From f5f1d357d903b3cfb954f4fdccf24b1194d84504 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 3 Jan 2018 16:39:03 +1000 Subject: [PATCH] Get rid of the string equality and convert a few more ID uses over. --- .../EditSessionBlockChangeDelegate.java | 5 +- .../sk89q/worldedit/blocks/SkullBlock.java | 2 +- .../com/sk89q/worldedit/blocks/BaseBlock.java | 2 +- .../worldedit/blocks/type/BlockType.java | 1 + .../worldedit/blocks/type/BlockTypes.java | 553 +++++++++++++++++- .../worldedit/command/BrushCommands.java | 5 +- .../worldedit/command/tool/AreaPickaxe.java | 15 +- .../command/tool/FloatingTreeRemover.java | 3 +- .../worldedit/command/tool/QueryTool.java | 8 +- .../command/tool/RecursivePickaxe.java | 16 +- .../command/tool/brush/CylinderBrush.java | 3 +- .../command/tool/brush/GravityBrush.java | 4 +- .../tool/brush/HollowCylinderBrush.java | 3 +- .../command/tool/brush/HollowSphereBrush.java | 3 +- .../command/tool/brush/SphereBrush.java | 3 +- .../sk89q/worldedit/extent/NullExtent.java | 5 +- .../extent/buffer/ForgetfulExtentBuffer.java | 3 +- .../extent/clipboard/BlockArrayClipboard.java | 3 +- .../SignCompatibilityHandler.java | 3 +- .../extent/reorder/MultiStageReorder.java | 3 +- .../validation/DataValidatorExtent.java | 5 +- .../extent/world/BlockQuirkExtent.java | 3 +- .../extent/world/SurvivalModeExtent.java | 2 +- .../function/block/ExtentBlockCopy.java | 2 +- .../worldedit/function/block/Naturalizer.java | 8 +- .../function/generator/FloraGenerator.java | 16 +- .../function/generator/ForestGenerator.java | 14 +- .../generator/GardenPatchGenerator.java | 22 +- .../function/mask/ExistingBlockMask.java | 2 +- .../worldedit/math/convolution/HeightMap.java | 7 +- .../worldedit/regions/RegionIntersection.java | 4 +- .../regions/shape/ArbitraryShape.java | 3 +- .../sk89q/worldedit/util/TreeGenerator.java | 5 +- .../util/formatting/ColorCodeBuilder.java | 5 +- .../sk89q/worldedit/world/AbstractWorld.java | 11 +- .../com/sk89q/worldedit/world/NullWorld.java | 6 +- .../world/storage/LegacyChunkStore.java | 6 +- .../world/storage/McRegionChunkStore.java | 5 +- .../sk89q/worldedit/sponge/SpongePlayer.java | 4 +- 39 files changed, 658 insertions(+), 115 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java index c3d1b2059..8eeb38e55 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java @@ -20,6 +20,7 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockTypes; import org.bukkit.BlockChangeDelegate; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.Vector; @@ -67,7 +68,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate { @Override public int getTypeId(int x, int y, int z) { - return editSession.getBlockType(new Vector(x, y, z)); + return editSession.getBlock(new Vector(x, y, z)).getId(); } @Override @@ -77,7 +78,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate { @Override public boolean isEmpty(int x, int y, int z) { - return editSession.getBlockType(new Vector(x, y, z)) == BlockID.AIR; + return editSession.getBlock(new Vector(x, y, z)).isAir(); } } diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java index d440ee0f7..6f7024c28 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java +++ b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java @@ -100,7 +100,7 @@ public class SkullBlock extends BaseBlock implements TileEntityBlock { if (owner.length() > 16 || owner.isEmpty()) this.owner = ""; else this.owner = owner; } - if (this.owner != null && !this.owner.isEmpty()) this.skullType = (byte) 3; + if (!this.owner.isEmpty()) this.skullType = (byte) 3; } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java index 398cc392b..9a9759bb1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java @@ -318,7 +318,7 @@ public class BaseBlock extends Block implements TileEntityBlock { * @return if air */ public boolean isAir() { - return getType().getId().equals(BlockTypes.AIR); + return getType() == BlockTypes.AIR; } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/type/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/type/BlockType.java index c973f3b29..5625d6bdd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/type/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/type/BlockType.java @@ -50,6 +50,7 @@ public class BlockType { } } + @Deprecated public com.sk89q.worldedit.blocks.BlockType getLegacyType() { return com.sk89q.worldedit.blocks.BlockType.fromID(getLegacyId()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/type/BlockTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/type/BlockTypes.java index 9c91fd50e..21dc523db 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/type/BlockTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/type/BlockTypes.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.blocks.type; +import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; @@ -32,20 +33,552 @@ public class BlockTypes { private BlockTypes() { } - public static final String AIR = "minecraft:air"; - public static final String GRASS = "minecraft:grass"; - public static final String WATER = "minecraft:water"; - public static final String LAVA = "minecraft:lava"; - public static final String WOOL = "minecraft:wool"; - public static final String STATIONARY_WATER = "minecraft:stationary_water"; - public static final String STATIONARY_LAVA = "minecraft:stationary_lava"; - public static final String WALL_SIGN = "minecraft:wall_sign"; - public static final String SIGN_POST = "minecraft:sign_post"; + public static final BlockType AIR = new BlockType("minecraft:air"); + public static final BlockType STONE = new BlockType("minecraft:stone"); + public static final BlockType GRANITE = new BlockType("minecraft:granite"); + public static final BlockType POLISHED_GRANITE = new BlockType("minecraft:polished_granite"); + public static final BlockType DIORITE = new BlockType("minecraft:diorite"); + public static final BlockType POLISHED_DIORITE = new BlockType("minecraft:polished_diorite"); + public static final BlockType ANDESITE = new BlockType("minecraft:andesite"); + public static final BlockType POLISHED_ANDESITE = new BlockType("minecraft:polished_andesite"); + public static final BlockType GRASS_BLOCK = new BlockType("minecraft:grass_block"); + public static final BlockType DIRT = new BlockType("minecraft:dirt"); + public static final BlockType COARSE_DIRT = new BlockType("minecraft:coarse_dirt"); + public static final BlockType PODZOL = new BlockType("minecraft:podzol"); + public static final BlockType COBBLESTONE = new BlockType("minecraft:cobblestone"); + public static final BlockType OAK_PLANKS = new BlockType("minecraft:oak_planks"); + public static final BlockType SPRUCE_PLANKS = new BlockType("minecraft:spruce_planks"); + public static final BlockType BIRCH_PLANKS = new BlockType("minecraft:birch_planks"); + public static final BlockType JUNGLE_PLANKS = new BlockType("minecraft:jungle_planks"); + public static final BlockType ACACIA_PLANKS = new BlockType("minecraft:acacia_planks"); + public static final BlockType DARK_OAK_PLANKS = new BlockType("minecraft:dark_oak_planks"); + public static final BlockType OAK_SAPLING = new BlockType("minecraft:oak_sapling"); + public static final BlockType SPRUCE_SAPLING = new BlockType("minecraft:spruce_sapling"); + public static final BlockType BIRCH_SAPLING = new BlockType("minecraft:birch_sapling"); + public static final BlockType JUNGLE_SAPLING = new BlockType("minecraft:jungle_sapling"); + public static final BlockType ACACIA_SAPLING = new BlockType("minecraft:acacia_sapling"); + public static final BlockType DARK_OAK_SAPLING = new BlockType("minecraft:dark_oak_sapling"); + public static final BlockType BEDROCK = new BlockType("minecraft:bedrock"); + public static final BlockType FLOWING_WATER = new BlockType("minecraft:flowing_water"); + public static final BlockType WATER = new BlockType("minecraft:water"); + public static final BlockType FLOWING_LAVA = new BlockType("minecraft:flowing_lava"); + public static final BlockType LAVA = new BlockType("minecraft:lava"); + public static final BlockType SAND = new BlockType("minecraft:sand"); + public static final BlockType RED_SAND = new BlockType("minecraft:red_sand"); + public static final BlockType GRAVEL = new BlockType("minecraft:gravel"); + public static final BlockType GOLD_ORE = new BlockType("minecraft:gold_ore"); + public static final BlockType IRON_ORE = new BlockType("minecraft:iron_ore"); + public static final BlockType COAL_ORE = new BlockType("minecraft:coal_ore"); + public static final BlockType OAK_LOG = new BlockType("minecraft:oak_log"); + public static final BlockType SPRUCE_LOG = new BlockType("minecraft:spruce_log"); + public static final BlockType BIRCH_LOG = new BlockType("minecraft:birch_log"); + public static final BlockType JUNGLE_LOG = new BlockType("minecraft:jungle_log"); + public static final BlockType ACACIA_LOG = new BlockType("minecraft:acacia_log"); + public static final BlockType DARK_OAK_LOG = new BlockType("minecraft:dark_oak_log"); + public static final BlockType OAK_BARK = new BlockType("minecraft:oak_bark"); + public static final BlockType SPRUCE_BARK = new BlockType("minecraft:spruce_bark"); + public static final BlockType BIRCH_BARK = new BlockType("minecraft:birch_bark"); + public static final BlockType JUNGLE_BARK = new BlockType("minecraft:jungle_bark"); + public static final BlockType ACACIA_BARK = new BlockType("minecraft:acacia_bark"); + public static final BlockType DARK_OAK_BARK = new BlockType("minecraft:dark_oak_bark"); + public static final BlockType OAK_LEAVES = new BlockType("minecraft:oak_leaves"); + public static final BlockType SPRUCE_LEAVES = new BlockType("minecraft:spruce_leaves"); + public static final BlockType BIRCH_LEAVES = new BlockType("minecraft:birch_leaves"); + public static final BlockType JUNGLE_LEAVES = new BlockType("minecraft:jungle_leaves"); + public static final BlockType ACACIA_LEAVES = new BlockType("minecraft:acacia_leaves"); + public static final BlockType DARK_OAK_LEAVES = new BlockType("minecraft:dark_oak_leaves"); + public static final BlockType SPONGE = new BlockType("minecraft:sponge"); + public static final BlockType WET_SPONGE = new BlockType("minecraft:wet_sponge"); + public static final BlockType GLASS = new BlockType("minecraft:glass"); + public static final BlockType LAPIS_ORE = new BlockType("minecraft:lapis_ore"); + public static final BlockType LAPIS_BLOCK = new BlockType("minecraft:lapis_block"); + public static final BlockType DISPENSER = new BlockType("minecraft:dispenser"); + public static final BlockType SANDSTONE = new BlockType("minecraft:sandstone"); + public static final BlockType CHISELED_SANDSTONE = new BlockType("minecraft:chiseled_sandstone"); + public static final BlockType CUT_SANDSTONE = new BlockType("minecraft:cut_sandstone"); + public static final BlockType NOTE_BLOCK = new BlockType("minecraft:note_block"); + public static final BlockType WHITE_BED = new BlockType("minecraft:white_bed"); + public static final BlockType ORANGE_BED = new BlockType("minecraft:orange_bed"); + public static final BlockType MAGENTA_BED = new BlockType("minecraft:magenta_bed"); + public static final BlockType LIGHT_BLUE_BED = new BlockType("minecraft:light_blue_bed"); + public static final BlockType YELLOW_BED = new BlockType("minecraft:yellow_bed"); + public static final BlockType LIME_BED = new BlockType("minecraft:lime_bed"); + public static final BlockType PINK_BED = new BlockType("minecraft:pink_bed"); + public static final BlockType GRAY_BED = new BlockType("minecraft:gray_bed"); + public static final BlockType LIGHT_GRAY_BED = new BlockType("minecraft:light_gray_bed"); + public static final BlockType CYAN_BED = new BlockType("minecraft:cyan_bed"); + public static final BlockType PURPLE_BED = new BlockType("minecraft:purple_bed"); + public static final BlockType BLUE_BED = new BlockType("minecraft:blue_bed"); + public static final BlockType BROWN_BED = new BlockType("minecraft:brown_bed"); + public static final BlockType GREEN_BED = new BlockType("minecraft:green_bed"); + public static final BlockType RED_BED = new BlockType("minecraft:red_bed"); + public static final BlockType BLACK_BED = new BlockType("minecraft:black_bed"); + public static final BlockType POWERED_RAIL = new BlockType("minecraft:powered_rail"); + public static final BlockType DETECTOR_RAIL = new BlockType("minecraft:detector_rail"); + public static final BlockType STICKY_PISTON = new BlockType("minecraft:sticky_piston"); + public static final BlockType COBWEB = new BlockType("minecraft:cobweb"); + public static final BlockType GRASS = new BlockType("minecraft:grass"); + public static final BlockType FERN = new BlockType("minecraft:fern"); + public static final BlockType DEAD_BUSH = new BlockType("minecraft:dead_bush"); + public static final BlockType PISTON = new BlockType("minecraft:piston"); + public static final BlockType PISTON_HEAD = new BlockType("minecraft:piston_head"); + public static final BlockType WHITE_WOOL = new BlockType("minecraft:white_wool"); + public static final BlockType ORANGE_WOOL = new BlockType("minecraft:orange_wool"); + public static final BlockType MAGENTA_WOOL = new BlockType("minecraft:magenta_wool"); + public static final BlockType LIGHT_BLUE_WOOL = new BlockType("minecraft:light_blue_wool"); + public static final BlockType YELLOW_WOOL = new BlockType("minecraft:yellow_wool"); + public static final BlockType LIME_WOOL = new BlockType("minecraft:lime_wool"); + public static final BlockType PINK_WOOL = new BlockType("minecraft:pink_wool"); + public static final BlockType GRAY_WOOL = new BlockType("minecraft:gray_wool"); + public static final BlockType LIGHT_GRAY_WOOL = new BlockType("minecraft:light_gray_wool"); + public static final BlockType CYAN_WOOL = new BlockType("minecraft:cyan_wool"); + public static final BlockType PURPLE_WOOL = new BlockType("minecraft:purple_wool"); + public static final BlockType BLUE_WOOL = new BlockType("minecraft:blue_wool"); + public static final BlockType BROWN_WOOL = new BlockType("minecraft:brown_wool"); + public static final BlockType GREEN_WOOL = new BlockType("minecraft:green_wool"); + public static final BlockType RED_WOOL = new BlockType("minecraft:red_wool"); + public static final BlockType BLACK_WOOL = new BlockType("minecraft:black_wool"); + public static final BlockType MOVING_PISTON = new BlockType("minecraft:moving_piston"); + public static final BlockType DANDELION = new BlockType("minecraft:dandelion"); + public static final BlockType POPPY = new BlockType("minecraft:poppy"); + public static final BlockType BLUE_ORCHID = new BlockType("minecraft:blue_orchid"); + public static final BlockType ALLIUM = new BlockType("minecraft:allium"); + public static final BlockType AZURE_BLUET = new BlockType("minecraft:azure_bluet"); + public static final BlockType RED_TULIP = new BlockType("minecraft:red_tulip"); + public static final BlockType ORANGE_TULIP = new BlockType("minecraft:orange_tulip"); + public static final BlockType WHITE_TULIP = new BlockType("minecraft:white_tulip"); + public static final BlockType PINK_TULIP = new BlockType("minecraft:pink_tulip"); + public static final BlockType OXEYE_DAISY = new BlockType("minecraft:oxeye_daisy"); + public static final BlockType BROWN_MUSHROOM = new BlockType("minecraft:brown_mushroom"); + public static final BlockType RED_MUSHROOM = new BlockType("minecraft:red_mushroom"); + public static final BlockType GOLD_BLOCK = new BlockType("minecraft:gold_block"); + public static final BlockType IRON_BLOCK = new BlockType("minecraft:iron_block"); + public static final BlockType BRICKS = new BlockType("minecraft:bricks"); + public static final BlockType TNT = new BlockType("minecraft:tnt"); + public static final BlockType BOOKSHELF = new BlockType("minecraft:bookshelf"); + public static final BlockType MOSSY_COBBLESTONE = new BlockType("minecraft:mossy_cobblestone"); + public static final BlockType OBSIDIAN = new BlockType("minecraft:obsidian"); + public static final BlockType TORCH = new BlockType("minecraft:torch"); + public static final BlockType WALL_TORCH = new BlockType("minecraft:wall_torch"); + public static final BlockType FIRE = new BlockType("minecraft:fire"); + public static final BlockType MOB_SPAWNER = new BlockType("minecraft:mob_spawner"); + public static final BlockType OAK_STAIRS = new BlockType("minecraft:oak_stairs"); + public static final BlockType CHEST = new BlockType("minecraft:chest"); + public static final BlockType REDSTONE_WIRE = new BlockType("minecraft:redstone_wire"); + public static final BlockType DIAMOND_ORE = new BlockType("minecraft:diamond_ore"); + public static final BlockType DIAMOND_BLOCK = new BlockType("minecraft:diamond_block"); + public static final BlockType CRAFTING_TABLE = new BlockType("minecraft:crafting_table"); + public static final BlockType WHEAT = new BlockType("minecraft:wheat"); + public static final BlockType FARMLAND = new BlockType("minecraft:farmland"); + public static final BlockType FURNACE = new BlockType("minecraft:furnace"); + public static final BlockType SIGN = new BlockType("minecraft:sign"); + public static final BlockType OAK_DOOR = new BlockType("minecraft:oak_door"); + public static final BlockType LADDER = new BlockType("minecraft:ladder"); + public static final BlockType RAIL = new BlockType("minecraft:rail"); + public static final BlockType COBBLESTONE_STAIRS = new BlockType("minecraft:cobblestone_stairs"); + public static final BlockType WALL_SIGN = new BlockType("minecraft:wall_sign"); + public static final BlockType LEVER = new BlockType("minecraft:lever"); + public static final BlockType STONE_PRESSURE_PLATE = new BlockType("minecraft:stone_pressure_plate"); + public static final BlockType IRON_DOOR = new BlockType("minecraft:iron_door"); + public static final BlockType OAK_PRESSURE_PLATE = new BlockType("minecraft:oak_pressure_plate"); + public static final BlockType SPRUCE_PRESSURE_PLATE = new BlockType("minecraft:spruce_pressure_plate"); + public static final BlockType BIRCH_PRESSURE_PLATE = new BlockType("minecraft:birch_pressure_plate"); + public static final BlockType JUNGLE_PRESSURE_PLATE = new BlockType("minecraft:jungle_pressure_plate"); + public static final BlockType ACACIA_PRESSURE_PLATE = new BlockType("minecraft:acacia_pressure_plate"); + public static final BlockType DARK_OAK_PRESSURE_PLATE = new BlockType("minecraft:dark_oak_pressure_plate"); + public static final BlockType REDSTONE_ORE = new BlockType("minecraft:redstone_ore"); + public static final BlockType REDSTONE_TORCH = new BlockType("minecraft:redstone_torch"); + public static final BlockType REDSTONE_WALL_TORCH = new BlockType("minecraft:redstone_wall_torch"); + public static final BlockType STONE_BUTTON = new BlockType("minecraft:stone_button"); + public static final BlockType SNOW = new BlockType("minecraft:snow"); + public static final BlockType ICE = new BlockType("minecraft:ice"); + public static final BlockType SNOW_BLOCK = new BlockType("minecraft:snow_block"); + public static final BlockType CACTUS = new BlockType("minecraft:cactus"); + public static final BlockType CLAY = new BlockType("minecraft:clay"); + public static final BlockType SUGAR_CANE = new BlockType("minecraft:sugar_cane"); + public static final BlockType JUKEBOX = new BlockType("minecraft:jukebox"); + public static final BlockType OAK_FENCE = new BlockType("minecraft:oak_fence"); + public static final BlockType PUMPKIN = new BlockType("minecraft:pumpkin"); + public static final BlockType NETHERRACK = new BlockType("minecraft:netherrack"); + public static final BlockType SOUL_SAND = new BlockType("minecraft:soul_sand"); + public static final BlockType GLOWSTONE = new BlockType("minecraft:glowstone"); + public static final BlockType PORTAL = new BlockType("minecraft:portal"); + public static final BlockType CARVED_PUMPKIN = new BlockType("minecraft:carved_pumpkin"); + public static final BlockType JACK_O_LANTERN = new BlockType("minecraft:jack_o_lantern"); + public static final BlockType CAKE = new BlockType("minecraft:cake"); + public static final BlockType REPEATER = new BlockType("minecraft:repeater"); + public static final BlockType WHITE_STAINED_GLASS = new BlockType("minecraft:white_stained_glass"); + public static final BlockType ORANGE_STAINED_GLASS = new BlockType("minecraft:orange_stained_glass"); + public static final BlockType MAGENTA_STAINED_GLASS = new BlockType("minecraft:magenta_stained_glass"); + public static final BlockType LIGHT_BLUE_STAINED_GLASS = new BlockType("minecraft:light_blue_stained_glass"); + public static final BlockType YELLOW_STAINED_GLASS = new BlockType("minecraft:yellow_stained_glass"); + public static final BlockType LIME_STAINED_GLASS = new BlockType("minecraft:lime_stained_glass"); + public static final BlockType PINK_STAINED_GLASS = new BlockType("minecraft:pink_stained_glass"); + public static final BlockType GRAY_STAINED_GLASS = new BlockType("minecraft:gray_stained_glass"); + public static final BlockType LIGHT_GRAY_STAINED_GLASS = new BlockType("minecraft:light_gray_stained_glass"); + public static final BlockType CYAN_STAINED_GLASS = new BlockType("minecraft:cyan_stained_glass"); + public static final BlockType PURPLE_STAINED_GLASS = new BlockType("minecraft:purple_stained_glass"); + public static final BlockType BLUE_STAINED_GLASS = new BlockType("minecraft:blue_stained_glass"); + public static final BlockType BROWN_STAINED_GLASS = new BlockType("minecraft:brown_stained_glass"); + public static final BlockType GREEN_STAINED_GLASS = new BlockType("minecraft:green_stained_glass"); + public static final BlockType RED_STAINED_GLASS = new BlockType("minecraft:red_stained_glass"); + public static final BlockType BLACK_STAINED_GLASS = new BlockType("minecraft:black_stained_glass"); + public static final BlockType OAK_TRAPDOOR = new BlockType("minecraft:oak_trapdoor"); + public static final BlockType SPRUCE_TRAPDOOR = new BlockType("minecraft:spruce_trapdoor"); + public static final BlockType BIRCH_TRAPDOOR = new BlockType("minecraft:birch_trapdoor"); + public static final BlockType JUNGLE_TRAPDOOR = new BlockType("minecraft:jungle_trapdoor"); + public static final BlockType ACACIA_TRAPDOOR = new BlockType("minecraft:acacia_trapdoor"); + public static final BlockType DARK_OAK_TRAPDOOR = new BlockType("minecraft:dark_oak_trapdoor"); + public static final BlockType INFESTED_STONE = new BlockType("minecraft:infested_stone"); + public static final BlockType INFESTED_COBBLESTONE = new BlockType("minecraft:infested_cobblestone"); + public static final BlockType INFESTED_STONE_BRICKS = new BlockType("minecraft:infested_stone_bricks"); + public static final BlockType INFESTED_MOSSY_STONE_BRICKS = new BlockType("minecraft:infested_mossy_stone_bricks"); + public static final BlockType INFESTED_CRACKED_STONE_BRICKS = new BlockType("minecraft:infested_cracked_stone_bricks"); + public static final BlockType INFESTED_CHISELED_STONE_BRICKS = new BlockType("minecraft:infested_chiseled_stone_bricks"); + public static final BlockType STONE_BRICKS = new BlockType("minecraft:stone_bricks"); + public static final BlockType MOSSY_STONE_BRICKS = new BlockType("minecraft:mossy_stone_bricks"); + public static final BlockType CRACKED_STONE_BRICKS = new BlockType("minecraft:cracked_stone_bricks"); + public static final BlockType CHISELED_STONE_BRICKS = new BlockType("minecraft:chiseled_stone_bricks"); + public static final BlockType BROWN_MUSHROOM_BLOCK = new BlockType("minecraft:brown_mushroom_block"); + public static final BlockType RED_MUSHROOM_BLOCK = new BlockType("minecraft:red_mushroom_block"); + public static final BlockType MUSHROOM_STEM = new BlockType("minecraft:mushroom_stem"); + public static final BlockType IRON_BARS = new BlockType("minecraft:iron_bars"); + public static final BlockType GLASS_PANE = new BlockType("minecraft:glass_pane"); + public static final BlockType MELON_BLOCK = new BlockType("minecraft:melon_block"); + public static final BlockType ATTACHED_PUMPKIN_STEM = new BlockType("minecraft:attached_pumpkin_stem"); + public static final BlockType ATTACHED_MELON_STEM = new BlockType("minecraft:attached_melon_stem"); + public static final BlockType PUMPKIN_STEM = new BlockType("minecraft:pumpkin_stem"); + public static final BlockType MELON_STEM = new BlockType("minecraft:melon_stem"); + public static final BlockType VINE = new BlockType("minecraft:vine"); + public static final BlockType OAK_FENCE_GATE = new BlockType("minecraft:oak_fence_gate"); + public static final BlockType BRICK_STAIRS = new BlockType("minecraft:brick_stairs"); + public static final BlockType STONE_BRICK_STAIRS = new BlockType("minecraft:stone_brick_stairs"); + public static final BlockType MYCELIUM = new BlockType("minecraft:mycelium"); + public static final BlockType LILY_PAD = new BlockType("minecraft:lily_pad"); + public static final BlockType NETHER_BRICKS = new BlockType("minecraft:nether_bricks"); + public static final BlockType NETHER_BRICK_FENCE = new BlockType("minecraft:nether_brick_fence"); + public static final BlockType NETHER_BRICK_STAIRS = new BlockType("minecraft:nether_brick_stairs"); + public static final BlockType NETHER_WART = new BlockType("minecraft:nether_wart"); + public static final BlockType ENCHANTING_TABLE = new BlockType("minecraft:enchanting_table"); + public static final BlockType BREWING_STAND = new BlockType("minecraft:brewing_stand"); + public static final BlockType CAULDRON = new BlockType("minecraft:cauldron"); + public static final BlockType END_PORTAL = new BlockType("minecraft:end_portal"); + public static final BlockType END_PORTAL_FRAME = new BlockType("minecraft:end_portal_frame"); + public static final BlockType END_STONE = new BlockType("minecraft:end_stone"); + public static final BlockType DRAGON_EGG = new BlockType("minecraft:dragon_egg"); + public static final BlockType REDSTONE_LAMP = new BlockType("minecraft:redstone_lamp"); + public static final BlockType COCOA = new BlockType("minecraft:cocoa"); + public static final BlockType SANDSTONE_STAIRS = new BlockType("minecraft:sandstone_stairs"); + public static final BlockType EMERALD_ORE = new BlockType("minecraft:emerald_ore"); + public static final BlockType ENDER_CHEST = new BlockType("minecraft:ender_chest"); + public static final BlockType TRIPWIRE_HOOK = new BlockType("minecraft:tripwire_hook"); + public static final BlockType TRIPWIRE = new BlockType("minecraft:tripwire"); + public static final BlockType EMERALD_BLOCK = new BlockType("minecraft:emerald_block"); + public static final BlockType SPRUCE_STAIRS = new BlockType("minecraft:spruce_stairs"); + public static final BlockType BIRCH_STAIRS = new BlockType("minecraft:birch_stairs"); + public static final BlockType JUNGLE_STAIRS = new BlockType("minecraft:jungle_stairs"); + public static final BlockType COMMAND_BLOCK = new BlockType("minecraft:command_block"); + public static final BlockType BEACON = new BlockType("minecraft:beacon"); + public static final BlockType COBBLESTONE_WALL = new BlockType("minecraft:cobblestone_wall"); + public static final BlockType MOSSY_COBBLESTONE_WALL = new BlockType("minecraft:mossy_cobblestone_wall"); + public static final BlockType FLOWER_POT = new BlockType("minecraft:flower_pot"); + public static final BlockType POTTED_OAK_SAPLING = new BlockType("minecraft:potted_oak_sapling"); + public static final BlockType POTTED_SPRUCE_SAPLING = new BlockType("minecraft:potted_spruce_sapling"); + public static final BlockType POTTED_BIRCH_SAPLING = new BlockType("minecraft:potted_birch_sapling"); + public static final BlockType POTTED_JUNGLE_SAPLING = new BlockType("minecraft:potted_jungle_sapling"); + public static final BlockType POTTED_ACACIA_SAPLING = new BlockType("minecraft:potted_acacia_sapling"); + public static final BlockType POTTED_DARK_OAK_SAPLING = new BlockType("minecraft:potted_dark_oak_sapling"); + public static final BlockType POTTED_FERN = new BlockType("minecraft:potted_fern"); + public static final BlockType POTTED_DANDELION = new BlockType("minecraft:potted_dandelion"); + public static final BlockType POTTED_POPPY = new BlockType("minecraft:potted_poppy"); + public static final BlockType POTTED_BLUE_ORCHID = new BlockType("minecraft:potted_blue_orchid"); + public static final BlockType POTTED_ALLIUM = new BlockType("minecraft:potted_allium"); + public static final BlockType POTTED_AZURE_BLUET = new BlockType("minecraft:potted_azure_bluet"); + public static final BlockType POTTED_RED_TULIP = new BlockType("minecraft:potted_red_tulip"); + public static final BlockType POTTED_ORANGE_TULIP = new BlockType("minecraft:potted_orange_tulip"); + public static final BlockType POTTED_WHITE_TULIP = new BlockType("minecraft:potted_white_tulip"); + public static final BlockType POTTED_PINK_TULIP = new BlockType("minecraft:potted_pink_tulip"); + public static final BlockType POTTED_OXEYE_DAISY = new BlockType("minecraft:potted_oxeye_daisy"); + public static final BlockType POTTED_RED_MUSHROOM = new BlockType("minecraft:potted_red_mushroom"); + public static final BlockType POTTED_BROWN_MUSHROOM = new BlockType("minecraft:potted_brown_mushroom"); + public static final BlockType POTTED_DEAD_BUSH = new BlockType("minecraft:potted_dead_bush"); + public static final BlockType POTTED_CACTUS = new BlockType("minecraft:potted_cactus"); + public static final BlockType CARROTS = new BlockType("minecraft:carrots"); + public static final BlockType POTATOES = new BlockType("minecraft:potatoes"); + public static final BlockType OAK_BUTTON = new BlockType("minecraft:oak_button"); + public static final BlockType SPRUCE_BUTTON = new BlockType("minecraft:spruce_button"); + public static final BlockType BIRCH_BUTTON = new BlockType("minecraft:birch_button"); + public static final BlockType JUNGLE_BUTTON = new BlockType("minecraft:jungle_button"); + public static final BlockType ACACIA_BUTTON = new BlockType("minecraft:acacia_button"); + public static final BlockType DARK_OAK_BUTTON = new BlockType("minecraft:dark_oak_button"); + public static final BlockType SKELETON_WALL_SKULL = new BlockType("minecraft:skeleton_wall_skull"); + public static final BlockType SKELETON_SKULL = new BlockType("minecraft:skeleton_skull"); + public static final BlockType WITHER_SKELETON_WALL_SKULL = new BlockType("minecraft:wither_skeleton_wall_skull"); + public static final BlockType WITHER_SKELETON_SKULL = new BlockType("minecraft:wither_skeleton_skull"); + public static final BlockType ZOMBIE_WALL_HEAD = new BlockType("minecraft:zombie_wall_head"); + public static final BlockType ZOMBIE_HEAD = new BlockType("minecraft:zombie_head"); + public static final BlockType PLAYER_WALL_HEAD = new BlockType("minecraft:player_wall_head"); + public static final BlockType PLAYER_HEAD = new BlockType("minecraft:player_head"); + public static final BlockType CREEPER_WALL_HEAD = new BlockType("minecraft:creeper_wall_head"); + public static final BlockType CREEPER_HEAD = new BlockType("minecraft:creeper_head"); + public static final BlockType DRAGON_WALL_HEAD = new BlockType("minecraft:dragon_wall_head"); + public static final BlockType DRAGON_HEAD = new BlockType("minecraft:dragon_head"); + public static final BlockType ANVIL = new BlockType("minecraft:anvil"); + public static final BlockType CHIPPED_ANVIL = new BlockType("minecraft:chipped_anvil"); + public static final BlockType DAMAGED_ANVIL = new BlockType("minecraft:damaged_anvil"); + public static final BlockType TRAPPED_CHEST = new BlockType("minecraft:trapped_chest"); + public static final BlockType LIGHT_WEIGHTED_PRESSURE_PLATE = new BlockType("minecraft:light_weighted_pressure_plate"); + public static final BlockType HEAVY_WEIGHTED_PRESSURE_PLATE = new BlockType("minecraft:heavy_weighted_pressure_plate"); + public static final BlockType COMPARATOR = new BlockType("minecraft:comparator"); + public static final BlockType DAYLIGHT_DETECTOR = new BlockType("minecraft:daylight_detector"); + public static final BlockType REDSTONE_BLOCK = new BlockType("minecraft:redstone_block"); + public static final BlockType NETHER_QUARTZ_ORE = new BlockType("minecraft:nether_quartz_ore"); + public static final BlockType HOPPER = new BlockType("minecraft:hopper"); + public static final BlockType QUARTZ_BLOCK = new BlockType("minecraft:quartz_block"); + public static final BlockType CHISELED_QUARTZ_BLOCK = new BlockType("minecraft:chiseled_quartz_block"); + public static final BlockType QUARTZ_PILLAR = new BlockType("minecraft:quartz_pillar"); + public static final BlockType QUARTZ_STAIRS = new BlockType("minecraft:quartz_stairs"); + public static final BlockType ACTIVATOR_RAIL = new BlockType("minecraft:activator_rail"); + public static final BlockType DROPPER = new BlockType("minecraft:dropper"); + public static final BlockType WHITE_TERRACOTTA = new BlockType("minecraft:white_terracotta"); + public static final BlockType ORANGE_TERRACOTTA = new BlockType("minecraft:orange_terracotta"); + public static final BlockType MAGENTA_TERRACOTTA = new BlockType("minecraft:magenta_terracotta"); + public static final BlockType LIGHT_BLUE_TERRACOTTA = new BlockType("minecraft:light_blue_terracotta"); + public static final BlockType YELLOW_TERRACOTTA = new BlockType("minecraft:yellow_terracotta"); + public static final BlockType LIME_TERRACOTTA = new BlockType("minecraft:lime_terracotta"); + public static final BlockType PINK_TERRACOTTA = new BlockType("minecraft:pink_terracotta"); + public static final BlockType GRAY_TERRACOTTA = new BlockType("minecraft:gray_terracotta"); + public static final BlockType LIGHT_GRAY_TERRACOTTA = new BlockType("minecraft:light_gray_terracotta"); + public static final BlockType CYAN_TERRACOTTA = new BlockType("minecraft:cyan_terracotta"); + public static final BlockType PURPLE_TERRACOTTA = new BlockType("minecraft:purple_terracotta"); + public static final BlockType BLUE_TERRACOTTA = new BlockType("minecraft:blue_terracotta"); + public static final BlockType BROWN_TERRACOTTA = new BlockType("minecraft:brown_terracotta"); + public static final BlockType GREEN_TERRACOTTA = new BlockType("minecraft:green_terracotta"); + public static final BlockType RED_TERRACOTTA = new BlockType("minecraft:red_terracotta"); + public static final BlockType BLACK_TERRACOTTA = new BlockType("minecraft:black_terracotta"); + public static final BlockType WHITE_STAINED_GLASS_PANE = new BlockType("minecraft:white_stained_glass_pane"); + public static final BlockType ORANGE_STAINED_GLASS_PANE = new BlockType("minecraft:orange_stained_glass_pane"); + public static final BlockType MAGENTA_STAINED_GLASS_PANE = new BlockType("minecraft:magenta_stained_glass_pane"); + public static final BlockType LIGHT_BLUE_STAINED_GLASS_PANE = new BlockType("minecraft:light_blue_stained_glass_pane"); + public static final BlockType YELLOW_STAINED_GLASS_PANE = new BlockType("minecraft:yellow_stained_glass_pane"); + public static final BlockType LIME_STAINED_GLASS_PANE = new BlockType("minecraft:lime_stained_glass_pane"); + public static final BlockType PINK_STAINED_GLASS_PANE = new BlockType("minecraft:pink_stained_glass_pane"); + public static final BlockType GRAY_STAINED_GLASS_PANE = new BlockType("minecraft:gray_stained_glass_pane"); + public static final BlockType LIGHT_GRAY_STAINED_GLASS_PANE = new BlockType("minecraft:light_gray_stained_glass_pane"); + public static final BlockType CYAN_STAINED_GLASS_PANE = new BlockType("minecraft:cyan_stained_glass_pane"); + public static final BlockType PURPLE_STAINED_GLASS_PANE = new BlockType("minecraft:purple_stained_glass_pane"); + public static final BlockType BLUE_STAINED_GLASS_PANE = new BlockType("minecraft:blue_stained_glass_pane"); + public static final BlockType BROWN_STAINED_GLASS_PANE = new BlockType("minecraft:brown_stained_glass_pane"); + public static final BlockType GREEN_STAINED_GLASS_PANE = new BlockType("minecraft:green_stained_glass_pane"); + public static final BlockType RED_STAINED_GLASS_PANE = new BlockType("minecraft:red_stained_glass_pane"); + public static final BlockType BLACK_STAINED_GLASS_PANE = new BlockType("minecraft:black_stained_glass_pane"); + public static final BlockType ACACIA_STAIRS = new BlockType("minecraft:acacia_stairs"); + public static final BlockType DARK_OAK_STAIRS = new BlockType("minecraft:dark_oak_stairs"); + public static final BlockType SLIME_BLOCK = new BlockType("minecraft:slime_block"); + public static final BlockType BARRIER = new BlockType("minecraft:barrier"); + public static final BlockType IRON_TRAPDOOR = new BlockType("minecraft:iron_trapdoor"); + public static final BlockType PRISMARINE = new BlockType("minecraft:prismarine"); + public static final BlockType PRISMARINE_BRICKS = new BlockType("minecraft:prismarine_bricks"); + public static final BlockType DARK_PRISMARINE = new BlockType("minecraft:dark_prismarine"); + public static final BlockType SEA_LANTERN = new BlockType("minecraft:sea_lantern"); + public static final BlockType HAY_BLOCK = new BlockType("minecraft:hay_block"); + public static final BlockType WHITE_CARPET = new BlockType("minecraft:white_carpet"); + public static final BlockType ORANGE_CARPET = new BlockType("minecraft:orange_carpet"); + public static final BlockType MAGENTA_CARPET = new BlockType("minecraft:magenta_carpet"); + public static final BlockType LIGHT_BLUE_CARPET = new BlockType("minecraft:light_blue_carpet"); + public static final BlockType YELLOW_CARPET = new BlockType("minecraft:yellow_carpet"); + public static final BlockType LIME_CARPET = new BlockType("minecraft:lime_carpet"); + public static final BlockType PINK_CARPET = new BlockType("minecraft:pink_carpet"); + public static final BlockType GRAY_CARPET = new BlockType("minecraft:gray_carpet"); + public static final BlockType LIGHT_GRAY_CARPET = new BlockType("minecraft:light_gray_carpet"); + public static final BlockType CYAN_CARPET = new BlockType("minecraft:cyan_carpet"); + public static final BlockType PURPLE_CARPET = new BlockType("minecraft:purple_carpet"); + public static final BlockType BLUE_CARPET = new BlockType("minecraft:blue_carpet"); + public static final BlockType BROWN_CARPET = new BlockType("minecraft:brown_carpet"); + public static final BlockType GREEN_CARPET = new BlockType("minecraft:green_carpet"); + public static final BlockType RED_CARPET = new BlockType("minecraft:red_carpet"); + public static final BlockType BLACK_CARPET = new BlockType("minecraft:black_carpet"); + public static final BlockType TERRACOTTA = new BlockType("minecraft:terracotta"); + public static final BlockType COAL_BLOCK = new BlockType("minecraft:coal_block"); + public static final BlockType PACKED_ICE = new BlockType("minecraft:packed_ice"); + public static final BlockType SUNFLOWER = new BlockType("minecraft:sunflower"); + public static final BlockType LILAC = new BlockType("minecraft:lilac"); + public static final BlockType ROSE_BUSH = new BlockType("minecraft:rose_bush"); + public static final BlockType PEONY = new BlockType("minecraft:peony"); + public static final BlockType TALL_GRASS = new BlockType("minecraft:tall_grass"); + public static final BlockType LARGE_FERN = new BlockType("minecraft:large_fern"); + public static final BlockType WHITE_BANNER = new BlockType("minecraft:white_banner"); + public static final BlockType ORANGE_BANNER = new BlockType("minecraft:orange_banner"); + public static final BlockType MAGENTA_BANNER = new BlockType("minecraft:magenta_banner"); + public static final BlockType LIGHT_BLUE_BANNER = new BlockType("minecraft:light_blue_banner"); + public static final BlockType YELLOW_BANNER = new BlockType("minecraft:yellow_banner"); + public static final BlockType LIME_BANNER = new BlockType("minecraft:lime_banner"); + public static final BlockType PINK_BANNER = new BlockType("minecraft:pink_banner"); + public static final BlockType GRAY_BANNER = new BlockType("minecraft:gray_banner"); + public static final BlockType LIGHT_GRAY_BANNER = new BlockType("minecraft:light_gray_banner"); + public static final BlockType CYAN_BANNER = new BlockType("minecraft:cyan_banner"); + public static final BlockType PURPLE_BANNER = new BlockType("minecraft:purple_banner"); + public static final BlockType BLUE_BANNER = new BlockType("minecraft:blue_banner"); + public static final BlockType BROWN_BANNER = new BlockType("minecraft:brown_banner"); + public static final BlockType GREEN_BANNER = new BlockType("minecraft:green_banner"); + public static final BlockType RED_BANNER = new BlockType("minecraft:red_banner"); + public static final BlockType BLACK_BANNER = new BlockType("minecraft:black_banner"); + public static final BlockType WHITE_WALL_BANNER = new BlockType("minecraft:white_wall_banner"); + public static final BlockType ORANGE_WALL_BANNER = new BlockType("minecraft:orange_wall_banner"); + public static final BlockType MAGENTA_WALL_BANNER = new BlockType("minecraft:magenta_wall_banner"); + public static final BlockType LIGHT_BLUE_WALL_BANNER = new BlockType("minecraft:light_blue_wall_banner"); + public static final BlockType YELLOW_WALL_BANNER = new BlockType("minecraft:yellow_wall_banner"); + public static final BlockType LIME_WALL_BANNER = new BlockType("minecraft:lime_wall_banner"); + public static final BlockType PINK_WALL_BANNER = new BlockType("minecraft:pink_wall_banner"); + public static final BlockType GRAY_WALL_BANNER = new BlockType("minecraft:gray_wall_banner"); + public static final BlockType LIGHT_GRAY_WALL_BANNER = new BlockType("minecraft:light_gray_wall_banner"); + public static final BlockType CYAN_WALL_BANNER = new BlockType("minecraft:cyan_wall_banner"); + public static final BlockType PURPLE_WALL_BANNER = new BlockType("minecraft:purple_wall_banner"); + public static final BlockType BLUE_WALL_BANNER = new BlockType("minecraft:blue_wall_banner"); + public static final BlockType BROWN_WALL_BANNER = new BlockType("minecraft:brown_wall_banner"); + public static final BlockType GREEN_WALL_BANNER = new BlockType("minecraft:green_wall_banner"); + public static final BlockType RED_WALL_BANNER = new BlockType("minecraft:red_wall_banner"); + public static final BlockType BLACK_WALL_BANNER = new BlockType("minecraft:black_wall_banner"); + public static final BlockType RED_SANDSTONE = new BlockType("minecraft:red_sandstone"); + public static final BlockType CHISELED_RED_SANDSTONE = new BlockType("minecraft:chiseled_red_sandstone"); + public static final BlockType CUT_RED_SANDSTONE = new BlockType("minecraft:cut_red_sandstone"); + public static final BlockType RED_SANDSTONE_STAIRS = new BlockType("minecraft:red_sandstone_stairs"); + public static final BlockType OAK_SLAB = new BlockType("minecraft:oak_slab"); + public static final BlockType SPRUCE_SLAB = new BlockType("minecraft:spruce_slab"); + public static final BlockType BIRCH_SLAB = new BlockType("minecraft:birch_slab"); + public static final BlockType JUNGLE_SLAB = new BlockType("minecraft:jungle_slab"); + public static final BlockType ACACIA_SLAB = new BlockType("minecraft:acacia_slab"); + public static final BlockType DARK_OAK_SLAB = new BlockType("minecraft:dark_oak_slab"); + public static final BlockType STONE_SLAB = new BlockType("minecraft:stone_slab"); + public static final BlockType SANDSTONE_SLAB = new BlockType("minecraft:sandstone_slab"); + public static final BlockType PETRIFIED_OAK_SLAB = new BlockType("minecraft:petrified_oak_slab"); + public static final BlockType COBBLESTONE_SLAB = new BlockType("minecraft:cobblestone_slab"); + public static final BlockType BRICK_SLAB = new BlockType("minecraft:brick_slab"); + public static final BlockType STONE_BRICK_SLAB = new BlockType("minecraft:stone_brick_slab"); + public static final BlockType NETHER_BRICK_SLAB = new BlockType("minecraft:nether_brick_slab"); + public static final BlockType QUARTZ_SLAB = new BlockType("minecraft:quartz_slab"); + public static final BlockType RED_SANDSTONE_SLAB = new BlockType("minecraft:red_sandstone_slab"); + public static final BlockType PURPUR_SLAB = new BlockType("minecraft:purpur_slab"); + public static final BlockType SMOOTH_STONE = new BlockType("minecraft:smooth_stone"); + public static final BlockType SMOOTH_SANDSTONE = new BlockType("minecraft:smooth_sandstone"); + public static final BlockType SMOOTH_QUARTZ = new BlockType("minecraft:smooth_quartz"); + public static final BlockType SMOOTH_RED_SANDSTONE = new BlockType("minecraft:smooth_red_sandstone"); + public static final BlockType SPRUCE_FENCE_GATE = new BlockType("minecraft:spruce_fence_gate"); + public static final BlockType BIRCH_FENCE_GATE = new BlockType("minecraft:birch_fence_gate"); + public static final BlockType JUNGLE_FENCE_GATE = new BlockType("minecraft:jungle_fence_gate"); + public static final BlockType ACACIA_FENCE_GATE = new BlockType("minecraft:acacia_fence_gate"); + public static final BlockType DARK_OAK_FENCE_GATE = new BlockType("minecraft:dark_oak_fence_gate"); + public static final BlockType SPRUCE_FENCE = new BlockType("minecraft:spruce_fence"); + public static final BlockType BIRCH_FENCE = new BlockType("minecraft:birch_fence"); + public static final BlockType JUNGLE_FENCE = new BlockType("minecraft:jungle_fence"); + public static final BlockType ACACIA_FENCE = new BlockType("minecraft:acacia_fence"); + public static final BlockType DARK_OAK_FENCE = new BlockType("minecraft:dark_oak_fence"); + public static final BlockType SPRUCE_DOOR = new BlockType("minecraft:spruce_door"); + public static final BlockType BIRCH_DOOR = new BlockType("minecraft:birch_door"); + public static final BlockType JUNGLE_DOOR = new BlockType("minecraft:jungle_door"); + public static final BlockType ACACIA_DOOR = new BlockType("minecraft:acacia_door"); + public static final BlockType DARK_OAK_DOOR = new BlockType("minecraft:dark_oak_door"); + public static final BlockType END_ROD = new BlockType("minecraft:end_rod"); + public static final BlockType CHORUS_PLANT = new BlockType("minecraft:chorus_plant"); + public static final BlockType CHORUS_FLOWER = new BlockType("minecraft:chorus_flower"); + public static final BlockType PURPUR_BLOCK = new BlockType("minecraft:purpur_block"); + public static final BlockType PURPUR_PILLAR = new BlockType("minecraft:purpur_pillar"); + public static final BlockType PURPUR_STAIRS = new BlockType("minecraft:purpur_stairs"); + public static final BlockType END_STONE_BRICKS = new BlockType("minecraft:end_stone_bricks"); + public static final BlockType BEETROOTS = new BlockType("minecraft:beetroots"); + public static final BlockType GRASS_PATH = new BlockType("minecraft:grass_path"); + public static final BlockType END_GATEWAY = new BlockType("minecraft:end_gateway"); + public static final BlockType REPEATING_COMMAND_BLOCK = new BlockType("minecraft:repeating_command_block"); + public static final BlockType CHAIN_COMMAND_BLOCK = new BlockType("minecraft:chain_command_block"); + public static final BlockType FROSTED_ICE = new BlockType("minecraft:frosted_ice"); + public static final BlockType MAGMA_BLOCK = new BlockType("minecraft:magma_block"); + public static final BlockType NETHER_WART_BLOCK = new BlockType("minecraft:nether_wart_block"); + public static final BlockType RED_NETHER_BRICKS = new BlockType("minecraft:red_nether_bricks"); + public static final BlockType BONE_BLOCK = new BlockType("minecraft:bone_block"); + public static final BlockType STRUCTURE_VOID = new BlockType("minecraft:structure_void"); + public static final BlockType OBSERVER = new BlockType("minecraft:observer"); + public static final BlockType WHITE_SHULKER_BOX = new BlockType("minecraft:white_shulker_box"); + public static final BlockType ORANGE_SHULKER_BOX = new BlockType("minecraft:orange_shulker_box"); + public static final BlockType MAGENTA_SHULKER_BOX = new BlockType("minecraft:magenta_shulker_box"); + public static final BlockType LIGHT_BLUE_SHULKER_BOX = new BlockType("minecraft:light_blue_shulker_box"); + public static final BlockType YELLOW_SHULKER_BOX = new BlockType("minecraft:yellow_shulker_box"); + public static final BlockType LIME_SHULKER_BOX = new BlockType("minecraft:lime_shulker_box"); + public static final BlockType PINK_SHULKER_BOX = new BlockType("minecraft:pink_shulker_box"); + public static final BlockType GRAY_SHULKER_BOX = new BlockType("minecraft:gray_shulker_box"); + public static final BlockType LIGHT_GRAY_SHULKER_BOX = new BlockType("minecraft:light_gray_shulker_box"); + public static final BlockType CYAN_SHULKER_BOX = new BlockType("minecraft:cyan_shulker_box"); + public static final BlockType PURPLE_SHULKER_BOX = new BlockType("minecraft:purple_shulker_box"); + public static final BlockType BLUE_SHULKER_BOX = new BlockType("minecraft:blue_shulker_box"); + public static final BlockType BROWN_SHULKER_BOX = new BlockType("minecraft:brown_shulker_box"); + public static final BlockType GREEN_SHULKER_BOX = new BlockType("minecraft:green_shulker_box"); + public static final BlockType RED_SHULKER_BOX = new BlockType("minecraft:red_shulker_box"); + public static final BlockType BLACK_SHULKER_BOX = new BlockType("minecraft:black_shulker_box"); + public static final BlockType WHITE_GLAZED_TERRACOTTA = new BlockType("minecraft:white_glazed_terracotta"); + public static final BlockType ORANGE_GLAZED_TERRACOTTA = new BlockType("minecraft:orange_glazed_terracotta"); + public static final BlockType MAGENTA_GLAZED_TERRACOTTA = new BlockType("minecraft:magenta_glazed_terracotta"); + public static final BlockType LIGHT_BLUE_GLAZED_TERRACOTTA = new BlockType("minecraft:light_blue_glazed_terracotta"); + public static final BlockType YELLOW_GLAZED_TERRACOTTA = new BlockType("minecraft:yellow_glazed_terracotta"); + public static final BlockType LIME_GLAZED_TERRACOTTA = new BlockType("minecraft:lime_glazed_terracotta"); + public static final BlockType PINK_GLAZED_TERRACOTTA = new BlockType("minecraft:pink_glazed_terracotta"); + public static final BlockType GRAY_GLAZED_TERRACOTTA = new BlockType("minecraft:gray_glazed_terracotta"); + public static final BlockType LIGHT_GRAY_GLAZED_TERRACOTTA = new BlockType("minecraft:light_gray_glazed_terracotta"); + public static final BlockType CYAN_GLAZED_TERRACOTTA = new BlockType("minecraft:cyan_glazed_terracotta"); + public static final BlockType PURPLE_GLAZED_TERRACOTTA = new BlockType("minecraft:purple_glazed_terracotta"); + public static final BlockType BLUE_GLAZED_TERRACOTTA = new BlockType("minecraft:blue_glazed_terracotta"); + public static final BlockType BROWN_GLAZED_TERRACOTTA = new BlockType("minecraft:brown_glazed_terracotta"); + public static final BlockType GREEN_GLAZED_TERRACOTTA = new BlockType("minecraft:green_glazed_terracotta"); + public static final BlockType RED_GLAZED_TERRACOTTA = new BlockType("minecraft:red_glazed_terracotta"); + public static final BlockType BLACK_GLAZED_TERRACOTTA = new BlockType("minecraft:black_glazed_terracotta"); + public static final BlockType WHITE_CONCRETE = new BlockType("minecraft:white_concrete"); + public static final BlockType ORANGE_CONCRETE = new BlockType("minecraft:orange_concrete"); + public static final BlockType MAGENTA_CONCRETE = new BlockType("minecraft:magenta_concrete"); + public static final BlockType LIGHT_BLUE_CONCRETE = new BlockType("minecraft:light_blue_concrete"); + public static final BlockType YELLOW_CONCRETE = new BlockType("minecraft:yellow_concrete"); + public static final BlockType LIME_CONCRETE = new BlockType("minecraft:lime_concrete"); + public static final BlockType PINK_CONCRETE = new BlockType("minecraft:pink_concrete"); + public static final BlockType GRAY_CONCRETE = new BlockType("minecraft:gray_concrete"); + public static final BlockType LIGHT_GRAY_CONCRETE = new BlockType("minecraft:light_gray_concrete"); + public static final BlockType CYAN_CONCRETE = new BlockType("minecraft:cyan_concrete"); + public static final BlockType PURPLE_CONCRETE = new BlockType("minecraft:purple_concrete"); + public static final BlockType BLUE_CONCRETE = new BlockType("minecraft:blue_concrete"); + public static final BlockType BROWN_CONCRETE = new BlockType("minecraft:brown_concrete"); + public static final BlockType GREEN_CONCRETE = new BlockType("minecraft:green_concrete"); + public static final BlockType RED_CONCRETE = new BlockType("minecraft:red_concrete"); + public static final BlockType BLACK_CONCRETE = new BlockType("minecraft:black_concrete"); + public static final BlockType WHITE_CONCRETE_POWDER = new BlockType("minecraft:white_concrete_powder"); + public static final BlockType ORANGE_CONCRETE_POWDER = new BlockType("minecraft:orange_concrete_powder"); + public static final BlockType MAGENTA_CONCRETE_POWDER = new BlockType("minecraft:magenta_concrete_powder"); + public static final BlockType LIGHT_BLUE_CONCRETE_POWDER = new BlockType("minecraft:light_blue_concrete_powder"); + public static final BlockType YELLOW_CONCRETE_POWDER = new BlockType("minecraft:yellow_concrete_powder"); + public static final BlockType LIME_CONCRETE_POWDER = new BlockType("minecraft:lime_concrete_powder"); + public static final BlockType PINK_CONCRETE_POWDER = new BlockType("minecraft:pink_concrete_powder"); + public static final BlockType GRAY_CONCRETE_POWDER = new BlockType("minecraft:gray_concrete_powder"); + public static final BlockType LIGHT_GRAY_CONCRETE_POWDER = new BlockType("minecraft:light_gray_concrete_powder"); + public static final BlockType CYAN_CONCRETE_POWDER = new BlockType("minecraft:cyan_concrete_powder"); + public static final BlockType PURPLE_CONCRETE_POWDER = new BlockType("minecraft:purple_concrete_powder"); + public static final BlockType BLUE_CONCRETE_POWDER = new BlockType("minecraft:blue_concrete_powder"); + public static final BlockType BROWN_CONCRETE_POWDER = new BlockType("minecraft:brown_concrete_powder"); + public static final BlockType GREEN_CONCRETE_POWDER = new BlockType("minecraft:green_concrete_powder"); + public static final BlockType RED_CONCRETE_POWDER = new BlockType("minecraft:red_concrete_powder"); + public static final BlockType BLACK_CONCRETE_POWDER = new BlockType("minecraft:black_concrete_powder"); + public static final BlockType STRUCTURE_BLOCK = new BlockType("minecraft:structure_block"); private static final Map blockMapping = new HashMap<>(); + static { + for (Field field : BlockTypes.class.getFields()) { + if (field.getType() == BlockType.class) { + try { + registerBlock((BlockType) field.get(null)); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + } + } + public static void registerBlock(BlockType blockType) { - if (blockMapping.containsKey(blockType.getId())) { + if (blockMapping.containsKey(blockType.getId()) && !blockType.getId().startsWith("minecraft:")) { throw new IllegalArgumentException("Existing block with this ID already registered"); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java index 67efbd716..631f17ae9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java @@ -30,6 +30,7 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.command.tool.BrushTool; import com.sk89q.worldedit.command.tool.brush.ButcherBrush; import com.sk89q.worldedit.command.tool.brush.ClipboardBrush; @@ -193,10 +194,10 @@ public class BrushCommands { worldEdit.checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player.getItemInHand()); - Pattern fill = new BlockPattern(new BaseBlock(0)); + Pattern fill = new BlockPattern(new BaseBlock(BlockTypes.AIR)); tool.setFill(fill); tool.setSize(radius); - tool.setMask(new BlockMask(editSession, new BaseBlock(BlockID.FIRE))); + tool.setMask(new BlockMask(editSession, new BaseBlock(BlockTypes.FIRE))); tool.setBrush(new SphereBrush(), "worldedit.brush.ex"); player.print(String.format("Extinguisher equipped (%.0f).", radius)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java index 04a25443a..f33ffbbbe 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java @@ -21,7 +21,8 @@ package com.sk89q.worldedit.command.tool; import com.sk89q.worldedit.*; import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockType; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; @@ -32,7 +33,7 @@ import com.sk89q.worldedit.world.World; */ public class AreaPickaxe implements BlockTool { - private static final BaseBlock air = new BaseBlock(0); + private static final BaseBlock air = new BaseBlock(BlockTypes.AIR); private int range; public AreaPickaxe(int range) { @@ -49,13 +50,13 @@ public class AreaPickaxe implements BlockTool { int ox = clicked.getBlockX(); int oy = clicked.getBlockY(); int oz = clicked.getBlockZ(); - int initialType = ((World) clicked.getExtent()).getBlockType(clicked.toVector()); + BlockType initialType = ((World) clicked.getExtent()).getBlock(clicked.toVector()).getType(); - if (initialType == 0) { + if (initialType == BlockTypes.AIR) { return true; } - if (initialType == BlockID.BEDROCK && !player.canDestroyBedrock()) { + if (initialType == BlockTypes.BEDROCK && !player.canDestroyBedrock()) { return true; } @@ -67,11 +68,11 @@ public class AreaPickaxe implements BlockTool { for (int y = oy - range; y <= oy + range; ++y) { for (int z = oz - range; z <= oz + range; ++z) { Vector pos = new Vector(x, y, z); - if (editSession.getBlockType(pos) != initialType) { + if (editSession.getBlock(pos).getType() != initialType) { continue; } - ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().distanceSq(pos)); + ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType.getLegacyId(), clicked.toVector().distanceSq(pos)); editSession.setBlock(pos, air); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java index 04adef915..8a375e376 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java @@ -22,6 +22,7 @@ package com.sk89q.worldedit.command.tool; import com.sk89q.worldedit.*; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; @@ -37,7 +38,7 @@ import java.util.Set; * to anything else) */ public class FloatingTreeRemover implements BlockTool { - private static final BaseBlock AIR = new BaseBlock(BlockID.AIR); + private static final BaseBlock AIR = new BaseBlock(BlockTypes.AIR); private int rangeSq; public FloatingTreeRemover() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java index 794dfa993..a0ed140b5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java @@ -56,7 +56,7 @@ public class QueryTool implements BlockTool { World world = (World) clicked.getExtent(); EditSession editSession = session.createEditSession(player); - BaseBlock block = (editSession).rawGetBlock(clicked.toVector()); + BaseBlock block = editSession.getBlock(clicked.toVector()); BlockType type = BlockType.fromID(block.getType().getLegacyId()); player.print("\u00A79@" + clicked.toVector() + ": " + "\u00A7e" @@ -71,13 +71,9 @@ public class QueryTool implements BlockTool { } else if (block instanceof NoteBlock) { player.printRaw("\u00A7e" + "Note block: " + ((NoteBlock) block).getNote()); - } else if (block.getType().getId().equals(BlockTypes.WOOL)) { - // Should never be null - player.printRaw("\u00A7e" + "Color: " - + ClothColor.fromID(block.getData()).getName()); } - Map states = BundledBlockData.getInstance().getStatesById(block.getId()); + Map states = BundledBlockData.getInstance().getStatesById(block.getType().getId()); if (states == null || states.isEmpty()) return true; StringBuilder builder = new StringBuilder(); builder.append("States: "); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java index 05fa39c51..25348565a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java @@ -22,6 +22,8 @@ package com.sk89q.worldedit.command.tool; import com.sk89q.worldedit.*; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockType; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; @@ -36,7 +38,7 @@ import java.util.Set; */ public class RecursivePickaxe implements BlockTool { - private static final BaseBlock air = new BaseBlock(0); + private static final BaseBlock air = new BaseBlock(BlockTypes.AIR); private double range; public RecursivePickaxe(double range) { @@ -52,13 +54,13 @@ public class RecursivePickaxe implements BlockTool { public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { World world = (World) clicked.getExtent(); - int initialType = world.getBlockType(clicked.toVector()); + BlockType initialType = world.getBlock(clicked.toVector()).getType(); - if (initialType == BlockID.AIR) { + if (initialType == BlockTypes.AIR) { return true; } - if (initialType == BlockID.BEDROCK && !player.canDestroyBedrock()) { + if (initialType == BlockTypes.BEDROCK && !player.canDestroyBedrock()) { return true; } @@ -79,7 +81,7 @@ public class RecursivePickaxe implements BlockTool { } private static void recurse(Platform server, EditSession editSession, World world, BlockVector pos, - Vector origin, double size, int initialType, Set visited) throws MaxChangedBlocksException { + Vector origin, double size, BlockType initialType, Set visited) throws MaxChangedBlocksException { final double distanceSq = origin.distanceSq(pos); if (distanceSq > size*size || visited.contains(pos)) { @@ -88,11 +90,11 @@ public class RecursivePickaxe implements BlockTool { visited.add(pos); - if (editSession.getBlock(pos).getType().getLegacyId() != initialType) { + if (editSession.getBlock(pos).getType() != initialType) { return; } - world.queueBlockBreakEffect(server, pos, initialType, distanceSq); + world.queueBlockBreakEffect(server, pos, initialType.getLegacyId(), distanceSq); editSession.setBlock(pos, air); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java index 2df64da79..ca4d4c145 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Patterns; @@ -39,7 +40,7 @@ public class CylinderBrush implements Brush { @Override public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { - pattern = new BlockPattern(new BaseBlock(BlockID.COBBLESTONE)); + pattern = new BlockPattern(new BaseBlock(BlockTypes.COBBLESTONE)); } editSession.makeCylinder(position, Patterns.wrap(pattern), size, size, height, true); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java index 758b7c53c..904cc8b89 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java @@ -39,7 +39,7 @@ public class GravityBrush implements Brush { @Override public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { - final BaseBlock air = new BaseBlock(BlockID.AIR, 0); + final BaseBlock air = new BaseBlock(BlockTypes.AIR); final double startY = fullHeight ? editSession.getWorld().getMaxY() : position.getBlockY() + size; for (double x = position.getBlockX() + size; x > position.getBlockX() - size; --x) { for (double z = position.getBlockZ() + size; z > position.getBlockZ() - size; --z) { @@ -56,7 +56,7 @@ public class GravityBrush implements Brush { Vector pt = new Vector(x, y, z); Collections.reverse(blockTypes); for (int i = 0; i < blockTypes.size();) { - if (editSession.getBlock(pt).getType().getId().equals(BlockTypes.AIR)) { + if (editSession.getBlock(pt).isAir()) { editSession.setBlock(pt, blockTypes.get(i++)); } pt = pt.add(0, 1, 0); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java index 0f468d666..0fe74aa47 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Patterns; @@ -39,7 +40,7 @@ public class HollowCylinderBrush implements Brush { @Override public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { - pattern = new BlockPattern(new BaseBlock(BlockID.COBBLESTONE)); + pattern = new BlockPattern(new BaseBlock(BlockTypes.COBBLESTONE)); } editSession.makeCylinder(position, Patterns.wrap(pattern), size, size, height, false); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java index 14813fd99..b28dc08a5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Patterns; @@ -33,7 +34,7 @@ public class HollowSphereBrush implements Brush { @Override public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { - pattern = new BlockPattern(new BaseBlock(BlockID.COBBLESTONE)); + pattern = new BlockPattern(new BaseBlock(BlockTypes.COBBLESTONE)); } editSession.makeSphere(position, Patterns.wrap(pattern), size, size, size, false); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java index 6c783a0da..23a3eddb3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Patterns; @@ -33,7 +34,7 @@ public class SphereBrush implements Brush { @Override public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { - pattern = new BlockPattern(new BaseBlock(BlockID.COBBLESTONE)); + pattern = new BlockPattern(new BaseBlock(BlockTypes.COBBLESTONE)); } editSession.makeSphere(position, Patterns.wrap(pattern), size, size, size, true); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java index 1979bdaaf..20a3b1556 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java @@ -23,6 +23,7 @@ import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.operation.Operation; @@ -70,12 +71,12 @@ public class NullExtent implements Extent { @Override public BaseBlock getBlock(Vector position) { - return new BaseBlock(0); + return new BaseBlock(BlockTypes.AIR); } @Override public BaseBlock getLazyBlock(Vector position) { - return new BaseBlock(0); + return new BaseBlock(BlockTypes.AIR); } @Nullable diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java index abdef5478..aed9e356d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.Mask; @@ -48,7 +49,7 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pattern { - private static final BaseBlock AIR = new BaseBlock(BlockID.AIR); + private static final BaseBlock AIR = new BaseBlock(BlockTypes.AIR); private final Map buffer = new LinkedHashMap(); private final Mask mask; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java index 15c9b7345..a48d8499f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.operation.Operation; @@ -129,7 +130,7 @@ public class BlockArrayClipboard implements Clipboard { } } - return new BaseBlock(BlockID.AIR); + return new BaseBlock(BlockTypes.AIR); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/SignCompatibilityHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/SignCompatibilityHandler.java index c8440375a..410059aba 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/SignCompatibilityHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/SignCompatibilityHandler.java @@ -28,13 +28,14 @@ import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockTypes; import java.util.Map; public class SignCompatibilityHandler implements NBTCompatibilityHandler { @Override public boolean isAffectedBlock(BaseBlock block) { - return block.getType().getLegacyId() == BlockID.SIGN_POST || block.getType().getLegacyId() == BlockID.WALL_SIGN; + return block.getType() == BlockTypes.SIGN || block.getType() == BlockTypes.WALL_SIGN; } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java index 04eafc2d1..86595f3df 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java @@ -27,6 +27,7 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockType; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.operation.BlockMapEntryPlacer; @@ -103,7 +104,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder return !(lazyBlock.getType() == block.getType() && lazyBlock.getData() == block.getData()); } else if (BlockType.shouldPlaceLast(lazyBlock.getType().getLegacyId())) { // Destroy torches, etc. first - super.setBlock(location, new BaseBlock(BlockID.AIR)); + super.setBlock(location, new BaseBlock(BlockTypes.AIR)); return super.setBlock(location, block); } else { stage1.put(location.toBlockVector(), block); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java index f143e7867..10b09a313 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java @@ -22,6 +22,7 @@ package com.sk89q.worldedit.extent.validation; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.blocks.type.BlockType; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.world.World; @@ -50,13 +51,13 @@ public class DataValidatorExtent extends AbstractDelegateExtent { @Override public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { final int y = location.getBlockY(); - final int type = block.getType().getLegacyId(); + final BlockType type = block.getType(); if (y < 0 || y > world.getMaxY()) { return false; } // No invalid blocks - if (!world.isValidBlockType(type)) { + if (type == null) { return false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java index d8eb38e8b..8e44947c6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockType; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.world.World; @@ -58,7 +59,7 @@ public class BlockQuirkExtent extends AbstractDelegateExtent { if (BlockType.isContainerBlock(existing)) { world.clearContainerBlockContents(position); // Clear the container block so that it doesn't drop items } else if (existing == BlockID.ICE) { - world.setBlock(position, new BaseBlock(BlockID.AIR)); // Ice turns until water so this has to be done first + world.setBlock(position, new BaseBlock(BlockTypes.AIR)); // Ice turns until water so this has to be done first } return super.setBlock(position, block); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java index 5366a2a84..aaed000d3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java @@ -81,7 +81,7 @@ public class SurvivalModeExtent extends AbstractDelegateExtent { @Override public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { - if (toolUse && block.getType().getLegacyId() == BlockID.AIR) { + if (toolUse && block.isAir()) { world.simulateBlockMine(location); return true; } else { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java index 94e39cd0c..c72990a1b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java @@ -104,7 +104,7 @@ public class ExtentBlockCopy implements RegionFunction { builder.putByte("Rot", (byte) MCDirections.toRotation(newDirection)); - return new BaseBlock(state.getId(), state.getData(), builder.build()); + return new BaseBlock(state.getType(), state.getData(), builder.build()); } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java index 5817e67ad..4b0f1c802 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java @@ -23,7 +23,7 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.function.LayerFunction; import com.sk89q.worldedit.masks.BlockMask; import com.sk89q.worldedit.masks.Mask; @@ -38,9 +38,9 @@ import static com.google.common.base.Preconditions.checkNotNull; public class Naturalizer implements LayerFunction { private final EditSession editSession; - private final BaseBlock grass = new BaseBlock(BlockID.GRASS); - private final BaseBlock dirt = new BaseBlock(BlockID.DIRT); - private final BaseBlock stone = new BaseBlock(BlockID.STONE); + private final BaseBlock grass = new BaseBlock(BlockTypes.GRASS_BLOCK); + private final BaseBlock dirt = new BaseBlock(BlockTypes.DIRT); + private final BaseBlock stone = new BaseBlock(BlockTypes.STONE); private final Mask mask = new BlockMask(grass, dirt, stone); private int affected = 0; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java index 068656342..a5d68d8f1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java @@ -84,9 +84,9 @@ public class FloraGenerator implements RegionFunction { */ public static Pattern getDesertPattern() { RandomPattern pattern = new RandomPattern(); - pattern.add(new BlockPattern(new BaseBlock(BlockID.DEAD_BUSH)), 30); - pattern.add(new BlockPattern(new BaseBlock(BlockID.CACTUS)), 20); - pattern.add(new BlockPattern(new BaseBlock(BlockID.AIR)), 300); + pattern.add(new BlockPattern(new BaseBlock(BlockTypes.DEAD_BUSH)), 30); + pattern.add(new BlockPattern(new BaseBlock(BlockTypes.CACTUS)), 20); + pattern.add(new BlockPattern(new BaseBlock(BlockTypes.AIR)), 300); return pattern; } @@ -97,9 +97,9 @@ public class FloraGenerator implements RegionFunction { */ public static Pattern getTemperatePattern() { RandomPattern pattern = new RandomPattern(); - pattern.add(new BlockPattern(new BaseBlock(BlockID.LONG_GRASS, 1)), 300); - pattern.add(new BlockPattern(new BaseBlock(BlockID.RED_FLOWER)), 5); - pattern.add(new BlockPattern(new BaseBlock(BlockID.YELLOW_FLOWER)), 5); + pattern.add(new BlockPattern(new BaseBlock(BlockTypes.TALL_GRASS, 1)), 300); + pattern.add(new BlockPattern(new BaseBlock(BlockTypes.POPPY)), 5); + pattern.add(new BlockPattern(new BaseBlock(BlockTypes.DANDELION)), 5); return pattern; } @@ -107,10 +107,10 @@ public class FloraGenerator implements RegionFunction { public boolean apply(Vector position) throws WorldEditException { BaseBlock block = editSession.getBlock(position); - if (block.getType().getId().equals(BlockTypes.GRASS)) { + if (block.getType() == BlockTypes.GRASS) { editSession.setBlock(position.add(0, 1, 0), temperatePattern.apply(position)); return true; - } else if (block.getType().getLegacyId() == BlockID.SAND) { + } else if (block.getType() == BlockTypes.SAND) { editSession.setBlock(position.add(0, 1, 0), desertPattern.apply(position)); return true; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java index c53374852..b5fdc60a7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java @@ -24,6 +24,8 @@ import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockType; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.util.TreeGenerator; @@ -50,17 +52,17 @@ public class ForestGenerator implements RegionFunction { @Override public boolean apply(Vector position) throws WorldEditException { BaseBlock block = editSession.getBlock(position); - int t = block.getType().getLegacyId(); + BlockType t = block.getType(); - if (t == BlockID.GRASS || t == BlockID.DIRT) { + if (t == BlockTypes.GRASS || t == BlockTypes.DIRT) { treeGenerator.generate(editSession, position.add(0, 1, 0)); return true; - } else if (t == BlockID.LONG_GRASS || t == BlockID.DEAD_BUSH || t == BlockID.RED_FLOWER || t == BlockID.YELLOW_FLOWER) { // TODO: This list needs to be moved - editSession.setBlock(position, new BaseBlock(0)); + } else if (t == BlockTypes.TALL_GRASS || t == BlockTypes.DEAD_BUSH || t == BlockTypes.POPPY || t == BlockTypes.DANDELION) { // TODO: This list needs to be moved + editSession.setBlock(position, new BaseBlock(BlockTypes.AIR)); treeGenerator.generate(editSession, position); return true; - } else if (t == BlockID.SNOW) { - editSession.setBlock(position, new BaseBlock(BlockID.AIR)); + } else if (t == BlockTypes.SNOW) { + editSession.setBlock(position, new BaseBlock(BlockTypes.AIR)); return false; } else { // Trees won't grow on this! return false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java index 3268d15cb..e0da9361b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java @@ -87,25 +87,25 @@ public class GardenPatchGenerator implements RegionFunction { */ private void placeVine(Vector basePos, Vector pos) throws MaxChangedBlocksException { if (pos.distance(basePos) > 4) return; - if (editSession.getBlockType(pos) != 0) return; + if (!editSession.getBlock(pos).isAir()) return; for (int i = -1; i > -3; --i) { Vector testPos = pos.add(0, i, 0); - if (editSession.getBlockType(testPos) == BlockID.AIR) { + if (editSession.getBlock(testPos).isAir()) { pos = testPos; } else { break; } } - editSession.setBlockIfAir(pos, new BaseBlock(BlockID.LEAVES)); + editSession.setBlockIfAir(pos, new BaseBlock(BlockTypes.OAK_LEAVES)); affected++; int t = random.nextInt(4); int h = random.nextInt(3) - 1; Vector p; - BaseBlock log = new BaseBlock(BlockID.LOG); + BaseBlock log = new BaseBlock(BlockTypes.OAK_LOG); switch (t) { case 0: @@ -160,17 +160,19 @@ public class GardenPatchGenerator implements RegionFunction { @Override public boolean apply(Vector position) throws WorldEditException { - if (!editSession.getBlock(position).getType().getId().equals(BlockTypes.AIR)) { + if (!editSession.getBlock(position).isAir()) { position = position.add(0, 1, 0); } - if (!editSession.getBlock(position.add(0, -1, 0)).getType().getId().equals(BlockTypes.GRASS)) { + if (editSession.getBlock(position.add(0, -1, 0)).getType() != BlockTypes.GRASS) { return false; } - BaseBlock leavesBlock = new BaseBlock(BlockID.LEAVES); + BaseBlock leavesBlock = new BaseBlock(BlockTypes.OAK_LEAVES); - editSession.setBlockIfAir(position, leavesBlock); + if (editSession.getBlock(position).isAir()) { + editSession.setBlock(position, leavesBlock); + } placeVine(position, position.add(0, 0, 1)); placeVine(position, position.add(0, 0, -1)); @@ -188,7 +190,7 @@ public class GardenPatchGenerator implements RegionFunction { public static Pattern getPumpkinPattern() { RandomPattern pattern = new RandomPattern(); for (int i = 0; i < 4; i++) { - pattern.add(new BlockPattern(new BaseBlock(BlockID.PUMPKIN, i)), 100); + pattern.add(new BlockPattern(new BaseBlock(BlockTypes.PUMPKIN, i)), 100); } return pattern; } @@ -199,6 +201,6 @@ public class GardenPatchGenerator implements RegionFunction { * @return a melon pattern */ public static Pattern getMelonPattern() { - return new BlockPattern(new BaseBlock(BlockID.MELON_BLOCK)); + return new BlockPattern(new BaseBlock(BlockTypes.MELON_BLOCK)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java index a633b3243..fd98c1a64 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java @@ -42,7 +42,7 @@ public class ExistingBlockMask extends AbstractExtentMask { @Override public boolean test(Vector vector) { - return getExtent().getLazyBlock(vector).getType().getLegacyId() != BlockID.AIR; + return !getExtent().getLazyBlock(vector).isAir(); } @Nullable diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java index 28f1c0bd7..45c85a99a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java @@ -23,7 +23,6 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.regions.Region; @@ -123,7 +122,7 @@ public class HeightMap { int originZ = minY.getBlockZ(); int maxY = region.getMaximumPoint().getBlockY(); - BaseBlock fillerAir = new BaseBlock(BlockID.AIR); + BaseBlock fillerAir = new BaseBlock(BlockTypes.AIR); int blocksChanged = 0; @@ -149,8 +148,8 @@ public class HeightMap { BaseBlock existing = session.getBlock(new Vector(xr, curHeight, zr)); // Skip water/lava - if (!existing.getType().getId().equals(BlockTypes.WATER) && !existing.getType().getId().equals(BlockTypes.STATIONARY_WATER) - && !existing.getType().getId().equals(BlockTypes.LAVA) && !existing.getType().getId().equals(BlockTypes.STATIONARY_LAVA)) { + if (existing.getType() != BlockTypes.WATER && existing.getType() != BlockTypes.FLOWING_WATER + && existing.getType() != BlockTypes.LAVA && existing.getType() != BlockTypes.FLOWING_LAVA) { session.setBlock(new Vector(xr, newHeight, zr), existing); ++blocksChanged; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java index 070a3527f..dc80c5345 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java @@ -73,9 +73,7 @@ public class RegionIntersection extends AbstractRegion { super(world); checkNotNull(regions); checkArgument(!regions.isEmpty(), "empty region list is not supported"); - for (Region region : regions) { - this.regions.add(region); - } + this.regions.addAll(regions); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java index 8f7642794..e630555b6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.patterns.Pattern; import com.sk89q.worldedit.regions.Region; @@ -113,7 +114,7 @@ public abstract class ArbitraryShape { case -2: // type and data 0 - return new BaseBlock(0, 0); + return new BaseBlock(BlockTypes.AIR); } return new BaseBlock(cacheEntry & 255, ((cacheEntry >> 8) - 1) & 15); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java index 18c9b0702..504d02b77 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java @@ -25,6 +25,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockTypes; import javax.annotation.Nullable; import java.util.Collections; @@ -198,8 +199,8 @@ public class TreeGenerator { int trunkHeight = (int) Math.floor(Math.random() * 2) + 3; int height = (int) Math.floor(Math.random() * 5) + 8; - BaseBlock logBlock = new BaseBlock(BlockID.LOG); - BaseBlock leavesBlock = new BaseBlock(BlockID.LEAVES); + BaseBlock logBlock = new BaseBlock(BlockTypes.OAK_LOG); + BaseBlock leavesBlock = new BaseBlock(BlockTypes.OAK_LEAVES); // Create trunk for (int i = 0; i < trunkHeight; ++i) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/ColorCodeBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/ColorCodeBuilder.java index c6bb755bd..08cf70e18 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/ColorCodeBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/ColorCodeBuilder.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.util.formatting; import com.google.common.base.Joiner; +import java.util.Arrays; import java.util.LinkedList; import java.util.List; @@ -183,9 +184,7 @@ public class ColorCodeBuilder { if ((transformed = transform(wordStr)) != null) { line.append(transformed); } else { - for (String partialWord : word.toString().split("(?<=\\G.{" + lineLength + "})")) { - lines.add(partialWord); - } + lines.addAll(Arrays.asList(word.toString().split("(?<=\\G.{" + lineLength + "})"))); } } else if (line.length() + word.length() - lineColorChars == lineLength) { // Line exactly the correct length...newline line.append(' '); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java index 7be4843cc..fea1e00da 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java @@ -29,6 +29,7 @@ import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockType; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.function.mask.BlockMask; import com.sk89q.worldedit.function.mask.Mask; @@ -102,10 +103,10 @@ public abstract class AbstractWorld implements World { @Override public Mask createLiquidMask() { return new BlockMask(this, - new BaseBlock(BlockID.STATIONARY_LAVA, -1), - new BaseBlock(BlockID.LAVA, -1), - new BaseBlock(BlockID.STATIONARY_WATER, -1), - new BaseBlock(BlockID.WATER, -1)); + new BaseBlock(BlockTypes.LAVA, -1), + new BaseBlock(BlockTypes.FLOWING_LAVA, -1), + new BaseBlock(BlockTypes.WATER, -1), + new BaseBlock(BlockTypes.FLOWING_WATER, -1)); } @Override @@ -140,7 +141,7 @@ public abstract class AbstractWorld implements World { } try { - setBlock(pt, new BaseBlock(BlockID.AIR)); + setBlock(pt, new BaseBlock(BlockTypes.AIR)); } catch (WorldEditException e) { throw new RuntimeException(e); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java index 1edfaadb3..3a13ae21b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java @@ -26,7 +26,7 @@ import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.regions.Region; @@ -102,12 +102,12 @@ public class NullWorld extends AbstractWorld { @Override public BaseBlock getBlock(Vector position) { - return new BaseBlock(BlockID.AIR); + return new BaseBlock(BlockTypes.AIR); } @Override public BaseBlock getLazyBlock(Vector position) { - return new BaseBlock(BlockID.AIR); + return new BaseBlock(BlockTypes.AIR); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java index b46467ea4..12c8f6d63 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java @@ -80,11 +80,9 @@ public abstract class LegacyChunkStore extends ChunkStore { + "." + Integer.toString(z, 36) + ".dat"; InputStream stream = getInputStream(folder1, folder2, filename); - NBTInputStream nbt = new NBTInputStream( - new GZIPInputStream(stream)); Tag tag; - try { + try (NBTInputStream nbt = new NBTInputStream(new GZIPInputStream(stream))) { tag = nbt.readNamedTag().getTag(); if (!(tag instanceof CompoundTag)) { throw new ChunkStoreException("CompoundTag expected for chunk; got " @@ -112,8 +110,6 @@ public abstract class LegacyChunkStore extends ChunkStore { } return rootTag; - } finally { - nbt.close(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java index f7c5fd691..30b2b42ff 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java @@ -71,10 +71,9 @@ public abstract class McRegionChunkStore extends ChunkStore { McRegionReader reader = getReader(position, world.getName()); InputStream stream = reader.getChunkInputStream(position); - NBTInputStream nbt = new NBTInputStream(stream); Tag tag; - try { + try (NBTInputStream nbt = new NBTInputStream(stream)) { tag = nbt.readNamedTag().getTag(); if (!(tag instanceof CompoundTag)) { throw new ChunkStoreException("CompoundTag expected for chunk; got " + tag.getClass().getName()); @@ -100,8 +99,6 @@ public abstract class McRegionChunkStore extends ChunkStore { } return rootTag; - } finally { - nbt.close(); } } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java index 8cf24040d..0d3577575 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java @@ -123,7 +123,7 @@ public class SpongePlayer extends AbstractPlayerActor { @Override public void printRaw(String msg) { for (String part : msg.split("\n")) { - this.player.sendMessage(TextSerializers.LEGACY_FORMATTING_CODE.deserialize(part)); + this.player.sendMessage(TextSerializers.FORMATTING_CODE.deserialize(part)); } } @@ -144,7 +144,7 @@ public class SpongePlayer extends AbstractPlayerActor { private void sendColorized(String msg, TextColor formatting) { for (String part : msg.split("\n")) { - this.player.sendMessage(Text.of(formatting, TextSerializers.LEGACY_FORMATTING_CODE.deserialize(part))); + this.player.sendMessage(Text.of(formatting, TextSerializers.FORMATTING_CODE.deserialize(part))); } }