Added BlockType.getBlockForItem.

This commit is contained in:
TomyLobo 2013-11-17 16:15:22 +01:00
parent 1a96847f88
commit 66253ff891

View File

@ -283,6 +283,39 @@ public enum BlockType {
} }
} }
private static Map<Integer, BaseBlock> itemBlockMapping = new HashMap<Integer, BaseBlock>();
static {
itemBlockMapping.put(ItemID.FLINT_AND_TINDER, new BaseBlock(BlockID.FIRE, -1));
itemBlockMapping.put(ItemID.STRING, new BaseBlock(BlockID.TRIPWIRE, -1));
itemBlockMapping.put(ItemID.SEEDS, new BaseBlock(BlockID.CROPS, -1));
itemBlockMapping.put(ItemID.SIGN, new BaseBlock(BlockID.SIGN_POST, -1));
itemBlockMapping.put(ItemID.WOODEN_DOOR_ITEM, new BaseBlock(BlockID.WOODEN_DOOR, -1));
itemBlockMapping.put(ItemID.WATER_BUCKET, new BaseBlock(BlockID.STATIONARY_WATER, -1));
itemBlockMapping.put(ItemID.LAVA_BUCKET, new BaseBlock(BlockID.STATIONARY_LAVA, -1));
itemBlockMapping.put(ItemID.IRON_DOOR_ITEM, new BaseBlock(BlockID.IRON_DOOR, -1));
itemBlockMapping.put(ItemID.REDSTONE_DUST, new BaseBlock(BlockID.REDSTONE_WIRE, -1));
itemBlockMapping.put(ItemID.SUGAR_CANE_ITEM, new BaseBlock(BlockID.REED, -1));
itemBlockMapping.put(ItemID.BED_ITEM, new BaseBlock(BlockID.BED, -1));
itemBlockMapping.put(ItemID.REDSTONE_REPEATER, new BaseBlock(BlockID.REDSTONE_REPEATER_OFF, -1));
itemBlockMapping.put(ItemID.PUMPKIN_SEEDS, new BaseBlock(BlockID.PUMPKIN_STEM, -1));
itemBlockMapping.put(ItemID.MELON_SEEDS, new BaseBlock(BlockID.MELON_STEM, -1));
itemBlockMapping.put(ItemID.NETHER_WART_SEED, new BaseBlock(BlockID.NETHER_WART, -1));
itemBlockMapping.put(ItemID.BREWING_STAND, new BaseBlock(BlockID.BREWING_STAND, -1));
itemBlockMapping.put(ItemID.CAULDRON, new BaseBlock(BlockID.CAULDRON, -1));
itemBlockMapping.put(ItemID.FLOWER_POT, new BaseBlock(BlockID.FLOWER_POT, -1));
itemBlockMapping.put(ItemID.CARROT, new BaseBlock(BlockID.CARROTS, -1));
itemBlockMapping.put(ItemID.POTATO, new BaseBlock(BlockID.POTATOES, -1));
itemBlockMapping.put(ItemID.COMPARATOR, new BaseBlock(BlockID.COMPARATOR_OFF, -1));
// These are just for fun:
itemBlockMapping.put(ItemID.BUCKET, new BaseBlock(BlockID.AIR, -1)); // There's nothing in the bucket, what did you expect?
itemBlockMapping.put(ItemID.MILK_BUCKET, new BaseBlock(BlockID.SNOW, -1)); // Whoops, spilled the milk
}
public static BaseBlock getBlockForItem(int typeId) {
return itemBlockMapping.get(typeId);
}
/** /**
* Get block numeric ID. * Get block numeric ID.
* *