diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java index a129b9633..1b5b140d4 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -69,7 +69,7 @@ public class BukkitPlayer extends AbstractPlayerActor { ItemStack itemStack = handSide == HandSide.MAIN_HAND ? player.getInventory().getItemInMainHand() : player.getInventory().getItemInOffHand(); - return BukkitUtil.toBlock(getWorld(), itemStack); + return BukkitUtil.toBlock(itemStack); } @Override diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java index f32d56766..fc003d783 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java @@ -24,19 +24,17 @@ import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.blocks.BlockType; -import com.sk89q.worldedit.blocks.ItemID; import com.sk89q.worldedit.blocks.type.BlockTypes; +import com.sk89q.worldedit.blocks.type.ItemType; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.util.Location; -import org.bukkit.DyeColor; +import com.sk89q.worldedit.world.registry.LegacyMapper; import org.bukkit.Server; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import org.bukkit.material.Dye; import java.util.List; @@ -123,29 +121,17 @@ public final class BukkitUtil { return ((BukkitWorld) world).getWorld(); } - public static BaseBlock toBlock(com.sk89q.worldedit.world.World world, ItemStack itemStack) throws WorldEditException { - final int typeId = itemStack.getTypeId(); - - switch (typeId) { - case ItemID.INK_SACK: - final Dye materialData = (Dye) itemStack.getData(); - if (materialData.getColor() == DyeColor.BROWN) { - return new BaseBlock(BlockTypes.COCOA); - } - break; - - default: - final BaseBlock baseBlock = BlockType.getBlockForItem(typeId, itemStack.getDurability()); - if (baseBlock != null) { - return baseBlock; - } - break; + public static BaseBlock toBlock(ItemStack itemStack) throws WorldEditException { + ItemType itemType = LegacyMapper.getInstance().getItemFromLegacy(itemStack.getTypeId(), itemStack.getData().getData()); + if (itemType.hasBlockType()) { + return new BaseBlock(itemType.getBlockType().getDefaultState()); + } else { + return new BaseBlock(BlockTypes.AIR.getDefaultState()); } - - return new BaseBlock(typeId, -1); } public static BaseItemStack toBaseItemStack(ItemStack itemStack) { - return new BaseItemStack(itemStack.getTypeId(), itemStack.getDurability()); + ItemType itemType = LegacyMapper.getInstance().getItemFromLegacy(itemStack.getTypeId(), itemStack.getData().getData()); + return new BaseItemStack(itemType, itemStack.getAmount()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index 1d98d726a..99d5a6033 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -443,7 +443,7 @@ public class EditSession implements Extent { Vector pt = new Vector(x, y, z); BlockState block = getBlock(pt); int[] datas = LegacyMapper.getInstance().getLegacyFromBlock(block); - if (naturalOnly ? BlockType.isNaturalTerrainBlock(datas[0], datas[1]) : !BlockType.canPassThrough(datas[0], datas[1])) { + if (naturalOnly ? BlockType.isNaturalTerrainBlock(datas[0], datas[1]) : block.getBlockType().getMaterial().isMovementBlocker()) { return y; } } @@ -1583,7 +1583,6 @@ public class EditSession implements Extent { for (int y = world.getMaxY(); y >= 1; --y) { final Vector pt = new Vector(x, y, z); final BlockState block = getBlock(pt); - final com.sk89q.worldedit.blocks.type.BlockType id = block.getBlockType(); if (block.getBlockType() == BlockTypes.DIRT || (!onlyNormalDirt && block.getBlockType() == BlockTypes.COARSE_DIRT)) { @@ -1593,7 +1592,7 @@ public class EditSession implements Extent { break; } else if (block.getBlockType() == BlockTypes.WATER || block.getBlockType() == BlockTypes.LAVA) { break; - } else if (!BlockType.canPassThrough(id.getLegacyId())) { + } else if (block.getBlockType().getMaterial().isMovementBlocker()) { break; } } @@ -2116,8 +2115,7 @@ public class EditSession implements Extent { while (!queue.isEmpty()) { final BlockVector current = queue.removeFirst(); final BlockState block = getBlock(current); - int[] datas = LegacyMapper.getInstance().getLegacyFromBlock(block); - if (!BlockType.canPassThrough(datas[0], datas[1])) { + if (block.getBlockType().getMaterial().isMovementBlocker()) { continue; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index d9c904344..12779701a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -555,7 +555,7 @@ public class LocalSession { * @throws InvalidToolBindException if the item can't be bound to that item */ public void setTool(ItemType item, @Nullable Tool tool) throws InvalidToolBindException { - if (false /*TODO item > 0 && item < 255*/) { + if (item.hasBlockType()) { throw new InvalidToolBindException(item, "Blocks can't be used"); } else if (item == ItemTypes.getItemType(config.wandItem)) { throw new InvalidToolBindException(item, "Already used for the wand"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java index 64d9485c0..9245a1e45 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -25,7 +25,7 @@ import static com.sk89q.worldedit.event.platform.Interaction.OPEN; import com.sk89q.worldedit.CuboidClipboard.FlipDirection; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseItem; -import com.sk89q.worldedit.blocks.BlockType; +import com.sk89q.worldedit.blocks.type.BlockType; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.event.platform.BlockInteractEvent; import com.sk89q.worldedit.event.platform.InputType; @@ -488,7 +488,7 @@ public class WorldEdit { int i = 0; for (Integer id : missingBlocks.keySet()) { - BlockType type = BlockType.fromID(id); + BlockType type = LegacyMapper.getInstance().getBlockFromLegacy(id).getBlockType(); str.append(type != null ? type.getName() + " (" + id + ")" diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockID.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockID.java index b7164d28c..f9e7c43b7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockID.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockID.java @@ -127,7 +127,6 @@ public final class BlockID { public static final int REDSTONE_REPEATER_ON = 94; // POWERED_REPEATER @Deprecated public static final int LOCKED_CHEST = 95; - public static final int STAINED_GLASS = 95; public static final int TRAP_DOOR = 96; // TRAPDOOR public static final int SILVERFISH_BLOCK = 97; // MONSTER_EGG public static final int STONE_BRICK = 98; // STONEBRICK @@ -154,7 +153,6 @@ public final class BlockID { public static final int END_PORTAL = 119; public static final int END_PORTAL_FRAME = 120; public static final int END_STONE = 121; - public static final int DRAGON_EGG = 122; public static final int REDSTONE_LAMP_OFF = 123; // REDSTONE_LAMP public static final int REDSTONE_LAMP_ON = 124; // LIT_REDSTONE_LAMP public static final int DOUBLE_WOODEN_STEP = 125; // DOUBLE_WOODEN_SLAB @@ -170,7 +168,6 @@ public final class BlockID { public static final int BIRCH_WOOD_STAIRS = 135; // BRUCE_STAIRS public static final int JUNGLE_WOOD_STAIRS = 136; // JUNGLE_STAIRS public static final int COMMAND_BLOCK = 137; - public static final int BEACON = 138; public static final int COBBLESTONE_WALL = 139; public static final int FLOWER_POT = 140; public static final int CARROTS = 141; @@ -197,11 +194,8 @@ public final class BlockID { public static final int LOG2 = 162; public static final int ACACIA_STAIRS = 163; public static final int DARK_OAK_STAIRS = 164; - public static final int SLIME = 165; public static final int BARRIER = 166; public static final int IRON_TRAP_DOOR = 167; - public static final int PRISMARINE = 168; - public static final int SEA_LANTERN = 169; public static final int HAY_BLOCK = 170; public static final int CARPET = 171; public static final int HARDENED_CLAY = 172; @@ -211,9 +205,7 @@ public final class BlockID { public static final int STANDING_BANNER = 176; public static final int WALL_BANNER = 177; public static final int DAYLIGHT_SENSOR_INVERTED = 178; - public static final int RED_SANDSTONE = 179; public static final int RED_SANDSTONE_STAIRS = 180; - public static final int DOUBLE_STEP2 = 181; public static final int STEP2 = 182; public static final int SPRUCE_FENCE_GATE = 183; public static final int BIRCH_FENCE_GATE = 184; @@ -233,59 +225,9 @@ public final class BlockID { public static final int END_ROD = 198; public static final int CHORUS_PLANT = 199; public static final int CHORUS_FLOWER = 200; - public static final int PURPUR_BLOCK = 201; - public static final int PURPUR_PILLAR = 202; public static final int PURPUR_STAIRS = 203; - public static final int PURPUR_DOUBLE_SLAB = 204; public static final int PURPUR_SLAB = 205; - public static final int END_BRICKS = 206; public static final int BEETROOTS = 207; - public static final int GRASS_PATH = 208; - public static final int END_GATEWAY = 209; - public static final int REPEATING_COMMAND_BLOCK = 210; - public static final int CHAIN_COMMAND_BLOCK = 211; - public static final int FROSTED_ICE = 212; - public static final int MAGMA_BLOCK = 213; - public static final int NETHER_WART_BLOCK = 214; - public static final int RED_NETHER_BRICK = 215; - public static final int BONE_BLOCK = 216; - public static final int STRUCTURE_VOID = 217; - public static final int OBSERVER = 218; - public static final int SHULKER_BOX_WHITE = 219; - public static final int SHULKER_BOX_ORANGE = 220; - public static final int SHULKER_BOX_MAGENTA = 221; - public static final int SHULKER_BOX_LIGHT_BLUE = 222; - public static final int SHULKER_BOX_YELLOW = 223; - public static final int SHULKER_BOX_LIME = 224; - public static final int SHULKER_BOX_PINK = 225; - public static final int SHULKER_BOX_GRAY = 226; - public static final int SHULKER_BOX_LIGHT_GRAY = 227; - public static final int SHULKER_BOX_CYAN = 228; - public static final int SHULKER_BOX_PURPLE = 229; - public static final int SHULKER_BOX_BLUE = 230; - public static final int SHULKER_BOX_BROWN = 231; - public static final int SHULKER_BOX_GREEN = 232; - public static final int SHULKER_BOX_RED = 233; - public static final int SHULKER_BOX_BLACK = 234; - public static final int TERRACOTTA_WHITE = 235; - public static final int TERRACOTTA_ORANGE = 236; - public static final int TERRACOTTA_MAGENTA = 237; - public static final int TERRACOTTA_LIGHT_BLUE = 238; - public static final int TERRACOTTA_YELLOW = 239; - public static final int TERRACOTTA_LIME = 240; - public static final int TERRACOTTA_PINK = 241; - public static final int TERRACOTTA_GRAY = 242; - public static final int TERRACOTTA_LIGHT_GRAY = 243; - public static final int TERRACOTTA_CYAN = 244; - public static final int TERRACOTTA_PURPLE = 245; - public static final int TERRACOTTA_BLUE = 246; - public static final int TERRACOTTA_BROWN = 247; - public static final int TERRACOTTA_GREEN = 248; - public static final int TERRACOTTA_RED = 249; - public static final int TERRACOTTA_BLACK = 250; - public static final int CONCRETE = 251; - public static final int CONCRETE_POWDER = 252; - public static final int STRUCTURE_BLOCK = 255; private BlockID() { } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockType.java index c77a4ca67..064562a82 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockType.java @@ -19,20 +19,18 @@ package com.sk89q.worldedit.blocks; -import com.sk89q.util.StringUtil; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.PlayerDirection; import com.sk89q.worldedit.blocks.type.BlockStateHolder; -import javax.annotation.Nullable; - -import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Random; import java.util.Set; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Block types. @@ -42,433 +40,7 @@ import static com.google.common.base.Preconditions.checkNotNull; @Deprecated public enum BlockType { - AIR(BlockID.AIR, "Air", "air"), - STONE(BlockID.STONE, "Stone", "stone", "rock"), - GRASS(BlockID.GRASS, "Grass", "grass"), - DIRT(BlockID.DIRT, "Dirt", "dirt"), - COBBLESTONE(BlockID.COBBLESTONE, "Cobblestone", "cobblestone", "cobble"), - WOOD(BlockID.WOOD, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"), - SAPLING(BlockID.SAPLING, "Sapling", "sapling", "seedling"), - BEDROCK(BlockID.BEDROCK, "Bedrock", "adminium", "bedrock"), - WATER(BlockID.WATER, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"), - STATIONARY_WATER(BlockID.STATIONARY_WATER, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"), - LAVA(BlockID.LAVA, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"), - STATIONARY_LAVA(BlockID.STATIONARY_LAVA, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"), - SAND(BlockID.SAND, "Sand", "sand"), - GRAVEL(BlockID.GRAVEL, "Gravel", "gravel"), - GOLD_ORE(BlockID.GOLD_ORE, "Gold ore", "goldore"), - IRON_ORE(BlockID.IRON_ORE, "Iron ore", "ironore"), - COAL_ORE(BlockID.COAL_ORE, "Coal ore", "coalore"), - LOG(BlockID.LOG, "Log", "log", "tree", "pine", "oak", "birch", "redwood"), - LEAVES(BlockID.LEAVES, "Leaves", "leaves", "leaf"), - SPONGE(BlockID.SPONGE, "Sponge", "sponge"), - GLASS(BlockID.GLASS, "Glass", "glass"), - LAPIS_LAZULI_ORE(BlockID.LAPIS_LAZULI_ORE, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"), - LAPIS_LAZULI(BlockID.LAPIS_LAZULI_BLOCK, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"), - DISPENSER(BlockID.DISPENSER, "Dispenser", "dispenser"), - SANDSTONE(BlockID.SANDSTONE, "Sandstone", "sandstone"), - NOTE_BLOCK(BlockID.NOTE_BLOCK, "Note block", "musicblock", "noteblock", "note", "music", "instrument"), - BED(BlockID.BED, "Bed", "bed"), - POWERED_RAIL(BlockID.POWERED_RAIL, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"), - DETECTOR_RAIL(BlockID.DETECTOR_RAIL, "Detector Rail", "detectorrail", "detector"), - PISTON_STICKY_BASE(BlockID.PISTON_STICKY_BASE, "Sticky Piston", "stickypiston"), - WEB(BlockID.WEB, "Web", "web", "spiderweb"), - LONG_GRASS(BlockID.LONG_GRASS, "Long grass", "longgrass", "tallgrass"), - DEAD_BUSH(BlockID.DEAD_BUSH, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"), - PISTON_BASE(BlockID.PISTON_BASE, "Piston", "piston"), - PISTON_EXTENSION(BlockID.PISTON_EXTENSION, "Piston extension", "pistonextendsion", "pistonhead"), - CLOTH(BlockID.CLOTH, "Wool", "cloth", "wool"), - PISTON_MOVING_PIECE(BlockID.PISTON_MOVING_PIECE, "Piston moving piece", "movingpiston"), - YELLOW_FLOWER(BlockID.YELLOW_FLOWER, "Yellow flower", "yellowflower", "flower"), - RED_FLOWER(BlockID.RED_FLOWER, "Red rose", "redflower", "redrose", "rose"), - BROWN_MUSHROOM(BlockID.BROWN_MUSHROOM, "Brown mushroom", "brownmushroom", "mushroom"), - RED_MUSHROOM(BlockID.RED_MUSHROOM, "Red mushroom", "redmushroom"), - GOLD_BLOCK(BlockID.GOLD_BLOCK, "Gold block", "gold", "goldblock"), - IRON_BLOCK(BlockID.IRON_BLOCK, "Iron block", "iron", "ironblock"), - DOUBLE_STEP(BlockID.DOUBLE_STEP, "Double step", "doubleslab", "doublestoneslab", "doublestep"), - STEP(BlockID.STEP, "Step", "slab", "stoneslab", "step", "halfstep"), - BRICK(BlockID.BRICK, "Brick", "brick", "brickblock"), - TNT(BlockID.TNT, "TNT", "tnt", "c4", "explosive"), - BOOKCASE(BlockID.BOOKCASE, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"), - MOSSY_COBBLESTONE(BlockID.MOSSY_COBBLESTONE, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"), - OBSIDIAN(BlockID.OBSIDIAN, "Obsidian", "obsidian"), - TORCH(BlockID.TORCH, "Torch", "torch", "light", "candle"), - FIRE(BlockID.FIRE, "Fire", "fire", "flame", "flames"), - MOB_SPAWNER(BlockID.MOB_SPAWNER, "Mob spawner", "mobspawner", "spawner"), - WOODEN_STAIRS(BlockID.OAK_WOOD_STAIRS, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"), - CHEST(BlockID.CHEST, "Chest", "chest", "storage", "storagechest"), - REDSTONE_WIRE(BlockID.REDSTONE_WIRE, "Redstone wire", "redstone", "redstoneblock"), - DIAMOND_ORE(BlockID.DIAMOND_ORE, "Diamond ore", "diamondore"), - DIAMOND_BLOCK(BlockID.DIAMOND_BLOCK, "Diamond block", "diamond", "diamondblock"), - WORKBENCH(BlockID.WORKBENCH, "Workbench", "workbench", "table", "craftingtable", "crafting"), - CROPS(BlockID.CROPS, "Crops", "crops", "crop", "plant", "plants"), - SOIL(BlockID.SOIL, "Soil", "soil", "farmland"), - FURNACE(BlockID.FURNACE, "Furnace", "furnace"), - BURNING_FURNACE(BlockID.BURNING_FURNACE, "Furnace (burning)", "burningfurnace", "litfurnace"), - SIGN_POST(BlockID.SIGN_POST, "Sign post", "sign", "signpost"), - WOODEN_DOOR(BlockID.WOODEN_DOOR, "Wooden door", "wooddoor", "woodendoor", "door"), - LADDER(BlockID.LADDER, "Ladder", "ladder"), - MINECART_TRACKS(BlockID.MINECART_TRACKS, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"), - COBBLESTONE_STAIRS(BlockID.COBBLESTONE_STAIRS, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"), - WALL_SIGN(BlockID.WALL_SIGN, "Wall sign", "wallsign"), - LEVER(BlockID.LEVER, "Lever", "lever", "switch", "stonelever", "stoneswitch"), - STONE_PRESSURE_PLATE(BlockID.STONE_PRESSURE_PLATE, "Stone pressure plate", "stonepressureplate", "stoneplate"), - IRON_DOOR(BlockID.IRON_DOOR, "Iron Door", "irondoor"), - WOODEN_PRESSURE_PLATE(BlockID.WOODEN_PRESSURE_PLATE, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"), - REDSTONE_ORE(BlockID.REDSTONE_ORE, "Redstone ore", "redstoneore"), - GLOWING_REDSTONE_ORE(BlockID.GLOWING_REDSTONE_ORE, "Glowing redstone ore", "glowingredstoneore"), - REDSTONE_TORCH_OFF(BlockID.REDSTONE_TORCH_OFF, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"), - REDSTONE_TORCH_ON(BlockID.REDSTONE_TORCH_ON, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"), - STONE_BUTTON(BlockID.STONE_BUTTON, "Stone Button", "stonebutton", "button"), - SNOW(BlockID.SNOW, "Snow", "snow"), - ICE(BlockID.ICE, "Ice", "ice"), - SNOW_BLOCK(BlockID.SNOW_BLOCK, "Snow block", "snowblock"), - CACTUS(BlockID.CACTUS, "Cactus", "cactus", "cacti"), - CLAY(BlockID.CLAY, "Clay", "clay"), - SUGAR_CANE(BlockID.REED, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"), - JUKEBOX(BlockID.JUKEBOX, "Jukebox", "jukebox", "stereo", "recordplayer"), - FENCE(BlockID.FENCE, "Fence", "fence"), - PUMPKIN(BlockID.PUMPKIN, "Pumpkin", "pumpkin"), - NETHERRACK(BlockID.NETHERRACK, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"), - SOUL_SAND(BlockID.SLOW_SAND, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"), - GLOWSTONE(BlockID.LIGHTSTONE, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"), - PORTAL(BlockID.PORTAL, "Portal", "portal"), - JACK_O_LANTERN(BlockID.JACKOLANTERN, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"), - CAKE(BlockID.CAKE_BLOCK, "Cake", "cake", "cakeblock"), - REDSTONE_REPEATER_OFF(BlockID.REDSTONE_REPEATER_OFF, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeateroff", "delayeroff"), - REDSTONE_REPEATER_ON(BlockID.REDSTONE_REPEATER_ON, "Redstone repeater (on)", "diodeon", "redstonerepeateron", "repeateron", "delayeron"), - STAINED_GLASS(BlockID.STAINED_GLASS, "Stained Glass", "stainedglass"), - TRAP_DOOR(BlockID.TRAP_DOOR, "Trap door", "trapdoor", "hatch", "floordoor"), - SILVERFISH_BLOCK(BlockID.SILVERFISH_BLOCK, "Silverfish block", "silverfish", "silver"), - STONE_BRICK(BlockID.STONE_BRICK, "Stone brick", "stonebrick", "sbrick", "smoothstonebrick"), - RED_MUSHROOM_CAP(BlockID.RED_MUSHROOM_CAP, "Red mushroom cap", "giantmushroomred", "redgiantmushroom", "redmushroomcap"), - BROWN_MUSHROOM_CAP(BlockID.BROWN_MUSHROOM_CAP, "Brown mushroom cap", "giantmushroombrown", "browngiantmushoom", "brownmushroomcap"), - IRON_BARS(BlockID.IRON_BARS, "Iron bars", "ironbars", "ironfence"), - GLASS_PANE(BlockID.GLASS_PANE, "Glass pane", "window", "glasspane", "glasswindow"), - MELON_BLOCK(BlockID.MELON_BLOCK, "Melon (block)", "melonblock"), - PUMPKIN_STEM(BlockID.PUMPKIN_STEM, "Pumpkin stem", "pumpkinstem"), - MELON_STEM(BlockID.MELON_STEM, "Melon stem", "melonstem"), - VINE(BlockID.VINE, "Vine", "vine", "vines", "creepers"), - FENCE_GATE(BlockID.FENCE_GATE, "Fence gate", "fencegate", "gate"), - BRICK_STAIRS(BlockID.BRICK_STAIRS, "Brick stairs", "brickstairs", "bricksteps"), - STONE_BRICK_STAIRS(BlockID.STONE_BRICK_STAIRS, "Stone brick stairs", "stonebrickstairs", "smoothstonebrickstairs"), - MYCELIUM(BlockID.MYCELIUM, "Mycelium", "mycelium", "fungus", "mycel"), - LILY_PAD(BlockID.LILY_PAD, "Lily pad", "lilypad", "waterlily"), - NETHER_BRICK(BlockID.NETHER_BRICK, "Nether brick", "netherbrick"), - NETHER_BRICK_FENCE(BlockID.NETHER_BRICK_FENCE, "Nether brick fence", "netherbrickfence", "netherfence"), - NETHER_BRICK_STAIRS(BlockID.NETHER_BRICK_STAIRS, "Nether brick stairs", "netherbrickstairs", "netherbricksteps", "netherstairs", "nethersteps"), - NETHER_WART(BlockID.NETHER_WART, "Nether wart", "netherwart", "netherstalk"), - ENCHANTMENT_TABLE(BlockID.ENCHANTMENT_TABLE, "Enchantment table", "enchantmenttable", "enchanttable"), - BREWING_STAND(BlockID.BREWING_STAND, "Brewing Stand", "brewingstand"), - CAULDRON(BlockID.CAULDRON, "Cauldron"), - END_PORTAL(BlockID.END_PORTAL, "End Portal", "endportal", "blackstuff", "airportal", "weirdblackstuff"), - END_PORTAL_FRAME(BlockID.END_PORTAL_FRAME, "End Portal Frame", "endportalframe", "airportalframe", "crystalblock"), - END_STONE(BlockID.END_STONE, "End Stone", "endstone", "enderstone", "endersand"), - DRAGON_EGG(BlockID.DRAGON_EGG, "Dragon Egg", "dragonegg", "dragons"), - REDSTONE_LAMP_OFF(BlockID.REDSTONE_LAMP_OFF, "Redstone lamp (off)", "redstonelamp", "redstonelampoff", "rslamp", "rslampoff", "rsglow", "rsglowoff"), - REDSTONE_LAMP_ON(BlockID.REDSTONE_LAMP_ON, "Redstone lamp (on)", "redstonelampon", "rslampon", "rsglowon"), - DOUBLE_WOODEN_STEP(BlockID.DOUBLE_WOODEN_STEP, "Double wood step", "doublewoodslab", "doublewoodstep"), - WOODEN_STEP(BlockID.WOODEN_STEP, "Wood step", "woodenslab", "woodslab", "woodstep", "woodhalfstep"), - COCOA_PLANT(BlockID.COCOA_PLANT, "Cocoa plant", "cocoplant", "cocoaplant"), - SANDSTONE_STAIRS(BlockID.SANDSTONE_STAIRS, "Sandstone stairs", "sandstairs", "sandstonestairs"), - EMERALD_ORE(BlockID.EMERALD_ORE, "Emerald ore", "emeraldore"), - ENDER_CHEST(BlockID.ENDER_CHEST, "Ender chest", "enderchest"), - TRIPWIRE_HOOK(BlockID.TRIPWIRE_HOOK, "Tripwire hook", "tripwirehook"), - TRIPWIRE(BlockID.TRIPWIRE, "Tripwire", "tripwire", "string"), - EMERALD_BLOCK(BlockID.EMERALD_BLOCK, "Emerald block", "emeraldblock", "emerald"), - SPRUCE_WOOD_STAIRS(BlockID.SPRUCE_WOOD_STAIRS, "Spruce wood stairs", "sprucestairs", "sprucewoodstairs"), - BIRCH_WOOD_STAIRS(BlockID.BIRCH_WOOD_STAIRS, "Birch wood stairs", "birchstairs", "birchwoodstairs"), - JUNGLE_WOOD_STAIRS(BlockID.JUNGLE_WOOD_STAIRS, "Jungle wood stairs", "junglestairs", "junglewoodstairs"), - COMMAND_BLOCK(BlockID.COMMAND_BLOCK, "Command block", "commandblock", "cmdblock", "command", "cmd"), - BEACON(BlockID.BEACON, "Beacon", "beacon", "beaconblock"), - COBBLESTONE_WALL(BlockID.COBBLESTONE_WALL, "Cobblestone wall", "cobblestonewall", "cobblewall"), - FLOWER_POT(BlockID.FLOWER_POT, "Flower pot", "flowerpot", "plantpot", "pot"), - CARROTS(BlockID.CARROTS, "Carrots", "carrots", "carrotsplant", "carrotsblock"), - POTATOES(BlockID.POTATOES, "Potatoes", "potatoes", "potatoesblock"), - WOODEN_BUTTON(BlockID.WOODEN_BUTTON, "Wooden button", "woodbutton", "woodenbutton"), - HEAD(BlockID.HEAD, "Head", "head", "skull"), - ANVIL(BlockID.ANVIL, "Anvil", "anvil", "blacksmith"), - TRAPPED_CHEST(BlockID.TRAPPED_CHEST, "Trapped Chest", "trappedchest", "redstonechest"), - PRESSURE_PLATE_LIGHT(BlockID.PRESSURE_PLATE_LIGHT, "Weighted Pressure Plate (Light)", "lightpressureplate"), - PRESSURE_PLATE_HEAVY(BlockID.PRESSURE_PLATE_HEAVY, "Weighted Pressure Plate (Heavy)", "heavypressureplate"), - COMPARATOR_OFF(BlockID.COMPARATOR_OFF, "Redstone Comparator (inactive)", "redstonecomparator", "comparator"), - COMPARATOR_ON(BlockID.COMPARATOR_ON, "Redstone Comparator (active)", "redstonecomparatoron", "comparatoron"), - DAYLIGHT_SENSOR(BlockID.DAYLIGHT_SENSOR, "Daylight Sensor", "daylightsensor", "lightsensor", "daylightdetector"), - REDSTONE_BLOCK(BlockID.REDSTONE_BLOCK, "Block of Redstone", "redstoneblock", "blockofredstone"), - QUARTZ_ORE(BlockID.QUARTZ_ORE, "Nether Quartz Ore", "quartzore", "netherquartzore"), - HOPPER(BlockID.HOPPER, "Hopper", "hopper"), - QUARTZ_BLOCK(BlockID.QUARTZ_BLOCK, "Block of Quartz", "quartzblock", "quartz"), - QUARTZ_STAIRS(BlockID.QUARTZ_STAIRS, "Quartz Stairs", "quartzstairs"), - ACTIVATOR_RAIL(BlockID.ACTIVATOR_RAIL, "Activator Rail", "activatorrail", "tntrail", "activatortrack"), - DROPPER(BlockID.DROPPER, "Dropper", "dropper"), - STAINED_CLAY(BlockID.STAINED_CLAY, "Stained Clay", "stainedclay", "stainedhardenedclay"), - STAINED_GLASS_PANE(BlockID.STAINED_GLASS_PANE, "Stained Glass Pane", "stainedglasspane"), - LEAVES2(BlockID.LEAVES2, "Leaves", "leaves2", "acacialeaves", "darkoakleaves"), - LOG2(BlockID.LOG2, "Log", "log2", "acacia", "darkoak"), - ACACIA_STAIRS(BlockID.ACACIA_STAIRS, "Acacia Wood Stairs", "acaciawoodstairs", "acaciastairs"), - DARK_OAK_STAIRS(BlockID.DARK_OAK_STAIRS, "Dark Oak Wood Stairs", "darkoakwoodstairs", "darkoakstairs"), - SLIME(BlockID.SLIME, "SLime", "slimeblock"), - BARRIER(BlockID.BARRIER, "Barrier", "barrier", "wall", "worldborder", "edge"), - IRON_TRAP_DOOR(BlockID.IRON_TRAP_DOOR, "Iron Trap Door", "irontrapdoor"), - PRISMARINE(BlockID.PRISMARINE, "Prismarine", "prismarine"), - SEA_LANTERN(BlockID.SEA_LANTERN, "Sea Lantern", "sealantern"), - HAY_BLOCK(BlockID.HAY_BLOCK, "Hay Block", "hayblock", "haybale", "wheatbale"), - CARPET(BlockID.CARPET, "Carpet", "carpet"), - HARDENED_CLAY(BlockID.HARDENED_CLAY, "Hardened Clay", "hardenedclay", "hardclay"), - COAL_BLOCK(BlockID.COAL_BLOCK, "Block of Coal", "coalblock", "blockofcoal"), - PACKED_ICE(BlockID.PACKED_ICE, "Packed Ice", "packedice", "hardice"), - DOUBLE_PLANT(BlockID.DOUBLE_PLANT, "Large Flowers", "largeflowers", "doubleflowers"), - STANDING_BANNER(BlockID.STANDING_BANNER, "Standing Banner", "standingbannear", "banner"), - WALL_BANNER(BlockID.WALL_BANNER, "Wall Banner", "wallbanner"), - DAYLIGHT_SENSOR_INVERTED(BlockID.DAYLIGHT_SENSOR_INVERTED, "Inverted Daylight Sensor", "inverteddaylight", "inverteddaylightsensor"), - RED_SANDSTONE(BlockID.RED_SANDSTONE, "Red Sandstone", "redsandstone"), - RED_SANDSTONE_STAIRS(BlockID.RED_SANDSTONE_STAIRS, "Red Sandstone Stairs", "redsandstonestairs"), - DOUBLE_STEP2(BlockID.DOUBLE_STEP2, "Double Step 2", "doublestep2", "doubleslab2", "doublestoneslab2", "doublestonestep2"), - STEP2(BlockID.STEP2, "Step 2", "step2", "slab2", "stonestep2", "stoneslab2"), - SPRUCE_FENCE_GATE(BlockID.SPRUCE_FENCE_GATE, "Spruce Fence Gate", "spurcefencegate"), - BIRCH_FENCE_GATE(BlockID.BIRCH_FENCE_GATE, "Birch Fence Gate", "birchfencegate"), - JUNGLE_FENCE_GATE(BlockID.JUNGLE_FENCE_GATE, "Jungle Fence Gate", "junglefencegate"), - DARK_OAK_FENCE_GATE(BlockID.DARK_OAK_FENCE_GATE, "Dark Oak Fence Gate", "darkoakfencegate"), - ACACIA_FENCE_GATE(BlockID.ACACIA_FENCE_GATE, "Acacia Fence Gate", "acaciafencegate"), - SPRUCE_FENCE(BlockID.SPRUCE_FENCE, "Spruce Fence", "sprucefence"), - BIRCH_FENCE(BlockID.BIRCH_FENCE, "Birch Fence", "birchfence"), - JUNGLE_FENCE(BlockID.JUNGLE_FENCE, "Jungle Fence", "junglefence"), - DARK_OAK_FENCE(BlockID.DARK_OAK_FENCE, "Dark Oak Fence", "darkoakfence"), - ACACIA_FENCE(BlockID.ACACIA_FENCE, "Acacia Fence", "acaciafence"), - SPRUCE_DOOR(BlockID.SPRUCE_DOOR, "Spruce Door", "sprucedoor"), - BIRCH_DOOR(BlockID.BIRCH_DOOR, "Birch Door", "birchdoor"), - JUNGLE_DOOR(BlockID.JUNGLE_DOOR, "Jungle Door", "jungledoor"), - ACACIA_DOOR(BlockID.ACACIA_DOOR, "Acacia Door", "acaciadoor"), - DARK_OAK_DOOR(BlockID.DARK_OAK_DOOR, "Dark Oak Door", "darkoakdoor"), - END_ROD(BlockID.END_ROD, "End Rod", "endrod", "endtorch"), - CHORUS_PLANT(BlockID.CHORUS_PLANT, "Chorus Plant", "chorusplant", "chorusstem"), - CHORUS_FLOWER(BlockID.CHORUS_FLOWER, "Chorus Flower", "chorusflower"), - PURPUR_BLOCK(BlockID.PURPUR_BLOCK, "Purpur Block", "purpurblock", "blockpurpur"), - PURPUR_PILLAR(BlockID.PURPUR_PILLAR, "Purpur Pillar", "purpurpillar"), - PURPUR_STAIRS(BlockID.PURPUR_STAIRS, "Purpur Stairs", "purpurstairs"), - PURPUR_DOUBLE_SLAB(BlockID.PURPUR_DOUBLE_SLAB, "Purpur Double Slab", "purpurdoubleslab", "doubleslabpurpur", "doublepurpurslab"), - PURPUR_SLAB(BlockID.PURPUR_SLAB, "Purpur Slab", "purpurslab", "slabpurpur"), - END_BRICKS(BlockID.END_BRICKS, "End Bricks", "endbricks"), - BEETROOTS(BlockID.BEETROOTS, "Beetroots", "beetroots", "beetroot_plant"), - GRASS_PATH(BlockID.GRASS_PATH, "Grass Path", "grasspath", "dirtpath"), - END_GATEWAY(BlockID.END_GATEWAY, "End Gateway", "endgateway"), - REPEATING_COMMAND_BLOCK(BlockID.REPEATING_COMMAND_BLOCK, "Repeating Command Block", "repeatingcommandblock", "commandblockrepeating"), - CHAIN_COMMAND_BLOCK(BlockID.CHAIN_COMMAND_BLOCK, "Chain Command Block", "chaincommandblock", "commandblockchain"), - FROSTED_ICE(BlockID.FROSTED_ICE, "Frosted Ice", "frostedice", "frostwalkerice"), - MAGMA_BLOCK(BlockID.MAGMA_BLOCK, "Magma Block", "magmablock", "magma"), - NETHER_WART_BLOCK(BlockID.NETHER_WART_BLOCK, "Nether Wart Block", "netherwartblock"), - RED_NETHER_BRICK(BlockID.RED_NETHER_BRICK, "Red Nether Brick", "rednetherbrick", "netherbrickred"), - BONE_BLOCK(BlockID.BONE_BLOCK, "Bone Block", "boneblock", "blockbone", "fossil", "fossilblock", "blockfossil"), - STRUCTURE_VOID(BlockID.STRUCTURE_VOID, "Structure Void", "structurevoid", "structureair"), - OBSERVER(BlockID.OBSERVER, "Observer", "observer", "blockupdatedetector"), - SHULKER_BOX_WHITE(BlockID.SHULKER_BOX_WHITE, "White Shulker Box", "shulkerboxwhite"), - SHULKER_BOX_ORANGE(BlockID.SHULKER_BOX_ORANGE, "Orange Shulker Box", "shulkerboxorange"), - SHULKER_BOX_MAGENTA(BlockID.SHULKER_BOX_MAGENTA, "Magenta Shulker Box", "shulkerboxmagenta"), - SHULKER_BOX_LIGHT_BLUE(BlockID.SHULKER_BOX_LIGHT_BLUE, "Light Blue Shulker Box", "shulkerboxlightblue"), - SHULKER_BOX_YELLOW(BlockID.SHULKER_BOX_YELLOW, "Yellow Shulker Box", "shulkerboxyellow"), - SHULKER_BOX_LIME(BlockID.SHULKER_BOX_LIME, "Lime Shulker Box", "shulkerboxlime"), - SHULKER_BOX_PINK(BlockID.SHULKER_BOX_PINK, "Pink Shulker Box", "shulkerboxpink"), - SHULKER_BOX_GRAY(BlockID.SHULKER_BOX_GRAY, "Gray Shulker Box", "shulkerboxgray"), - SHULKER_BOX_LIGHT_GRAY(BlockID.SHULKER_BOX_LIGHT_GRAY, "Light Gray Shulker Box", "shulkerboxlightgray"), - SHULKER_BOX_CYAN(BlockID.SHULKER_BOX_CYAN, "Cyan Shulker Box", "shulkerboxcyan"), - SHULKER_BOX_PURPLE(BlockID.SHULKER_BOX_PURPLE, "Purple Shulker Box", "shulkerboxpurple"), - SHULKER_BOX_BLUE(BlockID.SHULKER_BOX_BLUE, "Blue Shulker Box", "shulkerboxblue"), - SHULKER_BOX_BROWN(BlockID.SHULKER_BOX_BROWN, "Brown Shulker Box", "shulkerboxbrown"), - SHULKER_BOX_GREEN(BlockID.SHULKER_BOX_GREEN, "Green Shulker Box", "shulkerboxgreen"), - SHULKER_BOX_RED(BlockID.SHULKER_BOX_RED, "Red Shulker Box", "shulkerboxred"), - SHULKER_BOX_BLACK(BlockID.SHULKER_BOX_BLACK, "Black Shulker Box", "shulkerboxblack"), - TERRACOTTA_WHITE(BlockID.TERRACOTTA_WHITE, "White Terracotta", "terracottawhite"), - TERRACOTTA_ORANGE(BlockID.TERRACOTTA_ORANGE, "Orange Terracotta", "terracottaorange"), - TERRACOTTA_MAGENTA(BlockID.TERRACOTTA_MAGENTA, "Magenta Terracotta", "terracottamagenta"), - TERRACOTTA_LIGHT_BLUE(BlockID.TERRACOTTA_LIGHT_BLUE, "Light Blue Terracotta", "terracottalightblue"), - TERRACOTTA_YELLOW(BlockID.TERRACOTTA_YELLOW, "Yellow Terracotta", "terracottayellow"), - TERRACOTTA_LIME(BlockID.TERRACOTTA_LIME, "Lime Terracotta", "terracottalime"), - TERRACOTTA_PINK(BlockID.TERRACOTTA_PINK, "Pink Terracotta", "terracottapink"), - TERRACOTTA_GRAY(BlockID.TERRACOTTA_GRAY, "Gray Terracotta", "terracottagray"), - TERRACOTTA_LIGHT_GRAY(BlockID.TERRACOTTA_LIGHT_GRAY, "Light Gray Terracotta", "terracottalightgray"), - TERRACOTTA_CYAN(BlockID.TERRACOTTA_CYAN, "Cyan Terracotta", "terracottacyan"), - TERRACOTTA_PURPLE(BlockID.TERRACOTTA_PURPLE, "Purple Terracotta", "terracottapurple"), - TERRACOTTA_BLUE(BlockID.TERRACOTTA_BLUE, "Blue Terracotta", "terracottablue"), - TERRACOTTA_BROWN(BlockID.TERRACOTTA_BROWN, "Brown Terracotta", "terracottabrown"), - TERRACOTTA_GREEN(BlockID.TERRACOTTA_GREEN, "Green Terracotta", "terracottagreen"), - TERRACOTTA_RED(BlockID.TERRACOTTA_RED, "Red Terracotta", "terracottared"), - TERRACOTTA_BLACK(BlockID.TERRACOTTA_BLACK, "Black Terracotta", "terracottablack"), - CONCRETE(BlockID.CONCRETE, "Concrete", "concrete"), - CONCRETE_POWDER(BlockID.CONCRETE_POWDER, "Concrete Powder", "concretepowder"), - STRUCTURE_BLOCK(BlockID.STRUCTURE_BLOCK, "Structure Block", "structureblock"); - - /** - * Stores a map of the IDs for fast access. - */ - private static final Map ids = new HashMap<>(); - /** - * Stores a map of the names for fast access. - */ - private static final Map lookup = new HashMap<>(); - - private final int id; - private final String name; - private final String[] lookupKeys; - - static { - for (BlockType type : EnumSet.allOf(BlockType.class)) { - ids.put(type.id, type); - for (String key : type.lookupKeys) { - lookup.put(key, type); - } - } - } - - - /** - * Construct the type. - * - * @param id the ID of the block - * @param name the name of the block - * @param lookupKey a name to reference the block by - */ - BlockType(int id, String name, String lookupKey) { - this.id = id; - this.name = name; - this.lookupKeys = new String[] { lookupKey }; - } - - /** - * Construct the type. - * - * @param id the ID of the block - * @param name the name of the block - * @param lookupKeys an array of keys to reference the block by - */ - BlockType(int id, String name, String... lookupKeys) { - this.id = id; - this.name = name; - this.lookupKeys = lookupKeys; - } - - /** - * Return type from ID. May return null. - * - * @param id the type ID - * @return a block type, otherwise null - */ - @Nullable - public static BlockType fromID(int id) { - return ids.get(id); - } - - /** - * Return type from name. May return null. - * - * @param name the name to search - * @return a block type or null - */ - @Nullable - public static BlockType lookup(String name) { - return lookup(name, true); - } - - /** - * Return type from name. May return null. - * - * @param name the name (or ID) of a block - * @param fuzzy true to for a fuzzy search on the block name - * @return a block type or null - */ - @Nullable - public static BlockType lookup(String name, boolean fuzzy) { - try { - return fromID(Integer.parseInt(name)); - } catch (NumberFormatException e) { - return StringUtil.lookup(lookup, name, fuzzy); - } - } - - private static final Map itemBlockMapping = new HashMap<>(); - private static final Map dataItemBlockMapping = new HashMap<>(); - static { - for (int data = 0; data < 16; ++data) { - dataItemBlockMapping.put(typeDataKey(BlockID.DIRT, data), new BaseBlock(BlockID.DIRT, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.WOOD, data), new BaseBlock(BlockID.WOOD, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.SAND, data), new BaseBlock(BlockID.SAND, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.SANDSTONE, data), new BaseBlock(BlockID.SANDSTONE, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.LONG_GRASS, data), new BaseBlock(BlockID.LONG_GRASS, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.CLOTH, data), new BaseBlock(BlockID.CLOTH, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.SILVERFISH_BLOCK, data), new BaseBlock(BlockID.SILVERFISH_BLOCK, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.STONE_BRICK, data), new BaseBlock(BlockID.STONE_BRICK, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.COBBLESTONE_WALL, data), new BaseBlock(BlockID.COBBLESTONE_WALL, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.STAINED_CLAY, data), new BaseBlock(BlockID.STAINED_CLAY, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.CARPET, data), new BaseBlock(BlockID.CARPET, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.RED_FLOWER, data), new BaseBlock(BlockID.RED_FLOWER, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.DOUBLE_PLANT, data), new BaseBlock(BlockID.DOUBLE_PLANT, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.STAINED_GLASS, data), new BaseBlock(BlockID.STAINED_GLASS, data)); - } - - itemBlockMapping.put(ItemID.FLINT_AND_TINDER, new BaseBlock(BlockID.FIRE, -1)); - itemBlockMapping.put(ItemID.STRING, new BaseBlock(BlockID.TRIPWIRE, -1)); - itemBlockMapping.put(ItemID.SEEDS, new BaseBlock(BlockID.CROPS, -1)); - itemBlockMapping.put(ItemID.SIGN, new BaseBlock(BlockID.SIGN_POST, -1)); - itemBlockMapping.put(ItemID.WOODEN_DOOR_ITEM, new BaseBlock(BlockID.WOODEN_DOOR, -1)); - itemBlockMapping.put(ItemID.WATER_BUCKET, new BaseBlock(BlockID.STATIONARY_WATER, -1)); - itemBlockMapping.put(ItemID.LAVA_BUCKET, new BaseBlock(BlockID.STATIONARY_LAVA, -1)); - itemBlockMapping.put(ItemID.IRON_DOOR_ITEM, new BaseBlock(BlockID.IRON_DOOR, -1)); - itemBlockMapping.put(ItemID.REDSTONE_DUST, new BaseBlock(BlockID.REDSTONE_WIRE, -1)); - itemBlockMapping.put(ItemID.SUGAR_CANE_ITEM, new BaseBlock(BlockID.REED, -1)); - itemBlockMapping.put(ItemID.BED_ITEM, new BaseBlock(BlockID.BED, -1)); - itemBlockMapping.put(ItemID.REDSTONE_REPEATER, new BaseBlock(BlockID.REDSTONE_REPEATER_OFF, -1)); - itemBlockMapping.put(ItemID.PUMPKIN_SEEDS, new BaseBlock(BlockID.PUMPKIN_STEM, -1)); - itemBlockMapping.put(ItemID.MELON_SEEDS, new BaseBlock(BlockID.MELON_STEM, -1)); - itemBlockMapping.put(ItemID.NETHER_WART_SEED, new BaseBlock(BlockID.NETHER_WART, -1)); - itemBlockMapping.put(ItemID.BREWING_STAND, new BaseBlock(BlockID.BREWING_STAND, -1)); - itemBlockMapping.put(ItemID.CAULDRON, new BaseBlock(BlockID.CAULDRON, -1)); - itemBlockMapping.put(ItemID.FLOWER_POT, new BaseBlock(BlockID.FLOWER_POT, -1)); - itemBlockMapping.put(ItemID.CARROT, new BaseBlock(BlockID.CARROTS, -1)); - itemBlockMapping.put(ItemID.POTATO, new BaseBlock(BlockID.POTATOES, -1)); - itemBlockMapping.put(ItemID.COMPARATOR, new BaseBlock(BlockID.COMPARATOR_OFF, -1)); - itemBlockMapping.put(ItemID.BANNER, new BaseBlock(BlockID.STANDING_BANNER, -1)); - itemBlockMapping.put(ItemID.SPRUCE_DOOR, new BaseBlock(BlockID.SPRUCE_DOOR, -1)); - itemBlockMapping.put(ItemID.BIRCH_DOOR, new BaseBlock(BlockID.BIRCH_DOOR, -1)); - itemBlockMapping.put(ItemID.JUNGLE_DOOR, new BaseBlock(BlockID.JUNGLE_DOOR, -1)); - itemBlockMapping.put(ItemID.ACACIA_DOOR, new BaseBlock(BlockID.ACACIA_DOOR, -1)); - itemBlockMapping.put(ItemID.DARK_OAK_DOOR, new BaseBlock(BlockID.DARK_OAK_DOOR, -1)); - } - - /** - * Get the equivalent block for an item. - * - * @param typeId the type ID of the block - * @param data the data valuie of the block - * @return a block or null - */ - @Nullable - public static BaseBlock getBlockForItem(int typeId, int data) { - final BaseBlock block = itemBlockMapping.get(typeId); - - if (block != null) { - return block; - } - - return dataItemBlockMapping.get(typeDataKey(typeId, data)); - } - - /** - * Get block numeric ID. - * - * @return the block ID - */ - public int getID() { - return id; - } - - /** - * Get user-friendly block name. - * - * @return the block name - */ - public String getName() { - return name; - } - + ; /** * HashSet for shouldPlaceLast. @@ -539,16 +111,6 @@ public enum BlockType { return shouldPlaceLast.contains(id); } - /** - * Checks to see whether this block should be placed last (when reordering - * blocks that are placed) - * - * @return true if the block should be placed last - */ - public boolean shouldPlaceLast() { - return shouldPlaceLast.contains(id); - } - /** * HashSet for shouldPlaceLast. */ @@ -584,108 +146,6 @@ public enum BlockType { return shouldPlaceFinal.contains(id); } - /** - * HashSet for canPassThrough. - */ - private static final Set canPassThrough = new HashSet<>(); - static { - canPassThrough.add(BlockID.AIR); - canPassThrough.add(BlockID.WATER); - canPassThrough.add(BlockID.STATIONARY_WATER); - canPassThrough.add(BlockID.SAPLING); - canPassThrough.add(BlockID.POWERED_RAIL); - canPassThrough.add(BlockID.DETECTOR_RAIL); - canPassThrough.add(BlockID.WEB); - canPassThrough.add(BlockID.LONG_GRASS); - canPassThrough.add(BlockID.DEAD_BUSH); - canPassThrough.add(BlockID.YELLOW_FLOWER); - canPassThrough.add(BlockID.RED_FLOWER); - canPassThrough.add(BlockID.BROWN_MUSHROOM); - canPassThrough.add(BlockID.RED_MUSHROOM); - canPassThrough.add(BlockID.TORCH); - canPassThrough.add(BlockID.FIRE); - canPassThrough.add(BlockID.REDSTONE_WIRE); - canPassThrough.add(BlockID.CROPS); - canPassThrough.add(BlockID.SIGN_POST); - canPassThrough.add(BlockID.LADDER); - canPassThrough.add(BlockID.MINECART_TRACKS); - canPassThrough.add(BlockID.WALL_SIGN); - canPassThrough.add(BlockID.LEVER); - canPassThrough.add(BlockID.STONE_PRESSURE_PLATE); - canPassThrough.add(BlockID.WOODEN_PRESSURE_PLATE); - canPassThrough.add(BlockID.REDSTONE_TORCH_OFF); - canPassThrough.add(BlockID.REDSTONE_TORCH_ON); - canPassThrough.add(BlockID.STONE_BUTTON); - canPassThrough.add(-16*BlockID.SNOW-0); - canPassThrough.add(-16*BlockID.SNOW-8); - canPassThrough.add(BlockID.REED); - canPassThrough.add(BlockID.PORTAL); - canPassThrough.add(BlockID.REDSTONE_REPEATER_OFF); - canPassThrough.add(BlockID.REDSTONE_REPEATER_ON); - canPassThrough.add(BlockID.PUMPKIN_STEM); - canPassThrough.add(BlockID.MELON_STEM); - canPassThrough.add(BlockID.VINE); - canPassThrough.add(BlockID.NETHER_WART); - canPassThrough.add(BlockID.END_PORTAL); - canPassThrough.add(BlockID.TRIPWIRE_HOOK); - canPassThrough.add(BlockID.TRIPWIRE); - canPassThrough.add(BlockID.CARROTS); - canPassThrough.add(BlockID.POTATOES); - canPassThrough.add(BlockID.WOODEN_BUTTON); - canPassThrough.add(BlockID.PRESSURE_PLATE_LIGHT); - canPassThrough.add(BlockID.PRESSURE_PLATE_HEAVY); - canPassThrough.add(BlockID.COMPARATOR_OFF); - canPassThrough.add(BlockID.COMPARATOR_ON); - canPassThrough.add(BlockID.ACTIVATOR_RAIL); - canPassThrough.add(BlockID.IRON_TRAP_DOOR); - canPassThrough.add(BlockID.CARPET); - canPassThrough.add(BlockID.DOUBLE_PLANT); - canPassThrough.add(BlockID.STANDING_BANNER); - canPassThrough.add(BlockID.WALL_BANNER); - } - - - /** - * Checks whether a block can be passed through. - * - * @param id the ID of the block - * @return true if the block can be passed through - */ - public static boolean canPassThrough(int id) { - return canPassThrough.contains(id); - } - - /** - * Checks whether a block can be passed through. - * - * @param id the ID of the block - * @param data the data value of the block - * @return true if the block can be passed through - */ - public static boolean canPassThrough(int id, int data) { - return canPassThrough.contains(-16*id-data) || canPassThrough.contains(id); - } - - /** - * Checks whether a block can be passed through. - * - * @param block the block - * @return true if the block can be passed through - */ - public static boolean canPassThrough(BlockStateHolder block) { - checkNotNull(block); - return canPassThrough(block.getBlockType().getLegacyId()); - } - - /** - * Checks whether the block type can be passed through. - * - * @return whether the block can be passed through - */ - public boolean canPassThrough() { - return canPassThrough.contains(id); - } - /** * HashSet for centralTopLimit. */ @@ -761,7 +221,7 @@ public enum BlockType { if (centralTopLimit.containsKey(id)) return centralTopLimit.get(id); - return canPassThrough(id) ? 0 : 1; + return 1; } /** @@ -775,163 +235,6 @@ public enum BlockType { return centralTopLimit(block.getBlockType().getLegacyId(), 0); } - /** - * Returns the y offset a player falls to when falling onto the top of a block at xp+0.5/zp+0.5. - * - * @return the y offset - */ - public double centralTopLimit() { - if (centralTopLimit.containsKey(id)) - return centralTopLimit.get(id); - - return canPassThrough(id) ? 0 : 1; - } - - /** - * HashSet for usesData. - */ - private static final Set usesData = new HashSet<>(); - static { - usesData.add(BlockID.STONE); - usesData.add(BlockID.DIRT); - usesData.add(BlockID.WOOD); - usesData.add(BlockID.SAPLING); - usesData.add(BlockID.WATER); - usesData.add(BlockID.STATIONARY_WATER); - usesData.add(BlockID.LAVA); - usesData.add(BlockID.STATIONARY_LAVA); - usesData.add(BlockID.SAND); - usesData.add(BlockID.LOG); - usesData.add(BlockID.LOG2); - usesData.add(BlockID.LEAVES); - usesData.add(BlockID.LEAVES2); - usesData.add(BlockID.SPONGE); - usesData.add(BlockID.DISPENSER); - usesData.add(BlockID.SANDSTONE); - usesData.add(BlockID.BED); - usesData.add(BlockID.POWERED_RAIL); - usesData.add(BlockID.DETECTOR_RAIL); - usesData.add(BlockID.PISTON_STICKY_BASE); - usesData.add(BlockID.LONG_GRASS); - usesData.add(BlockID.PISTON_BASE); - usesData.add(BlockID.PISTON_EXTENSION); - usesData.add(BlockID.CLOTH); - usesData.add(BlockID.RED_FLOWER); - usesData.add(BlockID.DOUBLE_STEP); - usesData.add(BlockID.STEP); - usesData.add(BlockID.TORCH); - usesData.add(BlockID.FIRE); - usesData.add(BlockID.OAK_WOOD_STAIRS); - usesData.add(BlockID.CHEST); - usesData.add(BlockID.REDSTONE_WIRE); - usesData.add(BlockID.CROPS); - usesData.add(BlockID.SOIL); - usesData.add(BlockID.FURNACE); - usesData.add(BlockID.BURNING_FURNACE); - usesData.add(BlockID.SIGN_POST); - usesData.add(BlockID.WOODEN_DOOR); - usesData.add(BlockID.LADDER); - usesData.add(BlockID.MINECART_TRACKS); - usesData.add(BlockID.COBBLESTONE_STAIRS); - usesData.add(BlockID.WALL_SIGN); - usesData.add(BlockID.LEVER); - usesData.add(BlockID.STONE_PRESSURE_PLATE); - usesData.add(BlockID.IRON_DOOR); - usesData.add(BlockID.WOODEN_PRESSURE_PLATE); - usesData.add(BlockID.REDSTONE_TORCH_OFF); - usesData.add(BlockID.REDSTONE_TORCH_ON); - usesData.add(BlockID.STONE_BUTTON); - usesData.add(BlockID.SNOW); - usesData.add(BlockID.CACTUS); - usesData.add(BlockID.REED); - usesData.add(BlockID.JUKEBOX); - usesData.add(BlockID.PUMPKIN); - usesData.add(BlockID.JACKOLANTERN); - usesData.add(BlockID.CAKE_BLOCK); - usesData.add(BlockID.REDSTONE_REPEATER_OFF); - usesData.add(BlockID.REDSTONE_REPEATER_ON); - usesData.add(BlockID.TRAP_DOOR); - usesData.add(BlockID.SILVERFISH_BLOCK); - usesData.add(BlockID.STONE_BRICK); - usesData.add(BlockID.RED_MUSHROOM_CAP); - usesData.add(BlockID.BROWN_MUSHROOM_CAP); - usesData.add(BlockID.PUMPKIN_STEM); - usesData.add(BlockID.MELON_STEM); - usesData.add(BlockID.VINE); - usesData.add(BlockID.FENCE_GATE); - usesData.add(BlockID.BRICK_STAIRS); - usesData.add(BlockID.STONE_BRICK_STAIRS); - usesData.add(BlockID.NETHER_BRICK_STAIRS); - usesData.add(BlockID.NETHER_WART); - usesData.add(BlockID.BREWING_STAND); - usesData.add(BlockID.CAULDRON); - usesData.add(BlockID.END_PORTAL_FRAME); - usesData.add(BlockID.DOUBLE_WOODEN_STEP); - usesData.add(BlockID.WOODEN_STEP); - usesData.add(BlockID.COCOA_PLANT); - usesData.add(BlockID.SANDSTONE_STAIRS); - usesData.add(BlockID.ENDER_CHEST); - usesData.add(BlockID.TRIPWIRE_HOOK); - usesData.add(BlockID.TRIPWIRE); - usesData.add(BlockID.SPRUCE_WOOD_STAIRS); - usesData.add(BlockID.BIRCH_WOOD_STAIRS); - usesData.add(BlockID.JUNGLE_WOOD_STAIRS); - usesData.add(BlockID.COBBLESTONE_WALL); - usesData.add(BlockID.FLOWER_POT); - usesData.add(BlockID.CARROTS); - usesData.add(BlockID.POTATOES); - usesData.add(BlockID.WOODEN_BUTTON); - usesData.add(BlockID.HEAD); - usesData.add(BlockID.ANVIL); - usesData.add(BlockID.PRESSURE_PLATE_LIGHT); - usesData.add(BlockID.PRESSURE_PLATE_HEAVY); - usesData.add(BlockID.COMPARATOR_OFF); - usesData.add(BlockID.COMPARATOR_ON); - usesData.add(BlockID.QUARTZ_BLOCK); - usesData.add(BlockID.QUARTZ_STAIRS); - usesData.add(BlockID.ACTIVATOR_RAIL); - usesData.add(BlockID.DROPPER); - usesData.add(BlockID.HOPPER); - usesData.add(BlockID.STAINED_CLAY); - usesData.add(BlockID.STAINED_GLASS); - usesData.add(BlockID.STAINED_GLASS_PANE); - usesData.add(BlockID.IRON_TRAP_DOOR); - usesData.add(BlockID.PRISMARINE); - usesData.add(BlockID.HAY_BLOCK); - usesData.add(BlockID.CARPET); - usesData.add(BlockID.DOUBLE_PLANT); - usesData.add(BlockID.STANDING_BANNER); - usesData.add(BlockID.WALL_BANNER); - usesData.add(BlockID.RED_SANDSTONE); - usesData.add(BlockID.RED_SANDSTONE_STAIRS); - usesData.add(BlockID.DOUBLE_STEP2); - usesData.add(BlockID.STEP2); - usesData.add(BlockID.SPRUCE_DOOR); - usesData.add(BlockID.BIRCH_DOOR); - usesData.add(BlockID.JUNGLE_DOOR); - usesData.add(BlockID.ACACIA_DOOR); - usesData.add(BlockID.DARK_OAK_DOOR); - } - - /** - * Returns true if the block uses its data value. - * - * @param id the type ID - * @return true if the block type uses its data value - */ - public static boolean usesData(int id) { - return usesData.contains(id); - } - - /** - * Returns true if the block uses its data value. - * - * @return true if this block type uses its data value - */ - public boolean usesData() { - return usesData.contains(id); - } - /** * HashSet for isContainerBlock. */ @@ -958,185 +261,6 @@ public enum BlockType { return isContainerBlock.contains(id); } - /** - * Returns true if the block is a container block. - * - * @return true if the block is a container block - */ - public boolean isContainerBlock() { - return isContainerBlock.contains(id); - } - - /** - * HashSet for isRedstoneBlock. - */ - private static final Set isRedstoneBlock = new HashSet<>(); - static { - isRedstoneBlock.add(BlockID.POWERED_RAIL); - isRedstoneBlock.add(BlockID.DETECTOR_RAIL); - isRedstoneBlock.add(BlockID.PISTON_STICKY_BASE); - isRedstoneBlock.add(BlockID.PISTON_BASE); - isRedstoneBlock.add(BlockID.LEVER); - isRedstoneBlock.add(BlockID.STONE_PRESSURE_PLATE); - isRedstoneBlock.add(BlockID.WOODEN_PRESSURE_PLATE); - isRedstoneBlock.add(BlockID.REDSTONE_TORCH_OFF); - isRedstoneBlock.add(BlockID.REDSTONE_TORCH_ON); - isRedstoneBlock.add(BlockID.STONE_BUTTON); - isRedstoneBlock.add(BlockID.REDSTONE_WIRE); - isRedstoneBlock.add(BlockID.WOODEN_DOOR); - isRedstoneBlock.add(BlockID.ACACIA_DOOR); - isRedstoneBlock.add(BlockID.BIRCH_DOOR); - isRedstoneBlock.add(BlockID.JUNGLE_DOOR); - isRedstoneBlock.add(BlockID.DARK_OAK_DOOR); - isRedstoneBlock.add(BlockID.SPRUCE_DOOR); - isRedstoneBlock.add(BlockID.IRON_DOOR); - isRedstoneBlock.add(BlockID.TNT); - isRedstoneBlock.add(BlockID.DISPENSER); - isRedstoneBlock.add(BlockID.NOTE_BLOCK); - isRedstoneBlock.add(BlockID.REDSTONE_REPEATER_OFF); - isRedstoneBlock.add(BlockID.REDSTONE_REPEATER_ON); - isRedstoneBlock.add(BlockID.TRIPWIRE_HOOK); - isRedstoneBlock.add(BlockID.COMMAND_BLOCK); - isRedstoneBlock.add(BlockID.WOODEN_BUTTON); - isRedstoneBlock.add(BlockID.TRAPPED_CHEST); - isRedstoneBlock.add(BlockID.PRESSURE_PLATE_LIGHT); - isRedstoneBlock.add(BlockID.PRESSURE_PLATE_HEAVY); - isRedstoneBlock.add(BlockID.COMPARATOR_OFF); - isRedstoneBlock.add(BlockID.COMPARATOR_ON); - isRedstoneBlock.add(BlockID.DAYLIGHT_SENSOR); - isRedstoneBlock.add(BlockID.REDSTONE_BLOCK); - isRedstoneBlock.add(BlockID.HOPPER); - isRedstoneBlock.add(BlockID.ACTIVATOR_RAIL); - isRedstoneBlock.add(BlockID.DROPPER); - isRedstoneBlock.add(BlockID.DAYLIGHT_SENSOR_INVERTED); - } - - /** - * Returns true if a block uses Redstone in some way. - * - * @param id the type ID of the block - * @return true if the block uses Redstone - */ - public static boolean isRedstoneBlock(int id) { - return isRedstoneBlock.contains(id); - } - - /** - * Returns true if a block uses Redstone in some way. - * - * @return true if the block uses Redstone - */ - public boolean isRedstoneBlock() { - return isRedstoneBlock.contains(id); - } - - /** - * HashSet for canTransferRedstone. - */ - private static final Set canTransferRedstone = new HashSet<>(); - static { - canTransferRedstone.add(BlockID.REDSTONE_TORCH_OFF); - canTransferRedstone.add(BlockID.REDSTONE_TORCH_ON); - canTransferRedstone.add(BlockID.REDSTONE_WIRE); - canTransferRedstone.add(BlockID.REDSTONE_REPEATER_OFF); - canTransferRedstone.add(BlockID.REDSTONE_REPEATER_ON); - canTransferRedstone.add(BlockID.COMPARATOR_OFF); - canTransferRedstone.add(BlockID.COMPARATOR_ON); - } - - /** - * Returns true if a block can transfer Redstone. - * - *

This was made since {@link #isRedstoneBlock} was getting big.

- * - * @param id the type ID of the block - * @return true if the block can transfer redstone - */ - public static boolean canTransferRedstone(int id) { - return canTransferRedstone.contains(id); - } - - /** - * Returns true if a block can transfer Redstone. - * - *

This was made since {@link #isRedstoneBlock} was getting big.

- * - * @return true if the block can transfer redstone - */ - public boolean canTransferRedstone() { - return canTransferRedstone.contains(id); - } - - /** - * HashSet for isRedstoneSource. - */ - private static final Set isRedstoneSource = new HashSet<>(); - static { - isRedstoneSource.add(BlockID.DETECTOR_RAIL); - isRedstoneSource.add(BlockID.REDSTONE_TORCH_OFF); - isRedstoneSource.add(BlockID.REDSTONE_TORCH_ON); - isRedstoneSource.add(BlockID.LEVER); - isRedstoneSource.add(BlockID.STONE_PRESSURE_PLATE); - isRedstoneSource.add(BlockID.WOODEN_PRESSURE_PLATE); - isRedstoneSource.add(BlockID.STONE_BUTTON); - isRedstoneSource.add(BlockID.TRIPWIRE_HOOK); - isRedstoneSource.add(BlockID.WOODEN_BUTTON); - isRedstoneSource.add(BlockID.PRESSURE_PLATE_LIGHT); - isRedstoneSource.add(BlockID.PRESSURE_PLATE_HEAVY); - isRedstoneSource.add(BlockID.DAYLIGHT_SENSOR); - isRedstoneSource.add(BlockID.REDSTONE_BLOCK); - isRedstoneSource.add(BlockID.DAYLIGHT_SENSOR_INVERTED); - } - - /** - * Returns whether the block is a Redstone source. - * - * @param id the type ID of the block - * @return true if the block is a Redstone source - */ - public static boolean isRedstoneSource(int id) { - return isRedstoneSource.contains(id); - } - - /** - * Returns whether the block is a Redstone source. - * - * @return true if the block is a Redstone source - */ - public boolean isRedstoneSource() { - return isRedstoneSource.contains(id); - } - - /** - * HashSet for isRailBlock. - */ - private static final Set isRailBlock = new HashSet<>(); - static { - isRailBlock.add(BlockID.POWERED_RAIL); - isRailBlock.add(BlockID.DETECTOR_RAIL); - isRailBlock.add(BlockID.MINECART_TRACKS); - isRailBlock.add(BlockID.ACTIVATOR_RAIL); - } - - /** - * Checks if the block is that of one of the rail types. - * - * @param id the type ID of the block - * @return true if the block is a rail block - */ - public static boolean isRailBlock(int id) { - return isRailBlock.contains(id); - } - - /** - * Checks if the block is that of one of the rail types - * - * @return true if the block is a rail block - */ - public boolean isRailBlock() { - return isRailBlock.contains(id); - } - /** * HashSet for isNaturalBlock. */ @@ -1194,44 +318,6 @@ public enum BlockType { return isNaturalTerrainBlock.contains(-16*id-data) || isNaturalTerrainBlock.contains(id); } - /** - * HashSet for emitsLight. - */ - private static final Set emitsLight = new HashSet<>(); - static { - emitsLight.add(BlockID.LAVA); - emitsLight.add(BlockID.STATIONARY_LAVA); - emitsLight.add(BlockID.BROWN_MUSHROOM); - emitsLight.add(BlockID.RED_MUSHROOM); - emitsLight.add(BlockID.TORCH); - emitsLight.add(BlockID.FIRE); - emitsLight.add(BlockID.BURNING_FURNACE); - emitsLight.add(BlockID.GLOWING_REDSTONE_ORE); - emitsLight.add(BlockID.REDSTONE_TORCH_ON); - emitsLight.add(BlockID.LIGHTSTONE); - emitsLight.add(BlockID.PORTAL); - emitsLight.add(BlockID.JACKOLANTERN); - emitsLight.add(BlockID.REDSTONE_REPEATER_ON); - emitsLight.add(BlockID.BROWN_MUSHROOM_CAP); - emitsLight.add(BlockID.RED_MUSHROOM_CAP); - emitsLight.add(BlockID.END_PORTAL); - emitsLight.add(BlockID.REDSTONE_LAMP_ON); - emitsLight.add(BlockID.ENDER_CHEST); - emitsLight.add(BlockID.BEACON); - emitsLight.add(BlockID.REDSTONE_BLOCK); - emitsLight.add(BlockID.SEA_LANTERN); - } - - /** - * Checks if the block type emits light. - * - * @param id the type ID of the block - * @return true if the block emits light - */ - public static boolean emitsLight(int id) { - return emitsLight.contains(id); - } - /** * HashSet for isTranslucent. */ @@ -1616,16 +702,6 @@ public enum BlockType { } } - /** - * Get the block drop for this type given a data value. - * - * @param data the data value - * @return the item stack - */ - public BaseItemStack getBlockDrop(short data) { - return getBlockDrop(id, data); - } - private static final Random random = new Random(); /** @@ -1844,11 +920,7 @@ public enum BlockType { return null; } - if (usesData(id)) { - return new BaseItemStack(id, 1, data); - } else { - return new BaseItemStack(id); - } + return new BaseItemStack(id); } private static final Map dataAttachments = new HashMap<>(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ItemID.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ItemID.java index 7944ab876..92ccdd370 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ItemID.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ItemID.java @@ -27,218 +27,35 @@ package com.sk89q.worldedit.blocks; @Deprecated public final class ItemID { - public static final int IRON_SHOVEL = 256; - public static final int IRON_PICK = 257; - public static final int IRON_AXE = 258; - public static final int FLINT_AND_TINDER = 259; - public static final int RED_APPLE = 260; - public static final int BOW = 261; - public static final int ARROW = 262; public static final int COAL = 263; public static final int DIAMOND = 264; - public static final int IRON_BAR = 265; - public static final int GOLD_BAR = 266; - public static final int IRON_SWORD = 267; - public static final int WOOD_SWORD = 268; - public static final int WOOD_SHOVEL = 269; - public static final int WOOD_PICKAXE = 270; - public static final int WOOD_AXE = 271; - public static final int STONE_SWORD = 272; - public static final int STONE_SHOVEL = 273; - public static final int STONE_PICKAXE = 274; - public static final int STONE_AXE = 275; - public static final int DIAMOND_SWORD = 276; - public static final int DIAMOND_SHOVEL = 277; - public static final int DIAMOND_PICKAXE = 278; - public static final int DIAMOND_AXE = 279; - public static final int STICK = 280; - public static final int BOWL = 281; - public static final int MUSHROOM_SOUP = 282; - public static final int GOLD_SWORD = 283; - public static final int GOLD_SHOVEL = 284; - public static final int GOLD_PICKAXE = 285; - public static final int GOLD_AXE = 286; public static final int STRING = 287; - public static final int FEATHER = 288; - public static final int SULPHUR = 289; - public static final int WOOD_HOE = 290; - public static final int STONE_HOE = 291; - public static final int IRON_HOE = 292; - public static final int DIAMOND_HOE = 293; - public static final int GOLD_HOE = 294; public static final int SEEDS = 295; public static final int WHEAT = 296; - public static final int BREAD = 297; - public static final int LEATHER_HELMET = 298; - public static final int LEATHER_CHEST = 299; - public static final int LEATHER_PANTS = 300; - public static final int LEATHER_BOOTS = 301; - public static final int CHAINMAIL_HELMET = 302; - public static final int CHAINMAIL_CHEST = 303; - public static final int CHAINMAIL_PANTS = 304; - public static final int CHAINMAIL_BOOTS = 305; - public static final int IRON_HELMET = 306; - public static final int IRON_CHEST = 307; - public static final int IRON_PANTS = 308; - public static final int IRON_BOOTS = 309; - public static final int DIAMOND_HELMET = 310; - public static final int DIAMOND_CHEST = 311; - public static final int DIAMOND_PANTS = 312; - public static final int DIAMOND_BOOTS = 313; - public static final int GOLD_HELMET = 314; - public static final int GOLD_CHEST = 315; - public static final int GOLD_PANTS = 316; - public static final int GOLD_BOOTS = 317; public static final int FLINT = 318; - public static final int RAW_PORKCHOP = 319; - public static final int COOKED_PORKCHOP = 320; - public static final int PAINTING = 321; - public static final int GOLD_APPLE = 322; public static final int SIGN = 323; public static final int WOODEN_DOOR_ITEM = 324; - public static final int BUCKET = 325; - public static final int WATER_BUCKET = 326; - public static final int LAVA_BUCKET = 327; - public static final int MINECART = 328; - public static final int SADDLE = 329; public static final int IRON_DOOR_ITEM = 330; public static final int REDSTONE_DUST = 331; - public static final int SNOWBALL = 332; - public static final int WOOD_BOAT = 333; - public static final int LEATHER = 334; - public static final int MILK_BUCKET = 335; - public static final int BRICK_BAR = 336; public static final int CLAY_BALL = 337; public static final int SUGAR_CANE_ITEM = 338; - public static final int PAPER = 339; - public static final int BOOK = 340; - public static final int SLIME_BALL = 341; - public static final int STORAGE_MINECART = 342; - public static final int POWERED_MINECART = 343; - public static final int EGG = 344; - public static final int COMPASS = 345; - public static final int FISHING_ROD = 346; - public static final int WATCH = 347; public static final int LIGHTSTONE_DUST = 348; - public static final int RAW_FISH = 349; - public static final int COOKED_FISH = 350; public static final int INK_SACK = 351; - public static final int BONE = 352; - public static final int SUGAR = 353; public static final int CAKE_ITEM = 354; public static final int BED_ITEM = 355; public static final int REDSTONE_REPEATER = 356; - public static final int COOKIE = 357; - public static final int MAP = 358; - public static final int SHEARS = 359; public static final int MELON = 360; public static final int PUMPKIN_SEEDS = 361; public static final int MELON_SEEDS = 362; - public static final int RAW_BEEF = 363; - public static final int COOKED_BEEF = 364; - public static final int RAW_CHICKEN = 365; - public static final int COOKED_CHICKEN = 366; - public static final int ROTTEN_FLESH = 367; - public static final int ENDER_PEARL = 368; - public static final int BLAZE_ROD = 369; - public static final int GHAST_TEAR = 370; - public static final int GOLD_NUGGET = 371; public static final int NETHER_WART_SEED = 372; - public static final int POTION = 373; - public static final int GLASS_BOTTLE = 374; - public static final int SPIDER_EYE = 375; - public static final int FERMENTED_SPIDER_EYE = 376; - public static final int BLAZE_POWDER = 377; - public static final int MAGMA_CREAM = 378; public static final int BREWING_STAND = 379; public static final int CAULDRON = 380; - public static final int EYE_OF_ENDER = 381; - public static final int GLISTERING_MELON = 382; - public static final int SPAWN_EGG = 383; - public static final int BOTTLE_O_ENCHANTING = 384; - public static final int FIRE_CHARGE = 385; - public static final int BOOK_AND_QUILL = 386; - public static final int WRITTEN_BOOK = 387; public static final int EMERALD = 388; - public static final int ITEM_FRAME = 389; public static final int FLOWER_POT = 390; public static final int CARROT = 391; public static final int POTATO = 392; - public static final int BAKED_POTATO = 393; - public static final int POISONOUS_POTATO = 394; - public static final int BLANK_MAP = 395; - public static final int GOLDEN_CARROT = 396; - public static final int HEAD = 397; - public static final int CARROT_ON_A_STICK = 398; - public static final int NETHER_STAR = 399; - public static final int PUMPKIN_PIE = 400; - public static final int FIREWORK_ROCKET = 401; - public static final int FIREWORK_STAR = 402; - public static final int ENCHANTED_BOOK = 403; public static final int COMPARATOR = 404; - public static final int NETHER_BRICK = 405; public static final int NETHER_QUARTZ = 406; - public static final int TNT_MINECART = 407; - public static final int HOPPER_MINECART = 408; - public static final int PRISMARINE_SHARD = 409; - public static final int PRISMARINE_CRYSTALS = 410; - public static final int RABBIT = 411; - public static final int COOKED_RABBIT = 412; - public static final int RABBIT_STEW = 413; - public static final int RABBIT_FOOT = 414; - public static final int RABBIT_HIDE = 415; - public static final int ARMOR_STAND = 416; - public static final int HORSE_ARMOR_IRON = 417; - public static final int HORSE_ARMOR_GOLD = 418; - public static final int HORSE_ARMOR_DIAMOND = 419; - public static final int LEAD = 420; - public static final int NAME_TAG = 421; - public static final int COMMAND_BLOCK_MINECART = 422; - public static final int MUTTON = 423; - public static final int COOKED_MUTTON = 424; - public static final int BANNER = 425; - public static final int END_CRYSTAL = 426; - public static final int SPRUCE_DOOR = 427; - public static final int BIRCH_DOOR = 428; - public static final int JUNGLE_DOOR = 429; - public static final int ACACIA_DOOR = 430; - public static final int DARK_OAK_DOOR = 431; - public static final int CHORUS_FRUIT = 432; - public static final int CHORUS_FRUIT_POPPED = 433; - public static final int BEETROOT = 434; - public static final int BEETROOT_SEEDS = 435; - public static final int BEETROOT_SOUP = 436; - public static final int DRAGON_BREATH = 437; - public static final int SPLASH_POTION = 438; - public static final int SPECTRAL_ARROW = 439; - public static final int TIPPED_ARROW = 440; - public static final int LINGERING_POTION = 441; - public static final int SHIELD = 442; - public static final int ELYTRA = 443; - public static final int SPRUCE_BOAT = 444; - public static final int BIRCH_BOAT = 445; - public static final int JUNGLE_BOAT = 446; - public static final int ACACIA_BOAT = 447; - public static final int DARK_OAK_BOAT = 448; - public static final int TOTEM_OF_UNDYING = 449; - public static final int SHULKER_SHELL = 450; - public static final int IRON_NUGGET = 452; - public static final int KNOWLEDGE_BOOK = 453; - - @Deprecated public static final int GOLD_RECORD = 2256; // deprecated, but leave it there - @Deprecated public static final int GREEN_RECORD = 2257; // deprecated, but leave it there - public static final int DISC_13 = 2256; - public static final int DISC_CAT = 2257; - public static final int DISC_BLOCKS = 2258; - public static final int DISC_CHIRP = 2259; - public static final int DISC_FAR = 2260; - public static final int DISC_MALL = 2261; - public static final int DISC_MELLOHI = 2262; - public static final int DISC_STAL = 2263; - public static final int DISC_STRAD = 2264; - public static final int DISC_WARD = 2265; - public static final int DISC_11 = 2266; - public static final int DISC_WAIT = 2267; private ItemID() { } 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 98b2c4fdd..11660c745 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 @@ -19,11 +19,16 @@ package com.sk89q.worldedit.blocks.type; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.blocks.BlockMaterial; +import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.world.registry.BundledBlockData; import com.sk89q.worldedit.world.registry.LegacyMapper; import java.util.function.Function; +import javax.annotation.Nullable; + public class BlockType { private String id; @@ -77,6 +82,34 @@ public class BlockType { return this.defaultState; } + /** + * Gets whether this block type has an item representation. + * + * @return If it has an item + */ + public boolean hasItemType() { + return getItemType() != null; + } + + /** + * Gets the item representation of this block type, if it exists. + * + * @return The item representation + */ + @Nullable + public ItemType getItemType() { + return ItemTypes.getItemType(this.id); + } + + /** + * Get the material for this BlockType. + * + * @return The material + */ + public BlockMaterial getMaterial() { + return WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getMaterial(this.id); + } + /** * Gets the legacy ID. Needed for legacy reasons. * @@ -94,11 +127,6 @@ public class BlockType { } } - @Deprecated - public com.sk89q.worldedit.blocks.BlockType getLegacyType() { - return com.sk89q.worldedit.blocks.BlockType.fromID(getLegacyId()); - } - @Override public int hashCode() { return this.id.hashCode(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/type/ItemType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/type/ItemType.java index c3c6659f0..68a7a59c0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/type/ItemType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/type/ItemType.java @@ -22,6 +22,8 @@ package com.sk89q.worldedit.blocks.type; import com.sk89q.worldedit.world.registry.BundledItemData; import com.sk89q.worldedit.world.registry.LegacyMapper; +import javax.annotation.Nullable; + public class ItemType { private String id; @@ -52,6 +54,26 @@ public class ItemType { } } + + /** + * Gets whether this item type has a block representation. + * + * @return If it has a block + */ + public boolean hasBlockType() { + return getBlockType() != null; + } + + /** + * Gets the block representation of this item type, if it exists. + * + * @return The block representation + */ + @Nullable + public BlockType getBlockType() { + return BlockTypes.getBlockType(this.id); + } + /** * Gets the legacy ID. Needed for legacy reasons. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java index 7cc2bc6b5..ec16ffab1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java @@ -192,13 +192,13 @@ public class GeneralCommands { break; } -// TODO if (blocksOnly && searchType.getID() > 255) { -// continue; -// } -// -// if (itemsOnly && searchType.getID() <= 255) { -// continue; -// } + if (blocksOnly && !searchType.hasBlockType()) { + continue; + } + + if (itemsOnly && searchType.hasBlockType()) { + continue; + } for (String alias : Sets.newHashSet(searchType.getId(), searchType.getName())) { if (alias.contains(query)) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java index 3a0a1b8e9..43eed2d19 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java @@ -102,7 +102,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { byte free = 0; while (y <= world.getMinimumPoint().getBlockY() + 2) { - if (BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) { + if (!world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { ++free; } else { free = 0; @@ -132,7 +132,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { while (y >= 0) { final Vector pos = new Vector(x, y, z); final BlockState id = world.getBlock(pos); - if (!BlockType.canPassThrough(id.getBlockType().getLegacyId())) { + if (id.getBlockType().getMaterial().isMovementBlocker()) { setPosition(new Vector(x + 0.5, y + BlockType.centralTopLimit(id), z + 0.5)); return; } @@ -158,7 +158,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { byte spots = 0; while (y <= world.getMaximumPoint().getY() + 2) { - if (BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) { + if (!world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { ++free; } else { free = 0; @@ -198,7 +198,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { byte free = 0; while (y >= 1) { - if (BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) { + if (!world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { ++free; } else { free = 0; @@ -253,7 +253,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { while (y <= world.getMaximumPoint().getY()) { // Found a ceiling! - if (!BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) { + if (world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { int platformY = Math.max(initialY, y - 3 - clearance); floatAt(x, platformY + 1, z, alwaysGlass); return true; @@ -281,7 +281,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { final Extent world = getLocation().getExtent(); while (y <= world.getMaximumPoint().getY() + 2) { - if (!BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) { + if (world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { break; // Hit something } else if (y > maxY + 1) { break; @@ -364,7 +364,11 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException { final ItemType typeId = getItemInHand(handSide).getType(); - return new BaseBlock(typeId.getLegacyId()); + if (typeId.hasBlockType()) { + return new BaseBlock(typeId.getBlockType()); + } else { + return new BaseBlock(BlockTypes.AIR); + } } /** @@ -384,7 +388,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { boolean inFree = false; while ((block = hitBlox.getNextBlock()) != null) { - boolean free = BlockType.canPassThrough(world.getBlock(block.toVector())); + boolean free = !world.getBlock(block.toVector()).getBlockType().getMaterial().isMovementBlocker(); if (firstBlock) { firstBlock = false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FuzzyBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FuzzyBlockMask.java index baf453c22..b9f266512 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FuzzyBlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FuzzyBlockMask.java @@ -20,7 +20,6 @@ package com.sk89q.worldedit.function.mask; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.Blocks; import com.sk89q.worldedit.blocks.type.BlockStateHolder; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java index bb755a889..016b32cb5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java @@ -19,10 +19,9 @@ package com.sk89q.worldedit.function.mask; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BlockType; +import com.sk89q.worldedit.blocks.type.BlockState; +import com.sk89q.worldedit.extent.Extent; import javax.annotation.Nullable; @@ -35,8 +34,8 @@ public class SolidBlockMask extends AbstractExtentMask { @Override public boolean test(Vector vector) { Extent extent = getExtent(); - BaseBlock lazyBlock = extent.getLazyBlock(vector); - return !BlockType.canPassThrough(lazyBlock.getBlockType().getLegacyId(), lazyBlock.getData()); + BlockState block = extent.getBlock(vector); + return block.getBlockType().getMaterial().isMovementBlocker(); } @Nullable diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java index f25d9e4d9..8caecc3f2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java @@ -136,7 +136,7 @@ public class TargetBlock { * @return Block */ public Location getSolidTargetBlock() { - while (getNextBlock() != null && BlockType.canPassThrough(world.getBlock(getCurrentBlock().toVector()))) ; + while (getNextBlock() != null && !world.getBlock(getCurrentBlock().toVector()).getBlockType().getMaterial().isMovementBlocker()) ; return getCurrentBlock(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java index ed1a88b9d..b4c452051 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java @@ -19,15 +19,15 @@ package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockMaterial; import com.sk89q.worldedit.blocks.type.BlockState; import com.sk89q.worldedit.blocks.type.BlockStateHolder; import com.sk89q.worldedit.world.registry.state.State; -import javax.annotation.Nullable; import java.util.Map; +import javax.annotation.Nullable; + /** * Provides information on blocks and provides methods to create them. */ @@ -45,11 +45,11 @@ public interface BlockRegistry { /** * Get the material for the given block. * - * @param block the block + * @param id the block * @return the material, or null if the material information is not known */ @Nullable - BlockMaterial getMaterial(BaseBlock block); + BlockMaterial getMaterial(String id); /** * Get an unmodifiable map of states for this block. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java index 518f008e7..13a745075 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java @@ -19,16 +19,16 @@ package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockMaterial; import com.sk89q.worldedit.blocks.type.BlockState; import com.sk89q.worldedit.blocks.type.BlockStateHolder; import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.world.registry.state.State; -import javax.annotation.Nullable; import java.util.Map; +import javax.annotation.Nullable; + /** * A block registry that uses {@link BundledBlockData} to serve information * about blocks. @@ -43,8 +43,8 @@ public class BundledBlockRegistry implements BlockRegistry { @Nullable @Override - public BlockMaterial getMaterial(BaseBlock block) { - return BundledBlockData.getInstance().getMaterialById(block.getBlockType().getId()); + public BlockMaterial getMaterial(String id) { + return BundledBlockData.getInstance().getMaterialById(id); } @Nullable