added helper functions

This commit is contained in:
SpaceToad 2014-05-10 07:41:22 +02:00
parent b2f8cf102d
commit 178d82ef9f

View file

@ -67,6 +67,18 @@ public class MappingRegistry {
return itemToId.get(item);
}
public int itemIdWorldToRegistry(int id) {
Item item = Item.getItemById(id);
return getIdForItem(item);
}
public int itemIdRegistryToWorld(int id) {
Item item = getItemForId(id);
return Item.getIdFromItem(item);
}
public Block getBlockForId(int id) {
if (id >= idToBlock.size()) {
return null;
@ -83,6 +95,18 @@ public class MappingRegistry {
return blockToId.get(block);
}
public int blockIdWorldToRegistry(int id) {
Block block = Block.getBlockById(id);
return getIdForBlock(block);
}
public int blockIdRegistryToWorld(int id) {
Block block = getBlockForId(id);
return Block.getIdFromBlock(block);
}
public Class<? extends Entity> getEntityForId(int id) {
if (id >= idToEntity.size()) {
return null;