From d9b8285a351fd312ee0b5f381080da1bf7c1e58c Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Thu, 3 Nov 2011 18:34:20 +0100 Subject: [PATCH] Made ItemType.usesDamageValue a bit more sane. --- .../com/sk89q/worldedit/blocks/ItemType.java | 81 +++++++++++++++++-- 1 file changed, 75 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/blocks/ItemType.java b/src/main/java/com/sk89q/worldedit/blocks/ItemType.java index cda0d5e66..d70c6bd69 100644 --- a/src/main/java/com/sk89q/worldedit/blocks/ItemType.java +++ b/src/main/java/com/sk89q/worldedit/blocks/ItemType.java @@ -558,6 +558,80 @@ public enum ItemType { return shouldNotStack.contains(id); } + private static final Set usesDamageValue = new HashSet(); + static { + usesDamageValue.add(BlockID.SAPLING); + //usesDamageValue.add(BlockID.WATER); + //usesDamageValue.add(BlockID.STATIONARY_WATER); + //usesDamageValue.add(BlockID.LAVA); + //usesDamageValue.add(BlockID.STATIONARY_LAVA); + usesDamageValue.add(BlockID.LOG); + usesDamageValue.add(BlockID.LEAVES); + //usesDamageValue.add(BlockID.DISPENSER); + //usesDamageValue.add(BlockID.BED); + //usesDamageValue.add(BlockID.POWERED_RAIL); + //usesDamageValue.add(BlockID.DETECTOR_RAIL); + //usesDamageValue.add(BlockID.PISTON_STICKY_BASE); + //usesDamageValue.add(BlockID.LONG_GRASS); + //usesDamageValue.add(BlockID.PISTON_BASE); + //usesDamageValue.add(BlockID.PISTON_EXTENSION); + usesDamageValue.add(BlockID.CLOTH); + usesDamageValue.add(BlockID.DOUBLE_STEP); + usesDamageValue.add(BlockID.STEP); + //usesDamageValue.add(BlockID.TORCH); + //usesDamageValue.add(BlockID.FIRE); + //usesDamageValue.add(BlockID.WOODEN_STAIRS); + //usesDamageValue.add(BlockID.CHEST); + //usesDamageValue.add(BlockID.REDSTONE_WIRE); + //usesDamageValue.add(BlockID.CROPS); + //usesDamageValue.add(BlockID.SOIL); + //usesDamageValue.add(BlockID.FURNACE); + //usesDamageValue.add(BlockID.BURNING_FURNACE); + //usesDamageValue.add(BlockID.SIGN_POST); + //usesDamageValue.add(BlockID.WOODEN_DOOR); + //usesDamageValue.add(BlockID.LADDER); + //usesDamageValue.add(BlockID.MINECART_TRACKS); + //usesDamageValue.add(BlockID.COBBLESTONE_STAIRS); + //usesDamageValue.add(BlockID.WALL_SIGN); + //usesDamageValue.add(BlockID.LEVER); + //usesDamageValue.add(BlockID.STONE_PRESSURE_PLATE); + //usesDamageValue.add(BlockID.IRON_DOOR); + //usesDamageValue.add(BlockID.WOODEN_PRESSURE_PLATE); + //usesDamageValue.add(BlockID.REDSTONE_TORCH_OFF); + //usesDamageValue.add(BlockID.REDSTONE_TORCH_ON); + //usesDamageValue.add(BlockID.STONE_BUTTON); + //usesDamageValue.add(BlockID.SNOW); + //usesDamageValue.add(BlockID.CACTUS); + //usesDamageValue.add(BlockID.REED); + //usesDamageValue.add(BlockID.JUKEBOX); + //usesDamageValue.add(BlockID.PUMPKIN); + //usesDamageValue.add(BlockID.JACKOLANTERN); + //usesDamageValue.add(BlockID.CAKE_BLOCK); + //usesDamageValue.add(BlockID.REDSTONE_REPEATER_OFF); + //usesDamageValue.add(BlockID.REDSTONE_REPEATER_ON); + //usesDamageValue.add(BlockID.TRAP_DOOR); + //usesDamageValue.add(BlockID.SILVERFISH_BLOCK); + usesDamageValue.add(BlockID.STONE_BRICK); + //usesDamageValue.add(BlockID.RED_MUSHROOM_CAP); + //usesDamageValue.add(BlockID.BROWN_MUSHROOM_CAP); + //usesDamageValue.add(BlockID.PUMPKIN_STEM); + //usesDamageValue.add(BlockID.MELON_STEM); + //usesDamageValue.add(BlockID.VINE); + //usesDamageValue.add(BlockID.FENCE_GATE); + //usesDamageValue.add(BlockID.BRICK_STAIRS); + //usesDamageValue.add(BlockID.STONE_BRICK_STAIRS); + //usesDamageValue.add(BlockID.NETHER_BRICK_STAIRS); + //usesDamageValue.add(BlockID.NETHER_WART); + //usesDamageValue.add(BlockID.ENCHANTMENT_TABLE); + //usesDamageValue.add(BlockID.BREWING_STAND); + //usesDamageValue.add(BlockID.CAULDRON); + //usesDamageValue.add(BlockID.END_PORTAL_FRAME); + usesDamageValue.add(ItemID.COAL); + usesDamageValue.add(ItemID.INK_SACK); + usesDamageValue.add(ItemID.POTION); + usesDamageValue.add(ItemID.GLASS_BOTTLE); + } + /** * Returns true if an item uses its damage value for something * other than damage. @@ -566,11 +640,6 @@ public enum ItemType { * @return */ public static boolean usesDamageValue(int id) { - return id == ItemID.COAL - || id == ItemID.INK_SACK - || id == ItemID.POTION - || id == ItemID.GLASS_BOTTLE - // for material only, orientation data is not stored in inventory anyway - || BlockType.usesData(id); + return usesDamageValue.contains(id); } }