added helper functions
This commit is contained in:
parent
b2f8cf102d
commit
178d82ef9f
1 changed files with 24 additions and 0 deletions
|
@ -67,6 +67,18 @@ public class MappingRegistry {
|
||||||
return itemToId.get(item);
|
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) {
|
public Block getBlockForId(int id) {
|
||||||
if (id >= idToBlock.size()) {
|
if (id >= idToBlock.size()) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -83,6 +95,18 @@ public class MappingRegistry {
|
||||||
return blockToId.get(block);
|
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) {
|
public Class<? extends Entity> getEntityForId(int id) {
|
||||||
if (id >= idToEntity.size()) {
|
if (id >= idToEntity.size()) {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue