diff options
199 files changed, 8248 insertions, 3584 deletions
@@ -5,7 +5,7 @@ <groupId>org.bukkit</groupId> <artifactId>bukkit</artifactId> - <version>1.12.2-R0.1-SNAPSHOT</version> + <version>1.13-pre7-R0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>Bukkit</name> @@ -73,7 +73,7 @@ <dependency> <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> - <version>1.19</version> + <version>1.21</version> <scope>compile</scope> </dependency> <!-- testing --> @@ -113,7 +113,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> - <version>3.1.0</version> + <version>3.1.1</version> <executions> <execution> <phase>package</phase> @@ -138,7 +138,7 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>animal-sniffer-maven-plugin</artifactId> - <version>1.16</version> + <version>1.17</version> <executions> <execution> <phase>process-classes</phase> diff --git a/src/main/java/org/bukkit/Art.java b/src/main/java/org/bukkit/Art.java index a5ebae70..9ad05cf4 100644 --- a/src/main/java/org/bukkit/Art.java +++ b/src/main/java/org/bukkit/Art.java @@ -33,9 +33,9 @@ public enum Art { FIGHTERS(20, 4, 2), POINTER(21, 4, 4), PIGSCENE(22, 4, 4), - BURNINGSKULL(23, 4, 4), + BURNING_SKULL(23, 4, 4), SKELETON(24, 4, 3), - DONKEYKONG(25, 4, 3); + DONKEY_KONG(25, 4, 3); private int id, width, height; private static final HashMap<String, Art> BY_NAME = Maps.newHashMap(); @@ -99,13 +99,13 @@ public enum Art { public static Art getByName(String name) { Validate.notNull(name, "Name cannot be null"); - return BY_NAME.get(name.toLowerCase(java.util.Locale.ENGLISH).replaceAll("_", "")); + return BY_NAME.get(name.toLowerCase(java.util.Locale.ENGLISH)); } static { for (Art art : values()) { BY_ID.put(art.id, art); - BY_NAME.put(art.toString().toLowerCase(java.util.Locale.ENGLISH).replaceAll("_", ""), art); + BY_NAME.put(art.toString().toLowerCase(java.util.Locale.ENGLISH), art); } } } diff --git a/src/main/java/org/bukkit/Axis.java b/src/main/java/org/bukkit/Axis.java new file mode 100644 index 00000000..fd86d68d --- /dev/null +++ b/src/main/java/org/bukkit/Axis.java @@ -0,0 +1,21 @@ +package org.bukkit; + +/** + * Represents a mutually perpendicular axis in 3D Cartesian coordinates. In + * Minecraft the x, z axes lie in the horizontal plane, whilst the y axis points + * upwards. + */ +public enum Axis { + /** + * The x axis. + */ + X, + /** + * The y axis. + */ + Y, + /** + * The z axis. + */ + Z; +} diff --git a/src/main/java/org/bukkit/BlockChangeDelegate.java b/src/main/java/org/bukkit/BlockChangeDelegate.java index 3f1afd9c..8bdaafad 100644 --- a/src/main/java/org/bukkit/BlockChangeDelegate.java +++ b/src/main/java/org/bukkit/BlockChangeDelegate.java @@ -1,91 +1,34 @@ package org.bukkit; +import org.bukkit.block.data.BlockData; + /** * A delegate for handling block changes. This serves as a direct interface * between generation algorithms in the server implementation and utilizing * code. - * @deprecated rarely used API that was largely for implementation purposes */ -@Deprecated public interface BlockChangeDelegate { /** - * Set a block type at the specified coordinates without doing all world - * updates and notifications. - * <p> - * It is safe to have this call World.setTypeId, but it may be slower than - * World.setRawTypeId. - * - * @param x X coordinate - * @param y Y coordinate - * @param z Z coordinate - * @param typeId New block ID - * @return true if the block was set successfully - * @deprecated Magic value - */ - @Deprecated - public boolean setRawTypeId(int x, int y, int z, int typeId); - - /** - * Set a block type and data at the specified coordinates without doing - * all world updates and notifications. - * <p> - * It is safe to have this call World.setTypeId, but it may be slower than - * World.setRawTypeId. - * - * @param x X coordinate - * @param y Y coordinate - * @param z Z coordinate - * @param typeId New block ID - * @param data Block data - * @return true if the block was set successfully - * @deprecated Magic value - */ - @Deprecated - public boolean setRawTypeIdAndData(int x, int y, int z, int typeId, int data); - - /** - * Set a block type at the specified coordinates. - * <p> - * This method cannot call World.setRawTypeId, a full update is needed. - * - * @param x X coordinate - * @param y Y coordinate - * @param z Z coordinate - * @param typeId New block ID - * @return true if the block was set successfully - * @deprecated Magic value - */ - @Deprecated - public boolean setTypeId(int x, int y, int z, int typeId); - - /** - * Set a block type and data at the specified coordinates. - * <p> - * This method cannot call World.setRawTypeId, a full update is needed. + * Set a block data at the specified coordinates. * * @param x X coordinate * @param y Y coordinate * @param z Z coordinate - * @param typeId New block ID - * @param data Block data + * @param blockData Block data * @return true if the block was set successfully - * @deprecated Magic value */ - @Deprecated - public boolean setTypeIdAndData(int x, int y, int z, int typeId, int data); + public boolean setBlockData(int x, int y, int z, BlockData blockData); /** - * Get the block type at the location. + * Get the block data at the location. * * @param x X coordinate * @param y Y coordinate * @param z Z coordinate - * @return The block ID - * @deprecated Magic value + * @return The block data */ - @Deprecated - public int getTypeId(int x, int y, int z); + public BlockData getBlockData(int x, int y, int z); /** * Gets the height of the world. diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java index d57e4a57..a3eafe70 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -10,9 +10,11 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; +import java.util.function.Consumer; import java.util.logging.Logger; import org.bukkit.Warning.WarningState; +import org.bukkit.block.data.BlockData; import org.bukkit.boss.BarColor; import org.bukkit.boss.BarFlag; import org.bukkit.boss.BarStyle; @@ -1155,6 +1157,77 @@ public final class Bukkit { } /** + * Creates a new {@link BlockData} instance for the specified Material, with + * all properties initialized to unspecified defaults. + * + * @param material the material + * @return new data instance + */ + public static BlockData createBlockData(Material material) { + return server.createBlockData(material); + } + + /** + * Creates a new {@link BlockData} instance for the specified Material, with + * all properties initialized to unspecified defaults. + * + * @param material the material + * @param consumer consumer to run on new instance before returning + * @return new data instance + */ + public static BlockData createBlockData(Material material, Consumer<BlockData> consumer) { + return server.createBlockData(material, consumer); + } + + /** + * Creates a new {@link BlockData} instance with material and properties + * parsed from provided data. + * + * @param data data string + * @return new data instance + * @throws IllegalArgumentException if the specified data is not valid + */ + public static BlockData createBlockData(String data) throws IllegalArgumentException { + return server.createBlockData(data); + } + + /** + * Creates a new {@link BlockData} instance for the specified Material, with + * all properties initialized to unspecified defaults, except for those + * provided in data. + * + * @param material the material + * @param data data string + * @return new data instance + * @throws IllegalArgumentException if the specified data is not valid + */ + public static BlockData createBlockData(Material material, String data) throws IllegalArgumentException { + return server.createBlockData(material, data); + } + + /** + * Gets a tag which has already been defined within the server. Plugins are + * suggested to use the concrete tags in {@link Tag} rather than this method + * which makes no guarantees about which tags are available, and may also be + * less performant due to lack of caching. + * <br> + * Tags will be searched for in an implementation specific manner, but a + * path consisting of namespace/tags/registry/key is expected. + * <br> + * Server implementations are allowed to handle only the registries + * indicated in {@link Tag}. + * + * @param <T> type of the tag + * @param registry the tag registry to look at + * @param tag the name of the tag + * @param clazz the class of the tag entries + * @return the tag or null + */ + public static <T extends Keyed> Tag<T> getTag(String registry, NamespacedKey tag, Class<T> clazz) { + return server.getTag(registry, tag, clazz); + } + + /** * @see UnsafeValues * @return the unsafe values instance */ diff --git a/src/main/java/org/bukkit/ChunkSnapshot.java b/src/main/java/org/bukkit/ChunkSnapshot.java index 08e0bcdd..aa1394ee 100644 --- a/src/main/java/org/bukkit/ChunkSnapshot.java +++ b/src/main/java/org/bukkit/ChunkSnapshot.java @@ -1,6 +1,7 @@ package org.bukkit; import org.bukkit.block.Biome; +import org.bukkit.block.data.BlockData; /** * Represents a static, thread-safe snapshot of chunk of blocks. @@ -42,16 +43,14 @@ public interface ChunkSnapshot { Material getBlockType(int x, int y, int z); /** - * Get block type for block at corresponding coordinate in the chunk + * Get block data for block at corresponding coordinate in the chunk * * @param x 0-15 * @param y 0-127 * @param z 0-15 - * @return 0-255 - * @deprecated Magic value + * @return block material type */ - @Deprecated - int getBlockTypeId(int x, int y, int z); + BlockData getBlockData(int x, int y, int z); /** * Get block data for block at corresponding coordinate in the chunk @@ -63,7 +62,7 @@ public interface ChunkSnapshot { * @deprecated Magic value */ @Deprecated - int getBlockData(int x, int y, int z); + int getData(int x, int y, int z); /** * Get sky light level for block at corresponding coordinate in the chunk @@ -114,17 +113,6 @@ public interface ChunkSnapshot { double getRawBiomeTemperature(int x, int z); /** - * Get raw biome rainfall (0.0-1.0) at given coordinate - * - * @param x X-coordinate - * @param z Z-coordinate - * @return rainfall at given coordinate - * @deprecated this is not a chunk property in current Minecraft versions - */ - @Deprecated - double getRawBiomeRainfall(int x, int z); - - /** * Get world full time when chunk snapshot was captured * * @return time in ticks diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java index fcc76e19..e5fb19b1 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java @@ -1,549 +1,1871 @@ package org.bukkit; +import com.google.common.collect.Maps; import java.lang.reflect.Constructor; -import java.util.Arrays; +import java.util.Locale; import java.util.Map; - +import java.util.function.Consumer; import org.apache.commons.lang.Validate; -import org.bukkit.map.MapView; -import org.bukkit.material.Bed; -import org.bukkit.material.Button; -import org.bukkit.material.Cake; -import org.bukkit.material.Cauldron; -import org.bukkit.material.Chest; -import org.bukkit.material.Coal; -import org.bukkit.material.CocoaPlant; -import org.bukkit.material.Command; -import org.bukkit.material.Comparator; -import org.bukkit.material.Crops; -import org.bukkit.material.DetectorRail; -import org.bukkit.material.Diode; -import org.bukkit.material.Dispenser; -import org.bukkit.material.Door; -import org.bukkit.material.Dye; -import org.bukkit.material.EnderChest; -import org.bukkit.material.FlowerPot; -import org.bukkit.material.Furnace; -import org.bukkit.material.Gate; -import org.bukkit.material.Hopper; -import org.bukkit.material.Ladder; -import org.bukkit.material.Leaves; -import org.bukkit.material.Lever; -import org.bukkit.material.LongGrass; +import org.bukkit.block.data.Ageable; +import org.bukkit.block.data.AnaloguePowerable; +import org.bukkit.block.data.Bisected; +import org.bukkit.block.data.BlockData; +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Levelled; +import org.bukkit.block.data.Lightable; +import org.bukkit.block.data.MultipleFacing; +import org.bukkit.block.data.Orientable; +import org.bukkit.block.data.Powerable; +import org.bukkit.block.data.Rotatable; +import org.bukkit.block.data.Snowable; +import org.bukkit.block.data.Rail; +import org.bukkit.block.data.type.Bed; +import org.bukkit.block.data.type.BrewingStand; +import org.bukkit.block.data.type.BubbleColumn; +import org.bukkit.block.data.type.Cake; +import org.bukkit.block.data.type.Chest; +import org.bukkit.block.data.type.Cocoa; +import org.bukkit.block.data.type.CommandBlock; +import org.bukkit.block.data.type.Comparator; +import org.bukkit.block.data.type.DaylightDetector; +import org.bukkit.block.data.type.Dispenser; +import org.bukkit.block.data.type.Door; +import org.bukkit.block.data.type.EndPortalFrame; +import org.bukkit.block.data.type.EnderChest; +import org.bukkit.block.data.type.Farmland; +import org.bukkit.block.data.type.Fence; +import org.bukkit.block.data.type.Fire; +import org.bukkit.block.data.type.Furnace; +import org.bukkit.block.data.type.Gate; +import org.bukkit.block.data.type.GlassPane; +import org.bukkit.block.data.type.Hopper; +import org.bukkit.block.data.type.Jukebox; +import org.bukkit.block.data.type.Ladder; +import org.bukkit.block.data.type.Leaves; +import org.bukkit.block.data.type.NoteBlock; +import org.bukkit.block.data.type.Observer; +import org.bukkit.block.data.type.Piston; +import org.bukkit.block.data.type.PistonHead; +import org.bukkit.block.data.type.RedstoneRail; +import org.bukkit.block.data.type.RedstoneWallTorch; +import org.bukkit.block.data.type.RedstoneWire; +import org.bukkit.block.data.type.Repeater; +import org.bukkit.block.data.type.Sapling; +import org.bukkit.block.data.type.SeaPickle; +import org.bukkit.block.data.type.Sign; +import org.bukkit.block.data.type.Slab; +import org.bukkit.block.data.type.Snow; +import org.bukkit.block.data.type.Stairs; +import org.bukkit.block.data.type.StructureBlock; +import org.bukkit.block.data.type.Switch; +import org.bukkit.block.data.type.TechnicalPiston; +import org.bukkit.block.data.type.TrapDoor; +import org.bukkit.block.data.type.Tripwire; +import org.bukkit.block.data.type.TripwireHook; +import org.bukkit.block.data.type.TurtleEgg; +import org.bukkit.block.data.type.WallSign; import org.bukkit.material.MaterialData; -import org.bukkit.material.MonsterEggs; -import org.bukkit.material.Mushroom; -import org.bukkit.material.NetherWarts; -import org.bukkit.material.PistonBaseMaterial; -import org.bukkit.material.PistonExtensionMaterial; -import org.bukkit.material.PoweredRail; -import org.bukkit.material.PressurePlate; -import org.bukkit.material.Pumpkin; -import org.bukkit.material.Rails; -import org.bukkit.material.RedstoneTorch; -import org.bukkit.material.RedstoneWire; -import org.bukkit.material.Sandstone; -import org.bukkit.material.Sapling; -import org.bukkit.material.Sign; -import org.bukkit.material.Skull; -import org.bukkit.material.SmoothBrick; -import org.bukkit.material.SpawnEgg; -import org.bukkit.material.Stairs; -import org.bukkit.material.Step; -import org.bukkit.material.Torch; -import org.bukkit.material.TrapDoor; -import org.bukkit.material.Tree; -import org.bukkit.material.Tripwire; -import org.bukkit.material.TripwireHook; -import org.bukkit.material.Vine; -import org.bukkit.material.Wood; -import org.bukkit.material.WoodenStep; -import org.bukkit.material.Wool; - -import com.google.common.collect.Maps; - -import org.bukkit.material.Banner; -import org.bukkit.material.Observer; /** * An enum of all material IDs accepted by the official server and client */ -public enum Material { - AIR(0, 0), - STONE(1), - GRASS(2), - DIRT(3), - COBBLESTONE(4), - WOOD(5, Wood.class), - SAPLING(6, Sapling.class), - BEDROCK(7), - WATER(8, MaterialData.class), - STATIONARY_WATER(9, MaterialData.class), - LAVA(10, MaterialData.class), - STATIONARY_LAVA(11, MaterialData.class), - SAND(12), - GRAVEL(13), - GOLD_ORE(14), - IRON_ORE(15), - COAL_ORE(16), - LOG(17, Tree.class), - LEAVES(18, Leaves.class), - SPONGE(19), - GLASS(20), - LAPIS_ORE(21), - LAPIS_BLOCK(22), - DISPENSER(23, Dispenser.class), - SANDSTONE(24, Sandstone.class), - NOTE_BLOCK(25), - BED_BLOCK(26, Bed.class), - POWERED_RAIL(27, PoweredRail.class), - DETECTOR_RAIL(28, DetectorRail.class), - PISTON_STICKY_BASE(29, PistonBaseMaterial.class), - WEB(30), - LONG_GRASS(31, LongGrass.class), - DEAD_BUSH(32), - PISTON_BASE(33, PistonBaseMaterial.class), - PISTON_EXTENSION(34, PistonExtensionMaterial.class), - WOOL(35, Wool.class), - PISTON_MOVING_PIECE(36), - YELLOW_FLOWER(37), - RED_ROSE(38), - BROWN_MUSHROOM(39), - RED_MUSHROOM(40), - GOLD_BLOCK(41), - IRON_BLOCK(42), - DOUBLE_STEP(43, Step.class), - STEP(44, Step.class), - BRICK(45), - TNT(46), - BOOKSHELF(47), - MOSSY_COBBLESTONE(48), - OBSIDIAN(49), - TORCH(50, Torch.class), - FIRE(51), - MOB_SPAWNER(52), - WOOD_STAIRS(53, Stairs.class), - CHEST(54, Chest.class), - REDSTONE_WIRE(55, RedstoneWire.class), - DIAMOND_ORE(56), - DIAMOND_BLOCK(57), - WORKBENCH(58), - CROPS(59, Crops.class), - SOIL(60, MaterialData.class), - FURNACE(61, Furnace.class), - BURNING_FURNACE(62, Furnace.class), - SIGN_POST(63, 64, Sign.class), - WOODEN_DOOR(64, Door.class), - LADDER(65, Ladder.class), - RAILS(66, Rails.class), - COBBLESTONE_STAIRS(67, Stairs.class), - WALL_SIGN(68, 64, Sign.class), - LEVER(69, Lever.class), - STONE_PLATE(70, PressurePlate.class), - IRON_DOOR_BLOCK(71, Door.class), - WOOD_PLATE(72, PressurePlate.class), - REDSTONE_ORE(73), - GLOWING_REDSTONE_ORE(74), - REDSTONE_TORCH_OFF(75, RedstoneTorch.class), - REDSTONE_TORCH_ON(76, RedstoneTorch.class), - STONE_BUTTON(77, Button.class), - SNOW(78), - ICE(79), - SNOW_BLOCK(80), - CACTUS(81, MaterialData.class), - CLAY(82), - SUGAR_CANE_BLOCK(83, MaterialData.class), - JUKEBOX(84), - FENCE(85), - PUMPKIN(86, Pumpkin.class), - NETHERRACK(87), - SOUL_SAND(88), - GLOWSTONE(89), - PORTAL(90), - JACK_O_LANTERN(91, Pumpkin.class), - CAKE_BLOCK(92, 64, Cake.class), - DIODE_BLOCK_OFF(93, Diode.class), - DIODE_BLOCK_ON(94, Diode.class), - STAINED_GLASS(95), - TRAP_DOOR(96, TrapDoor.class), - MONSTER_EGGS(97, MonsterEggs.class), - SMOOTH_BRICK(98, SmoothBrick.class), - HUGE_MUSHROOM_1(99, Mushroom.class), - HUGE_MUSHROOM_2(100, Mushroom.class), - IRON_FENCE(101), - THIN_GLASS(102), - MELON_BLOCK(103), - PUMPKIN_STEM(104, MaterialData.class), - MELON_STEM(105, MaterialData.class), - VINE(106, Vine.class), - FENCE_GATE(107, Gate.class), - BRICK_STAIRS(108, Stairs.class), - SMOOTH_STAIRS(109, Stairs.class), - MYCEL(110), - WATER_LILY(111), - NETHER_BRICK(112), - NETHER_FENCE(113), - NETHER_BRICK_STAIRS(114, Stairs.class), - NETHER_WARTS(115, NetherWarts.class), - ENCHANTMENT_TABLE(116), - BREWING_STAND(117, MaterialData.class), - CAULDRON(118, Cauldron.class), - ENDER_PORTAL(119), - ENDER_PORTAL_FRAME(120), - ENDER_STONE(121), - DRAGON_EGG(122), - REDSTONE_LAMP_OFF(123), - REDSTONE_LAMP_ON(124), - WOOD_DOUBLE_STEP(125, Wood.class), - WOOD_STEP(126, WoodenStep.class), - COCOA(127, CocoaPlant.class), - SANDSTONE_STAIRS(128, Stairs.class), - EMERALD_ORE(129), - ENDER_CHEST(130, EnderChest.class), - TRIPWIRE_HOOK(131, TripwireHook.class), - TRIPWIRE(132, Tripwire.class), - EMERALD_BLOCK(133), - SPRUCE_WOOD_STAIRS(134, Stairs.class), - BIRCH_WOOD_STAIRS(135, Stairs.class), - JUNGLE_WOOD_STAIRS(136, Stairs.class), - COMMAND(137, Command.class), - BEACON(138), - COBBLE_WALL(139), - FLOWER_POT(140, FlowerPot.class), - CARROT(141, Crops.class), - POTATO(142, Crops.class), - WOOD_BUTTON(143, Button.class), - SKULL(144, Skull.class), - ANVIL(145), - TRAPPED_CHEST(146, Chest.class), - GOLD_PLATE(147), - IRON_PLATE(148), - REDSTONE_COMPARATOR_OFF(149, Comparator.class), - REDSTONE_COMPARATOR_ON(150, Comparator.class), - DAYLIGHT_DETECTOR(151), - REDSTONE_BLOCK(152), - QUARTZ_ORE(153), - HOPPER(154, Hopper.class), - QUARTZ_BLOCK(155), - QUARTZ_STAIRS(156, Stairs.class), - ACTIVATOR_RAIL(157, PoweredRail.class), - DROPPER(158, Dispenser.class), - STAINED_CLAY(159), - STAINED_GLASS_PANE(160), - LEAVES_2(161, Leaves.class), - LOG_2(162, Tree.class), - ACACIA_STAIRS(163, Stairs.class), - DARK_OAK_STAIRS(164, Stairs.class), - SLIME_BLOCK(165), - BARRIER(166), - IRON_TRAPDOOR(167, TrapDoor.class), - PRISMARINE(168), - SEA_LANTERN(169), - HAY_BLOCK(170), - CARPET(171), - HARD_CLAY(172), - COAL_BLOCK(173), - PACKED_ICE(174), - DOUBLE_PLANT(175), - STANDING_BANNER(176, Banner.class), - WALL_BANNER(177, Banner.class), - DAYLIGHT_DETECTOR_INVERTED(178), - RED_SANDSTONE(179), - RED_SANDSTONE_STAIRS(180, Stairs.class), - DOUBLE_STONE_SLAB2(181), - STONE_SLAB2(182), - SPRUCE_FENCE_GATE(183, Gate.class), - BIRCH_FENCE_GATE(184, Gate.class), - JUNGLE_FENCE_GATE(185, Gate.class), - DARK_OAK_FENCE_GATE(186, Gate.class), - ACACIA_FENCE_GATE(187, Gate.class), - SPRUCE_FENCE(188), - BIRCH_FENCE(189), - JUNGLE_FENCE(190), - DARK_OAK_FENCE(191), - ACACIA_FENCE(192), - SPRUCE_DOOR(193, Door.class), - BIRCH_DOOR(194, Door.class), - JUNGLE_DOOR(195, Door.class), - ACACIA_DOOR(196, Door.class), - DARK_OAK_DOOR(197, Door.class), - END_ROD(198), - CHORUS_PLANT(199), - CHORUS_FLOWER(200), - PURPUR_BLOCK(201), - PURPUR_PILLAR(202), - PURPUR_STAIRS(203, Stairs.class), - PURPUR_DOUBLE_SLAB(204), - PURPUR_SLAB(205), - END_BRICKS(206), - BEETROOT_BLOCK(207, Crops.class), - GRASS_PATH(208), - END_GATEWAY(209), - COMMAND_REPEATING(210, Command.class), - COMMAND_CHAIN(211, Command.class), - FROSTED_ICE(212), - MAGMA(213), - NETHER_WART_BLOCK(214), - RED_NETHER_BRICK(215), - BONE_BLOCK(216), - STRUCTURE_VOID(217), - OBSERVER(218, Observer.class), - WHITE_SHULKER_BOX(219, 1), - ORANGE_SHULKER_BOX(220, 1), - MAGENTA_SHULKER_BOX(221, 1), - LIGHT_BLUE_SHULKER_BOX(222, 1), - YELLOW_SHULKER_BOX(223, 1), - LIME_SHULKER_BOX(224, 1), - PINK_SHULKER_BOX(225, 1), - GRAY_SHULKER_BOX(226, 1), - SILVER_SHULKER_BOX(227, 1), - CYAN_SHULKER_BOX(228, 1), - PURPLE_SHULKER_BOX(229, 1), - BLUE_SHULKER_BOX(230, 1), - BROWN_SHULKER_BOX(231, 1), - GREEN_SHULKER_BOX(232, 1), - RED_SHULKER_BOX(233, 1), - BLACK_SHULKER_BOX(234, 1), - WHITE_GLAZED_TERRACOTTA(235), - ORANGE_GLAZED_TERRACOTTA(236), - MAGENTA_GLAZED_TERRACOTTA(237), - LIGHT_BLUE_GLAZED_TERRACOTTA(238), - YELLOW_GLAZED_TERRACOTTA(239), - LIME_GLAZED_TERRACOTTA(240), - PINK_GLAZED_TERRACOTTA(241), - GRAY_GLAZED_TERRACOTTA(242), - SILVER_GLAZED_TERRACOTTA(243), - CYAN_GLAZED_TERRACOTTA(244), - PURPLE_GLAZED_TERRACOTTA(245), - BLUE_GLAZED_TERRACOTTA(246), - BROWN_GLAZED_TERRACOTTA(247), - GREEN_GLAZED_TERRACOTTA(248), - RED_GLAZED_TERRACOTTA(249), - BLACK_GLAZED_TERRACOTTA(250), - CONCRETE(251), - CONCRETE_POWDER(252), - STRUCTURE_BLOCK(255), +public enum Material implements Keyed { + //<editor-fold desc="Materials" defaultstate="collapsed"> + ACACIA_BOAT(27326, 1), + ACACIA_BUTTON(13993, Switch.class), + ACACIA_DOOR(23797, Door.class), + ACACIA_FENCE(4569, Fence.class), + ACACIA_FENCE_GATE(14145, Gate.class), + ACACIA_LEAVES(16606, Leaves.class), + ACACIA_LOG(8385, Orientable.class), + ACACIA_PLANKS(31312), + ACACIA_PRESSURE_PLATE(17586, Powerable.class), + ACACIA_SAPLING(20806, Sapling.class), + ACACIA_SLAB(23730, Slab.class), + ACACIA_STAIRS(17453, Stairs.class), + ACACIA_TRAPDOOR(18343, TrapDoor.class), + ACACIA_WOOD(21861, Orientable.class), + ACTIVATOR_RAIL(5834, RedstoneRail.class), + AIR(9648, 0), + ALLIUM(6871), + ANDESITE(25975), + ANVIL(18718, Directional.class), + APPLE(7720), + ARMOR_STAND(12852, 16), + ARROW(31091), + ATTACHED_MELON_STEM(30882, Directional.class), + ATTACHED_PUMPKIN_STEM(12724, Directional.class), + AZURE_BLUET(17608), + BAKED_POTATO(14624), + BARRIER(26453), + BAT_SPAWN_EGG(14607), + BEACON(6608), + BEDROCK(23130), + BEEF(4803), + BEETROOT(23305), + BEETROOTS(22075, Ageable.class), + BEETROOT_SEEDS(21282), + BEETROOT_SOUP(16036, 1), + BIRCH_BOAT(28104, 1), + BIRCH_BUTTON(26934, Switch.class), + BIRCH_DOOR(14759, Door.class), + BIRCH_FENCE(17347, Fence.class), + BIRCH_FENCE_GATE(6322, Gate.class), + BIRCH_LEAVES(12601, Leaves.class), + BIRCH_LOG(26727, Orientable.class), + BIRCH_PLANKS(29322), + BIRCH_PRESSURE_PLATE(9664, Powerable.class), + BIRCH_SAPLING(31533, Sapling.class), + BIRCH_SLAB(13807, Slab.class), + BIRCH_STAIRS(7657, Stairs.class), + BIRCH_TRAPDOOR(32585, TrapDoor.class), + BIRCH_WOOD(7924, Orientable.class), + BLACK_BANNER(9365, 16, Rotatable.class), + BLACK_BED(20490, 1, Bed.class), + BLACK_CARPET(6056), + BLACK_CONCRETE(13338), + BLACK_CONCRETE_POWDER(16150), + BLACK_GLAZED_TERRACOTTA(29678, Directional.class), + BLACK_SHULKER_BOX(24076, 1, Directional.class), + BLACK_STAINED_GLASS(13941), + BLACK_STAINED_GLASS_PANE(13201, GlassPane.class), + BLACK_TERRACOTTA(26691), + BLACK_WALL_BANNER(4919, Directional.class), + BLACK_WOOL(16693), + BLAZE_POWDER(18941), + BLAZE_ROD(8289), + BLAZE_SPAWN_EGG(4759), + BLUE_BANNER(18481, 16, Rotatable.class), + BLUE_BED(12714, 1, Bed.class), + BLUE_CARPET(13292), + BLUE_CONCRETE(18756), + BLUE_CONCRETE_POWDER(17773), + BLUE_GLAZED_TERRACOTTA(23823, Directional.class), + BLUE_ICE(22449), + BLUE_ORCHID(13432), + BLUE_SHULKER_BOX(11476, 1, Directional.class), + BLUE_STAINED_GLASS(7107), + BLUE_STAINED_GLASS_PANE(28484, GlassPane.class), + BLUE_TERRACOTTA(5236), + BLUE_WALL_BANNER(17757, Directional.class), + BLUE_WOOL(15738), + BONE(5686), + BONE_BLOCK(17312, Orientable.class), + BONE_MEAL(32458), + BOOK(23097), + BOOKSHELF(10069), + BOW(8745, 1, 384), + BOWL(32661), + BRAIN_CORAL(31316), + BRAIN_CORAL_BLOCK(30618), + BRAIN_CORAL_FAN(13849, Directional.class), + BREAD(32049), + BREWING_STAND(14539, BrewingStand.class), + BRICK(6820), + BRICKS(14165), + BRICK_SLAB(26333, Slab.class), + BRICK_STAIRS(21534, Stairs.class), + BROWN_BANNER(11481, 16, Rotatable.class), + BROWN_BED(25624, 1, Bed.class), + BROWN_CARPET(23352), + BROWN_CONCRETE(19006), + BROWN_CONCRETE_POWDER(21485), + BROWN_GLAZED_TERRACOTTA(5655, Directional.class), + BROWN_MUSHROOM(9665), + BROWN_MUSHROOM_BLOCK(6291, MultipleFacing.class), + BROWN_SHULKER_BOX(24230, 1, Directional.class), + BROWN_STAINED_GLASS(20945), + BROWN_STAINED_GLASS_PANE(17557, GlassPane.class), + BROWN_TERRACOTTA(23664), + BROWN_WALL_BANNER(14731, Directional.class), + BROWN_WOOL(32638), + BUBBLE_COLUMN(13758, BubbleColumn.class), + BUBBLE_CORAL(12464), + BUBBLE_CORAL_BLOCK(15437), + BUBBLE_CORAL_FAN(10795, Directional.class), + BUCKET(15215, 16), + CACTUS(12191, Ageable.class), + CACTUS_GREEN(17296), + CAKE(27048, 1, Cake.class), + CARROT(22824), + CARROTS(17258, Ageable.class), + CARROT_ON_A_STICK(27809, 1, 25), + CARVED_PUMPKIN(25833, Directional.class), + CAULDRON(26531, Levelled.class), + CAVE_AIR(17422), + CAVE_SPIDER_SPAWN_EGG(23341), + CHAINMAIL_BOOTS(17953, 1, 195), + CHAINMAIL_CHESTPLATE(23602, 1, 240), + CHAINMAIL_HELMET(26114, 1, 165), + CHAINMAIL_LEGGINGS(19087, 1, 225), + CHAIN_COMMAND_BLOCK(26798, CommandBlock.class), + CHARCOAL(5390), + CHEST(22969, Chest.class), + CHEST_MINECART(4497, 1), + CHICKEN(17281), + CHICKEN_SPAWN_EGG(5462), + CHIPPED_ANVIL(10623, Directional.class), + CHISELED_QUARTZ_BLOCK(30964), + CHISELED_RED_SANDSTONE(15529), + CHISELED_SANDSTONE(31763), + CHISELED_STONE_BRICKS(9087), + CHORUS_FLOWER(28542, Ageable.class), + CHORUS_FRUIT(7652), + CHORUS_PLANT(28243, MultipleFacing.class), + CLAY(27880), + CLAY_BALL(24603), + CLOCK(14980), + COAL(29067), + COAL_BLOCK(27968), + COAL_ORE(30965), + COARSE_DIRT(15411), + COBBLESTONE(32147), + COBBLESTONE_SLAB(6340, Slab.class), + COBBLESTONE_STAIRS(24715, Stairs.class), + COBBLESTONE_WALL(12616, Fence.class), + COBWEB(9469), + COCOA(29709, Cocoa.class), + COCOA_BEANS(27381), + COD(24691), + COD_BUCKET(28601, 1), + COD_SPAWN_EGG(27248), + COMMAND_BLOCK(4355, CommandBlock.class), + COMMAND_BLOCK_MINECART(7992, 1), + COMPARATOR(18911, Comparator.class), + COMPASS(24139), + CONDUIT(5148), + COOKED_BEEF(21595), + COOKED_CHICKEN(20780), + COOKED_COD(9681), + COOKED_MUTTON(31447), + COOKED_PORKCHOP(27231), + COOKED_RABBIT(4454), + COOKED_SALMON(5615), + COOKIE(27431), + COW_SPAWN_EGG(14761), + CRACKED_STONE_BRICKS(27869), + CRAFTING_TABLE(20706), + CREEPER_HEAD(29146, Rotatable.class), + CREEPER_SPAWN_EGG(9653), + CREEPER_WALL_HEAD(30123, Directional.class), + CUT_RED_SANDSTONE(26842), + CUT_SANDSTONE(6118), + CYAN_BANNER(9839, 16, Rotatable.class), + CYAN_BED(16746, 1, Bed.class), + CYAN_CARPET(31495), + CYAN_CONCRETE(26522), + CYAN_CONCRETE_POWDER(15734), + CYAN_DYE(8043), + CYAN_GLAZED_TERRACOTTA(9550, Directional.class), + CYAN_SHULKER_BOX(28123, 1, Directional.class), + CYAN_STAINED_GLASS(30604), + CYAN_STAINED_GLASS_PANE(11784, GlassPane.class), + CYAN_TERRACOTTA(25940), + CYAN_WALL_BANNER(10889, Directional.class), + CYAN_WOOL(12221), + DAMAGED_ANVIL(10274, Directional.class), + DANDELION(30558), + DANDELION_YELLOW(21789), + DARK_OAK_BOAT(28618, 1), + DARK_OAK_BUTTON(6214, Switch.class), + DARK_OAK_DOOR(10669, Door.class), + DARK_OAK_FENCE(21767, Fence.class), + DARK_OAK_FENCE_GATE(10679, Gate.class), + DARK_OAK_LEAVES(22254, Leaves.class), + DARK_OAK_LOG(14831, Orientable.class), + DARK_OAK_PLANKS(20869), + DARK_OAK_PRESSURE_PLATE(31375, Powerable.class), + DARK_OAK_SAPLING(14933, Sapling.class), + DARK_OAK_SLAB(28852, Slab.class), + DARK_OAK_STAIRS(22921, Stairs.class), + DARK_OAK_TRAPDOOR(10355, TrapDoor.class), + DARK_OAK_WOOD(7871, Orientable.class), + DARK_PRISMARINE(19940), + DARK_PRISMARINE_SLAB(7577, Slab.class), + DARK_PRISMARINE_STAIRS(26511, Stairs.class), + DAYLIGHT_DETECTOR(8864, DaylightDetector.class), + DEAD_BRAIN_CORAL_BLOCK(12979), + DEAD_BUBBLE_CORAL_BLOCK(28220), + DEAD_BUSH(22888), + DEAD_FIRE_CORAL_BLOCK(5307), + DEAD_HORN_CORAL_BLOCK(15103), + DEAD_TUBE_CORAL_BLOCK(28350), + DEBUG_STICK(24562, 1), + DETECTOR_RAIL(13475, RedstoneRail.class), + DIAMOND(20865), + DIAMOND_AXE(27277, 1, 1561), + DIAMOND_BLOCK(5944), + DIAMOND_BOOTS(16522, 1, 429), + DIAMOND_CHESTPLATE(32099, 1, 528), + DIAMOND_HELMET(10755, 1, 363), + DIAMOND_HOE(24050, 1, 1561), + DIAMOND_HORSE_ARMOR(10321, 1), + DIAMOND_LEGGINGS(11202, 1, 495), + DIAMOND_ORE(9292), + DIAMOND_PICKAXE(24291, 1, 1561), + DIAMOND_SHOVEL(25415, 1, 1561), + DIAMOND_SWORD(27707, 1, 1561), + DIORITE(24688), + DIRT(10580), + DISPENSER(20871, Dispenser.class), + DOLPHIN_SPAWN_EGG(20787), + DONKEY_SPAWN_EGG(14513), + DRAGON_BREATH(20154), + DRAGON_EGG(29946), + DRAGON_HEAD(20084, Rotatable.class), + DRAGON_WALL_HEAD(19818, Directional.class), + DRIED_KELP(21042), + DRIED_KELP_BLOCK(12966), + DROPPER(31273, Dispenser.class), + DROWNED_SPAWN_EGG(19368), + EGG(21603, 16), + ELDER_GUARDIAN_SPAWN_EGG(11418), + ELYTRA(23829, 1, 432), + EMERALD(5654), + EMERALD_BLOCK(9914), + EMERALD_ORE(16630), + ENCHANTED_BOOK(11741, 1), + ENCHANTED_GOLDEN_APPLE(8280), + ENCHANTING_TABLE(16255), + ENDERMAN_SPAWN_EGG(29488), + ENDERMITE_SPAWN_EGG(16617), + ENDER_CHEST(32349, EnderChest.class), + ENDER_EYE(24860), + ENDER_PEARL(5259, 16), + END_CRYSTAL(19090), + END_GATEWAY(26605), + END_PORTAL(16782), + END_PORTAL_FRAME(15480, EndPortalFrame.class), + END_ROD(24832, Directional.class), + END_STONE(29686), + END_STONE_BRICKS(20314), + EVOKER_SPAWN_EGG(19365), + EXPERIENCE_BOTTLE(12858), + FARMLAND(31166, Farmland.class), + FEATHER(30548), + FERMENTED_SPIDER_EYE(19386), + FERN(15794), + FILLED_MAP(23504), + FIRE(16396, Fire.class), + FIREWORK_ROCKET(23841), + FIREWORK_STAR(12190), + FIRE_CHARGE(4842), + FIRE_CORAL(29151), + FIRE_CORAL_BLOCK(12119), + FIRE_CORAL_FAN(11112, Directional.class), + FISHING_ROD(4167, 1, 64), + FLINT(23596), + FLINT_AND_STEEL(28620, 1, 64), + FLOWER_POT(30567), + FROSTED_ICE(21814, Ageable.class), + FURNACE(8133, Furnace.class), + FURNACE_MINECART(14196, 1), + GHAST_SPAWN_EGG(9970), + GHAST_TEAR(18222), + GLASS(6195), + GLASS_BOTTLE(6116), + GLASS_PANE(5709, GlassPane.class), + GLISTERING_MELON_SLICE(20158), + GLOWSTONE(32713), + GLOWSTONE_DUST(6665), + GOLDEN_APPLE(27732), + GOLDEN_AXE(4878, 1, 32), + GOLDEN_BOOTS(7859, 1, 91), + GOLDEN_CARROT(5300), + GOLDEN_CHESTPLATE(4507, 1, 112), + GOLDEN_HELMET(7945, 1, 77), + GOLDEN_HOE(19337, 1, 32), + GOLDEN_HORSE_ARMOR(7996, 1), + GOLDEN_LEGGINGS(21002, 1, 105), + GOLDEN_PICKAXE(10901, 1, 32), + GOLDEN_SHOVEL(15597, 1, 32), + GOLDEN_SWORD(10505, 1, 32), + GOLD_BLOCK(27392), + GOLD_INGOT(28927), + GOLD_NUGGET(28814), + GOLD_ORE(32625), + GRANITE(21091), + GRASS(6155), + GRASS_BLOCK(28346, Snowable.class), + GRASS_PATH(8604), + GRAVEL(7804), + GRAY_BANNER(12053, 16, Rotatable.class), + GRAY_BED(15745, 1, Bed.class), + GRAY_CARPET(26991), + GRAY_CONCRETE(13959), + GRAY_CONCRETE_POWDER(13031), + GRAY_DYE(9184), + GRAY_GLAZED_TERRACOTTA(6256, Directional.class), + GRAY_SHULKER_BOX(12754, 1, Directional.class), + GRAY_STAINED_GLASS(29979), + GRAY_STAINED_GLASS_PANE(25272, GlassPane.class), + GRAY_TERRACOTTA(18004), + GRAY_WALL_BANNER(24275, Directional.class), + GRAY_WOOL(27209), + GREEN_BANNER(10698, 16, Rotatable.class), + GREEN_BED(13797, 1, Bed.class), + GREEN_CARPET(7780), + GREEN_CONCRETE(17949), + GREEN_CONCRETE_POWDER(6904), + GREEN_GLAZED_TERRACOTTA(6958, Directional.class), + GREEN_SHULKER_BOX(9377, 1, Directional.class), + GREEN_STAINED_GLASS(22503), + GREEN_STAINED_GLASS_PANE(4767, GlassPane.class), + GREEN_TERRACOTTA(4105), + GREEN_WALL_BANNER(15046, Directional.class), + GREEN_WOOL(25085), + GUARDIAN_SPAWN_EGG(20113), + GUNPOWDER(29974), + HAY_BLOCK(17461, Orientable.class), + HEART_OF_THE_SEA(11807), + HEAVY_WEIGHTED_PRESSURE_PLATE(16970, AnaloguePowerable.class), + HOPPER(31974, Hopper.class), + HOPPER_MINECART(19024, 1), + HORN_CORAL(19511), + HORN_CORAL_BLOCK(19958), + HORN_CORAL_FAN(13610, Directional.class), + HORSE_SPAWN_EGG(25981), + HUSK_SPAWN_EGG(20178), + ICE(30428), + INFESTED_CHISELED_STONE_BRICKS(4728), + INFESTED_COBBLESTONE(28798), + INFESTED_CRACKED_STONE_BRICKS(7476), + INFESTED_MOSSY_STONE_BRICKS(9850), + INFESTED_STONE(18440), + INFESTED_STONE_BRICKS(19749), + INK_SAC(7184), + IRON_AXE(15894, 1, 250), + IRON_BARS(9378, Fence.class), + IRON_BLOCK(24754), + IRON_BOOTS(8531, 1, 195), + IRON_CHESTPLATE(28112, 1, 240), + IRON_DOOR(4788, Door.class), + IRON_HELMET(12025, 1, 165), + IRON_HOE(11339, 1, 250), + IRON_HORSE_ARMOR(30108, 1), + IRON_INGOT(24895), + IRON_LEGGINGS(18951, 1, 225), + IRON_NUGGET(13715), + IRON_ORE(19834), + IRON_PICKAXE(8842, 1, 250), + IRON_SHOVEL(30045, 1, 250), + IRON_SWORD(10904, 1, 250), + IRON_TRAPDOOR(17095, TrapDoor.class), + ITEM_FRAME(27318), + JACK_O_LANTERN(31612, Directional.class), + JUKEBOX(19264, Jukebox.class), + JUNGLE_BOAT(4495, 1), + JUNGLE_BUTTON(25317, Switch.class), + JUNGLE_DOOR(28163, Door.class), + JUNGLE_FENCE(14358, Fence.class), + JUNGLE_FENCE_GATE(21360, Gate.class), + JUNGLE_LEAVES(5133, Leaves.class), + JUNGLE_LOG(20721, Orientable.class), + JUNGLE_PLANKS(26445), + JUNGLE_PRESSURE_PLATE(11376, Powerable.class), + JUNGLE_SAPLING(17951, Sapling.class), + JUNGLE_SLAB(19117, Slab.class), + JUNGLE_STAIRS(20636, Stairs.class), + JUNGLE_TRAPDOOR(8626, TrapDoor.class), + JUNGLE_WOOD(30228, Orientable.class), + KELP(21916, Ageable.class), + KELP_PLANT(29697), + KNOWLEDGE_BOOK(12646, 1), + LADDER(23599, Ladder.class), + LAPIS_BLOCK(14485), + LAPIS_LAZULI(11075), + LAPIS_ORE(22934), + LARGE_FERN(30177, Bisected.class), + LAVA(8415, Levelled.class), + LAVA_BUCKET(9228, 1), + LEAD(29539), + LEATHER(16414), + LEATHER_BOOTS(15282, 1, 65), + LEATHER_CHESTPLATE(29275, 1, 80), + LEATHER_HELMET(11624, 1, 55), + LEATHER_LEGGINGS(28210, 1, 75), + LEVER(15319, Switch.class), + LIGHT_BLUE_BANNER(18060, 16, Rotatable.class), + LIGHT_BLUE_BED(20957, 1, Bed.class), + LIGHT_BLUE_CARPET(21194), + LIGHT_BLUE_CONCRETE(29481), + LIGHT_BLUE_CONCRETE_POWDER(31206), + LIGHT_BLUE_DYE(28738), + LIGHT_BLUE_GLAZED_TERRACOTTA(4336, Directional.class), + LIGHT_BLUE_SHULKER_BOX(18226, 1, Directional.class), + LIGHT_BLUE_STAINED_GLASS(17162), + LIGHT_BLUE_STAINED_GLASS_PANE(18721, GlassPane.class), + LIGHT_BLUE_TERRACOTTA(31779), + LIGHT_BLUE_WALL_BANNER(12011, Directional.class), + LIGHT_BLUE_WOOL(21073), + LIGHT_GRAY_BANNER(11417, 16, Rotatable.class), + LIGHT_GRAY_BED(5090, 1, Bed.class), + LIGHT_GRAY_CARPET(11317), + LIGHT_GRAY_CONCRETE(14453), + LIGHT_GRAY_CONCRETE_POWDER(21589), + LIGHT_GRAY_DYE(27643), + LIGHT_GRAY_GLAZED_TERRACOTTA(10707, Directional.class), + LIGHT_GRAY_SHULKER_BOX(21345, 1, Directional.class), + LIGHT_GRAY_STAINED_GLASS(5843), + LIGHT_GRAY_STAINED_GLASS_PANE(19008, GlassPane.class), + LIGHT_GRAY_TERRACOTTA(26388), + LIGHT_GRAY_WALL_BANNER(31088, Directional.class), + LIGHT_GRAY_WOOL(22936), + LIGHT_WEIGHTED_PRESSURE_PLATE(14875, AnaloguePowerable.class), + LILAC(22837, Bisected.class), + LILY_PAD(19271), + LIME_BANNER(18887, 16, Rotatable.class), + LIME_BED(27860, 1, Bed.class), + LIME_CARPET(15443), + LIME_CONCRETE(5863), + LIME_CONCRETE_POWDER(28859), + LIME_DYE(6147), + LIME_GLAZED_TERRACOTTA(13861, Directional.class), + LIME_SHULKER_BOX(28360, 1, Directional.class), + LIME_STAINED_GLASS(24266), + LIME_STAINED_GLASS_PANE(10610, GlassPane.class), + LIME_TERRACOTTA(24013), + LIME_WALL_BANNER(21422, Directional.class), + LIME_WOOL(10443), + LINGERING_POTION(25857, 1), + LLAMA_SPAWN_EGG(23640), + MAGENTA_BANNER(15591, 16, Rotatable.class), + MAGENTA_BED(20061, 1, Bed.class), + MAGENTA_CARPET(6180), + MAGENTA_CONCRETE(20591), + MAGENTA_CONCRETE_POWDER(8272), + MAGENTA_DYE(11788), + MAGENTA_GLAZED_TERRACOTTA(8067, Directional.class), + MAGENTA_SHULKER_BOX(21566, 1, Directional.class), + MAGENTA_STAINED_GLASS(26814), + MAGENTA_STAINED_GLASS_PANE(14082, GlassPane.class), + MAGENTA_TERRACOTTA(25900), + MAGENTA_WALL_BANNER(23291, Directional.class), + MAGENTA_WOOL(11853), + MAGMA_BLOCK(25927), + MAGMA_CREAM(25097), + MAGMA_CUBE_SPAWN_EGG(26638), + MAP(21655), + MELON(25172), + MELON_SEEDS(18340), + MELON_SLICE(5347), + MELON_STEM(8247, Ageable.class), + MILK_BUCKET(9680, 1), + MINECART(14352, 1), + MOOSHROOM_SPAWN_EGG(22125), + MOSSY_COBBLESTONE(21900, MultipleFacing.class), + MOSSY_COBBLESTONE_WALL(11536, Fence.class), + MOSSY_STONE_BRICKS(16415), + MOVING_PISTON(13831, TechnicalPiston.class), + MULE_SPAWN_EGG(11229), + MUSHROOM_STEM(16543, MultipleFacing.class), + MUSHROOM_STEW(16336, 1), + MUSIC_DISC_11(27426, 1), + MUSIC_DISC_13(16359, 1), + MUSIC_DISC_BLOCKS(26667, 1), + MUSIC_DISC_CAT(16246, 1), + MUSIC_DISC_CHIRP(19436, 1), + MUSIC_DISC_FAR(13823, 1), + MUSIC_DISC_MALL(11517, 1), + MUSIC_DISC_MELLOHI(26117, 1), + MUSIC_DISC_STAL(14989, 1), + MUSIC_DISC_STRAD(16785, 1), + MUSIC_DISC_WAIT(26499, 1), + MUSIC_DISC_WARD(24026, 1), + MUTTON(4792), + MYCELIUM(9913, Snowable.class), + NAME_TAG(30731), + NAUTILUS_SHELL(19989), + NETHERRACK(23425), + NETHER_BRICK(19996), + NETHER_BRICKS(27802), + NETHER_BRICK_FENCE(5286, Fence.class), + NETHER_BRICK_SLAB(26586, Slab.class), + NETHER_BRICK_STAIRS(12085, Stairs.class), + NETHER_PORTAL(19085, Orientable.class), + NETHER_QUARTZ_ORE(4807), + NETHER_STAR(12469), + NETHER_WART(29227, Ageable.class), + NETHER_WART_BLOCK(15486), + NOTE_BLOCK(20979, NoteBlock.class), + OAK_BOAT(17570, 1), + OAK_BUTTON(13510, Switch.class), + OAK_DOOR(20341, Door.class), + OAK_FENCE(6442, Fence.class), + OAK_FENCE_GATE(16689, Gate.class), + OAK_LEAVES(4385, Leaves.class), + OAK_LOG(26723, Orientable.class), + OAK_PLANKS(14905), + OAK_PRESSURE_PLATE(20108, Powerable.class), + OAK_SAPLING(9636, Sapling.class), + OAK_SLAB(12002, Slab.class), + OAK_STAIRS(5449, Stairs.class), + OAK_TRAPDOOR(16927, TrapDoor.class), + OAK_WOOD(23286, Orientable.class), + OBSERVER(10726, Observer.class), + OBSIDIAN(32723), + OCELOT_SPAWN_EGG(30080), + ORANGE_BANNER(4839, 16, Rotatable.class), + ORANGE_BED(11194, 1, Bed.class), + ORANGE_CARPET(24752), + ORANGE_CONCRETE(19914), + ORANGE_CONCRETE_POWDER(30159), + ORANGE_DYE(13866), + ORANGE_GLAZED_TERRACOTTA(27451, Directional.class), + ORANGE_SHULKER_BOX(21673, 1, Directional.class), + ORANGE_STAINED_GLASS(25142), + ORANGE_STAINED_GLASS_PANE(21089, GlassPane.class), + ORANGE_TERRACOTTA(18684), + ORANGE_TULIP(26038), + ORANGE_WALL_BANNER(9936, Directional.class), + ORANGE_WOOL(23957), + OXEYE_DAISY(11709), + PACKED_ICE(28993), + PAINTING(23945), + PAPER(9923), + PARROT_SPAWN_EGG(23614), + PEONY(21155, Bisected.class), + PETRIFIED_OAK_SLAB(18658, Slab.class), + PHANTOM_MEMBRANE(18398), + PHANTOM_SPAWN_EGG(24648), + PIG_SPAWN_EGG(22584), + PINK_BANNER(19439, 16, Rotatable.class), + PINK_BED(13795, 1, Bed.class), + PINK_CARPET(30186), + PINK_CONCRETE(5227), + PINK_CONCRETE_POWDER(6421), + PINK_DYE(31151), + PINK_GLAZED_TERRACOTTA(10260, Directional.class), + PINK_SHULKER_BOX(24968, 1, Directional.class), + PINK_STAINED_GLASS(16164), + PINK_STAINED_GLASS_PANE(24637, GlassPane.class), + PINK_TERRACOTTA(23727), + PINK_TULIP(27319), + PINK_WALL_BANNER(9421, Directional.class), + PINK_WOOL(7611), + PISTON(21130, Piston.class), + PISTON_HEAD(30226, PistonHead.class), + PLAYER_HEAD(21174, Rotatable.class), + PLAYER_WALL_HEAD(13164, Directional.class), + PODZOL(24068, Snowable.class), + POISONOUS_POTATO(32640), + POLAR_BEAR_SPAWN_EGG(17015), + POLISHED_ANDESITE(8335), + POLISHED_DIORITE(31615), + POLISHED_GRANITE(5477), + POPPED_CHORUS_FRUIT(16880), + POPPY(12851), + PORKCHOP(30896), + POTATO(21088), + POTATOES(10879, Ageable.class), + POTION(24020, 1), + POTTED_ACACIA_SAPLING(14096), + POTTED_ALLIUM(13184), + POTTED_AZURE_BLUET(8754), + POTTED_BIRCH_SAPLING(32484), + POTTED_BLUE_ORCHID(6599), + POTTED_BROWN_MUSHROOM(14481), + POTTED_CACTUS(8777), + POTTED_DANDELION(9727), + POTTED_DARK_OAK_SAPLING(6486), + POTTED_DEAD_BUSH(13020), + POTTED_FERN(23315), + POTTED_JUNGLE_SAPLING(7525), + POTTED_OAK_SAPLING(11905), + POTTED_ORANGE_TULIP(28807), + POTTED_OXEYE_DAISY(19707), + POTTED_PINK_TULIP(10089), + POTTED_POPPY(7457), + POTTED_RED_MUSHROOM(22881), + POTTED_RED_TULIP(28594), + POTTED_SPRUCE_SAPLING(29498), + POTTED_WHITE_TULIP(24330), + POWERED_RAIL(11064, RedstoneRail.class), + PRISMARINE(7539), + PRISMARINE_BRICKS(29118), + PRISMARINE_BRICK_SLAB(26672, Slab.class), + PRISMARINE_BRICK_STAIRS(15445, Stairs.class), + PRISMARINE_CRYSTALS(31546), + PRISMARINE_SHARD(10993), + PRISMARINE_SLAB(31323, Slab.class), + PRISMARINE_STAIRS(19217, Stairs.class), + PUFFERFISH(8115), + PUFFERFISH_BUCKET(8861, 1), + PUFFERFISH_SPAWN_EGG(24573), + PUMPKIN(19170), + PUMPKIN_PIE(28725), + PUMPKIN_SEEDS(28985), + PUMPKIN_STEM(19021, Ageable.class), + PURPLE_BANNER(29027, 16, Rotatable.class), + PURPLE_BED(29755, 1, Bed.class), + PURPLE_CARPET(5574), + PURPLE_CONCRETE(20623), + PURPLE_CONCRETE_POWDER(26808), + PURPLE_DYE(6347), + PURPLE_GLAZED_TERRACOTTA(4818, Directional.class), + PURPLE_SHULKER_BOX(10373, 1, Directional.class), + PURPLE_STAINED_GLASS(21845), + PURPLE_STAINED_GLASS_PANE(10948, GlassPane.class), + PURPLE_TERRACOTTA(10387), + PURPLE_WALL_BANNER(14298, Directional.class), + PURPLE_WOOL(11922), + PURPUR_BLOCK(7538), + PURPUR_PILLAR(26718, Orientable.class), + PURPUR_SLAB(11487, Slab.class), + PURPUR_STAIRS(8921, Stairs.class), + QUARTZ(23608), + QUARTZ_BLOCK(11987), + QUARTZ_PILLAR(16452, Orientable.class), + QUARTZ_SLAB(4423, Slab.class), + QUARTZ_STAIRS(24079, Stairs.class), + RABBIT(23068), + RABBIT_FOOT(13864), + RABBIT_HIDE(12467), + RABBIT_SPAWN_EGG(26496), + RABBIT_STEW(10611, 1), + RAIL(13285, Rail.class), + REDSTONE(11233), + REDSTONE_BLOCK(19496), + REDSTONE_LAMP(8217, Lightable.class), + REDSTONE_ORE(10887, Lightable.class), + REDSTONE_TORCH(22547, Lightable.class), + REDSTONE_WALL_TORCH(7595, RedstoneWallTorch.class), + REDSTONE_WIRE(25984, RedstoneWire.class), + RED_BANNER(26961, 16, Rotatable.class), + RED_BED(30910, 1, Bed.class), + RED_CARPET(5424), + RED_CONCRETE(8032), + RED_CONCRETE_POWDER(13286), + RED_GLAZED_TERRACOTTA(24989, Directional.class), + RED_MUSHROOM(19728), + RED_MUSHROOM_BLOCK(20766, MultipleFacing.class), + RED_NETHER_BRICKS(18056), + RED_SAND(16279), + RED_SANDSTONE(9092), + RED_SANDSTONE_SLAB(17550, Slab.class), + RED_SANDSTONE_STAIRS(25466, Stairs.class), + RED_SHULKER_BOX(32448, 1, Directional.class), + RED_STAINED_GLASS(9717), + RED_STAINED_GLASS_PANE(8630, GlassPane.class), + RED_TERRACOTTA(5086), + RED_TULIP(16781), + RED_WALL_BANNER(4378, Directional.class), + RED_WOOL(11621), + REPEATER(28823, Repeater.class), + REPEATING_COMMAND_BLOCK(12405, CommandBlock.class), + ROSE_BUSH(6080, Bisected.class), + ROSE_RED(15694), + ROTTEN_FLESH(21591), + SADDLE(30206, 1), + SALMON(18516), + SALMON_BUCKET(31427, 1), + SALMON_SPAWN_EGG(18739), + SAND(11542), + SANDSTONE(13141), + SANDSTONE_SLAB(29830, Slab.class), + SANDSTONE_STAIRS(18474, Stairs.class), + SCUTE(11914), + SEAGRASS(23942), + SEA_LANTERN(16984), + SEA_PICKLE(19562, SeaPickle.class), + SHEARS(27971, 1, 238), + SHEEP_SPAWN_EGG(24488), + SHIELD(29943, 1, 336), + SHULKER_BOX(7776, 1, Directional.class), + SHULKER_SHELL(27848), + SHULKER_SPAWN_EGG(31848), + SIGN(16918, 16, Sign.class), + SILVERFISH_SPAWN_EGG(14537), + SKELETON_HORSE_SPAWN_EGG(21356), + SKELETON_SKULL(13270, Rotatable.class), + SKELETON_SPAWN_EGG(15261), + SKELETON_WALL_SKULL(31650, Directional.class), + SLIME_BALL(5242), + SLIME_BLOCK(31892), + SLIME_SPAWN_EGG(6550), + SMOOTH_QUARTZ(14415), + SMOOTH_RED_SANDSTONE(25180), + SMOOTH_SANDSTONE(30039), + SMOOTH_STONE(21910), + SNOW(14146, Snow.class), + SNOWBALL(19487, 16), + SNOW_BLOCK(19913), + SOUL_SAND(16841), + SPAWNER(25500), + SPECTRAL_ARROW(4568), + SPIDER_EYE(9318), + SPIDER_SPAWN_EGG(14984), + SPLASH_POTION(30248, 1), + SPONGE(15860), + SPRUCE_BOAT(9606, 1), + SPRUCE_BUTTON(23281, Switch.class), + SPRUCE_DOOR(10642, Door.class), + SPRUCE_FENCE(25416, Fence.class), + SPRUCE_FENCE_GATE(26423, Gate.class), + SPRUCE_LEAVES(20039, Leaves.class), + SPRUCE_LOG(9726, Orientable.class), + SPRUCE_PLANKS(14593), + SPRUCE_PRESSURE_PLATE(15932, Powerable.class), + SPRUCE_SAPLING(19874, Sapling.class), + SPRUCE_SLAB(4348, Slab.class), + SPRUCE_STAIRS(11192, Stairs.class), + SPRUCE_TRAPDOOR(10289, TrapDoor.class), + SPRUCE_WOOD(22538, Orientable.class), + SQUID_SPAWN_EGG(10682), + STICK(9773), + STICKY_PISTON(18127, Piston.class), + STONE(22948), + STONE_AXE(6338, 1, 131), + STONE_BRICKS(6962), + STONE_BRICK_SLAB(19676, Slab.class), + STONE_BRICK_STAIRS(27032, Stairs.class), + STONE_BUTTON(12279, Switch.class), + STONE_HOE(22855, 1, 131), + STONE_PICKAXE(14611, 1, 131), + STONE_PRESSURE_PLATE(22591, Powerable.class), + STONE_SHOVEL(9520, 1, 131), + STONE_SLAB(19838, Slab.class), + STONE_SWORD(25084, 1, 131), + STRAY_SPAWN_EGG(30153), + STRING(12806), + STRIPPED_ACACIA_LOG(18167, Orientable.class), + STRIPPED_ACACIA_WOOD(17579, Orientable.class), + STRIPPED_BIRCH_LOG(8838, Orientable.class), + STRIPPED_BIRCH_WOOD(30740, Orientable.class), + STRIPPED_DARK_OAK_LOG(6492, Orientable.class), + STRIPPED_DARK_OAK_WOOD(6606, Orientable.class), + STRIPPED_JUNGLE_LOG(15476, Orientable.class), + STRIPPED_JUNGLE_WOOD(5072, Orientable.class), + STRIPPED_OAK_LOG(20523, Orientable.class), + STRIPPED_OAK_WOOD(4514, Orientable.class), + STRIPPED_SPRUCE_LOG(6140, Orientable.class), + STRIPPED_SPRUCE_WOOD(15634, Orientable.class), + STRUCTURE_BLOCK(26831, StructureBlock.class), + STRUCTURE_VOID(30806), + SUGAR(30638), + SUGAR_CANE(7726, Ageable.class), + SUNFLOWER(7408, Bisected.class), + TALL_GRASS(21559, Bisected.class), + TALL_SEAGRASS(27189, Bisected.class), + TERRACOTTA(16544), + TIPPED_ARROW(25164), + TNT(7896), + TNT_MINECART(4277, 1), + TORCH(6063), + TOTEM_OF_UNDYING(10139, 1), + TRAPPED_CHEST(18970, Chest.class), + TRIDENT(7534, 1, 250), + TRIPWIRE(8810, Tripwire.class), + TRIPWIRE_HOOK(8130, TripwireHook.class), + TROPICAL_FISH(12795), + TROPICAL_FISH_BUCKET(30390, 1), + TROPICAL_FISH_SPAWN_EGG(19713), + TUBE_CORAL(23048), + TUBE_CORAL_BLOCK(23723), + TUBE_CORAL_FAN(19929, Directional.class), + TURTLE_EGG(32101, TurtleEgg.class), + TURTLE_HELMET(30120, 1, 275), + TURTLE_SPAWN_EGG(17324), + VEX_SPAWN_EGG(27751), + VILLAGER_SPAWN_EGG(30348), + VINDICATOR_SPAWN_EGG(21672), + VINE(14564, MultipleFacing.class), + VOID_AIR(13668), + WALL_SIGN(10644, WallSign.class), + WALL_TORCH(25890, Directional.class), + WATER(24998, Levelled.class), + WATER_BUCKET(8802, 1), + WET_SPONGE(9043), + WHEAT(27709, Ageable.class), + WHEAT_SEEDS(28742), + WHITE_BANNER(17562, 16, Rotatable.class), + WHITE_BED(8185, 1, Bed.class), + WHITE_CARPET(15117), + WHITE_CONCRETE(6281), + WHITE_CONCRETE_POWDER(10363), + WHITE_GLAZED_TERRACOTTA(11326, Directional.class), + WHITE_SHULKER_BOX(31750, 1, Directional.class), + WHITE_STAINED_GLASS(31190), + WHITE_STAINED_GLASS_PANE(10557, GlassPane.class), + WHITE_TERRACOTTA(20975), + WHITE_TULIP(9742), + WHITE_WALL_BANNER(15967, Directional.class), + WHITE_WOOL(8624), + WITCH_SPAWN_EGG(11837), + WITHER_SKELETON_SKULL(31487, Rotatable.class), + WITHER_SKELETON_SPAWN_EGG(10073), + WITHER_SKELETON_WALL_SKULL(9326, Directional.class), + WOLF_SPAWN_EGG(21692), + WOODEN_AXE(6292, 1, 59), + WOODEN_HOE(16043, 1, 59), + WOODEN_PICKAXE(12792, 1, 59), + WOODEN_SHOVEL(28432, 1, 59), + WOODEN_SWORD(7175, 1, 59), + WRITABLE_BOOK(13393, 1), + WRITTEN_BOOK(24164, 16), + YELLOW_BANNER(30382, 16, Rotatable.class), + YELLOW_BED(30410, 1, Bed.class), + YELLOW_CARPET(18149), + YELLOW_CONCRETE(15722), + YELLOW_CONCRETE_POWDER(10655), + YELLOW_GLAZED_TERRACOTTA(10914, Directional.class), + YELLOW_SHULKER_BOX(28700, 1, Directional.class), + YELLOW_STAINED_GLASS(12182), + YELLOW_STAINED_GLASS_PANE(20298, GlassPane.class), + YELLOW_TERRACOTTA(32129), + YELLOW_WALL_BANNER(32004, Directional.class), + YELLOW_WOOL(29507), + ZOMBIE_HEAD(9304, Rotatable.class), + ZOMBIE_HORSE_SPAWN_EGG(4275), + ZOMBIE_PIGMAN_SPAWN_EGG(11531), + ZOMBIE_SPAWN_EGG(5814), + ZOMBIE_VILLAGER_SPAWN_EGG(10311), + ZOMBIE_WALL_HEAD(16296, Directional.class), + // ----- Legacy Separator ----- + @Deprecated + LEGACY_AIR(0, 0), + @Deprecated + LEGACY_STONE(1), + @Deprecated + LEGACY_GRASS(2), + @Deprecated + LEGACY_DIRT(3), + @Deprecated + LEGACY_COBBLESTONE(4), + @Deprecated + LEGACY_WOOD(5, org.bukkit.material.Wood.class), + @Deprecated + LEGACY_SAPLING(6, org.bukkit.material.Sapling.class), + @Deprecated + LEGACY_BEDROCK(7), + @Deprecated + LEGACY_WATER(8, org.bukkit.material.MaterialData.class), + @Deprecated + LEGACY_STATIONARY_WATER(9, org.bukkit.material.MaterialData.class), + @Deprecated + LEGACY_LAVA(10, org.bukkit.material.MaterialData.class), + @Deprecated + LEGACY_STATIONARY_LAVA(11, org.bukkit.material.MaterialData.class), + @Deprecated + LEGACY_SAND(12), + @Deprecated + LEGACY_GRAVEL(13), + @Deprecated + LEGACY_GOLD_ORE(14), + @Deprecated + LEGACY_IRON_ORE(15), + @Deprecated + LEGACY_COAL_ORE(16), + @Deprecated + LEGACY_LOG(17, org.bukkit.material.Tree.class), + @Deprecated + LEGACY_LEAVES(18, org.bukkit.material.Leaves.class), + @Deprecated + LEGACY_SPONGE(19), + @Deprecated + LEGACY_GLASS(20), + @Deprecated + LEGACY_LAPIS_ORE(21), + @Deprecated + LEGACY_LAPIS_BLOCK(22), + @Deprecated + LEGACY_DISPENSER(23, org.bukkit.material.Dispenser.class), + @Deprecated + LEGACY_SANDSTONE(24, org.bukkit.material.Sandstone.class), + @Deprecated + LEGACY_NOTE_BLOCK(25), + @Deprecated + LEGACY_BED_BLOCK(26, org.bukkit.material.Bed.class), + @Deprecated + LEGACY_POWERED_RAIL(27, org.bukkit.material.PoweredRail.class), + @Deprecated + LEGACY_DETECTOR_RAIL(28, org.bukkit.material.DetectorRail.class), + @Deprecated + LEGACY_PISTON_STICKY_BASE(29, org.bukkit.material.PistonBaseMaterial.class), + @Deprecated + LEGACY_WEB(30), + @Deprecated + LEGACY_LONG_GRASS(31, org.bukkit.material.LongGrass.class), + @Deprecated + LEGACY_DEAD_BUSH(32), + @Deprecated + LEGACY_PISTON_BASE(33, org.bukkit.material.PistonBaseMaterial.class), + @Deprecated + LEGACY_PISTON_EXTENSION(34, org.bukkit.material.PistonExtensionMaterial.class), + @Deprecated + LEGACY_WOOL(35, org.bukkit.material.Wool.class), + @Deprecated + LEGACY_PISTON_MOVING_PIECE(36), + @Deprecated + LEGACY_YELLOW_FLOWER(37), + @Deprecated + LEGACY_RED_ROSE(38), + @Deprecated + LEGACY_BROWN_MUSHROOM(39), + @Deprecated + LEGACY_RED_MUSHROOM(40), + @Deprecated + LEGACY_GOLD_BLOCK(41), + @Deprecated + LEGACY_IRON_BLOCK(42), + @Deprecated + LEGACY_DOUBLE_STEP(43, org.bukkit.material.Step.class), + @Deprecated + LEGACY_STEP(44, org.bukkit.material.Step.class), + @Deprecated + LEGACY_BRICK(45), + @Deprecated + LEGACY_TNT(46), + @Deprecated + LEGACY_BOOKSHELF(47), + @Deprecated + LEGACY_MOSSY_COBBLESTONE(48), + @Deprecated + LEGACY_OBSIDIAN(49), + @Deprecated + LEGACY_TORCH(50, org.bukkit.material.Torch.class), + @Deprecated + LEGACY_FIRE(51), + @Deprecated + LEGACY_MOB_SPAWNER(52), + @Deprecated + LEGACY_WOOD_STAIRS(53, org.bukkit.material.Stairs.class), + @Deprecated + LEGACY_CHEST(54, org.bukkit.material.Chest.class), + @Deprecated + LEGACY_REDSTONE_WIRE(55, org.bukkit.material.RedstoneWire.class), + @Deprecated + LEGACY_DIAMOND_ORE(56), + @Deprecated + LEGACY_DIAMOND_BLOCK(57), + @Deprecated + LEGACY_WORKBENCH(58), + @Deprecated + LEGACY_CROPS(59, org.bukkit.material.Crops.class), + @Deprecated + LEGACY_SOIL(60, org.bukkit.material.MaterialData.class), + @Deprecated + LEGACY_FURNACE(61, org.bukkit.material.Furnace.class), + @Deprecated + LEGACY_BURNING_FURNACE(62, org.bukkit.material.Furnace.class), + @Deprecated + LEGACY_SIGN_POST(63, 64, org.bukkit.material.Sign.class), + @Deprecated + LEGACY_WOODEN_DOOR(64, org.bukkit.material.Door.class), + @Deprecated + LEGACY_LADDER(65, org.bukkit.material.Ladder.class), + @Deprecated + LEGACY_RAILS(66, org.bukkit.material.Rails.class), + @Deprecated + LEGACY_COBBLESTONE_STAIRS(67, org.bukkit.material.Stairs.class), + @Deprecated + LEGACY_WALL_SIGN(68, 64, org.bukkit.material.Sign.class), + @Deprecated + LEGACY_LEVER(69, org.bukkit.material.Lever.class), + @Deprecated + LEGACY_STONE_PLATE(70, org.bukkit.material.PressurePlate.class), + @Deprecated + LEGACY_IRON_DOOR_BLOCK(71, org.bukkit.material.Door.class), + @Deprecated + LEGACY_WOOD_PLATE(72, org.bukkit.material.PressurePlate.class), + @Deprecated + LEGACY_REDSTONE_ORE(73), + @Deprecated + LEGACY_GLOWING_REDSTONE_ORE(74), + @Deprecated + LEGACY_REDSTONE_TORCH_OFF(75, org.bukkit.material.RedstoneTorch.class), + @Deprecated + LEGACY_REDSTONE_TORCH_ON(76, org.bukkit.material.RedstoneTorch.class), + @Deprecated + LEGACY_STONE_BUTTON(77, org.bukkit.material.Button.class), + @Deprecated + LEGACY_SNOW(78), + @Deprecated + LEGACY_ICE(79), + @Deprecated + LEGACY_SNOW_BLOCK(80), + @Deprecated + LEGACY_CACTUS(81, org.bukkit.material.MaterialData.class), + @Deprecated + LEGACY_CLAY(82), + @Deprecated + LEGACY_SUGAR_CANE_BLOCK(83, org.bukkit.material.MaterialData.class), + @Deprecated + LEGACY_JUKEBOX(84), + @Deprecated + LEGACY_FENCE(85), + @Deprecated + LEGACY_PUMPKIN(86, org.bukkit.material.Pumpkin.class), + @Deprecated + LEGACY_NETHERRACK(87), + @Deprecated + LEGACY_SOUL_SAND(88), + @Deprecated + LEGACY_GLOWSTONE(89), + @Deprecated + LEGACY_PORTAL(90), + @Deprecated + LEGACY_JACK_O_LANTERN(91, org.bukkit.material.Pumpkin.class), + @Deprecated + LEGACY_CAKE_BLOCK(92, 64, org.bukkit.material.Cake.class), + @Deprecated + LEGACY_DIODE_BLOCK_OFF(93, org.bukkit.material.Diode.class), + @Deprecated + LEGACY_DIODE_BLOCK_ON(94, org.bukkit.material.Diode.class), + @Deprecated + LEGACY_STAINED_GLASS(95), + @Deprecated + LEGACY_TRAP_DOOR(96, org.bukkit.material.TrapDoor.class), + @Deprecated + LEGACY_MONSTER_EGGS(97, org.bukkit.material.MonsterEggs.class), + @Deprecated + LEGACY_SMOOTH_BRICK(98, org.bukkit.material.SmoothBrick.class), + @Deprecated + LEGACY_HUGE_MUSHROOM_1(99, org.bukkit.material.Mushroom.class), + @Deprecated + LEGACY_HUGE_MUSHROOM_2(100, org.bukkit.material.Mushroom.class), + @Deprecated + LEGACY_IRON_FENCE(101), + @Deprecated + LEGACY_THIN_GLASS(102), + @Deprecated + LEGACY_MELON_BLOCK(103), + @Deprecated + LEGACY_PUMPKIN_STEM(104, org.bukkit.material.MaterialData.class), + @Deprecated + LEGACY_MELON_STEM(105, org.bukkit.material.MaterialData.class), + @Deprecated + LEGACY_VINE(106, org.bukkit.material.Vine.class), + @Deprecated + LEGACY_FENCE_GATE(107, org.bukkit.material.Gate.class), + @Deprecated + LEGACY_BRICK_STAIRS(108, org.bukkit.material.Stairs.class), + @Deprecated + LEGACY_SMOOTH_STAIRS(109, org.bukkit.material.Stairs.class), + @Deprecated + LEGACY_MYCEL(110), + @Deprecated + LEGACY_WATER_LILY(111), + @Deprecated + LEGACY_NETHER_BRICK(112), + @Deprecated + LEGACY_NETHER_FENCE(113), + @Deprecated + LEGACY_NETHER_BRICK_STAIRS(114, org.bukkit.material.Stairs.class), + @Deprecated + LEGACY_NETHER_WARTS(115, org.bukkit.material.NetherWarts.class), + @Deprecated + LEGACY_ENCHANTMENT_TABLE(116), + @Deprecated + LEGACY_BREWING_STAND(117, org.bukkit.material.MaterialData.class), + @Deprecated + LEGACY_CAULDRON(118, org.bukkit.material.Cauldron.class), + @Deprecated + LEGACY_ENDER_PORTAL(119), + @Deprecated + LEGACY_ENDER_PORTAL_FRAME(120), + @Deprecated + LEGACY_ENDER_STONE(121), + @Deprecated + LEGACY_DRAGON_EGG(122), + @Deprecated + LEGACY_REDSTONE_LAMP_OFF(123), + @Deprecated + LEGACY_REDSTONE_LAMP_ON(124), + @Deprecated + LEGACY_WOOD_DOUBLE_STEP(125, org.bukkit.material.Wood.class), + @Deprecated + LEGACY_WOOD_STEP(126, org.bukkit.material.WoodenStep.class), + @Deprecated + LEGACY_COCOA(127, org.bukkit.material.CocoaPlant.class), + @Deprecated + LEGACY_SANDSTONE_STAIRS(128, org.bukkit.material.Stairs.class), + @Deprecated + LEGACY_EMERALD_ORE(129), + @Deprecated + LEGACY_ENDER_CHEST(130, org.bukkit.material.EnderChest.class), + @Deprecated + LEGACY_TRIPWIRE_HOOK(131, org.bukkit.material.TripwireHook.class), + @Deprecated + LEGACY_TRIPWIRE(132, org.bukkit.material.Tripwire.class), + @Deprecated + LEGACY_EMERALD_BLOCK(133), + @Deprecated + LEGACY_SPRUCE_WOOD_STAIRS(134, org.bukkit.material.Stairs.class), + @Deprecated + LEGACY_BIRCH_WOOD_STAIRS(135, org.bukkit.material.Stairs.class), + @Deprecated + LEGACY_JUNGLE_WOOD_STAIRS(136, org.bukkit.material.Stairs.class), + @Deprecated + LEGACY_COMMAND(137, org.bukkit.material.Command.class), + @Deprecated + LEGACY_BEACON(138), + @Deprecated + LEGACY_COBBLE_WALL(139), + @Deprecated + LEGACY_FLOWER_POT(140, org.bukkit.material.FlowerPot.class), + @Deprecated + LEGACY_CARROT(141, org.bukkit.material.Crops.class), + @Deprecated + LEGACY_POTATO(142, org.bukkit.material.Crops.class), + @Deprecated + LEGACY_WOOD_BUTTON(143, org.bukkit.material.Button.class), + @Deprecated + LEGACY_SKULL(144, org.bukkit.material.Skull.class), + @Deprecated + LEGACY_ANVIL(145), + @Deprecated + LEGACY_TRAPPED_CHEST(146, org.bukkit.material.Chest.class), + @Deprecated + LEGACY_GOLD_PLATE(147), + @Deprecated + LEGACY_IRON_PLATE(148), + @Deprecated + LEGACY_REDSTONE_COMPARATOR_OFF(149, org.bukkit.material.Comparator.class), + @Deprecated + LEGACY_REDSTONE_COMPARATOR_ON(150, org.bukkit.material.Comparator.class), + @Deprecated + LEGACY_DAYLIGHT_DETECTOR(151), + @Deprecated + LEGACY_REDSTONE_BLOCK(152), + @Deprecated + LEGACY_QUARTZ_ORE(153), + @Deprecated + LEGACY_HOPPER(154, org.bukkit.material.Hopper.class), + @Deprecated + LEGACY_QUARTZ_BLOCK(155), + @Deprecated + LEGACY_QUARTZ_STAIRS(156, org.bukkit.material.Stairs.class), + @Deprecated + LEGACY_ACTIVATOR_RAIL(157, org.bukkit.material.PoweredRail.class), + @Deprecated + LEGACY_DROPPER(158, org.bukkit.material.Dispenser.class), + @Deprecated + LEGACY_STAINED_CLAY(159), + @Deprecated + LEGACY_STAINED_GLASS_PANE(160), + @Deprecated + LEGACY_LEAVES_2(161, org.bukkit.material.Leaves.class), + @Deprecated + LEGACY_LOG_2(162, org.bukkit.material.Tree.class), + @Deprecated + LEGACY_ACACIA_STAIRS(163, org.bukkit.material.Stairs.class), + @Deprecated + LEGACY_DARK_OAK_STAIRS(164, org.bukkit.material.Stairs.class), + @Deprecated + LEGACY_SLIME_BLOCK(165), + @Deprecated + LEGACY_BARRIER(166), + @Deprecated + LEGACY_IRON_TRAPDOOR(167, org.bukkit.material.TrapDoor.class), + @Deprecated + LEGACY_PRISMARINE(168), + @Deprecated + LEGACY_SEA_LANTERN(169), + @Deprecated + LEGACY_HAY_BLOCK(170), + @Deprecated + LEGACY_CARPET(171), + @Deprecated + LEGACY_HARD_CLAY(172), + @Deprecated + LEGACY_COAL_BLOCK(173), + @Deprecated + LEGACY_PACKED_ICE(174), + @Deprecated + LEGACY_DOUBLE_PLANT(175), + @Deprecated + LEGACY_STANDING_BANNER(176, org.bukkit.material.Banner.class), + @Deprecated + LEGACY_WALL_BANNER(177, org.bukkit.material.Banner.class), + @Deprecated + LEGACY_DAYLIGHT_DETECTOR_INVERTED(178), + @Deprecated + LEGACY_RED_SANDSTONE(179), + @Deprecated + LEGACY_RED_SANDSTONE_STAIRS(180, org.bukkit.material.Stairs.class), + @Deprecated + LEGACY_DOUBLE_STONE_SLAB2(181), + @Deprecated + LEGACY_STONE_SLAB2(182), + @Deprecated + LEGACY_SPRUCE_FENCE_GATE(183, org.bukkit.material.Gate.class), + @Deprecated + LEGACY_BIRCH_FENCE_GATE(184, org.bukkit.material.Gate.class), + @Deprecated + LEGACY_JUNGLE_FENCE_GATE(185, org.bukkit.material.Gate.class), + @Deprecated + LEGACY_DARK_OAK_FENCE_GATE(186, org.bukkit.material.Gate.class), + @Deprecated + LEGACY_ACACIA_FENCE_GATE(187, org.bukkit.material.Gate.class), + @Deprecated + LEGACY_SPRUCE_FENCE(188), + @Deprecated + LEGACY_BIRCH_FENCE(189), + @Deprecated + LEGACY_JUNGLE_FENCE(190), + @Deprecated + LEGACY_DARK_OAK_FENCE(191), + @Deprecated + LEGACY_ACACIA_FENCE(192), + @Deprecated + LEGACY_SPRUCE_DOOR(193, org.bukkit.material.Door.class), + @Deprecated + LEGACY_BIRCH_DOOR(194, org.bukkit.material.Door.class), + @Deprecated + LEGACY_JUNGLE_DOOR(195, org.bukkit.material.Door.class), + @Deprecated + LEGACY_ACACIA_DOOR(196, org.bukkit.material.Door.class), + @Deprecated + LEGACY_DARK_OAK_DOOR(197, org.bukkit.material.Door.class), + @Deprecated + LEGACY_END_ROD(198), + @Deprecated + LEGACY_CHORUS_PLANT(199), + @Deprecated + LEGACY_CHORUS_FLOWER(200), + @Deprecated + LEGACY_PURPUR_BLOCK(201), + @Deprecated + LEGACY_PURPUR_PILLAR(202), + @Deprecated + LEGACY_PURPUR_STAIRS(203, org.bukkit.material.Stairs.class), + @Deprecated + LEGACY_PURPUR_DOUBLE_SLAB(204), + @Deprecated + LEGACY_PURPUR_SLAB(205), + @Deprecated + LEGACY_END_BRICKS(206), + @Deprecated + LEGACY_BEETROOT_BLOCK(207, org.bukkit.material.Crops.class), + @Deprecated + LEGACY_GRASS_PATH(208), + @Deprecated + LEGACY_END_GATEWAY(209), + @Deprecated + LEGACY_COMMAND_REPEATING(210, org.bukkit.material.Command.class), + @Deprecated + LEGACY_COMMAND_CHAIN(211, org.bukkit.material.Command.class), + @Deprecated + LEGACY_FROSTED_ICE(212), + @Deprecated + LEGACY_MAGMA(213), + @Deprecated + LEGACY_NETHER_WART_BLOCK(214), + @Deprecated + LEGACY_RED_NETHER_BRICK(215), + @Deprecated + LEGACY_BONE_BLOCK(216), + @Deprecated + LEGACY_STRUCTURE_VOID(217), + @Deprecated + LEGACY_OBSERVER(218, org.bukkit.material.Observer.class), + @Deprecated + LEGACY_WHITE_SHULKER_BOX(219, 1), + @Deprecated + LEGACY_ORANGE_SHULKER_BOX(220, 1), + @Deprecated + LEGACY_MAGENTA_SHULKER_BOX(221, 1), + @Deprecated + LEGACY_LIGHT_BLUE_SHULKER_BOX(222, 1), + @Deprecated + LEGACY_YELLOW_SHULKER_BOX(223, 1), + @Deprecated + LEGACY_LIME_SHULKER_BOX(224, 1), + @Deprecated + LEGACY_PINK_SHULKER_BOX(225, 1), + @Deprecated + LEGACY_GRAY_SHULKER_BOX(226, 1), + @Deprecated + LEGACY_SILVER_SHULKER_BOX(227, 1), + @Deprecated + LEGACY_CYAN_SHULKER_BOX(228, 1), + @Deprecated + LEGACY_PURPLE_SHULKER_BOX(229, 1), + @Deprecated + LEGACY_BLUE_SHULKER_BOX(230, 1), + @Deprecated + LEGACY_BROWN_SHULKER_BOX(231, 1), + @Deprecated + LEGACY_GREEN_SHULKER_BOX(232, 1), + @Deprecated + LEGACY_RED_SHULKER_BOX(233, 1), + @Deprecated + LEGACY_BLACK_SHULKER_BOX(234, 1), + @Deprecated + LEGACY_WHITE_GLAZED_TERRACOTTA(235), + @Deprecated + LEGACY_ORANGE_GLAZED_TERRACOTTA(236), + @Deprecated + LEGACY_MAGENTA_GLAZED_TERRACOTTA(237), + @Deprecated + LEGACY_LIGHT_BLUE_GLAZED_TERRACOTTA(238), + @Deprecated + LEGACY_YELLOW_GLAZED_TERRACOTTA(239), + @Deprecated + LEGACY_LIME_GLAZED_TERRACOTTA(240), + @Deprecated + LEGACY_PINK_GLAZED_TERRACOTTA(241), + @Deprecated + LEGACY_GRAY_GLAZED_TERRACOTTA(242), + @Deprecated + LEGACY_SILVER_GLAZED_TERRACOTTA(243), + @Deprecated + LEGACY_CYAN_GLAZED_TERRACOTTA(244), + @Deprecated + LEGACY_PURPLE_GLAZED_TERRACOTTA(245), + @Deprecated + LEGACY_BLUE_GLAZED_TERRACOTTA(246), + @Deprecated + LEGACY_BROWN_GLAZED_TERRACOTTA(247), + @Deprecated + LEGACY_GREEN_GLAZED_TERRACOTTA(248), + @Deprecated + LEGACY_RED_GLAZED_TERRACOTTA(249), + @Deprecated + LEGACY_BLACK_GLAZED_TERRACOTTA(250), + @Deprecated + LEGACY_CONCRETE(251), + @Deprecated + LEGACY_CONCRETE_POWDER(252), + @Deprecated + LEGACY_STRUCTURE_BLOCK(255), // ----- Item Separator ----- - IRON_SPADE(256, 1, 250), - IRON_PICKAXE(257, 1, 250), - IRON_AXE(258, 1, 250), - FLINT_AND_STEEL(259, 1, 64), - APPLE(260), - BOW(261, 1, 384), - ARROW(262), - COAL(263, Coal.class), - DIAMOND(264), - IRON_INGOT(265), - GOLD_INGOT(266), - IRON_SWORD(267, 1, 250), - WOOD_SWORD(268, 1, 59), - WOOD_SPADE(269, 1, 59), - WOOD_PICKAXE(270, 1, 59), - WOOD_AXE(271, 1, 59), - STONE_SWORD(272, 1, 131), - STONE_SPADE(273, 1, 131), - STONE_PICKAXE(274, 1, 131), - STONE_AXE(275, 1, 131), - DIAMOND_SWORD(276, 1, 1561), - DIAMOND_SPADE(277, 1, 1561), - DIAMOND_PICKAXE(278, 1, 1561), - DIAMOND_AXE(279, 1, 1561), - STICK(280), - BOWL(281), - MUSHROOM_SOUP(282, 1), - GOLD_SWORD(283, 1, 32), - GOLD_SPADE(284, 1, 32), - GOLD_PICKAXE(285, 1, 32), - GOLD_AXE(286, 1, 32), - STRING(287), - FEATHER(288), - SULPHUR(289), - WOOD_HOE(290, 1, 59), - STONE_HOE(291, 1, 131), - IRON_HOE(292, 1, 250), - DIAMOND_HOE(293, 1, 1561), - GOLD_HOE(294, 1, 32), - SEEDS(295), - WHEAT(296), - BREAD(297), - LEATHER_HELMET(298, 1, 55), - LEATHER_CHESTPLATE(299, 1, 80), - LEATHER_LEGGINGS(300, 1, 75), - LEATHER_BOOTS(301, 1, 65), - CHAINMAIL_HELMET(302, 1, 165), - CHAINMAIL_CHESTPLATE(303, 1, 240), - CHAINMAIL_LEGGINGS(304, 1, 225), - CHAINMAIL_BOOTS(305, 1, 195), - IRON_HELMET(306, 1, 165), - IRON_CHESTPLATE(307, 1, 240), - IRON_LEGGINGS(308, 1, 225), - IRON_BOOTS(309, 1, 195), - DIAMOND_HELMET(310, 1, 363), - DIAMOND_CHESTPLATE(311, 1, 528), - DIAMOND_LEGGINGS(312, 1, 495), - DIAMOND_BOOTS(313, 1, 429), - GOLD_HELMET(314, 1, 77), - GOLD_CHESTPLATE(315, 1, 112), - GOLD_LEGGINGS(316, 1, 105), - GOLD_BOOTS(317, 1, 91), - FLINT(318), - PORK(319), - GRILLED_PORK(320), - PAINTING(321), - GOLDEN_APPLE(322), - SIGN(323, 16), - WOOD_DOOR(324, 64), - BUCKET(325, 16), - WATER_BUCKET(326, 1), - LAVA_BUCKET(327, 1), - MINECART(328, 1), - SADDLE(329, 1), - IRON_DOOR(330, 64), - REDSTONE(331), - SNOW_BALL(332, 16), - BOAT(333, 1), - LEATHER(334), - MILK_BUCKET(335, 1), - CLAY_BRICK(336), - CLAY_BALL(337), - SUGAR_CANE(338), - PAPER(339), - BOOK(340), - SLIME_BALL(341), - STORAGE_MINECART(342, 1), - POWERED_MINECART(343, 1), - EGG(344, 16), - COMPASS(345), - FISHING_ROD(346, 1, 64), - WATCH(347), - GLOWSTONE_DUST(348), - RAW_FISH(349), - COOKED_FISH(350), - INK_SACK(351, Dye.class), - BONE(352), - SUGAR(353), - CAKE(354, 1), - BED(355, 1), - DIODE(356), - COOKIE(357), + @Deprecated + LEGACY_IRON_SPADE(256, 1, 250), + @Deprecated + LEGACY_IRON_PICKAXE(257, 1, 250), + @Deprecated + LEGACY_IRON_AXE(258, 1, 250), + @Deprecated + LEGACY_FLINT_AND_STEEL(259, 1, 64), + @Deprecated + LEGACY_APPLE(260), + @Deprecated + LEGACY_BOW(261, 1, 384), + @Deprecated + LEGACY_ARROW(262), + @Deprecated + LEGACY_COAL(263, org.bukkit.material.Coal.class), + @Deprecated + LEGACY_DIAMOND(264), + @Deprecated + LEGACY_IRON_INGOT(265), + @Deprecated + LEGACY_GOLD_INGOT(266), + @Deprecated + LEGACY_IRON_SWORD(267, 1, 250), + @Deprecated + LEGACY_WOOD_SWORD(268, 1, 59), + @Deprecated + LEGACY_WOOD_SPADE(269, 1, 59), + @Deprecated + LEGACY_WOOD_PICKAXE(270, 1, 59), + @Deprecated + LEGACY_WOOD_AXE(271, 1, 59), + @Deprecated + LEGACY_STONE_SWORD(272, 1, 131), + @Deprecated + LEGACY_STONE_SPADE(273, 1, 131), + @Deprecated + LEGACY_STONE_PICKAXE(274, 1, 131), + @Deprecated + LEGACY_STONE_AXE(275, 1, 131), + @Deprecated + LEGACY_DIAMOND_SWORD(276, 1, 1561), + @Deprecated + LEGACY_DIAMOND_SPADE(277, 1, 1561), + @Deprecated + LEGACY_DIAMOND_PICKAXE(278, 1, 1561), + @Deprecated + LEGACY_DIAMOND_AXE(279, 1, 1561), + @Deprecated + LEGACY_STICK(280), + @Deprecated + LEGACY_BOWL(281), + @Deprecated + LEGACY_MUSHROOM_SOUP(282, 1), + @Deprecated + LEGACY_GOLD_SWORD(283, 1, 32), + @Deprecated + LEGACY_GOLD_SPADE(284, 1, 32), + @Deprecated + LEGACY_GOLD_PICKAXE(285, 1, 32), + @Deprecated + LEGACY_GOLD_AXE(286, 1, 32), + @Deprecated + LEGACY_STRING(287), + @Deprecated + LEGACY_FEATHER(288), + @Deprecated + LEGACY_SULPHUR(289), + @Deprecated + LEGACY_WOOD_HOE(290, 1, 59), + @Deprecated + LEGACY_STONE_HOE(291, 1, 131), + @Deprecated + LEGACY_IRON_HOE(292, 1, 250), + @Deprecated + LEGACY_DIAMOND_HOE(293, 1, 1561), + @Deprecated + LEGACY_GOLD_HOE(294, 1, 32), + @Deprecated + LEGACY_SEEDS(295), + @Deprecated + LEGACY_WHEAT(296), + @Deprecated + LEGACY_BREAD(297), + @Deprecated + LEGACY_LEATHER_HELMET(298, 1, 55), + @Deprecated + LEGACY_LEATHER_CHESTPLATE(299, 1, 80), + @Deprecated + LEGACY_LEATHER_LEGGINGS(300, 1, 75), + @Deprecated + LEGACY_LEATHER_BOOTS(301, 1, 65), + @Deprecated + LEGACY_CHAINMAIL_HELMET(302, 1, 165), + @Deprecated + LEGACY_CHAINMAIL_CHESTPLATE(303, 1, 240), + @Deprecated + LEGACY_CHAINMAIL_LEGGINGS(304, 1, 225), + @Deprecated + LEGACY_CHAINMAIL_BOOTS(305, 1, 195), + @Deprecated + LEGACY_IRON_HELMET(306, 1, 165), + @Deprecated + LEGACY_IRON_CHESTPLATE(307, 1, 240), + @Deprecated + LEGACY_IRON_LEGGINGS(308, 1, 225), + @Deprecated + LEGACY_IRON_BOOTS(309, 1, 195), + @Deprecated + LEGACY_DIAMOND_HELMET(310, 1, 363), + @Deprecated + LEGACY_DIAMOND_CHESTPLATE(311, 1, 528), + @Deprecated + LEGACY_DIAMOND_LEGGINGS(312, 1, 495), + @Deprecated + LEGACY_DIAMOND_BOOTS(313, 1, 429), + @Deprecated + LEGACY_GOLD_HELMET(314, 1, 77), + @Deprecated + LEGACY_GOLD_CHESTPLATE(315, 1, 112), + @Deprecated + LEGACY_GOLD_LEGGINGS(316, 1, 105), + @Deprecated + LEGACY_GOLD_BOOTS(317, 1, 91), + @Deprecated + LEGACY_FLINT(318), + @Deprecated + LEGACY_PORK(319), + @Deprecated + LEGACY_GRILLED_PORK(320), + @Deprecated + LEGACY_PAINTING(321), + @Deprecated + LEGACY_GOLDEN_APPLE(322), + @Deprecated + LEGACY_SIGN(323, 16), + @Deprecated + LEGACY_WOOD_DOOR(324, 64), + @Deprecated + LEGACY_BUCKET(325, 16), + @Deprecated + LEGACY_WATER_BUCKET(326, 1), + @Deprecated + LEGACY_LAVA_BUCKET(327, 1), + @Deprecated + LEGACY_MINECART(328, 1), + @Deprecated + LEGACY_SADDLE(329, 1), + @Deprecated + LEGACY_IRON_DOOR(330, 64), + @Deprecated + LEGACY_REDSTONE(331), + @Deprecated + LEGACY_SNOW_BALL(332, 16), + @Deprecated + LEGACY_BOAT(333, 1), + @Deprecated + LEGACY_LEATHER(334), + @Deprecated + LEGACY_MILK_BUCKET(335, 1), + @Deprecated + LEGACY_CLAY_BRICK(336), + @Deprecated + LEGACY_CLAY_BALL(337), + @Deprecated + LEGACY_SUGAR_CANE(338), + @Deprecated + LEGACY_PAPER(339), + @Deprecated + LEGACY_BOOK(340), + @Deprecated + LEGACY_SLIME_BALL(341), + @Deprecated + LEGACY_STORAGE_MINECART(342, 1), + @Deprecated + LEGACY_POWERED_MINECART(343, 1), + @Deprecated + LEGACY_EGG(344, 16), + @Deprecated + LEGACY_COMPASS(345), + @Deprecated + LEGACY_FISHING_ROD(346, 1, 64), + @Deprecated + LEGACY_WATCH(347), + @Deprecated + LEGACY_GLOWSTONE_DUST(348), + @Deprecated + LEGACY_RAW_FISH(349), + @Deprecated + LEGACY_COOKED_FISH(350), + @Deprecated + LEGACY_INK_SACK(351, org.bukkit.material.Dye.class), + @Deprecated + LEGACY_BONE(352), + @Deprecated + LEGACY_SUGAR(353), + @Deprecated + LEGACY_CAKE(354, 1), + @Deprecated + LEGACY_BED(355, 1), + @Deprecated + LEGACY_DIODE(356), + @Deprecated + LEGACY_COOKIE(357), /** - * @see MapView + * @see org.bukkit.map.MapView */ - MAP(358, MaterialData.class), - SHEARS(359, 1, 238), - MELON(360), - PUMPKIN_SEEDS(361), - MELON_SEEDS(362), - RAW_BEEF(363), - COOKED_BEEF(364), - RAW_CHICKEN(365), - COOKED_CHICKEN(366), - ROTTEN_FLESH(367), - ENDER_PEARL(368, 16), - BLAZE_ROD(369), - GHAST_TEAR(370), - GOLD_NUGGET(371), - NETHER_STALK(372), - POTION(373, 1, MaterialData.class), - GLASS_BOTTLE(374), - SPIDER_EYE(375), - FERMENTED_SPIDER_EYE(376), - BLAZE_POWDER(377), - MAGMA_CREAM(378), - BREWING_STAND_ITEM(379), - CAULDRON_ITEM(380), - EYE_OF_ENDER(381), - SPECKLED_MELON(382), - MONSTER_EGG(383, 64, SpawnEgg.class), - EXP_BOTTLE(384, 64), - FIREBALL(385, 64), - BOOK_AND_QUILL(386, 1), - WRITTEN_BOOK(387, 16), - EMERALD(388, 64), - ITEM_FRAME(389), - FLOWER_POT_ITEM(390), - CARROT_ITEM(391), - POTATO_ITEM(392), - BAKED_POTATO(393), - POISONOUS_POTATO(394), - EMPTY_MAP(395), - GOLDEN_CARROT(396), - SKULL_ITEM(397), - CARROT_STICK(398, 1, 25), - NETHER_STAR(399), - PUMPKIN_PIE(400), - FIREWORK(401), - FIREWORK_CHARGE(402), - ENCHANTED_BOOK(403, 1), - REDSTONE_COMPARATOR(404), - NETHER_BRICK_ITEM(405), - QUARTZ(406), - EXPLOSIVE_MINECART(407, 1), - HOPPER_MINECART(408, 1), - PRISMARINE_SHARD(409), - PRISMARINE_CRYSTALS(410), - RABBIT(411), - COOKED_RABBIT(412), - RABBIT_STEW(413, 1), - RABBIT_FOOT(414), - RABBIT_HIDE(415), - ARMOR_STAND(416, 16), - IRON_BARDING(417, 1), - GOLD_BARDING(418, 1), - DIAMOND_BARDING(419, 1), - LEASH(420), - NAME_TAG(421), - COMMAND_MINECART(422, 1), - MUTTON(423), - COOKED_MUTTON(424), - BANNER(425, 16), - END_CRYSTAL(426), - SPRUCE_DOOR_ITEM(427), - BIRCH_DOOR_ITEM(428), - JUNGLE_DOOR_ITEM(429), - ACACIA_DOOR_ITEM(430), - DARK_OAK_DOOR_ITEM(431), - CHORUS_FRUIT(432), - CHORUS_FRUIT_POPPED(433), - BEETROOT(434), - BEETROOT_SEEDS(435), - BEETROOT_SOUP(436, 1), - DRAGONS_BREATH(437), - SPLASH_POTION(438, 1), - SPECTRAL_ARROW(439), - TIPPED_ARROW(440), - LINGERING_POTION(441, 1), - SHIELD(442, 1, 336), - ELYTRA(443, 1, 431), - BOAT_SPRUCE(444, 1), - BOAT_BIRCH(445, 1), - BOAT_JUNGLE(446, 1), - BOAT_ACACIA(447, 1), - BOAT_DARK_OAK(448, 1), - TOTEM(449, 1), - SHULKER_SHELL(450), - IRON_NUGGET(452), - KNOWLEDGE_BOOK(453, 1), - GOLD_RECORD(2256, 1), - GREEN_RECORD(2257, 1), - RECORD_3(2258, 1), - RECORD_4(2259, 1), - RECORD_5(2260, 1), - RECORD_6(2261, 1), - RECORD_7(2262, 1), - RECORD_8(2263, 1), - RECORD_9(2264, 1), - RECORD_10(2265, 1), - RECORD_11(2266, 1), - RECORD_12(2267, 1), + @Deprecated + LEGACY_MAP(358, org.bukkit.material.MaterialData.class), + @Deprecated + LEGACY_SHEARS(359, 1, 238), + @Deprecated + LEGACY_MELON(360), + @Deprecated + LEGACY_PUMPKIN_SEEDS(361), + @Deprecated + LEGACY_MELON_SEEDS(362), + @Deprecated + LEGACY_RAW_BEEF(363), + @Deprecated + LEGACY_COOKED_BEEF(364), + @Deprecated + LEGACY_RAW_CHICKEN(365), + @Deprecated + LEGACY_COOKED_CHICKEN(366), + @Deprecated + LEGACY_ROTTEN_FLESH(367), + @Deprecated + LEGACY_ENDER_PEARL(368, 16), + @Deprecated + LEGACY_BLAZE_ROD(369), + @Deprecated + LEGACY_GHAST_TEAR(370), + @Deprecated + LEGACY_GOLD_NUGGET(371), + @Deprecated + LEGACY_NETHER_STALK(372), + @Deprecated + LEGACY_POTION(373, 1, org.bukkit.material.MaterialData.class), + @Deprecated + LEGACY_GLASS_BOTTLE(374), + @Deprecated + LEGACY_SPIDER_EYE(375), + @Deprecated + LEGACY_FERMENTED_SPIDER_EYE(376), + @Deprecated + LEGACY_BLAZE_POWDER(377), + @Deprecated + LEGACY_MAGMA_CREAM(378), + @Deprecated + LEGACY_BREWING_STAND_ITEM(379), + @Deprecated + LEGACY_CAULDRON_ITEM(380), + @Deprecated + LEGACY_EYE_OF_ENDER(381), + @Deprecated + LEGACY_SPECKLED_MELON(382), + @Deprecated + LEGACY_MONSTER_EGG(383, 64, org.bukkit.material.SpawnEgg.class), + @Deprecated + LEGACY_EXP_BOTTLE(384, 64), + @Deprecated + LEGACY_FIREBALL(385, 64), + @Deprecated + LEGACY_BOOK_AND_QUILL(386, 1), + @Deprecated + LEGACY_WRITTEN_BOOK(387, 16), + @Deprecated + LEGACY_EMERALD(388, 64), + @Deprecated + LEGACY_ITEM_FRAME(389), + @Deprecated + LEGACY_FLOWER_POT_ITEM(390), + @Deprecated + LEGACY_CARROT_ITEM(391), + @Deprecated + LEGACY_POTATO_ITEM(392), + @Deprecated + LEGACY_BAKED_POTATO(393), + @Deprecated + LEGACY_POISONOUS_POTATO(394), + @Deprecated + LEGACY_EMPTY_MAP(395), + @Deprecated + LEGACY_GOLDEN_CARROT(396), + @Deprecated + LEGACY_SKULL_ITEM(397), + @Deprecated + LEGACY_CARROT_STICK(398, 1, 25), + @Deprecated + LEGACY_NETHER_STAR(399), + @Deprecated + LEGACY_PUMPKIN_PIE(400), + @Deprecated + LEGACY_FIREWORK(401), + @Deprecated + LEGACY_FIREWORK_CHARGE(402), + @Deprecated + LEGACY_ENCHANTED_BOOK(403, 1), + @Deprecated + LEGACY_REDSTONE_COMPARATOR(404), + @Deprecated + LEGACY_NETHER_BRICK_ITEM(405), + @Deprecated + LEGACY_QUARTZ(406), + @Deprecated + LEGACY_EXPLOSIVE_MINECART(407, 1), + @Deprecated + LEGACY_HOPPER_MINECART(408, 1), + @Deprecated + LEGACY_PRISMARINE_SHARD(409), + @Deprecated + LEGACY_PRISMARINE_CRYSTALS(410), + @Deprecated + LEGACY_RABBIT(411), + @Deprecated + LEGACY_COOKED_RABBIT(412), + @Deprecated + LEGACY_RABBIT_STEW(413, 1), + @Deprecated + LEGACY_RABBIT_FOOT(414), + @Deprecated + LEGACY_RABBIT_HIDE(415), + @Deprecated + LEGACY_ARMOR_STAND(416, 16), + @Deprecated + LEGACY_IRON_BARDING(417, 1), + @Deprecated + LEGACY_GOLD_BARDING(418, 1), + @Deprecated + LEGACY_DIAMOND_BARDING(419, 1), + @Deprecated + LEGACY_LEASH(420), + @Deprecated + LEGACY_NAME_TAG(421), + @Deprecated + LEGACY_COMMAND_MINECART(422, 1), + @Deprecated + LEGACY_MUTTON(423), + @Deprecated + LEGACY_COOKED_MUTTON(424), + @Deprecated + LEGACY_BANNER(425, 16), + @Deprecated + LEGACY_END_CRYSTAL(426), + @Deprecated + LEGACY_SPRUCE_DOOR_ITEM(427), + @Deprecated + LEGACY_BIRCH_DOOR_ITEM(428), + @Deprecated + LEGACY_JUNGLE_DOOR_ITEM(429), + @Deprecated + LEGACY_ACACIA_DOOR_ITEM(430), + @Deprecated + LEGACY_DARK_OAK_DOOR_ITEM(431), + @Deprecated + LEGACY_CHORUS_FRUIT(432), + @Deprecated + LEGACY_CHORUS_FRUIT_POPPED(433), + @Deprecated + LEGACY_BEETROOT(434), + @Deprecated + LEGACY_BEETROOT_SEEDS(435), + @Deprecated + LEGACY_BEETROOT_SOUP(436, 1), + @Deprecated + LEGACY_DRAGONS_BREATH(437), + @Deprecated + LEGACY_SPLASH_POTION(438, 1), + @Deprecated + LEGACY_SPECTRAL_ARROW(439), + @Deprecated + LEGACY_TIPPED_ARROW(440), + @Deprecated + LEGACY_LINGERING_POTION(441, 1), + @Deprecated + LEGACY_SHIELD(442, 1, 336), + @Deprecated + LEGACY_ELYTRA(443, 1, 431), + @Deprecated + LEGACY_BOAT_SPRUCE(444, 1), + @Deprecated + LEGACY_BOAT_BIRCH(445, 1), + @Deprecated + LEGACY_BOAT_JUNGLE(446, 1), + @Deprecated + LEGACY_BOAT_ACACIA(447, 1), + @Deprecated + LEGACY_BOAT_DARK_OAK(448, 1), + @Deprecated + LEGACY_TOTEM(449, 1), + @Deprecated + LEGACY_SHULKER_SHELL(450), + @Deprecated + LEGACY_IRON_NUGGET(452), + @Deprecated + LEGACY_KNOWLEDGE_BOOK(453, 1), + @Deprecated + LEGACY_GOLD_RECORD(2256, 1), + @Deprecated + LEGACY_GREEN_RECORD(2257, 1), + @Deprecated + LEGACY_RECORD_3(2258, 1), + @Deprecated + LEGACY_RECORD_4(2259, 1), + @Deprecated + LEGACY_RECORD_5(2260, 1), + @Deprecated + LEGACY_RECORD_6(2261, 1), + @Deprecated + LEGACY_RECORD_7(2262, 1), + @Deprecated + LEGACY_RECORD_8(2263, 1), + @Deprecated + LEGACY_RECORD_9(2264, 1), + @Deprecated + LEGACY_RECORD_10(2265, 1), + @Deprecated + LEGACY_RECORD_11(2266, 1), + @Deprecated + LEGACY_RECORD_12(2267, 1), ; + //</editor-fold> + + @Deprecated + public static final String LEGACY_PREFIX = "LEGACY_"; private final int id; private final Constructor<? extends MaterialData> ctor; - private static Material[] byId = new Material[383]; private final static Map<String, Material> BY_NAME = Maps.newHashMap(); private final int maxStack; private final short durability; + public final Class<?> data; + private final boolean legacy; + private final NamespacedKey key; private Material(final int id) { this(id, 64); @@ -557,21 +1879,28 @@ public enum Material { this(id, stack, durability, MaterialData.class); } - private Material(final int id, final Class<? extends MaterialData> data) { + private Material(final int id, final Class<?> data) { this(id, 64, data); } - private Material(final int id, final int stack, final Class<? extends MaterialData> data) { + private Material(final int id, final int stack, final Class<?> data) { this(id, stack, 0, data); } - private Material(final int id, final int stack, final int durability, final Class<? extends MaterialData> data) { + private Material(final int id, final int stack, final int durability, final Class<?> data) { this.id = id; this.durability = (short) durability; this.maxStack = stack; + this.data = data; + this.legacy = this.name().startsWith(LEGACY_PREFIX); + this.key = NamespacedKey.minecraft(this.name().toLowerCase(Locale.ROOT)); // try to cache the constructor for this material try { - this.ctor = data.getConstructor(int.class, byte.class); + if (MaterialData.class.isAssignableFrom(data)) { + this.ctor = (Constructor<? extends MaterialData>) data.getConstructor(Material.class, byte.class); + } else { + this.ctor = null; + } } catch (NoSuchMethodException ex) { throw new AssertionError(ex); } catch (SecurityException ex) { @@ -580,7 +1909,7 @@ public enum Material { } /** - * Gets the item ID or block ID of this Material + * Do not use for any reason. * * @return ID of this material * @deprecated Magic value @@ -591,6 +1920,22 @@ public enum Material { } /** + * Do not use for any reason. + * + * @return legacy status + */ + @Deprecated + public boolean isLegacy() { + return legacy; + } + + @Override + public NamespacedKey getKey() { + Validate.isTrue(!legacy, "Cannot get key of Legacy Material"); + return key; + } + + /** * Gets the maximum amount of this material that can be held in a stack * * @return Maximum stack size for this material @@ -609,11 +1954,45 @@ public enum Material { } /** + * Creates a new {@link BlockData} instance for this Material, with all + * properties initialized to unspecified defaults. + * + * @return new data instance + */ + public BlockData createBlockData() { + return Bukkit.createBlockData(this); + } + + /** + * Creates a new {@link BlockData} instance for the specified Material, with + * all properties initialized to unspecified defaults. + * + * @param consumer consumer to run on new instance before returning + * @return new data instance + */ + public BlockData createBlockData(Consumer<BlockData> consumer) { + return Bukkit.createBlockData(this, consumer); + } + + /** + * Creates a new {@link BlockData} instance with material and properties + * parsed from provided data. + * + * @param data data string + * @return new data instance + * @throws IllegalArgumentException if the specified data is not valid + */ + public BlockData createBlockData(String data) throws IllegalArgumentException { + return Bukkit.createBlockData(data); + } + + /** * Gets the MaterialData class associated with this Material * * @return MaterialData associated with this Material */ public Class<? extends MaterialData> getData() { + Validate.isTrue(legacy, "Cannot get data class of Modern Material"); return ctor.getDeclaringClass(); } @@ -627,8 +2006,9 @@ public enum Material { */ @Deprecated public MaterialData getNewData(final byte raw) { + Validate.isTrue(legacy, "Cannot get new data of Modern Material"); try { - return ctor.newInstance(id, raw); + return ctor.newInstance(this, raw); } catch (InstantiationException ex) { final Throwable t = ex.getCause(); if (t instanceof RuntimeException) { @@ -649,7 +2029,591 @@ public enum Material { * @return true if this material is a block */ public boolean isBlock() { - return id < 256; + switch (this) { + //<editor-fold defaultstate="collapsed" desc="isBlock"> + case ACACIA_WOOD: + case ACACIA_BUTTON: + case ACACIA_DOOR: + case ACACIA_FENCE: + case ACACIA_FENCE_GATE: + case ACACIA_LEAVES: + case ACACIA_LOG: + case ACACIA_PLANKS: + case ACACIA_PRESSURE_PLATE: + case ACACIA_SAPLING: + case ACACIA_SLAB: + case ACACIA_STAIRS: + case ACACIA_TRAPDOOR: + case ACTIVATOR_RAIL: + case AIR: + case ALLIUM: + case ANDESITE: + case ANVIL: + case ATTACHED_MELON_STEM: + case ATTACHED_PUMPKIN_STEM: + case AZURE_BLUET: + case BARRIER: + case BEACON: + case BEDROCK: + case BEETROOTS: + case BIRCH_WOOD: + case BIRCH_BUTTON: + case BIRCH_DOOR: + case BIRCH_FENCE: + case BIRCH_FENCE_GATE: + case BIRCH_LEAVES: + case BIRCH_LOG: + case BIRCH_PLANKS: + case BIRCH_PRESSURE_PLATE: + case BIRCH_SAPLING: + case BIRCH_SLAB: + case BIRCH_STAIRS: + case BIRCH_TRAPDOOR: + case BLACK_BANNER: + case BLACK_BED: + case BLACK_CARPET: + case BLACK_CONCRETE: + case BLACK_CONCRETE_POWDER: + case BLACK_GLAZED_TERRACOTTA: + case BLACK_SHULKER_BOX: + case BLACK_STAINED_GLASS: + case BLACK_STAINED_GLASS_PANE: + case BLACK_TERRACOTTA: + case BLACK_WALL_BANNER: + case BLACK_WOOL: + case BLUE_BANNER: + case BLUE_BED: + case BLUE_CARPET: + case BLUE_CONCRETE: + case BLUE_CONCRETE_POWDER: + case BLUE_GLAZED_TERRACOTTA: + case BLUE_ICE: + case BLUE_ORCHID: + case BLUE_SHULKER_BOX: + case BLUE_STAINED_GLASS: + case BLUE_STAINED_GLASS_PANE: + case BLUE_TERRACOTTA: + case BLUE_WALL_BANNER: + case BLUE_WOOL: + case BONE_BLOCK: + case BOOKSHELF: + case BRAIN_CORAL: + case BRAIN_CORAL_BLOCK: + case BRAIN_CORAL_FAN: + case BREWING_STAND: + case BRICKS: + case BRICK_SLAB: + case BRICK_STAIRS: + case BROWN_BANNER: + case BROWN_BED: + case BROWN_CARPET: + case BROWN_CONCRETE: + case BROWN_CONCRETE_POWDER: + case BROWN_GLAZED_TERRACOTTA: + case BROWN_MUSHROOM: + case BROWN_MUSHROOM_BLOCK: + case BROWN_SHULKER_BOX: + case BROWN_STAINED_GLASS: + case BROWN_STAINED_GLASS_PANE: + case BROWN_TERRACOTTA: + case BROWN_WALL_BANNER: + case BROWN_WOOL: + case BUBBLE_COLUMN: + case BUBBLE_CORAL: + case BUBBLE_CORAL_BLOCK: + case BUBBLE_CORAL_FAN: + case CACTUS: + case CAKE: + case CARROTS: + case CARVED_PUMPKIN: + case CAULDRON: + case CAVE_AIR: + case CHAIN_COMMAND_BLOCK: + case CHEST: + case CHIPPED_ANVIL: + case CHISELED_QUARTZ_BLOCK: + case CHISELED_RED_SANDSTONE: + case CHISELED_SANDSTONE: + case CHISELED_STONE_BRICKS: + case CHORUS_FLOWER: + case CHORUS_PLANT: + case CLAY: + case COAL_BLOCK: + case COAL_ORE: + case COARSE_DIRT: + case COBBLESTONE: + case COBBLESTONE_SLAB: + case COBBLESTONE_STAIRS: + case COBBLESTONE_WALL: + case COBWEB: + case COCOA: + case COMMAND_BLOCK: + case COMPARATOR: + case CONDUIT: + case CRACKED_STONE_BRICKS: + case CRAFTING_TABLE: + case CREEPER_HEAD: + case CREEPER_WALL_HEAD: + case CUT_RED_SANDSTONE: + case CUT_SANDSTONE: + case CYAN_BANNER: + case CYAN_BED: + case CYAN_CARPET: + case CYAN_CONCRETE: + case CYAN_CONCRETE_POWDER: + case CYAN_GLAZED_TERRACOTTA: + case CYAN_SHULKER_BOX: + case CYAN_STAINED_GLASS: + case CYAN_STAINED_GLASS_PANE: + case CYAN_TERRACOTTA: + case CYAN_WALL_BANNER: + case CYAN_WOOL: + case DAMAGED_ANVIL: + case DANDELION: + case DARK_OAK_WOOD: + case DARK_OAK_BUTTON: + case DARK_OAK_DOOR: + case DARK_OAK_FENCE: + case DARK_OAK_FENCE_GATE: + case DARK_OAK_LEAVES: + case DARK_OAK_LOG: + case DARK_OAK_PLANKS: + case DARK_OAK_PRESSURE_PLATE: + case DARK_OAK_SAPLING: + case DARK_OAK_SLAB: + case DARK_OAK_STAIRS: + case DARK_OAK_TRAPDOOR: + case DARK_PRISMARINE: + case DARK_PRISMARINE_SLAB: + case DARK_PRISMARINE_STAIRS: + case DAYLIGHT_DETECTOR: + case DEAD_BRAIN_CORAL_BLOCK: + case DEAD_BUBBLE_CORAL_BLOCK: + case DEAD_BUSH: + case DEAD_FIRE_CORAL_BLOCK: + case DEAD_HORN_CORAL_BLOCK: + case DEAD_TUBE_CORAL_BLOCK: + case DETECTOR_RAIL: + case DIAMOND_BLOCK: + case DIAMOND_ORE: + case DIORITE: + case DIRT: + case DISPENSER: + case DRAGON_EGG: + case DRAGON_HEAD: + case DRAGON_WALL_HEAD: + case DRIED_KELP_BLOCK: + case DROPPER: + case EMERALD_BLOCK: + case EMERALD_ORE: + case ENCHANTING_TABLE: + case ENDER_CHEST: + case END_GATEWAY: + case END_PORTAL: + case END_PORTAL_FRAME: + case END_ROD: + case END_STONE: + case END_STONE_BRICKS: + case FARMLAND: + case FERN: + case FIRE: + case FIRE_CORAL: + case FIRE_CORAL_BLOCK: + case FIRE_CORAL_FAN: + case FLOWER_POT: + case FROSTED_ICE: + case FURNACE: + case GLASS: + case GLASS_PANE: + case GLOWSTONE: + case GOLD_BLOCK: + case GOLD_ORE: + case GRANITE: + case GRASS: + case GRASS_BLOCK: + case GRASS_PATH: + case GRAVEL: + case GRAY_BANNER: + case GRAY_BED: + case GRAY_CARPET: + case GRAY_CONCRETE: + case GRAY_CONCRETE_POWDER: + case GRAY_GLAZED_TERRACOTTA: + case GRAY_SHULKER_BOX: + case GRAY_STAINED_GLASS: + case GRAY_STAINED_GLASS_PANE: + case GRAY_TERRACOTTA: + case GRAY_WALL_BANNER: + case GRAY_WOOL: + case GREEN_BANNER: + case GREEN_BED: + case GREEN_CARPET: + case GREEN_CONCRETE: + case GREEN_CONCRETE_POWDER: + case GREEN_GLAZED_TERRACOTTA: + case GREEN_SHULKER_BOX: + case GREEN_STAINED_GLASS: + case GREEN_STAINED_GLASS_PANE: + case GREEN_TERRACOTTA: + case GREEN_WALL_BANNER: + case GREEN_WOOL: + case HAY_BLOCK: + case HEAVY_WEIGHTED_PRESSURE_PLATE: + case HOPPER: + case HORN_CORAL: + case HORN_CORAL_BLOCK: + case HORN_CORAL_FAN: + case ICE: + case INFESTED_CHISELED_STONE_BRICKS: + case INFESTED_COBBLESTONE: + case INFESTED_CRACKED_STONE_BRICKS: + case INFESTED_MOSSY_STONE_BRICKS: + case INFESTED_STONE: + case INFESTED_STONE_BRICKS: + case IRON_BARS: + case IRON_BLOCK: + case IRON_DOOR: + case IRON_ORE: + case IRON_TRAPDOOR: + case JACK_O_LANTERN: + case JUKEBOX: + case JUNGLE_WOOD: + case JUNGLE_BUTTON: + case JUNGLE_DOOR: + case JUNGLE_FENCE: + case JUNGLE_FENCE_GATE: + case JUNGLE_LEAVES: + case JUNGLE_LOG: + case JUNGLE_PLANKS: + case JUNGLE_PRESSURE_PLATE: + case JUNGLE_SAPLING: + case JUNGLE_SLAB: + case JUNGLE_STAIRS: + case JUNGLE_TRAPDOOR: + case KELP: + case KELP_PLANT: + case LADDER: + case LAPIS_BLOCK: + case LAPIS_ORE: + case LARGE_FERN: + case LAVA: + case LEVER: + case LIGHT_BLUE_BANNER: + case LIGHT_BLUE_BED: + case LIGHT_BLUE_CARPET: + case LIGHT_BLUE_CONCRETE: + case LIGHT_BLUE_CONCRETE_POWDER: + case LIGHT_BLUE_GLAZED_TERRACOTTA: + case LIGHT_BLUE_SHULKER_BOX: + case LIGHT_BLUE_STAINED_GLASS: + case LIGHT_BLUE_STAINED_GLASS_PANE: + case LIGHT_BLUE_TERRACOTTA: + case LIGHT_BLUE_WALL_BANNER: + case LIGHT_BLUE_WOOL: + case LIGHT_GRAY_BANNER: + case LIGHT_GRAY_BED: + case LIGHT_GRAY_CARPET: + case LIGHT_GRAY_CONCRETE: + case LIGHT_GRAY_CONCRETE_POWDER: + case LIGHT_GRAY_GLAZED_TERRACOTTA: + case LIGHT_GRAY_SHULKER_BOX: + case LIGHT_GRAY_STAINED_GLASS: + case LIGHT_GRAY_STAINED_GLASS_PANE: + case LIGHT_GRAY_TERRACOTTA: + case LIGHT_GRAY_WALL_BANNER: + case LIGHT_GRAY_WOOL: + case LIGHT_WEIGHTED_PRESSURE_PLATE: + case LILAC: + case LILY_PAD: + case LIME_BANNER: + case LIME_BED: + case LIME_CARPET: + case LIME_CONCRETE: + case LIME_CONCRETE_POWDER: + case LIME_GLAZED_TERRACOTTA: + case LIME_SHULKER_BOX: + case LIME_STAINED_GLASS: + case LIME_STAINED_GLASS_PANE: + case LIME_TERRACOTTA: + case LIME_WALL_BANNER: + case LIME_WOOL: + case MAGENTA_BANNER: + case MAGENTA_BED: + case MAGENTA_CARPET: + case MAGENTA_CONCRETE: + case MAGENTA_CONCRETE_POWDER: + case MAGENTA_GLAZED_TERRACOTTA: + case MAGENTA_SHULKER_BOX: + case MAGENTA_STAINED_GLASS: + case MAGENTA_STAINED_GLASS_PANE: + case MAGENTA_TERRACOTTA: + case MAGENTA_WALL_BANNER: + case MAGENTA_WOOL: + case MAGMA_BLOCK: + case MELON: + case MELON_STEM: + case SPAWNER: + case MOSSY_COBBLESTONE: + case MOSSY_COBBLESTONE_WALL: + case MOSSY_STONE_BRICKS: + case MOVING_PISTON: + case MUSHROOM_STEM: + case MYCELIUM: + case NETHERRACK: + case NETHER_BRICKS: + case NETHER_BRICK_FENCE: + case NETHER_BRICK_SLAB: + case NETHER_BRICK_STAIRS: + case NETHER_QUARTZ_ORE: + case NETHER_WART: + case NETHER_WART_BLOCK: + case NOTE_BLOCK: + case OAK_WOOD: + case OAK_BUTTON: + case OAK_DOOR: + case OAK_FENCE: + case OAK_FENCE_GATE: + case OAK_LEAVES: + case OAK_LOG: + case OAK_PLANKS: + case OAK_PRESSURE_PLATE: + case OAK_SAPLING: + case OAK_SLAB: + case OAK_STAIRS: + case OAK_TRAPDOOR: + case OBSERVER: + case OBSIDIAN: + case ORANGE_BANNER: + case ORANGE_BED: + case ORANGE_CARPET: + case ORANGE_CONCRETE: + case ORANGE_CONCRETE_POWDER: + case ORANGE_GLAZED_TERRACOTTA: + case ORANGE_SHULKER_BOX: + case ORANGE_STAINED_GLASS: + case ORANGE_STAINED_GLASS_PANE: + case ORANGE_TERRACOTTA: + case ORANGE_TULIP: + case ORANGE_WALL_BANNER: + case ORANGE_WOOL: + case OXEYE_DAISY: + case PACKED_ICE: + case PEONY: + case PETRIFIED_OAK_SLAB: + case PINK_BANNER: + case PINK_BED: + case PINK_CARPET: + case PINK_CONCRETE: + case PINK_CONCRETE_POWDER: + case PINK_GLAZED_TERRACOTTA: + case PINK_SHULKER_BOX: + case PINK_STAINED_GLASS: + case PINK_STAINED_GLASS_PANE: + case PINK_TERRACOTTA: + case PINK_TULIP: + case PINK_WALL_BANNER: + case PINK_WOOL: + case PISTON: + case PISTON_HEAD: + case PLAYER_HEAD: + case PLAYER_WALL_HEAD: + case PODZOL: + case POLISHED_ANDESITE: + case POLISHED_DIORITE: + case POLISHED_GRANITE: + case POPPY: + case NETHER_PORTAL: + case POTATOES: + case POTTED_ACACIA_SAPLING: + case POTTED_ALLIUM: + case POTTED_AZURE_BLUET: + case POTTED_BIRCH_SAPLING: + case POTTED_BLUE_ORCHID: + case POTTED_BROWN_MUSHROOM: + case POTTED_CACTUS: + case POTTED_DANDELION: + case POTTED_DARK_OAK_SAPLING: + case POTTED_DEAD_BUSH: + case POTTED_FERN: + case POTTED_JUNGLE_SAPLING: + case POTTED_OAK_SAPLING: + case POTTED_ORANGE_TULIP: + case POTTED_OXEYE_DAISY: + case POTTED_PINK_TULIP: + case POTTED_POPPY: + case POTTED_RED_MUSHROOM: + case POTTED_RED_TULIP: + case POTTED_SPRUCE_SAPLING: + case POTTED_WHITE_TULIP: + case POWERED_RAIL: + case PRISMARINE: + case PRISMARINE_BRICKS: + case PRISMARINE_BRICK_SLAB: + case PRISMARINE_BRICK_STAIRS: + case PRISMARINE_SLAB: + case PRISMARINE_STAIRS: + case PUMPKIN: + case PUMPKIN_STEM: + case PURPLE_BANNER: + case PURPLE_BED: + case PURPLE_CARPET: + case PURPLE_CONCRETE: + case PURPLE_CONCRETE_POWDER: + case PURPLE_GLAZED_TERRACOTTA: + case PURPLE_SHULKER_BOX: + case PURPLE_STAINED_GLASS: + case PURPLE_STAINED_GLASS_PANE: + case PURPLE_TERRACOTTA: + case PURPLE_WALL_BANNER: + case PURPLE_WOOL: + case PURPUR_BLOCK: + case PURPUR_PILLAR: + case PURPUR_SLAB: + case PURPUR_STAIRS: + case QUARTZ_BLOCK: + case QUARTZ_PILLAR: + case QUARTZ_SLAB: + case QUARTZ_STAIRS: + case RAIL: + case REDSTONE_BLOCK: + case REDSTONE_LAMP: + case REDSTONE_ORE: + case REDSTONE_TORCH: + case REDSTONE_WALL_TORCH: + case REDSTONE_WIRE: + case RED_BANNER: + case RED_BED: + case RED_CARPET: + case RED_CONCRETE: + case RED_CONCRETE_POWDER: + case RED_GLAZED_TERRACOTTA: + case RED_MUSHROOM: + case RED_MUSHROOM_BLOCK: + case RED_NETHER_BRICKS: + case RED_SAND: + case RED_SANDSTONE: + case RED_SANDSTONE_SLAB: + case RED_SANDSTONE_STAIRS: + case RED_SHULKER_BOX: + case RED_STAINED_GLASS: + case RED_STAINED_GLASS_PANE: + case RED_TERRACOTTA: + case RED_TULIP: + case RED_WALL_BANNER: + case RED_WOOL: + case REPEATER: + case REPEATING_COMMAND_BLOCK: + case ROSE_BUSH: + case SAND: + case SANDSTONE: + case SANDSTONE_SLAB: + case SANDSTONE_STAIRS: + case SEAGRASS: + case SEA_LANTERN: + case SEA_PICKLE: + case SHULKER_BOX: + case SIGN: + case SKELETON_SKULL: + case SKELETON_WALL_SKULL: + case SLIME_BLOCK: + case SMOOTH_QUARTZ: + case SMOOTH_RED_SANDSTONE: + case SMOOTH_SANDSTONE: + case SMOOTH_STONE: + case SNOW: + case SNOW_BLOCK: + case SOUL_SAND: + case SPONGE: + case SPRUCE_WOOD: + case SPRUCE_BUTTON: + case SPRUCE_DOOR: + case SPRUCE_FENCE: + case SPRUCE_FENCE_GATE: + case SPRUCE_LEAVES: + case SPRUCE_LOG: + case SPRUCE_PLANKS: + case SPRUCE_PRESSURE_PLATE: + case SPRUCE_SAPLING: + case SPRUCE_SLAB: + case SPRUCE_STAIRS: + case SPRUCE_TRAPDOOR: + case STICKY_PISTON: + case STONE: + case STONE_BRICKS: + case STONE_BRICK_SLAB: + case STONE_BRICK_STAIRS: + case STONE_BUTTON: + case STONE_PRESSURE_PLATE: + case STONE_SLAB: + case STRIPPED_ACACIA_WOOD: + case STRIPPED_ACACIA_LOG: + case STRIPPED_BIRCH_WOOD: + case STRIPPED_BIRCH_LOG: + case STRIPPED_DARK_OAK_WOOD: + case STRIPPED_DARK_OAK_LOG: + case STRIPPED_JUNGLE_WOOD: + case STRIPPED_JUNGLE_LOG: + case STRIPPED_OAK_WOOD: + case STRIPPED_OAK_LOG: + case STRIPPED_SPRUCE_WOOD: + case STRIPPED_SPRUCE_LOG: + case STRUCTURE_BLOCK: + case STRUCTURE_VOID: + case SUGAR_CANE: + case SUNFLOWER: + case TALL_GRASS: + case TALL_SEAGRASS: + case TERRACOTTA: + case TNT: + case TORCH: + case TRAPPED_CHEST: + case TRIPWIRE: + case TRIPWIRE_HOOK: + case TUBE_CORAL: + case TUBE_CORAL_BLOCK: + case TUBE_CORAL_FAN: + case TURTLE_EGG: + case VINE: + case VOID_AIR: + case WALL_SIGN: + case WALL_TORCH: + case WATER: + case WET_SPONGE: + case WHEAT: + case WHITE_BANNER: + case WHITE_BED: + case WHITE_CARPET: + case WHITE_CONCRETE: + case WHITE_CONCRETE_POWDER: + case WHITE_GLAZED_TERRACOTTA: + case WHITE_SHULKER_BOX: + case WHITE_STAINED_GLASS: + case WHITE_STAINED_GLASS_PANE: + case WHITE_TERRACOTTA: + case WHITE_TULIP: + case WHITE_WALL_BANNER: + case WHITE_WOOL: + case WITHER_SKELETON_SKULL: + case WITHER_SKELETON_WALL_SKULL: + case YELLOW_BANNER: + case YELLOW_BED: + case YELLOW_CARPET: + case YELLOW_CONCRETE: + case YELLOW_CONCRETE_POWDER: + case YELLOW_GLAZED_TERRACOTTA: + case YELLOW_SHULKER_BOX: + case YELLOW_STAINED_GLASS: + case YELLOW_STAINED_GLASS_PANE: + case YELLOW_TERRACOTTA: + case YELLOW_WALL_BANNER: + case YELLOW_WOOL: + case ZOMBIE_HEAD: + case ZOMBIE_WALL_HEAD: + //</editor-fold> + return true; + default: + return 0 <= id && id < 256; + } } /** @@ -659,36 +2623,75 @@ public enum Material { */ public boolean isEdible() { switch (this) { - case BREAD: - case CARROT_ITEM: + //<editor-fold defaultstate="collapsed" desc="isEdible"> + case APPLE: case BAKED_POTATO: - case POTATO_ITEM: - case POISONOUS_POTATO: - case GOLDEN_CARROT: - case PUMPKIN_PIE: - case COOKIE: - case MELON: - case MUSHROOM_SOUP: - case RAW_CHICKEN: - case COOKED_CHICKEN: - case RAW_BEEF: + case BEEF: + case BEETROOT: + case BEETROOT_SOUP: + case BREAD: + case CARROT: + case CHICKEN: + case CHORUS_FRUIT: + case TROPICAL_FISH: + case COD: case COOKED_BEEF: - case RAW_FISH: - case COOKED_FISH: - case PORK: - case GRILLED_PORK: - case APPLE: + case COOKED_CHICKEN: + case COOKED_COD: + case COOKED_MUTTON: + case COOKED_PORKCHOP: + case COOKED_RABBIT: + case COOKED_SALMON: + case COOKIE: + case DRIED_KELP: + case ENCHANTED_GOLDEN_APPLE: case GOLDEN_APPLE: - case ROTTEN_FLESH: - case SPIDER_EYE: + case GOLDEN_CARROT: + case MELON_SLICE: + case MUSHROOM_STEW: + case MUTTON: + case POISONOUS_POTATO: + case PORKCHOP: + case POTATO: + case PUFFERFISH: + case PUMPKIN_PIE: case RABBIT: - case COOKED_RABBIT: case RABBIT_STEW: - case MUTTON: - case COOKED_MUTTON: - case BEETROOT: - case CHORUS_FRUIT: - case BEETROOT_SOUP: + case ROTTEN_FLESH: + case SALMON: + case SPIDER_EYE: + // ----- Legacy Separator ----- + case LEGACY_BREAD: + case LEGACY_CARROT_ITEM: + case LEGACY_BAKED_POTATO: + case LEGACY_POTATO_ITEM: + case LEGACY_POISONOUS_POTATO: + case LEGACY_GOLDEN_CARROT: + case LEGACY_PUMPKIN_PIE: + case LEGACY_COOKIE: + case LEGACY_MELON: + case LEGACY_MUSHROOM_SOUP: + case LEGACY_RAW_CHICKEN: + case LEGACY_COOKED_CHICKEN: + case LEGACY_RAW_BEEF: + case LEGACY_COOKED_BEEF: + case LEGACY_RAW_FISH: + case LEGACY_COOKED_FISH: + case LEGACY_PORK: + case LEGACY_GRILLED_PORK: + case LEGACY_APPLE: + case LEGACY_GOLDEN_APPLE: + case LEGACY_ROTTEN_FLESH: + case LEGACY_SPIDER_EYE: + case LEGACY_RABBIT: + case LEGACY_COOKED_RABBIT: + case LEGACY_RABBIT_STEW: + case LEGACY_MUTTON: + case LEGACY_COOKED_MUTTON: + case LEGACY_BEETROOT: + case LEGACY_CHORUS_FRUIT: + case LEGACY_BEETROOT_SOUP: + //</editor-fold> return true; default: return false; @@ -696,19 +2699,16 @@ public enum Material { } /** - * Attempts to get the Material with the given ID + * Attempts to get the Material with the given name. + * <p> + * This is a normal lookup, names must be the precise name they are given + * in the enum. * - * @param id ID of the material to get + * @param name Name of the material to get * @return Material if found, or null - * @deprecated Magic value */ - @Deprecated - public static Material getMaterial(final int id) { - if (byId.length > id && id >= 0) { - return byId[id]; - } else { - return null; - } + public static Material getMaterial(final String name) { + return getMaterial(name, false); } /** @@ -718,9 +2718,19 @@ public enum Material { * in the enum. * * @param name Name of the material to get + * @param legacyName whether this is a legacy name * @return Material if found, or null */ - public static Material getMaterial(final String name) { + public static Material getMaterial(String name, boolean legacyName) { + if (legacyName) { + if (!name.startsWith(LEGACY_PREFIX)) { + name = LEGACY_PREFIX + name; + } + + Material match = BY_NAME.get(name); + return Bukkit.getUnsafe().fromLegacy(match); + } + return BY_NAME.get(name); } @@ -730,39 +2740,36 @@ public enum Material { * This is a match lookup; names will be converted to uppercase, then * stripped of special characters in an attempt to format it like the * enum. - * <p> - * Using this for match by ID is deprecated. * * @param name Name of the material to get * @return Material if found, or null */ public static Material matchMaterial(final String name) { - Validate.notNull(name, "Name cannot be null"); - - Material result = null; - - try { - result = getMaterial(Integer.parseInt(name)); - } catch (NumberFormatException ex) {} + return matchMaterial(name, false); + } - if (result == null) { - String filtered = name.toUpperCase(java.util.Locale.ENGLISH); + /** + * Attempts to match the Material with the given name. + * <p> + * This is a match lookup; names will be converted to uppercase, then + * stripped of special characters in an attempt to format it like the + * enum. + * + * @param name Name of the material to get + * @param legacyName whether this is a legacy name + * @return Material if found, or null + */ + public static Material matchMaterial(final String name, boolean legacyName) { + Validate.notNull(name, "Name cannot be null"); - filtered = filtered.replaceAll("\\s+", "_").replaceAll("\\W", ""); - result = BY_NAME.get(filtered); - } + String filtered = name.toUpperCase(java.util.Locale.ENGLISH); - return result; + filtered = filtered.replaceAll("\\s+", "_").replaceAll("\\W", ""); + return getMaterial(filtered, legacyName); } static { for (Material material : values()) { - if (byId.length > material.id) { - byId[material.id] = material; - } else { - byId = Arrays.copyOfRange(byId, 0, material.id + 2); - byId[material.id] = material; - } BY_NAME.put(material.name(), material); } } @@ -771,7 +2778,25 @@ public enum Material { * @return True if this material represents a playable music disk. */ public boolean isRecord() { - return id >= GOLD_RECORD.id && id <= RECORD_12.id; + switch (this) { + //<editor-fold defaultstate="collapsed" desc="isRecord"> + case MUSIC_DISC_11: + case MUSIC_DISC_13: + case MUSIC_DISC_BLOCKS: + case MUSIC_DISC_CAT: + case MUSIC_DISC_CHIRP: + case MUSIC_DISC_FAR: + case MUSIC_DISC_MALL: + case MUSIC_DISC_MELLOHI: + case MUSIC_DISC_STAL: + case MUSIC_DISC_STRAD: + case MUSIC_DISC_WAIT: + case MUSIC_DISC_WARD: + //</editor-fold> + return true; + default: + return id >= LEGACY_GOLD_RECORD.id && id <= LEGACY_RECORD_12.id; + } } /** @@ -784,205 +2809,643 @@ public enum Material { return false; } switch (this) { - case STONE: - case GRASS: - case DIRT: - case COBBLESTONE: - case WOOD: + //<editor-fold defaultstate="collapsed" desc="isSolid"> + case ACACIA_DOOR: + case ACACIA_FENCE: + case ACACIA_FENCE_GATE: + case ACACIA_LEAVES: + case ACACIA_LOG: + case ACACIA_PLANKS: + case ACACIA_PRESSURE_PLATE: + case ACACIA_SLAB: + case ACACIA_STAIRS: + case ACACIA_TRAPDOOR: + case ACACIA_WOOD: + case ANDESITE: + case ANVIL: + case BARRIER: + case BEACON: case BEDROCK: - case SAND: - case GRAVEL: - case GOLD_ORE: - case IRON_ORE: - case COAL_ORE: - case LOG: - case LEAVES: - case SPONGE: - case GLASS: - case LAPIS_ORE: - case LAPIS_BLOCK: - case DISPENSER: - case SANDSTONE: - case NOTE_BLOCK: - case BED_BLOCK: - case PISTON_STICKY_BASE: - case PISTON_BASE: - case PISTON_EXTENSION: - case WOOL: - case PISTON_MOVING_PIECE: - case GOLD_BLOCK: - case IRON_BLOCK: - case DOUBLE_STEP: - case STEP: - case BRICK: - case TNT: + case BIRCH_DOOR: + case BIRCH_FENCE: + case BIRCH_FENCE_GATE: + case BIRCH_LEAVES: + case BIRCH_LOG: + case BIRCH_PLANKS: + case BIRCH_PRESSURE_PLATE: + case BIRCH_SLAB: + case BIRCH_STAIRS: + case BIRCH_TRAPDOOR: + case BIRCH_WOOD: + case BLACK_BANNER: + case BLACK_BED: + case BLACK_CONCRETE: + case BLACK_CONCRETE_POWDER: + case BLACK_GLAZED_TERRACOTTA: + case BLACK_SHULKER_BOX: + case BLACK_STAINED_GLASS: + case BLACK_STAINED_GLASS_PANE: + case BLACK_TERRACOTTA: + case BLACK_WALL_BANNER: + case BLACK_WOOL: + case BLUE_BANNER: + case BLUE_BED: + case BLUE_CONCRETE: + case BLUE_CONCRETE_POWDER: + case BLUE_GLAZED_TERRACOTTA: + case BLUE_ICE: + case BLUE_SHULKER_BOX: + case BLUE_STAINED_GLASS: + case BLUE_STAINED_GLASS_PANE: + case BLUE_TERRACOTTA: + case BLUE_WALL_BANNER: + case BLUE_WOOL: + case BONE_BLOCK: case BOOKSHELF: - case MOSSY_COBBLESTONE: - case OBSIDIAN: - case MOB_SPAWNER: - case WOOD_STAIRS: - case CHEST: - case DIAMOND_ORE: - case DIAMOND_BLOCK: - case WORKBENCH: - case SOIL: - case FURNACE: - case BURNING_FURNACE: - case SIGN_POST: - case WOODEN_DOOR: - case COBBLESTONE_STAIRS: - case WALL_SIGN: - case STONE_PLATE: - case IRON_DOOR_BLOCK: - case WOOD_PLATE: - case REDSTONE_ORE: - case GLOWING_REDSTONE_ORE: - case ICE: - case SNOW_BLOCK: - case CACTUS: - case CLAY: - case JUKEBOX: - case FENCE: - case PUMPKIN: - case NETHERRACK: - case SOUL_SAND: - case GLOWSTONE: - case JACK_O_LANTERN: - case CAKE_BLOCK: - case STAINED_GLASS: - case TRAP_DOOR: - case MONSTER_EGGS: - case SMOOTH_BRICK: - case HUGE_MUSHROOM_1: - case HUGE_MUSHROOM_2: - case IRON_FENCE: - case THIN_GLASS: - case MELON_BLOCK: - case FENCE_GATE: - case BRICK_STAIRS: - case SMOOTH_STAIRS: - case MYCEL: - case NETHER_BRICK: - case NETHER_FENCE: - case NETHER_BRICK_STAIRS: - case ENCHANTMENT_TABLE: + case BRAIN_CORAL_BLOCK: case BREWING_STAND: + case BRICKS: + case BRICK_SLAB: + case BRICK_STAIRS: + case BROWN_BANNER: + case BROWN_BED: + case BROWN_CONCRETE: + case BROWN_CONCRETE_POWDER: + case BROWN_GLAZED_TERRACOTTA: + case BROWN_MUSHROOM_BLOCK: + case BROWN_SHULKER_BOX: + case BROWN_STAINED_GLASS: + case BROWN_STAINED_GLASS_PANE: + case BROWN_TERRACOTTA: + case BROWN_WALL_BANNER: + case BROWN_WOOL: + case BUBBLE_CORAL_BLOCK: + case CACTUS: + case CAKE: + case CARVED_PUMPKIN: case CAULDRON: - case ENDER_PORTAL_FRAME: - case ENDER_STONE: + case CHAIN_COMMAND_BLOCK: + case CHEST: + case CHIPPED_ANVIL: + case CHISELED_QUARTZ_BLOCK: + case CHISELED_RED_SANDSTONE: + case CHISELED_SANDSTONE: + case CHISELED_STONE_BRICKS: + case CLAY: + case COAL_BLOCK: + case COAL_ORE: + case COARSE_DIRT: + case COBBLESTONE: + case COBBLESTONE_SLAB: + case COBBLESTONE_STAIRS: + case COBBLESTONE_WALL: + case COMMAND_BLOCK: + case CONDUIT: + case CRACKED_STONE_BRICKS: + case CRAFTING_TABLE: + case CUT_RED_SANDSTONE: + case CUT_SANDSTONE: + case CYAN_BANNER: + case CYAN_BED: + case CYAN_CONCRETE: + case CYAN_CONCRETE_POWDER: + case CYAN_GLAZED_TERRACOTTA: + case CYAN_SHULKER_BOX: + case CYAN_STAINED_GLASS: + case CYAN_STAINED_GLASS_PANE: + case CYAN_TERRACOTTA: + case CYAN_WALL_BANNER: + case CYAN_WOOL: + case DAMAGED_ANVIL: + case DARK_OAK_DOOR: + case DARK_OAK_FENCE: + case DARK_OAK_FENCE_GATE: + case DARK_OAK_LEAVES: + case DARK_OAK_LOG: + case DARK_OAK_PLANKS: + case DARK_OAK_PRESSURE_PLATE: + case DARK_OAK_SLAB: + case DARK_OAK_STAIRS: + case DARK_OAK_TRAPDOOR: + case DARK_OAK_WOOD: + case DARK_PRISMARINE: + case DARK_PRISMARINE_SLAB: + case DARK_PRISMARINE_STAIRS: + case DAYLIGHT_DETECTOR: + case DEAD_BRAIN_CORAL_BLOCK: + case DEAD_BUBBLE_CORAL_BLOCK: + case DEAD_FIRE_CORAL_BLOCK: + case DEAD_HORN_CORAL_BLOCK: + case DEAD_TUBE_CORAL_BLOCK: + case DIAMOND_BLOCK: + case DIAMOND_ORE: + case DIORITE: + case DIRT: + case DISPENSER: case DRAGON_EGG: - case REDSTONE_LAMP_OFF: - case REDSTONE_LAMP_ON: - case WOOD_DOUBLE_STEP: - case WOOD_STEP: - case SANDSTONE_STAIRS: + case DRIED_KELP_BLOCK: + case DROPPER: + case EMERALD_BLOCK: case EMERALD_ORE: + case ENCHANTING_TABLE: case ENDER_CHEST: - case EMERALD_BLOCK: - case SPRUCE_WOOD_STAIRS: - case BIRCH_WOOD_STAIRS: - case JUNGLE_WOOD_STAIRS: - case COMMAND: - case BEACON: - case COBBLE_WALL: - case ANVIL: - case TRAPPED_CHEST: - case GOLD_PLATE: - case IRON_PLATE: - case DAYLIGHT_DETECTOR: - case REDSTONE_BLOCK: - case QUARTZ_ORE: - case HOPPER: - case QUARTZ_BLOCK: - case QUARTZ_STAIRS: - case DROPPER: - case STAINED_CLAY: + case END_PORTAL_FRAME: + case END_STONE: + case END_STONE_BRICKS: + case FARMLAND: + case FIRE_CORAL_BLOCK: + case FROSTED_ICE: + case FURNACE: + case GLASS: + case GLASS_PANE: + case GLOWSTONE: + case GOLD_BLOCK: + case GOLD_ORE: + case GRANITE: + case GRASS_BLOCK: + case GRASS_PATH: + case GRAVEL: + case GRAY_BANNER: + case GRAY_BED: + case GRAY_CONCRETE: + case GRAY_CONCRETE_POWDER: + case GRAY_GLAZED_TERRACOTTA: + case GRAY_SHULKER_BOX: + case GRAY_STAINED_GLASS: + case GRAY_STAINED_GLASS_PANE: + case GRAY_TERRACOTTA: + case GRAY_WALL_BANNER: + case GRAY_WOOL: + case GREEN_BANNER: + case GREEN_BED: + case GREEN_CONCRETE: + case GREEN_CONCRETE_POWDER: + case GREEN_GLAZED_TERRACOTTA: + case GREEN_SHULKER_BOX: + case GREEN_STAINED_GLASS: + case GREEN_STAINED_GLASS_PANE: + case GREEN_TERRACOTTA: + case GREEN_WALL_BANNER: + case GREEN_WOOL: case HAY_BLOCK: - case HARD_CLAY: - case COAL_BLOCK: - case STAINED_GLASS_PANE: - case LEAVES_2: - case LOG_2: - case ACACIA_STAIRS: - case DARK_OAK_STAIRS: - case PACKED_ICE: - case RED_SANDSTONE: - case SLIME_BLOCK: - case BARRIER: + case HEAVY_WEIGHTED_PRESSURE_PLATE: + case HOPPER: + case HORN_CORAL_BLOCK: + case ICE: + case INFESTED_CHISELED_STONE_BRICKS: + case INFESTED_COBBLESTONE: + case INFESTED_CRACKED_STONE_BRICKS: + case INFESTED_MOSSY_STONE_BRICKS: + case INFESTED_STONE: + case INFESTED_STONE_BRICKS: + case IRON_BARS: + case IRON_BLOCK: + case IRON_DOOR: + case IRON_ORE: case IRON_TRAPDOOR: - case PRISMARINE: - case SEA_LANTERN: - case DOUBLE_STONE_SLAB2: - case RED_SANDSTONE_STAIRS: - case STONE_SLAB2: - case SPRUCE_FENCE_GATE: - case BIRCH_FENCE_GATE: - case JUNGLE_FENCE_GATE: - case DARK_OAK_FENCE_GATE: - case ACACIA_FENCE_GATE: - case SPRUCE_FENCE: - case BIRCH_FENCE: - case JUNGLE_FENCE: - case DARK_OAK_FENCE: - case ACACIA_FENCE: - case STANDING_BANNER: - case WALL_BANNER: - case DAYLIGHT_DETECTOR_INVERTED: - case SPRUCE_DOOR: - case BIRCH_DOOR: + case JACK_O_LANTERN: + case JUKEBOX: case JUNGLE_DOOR: - case ACACIA_DOOR: - case DARK_OAK_DOOR: - case PURPUR_BLOCK: - case PURPUR_PILLAR: - case PURPUR_STAIRS: - case PURPUR_DOUBLE_SLAB: - case PURPUR_SLAB: - case END_BRICKS: - case GRASS_PATH: - case STRUCTURE_BLOCK: - case COMMAND_REPEATING: - case COMMAND_CHAIN: - case FROSTED_ICE: - case MAGMA: + case JUNGLE_FENCE: + case JUNGLE_FENCE_GATE: + case JUNGLE_LEAVES: + case JUNGLE_LOG: + case JUNGLE_PLANKS: + case JUNGLE_PRESSURE_PLATE: + case JUNGLE_SLAB: + case JUNGLE_STAIRS: + case JUNGLE_TRAPDOOR: + case JUNGLE_WOOD: + case LAPIS_BLOCK: + case LAPIS_ORE: + case LIGHT_BLUE_BANNER: + case LIGHT_BLUE_BED: + case LIGHT_BLUE_CONCRETE: + case LIGHT_BLUE_CONCRETE_POWDER: + case LIGHT_BLUE_GLAZED_TERRACOTTA: + case LIGHT_BLUE_SHULKER_BOX: + case LIGHT_BLUE_STAINED_GLASS: + case LIGHT_BLUE_STAINED_GLASS_PANE: + case LIGHT_BLUE_TERRACOTTA: + case LIGHT_BLUE_WALL_BANNER: + case LIGHT_BLUE_WOOL: + case LIGHT_GRAY_BANNER: + case LIGHT_GRAY_BED: + case LIGHT_GRAY_CONCRETE: + case LIGHT_GRAY_CONCRETE_POWDER: + case LIGHT_GRAY_GLAZED_TERRACOTTA: + case LIGHT_GRAY_SHULKER_BOX: + case LIGHT_GRAY_STAINED_GLASS: + case LIGHT_GRAY_STAINED_GLASS_PANE: + case LIGHT_GRAY_TERRACOTTA: + case LIGHT_GRAY_WALL_BANNER: + case LIGHT_GRAY_WOOL: + case LIGHT_WEIGHTED_PRESSURE_PLATE: + case LIME_BANNER: + case LIME_BED: + case LIME_CONCRETE: + case LIME_CONCRETE_POWDER: + case LIME_GLAZED_TERRACOTTA: + case LIME_SHULKER_BOX: + case LIME_STAINED_GLASS: + case LIME_STAINED_GLASS_PANE: + case LIME_TERRACOTTA: + case LIME_WALL_BANNER: + case LIME_WOOL: + case MAGENTA_BANNER: + case MAGENTA_BED: + case MAGENTA_CONCRETE: + case MAGENTA_CONCRETE_POWDER: + case MAGENTA_GLAZED_TERRACOTTA: + case MAGENTA_SHULKER_BOX: + case MAGENTA_STAINED_GLASS: + case MAGENTA_STAINED_GLASS_PANE: + case MAGENTA_TERRACOTTA: + case MAGENTA_WALL_BANNER: + case MAGENTA_WOOL: + case MAGMA_BLOCK: + case MELON: + case MOSSY_COBBLESTONE: + case MOSSY_COBBLESTONE_WALL: + case MOSSY_STONE_BRICKS: + case MOVING_PISTON: + case MUSHROOM_STEM: + case MYCELIUM: + case NETHERRACK: + case NETHER_BRICKS: + case NETHER_BRICK_FENCE: + case NETHER_BRICK_SLAB: + case NETHER_BRICK_STAIRS: + case NETHER_QUARTZ_ORE: case NETHER_WART_BLOCK: - case RED_NETHER_BRICK: - case BONE_BLOCK: + case NOTE_BLOCK: + case OAK_DOOR: + case OAK_FENCE: + case OAK_FENCE_GATE: + case OAK_LEAVES: + case OAK_LOG: + case OAK_PLANKS: + case OAK_PRESSURE_PLATE: + case OAK_SLAB: + case OAK_STAIRS: + case OAK_TRAPDOOR: + case OAK_WOOD: case OBSERVER: - case WHITE_SHULKER_BOX: + case OBSIDIAN: + case ORANGE_BANNER: + case ORANGE_BED: + case ORANGE_CONCRETE: + case ORANGE_CONCRETE_POWDER: + case ORANGE_GLAZED_TERRACOTTA: case ORANGE_SHULKER_BOX: - case MAGENTA_SHULKER_BOX: - case LIGHT_BLUE_SHULKER_BOX: - case YELLOW_SHULKER_BOX: - case LIME_SHULKER_BOX: + case ORANGE_STAINED_GLASS: + case ORANGE_STAINED_GLASS_PANE: + case ORANGE_TERRACOTTA: + case ORANGE_WALL_BANNER: + case ORANGE_WOOL: + case PACKED_ICE: + case PETRIFIED_OAK_SLAB: + case PINK_BANNER: + case PINK_BED: + case PINK_CONCRETE: + case PINK_CONCRETE_POWDER: + case PINK_GLAZED_TERRACOTTA: case PINK_SHULKER_BOX: - case GRAY_SHULKER_BOX: - case SILVER_SHULKER_BOX: - case CYAN_SHULKER_BOX: + case PINK_STAINED_GLASS: + case PINK_STAINED_GLASS_PANE: + case PINK_TERRACOTTA: + case PINK_WALL_BANNER: + case PINK_WOOL: + case PISTON: + case PISTON_HEAD: + case PODZOL: + case POLISHED_ANDESITE: + case POLISHED_DIORITE: + case POLISHED_GRANITE: + case PRISMARINE: + case PRISMARINE_BRICKS: + case PRISMARINE_BRICK_SLAB: + case PRISMARINE_BRICK_STAIRS: + case PRISMARINE_SLAB: + case PRISMARINE_STAIRS: + case PUMPKIN: + case PURPLE_BANNER: + case PURPLE_BED: + case PURPLE_CONCRETE: + case PURPLE_CONCRETE_POWDER: + case PURPLE_GLAZED_TERRACOTTA: case PURPLE_SHULKER_BOX: - case BLUE_SHULKER_BOX: - case BROWN_SHULKER_BOX: - case GREEN_SHULKER_BOX: + case PURPLE_STAINED_GLASS: + case PURPLE_STAINED_GLASS_PANE: + case PURPLE_TERRACOTTA: + case PURPLE_WALL_BANNER: + case PURPLE_WOOL: + case PURPUR_BLOCK: + case PURPUR_PILLAR: + case PURPUR_SLAB: + case PURPUR_STAIRS: + case QUARTZ_BLOCK: + case QUARTZ_PILLAR: + case QUARTZ_SLAB: + case QUARTZ_STAIRS: + case REDSTONE_BLOCK: + case REDSTONE_LAMP: + case REDSTONE_ORE: + case RED_BANNER: + case RED_BED: + case RED_CONCRETE: + case RED_CONCRETE_POWDER: + case RED_GLAZED_TERRACOTTA: + case RED_MUSHROOM_BLOCK: + case RED_NETHER_BRICKS: + case RED_SAND: + case RED_SANDSTONE: + case RED_SANDSTONE_SLAB: + case RED_SANDSTONE_STAIRS: case RED_SHULKER_BOX: - case BLACK_SHULKER_BOX: + case RED_STAINED_GLASS: + case RED_STAINED_GLASS_PANE: + case RED_TERRACOTTA: + case RED_WALL_BANNER: + case RED_WOOL: + case REPEATING_COMMAND_BLOCK: + case SAND: + case SANDSTONE: + case SANDSTONE_SLAB: + case SANDSTONE_STAIRS: + case SEA_LANTERN: + case SHULKER_BOX: + case SIGN: + case SLIME_BLOCK: + case SMOOTH_QUARTZ: + case SMOOTH_RED_SANDSTONE: + case SMOOTH_SANDSTONE: + case SMOOTH_STONE: + case SNOW_BLOCK: + case SOUL_SAND: + case SPAWNER: + case SPONGE: + case SPRUCE_DOOR: + case SPRUCE_FENCE: + case SPRUCE_FENCE_GATE: + case SPRUCE_LEAVES: + case SPRUCE_LOG: + case SPRUCE_PLANKS: + case SPRUCE_PRESSURE_PLATE: + case SPRUCE_SLAB: + case SPRUCE_STAIRS: + case SPRUCE_TRAPDOOR: + case SPRUCE_WOOD: + case STICKY_PISTON: + case STONE: + case STONE_BRICKS: + case STONE_BRICK_SLAB: + case STONE_BRICK_STAIRS: + case STONE_PRESSURE_PLATE: + case STONE_SLAB: + case STRIPPED_ACACIA_LOG: + case STRIPPED_ACACIA_WOOD: + case STRIPPED_BIRCH_LOG: + case STRIPPED_BIRCH_WOOD: + case STRIPPED_DARK_OAK_LOG: + case STRIPPED_DARK_OAK_WOOD: + case STRIPPED_JUNGLE_LOG: + case STRIPPED_JUNGLE_WOOD: + case STRIPPED_OAK_LOG: + case STRIPPED_OAK_WOOD: + case STRIPPED_SPRUCE_LOG: + case STRIPPED_SPRUCE_WOOD: + case STRUCTURE_BLOCK: + case TERRACOTTA: + case TNT: + case TRAPPED_CHEST: + case TUBE_CORAL_BLOCK: + case TURTLE_EGG: + case WALL_SIGN: + case WET_SPONGE: + case WHITE_BANNER: + case WHITE_BED: + case WHITE_CONCRETE: + case WHITE_CONCRETE_POWDER: case WHITE_GLAZED_TERRACOTTA: - case ORANGE_GLAZED_TERRACOTTA: - case MAGENTA_GLAZED_TERRACOTTA: - case LIGHT_BLUE_GLAZED_TERRACOTTA: + case WHITE_SHULKER_BOX: + case WHITE_STAINED_GLASS: + case WHITE_STAINED_GLASS_PANE: + case WHITE_TERRACOTTA: + case WHITE_WALL_BANNER: + case WHITE_WOOL: + case YELLOW_BANNER: + case YELLOW_BED: + case YELLOW_CONCRETE: + case YELLOW_CONCRETE_POWDER: case YELLOW_GLAZED_TERRACOTTA: - case LIME_GLAZED_TERRACOTTA: - case PINK_GLAZED_TERRACOTTA: - case GRAY_GLAZED_TERRACOTTA: - case SILVER_GLAZED_TERRACOTTA: - case CYAN_GLAZED_TERRACOTTA: - case PURPLE_GLAZED_TERRACOTTA: - case BLUE_GLAZED_TERRACOTTA: - case BROWN_GLAZED_TERRACOTTA: - case GREEN_GLAZED_TERRACOTTA: - case RED_GLAZED_TERRACOTTA: - case BLACK_GLAZED_TERRACOTTA: - case CONCRETE: - case CONCRETE_POWDER: + case YELLOW_SHULKER_BOX: + case YELLOW_STAINED_GLASS: + case YELLOW_STAINED_GLASS_PANE: + case YELLOW_TERRACOTTA: + case YELLOW_WALL_BANNER: + case YELLOW_WOOL: + // ----- Legacy Separator ----- + case LEGACY_STONE: + case LEGACY_GRASS: + case LEGACY_DIRT: + case LEGACY_COBBLESTONE: + case LEGACY_WOOD: + case LEGACY_BEDROCK: + case LEGACY_SAND: + case LEGACY_GRAVEL: + case LEGACY_GOLD_ORE: + case LEGACY_IRON_ORE: + case LEGACY_COAL_ORE: + case LEGACY_LOG: + case LEGACY_LEAVES: + case LEGACY_SPONGE: + case LEGACY_GLASS: + case LEGACY_LAPIS_ORE: + case LEGACY_LAPIS_BLOCK: + case LEGACY_DISPENSER: + case LEGACY_SANDSTONE: + case LEGACY_NOTE_BLOCK: + case LEGACY_BED_BLOCK: + case LEGACY_PISTON_STICKY_BASE: + case LEGACY_PISTON_BASE: + case LEGACY_PISTON_EXTENSION: + case LEGACY_WOOL: + case LEGACY_PISTON_MOVING_PIECE: + case LEGACY_GOLD_BLOCK: + case LEGACY_IRON_BLOCK: + case LEGACY_DOUBLE_STEP: + case LEGACY_STEP: + case LEGACY_BRICK: + case LEGACY_TNT: + case LEGACY_BOOKSHELF: + case LEGACY_MOSSY_COBBLESTONE: + case LEGACY_OBSIDIAN: + case LEGACY_MOB_SPAWNER: + case LEGACY_WOOD_STAIRS: + case LEGACY_CHEST: + case LEGACY_DIAMOND_ORE: + case LEGACY_DIAMOND_BLOCK: + case LEGACY_WORKBENCH: + case LEGACY_SOIL: + case LEGACY_FURNACE: + case LEGACY_BURNING_FURNACE: + case LEGACY_SIGN_POST: + case LEGACY_WOODEN_DOOR: + case LEGACY_COBBLESTONE_STAIRS: + case LEGACY_WALL_SIGN: + case LEGACY_STONE_PLATE: + case LEGACY_IRON_DOOR_BLOCK: + case LEGACY_WOOD_PLATE: + case LEGACY_REDSTONE_ORE: + case LEGACY_GLOWING_REDSTONE_ORE: + case LEGACY_ICE: + case LEGACY_SNOW_BLOCK: + case LEGACY_CACTUS: + case LEGACY_CLAY: + case LEGACY_JUKEBOX: + case LEGACY_FENCE: + case LEGACY_PUMPKIN: + case LEGACY_NETHERRACK: + case LEGACY_SOUL_SAND: + case LEGACY_GLOWSTONE: + case LEGACY_JACK_O_LANTERN: + case LEGACY_CAKE_BLOCK: + case LEGACY_STAINED_GLASS: + case LEGACY_TRAP_DOOR: + case LEGACY_MONSTER_EGGS: + case LEGACY_SMOOTH_BRICK: + case LEGACY_HUGE_MUSHROOM_1: + case LEGACY_HUGE_MUSHROOM_2: + case LEGACY_IRON_FENCE: + case LEGACY_THIN_GLASS: + case LEGACY_MELON_BLOCK: + case LEGACY_FENCE_GATE: + case LEGACY_BRICK_STAIRS: + case LEGACY_SMOOTH_STAIRS: + case LEGACY_MYCEL: + case LEGACY_NETHER_BRICK: + case LEGACY_NETHER_FENCE: + case LEGACY_NETHER_BRICK_STAIRS: + case LEGACY_ENCHANTMENT_TABLE: + case LEGACY_BREWING_STAND: + case LEGACY_CAULDRON: + case LEGACY_ENDER_PORTAL_FRAME: + case LEGACY_ENDER_STONE: + case LEGACY_DRAGON_EGG: + case LEGACY_REDSTONE_LAMP_OFF: + case LEGACY_REDSTONE_LAMP_ON: + case LEGACY_WOOD_DOUBLE_STEP: + case LEGACY_WOOD_STEP: + case LEGACY_SANDSTONE_STAIRS: + case LEGACY_EMERALD_ORE: + case LEGACY_ENDER_CHEST: + case LEGACY_EMERALD_BLOCK: + case LEGACY_SPRUCE_WOOD_STAIRS: + case LEGACY_BIRCH_WOOD_STAIRS: + case LEGACY_JUNGLE_WOOD_STAIRS: + case LEGACY_COMMAND: + case LEGACY_BEACON: + case LEGACY_COBBLE_WALL: + case LEGACY_ANVIL: + case LEGACY_TRAPPED_CHEST: + case LEGACY_GOLD_PLATE: + case LEGACY_IRON_PLATE: + case LEGACY_DAYLIGHT_DETECTOR: + case LEGACY_REDSTONE_BLOCK: + case LEGACY_QUARTZ_ORE: + case LEGACY_HOPPER: + case LEGACY_QUARTZ_BLOCK: + case LEGACY_QUARTZ_STAIRS: + case LEGACY_DROPPER: + case LEGACY_STAINED_CLAY: + case LEGACY_HAY_BLOCK: + case LEGACY_HARD_CLAY: + case LEGACY_COAL_BLOCK: + case LEGACY_STAINED_GLASS_PANE: + case LEGACY_LEAVES_2: + case LEGACY_LOG_2: + case LEGACY_ACACIA_STAIRS: + case LEGACY_DARK_OAK_STAIRS: + case LEGACY_PACKED_ICE: + case LEGACY_RED_SANDSTONE: + case LEGACY_SLIME_BLOCK: + case LEGACY_BARRIER: + case LEGACY_IRON_TRAPDOOR: + case LEGACY_PRISMARINE: + case LEGACY_SEA_LANTERN: + case LEGACY_DOUBLE_STONE_SLAB2: + case LEGACY_RED_SANDSTONE_STAIRS: + case LEGACY_STONE_SLAB2: + case LEGACY_SPRUCE_FENCE_GATE: + case LEGACY_BIRCH_FENCE_GATE: + case LEGACY_JUNGLE_FENCE_GATE: + case LEGACY_DARK_OAK_FENCE_GATE: + case LEGACY_ACACIA_FENCE_GATE: + case LEGACY_SPRUCE_FENCE: + case LEGACY_BIRCH_FENCE: + case LEGACY_JUNGLE_FENCE: + case LEGACY_DARK_OAK_FENCE: + case LEGACY_ACACIA_FENCE: + case LEGACY_STANDING_BANNER: + case LEGACY_WALL_BANNER: + case LEGACY_DAYLIGHT_DETECTOR_INVERTED: + case LEGACY_SPRUCE_DOOR: + case LEGACY_BIRCH_DOOR: + case LEGACY_JUNGLE_DOOR: + case LEGACY_ACACIA_DOOR: + case LEGACY_DARK_OAK_DOOR: + case LEGACY_PURPUR_BLOCK: + case LEGACY_PURPUR_PILLAR: + case LEGACY_PURPUR_STAIRS: + case LEGACY_PURPUR_DOUBLE_SLAB: + case LEGACY_PURPUR_SLAB: + case LEGACY_END_BRICKS: + case LEGACY_GRASS_PATH: + case LEGACY_STRUCTURE_BLOCK: + case LEGACY_COMMAND_REPEATING: + case LEGACY_COMMAND_CHAIN: + case LEGACY_FROSTED_ICE: + case LEGACY_MAGMA: + case LEGACY_NETHER_WART_BLOCK: + case LEGACY_RED_NETHER_BRICK: + case LEGACY_BONE_BLOCK: + case LEGACY_OBSERVER: + case LEGACY_WHITE_SHULKER_BOX: + case LEGACY_ORANGE_SHULKER_BOX: + case LEGACY_MAGENTA_SHULKER_BOX: + case LEGACY_LIGHT_BLUE_SHULKER_BOX: + case LEGACY_YELLOW_SHULKER_BOX: + case LEGACY_LIME_SHULKER_BOX: + case LEGACY_PINK_SHULKER_BOX: + case LEGACY_GRAY_SHULKER_BOX: + case LEGACY_SILVER_SHULKER_BOX: + case LEGACY_CYAN_SHULKER_BOX: + case LEGACY_PURPLE_SHULKER_BOX: + case LEGACY_BLUE_SHULKER_BOX: + case LEGACY_BROWN_SHULKER_BOX: + case LEGACY_GREEN_SHULKER_BOX: + case LEGACY_RED_SHULKER_BOX: + case LEGACY_BLACK_SHULKER_BOX: + case LEGACY_WHITE_GLAZED_TERRACOTTA: + case LEGACY_ORANGE_GLAZED_TERRACOTTA: + case LEGACY_MAGENTA_GLAZED_TERRACOTTA: + case LEGACY_LIGHT_BLUE_GLAZED_TERRACOTTA: + case LEGACY_YELLOW_GLAZED_TERRACOTTA: + case LEGACY_LIME_GLAZED_TERRACOTTA: + case LEGACY_PINK_GLAZED_TERRACOTTA: + case LEGACY_GRAY_GLAZED_TERRACOTTA: + case LEGACY_SILVER_GLAZED_TERRACOTTA: + case LEGACY_CYAN_GLAZED_TERRACOTTA: + case LEGACY_PURPLE_GLAZED_TERRACOTTA: + case LEGACY_BLUE_GLAZED_TERRACOTTA: + case LEGACY_BROWN_GLAZED_TERRACOTTA: + case LEGACY_GREEN_GLAZED_TERRACOTTA: + case LEGACY_RED_GLAZED_TERRACOTTA: + case LEGACY_BLACK_GLAZED_TERRACOTTA: + case LEGACY_CONCRETE: + case LEGACY_CONCRETE_POWDER: + //</editor-fold> return true; default: return false; @@ -993,62 +3456,191 @@ public enum Material { * Check if the material is a block and does not block any light * * @return True if this material is a block and does not block any light + * @deprecated currently does not have an implementation which is well + * linked to the underlying server. Contributions welcome. */ + @Deprecated public boolean isTransparent() { if (!isBlock()) { return false; } switch (this) { + //<editor-fold defaultstate="collapsed" desc="isTransparent"> + case ACACIA_BUTTON: + case ACACIA_SAPLING: + case ACTIVATOR_RAIL: case AIR: - case SAPLING: - case POWERED_RAIL: - case DETECTOR_RAIL: - case LONG_GRASS: - case DEAD_BUSH: - case YELLOW_FLOWER: - case RED_ROSE: + case ALLIUM: + case ATTACHED_MELON_STEM: + case ATTACHED_PUMPKIN_STEM: + case AZURE_BLUET: + case BARRIER: + case BEETROOTS: + case BIRCH_BUTTON: + case BIRCH_SAPLING: + case BLACK_CARPET: + case BLUE_CARPET: + case BLUE_ORCHID: + case BROWN_CARPET: case BROWN_MUSHROOM: - case RED_MUSHROOM: - case TORCH: + case CARROTS: + case CHORUS_FLOWER: + case CHORUS_PLANT: + case COCOA: + case COMPARATOR: + case CREEPER_HEAD: + case CREEPER_WALL_HEAD: + case CYAN_CARPET: + case DANDELION: + case DARK_OAK_BUTTON: + case DARK_OAK_SAPLING: + case DEAD_BUSH: + case DETECTOR_RAIL: + case DRAGON_HEAD: + case DRAGON_WALL_HEAD: + case END_GATEWAY: + case END_PORTAL: + case END_ROD: + case FERN: case FIRE: - case REDSTONE_WIRE: - case CROPS: + case FLOWER_POT: + case GRASS: + case GRAY_CARPET: + case GREEN_CARPET: + case JUNGLE_BUTTON: + case JUNGLE_SAPLING: case LADDER: - case RAILS: + case LARGE_FERN: case LEVER: - case REDSTONE_TORCH_OFF: - case REDSTONE_TORCH_ON: - case STONE_BUTTON: - case SNOW: - case SUGAR_CANE_BLOCK: - case PORTAL: - case DIODE_BLOCK_OFF: - case DIODE_BLOCK_ON: - case PUMPKIN_STEM: + case LIGHT_BLUE_CARPET: + case LIGHT_GRAY_CARPET: + case LILAC: + case LILY_PAD: + case LIME_CARPET: + case MAGENTA_CARPET: case MELON_STEM: - case VINE: - case WATER_LILY: - case NETHER_WARTS: - case ENDER_PORTAL: - case COCOA: - case TRIPWIRE_HOOK: - case TRIPWIRE: - case FLOWER_POT: - case CARROT: - case POTATO: - case WOOD_BUTTON: - case SKULL: - case REDSTONE_COMPARATOR_OFF: - case REDSTONE_COMPARATOR_ON: - case ACTIVATOR_RAIL: - case CARPET: - case DOUBLE_PLANT: - case END_ROD: - case CHORUS_PLANT: - case CHORUS_FLOWER: - case BEETROOT_BLOCK: - case END_GATEWAY: + case NETHER_PORTAL: + case NETHER_WART: + case OAK_BUTTON: + case OAK_SAPLING: + case ORANGE_CARPET: + case ORANGE_TULIP: + case OXEYE_DAISY: + case PEONY: + case PINK_CARPET: + case PINK_TULIP: + case PLAYER_HEAD: + case PLAYER_WALL_HEAD: + case POPPY: + case POTATOES: + case POTTED_ACACIA_SAPLING: + case POTTED_ALLIUM: + case POTTED_AZURE_BLUET: + case POTTED_BIRCH_SAPLING: + case POTTED_BLUE_ORCHID: + case POTTED_BROWN_MUSHROOM: + case POTTED_CACTUS: + case POTTED_DANDELION: + case POTTED_DARK_OAK_SAPLING: + case POTTED_DEAD_BUSH: + case POTTED_FERN: + case POTTED_JUNGLE_SAPLING: + case POTTED_OAK_SAPLING: + case POTTED_ORANGE_TULIP: + case POTTED_OXEYE_DAISY: + case POTTED_PINK_TULIP: + case POTTED_POPPY: + case POTTED_RED_MUSHROOM: + case POTTED_RED_TULIP: + case POTTED_SPRUCE_SAPLING: + case POTTED_WHITE_TULIP: + case POWERED_RAIL: + case PUMPKIN_STEM: + case PURPLE_CARPET: + case RAIL: + case REDSTONE_TORCH: + case REDSTONE_WALL_TORCH: + case REDSTONE_WIRE: + case RED_CARPET: + case RED_MUSHROOM: + case RED_TULIP: + case REPEATER: + case ROSE_BUSH: + case SKELETON_SKULL: + case SKELETON_WALL_SKULL: + case SNOW: + case SPRUCE_BUTTON: + case SPRUCE_SAPLING: + case STONE_BUTTON: case STRUCTURE_VOID: + case SUGAR_CANE: + case SUNFLOWER: + case TALL_GRASS: + case TORCH: + case TRIPWIRE: + case TRIPWIRE_HOOK: + case VINE: + case WALL_TORCH: + case WHEAT: + case WHITE_CARPET: + case WHITE_TULIP: + case WITHER_SKELETON_SKULL: + case WITHER_SKELETON_WALL_SKULL: + case YELLOW_CARPET: + case ZOMBIE_HEAD: + case ZOMBIE_WALL_HEAD: + // ----- Legacy Separator ----- + case LEGACY_AIR: + case LEGACY_SAPLING: + case LEGACY_POWERED_RAIL: + case LEGACY_DETECTOR_RAIL: + case LEGACY_LONG_GRASS: + case LEGACY_DEAD_BUSH: + case LEGACY_YELLOW_FLOWER: + case LEGACY_RED_ROSE: + case LEGACY_BROWN_MUSHROOM: + case LEGACY_RED_MUSHROOM: + case LEGACY_TORCH: + case LEGACY_FIRE: + case LEGACY_REDSTONE_WIRE: + case LEGACY_CROPS: + case LEGACY_LADDER: + case LEGACY_RAILS: + case LEGACY_LEVER: + case LEGACY_REDSTONE_TORCH_OFF: + case LEGACY_REDSTONE_TORCH_ON: + case LEGACY_STONE_BUTTON: + case LEGACY_SNOW: + case LEGACY_SUGAR_CANE_BLOCK: + case LEGACY_PORTAL: + case LEGACY_DIODE_BLOCK_OFF: + case LEGACY_DIODE_BLOCK_ON: + case LEGACY_PUMPKIN_STEM: + case LEGACY_MELON_STEM: + case LEGACY_VINE: + case LEGACY_WATER_LILY: + case LEGACY_NETHER_WARTS: + case LEGACY_ENDER_PORTAL: + case LEGACY_COCOA: + case LEGACY_TRIPWIRE_HOOK: + case LEGACY_TRIPWIRE: + case LEGACY_FLOWER_POT: + case LEGACY_CARROT: + case LEGACY_POTATO: + case LEGACY_WOOD_BUTTON: + case LEGACY_SKULL: + case LEGACY_REDSTONE_COMPARATOR_OFF: + case LEGACY_REDSTONE_COMPARATOR_ON: + case LEGACY_ACTIVATOR_RAIL: + case LEGACY_CARPET: + case LEGACY_DOUBLE_PLANT: + case LEGACY_END_ROD: + case LEGACY_CHORUS_PLANT: + case LEGACY_CHORUS_FLOWER: + case LEGACY_BEETROOT_BLOCK: + case LEGACY_END_GATEWAY: + case LEGACY_STRUCTURE_VOID: + //</editor-fold> return true; default: return false; @@ -1065,61 +3657,245 @@ public enum Material { return false; } switch (this) { - case WOOD: - case LOG: - case LEAVES: - case NOTE_BLOCK: - case BED_BLOCK: - case LONG_GRASS: - case DEAD_BUSH: - case WOOL: - case TNT: - case BOOKSHELF: - case WOOD_STAIRS: - case CHEST: - case WORKBENCH: - case SIGN_POST: - case WOODEN_DOOR: - case WALL_SIGN: - case WOOD_PLATE: - case JUKEBOX: - case FENCE: - case TRAP_DOOR: - case HUGE_MUSHROOM_1: - case HUGE_MUSHROOM_2: - case VINE: - case FENCE_GATE: - case WOOD_DOUBLE_STEP: - case WOOD_STEP: - case SPRUCE_WOOD_STAIRS: - case BIRCH_WOOD_STAIRS: - case JUNGLE_WOOD_STAIRS: - case TRAPPED_CHEST: - case DAYLIGHT_DETECTOR: - case CARPET: - case LEAVES_2: - case LOG_2: + //<editor-fold defaultstate="collapsed" desc="isFlammable"> + case ACACIA_DOOR: + case ACACIA_FENCE: + case ACACIA_FENCE_GATE: + case ACACIA_LEAVES: + case ACACIA_LOG: + case ACACIA_PLANKS: + case ACACIA_PRESSURE_PLATE: + case ACACIA_SLAB: case ACACIA_STAIRS: - case DARK_OAK_STAIRS: - case DOUBLE_PLANT: - case SPRUCE_FENCE_GATE: + case ACACIA_TRAPDOOR: + case ACACIA_WOOD: + case BIRCH_DOOR: + case BIRCH_FENCE: case BIRCH_FENCE_GATE: - case JUNGLE_FENCE_GATE: + case BIRCH_LEAVES: + case BIRCH_LOG: + case BIRCH_PLANKS: + case BIRCH_PRESSURE_PLATE: + case BIRCH_SLAB: + case BIRCH_STAIRS: + case BIRCH_TRAPDOOR: + case BIRCH_WOOD: + case BLACK_BANNER: + case BLACK_BED: + case BLACK_CARPET: + case BLACK_WALL_BANNER: + case BLACK_WOOL: + case BLUE_BANNER: + case BLUE_BED: + case BLUE_CARPET: + case BLUE_WALL_BANNER: + case BLUE_WOOL: + case BOOKSHELF: + case BROWN_BANNER: + case BROWN_BED: + case BROWN_CARPET: + case BROWN_MUSHROOM_BLOCK: + case BROWN_WALL_BANNER: + case BROWN_WOOL: + case CHEST: + case CRAFTING_TABLE: + case CYAN_BANNER: + case CYAN_BED: + case CYAN_CARPET: + case CYAN_WALL_BANNER: + case CYAN_WOOL: + case DARK_OAK_DOOR: + case DARK_OAK_FENCE: case DARK_OAK_FENCE_GATE: - case ACACIA_FENCE_GATE: - case SPRUCE_FENCE: - case BIRCH_FENCE: + case DARK_OAK_LEAVES: + case DARK_OAK_LOG: + case DARK_OAK_PLANKS: + case DARK_OAK_PRESSURE_PLATE: + case DARK_OAK_SLAB: + case DARK_OAK_STAIRS: + case DARK_OAK_TRAPDOOR: + case DARK_OAK_WOOD: + case DAYLIGHT_DETECTOR: + case DEAD_BUSH: + case FERN: + case GRASS: + case GRAY_BANNER: + case GRAY_BED: + case GRAY_CARPET: + case GRAY_WALL_BANNER: + case GRAY_WOOL: + case GREEN_BANNER: + case GREEN_BED: + case GREEN_CARPET: + case GREEN_WALL_BANNER: + case GREEN_WOOL: + case JUKEBOX: + case JUNGLE_DOOR: case JUNGLE_FENCE: - case DARK_OAK_FENCE: - case ACACIA_FENCE: - case STANDING_BANNER: - case WALL_BANNER: - case DAYLIGHT_DETECTOR_INVERTED: + case JUNGLE_FENCE_GATE: + case JUNGLE_LEAVES: + case JUNGLE_LOG: + case JUNGLE_PLANKS: + case JUNGLE_PRESSURE_PLATE: + case JUNGLE_SLAB: + case JUNGLE_STAIRS: + case JUNGLE_TRAPDOOR: + case JUNGLE_WOOD: + case LARGE_FERN: + case LIGHT_BLUE_BANNER: + case LIGHT_BLUE_BED: + case LIGHT_BLUE_CARPET: + case LIGHT_BLUE_WALL_BANNER: + case LIGHT_BLUE_WOOL: + case LIGHT_GRAY_BANNER: + case LIGHT_GRAY_BED: + case LIGHT_GRAY_CARPET: + case LIGHT_GRAY_WALL_BANNER: + case LIGHT_GRAY_WOOL: + case LILAC: + case LIME_BANNER: + case LIME_BED: + case LIME_CARPET: + case LIME_WALL_BANNER: + case LIME_WOOL: + case MAGENTA_BANNER: + case MAGENTA_BED: + case MAGENTA_CARPET: + case MAGENTA_WALL_BANNER: + case MAGENTA_WOOL: + case MUSHROOM_STEM: + case NOTE_BLOCK: + case OAK_DOOR: + case OAK_FENCE: + case OAK_FENCE_GATE: + case OAK_LEAVES: + case OAK_LOG: + case OAK_PLANKS: + case OAK_PRESSURE_PLATE: + case OAK_SLAB: + case OAK_STAIRS: + case OAK_TRAPDOOR: + case OAK_WOOD: + case ORANGE_BANNER: + case ORANGE_BED: + case ORANGE_CARPET: + case ORANGE_WALL_BANNER: + case ORANGE_WOOL: + case PEONY: + case PINK_BANNER: + case PINK_BED: + case PINK_CARPET: + case PINK_WALL_BANNER: + case PINK_WOOL: + case PURPLE_BANNER: + case PURPLE_BED: + case PURPLE_CARPET: + case PURPLE_WALL_BANNER: + case PURPLE_WOOL: + case RED_BANNER: + case RED_BED: + case RED_CARPET: + case RED_MUSHROOM_BLOCK: + case RED_WALL_BANNER: + case RED_WOOL: + case ROSE_BUSH: + case SIGN: case SPRUCE_DOOR: - case BIRCH_DOOR: - case JUNGLE_DOOR: - case ACACIA_DOOR: - case DARK_OAK_DOOR: + case SPRUCE_FENCE: + case SPRUCE_FENCE_GATE: + case SPRUCE_LEAVES: + case SPRUCE_LOG: + case SPRUCE_PLANKS: + case SPRUCE_PRESSURE_PLATE: + case SPRUCE_SLAB: + case SPRUCE_STAIRS: + case SPRUCE_TRAPDOOR: + case SPRUCE_WOOD: + case STRIPPED_ACACIA_LOG: + case STRIPPED_ACACIA_WOOD: + case STRIPPED_BIRCH_LOG: + case STRIPPED_BIRCH_WOOD: + case STRIPPED_DARK_OAK_LOG: + case STRIPPED_DARK_OAK_WOOD: + case STRIPPED_JUNGLE_LOG: + case STRIPPED_JUNGLE_WOOD: + case STRIPPED_OAK_LOG: + case STRIPPED_OAK_WOOD: + case STRIPPED_SPRUCE_LOG: + case STRIPPED_SPRUCE_WOOD: + case SUNFLOWER: + case TALL_GRASS: + case TNT: + case TRAPPED_CHEST: + case VINE: + case WALL_SIGN: + case WHITE_BANNER: + case WHITE_BED: + case WHITE_CARPET: + case WHITE_WALL_BANNER: + case WHITE_WOOL: + case YELLOW_BANNER: + case YELLOW_BED: + case YELLOW_CARPET: + case YELLOW_WALL_BANNER: + case YELLOW_WOOL: + // ----- Legacy Separator ----- + case LEGACY_WOOD: + case LEGACY_LOG: + case LEGACY_LEAVES: + case LEGACY_NOTE_BLOCK: + case LEGACY_BED_BLOCK: + case LEGACY_LONG_GRASS: + case LEGACY_DEAD_BUSH: + case LEGACY_WOOL: + case LEGACY_TNT: + case LEGACY_BOOKSHELF: + case LEGACY_WOOD_STAIRS: + case LEGACY_CHEST: + case LEGACY_WORKBENCH: + case LEGACY_SIGN_POST: + case LEGACY_WOODEN_DOOR: + case LEGACY_WALL_SIGN: + case LEGACY_WOOD_PLATE: + case LEGACY_JUKEBOX: + case LEGACY_FENCE: + case LEGACY_TRAP_DOOR: + case LEGACY_HUGE_MUSHROOM_1: + case LEGACY_HUGE_MUSHROOM_2: + case LEGACY_VINE: + case LEGACY_FENCE_GATE: + case LEGACY_WOOD_DOUBLE_STEP: + case LEGACY_WOOD_STEP: + case LEGACY_SPRUCE_WOOD_STAIRS: + case LEGACY_BIRCH_WOOD_STAIRS: + case LEGACY_JUNGLE_WOOD_STAIRS: + case LEGACY_TRAPPED_CHEST: + case LEGACY_DAYLIGHT_DETECTOR: + case LEGACY_CARPET: + case LEGACY_LEAVES_2: + case LEGACY_LOG_2: + case LEGACY_ACACIA_STAIRS: + case LEGACY_DARK_OAK_STAIRS: + case LEGACY_DOUBLE_PLANT: + case LEGACY_SPRUCE_FENCE_GATE: + case LEGACY_BIRCH_FENCE_GATE: + case LEGACY_JUNGLE_FENCE_GATE: + case LEGACY_DARK_OAK_FENCE_GATE: + case LEGACY_ACACIA_FENCE_GATE: + case LEGACY_SPRUCE_FENCE: + case LEGACY_BIRCH_FENCE: + case LEGACY_JUNGLE_FENCE: + case LEGACY_DARK_OAK_FENCE: + case LEGACY_ACACIA_FENCE: + case LEGACY_STANDING_BANNER: + case LEGACY_WALL_BANNER: + case LEGACY_DAYLIGHT_DETECTOR_INVERTED: + case LEGACY_SPRUCE_DOOR: + case LEGACY_BIRCH_DOOR: + case LEGACY_JUNGLE_DOOR: + case LEGACY_ACACIA_DOOR: + case LEGACY_DARK_OAK_DOOR: + //</editor-fold> return true; default: return false; @@ -1136,43 +3912,163 @@ public enum Material { return false; } switch (this) { - case WOOD: - case LOG: - case LEAVES: - case LONG_GRASS: - case WOOL: - case YELLOW_FLOWER: - case RED_ROSE: - case TNT: + //<editor-fold defaultstate="collapsed" desc="isBurnable"> + case ACACIA_FENCE: + case ACACIA_FENCE_GATE: + case ACACIA_LEAVES: + case ACACIA_LOG: + case ACACIA_PLANKS: + case ACACIA_SLAB: + case ACACIA_STAIRS: + case ACACIA_WOOD: + case ALLIUM: + case AZURE_BLUET: + case BIRCH_FENCE: + case BIRCH_FENCE_GATE: + case BIRCH_LEAVES: + case BIRCH_LOG: + case BIRCH_PLANKS: + case BIRCH_SLAB: + case BIRCH_STAIRS: + case BIRCH_WOOD: + case BLACK_CARPET: + case BLACK_WOOL: + case BLUE_CARPET: + case BLUE_ORCHID: + case BLUE_WOOL: case BOOKSHELF: - case WOOD_STAIRS: - case FENCE: - case VINE: - case WOOD_DOUBLE_STEP: - case WOOD_STEP: - case SPRUCE_WOOD_STAIRS: - case BIRCH_WOOD_STAIRS: - case JUNGLE_WOOD_STAIRS: - case HAY_BLOCK: + case BROWN_CARPET: + case BROWN_WOOL: case COAL_BLOCK: - case LEAVES_2: - case LOG_2: - case CARPET: - case DOUBLE_PLANT: + case CYAN_CARPET: + case CYAN_WOOL: + case DANDELION: + case DARK_OAK_FENCE: + case DARK_OAK_FENCE_GATE: + case DARK_OAK_LEAVES: + case DARK_OAK_LOG: + case DARK_OAK_PLANKS: + case DARK_OAK_SLAB: + case DARK_OAK_STAIRS: + case DARK_OAK_WOOD: case DEAD_BUSH: - case FENCE_GATE: - case SPRUCE_FENCE_GATE: - case BIRCH_FENCE_GATE: + case DRIED_KELP_BLOCK: + case FERN: + case GRASS: + case GRAY_CARPET: + case GRAY_WOOL: + case GREEN_CARPET: + case GREEN_WOOL: + case HAY_BLOCK: + case JUNGLE_FENCE: case JUNGLE_FENCE_GATE: - case DARK_OAK_FENCE_GATE: - case ACACIA_FENCE_GATE: + case JUNGLE_LEAVES: + case JUNGLE_LOG: + case JUNGLE_PLANKS: + case JUNGLE_SLAB: + case JUNGLE_STAIRS: + case JUNGLE_WOOD: + case LARGE_FERN: + case LIGHT_BLUE_CARPET: + case LIGHT_BLUE_WOOL: + case LIGHT_GRAY_CARPET: + case LIGHT_GRAY_WOOL: + case LILAC: + case LIME_CARPET: + case LIME_WOOL: + case MAGENTA_CARPET: + case MAGENTA_WOOL: + case OAK_FENCE: + case OAK_FENCE_GATE: + case OAK_LEAVES: + case OAK_LOG: + case OAK_PLANKS: + case OAK_SLAB: + case OAK_STAIRS: + case OAK_WOOD: + case ORANGE_CARPET: + case ORANGE_TULIP: + case ORANGE_WOOL: + case OXEYE_DAISY: + case PEONY: + case PINK_CARPET: + case PINK_TULIP: + case PINK_WOOL: + case POPPY: + case PURPLE_CARPET: + case PURPLE_WOOL: + case RED_CARPET: + case RED_TULIP: + case RED_WOOL: + case ROSE_BUSH: case SPRUCE_FENCE: - case BIRCH_FENCE: - case JUNGLE_FENCE: - case DARK_OAK_FENCE: - case ACACIA_FENCE: - case ACACIA_STAIRS: - case DARK_OAK_STAIRS: + case SPRUCE_FENCE_GATE: + case SPRUCE_LEAVES: + case SPRUCE_LOG: + case SPRUCE_PLANKS: + case SPRUCE_SLAB: + case SPRUCE_STAIRS: + case SPRUCE_WOOD: + case STRIPPED_ACACIA_LOG: + case STRIPPED_ACACIA_WOOD: + case STRIPPED_BIRCH_LOG: + case STRIPPED_BIRCH_WOOD: + case STRIPPED_DARK_OAK_LOG: + case STRIPPED_DARK_OAK_WOOD: + case STRIPPED_JUNGLE_LOG: + case STRIPPED_JUNGLE_WOOD: + case STRIPPED_OAK_LOG: + case STRIPPED_OAK_WOOD: + case STRIPPED_SPRUCE_LOG: + case STRIPPED_SPRUCE_WOOD: + case SUNFLOWER: + case TALL_GRASS: + case TNT: + case VINE: + case WHITE_CARPET: + case WHITE_TULIP: + case WHITE_WOOL: + case YELLOW_CARPET: + case YELLOW_WOOL: + // ----- Legacy Separator ----- + case LEGACY_WOOD: + case LEGACY_LOG: + case LEGACY_LEAVES: + case LEGACY_LONG_GRASS: + case LEGACY_WOOL: + case LEGACY_YELLOW_FLOWER: + case LEGACY_RED_ROSE: + case LEGACY_TNT: + case LEGACY_BOOKSHELF: + case LEGACY_WOOD_STAIRS: + case LEGACY_FENCE: + case LEGACY_VINE: + case LEGACY_WOOD_DOUBLE_STEP: + case LEGACY_WOOD_STEP: + case LEGACY_SPRUCE_WOOD_STAIRS: + case LEGACY_BIRCH_WOOD_STAIRS: + case LEGACY_JUNGLE_WOOD_STAIRS: + case LEGACY_HAY_BLOCK: + case LEGACY_COAL_BLOCK: + case LEGACY_LEAVES_2: + case LEGACY_LOG_2: + case LEGACY_CARPET: + case LEGACY_DOUBLE_PLANT: + case LEGACY_DEAD_BUSH: + case LEGACY_FENCE_GATE: + case LEGACY_SPRUCE_FENCE_GATE: + case LEGACY_BIRCH_FENCE_GATE: + case LEGACY_JUNGLE_FENCE_GATE: + case LEGACY_DARK_OAK_FENCE_GATE: + case LEGACY_ACACIA_FENCE_GATE: + case LEGACY_SPRUCE_FENCE: + case LEGACY_BIRCH_FENCE: + case LEGACY_JUNGLE_FENCE: + case LEGACY_DARK_OAK_FENCE: + case LEGACY_ACACIA_FENCE: + case LEGACY_ACACIA_STAIRS: + case LEGACY_DARK_OAK_STAIRS: + //</editor-fold> return true; default: return false; @@ -1186,71 +4082,234 @@ public enum Material { */ public boolean isFuel() { switch (this) { - case LAVA_BUCKET: - case COAL_BLOCK: - case BLAZE_ROD: - case COAL: - case BOAT: - case BOAT_ACACIA: - case BOAT_BIRCH: - case BOAT_DARK_OAK: - case BOAT_JUNGLE: - case BOAT_SPRUCE: - case LOG: - case LOG_2: - case WOOD: - case WOOD_PLATE: - case FENCE: + //<editor-fold defaultstate="collapsed" desc="isFuel"> + case ACACIA_BOAT: + case ACACIA_BUTTON: + case ACACIA_DOOR: case ACACIA_FENCE: - case BIRCH_FENCE: - case DARK_OAK_FENCE: - case JUNGLE_FENCE: - case SPRUCE_FENCE: - case FENCE_GATE: case ACACIA_FENCE_GATE: - case BIRCH_FENCE_GATE: - case DARK_OAK_FENCE_GATE: - case JUNGLE_FENCE_GATE: - case SPRUCE_FENCE_GATE: - case WOOD_STAIRS: + case ACACIA_LOG: + case ACACIA_PLANKS: + case ACACIA_PRESSURE_PLATE: + case ACACIA_SAPLING: + case ACACIA_SLAB: case ACACIA_STAIRS: - case BIRCH_WOOD_STAIRS: - case DARK_OAK_STAIRS: - case JUNGLE_WOOD_STAIRS: - case SPRUCE_WOOD_STAIRS: - case TRAP_DOOR: - case WORKBENCH: + case ACACIA_TRAPDOOR: + case ACACIA_WOOD: + case BIRCH_BOAT: + case BIRCH_BUTTON: + case BIRCH_DOOR: + case BIRCH_FENCE: + case BIRCH_FENCE_GATE: + case BIRCH_LOG: + case BIRCH_PLANKS: + case BIRCH_PRESSURE_PLATE: + case BIRCH_SAPLING: + case BIRCH_SLAB: + case BIRCH_STAIRS: + case BIRCH_TRAPDOOR: + case BIRCH_WOOD: + case BLACK_BANNER: + case BLACK_CARPET: + case BLACK_WOOL: + case BLAZE_ROD: + case BLUE_BANNER: + case BLUE_CARPET: + case BLUE_WOOL: case BOOKSHELF: + case BOW: + case BOWL: + case BROWN_BANNER: + case BROWN_CARPET: + case BROWN_WOOL: + case CHARCOAL: case CHEST: - case TRAPPED_CHEST: + case COAL: + case COAL_BLOCK: + case CRAFTING_TABLE: + case CYAN_BANNER: + case CYAN_CARPET: + case CYAN_WOOL: + case DARK_OAK_BOAT: + case DARK_OAK_BUTTON: + case DARK_OAK_DOOR: + case DARK_OAK_FENCE: + case DARK_OAK_FENCE_GATE: + case DARK_OAK_LOG: + case DARK_OAK_PLANKS: + case DARK_OAK_PRESSURE_PLATE: + case DARK_OAK_SAPLING: + case DARK_OAK_SLAB: + case DARK_OAK_STAIRS: + case DARK_OAK_TRAPDOOR: + case DARK_OAK_WOOD: case DAYLIGHT_DETECTOR: - case JUKEBOX: - case NOTE_BLOCK: - case HUGE_MUSHROOM_1: - case HUGE_MUSHROOM_2: - case BANNER: + case DRIED_KELP_BLOCK: case FISHING_ROD: + case GRAY_BANNER: + case GRAY_CARPET: + case GRAY_WOOL: + case GREEN_BANNER: + case GREEN_CARPET: + case GREEN_WOOL: + case JUKEBOX: + case JUNGLE_BOAT: + case JUNGLE_BUTTON: + case JUNGLE_DOOR: + case JUNGLE_FENCE: + case JUNGLE_FENCE_GATE: + case JUNGLE_LOG: + case JUNGLE_PLANKS: + case JUNGLE_PRESSURE_PLATE: + case JUNGLE_SAPLING: + case JUNGLE_SLAB: + case JUNGLE_STAIRS: + case JUNGLE_TRAPDOOR: + case JUNGLE_WOOD: case LADDER: - case WOOD_SWORD: - case WOOD_PICKAXE: - case WOOD_AXE: - case WOOD_SPADE: - case WOOD_HOE: - case BOW: + case LAVA_BUCKET: + case LIGHT_BLUE_BANNER: + case LIGHT_BLUE_CARPET: + case LIGHT_BLUE_WOOL: + case LIGHT_GRAY_BANNER: + case LIGHT_GRAY_CARPET: + case LIGHT_GRAY_WOOL: + case LIME_BANNER: + case LIME_CARPET: + case LIME_WOOL: + case MAGENTA_BANNER: + case MAGENTA_CARPET: + case MAGENTA_WOOL: + case NOTE_BLOCK: + case OAK_BOAT: + case OAK_BUTTON: + case OAK_DOOR: + case OAK_FENCE: + case OAK_FENCE_GATE: + case OAK_LOG: + case OAK_PLANKS: + case OAK_PRESSURE_PLATE: + case OAK_SAPLING: + case OAK_SLAB: + case OAK_STAIRS: + case OAK_TRAPDOOR: + case OAK_WOOD: + case ORANGE_BANNER: + case ORANGE_CARPET: + case ORANGE_WOOL: + case PINK_BANNER: + case PINK_CARPET: + case PINK_WOOL: + case PURPLE_BANNER: + case PURPLE_CARPET: + case PURPLE_WOOL: + case RED_BANNER: + case RED_CARPET: + case RED_WOOL: case SIGN: - case WOOD_DOOR: - case ACACIA_DOOR_ITEM: - case BIRCH_DOOR_ITEM: - case DARK_OAK_DOOR_ITEM: - case JUNGLE_DOOR_ITEM: - case SPRUCE_DOOR_ITEM: - case WOOD_STEP: - case SAPLING: - case BOWL: + case SPRUCE_BOAT: + case SPRUCE_BUTTON: + case SPRUCE_DOOR: + case SPRUCE_FENCE: + case SPRUCE_FENCE_GATE: + case SPRUCE_LOG: + case SPRUCE_PLANKS: + case SPRUCE_PRESSURE_PLATE: + case SPRUCE_SAPLING: + case SPRUCE_SLAB: + case SPRUCE_STAIRS: + case SPRUCE_TRAPDOOR: + case SPRUCE_WOOD: case STICK: - case WOOD_BUTTON: - case WOOL: - case CARPET: + case STRIPPED_ACACIA_LOG: + case STRIPPED_ACACIA_WOOD: + case STRIPPED_BIRCH_LOG: + case STRIPPED_BIRCH_WOOD: + case STRIPPED_DARK_OAK_LOG: + case STRIPPED_DARK_OAK_WOOD: + case STRIPPED_JUNGLE_LOG: + case STRIPPED_JUNGLE_WOOD: + case STRIPPED_OAK_LOG: + case STRIPPED_OAK_WOOD: + case STRIPPED_SPRUCE_LOG: + case STRIPPED_SPRUCE_WOOD: + case TRAPPED_CHEST: + case WHITE_BANNER: + case WHITE_CARPET: + case WHITE_WOOL: + case WOODEN_AXE: + case WOODEN_HOE: + case WOODEN_PICKAXE: + case WOODEN_SHOVEL: + case WOODEN_SWORD: + case YELLOW_BANNER: + case YELLOW_CARPET: + case YELLOW_WOOL: + // ----- Legacy Separator ----- + case LEGACY_LAVA_BUCKET: + case LEGACY_COAL_BLOCK: + case LEGACY_BLAZE_ROD: + case LEGACY_COAL: + case LEGACY_BOAT: + case LEGACY_BOAT_ACACIA: + case LEGACY_BOAT_BIRCH: + case LEGACY_BOAT_DARK_OAK: + case LEGACY_BOAT_JUNGLE: + case LEGACY_BOAT_SPRUCE: + case LEGACY_LOG: + case LEGACY_LOG_2: + case LEGACY_WOOD: + case LEGACY_WOOD_PLATE: + case LEGACY_FENCE: + case LEGACY_ACACIA_FENCE: + case LEGACY_BIRCH_FENCE: + case LEGACY_DARK_OAK_FENCE: + case LEGACY_JUNGLE_FENCE: + case LEGACY_SPRUCE_FENCE: + case LEGACY_FENCE_GATE: + case LEGACY_ACACIA_FENCE_GATE: + case LEGACY_BIRCH_FENCE_GATE: + case LEGACY_DARK_OAK_FENCE_GATE: + case LEGACY_JUNGLE_FENCE_GATE: + case LEGACY_SPRUCE_FENCE_GATE: + case LEGACY_WOOD_STAIRS: + case LEGACY_ACACIA_STAIRS: + case LEGACY_BIRCH_WOOD_STAIRS: + case LEGACY_DARK_OAK_STAIRS: + case LEGACY_JUNGLE_WOOD_STAIRS: + case LEGACY_SPRUCE_WOOD_STAIRS: + case LEGACY_TRAP_DOOR: + case LEGACY_WORKBENCH: + case LEGACY_BOOKSHELF: + case LEGACY_CHEST: + case LEGACY_TRAPPED_CHEST: + case LEGACY_DAYLIGHT_DETECTOR: + case LEGACY_JUKEBOX: + case LEGACY_NOTE_BLOCK: + case LEGACY_BANNER: + case LEGACY_FISHING_ROD: + case LEGACY_LADDER: + case LEGACY_WOOD_SWORD: + case LEGACY_WOOD_PICKAXE: + case LEGACY_WOOD_AXE: + case LEGACY_WOOD_SPADE: + case LEGACY_WOOD_HOE: + case LEGACY_BOW: + case LEGACY_SIGN: + case LEGACY_WOOD_DOOR: + case LEGACY_ACACIA_DOOR_ITEM: + case LEGACY_BIRCH_DOOR_ITEM: + case LEGACY_DARK_OAK_DOOR_ITEM: + case LEGACY_JUNGLE_DOOR_ITEM: + case LEGACY_SPRUCE_DOOR_ITEM: + case LEGACY_WOOD_STEP: + case LEGACY_SAPLING: + case LEGACY_STICK: + case LEGACY_WOOD_BUTTON: + case LEGACY_WOOL: + case LEGACY_CARPET: + case LEGACY_BOWL: + //</editor-fold> return true; default: return false; @@ -1267,104 +4326,329 @@ public enum Material { return false; } switch (this) { - case STONE: - case GRASS: - case DIRT: - case COBBLESTONE: - case WOOD: + //<editor-fold defaultstate="collapsed" desc="isOccluding"> + case ACACIA_LOG: + case ACACIA_PLANKS: + case ACACIA_WOOD: + case ANDESITE: + case BARRIER: case BEDROCK: - case SAND: - case GRAVEL: - case GOLD_ORE: - case IRON_ORE: + case BIRCH_LOG: + case BIRCH_PLANKS: + case BIRCH_WOOD: + case BLACK_CONCRETE: + case BLACK_CONCRETE_POWDER: + case BLACK_GLAZED_TERRACOTTA: + case BLACK_TERRACOTTA: + case BLACK_WOOL: + case BLUE_CONCRETE: + case BLUE_CONCRETE_POWDER: + case BLUE_GLAZED_TERRACOTTA: + case BLUE_ICE: + case BLUE_TERRACOTTA: + case BLUE_WOOL: + case BONE_BLOCK: + case BOOKSHELF: + case BRAIN_CORAL_BLOCK: + case BRICKS: + case BROWN_CONCRETE: + case BROWN_CONCRETE_POWDER: + case BROWN_GLAZED_TERRACOTTA: + case BROWN_MUSHROOM_BLOCK: + case BROWN_TERRACOTTA: + case BROWN_WOOL: + case BUBBLE_CORAL_BLOCK: + case CARVED_PUMPKIN: + case CHAIN_COMMAND_BLOCK: + case CHISELED_QUARTZ_BLOCK: + case CHISELED_RED_SANDSTONE: + case CHISELED_SANDSTONE: + case CHISELED_STONE_BRICKS: + case CLAY: + case COAL_BLOCK: case COAL_ORE: - case LOG: - case SPONGE: - case LAPIS_ORE: - case LAPIS_BLOCK: + case COARSE_DIRT: + case COBBLESTONE: + case COMMAND_BLOCK: + case CRACKED_STONE_BRICKS: + case CRAFTING_TABLE: + case CUT_RED_SANDSTONE: + case CUT_SANDSTONE: + case CYAN_CONCRETE: + case CYAN_CONCRETE_POWDER: + case CYAN_GLAZED_TERRACOTTA: + case CYAN_TERRACOTTA: + case CYAN_WOOL: + case DARK_OAK_LOG: + case DARK_OAK_PLANKS: + case DARK_OAK_WOOD: + case DARK_PRISMARINE: + case DEAD_BRAIN_CORAL_BLOCK: + case DEAD_BUBBLE_CORAL_BLOCK: + case DEAD_FIRE_CORAL_BLOCK: + case DEAD_HORN_CORAL_BLOCK: + case DEAD_TUBE_CORAL_BLOCK: + case DIAMOND_BLOCK: + case DIAMOND_ORE: + case DIORITE: + case DIRT: case DISPENSER: - case SANDSTONE: - case NOTE_BLOCK: - case WOOL: + case DRIED_KELP_BLOCK: + case DROPPER: + case EMERALD_BLOCK: + case EMERALD_ORE: + case END_STONE: + case END_STONE_BRICKS: + case FIRE_CORAL_BLOCK: + case FURNACE: case GOLD_BLOCK: + case GOLD_ORE: + case GRANITE: + case GRASS_BLOCK: + case GRAVEL: + case GRAY_CONCRETE: + case GRAY_CONCRETE_POWDER: + case GRAY_GLAZED_TERRACOTTA: + case GRAY_TERRACOTTA: + case GRAY_WOOL: + case GREEN_CONCRETE: + case GREEN_CONCRETE_POWDER: + case GREEN_GLAZED_TERRACOTTA: + case GREEN_TERRACOTTA: + case GREEN_WOOL: + case HAY_BLOCK: + case HORN_CORAL_BLOCK: + case INFESTED_CHISELED_STONE_BRICKS: + case INFESTED_COBBLESTONE: + case INFESTED_CRACKED_STONE_BRICKS: + case INFESTED_MOSSY_STONE_BRICKS: + case INFESTED_STONE: + case INFESTED_STONE_BRICKS: case IRON_BLOCK: - case DOUBLE_STEP: - case BRICK: - case BOOKSHELF: - case MOSSY_COBBLESTONE: - case OBSIDIAN: - case MOB_SPAWNER: - case DIAMOND_ORE: - case DIAMOND_BLOCK: - case WORKBENCH: - case FURNACE: - case BURNING_FURNACE: - case REDSTONE_ORE: - case GLOWING_REDSTONE_ORE: - case SNOW_BLOCK: - case CLAY: + case IRON_ORE: + case JACK_O_LANTERN: case JUKEBOX: - case PUMPKIN: + case JUNGLE_LOG: + case JUNGLE_PLANKS: + case JUNGLE_WOOD: + case LAPIS_BLOCK: + case LAPIS_ORE: + case LIGHT_BLUE_CONCRETE: + case LIGHT_BLUE_CONCRETE_POWDER: + case LIGHT_BLUE_GLAZED_TERRACOTTA: + case LIGHT_BLUE_TERRACOTTA: + case LIGHT_BLUE_WOOL: + case LIGHT_GRAY_CONCRETE: + case LIGHT_GRAY_CONCRETE_POWDER: + case LIGHT_GRAY_GLAZED_TERRACOTTA: + case LIGHT_GRAY_TERRACOTTA: + case LIGHT_GRAY_WOOL: + case LIME_CONCRETE: + case LIME_CONCRETE_POWDER: + case LIME_GLAZED_TERRACOTTA: + case LIME_TERRACOTTA: + case LIME_WOOL: + case MAGENTA_CONCRETE: + case MAGENTA_CONCRETE_POWDER: + case MAGENTA_GLAZED_TERRACOTTA: + case MAGENTA_TERRACOTTA: + case MAGENTA_WOOL: + case MAGMA_BLOCK: + case MELON: + case MOSSY_COBBLESTONE: + case MOSSY_STONE_BRICKS: + case MUSHROOM_STEM: + case MYCELIUM: case NETHERRACK: - case SOUL_SAND: - case JACK_O_LANTERN: - case MONSTER_EGGS: - case SMOOTH_BRICK: - case HUGE_MUSHROOM_1: - case HUGE_MUSHROOM_2: - case MELON_BLOCK: - case MYCEL: - case NETHER_BRICK: - case ENDER_STONE: - case REDSTONE_LAMP_OFF: - case REDSTONE_LAMP_ON: - case WOOD_DOUBLE_STEP: - case EMERALD_ORE: - case EMERALD_BLOCK: - case COMMAND: - case QUARTZ_ORE: - case QUARTZ_BLOCK: - case DROPPER: - case STAINED_CLAY: - case HAY_BLOCK: - case HARD_CLAY: - case COAL_BLOCK: - case LOG_2: + case NETHER_BRICKS: + case NETHER_QUARTZ_ORE: + case NETHER_WART_BLOCK: + case NOTE_BLOCK: + case OAK_LOG: + case OAK_PLANKS: + case OAK_WOOD: + case OBSIDIAN: + case ORANGE_CONCRETE: + case ORANGE_CONCRETE_POWDER: + case ORANGE_GLAZED_TERRACOTTA: + case ORANGE_TERRACOTTA: + case ORANGE_WOOL: case PACKED_ICE: - case SLIME_BLOCK: - case BARRIER: + case PINK_CONCRETE: + case PINK_CONCRETE_POWDER: + case PINK_GLAZED_TERRACOTTA: + case PINK_TERRACOTTA: + case PINK_WOOL: + case PODZOL: + case POLISHED_ANDESITE: + case POLISHED_DIORITE: + case POLISHED_GRANITE: case PRISMARINE: - case RED_SANDSTONE: - case DOUBLE_STONE_SLAB2: + case PRISMARINE_BRICKS: + case PUMPKIN: + case PURPLE_CONCRETE: + case PURPLE_CONCRETE_POWDER: + case PURPLE_GLAZED_TERRACOTTA: + case PURPLE_TERRACOTTA: + case PURPLE_WOOL: case PURPUR_BLOCK: case PURPUR_PILLAR: - case PURPUR_DOUBLE_SLAB: - case END_BRICKS: + case QUARTZ_BLOCK: + case QUARTZ_PILLAR: + case REDSTONE_LAMP: + case REDSTONE_ORE: + case RED_CONCRETE: + case RED_CONCRETE_POWDER: + case RED_GLAZED_TERRACOTTA: + case RED_MUSHROOM_BLOCK: + case RED_NETHER_BRICKS: + case RED_SAND: + case RED_SANDSTONE: + case RED_TERRACOTTA: + case RED_WOOL: + case REPEATING_COMMAND_BLOCK: + case SAND: + case SANDSTONE: + case SLIME_BLOCK: + case SMOOTH_QUARTZ: + case SMOOTH_RED_SANDSTONE: + case SMOOTH_SANDSTONE: + case SMOOTH_STONE: + case SNOW_BLOCK: + case SOUL_SAND: + case SPAWNER: + case SPONGE: + case SPRUCE_LOG: + case SPRUCE_PLANKS: + case SPRUCE_WOOD: + case STONE: + case STONE_BRICKS: + case STRIPPED_ACACIA_LOG: + case STRIPPED_ACACIA_WOOD: + case STRIPPED_BIRCH_LOG: + case STRIPPED_BIRCH_WOOD: + case STRIPPED_DARK_OAK_LOG: + case STRIPPED_DARK_OAK_WOOD: + case STRIPPED_JUNGLE_LOG: + case STRIPPED_JUNGLE_WOOD: + case STRIPPED_OAK_LOG: + case STRIPPED_OAK_WOOD: + case STRIPPED_SPRUCE_LOG: + case STRIPPED_SPRUCE_WOOD: case STRUCTURE_BLOCK: - case COMMAND_REPEATING: - case COMMAND_CHAIN: - case MAGMA: - case NETHER_WART_BLOCK: - case RED_NETHER_BRICK: - case BONE_BLOCK: + case TERRACOTTA: + case TUBE_CORAL_BLOCK: + case WET_SPONGE: + case WHITE_CONCRETE: + case WHITE_CONCRETE_POWDER: case WHITE_GLAZED_TERRACOTTA: - case ORANGE_GLAZED_TERRACOTTA: - case MAGENTA_GLAZED_TERRACOTTA: - case LIGHT_BLUE_GLAZED_TERRACOTTA: + case WHITE_TERRACOTTA: + case WHITE_WOOL: + case YELLOW_CONCRETE: + case YELLOW_CONCRETE_POWDER: case YELLOW_GLAZED_TERRACOTTA: - case LIME_GLAZED_TERRACOTTA: - case PINK_GLAZED_TERRACOTTA: - case GRAY_GLAZED_TERRACOTTA: - case SILVER_GLAZED_TERRACOTTA: - case CYAN_GLAZED_TERRACOTTA: - case PURPLE_GLAZED_TERRACOTTA: - case BLUE_GLAZED_TERRACOTTA: - case BROWN_GLAZED_TERRACOTTA: - case GREEN_GLAZED_TERRACOTTA: - case RED_GLAZED_TERRACOTTA: - case BLACK_GLAZED_TERRACOTTA: - case CONCRETE: - case CONCRETE_POWDER: + case YELLOW_TERRACOTTA: + case YELLOW_WOOL: + // ----- Legacy Separator ----- + case LEGACY_STONE: + case LEGACY_GRASS: + case LEGACY_DIRT: + case LEGACY_COBBLESTONE: + case LEGACY_WOOD: + case LEGACY_BEDROCK: + case LEGACY_SAND: + case LEGACY_GRAVEL: + case LEGACY_GOLD_ORE: + case LEGACY_IRON_ORE: + case LEGACY_COAL_ORE: + case LEGACY_LOG: + case LEGACY_SPONGE: + case LEGACY_LAPIS_ORE: + case LEGACY_LAPIS_BLOCK: + case LEGACY_DISPENSER: + case LEGACY_SANDSTONE: + case LEGACY_NOTE_BLOCK: + case LEGACY_WOOL: + case LEGACY_GOLD_BLOCK: + case LEGACY_IRON_BLOCK: + case LEGACY_DOUBLE_STEP: + case LEGACY_BRICK: + case LEGACY_BOOKSHELF: + case LEGACY_MOSSY_COBBLESTONE: + case LEGACY_OBSIDIAN: + case LEGACY_MOB_SPAWNER: + case LEGACY_DIAMOND_ORE: + case LEGACY_DIAMOND_BLOCK: + case LEGACY_WORKBENCH: + case LEGACY_FURNACE: + case LEGACY_BURNING_FURNACE: + case LEGACY_REDSTONE_ORE: + case LEGACY_GLOWING_REDSTONE_ORE: + case LEGACY_SNOW_BLOCK: + case LEGACY_CLAY: + case LEGACY_JUKEBOX: + case LEGACY_PUMPKIN: + case LEGACY_NETHERRACK: + case LEGACY_SOUL_SAND: + case LEGACY_JACK_O_LANTERN: + case LEGACY_MONSTER_EGGS: + case LEGACY_SMOOTH_BRICK: + case LEGACY_HUGE_MUSHROOM_1: + case LEGACY_HUGE_MUSHROOM_2: + case LEGACY_MELON_BLOCK: + case LEGACY_MYCEL: + case LEGACY_NETHER_BRICK: + case LEGACY_ENDER_STONE: + case LEGACY_REDSTONE_LAMP_OFF: + case LEGACY_REDSTONE_LAMP_ON: + case LEGACY_WOOD_DOUBLE_STEP: + case LEGACY_EMERALD_ORE: + case LEGACY_EMERALD_BLOCK: + case LEGACY_COMMAND: + case LEGACY_QUARTZ_ORE: + case LEGACY_QUARTZ_BLOCK: + case LEGACY_DROPPER: + case LEGACY_STAINED_CLAY: + case LEGACY_HAY_BLOCK: + case LEGACY_HARD_CLAY: + case LEGACY_COAL_BLOCK: + case LEGACY_LOG_2: + case LEGACY_PACKED_ICE: + case LEGACY_SLIME_BLOCK: + case LEGACY_BARRIER: + case LEGACY_PRISMARINE: + case LEGACY_RED_SANDSTONE: + case LEGACY_DOUBLE_STONE_SLAB2: + case LEGACY_PURPUR_BLOCK: + case LEGACY_PURPUR_PILLAR: + case LEGACY_PURPUR_DOUBLE_SLAB: + case LEGACY_END_BRICKS: + case LEGACY_STRUCTURE_BLOCK: + case LEGACY_COMMAND_REPEATING: + case LEGACY_COMMAND_CHAIN: + case LEGACY_MAGMA: + case LEGACY_NETHER_WART_BLOCK: + case LEGACY_RED_NETHER_BRICK: + case LEGACY_BONE_BLOCK: + case LEGACY_WHITE_GLAZED_TERRACOTTA: + case LEGACY_ORANGE_GLAZED_TERRACOTTA: + case LEGACY_MAGENTA_GLAZED_TERRACOTTA: + case LEGACY_LIGHT_BLUE_GLAZED_TERRACOTTA: + case LEGACY_YELLOW_GLAZED_TERRACOTTA: + case LEGACY_LIME_GLAZED_TERRACOTTA: + case LEGACY_PINK_GLAZED_TERRACOTTA: + case LEGACY_GRAY_GLAZED_TERRACOTTA: + case LEGACY_SILVER_GLAZED_TERRACOTTA: + case LEGACY_CYAN_GLAZED_TERRACOTTA: + case LEGACY_PURPLE_GLAZED_TERRACOTTA: + case LEGACY_BLUE_GLAZED_TERRACOTTA: + case LEGACY_BROWN_GLAZED_TERRACOTTA: + case LEGACY_GREEN_GLAZED_TERRACOTTA: + case LEGACY_RED_GLAZED_TERRACOTTA: + case LEGACY_BLACK_GLAZED_TERRACOTTA: + case LEGACY_CONCRETE: + case LEGACY_CONCRETE_POWDER: + //</editor-fold> return true; default: return false; @@ -1379,10 +4663,36 @@ public enum Material { return false; } switch (this) { - case SAND: - case GRAVEL: + //<editor-fold defaultstate="collapsed" desc="hasGravity"> case ANVIL: - case CONCRETE_POWDER: + case BLACK_CONCRETE_POWDER: + case BLUE_CONCRETE_POWDER: + case BROWN_CONCRETE_POWDER: + case CHIPPED_ANVIL: + case CYAN_CONCRETE_POWDER: + case DAMAGED_ANVIL: + case DRAGON_EGG: + case GRAVEL: + case GRAY_CONCRETE_POWDER: + case GREEN_CONCRETE_POWDER: + case LIGHT_BLUE_CONCRETE_POWDER: + case LIGHT_GRAY_CONCRETE_POWDER: + case LIME_CONCRETE_POWDER: + case MAGENTA_CONCRETE_POWDER: + case ORANGE_CONCRETE_POWDER: + case PINK_CONCRETE_POWDER: + case PURPLE_CONCRETE_POWDER: + case RED_CONCRETE_POWDER: + case RED_SAND: + case SAND: + case WHITE_CONCRETE_POWDER: + case YELLOW_CONCRETE_POWDER: + // ----- Legacy Separator ----- + case LEGACY_SAND: + case LEGACY_GRAVEL: + case LEGACY_ANVIL: + case LEGACY_CONCRETE_POWDER: + //</editor-fold> return true; default: return false; @@ -1396,58 +4706,131 @@ public enum Material { */ public boolean isItem() { switch (this) { - case ACACIA_DOOR: - case BED_BLOCK: - case BEETROOT_BLOCK: - case BIRCH_DOOR: - case BREWING_STAND: - case BURNING_FURNACE: - case CAKE_BLOCK: - case CARROT: - case CAULDRON: + //<editor-fold defaultstate="collapsed" desc="isItem"> + case ATTACHED_MELON_STEM: + case ATTACHED_PUMPKIN_STEM: + case BEETROOTS: + case BLACK_WALL_BANNER: + case BLUE_WALL_BANNER: + case BROWN_WALL_BANNER: + case BUBBLE_COLUMN: + case CARROTS: + case CAVE_AIR: case COCOA: - case CROPS: - case DARK_OAK_DOOR: - case DAYLIGHT_DETECTOR_INVERTED: - case DIODE_BLOCK_OFF: - case DIODE_BLOCK_ON: - case DOUBLE_STEP: - case DOUBLE_STONE_SLAB2: - case ENDER_PORTAL: + case CREEPER_WALL_HEAD: + case CYAN_WALL_BANNER: + case DRAGON_WALL_HEAD: case END_GATEWAY: + case END_PORTAL: case FIRE: - case FLOWER_POT: case FROSTED_ICE: - case GLOWING_REDSTONE_ORE: - case IRON_DOOR_BLOCK: - case JUNGLE_DOOR: + case GRAY_WALL_BANNER: + case GREEN_WALL_BANNER: + case KELP_PLANT: case LAVA: + case LIGHT_BLUE_WALL_BANNER: + case LIGHT_GRAY_WALL_BANNER: + case LIME_WALL_BANNER: + case MAGENTA_WALL_BANNER: case MELON_STEM: - case NETHER_WARTS: - case PISTON_EXTENSION: - case PISTON_MOVING_PIECE: - case PORTAL: - case POTATO: + case MOVING_PISTON: + case NETHER_PORTAL: + case ORANGE_WALL_BANNER: + case PINK_WALL_BANNER: + case PISTON_HEAD: + case PLAYER_WALL_HEAD: + case POTATOES: + case POTTED_ACACIA_SAPLING: + case POTTED_ALLIUM: + case POTTED_AZURE_BLUET: + case POTTED_BIRCH_SAPLING: + case POTTED_BLUE_ORCHID: + case POTTED_BROWN_MUSHROOM: + case POTTED_CACTUS: + case POTTED_DANDELION: + case POTTED_DARK_OAK_SAPLING: + case POTTED_DEAD_BUSH: + case POTTED_FERN: + case POTTED_JUNGLE_SAPLING: + case POTTED_OAK_SAPLING: + case POTTED_ORANGE_TULIP: + case POTTED_OXEYE_DAISY: + case POTTED_PINK_TULIP: + case POTTED_POPPY: + case POTTED_RED_MUSHROOM: + case POTTED_RED_TULIP: + case POTTED_SPRUCE_SAPLING: + case POTTED_WHITE_TULIP: case PUMPKIN_STEM: - case PURPUR_DOUBLE_SLAB: - case REDSTONE_COMPARATOR_OFF: - case REDSTONE_COMPARATOR_ON: - case REDSTONE_LAMP_ON: - case REDSTONE_TORCH_OFF: + case PURPLE_WALL_BANNER: + case REDSTONE_WALL_TORCH: case REDSTONE_WIRE: - case SIGN_POST: - case SKULL: - case SPRUCE_DOOR: - case STANDING_BANNER: - case STATIONARY_LAVA: - case STATIONARY_WATER: - case SUGAR_CANE_BLOCK: + case RED_WALL_BANNER: + case SKELETON_WALL_SKULL: + case TALL_SEAGRASS: case TRIPWIRE: - case WALL_BANNER: + case VOID_AIR: case WALL_SIGN: + case WALL_TORCH: case WATER: - case WOODEN_DOOR: - case WOOD_DOUBLE_STEP: + case WHITE_WALL_BANNER: + case WITHER_SKELETON_WALL_SKULL: + case YELLOW_WALL_BANNER: + case ZOMBIE_WALL_HEAD: + // ----- Legacy Separator ----- + case LEGACY_ACACIA_DOOR: + case LEGACY_BED_BLOCK: + case LEGACY_BEETROOT_BLOCK: + case LEGACY_BIRCH_DOOR: + case LEGACY_BREWING_STAND: + case LEGACY_BURNING_FURNACE: + case LEGACY_CAKE_BLOCK: + case LEGACY_CARROT: + case LEGACY_CAULDRON: + case LEGACY_COCOA: + case LEGACY_CROPS: + case LEGACY_DARK_OAK_DOOR: + case LEGACY_DAYLIGHT_DETECTOR_INVERTED: + case LEGACY_DIODE_BLOCK_OFF: + case LEGACY_DIODE_BLOCK_ON: + case LEGACY_DOUBLE_STEP: + case LEGACY_DOUBLE_STONE_SLAB2: + case LEGACY_ENDER_PORTAL: + case LEGACY_END_GATEWAY: + case LEGACY_FIRE: + case LEGACY_FLOWER_POT: + case LEGACY_FROSTED_ICE: + case LEGACY_GLOWING_REDSTONE_ORE: + case LEGACY_IRON_DOOR_BLOCK: + case LEGACY_JUNGLE_DOOR: + case LEGACY_LAVA: + case LEGACY_MELON_STEM: + case LEGACY_NETHER_WARTS: + case LEGACY_PISTON_EXTENSION: + case LEGACY_PISTON_MOVING_PIECE: + case LEGACY_PORTAL: + case LEGACY_POTATO: + case LEGACY_PUMPKIN_STEM: + case LEGACY_PURPUR_DOUBLE_SLAB: + case LEGACY_REDSTONE_COMPARATOR_OFF: + case LEGACY_REDSTONE_COMPARATOR_ON: + case LEGACY_REDSTONE_LAMP_ON: + case LEGACY_REDSTONE_TORCH_OFF: + case LEGACY_REDSTONE_WIRE: + case LEGACY_SIGN_POST: + case LEGACY_SKULL: + case LEGACY_SPRUCE_DOOR: + case LEGACY_STANDING_BANNER: + case LEGACY_STATIONARY_LAVA: + case LEGACY_STATIONARY_WATER: + case LEGACY_SUGAR_CANE_BLOCK: + case LEGACY_TRIPWIRE: + case LEGACY_WALL_BANNER: + case LEGACY_WALL_SIGN: + case LEGACY_WATER: + case LEGACY_WOODEN_DOOR: + case LEGACY_WOOD_DOUBLE_STEP: + //</editor-fold> return false; default: return true; diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java index 9794c13e..4d0acaf5 100644 --- a/src/main/java/org/bukkit/Particle.java +++ b/src/main/java/org/bukkit/Particle.java @@ -1,5 +1,7 @@ package org.bukkit; +import com.google.common.base.Preconditions; +import org.bukkit.block.data.BlockData; import org.bukkit.inventory.ItemStack; import org.bukkit.material.MaterialData; @@ -32,27 +34,35 @@ public enum Particle { ENCHANTMENT_TABLE, FLAME, LAVA, - FOOTSTEP, CLOUD, - REDSTONE, + REDSTONE(DustOptions.class), SNOWBALL, SNOW_SHOVEL, SLIME, HEART, BARRIER, ITEM_CRACK(ItemStack.class), - BLOCK_CRACK(MaterialData.class), - BLOCK_DUST(MaterialData.class), + BLOCK_CRACK(BlockData.class), + BLOCK_DUST(BlockData.class), WATER_DROP, - ITEM_TAKE, MOB_APPEARANCE, DRAGON_BREATH, END_ROD, DAMAGE_INDICATOR, SWEEP_ATTACK, - FALLING_DUST(MaterialData.class), + FALLING_DUST(BlockData.class), TOTEM, - SPIT; + SPIT, + SQUID_INK, + BUBBLE_POP, + CURRENT_DOWN, + BUBBLE_COLUMN_UP, + NAUTILUS, + DOLPHIN, + // ----- Legacy Separator ----- + LEGACY_BLOCK_CRACK(MaterialData.class), + LEGACY_BLOCK_DUST(MaterialData.class), + LEGACY_FALLING_DUST(MaterialData.class); private final Class<?> dataType; @@ -71,4 +81,38 @@ public enum Particle { public Class<?> getDataType() { return dataType; } + + /** + * Options which can be applied to redstone dust particles - a particle + * color and size. + */ + public static class DustOptions { + + private final Color color; + private final float size; + + public DustOptions(Color color, float size) { + Preconditions.checkArgument(color != null, "color"); + this.color = color; + this.size = size; + } + + /** + * The color of the particles to be displayed. + * + * @return particle color + */ + public Color getColor() { + return color; + } + + /** + * Relative size of the particle. + * + * @return relative particle size + */ + public float getSize() { + return size; + } + } } diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java index 5f88b720..dc2e1018 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -10,9 +10,11 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; +import java.util.function.Consumer; import java.util.logging.Logger; import org.bukkit.Warning.WarningState; +import org.bukkit.block.data.BlockData; import org.bukkit.boss.BarColor; import org.bukkit.boss.BarFlag; import org.bukkit.boss.BarStyle; @@ -945,6 +947,67 @@ public interface Server extends PluginMessageRecipient { Iterator<Advancement> advancementIterator(); /** + * Creates a new {@link BlockData} instance for the specified Material, with + * all properties initialized to unspecified defaults. + * + * @param material the material + * @return new data instance + */ + BlockData createBlockData(Material material); + + /** + * Creates a new {@link BlockData} instance for the specified Material, with + * all properties initialized to unspecified defaults. + * + * @param material the material + * @param consumer consumer to run on new instance before returning + * @return new data instance + */ + public BlockData createBlockData(Material material, Consumer<BlockData> consumer); + + /** + * Creates a new {@link BlockData} instance with material and properties + * parsed from provided data. + * + * @param data data string + * @return new data instance + * @throws IllegalArgumentException if the specified data is not valid + */ + BlockData createBlockData(String data) throws IllegalArgumentException; + + /** + * Creates a new {@link BlockData} instance for the specified Material, with + * all properties initialized to unspecified defaults, except for those + * provided in data. + * + * @param material the material + * @param data data string + * @return new data instance + * @throws IllegalArgumentException if the specified data is not valid + */ + BlockData createBlockData(Material material, String data) throws IllegalArgumentException; + + /** + * Gets a tag which has already been defined within the server. Plugins are + * suggested to use the concrete tags in {@link Tag} rather than this method + * which makes no guarantees about which tags are available, and may also be + * less performant due to lack of caching. + * <br> + * Tags will be searched for in an implementation specific manner, but a + * path consisting of namespace/tags/registry/key is expected. + * <br> + * Server implementations are allowed to handle only the registries + * indicated in {@link Tag}. + * + * @param <T> type of the tag + * @param registry the tag registry to look at + * @param tag the name of the tag + * @param clazz the class of the tag entries + * @return the tag or null + */ + <T extends Keyed> Tag<T> getTag(String registry, NamespacedKey tag, Class<T> clazz); + + /** * @see UnsafeValues * @return the unsafe values instance */ diff --git a/src/main/java/org/bukkit/SkullType.java b/src/main/java/org/bukkit/SkullType.java index db651d50..1c3d9ae9 100644 --- a/src/main/java/org/bukkit/SkullType.java +++ b/src/main/java/org/bukkit/SkullType.java @@ -2,7 +2,9 @@ package org.bukkit; /** * Represents the different types of skulls. + * @deprecated check {@link Material} instead */ +@Deprecated public enum SkullType { SKELETON, WITHER, diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java index 82d75054..d84ad5b9 100644 --- a/src/main/java/org/bukkit/Sound.java +++ b/src/main/java/org/bukkit/Sound.java @@ -10,6 +10,12 @@ package org.bukkit; */ public enum Sound { AMBIENT_CAVE, + AMBIENT_UNDERWATER_ENTER, + AMBIENT_UNDERWATER_EXIT, + AMBIENT_UNDERWATER_LOOP, + AMBIENT_UNDERWATER_LOOP_ADDITIONS, + AMBIENT_UNDERWATER_LOOP_ADDITIONS_RARE, + AMBIENT_UNDERWATER_LOOP_ADDITIONS_ULTRA_RARE, BLOCK_ANVIL_BREAK, BLOCK_ANVIL_DESTROY, BLOCK_ANVIL_FALL, @@ -18,24 +24,38 @@ public enum Sound { BLOCK_ANVIL_PLACE, BLOCK_ANVIL_STEP, BLOCK_ANVIL_USE, + BLOCK_BEACON_ACTIVATE, + BLOCK_BEACON_AMBIENT, + BLOCK_BEACON_DEACTIVATE, + BLOCK_BEACON_POWER_SELECT, BLOCK_BREWING_STAND_BREW, + BLOCK_BUBBLE_COLUMN_BUBBLE_POP, + BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT, + BLOCK_BUBBLE_COLUMN_UPWARDS_INSIDE, + BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT, + BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE, BLOCK_CHEST_CLOSE, BLOCK_CHEST_LOCKED, BLOCK_CHEST_OPEN, BLOCK_CHORUS_FLOWER_DEATH, BLOCK_CHORUS_FLOWER_GROW, - BLOCK_CLOTH_BREAK, - BLOCK_CLOTH_FALL, - BLOCK_CLOTH_HIT, - BLOCK_CLOTH_PLACE, - BLOCK_CLOTH_STEP, BLOCK_COMPARATOR_CLICK, + BLOCK_CONDUIT_ACTIVATE, + BLOCK_CONDUIT_AMBIENT, + BLOCK_CONDUIT_AMBIENT_SHORT, + BLOCK_CONDUIT_ATTACK_TARGET, + BLOCK_CONDUIT_DEACTIVATE, + BLOCK_CORAL_BLOCK_BREAK, + BLOCK_CORAL_BLOCK_FALL, + BLOCK_CORAL_BLOCK_HIT, + BLOCK_CORAL_BLOCK_PLACE, + BLOCK_CORAL_BLOCK_STEP, BLOCK_DISPENSER_DISPENSE, BLOCK_DISPENSER_FAIL, BLOCK_DISPENSER_LAUNCH, BLOCK_ENCHANTMENT_TABLE_USE, - BLOCK_ENDERCHEST_CLOSE, - BLOCK_ENDERCHEST_OPEN, + BLOCK_ENDER_CHEST_CLOSE, + BLOCK_ENDER_CHEST_OPEN, BLOCK_END_GATEWAY_SPAWN, BLOCK_END_PORTAL_FRAME_FILL, BLOCK_END_PORTAL_SPAWN, @@ -72,29 +92,31 @@ public enum Sound { BLOCK_LAVA_EXTINGUISH, BLOCK_LAVA_POP, BLOCK_LEVER_CLICK, + BLOCK_LILY_PAD_PLACE, BLOCK_METAL_BREAK, BLOCK_METAL_FALL, BLOCK_METAL_HIT, BLOCK_METAL_PLACE, - BLOCK_METAL_PRESSUREPLATE_CLICK_OFF, - BLOCK_METAL_PRESSUREPLATE_CLICK_ON, + BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF, + BLOCK_METAL_PRESSURE_PLATE_CLICK_ON, BLOCK_METAL_STEP, - BLOCK_NOTE_BASEDRUM, - BLOCK_NOTE_BASS, - BLOCK_NOTE_BELL, - BLOCK_NOTE_CHIME, - BLOCK_NOTE_FLUTE, - BLOCK_NOTE_GUITAR, - BLOCK_NOTE_HARP, - BLOCK_NOTE_HAT, - BLOCK_NOTE_PLING, - BLOCK_NOTE_SNARE, - BLOCK_NOTE_XYLOPHONE, + BLOCK_NOTE_BLOCK_BASEDRUM, + BLOCK_NOTE_BLOCK_BASS, + BLOCK_NOTE_BLOCK_BELL, + BLOCK_NOTE_BLOCK_CHIME, + BLOCK_NOTE_BLOCK_FLUTE, + BLOCK_NOTE_BLOCK_GUITAR, + BLOCK_NOTE_BLOCK_HARP, + BLOCK_NOTE_BLOCK_HAT, + BLOCK_NOTE_BLOCK_PLING, + BLOCK_NOTE_BLOCK_SNARE, + BLOCK_NOTE_BLOCK_XYLOPHONE, BLOCK_PISTON_CONTRACT, BLOCK_PISTON_EXTEND, BLOCK_PORTAL_AMBIENT, BLOCK_PORTAL_TRAVEL, BLOCK_PORTAL_TRIGGER, + BLOCK_PUMPKIN_CARVE, BLOCK_REDSTONE_TORCH_BURNOUT, BLOCK_SAND_BREAK, BLOCK_SAND_FALL, @@ -103,11 +125,11 @@ public enum Sound { BLOCK_SAND_STEP, BLOCK_SHULKER_BOX_CLOSE, BLOCK_SHULKER_BOX_OPEN, - BLOCK_SLIME_BREAK, - BLOCK_SLIME_FALL, - BLOCK_SLIME_HIT, - BLOCK_SLIME_PLACE, - BLOCK_SLIME_STEP, + BLOCK_SLIME_BLOCK_BREAK, + BLOCK_SLIME_BLOCK_FALL, + BLOCK_SLIME_BLOCK_HIT, + BLOCK_SLIME_BLOCK_PLACE, + BLOCK_SLIME_BLOCK_STEP, BLOCK_SNOW_BREAK, BLOCK_SNOW_FALL, BLOCK_SNOW_HIT, @@ -119,33 +141,42 @@ public enum Sound { BLOCK_STONE_FALL, BLOCK_STONE_HIT, BLOCK_STONE_PLACE, - BLOCK_STONE_PRESSUREPLATE_CLICK_OFF, - BLOCK_STONE_PRESSUREPLATE_CLICK_ON, + BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF, + BLOCK_STONE_PRESSURE_PLATE_CLICK_ON, BLOCK_STONE_STEP, BLOCK_TRIPWIRE_ATTACH, BLOCK_TRIPWIRE_CLICK_OFF, BLOCK_TRIPWIRE_CLICK_ON, BLOCK_TRIPWIRE_DETACH, - BLOCK_WATERLILY_PLACE, BLOCK_WATER_AMBIENT, + BLOCK_WET_GRASS_BREAK, + BLOCK_WET_GRASS_FALL, + BLOCK_WET_GRASS_HIT, + BLOCK_WET_GRASS_PLACE, + BLOCK_WET_GRASS_STEP, + BLOCK_WOODEN_BUTTON_CLICK_OFF, + BLOCK_WOODEN_BUTTON_CLICK_ON, BLOCK_WOODEN_DOOR_CLOSE, BLOCK_WOODEN_DOOR_OPEN, + BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF, + BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON, BLOCK_WOODEN_TRAPDOOR_CLOSE, BLOCK_WOODEN_TRAPDOOR_OPEN, BLOCK_WOOD_BREAK, - BLOCK_WOOD_BUTTON_CLICK_OFF, - BLOCK_WOOD_BUTTON_CLICK_ON, BLOCK_WOOD_FALL, BLOCK_WOOD_HIT, BLOCK_WOOD_PLACE, - BLOCK_WOOD_PRESSUREPLATE_CLICK_OFF, - BLOCK_WOOD_PRESSUREPLATE_CLICK_ON, BLOCK_WOOD_STEP, + BLOCK_WOOL_BREAK, + BLOCK_WOOL_FALL, + BLOCK_WOOL_HIT, + BLOCK_WOOL_PLACE, + BLOCK_WOOL_STEP, ENCHANT_THORNS_HIT, - ENTITY_ARMORSTAND_BREAK, - ENTITY_ARMORSTAND_FALL, - ENTITY_ARMORSTAND_HIT, - ENTITY_ARMORSTAND_PLACE, + ENTITY_ARMOR_STAND_BREAK, + ENTITY_ARMOR_STAND_FALL, + ENTITY_ARMOR_STAND_HIT, + ENTITY_ARMOR_STAND_PLACE, ENTITY_ARROW_HIT, ENTITY_ARROW_HIT_PLAYER, ENTITY_ARROW_SHOOT, @@ -161,9 +192,6 @@ public enum Sound { ENTITY_BLAZE_SHOOT, ENTITY_BOAT_PADDLE_LAND, ENTITY_BOAT_PADDLE_WATER, - ENTITY_BOBBER_RETRIEVE, - ENTITY_BOBBER_SPLASH, - ENTITY_BOBBER_THROW, ENTITY_CAT_AMBIENT, ENTITY_CAT_DEATH, ENTITY_CAT_HISS, @@ -175,6 +203,10 @@ public enum Sound { ENTITY_CHICKEN_EGG, ENTITY_CHICKEN_HURT, ENTITY_CHICKEN_STEP, + ENTITY_COD_AMBIENT, + ENTITY_COD_DEATH, + ENTITY_COD_FLOP, + ENTITY_COD_HURT, ENTITY_COW_AMBIENT, ENTITY_COW_DEATH, ENTITY_COW_HURT, @@ -183,11 +215,31 @@ public enum Sound { ENTITY_CREEPER_DEATH, ENTITY_CREEPER_HURT, ENTITY_CREEPER_PRIMED, + ENTITY_DOLPHIN_AMBIENT, + ENTITY_DOLPHIN_AMBIENT_WATER, + ENTITY_DOLPHIN_ATTACK, + ENTITY_DOLPHIN_DEATH, + ENTITY_DOLPHIN_EAT, + ENTITY_DOLPHIN_HURT, + ENTITY_DOLPHIN_JUMP, + ENTITY_DOLPHIN_PLAY, + ENTITY_DOLPHIN_SPLASH, + ENTITY_DOLPHIN_SWIM, ENTITY_DONKEY_AMBIENT, ENTITY_DONKEY_ANGRY, ENTITY_DONKEY_CHEST, ENTITY_DONKEY_DEATH, ENTITY_DONKEY_HURT, + ENTITY_DRAGON_FIREBALL_EXPLODE, + ENTITY_DROWNED_AMBIENT, + ENTITY_DROWNED_AMBIENT_WATER, + ENTITY_DROWNED_DEATH, + ENTITY_DROWNED_DEATH_WATER, + ENTITY_DROWNED_HURT, + ENTITY_DROWNED_HURT_WATER, + ENTITY_DROWNED_SHOOT, + ENTITY_DROWNED_STEP, + ENTITY_DROWNED_SWIM, ENTITY_EGG_THROW, ENTITY_ELDER_GUARDIAN_AMBIENT, ENTITY_ELDER_GUARDIAN_AMBIENT_LAND, @@ -197,44 +249,47 @@ public enum Sound { ENTITY_ELDER_GUARDIAN_FLOP, ENTITY_ELDER_GUARDIAN_HURT, ENTITY_ELDER_GUARDIAN_HURT_LAND, - ENTITY_ENDERDRAGON_AMBIENT, - ENTITY_ENDERDRAGON_DEATH, - ENTITY_ENDERDRAGON_FIREBALL_EXPLODE, - ENTITY_ENDERDRAGON_FLAP, - ENTITY_ENDERDRAGON_GROWL, - ENTITY_ENDERDRAGON_HURT, - ENTITY_ENDERDRAGON_SHOOT, - ENTITY_ENDEREYE_DEATH, - ENTITY_ENDEREYE_LAUNCH, - ENTITY_ENDERMEN_AMBIENT, - ENTITY_ENDERMEN_DEATH, - ENTITY_ENDERMEN_HURT, - ENTITY_ENDERMEN_SCREAM, - ENTITY_ENDERMEN_STARE, - ENTITY_ENDERMEN_TELEPORT, + ENTITY_ENDERMAN_AMBIENT, + ENTITY_ENDERMAN_DEATH, + ENTITY_ENDERMAN_HURT, + ENTITY_ENDERMAN_SCREAM, + ENTITY_ENDERMAN_STARE, + ENTITY_ENDERMAN_TELEPORT, ENTITY_ENDERMITE_AMBIENT, ENTITY_ENDERMITE_DEATH, ENTITY_ENDERMITE_HURT, ENTITY_ENDERMITE_STEP, - ENTITY_ENDERPEARL_THROW, - ENTITY_EVOCATION_FANGS_ATTACK, - ENTITY_EVOCATION_ILLAGER_AMBIENT, - ENTITY_EVOCATION_ILLAGER_CAST_SPELL, - ENTITY_EVOCATION_ILLAGER_DEATH, - ENTITY_EVOCATION_ILLAGER_HURT, - ENTITY_EVOCATION_ILLAGER_PREPARE_ATTACK, - ENTITY_EVOCATION_ILLAGER_PREPARE_SUMMON, - ENTITY_EVOCATION_ILLAGER_PREPARE_WOLOLO, + ENTITY_ENDER_DRAGON_AMBIENT, + ENTITY_ENDER_DRAGON_DEATH, + ENTITY_ENDER_DRAGON_FLAP, + ENTITY_ENDER_DRAGON_GROWL, + ENTITY_ENDER_DRAGON_HURT, + ENTITY_ENDER_DRAGON_SHOOT, + ENTITY_ENDER_EYE_DEATH, + ENTITY_ENDER_EYE_LAUNCH, + ENTITY_ENDER_PEARL_THROW, + ENTITY_EVOKER_AMBIENT, + ENTITY_EVOKER_CAST_SPELL, + ENTITY_EVOKER_DEATH, + ENTITY_EVOKER_FANGS_ATTACK, + ENTITY_EVOKER_HURT, + ENTITY_EVOKER_PREPARE_ATTACK, + ENTITY_EVOKER_PREPARE_SUMMON, + ENTITY_EVOKER_PREPARE_WOLOLO, ENTITY_EXPERIENCE_BOTTLE_THROW, ENTITY_EXPERIENCE_ORB_PICKUP, - ENTITY_FIREWORK_BLAST, - ENTITY_FIREWORK_BLAST_FAR, - ENTITY_FIREWORK_LARGE_BLAST, - ENTITY_FIREWORK_LARGE_BLAST_FAR, - ENTITY_FIREWORK_LAUNCH, - ENTITY_FIREWORK_SHOOT, - ENTITY_FIREWORK_TWINKLE, - ENTITY_FIREWORK_TWINKLE_FAR, + ENTITY_FIREWORK_ROCKET_BLAST, + ENTITY_FIREWORK_ROCKET_BLAST_FAR, + ENTITY_FIREWORK_ROCKET_LARGE_BLAST, + ENTITY_FIREWORK_ROCKET_LARGE_BLAST_FAR, + ENTITY_FIREWORK_ROCKET_LAUNCH, + ENTITY_FIREWORK_ROCKET_SHOOT, + ENTITY_FIREWORK_ROCKET_TWINKLE, + ENTITY_FIREWORK_ROCKET_TWINKLE_FAR, + ENTITY_FISHING_BOBBER_RETRIEVE, + ENTITY_FISHING_BOBBER_SPLASH, + ENTITY_FISHING_BOBBER_THROW, + ENTITY_FISH_SWIM, ENTITY_GENERIC_BIG_FALL, ENTITY_GENERIC_BURN, ENTITY_GENERIC_DEATH, @@ -280,32 +335,33 @@ public enum Sound { ENTITY_HOSTILE_SPLASH, ENTITY_HOSTILE_SWIM, ENTITY_HUSK_AMBIENT, + ENTITY_HUSK_CONVERTED_TO_ZOMBIE, ENTITY_HUSK_DEATH, ENTITY_HUSK_HURT, ENTITY_HUSK_STEP, - ENTITY_ILLUSION_ILLAGER_AMBIENT, - ENTITY_ILLUSION_ILLAGER_CAST_SPELL, - ENTITY_ILLUSION_ILLAGER_DEATH, - ENTITY_ILLUSION_ILLAGER_HURT, - ENTITY_ILLUSION_ILLAGER_MIRROR_MOVE, - ENTITY_ILLUSION_ILLAGER_PREPARE_BLINDNESS, - ENTITY_ILLUSION_ILLAGER_PREPARE_MIRROR, - ENTITY_IRONGOLEM_ATTACK, - ENTITY_IRONGOLEM_DEATH, - ENTITY_IRONGOLEM_HURT, - ENTITY_IRONGOLEM_STEP, - ENTITY_ITEMFRAME_ADD_ITEM, - ENTITY_ITEMFRAME_BREAK, - ENTITY_ITEMFRAME_PLACE, - ENTITY_ITEMFRAME_REMOVE_ITEM, - ENTITY_ITEMFRAME_ROTATE_ITEM, + ENTITY_ILLUSIONER_AMBIENT, + ENTITY_ILLUSIONER_CAST_SPELL, + ENTITY_ILLUSIONER_DEATH, + ENTITY_ILLUSIONER_HURT, + ENTITY_ILLUSIONER_MIRROR_MOVE, + ENTITY_ILLUSIONER_PREPARE_BLINDNESS, + ENTITY_ILLUSIONER_PREPARE_MIRROR, + ENTITY_IRON_GOLEM_ATTACK, + ENTITY_IRON_GOLEM_DEATH, + ENTITY_IRON_GOLEM_HURT, + ENTITY_IRON_GOLEM_STEP, ENTITY_ITEM_BREAK, + ENTITY_ITEM_FRAME_ADD_ITEM, + ENTITY_ITEM_FRAME_BREAK, + ENTITY_ITEM_FRAME_PLACE, + ENTITY_ITEM_FRAME_REMOVE_ITEM, + ENTITY_ITEM_FRAME_ROTATE_ITEM, ENTITY_ITEM_PICKUP, - ENTITY_LEASHKNOT_BREAK, - ENTITY_LEASHKNOT_PLACE, - ENTITY_LIGHTNING_IMPACT, - ENTITY_LIGHTNING_THUNDER, - ENTITY_LINGERINGPOTION_THROW, + ENTITY_LEASH_KNOT_BREAK, + ENTITY_LEASH_KNOT_PLACE, + ENTITY_LIGHTNING_BOLT_IMPACT, + ENTITY_LIGHTNING_BOLT_THUNDER, + ENTITY_LINGERING_POTION_THROW, ENTITY_LLAMA_AMBIENT, ENTITY_LLAMA_ANGRY, ENTITY_LLAMA_CHEST, @@ -315,10 +371,13 @@ public enum Sound { ENTITY_LLAMA_SPIT, ENTITY_LLAMA_STEP, ENTITY_LLAMA_SWAG, - ENTITY_MAGMACUBE_DEATH, - ENTITY_MAGMACUBE_HURT, - ENTITY_MAGMACUBE_JUMP, - ENTITY_MAGMACUBE_SQUISH, + ENTITY_MAGMA_CUBE_DEATH, + ENTITY_MAGMA_CUBE_DEATH_SMALL, + ENTITY_MAGMA_CUBE_HURT, + ENTITY_MAGMA_CUBE_HURT_SMALL, + ENTITY_MAGMA_CUBE_JUMP, + ENTITY_MAGMA_CUBE_SQUISH, + ENTITY_MAGMA_CUBE_SQUISH_SMALL, ENTITY_MINECART_INSIDE, ENTITY_MINECART_RIDING, ENTITY_MOOSHROOM_SHEAR, @@ -335,15 +394,17 @@ public enum Sound { ENTITY_PARROT_HURT, ENTITY_PARROT_IMITATE_BLAZE, ENTITY_PARROT_IMITATE_CREEPER, + ENTITY_PARROT_IMITATE_DROWNED, ENTITY_PARROT_IMITATE_ELDER_GUARDIAN, - ENTITY_PARROT_IMITATE_ENDERDRAGON, ENTITY_PARROT_IMITATE_ENDERMAN, ENTITY_PARROT_IMITATE_ENDERMITE, - ENTITY_PARROT_IMITATE_EVOCATION_ILLAGER, + ENTITY_PARROT_IMITATE_ENDER_DRAGON, + ENTITY_PARROT_IMITATE_EVOKER, ENTITY_PARROT_IMITATE_GHAST, ENTITY_PARROT_IMITATE_HUSK, - ENTITY_PARROT_IMITATE_ILLUSION_ILLAGER, - ENTITY_PARROT_IMITATE_MAGMACUBE, + ENTITY_PARROT_IMITATE_ILLUSIONER, + ENTITY_PARROT_IMITATE_MAGMA_CUBE, + ENTITY_PARROT_IMITATE_PHANTOM, ENTITY_PARROT_IMITATE_POLAR_BEAR, ENTITY_PARROT_IMITATE_SHULKER, ENTITY_PARROT_IMITATE_SILVERFISH, @@ -352,7 +413,7 @@ public enum Sound { ENTITY_PARROT_IMITATE_SPIDER, ENTITY_PARROT_IMITATE_STRAY, ENTITY_PARROT_IMITATE_VEX, - ENTITY_PARROT_IMITATE_VINDICATION_ILLAGER, + ENTITY_PARROT_IMITATE_VINDICATOR, ENTITY_PARROT_IMITATE_WITCH, ENTITY_PARROT_IMITATE_WITHER, ENTITY_PARROT_IMITATE_WITHER_SKELETON, @@ -361,6 +422,12 @@ public enum Sound { ENTITY_PARROT_IMITATE_ZOMBIE_PIGMAN, ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER, ENTITY_PARROT_STEP, + ENTITY_PHANTOM_AMBIENT, + ENTITY_PHANTOM_BITE, + ENTITY_PHANTOM_DEATH, + ENTITY_PHANTOM_FLAP, + ENTITY_PHANTOM_HURT, + ENTITY_PHANTOM_SWOOP, ENTITY_PIG_AMBIENT, ENTITY_PIG_DEATH, ENTITY_PIG_HURT, @@ -382,18 +449,30 @@ public enum Sound { ENTITY_PLAYER_LEVELUP, ENTITY_PLAYER_SMALL_FALL, ENTITY_PLAYER_SPLASH, + ENTITY_PLAYER_SPLASH_HIGH_SPEED, ENTITY_PLAYER_SWIM, ENTITY_POLAR_BEAR_AMBIENT, - ENTITY_POLAR_BEAR_BABY_AMBIENT, + ENTITY_POLAR_BEAR_AMBIENT_BABY, ENTITY_POLAR_BEAR_DEATH, ENTITY_POLAR_BEAR_HURT, ENTITY_POLAR_BEAR_STEP, ENTITY_POLAR_BEAR_WARNING, + ENTITY_PUFFER_FISH_AMBIENT, + ENTITY_PUFFER_FISH_BLOW_OUT, + ENTITY_PUFFER_FISH_BLOW_UP, + ENTITY_PUFFER_FISH_DEATH, + ENTITY_PUFFER_FISH_FLOP, + ENTITY_PUFFER_FISH_HURT, + ENTITY_PUFFER_FISH_STING, ENTITY_RABBIT_AMBIENT, ENTITY_RABBIT_ATTACK, ENTITY_RABBIT_DEATH, ENTITY_RABBIT_HURT, ENTITY_RABBIT_JUMP, + ENTITY_SALMON_AMBIENT, + ENTITY_SALMON_DEATH, + ENTITY_SALMON_FLOP, + ENTITY_SALMON_HURT, ENTITY_SHEEP_AMBIENT, ENTITY_SHEEP_DEATH, ENTITY_SHEEP_HURT, @@ -416,28 +495,30 @@ public enum Sound { ENTITY_SKELETON_AMBIENT, ENTITY_SKELETON_DEATH, ENTITY_SKELETON_HORSE_AMBIENT, + ENTITY_SKELETON_HORSE_AMBIENT_WATER, ENTITY_SKELETON_HORSE_DEATH, + ENTITY_SKELETON_HORSE_GALLOP_WATER, ENTITY_SKELETON_HORSE_HURT, + ENTITY_SKELETON_HORSE_JUMP_WATER, + ENTITY_SKELETON_HORSE_STEP_WATER, + ENTITY_SKELETON_HORSE_SWIM, ENTITY_SKELETON_HURT, ENTITY_SKELETON_SHOOT, ENTITY_SKELETON_STEP, ENTITY_SLIME_ATTACK, ENTITY_SLIME_DEATH, + ENTITY_SLIME_DEATH_SMALL, ENTITY_SLIME_HURT, + ENTITY_SLIME_HURT_SMALL, ENTITY_SLIME_JUMP, + ENTITY_SLIME_JUMP_SMALL, ENTITY_SLIME_SQUISH, - ENTITY_SMALL_MAGMACUBE_DEATH, - ENTITY_SMALL_MAGMACUBE_HURT, - ENTITY_SMALL_MAGMACUBE_SQUISH, - ENTITY_SMALL_SLIME_DEATH, - ENTITY_SMALL_SLIME_HURT, - ENTITY_SMALL_SLIME_JUMP, - ENTITY_SMALL_SLIME_SQUISH, + ENTITY_SLIME_SQUISH_SMALL, ENTITY_SNOWBALL_THROW, - ENTITY_SNOWMAN_AMBIENT, - ENTITY_SNOWMAN_DEATH, - ENTITY_SNOWMAN_HURT, - ENTITY_SNOWMAN_SHOOT, + ENTITY_SNOW_GOLEM_AMBIENT, + ENTITY_SNOW_GOLEM_DEATH, + ENTITY_SNOW_GOLEM_HURT, + ENTITY_SNOW_GOLEM_SHOOT, ENTITY_SPIDER_AMBIENT, ENTITY_SPIDER_DEATH, ENTITY_SPIDER_HURT, @@ -447,11 +528,28 @@ public enum Sound { ENTITY_SQUID_AMBIENT, ENTITY_SQUID_DEATH, ENTITY_SQUID_HURT, + ENTITY_SQUID_SQUIRT, ENTITY_STRAY_AMBIENT, ENTITY_STRAY_DEATH, ENTITY_STRAY_HURT, ENTITY_STRAY_STEP, ENTITY_TNT_PRIMED, + ENTITY_TROPICAL_FISH_AMBIENT, + ENTITY_TROPICAL_FISH_DEATH, + ENTITY_TROPICAL_FISH_FLOP, + ENTITY_TROPICAL_FISH_HURT, + ENTITY_TURTLE_AMBIENT_LAND, + ENTITY_TURTLE_DEATH, + ENTITY_TURTLE_DEATH_BABY, + ENTITY_TURTLE_EGG_BREAK, + ENTITY_TURTLE_EGG_CRACK, + ENTITY_TURTLE_EGG_HATCH, + ENTITY_TURTLE_HURT, + ENTITY_TURTLE_HURT_BABY, + ENTITY_TURTLE_LAY_EGG, + ENTITY_TURTLE_SHAMBLE, + ENTITY_TURTLE_SHAMBLE_BABY, + ENTITY_TURTLE_SWIM, ENTITY_VEX_AMBIENT, ENTITY_VEX_CHARGE, ENTITY_VEX_DEATH, @@ -460,11 +558,11 @@ public enum Sound { ENTITY_VILLAGER_DEATH, ENTITY_VILLAGER_HURT, ENTITY_VILLAGER_NO, - ENTITY_VILLAGER_TRADING, + ENTITY_VILLAGER_TRADE, ENTITY_VILLAGER_YES, - ENTITY_VINDICATION_ILLAGER_AMBIENT, - ENTITY_VINDICATION_ILLAGER_DEATH, - ENTITY_VINDICATION_ILLAGER_HURT, + ENTITY_VINDICATOR_AMBIENT, + ENTITY_VINDICATOR_DEATH, + ENTITY_VINDICATOR_HURT, ENTITY_WITCH_AMBIENT, ENTITY_WITCH_DEATH, ENTITY_WITCH_DRINK, @@ -490,19 +588,21 @@ public enum Sound { ENTITY_WOLF_STEP, ENTITY_WOLF_WHINE, ENTITY_ZOMBIE_AMBIENT, - ENTITY_ZOMBIE_ATTACK_DOOR_WOOD, ENTITY_ZOMBIE_ATTACK_IRON_DOOR, - ENTITY_ZOMBIE_BREAK_DOOR_WOOD, + ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR, + ENTITY_ZOMBIE_BREAK_WOODEN_DOOR, + ENTITY_ZOMBIE_CONVERTED_TO_DROWNED, ENTITY_ZOMBIE_DEATH, + ENTITY_ZOMBIE_DESTROY_EGG, ENTITY_ZOMBIE_HORSE_AMBIENT, ENTITY_ZOMBIE_HORSE_DEATH, ENTITY_ZOMBIE_HORSE_HURT, ENTITY_ZOMBIE_HURT, ENTITY_ZOMBIE_INFECT, - ENTITY_ZOMBIE_PIG_AMBIENT, - ENTITY_ZOMBIE_PIG_ANGRY, - ENTITY_ZOMBIE_PIG_DEATH, - ENTITY_ZOMBIE_PIG_HURT, + ENTITY_ZOMBIE_PIGMAN_AMBIENT, + ENTITY_ZOMBIE_PIGMAN_ANGRY, + ENTITY_ZOMBIE_PIGMAN_DEATH, + ENTITY_ZOMBIE_PIGMAN_HURT, ENTITY_ZOMBIE_STEP, ENTITY_ZOMBIE_VILLAGER_AMBIENT, ENTITY_ZOMBIE_VILLAGER_CONVERTED, @@ -517,12 +617,16 @@ public enum Sound { ITEM_ARMOR_EQUIP_GOLD, ITEM_ARMOR_EQUIP_IRON, ITEM_ARMOR_EQUIP_LEATHER, + ITEM_ARMOR_EQUIP_TURTLE, + ITEM_AXE_STRIP, ITEM_BOTTLE_EMPTY, ITEM_BOTTLE_FILL, ITEM_BOTTLE_FILL_DRAGONBREATH, ITEM_BUCKET_EMPTY, + ITEM_BUCKET_EMPTY_FISH, ITEM_BUCKET_EMPTY_LAVA, ITEM_BUCKET_FILL, + ITEM_BUCKET_FILL_FISH, ITEM_BUCKET_FILL_LAVA, ITEM_CHORUS_FRUIT_TELEPORT, ITEM_ELYTRA_FLYING, @@ -533,29 +637,38 @@ public enum Sound { ITEM_SHIELD_BREAK, ITEM_SHOVEL_FLATTEN, ITEM_TOTEM_USE, + ITEM_TRIDENT_HIT, + ITEM_TRIDENT_HIT_GROUND, + ITEM_TRIDENT_RETURN, + ITEM_TRIDENT_RIPTIDE_1, + ITEM_TRIDENT_RIPTIDE_2, + ITEM_TRIDENT_RIPTIDE_3, + ITEM_TRIDENT_THROW, + ITEM_TRIDENT_THUNDER, MUSIC_CREATIVE, MUSIC_CREDITS, + MUSIC_DISC_11, + MUSIC_DISC_13, + MUSIC_DISC_BLOCKS, + MUSIC_DISC_CAT, + MUSIC_DISC_CHIRP, + MUSIC_DISC_FAR, + MUSIC_DISC_MALL, + MUSIC_DISC_MELLOHI, + MUSIC_DISC_STAL, + MUSIC_DISC_STRAD, + MUSIC_DISC_WAIT, + MUSIC_DISC_WARD, MUSIC_DRAGON, MUSIC_END, MUSIC_GAME, MUSIC_MENU, MUSIC_NETHER, - RECORD_11, - RECORD_13, - RECORD_BLOCKS, - RECORD_CAT, - RECORD_CHIRP, - RECORD_FAR, - RECORD_MALL, - RECORD_MELLOHI, - RECORD_STAL, - RECORD_STRAD, - RECORD_WAIT, - RECORD_WARD, + MUSIC_UNDER_WATER, UI_BUTTON_CLICK, UI_TOAST_CHALLENGE_COMPLETE, UI_TOAST_IN, UI_TOAST_OUT, WEATHER_RAIN, - WEATHER_RAIN_ABOVE; + WEATHER_RAIN_ABOVE, } diff --git a/src/main/java/org/bukkit/Statistic.java b/src/main/java/org/bukkit/Statistic.java index 1472d9a6..e564fef8 100644 --- a/src/main/java/org/bukkit/Statistic.java +++ b/src/main/java/org/bukkit/Statistic.java @@ -13,16 +13,17 @@ public enum Statistic { ANIMALS_BRED, LEAVE_GAME, JUMP, + DROP_COUNT, DROP(Type.ITEM), PICKUP(Type.ITEM), - PLAY_ONE_TICK, + PLAY_ONE_MINUTE, WALK_ONE_CM, - SWIM_ONE_CM, + WALK_ON_WATER_ONE_CM, FALL_ONE_CM, SNEAK_TIME, CLIMB_ONE_CM, FLY_ONE_CM, - DIVE_ONE_CM, + WALK_UNDER_WATER_ONE_CM, MINECART_ONE_CM, BOAT_ONE_CM, PIG_ONE_CM, @@ -60,7 +61,9 @@ public enum Statistic { CRAFTING_TABLE_INTERACTION, CHEST_OPENED, SLEEP_IN_BED, - SHULKER_BOX_OPENED; + SHULKER_BOX_OPENED, + TIME_SINCE_REST, + SWIM_ONE_CM; private final Type type; diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java new file mode 100644 index 00000000..9b748a98 --- /dev/null +++ b/src/main/java/org/bukkit/Tag.java @@ -0,0 +1,188 @@ +package org.bukkit; + +import java.util.Set; + +/** + * Represents a tag that may be defined by the server or a resource pack to + * group like things together. + * + * @param <T> the type of things grouped by this tag + */ +public interface Tag<T extends Keyed> { + + /** + * Key for the built in block registry. + */ + String REGISTRY_BLOCKS = "blocks"; + /** + * Vanilla block tag representing all colors of wool. + */ + Tag<Material> WOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wool"), Material.class); + /** + * Vanilla block tag representing all plank variants. + */ + Tag<Material> PLANKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("planks"), Material.class); + /** + * Vanilla block tag representing all regular/mossy/cracked/chiseled stone + * bricks. + */ + Tag<Material> STONE_BRICKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("stone_bricks"), Material.class); + /** + * Vanilla block tag representing all wooden buttons. + */ + Tag<Material> WOODEN_BUTTONS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_buttons"), Material.class); + /** + * Vanilla block tag representing all buttons (inherits from + * {@link #WOODEN_BUTTONS}. + */ + Tag<Material> BUTTONS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("buttons"), Material.class); + /** + * Vanilla block tag representing all colors of carpet. + */ + Tag<Material> CARPETS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("carpets"), Material.class); + /** + * Vanilla block tag representing all wooden doors. + */ + Tag<Material> WOODEN_DOORS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_doors"), Material.class); + /** + * Vanilla block tag representing all wooden stairs. + */ + Tag<Material> WOODEN_STAIRS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_stairs"), Material.class); + /** + * Vanilla block tag representing all wooden slabs. + */ + Tag<Material> WOODEN_SLABS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_slabs"), Material.class); + /** + * Vanilla block tag representing all wooden pressure plates. + */ + Tag<Material> WOODEN_PRESSURE_PLATES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_pressure_plates"), Material.class); + /** + * Vanilla block tag representing all doors (inherits from + * {@link #WOODEN_DOORS}. + */ + Tag<Material> DOORS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("doors"), Material.class); + /** + * Vanilla block tag representing all sapling variants. + */ + Tag<Material> SAPLINGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("saplings"), Material.class); + /** + * Vanilla block tag representing all log and bark variants. + */ + Tag<Material> LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("logs"), Material.class); + /** + * Vanilla block tag representing all dark oak log and bark variants. + */ + Tag<Material> DARK_OAK_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dark_oak_logs"), Material.class); + /** + * Vanilla block tag representing all oak log and bark variants. + */ + Tag<Material> OAK_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("oak_logs"), Material.class); + /** + * Vanilla block tag representing all birch log and bark variants. + */ + Tag<Material> BIRCH_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("birch_logs"), Material.class); + /** + * Vanilla block tag representing all acacia log and bark variants. + */ + Tag<Material> ACACIA_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("acacia_logs"), Material.class); + /** + * Vanilla block tag representing all jungle log and bark variants. + */ + Tag<Material> JUNGLE_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("jungle_logs"), Material.class); + /** + * Vanilla block tag representing all spruce log and bark variants. + */ + Tag<Material> SPRUCE_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("spruce_logs"), Material.class); + /** + * Vanilla block tag representing all banner blocks. + */ + Tag<Material> BANNERS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("banners"), Material.class); + /** + * Vanilla block tag representing all sand blocks. + */ + Tag<Material> SAND = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("sand"), Material.class); + /** + * Vanilla block tag representing all stairs. + */ + Tag<Material> STAIRS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("stairs"), Material.class); + /** + * Vanilla block tag representing all slabs. + */ + Tag<Material> SLABS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("slabs"), Material.class); + /** + * Vanilla block tag representing all damaged and undamaged anvils. + */ + Tag<Material> ANVIL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("anvil"), Material.class); + /** + * Vanilla block tag representing all damaged and undamaged anvils. + */ + Tag<Material> RAILS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("rails"), Material.class); + /** + * Vanilla block tag representing all live coral. + */ + Tag<Material> LIVE_CORAL_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("live_coral_blocks"), Material.class); + /** + * Vanilla block tag representing all dead coral. + */ + Tag<Material> DEAD_CORAL_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dead_coral_blocks"), Material.class); + /** + * Vanilla block tag representing all coral. + */ + Tag<Material> CORAL_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("coral_blocks"), Material.class); + /** + * Vanilla block tag representing all coral. + */ + Tag<Material> CORALS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("corals"), Material.class); + /** + * Vanilla block tag representing all coral fans. + */ + Tag<Material> CORAL_FANS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("coral_fans"), Material.class); + /** + * Vanilla block tag representing all leaves fans. + */ + Tag<Material> LEAVES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("leaves"), Material.class); + /** + * Vanilla block tag representing all empty and filled flower pots. + */ + Tag<Material> FLOWER_POTS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("flower_pots"), Material.class); + /** + * Vanilla block tag denoting blocks that enderman may pick up and hold. + */ + Tag<Material> ENDERMAN_HOLDABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("enderman_holdable"), Material.class); + /** + * Vanilla block tag denoting ice blocks. + */ + Tag<Material> ICE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("ice"), Material.class); + /** + * Key for the built in item registry. + */ + String REGISTRY_ITEMS = "items"; + /** + * Vanilla item tag representing all banner items. + */ + Tag<Material> ITEMS_BANNERS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("banners"), Material.class); + /** + * Vanilla item tag representing all boat items. + */ + Tag<Material> ITEMS_BOATS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("boats"), Material.class); + /** + * Vanilla item tag representing all fish items. + */ + Tag<Material> ITEMS_FISHES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("fishes"), Material.class); + + /** + * Returns whether or not this tag has an entry for the specified item. + * + * @param item to check + * @return if it is tagged + */ + boolean isTagged(T item); + + /** + * Gets an immutable set of all tagged items. + * + * @return set of tagged items + */ + Set<T> getValues(); + +} diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java index fba9edf9..20b3a9ee 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java @@ -1,9 +1,10 @@ package org.bukkit; -import java.util.List; - import org.bukkit.advancement.Advancement; +import org.bukkit.block.data.BlockData; import org.bukkit.inventory.ItemStack; +import org.bukkit.material.MaterialData; +import org.bukkit.plugin.PluginDescriptionFile; /** * This interface provides value conversions that may be specific to a @@ -16,17 +17,21 @@ import org.bukkit.inventory.ItemStack; @Deprecated public interface UnsafeValues { - Material getMaterialFromInternalName(String name); + Material toLegacy(Material material); - List<String> tabCompleteInternalMaterialName(String token, List<String> completions); + Material fromLegacy(Material material); - ItemStack modifyItemStack(ItemStack stack, String arguments); + Material fromLegacy(MaterialData material); + + BlockData fromLegacy(Material material, byte data); - Statistic getStatisticFromInternalName(String name); + int getDataVersion(); + + ItemStack modifyItemStack(ItemStack stack, String arguments); - Achievement getAchievementFromInternalName(String name); + void checkSupported(PluginDescriptionFile pdf); - List<String> tabCompleteInternalStatisticOrAchievementName(String token, List<String> completions); + byte[] processClass(PluginDescriptionFile pdf, byte[] clazz); /** * Load an advancement represented by the specified string into the server. diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java index c8344c6d..f18dff83 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -10,6 +10,7 @@ import java.util.UUID; import org.bukkit.block.Biome; import org.bukkit.block.Block; +import org.bukkit.block.data.BlockData; import org.bukkit.entity.*; import org.bukkit.generator.BlockPopulator; import org.bukkit.inventory.ItemStack; @@ -31,8 +32,6 @@ public interface World extends PluginMessageRecipient, Metadatable { * @param y Y-coordinate of the block * @param z Z-coordinate of the block * @return Block at the given coordinates - * @see #getBlockTypeIdAt(int, int, int) Returns the current type ID of - * the block */ public Block getBlockAt(int x, int y, int z); @@ -41,38 +40,10 @@ public interface World extends PluginMessageRecipient, Metadatable { * * @param location Location of the block * @return Block at the given location - * @see #getBlockTypeIdAt(org.bukkit.Location) Returns the current type ID - * of the block */ public Block getBlockAt(Location location); /** - * Gets the block type ID at the given coordinates - * - * @param x X-coordinate of the block - * @param y Y-coordinate of the block - * @param z Z-coordinate of the block - * @return Type ID of the block at the given coordinates - * @see #getBlockAt(int, int, int) Returns a live Block object at the - * given location - * @deprecated Magic value - */ - @Deprecated - public int getBlockTypeIdAt(int x, int y, int z); - - /** - * Gets the block type ID at the given {@link Location} - * - * @param location Location of the block - * @return Type ID of the block at the given location - * @see #getBlockAt(org.bukkit.Location) Returns a live Block object at - * the given location - * @deprecated Magic value - */ - @Deprecated - public int getBlockTypeIdAt(Location location); - - /** * Gets the y coordinate of the lowest block at this position such that the * block and all blocks above it are transparent for lighting purposes. * @@ -358,9 +329,7 @@ public interface World extends PluginMessageRecipient, Metadatable { * @param delegate A class to call for each block changed as a result of * this method * @return true if the tree was created successfully, otherwise false - * @deprecated rarely used API that was largely for implementation purposes */ - @Deprecated public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate); /** @@ -757,31 +726,31 @@ public interface World extends PluginMessageRecipient, Metadatable { * material.isBlock()}. The Material may not be air. * * @param location The {@link Location} to spawn the FallingBlock - * @param material The block {@link Material} type * @param data The block data * @return The spawned {@link FallingBlock} instance * @throws IllegalArgumentException if {@link Location} or {@link - * Material} are null or {@link Material} is not a block - * @deprecated Magic value + * BlockData} are null */ - @Deprecated - public FallingBlock spawnFallingBlock(Location location, Material material, byte data) throws IllegalArgumentException; + public FallingBlock spawnFallingBlock(Location location, BlockData data) throws IllegalArgumentException; /** - * Spawn a {@link FallingBlock} entity at the given {@link Location} of - * the specified blockId (converted to {@link Material}) + * Spawn a {@link FallingBlock} entity at the given {@link Location} of the + * specified {@link Material}. The material dictates what is falling. + * When the FallingBlock hits the ground, it will place that block. + * <p> + * The Material must be a block type, check with {@link Material#isBlock() + * material.isBlock()}. The Material may not be air. * * @param location The {@link Location} to spawn the FallingBlock - * @param blockId The id of the intended material - * @param blockData The block data - * @return The spawned FallingBlock instance - * @throws IllegalArgumentException if location is null, or blockId is - * invalid - * @see #spawnFallingBlock(org.bukkit.Location, org.bukkit.Material, byte) + * @param material The block {@link Material} type + * @param data The block data + * @return The spawned {@link FallingBlock} instance + * @throws IllegalArgumentException if {@link Location} or {@link + * Material} are null or {@link Material} is not a block * @deprecated Magic value */ @Deprecated - public FallingBlock spawnFallingBlock(Location location, int blockId, byte blockData) throws IllegalArgumentException; + public FallingBlock spawnFallingBlock(Location location, Material material, byte data) throws IllegalArgumentException; /** * Plays an effect to all players within a default radius around a given @@ -838,11 +807,11 @@ public interface World extends PluginMessageRecipient, Metadatable { * @param z - chunk z coordinate * @param includeBiome - if true, snapshot includes per-coordinate biome * type - * @param includeBiomeTempRain - if true, snapshot includes per-coordinate - * raw biome temperature and rainfall + * @param includeBiomeTemp - if true, snapshot includes per-coordinate + * raw biome temperature * @return The empty snapshot. */ - public ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTempRain); + public ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTemp); /** * Sets the spawn flags for this. diff --git a/src/main/java/org/bukkit/WorldType.java b/src/main/java/org/bukkit/WorldType.java index 6c810799..ba481fc1 100644 --- a/src/main/java/org/bukkit/WorldType.java +++ b/src/main/java/org/bukkit/WorldType.java @@ -12,7 +12,8 @@ public enum WorldType { VERSION_1_1("DEFAULT_1_1"), LARGE_BIOMES("LARGEBIOMES"), AMPLIFIED("AMPLIFIED"), - CUSTOMIZED("CUSTOMIZED"); + CUSTOMIZED("CUSTOMIZED"), + BUFFET("BUFFET"); private final static Map<String, WorldType> BY_NAME = Maps.newHashMap(); private final String name; diff --git a/src/main/java/org/bukkit/block/Bed.java b/src/main/java/org/bukkit/block/Bed.java index 17a807a9..a2393852 100644 --- a/src/main/java/org/bukkit/block/Bed.java +++ b/src/main/java/org/bukkit/block/Bed.java @@ -4,5 +4,7 @@ import org.bukkit.material.Colorable; /** * Represents a captured state of a bed. + * @deprecated does not provide useful information beyond the material itself */ +@Deprecated public interface Bed extends BlockState, Colorable { } diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java index 9585005f..a3b310b7 100644 --- a/src/main/java/org/bukkit/block/Biome.java +++ b/src/main/java/org/bukkit/block/Biome.java @@ -7,63 +7,74 @@ public enum Biome { OCEAN, PLAINS, DESERT, - EXTREME_HILLS, + MOUNTAINS, FOREST, TAIGA, - SWAMPLAND, + SWAMP, RIVER, - HELL, - SKY, + NETHER, + THE_END, FROZEN_OCEAN, FROZEN_RIVER, - ICE_FLATS, - ICE_MOUNTAINS, - MUSHROOM_ISLAND, - MUSHROOM_ISLAND_SHORE, - BEACHES, + SNOWY_TUNDRA, + SNOWY_MOUNTAINS, + MUSHROOM_FIELDS, + MUSHROOM_FIELD_SHORE, + BEACH, DESERT_HILLS, - FOREST_HILLS, + WOODED_HILLS, TAIGA_HILLS, - SMALLER_EXTREME_HILLS, + MOUNTAIN_EDGE, JUNGLE, JUNGLE_HILLS, JUNGLE_EDGE, DEEP_OCEAN, - STONE_BEACH, - COLD_BEACH, + STONE_SHORE, + SNOWY_BEACH, BIRCH_FOREST, BIRCH_FOREST_HILLS, - ROOFED_FOREST, - TAIGA_COLD, - TAIGA_COLD_HILLS, - REDWOOD_TAIGA, - REDWOOD_TAIGA_HILLS, - EXTREME_HILLS_WITH_TREES, + DARK_FOREST, + SNOWY_TAIGA, + SNOWY_TAIGA_HILLS, + GIANT_TREE_TAIGA, + GIANT_TREE_TAIGA_HILLS, + WOODED_MOUNTAINS, SAVANNA, - SAVANNA_ROCK, - MESA, - MESA_ROCK, - MESA_CLEAR_ROCK, - VOID, - MUTATED_PLAINS, - MUTATED_DESERT, - MUTATED_EXTREME_HILLS, - MUTATED_FOREST, - MUTATED_TAIGA, - MUTATED_SWAMPLAND, - MUTATED_ICE_FLATS, - MUTATED_JUNGLE, - MUTATED_JUNGLE_EDGE, - MUTATED_BIRCH_FOREST, - MUTATED_BIRCH_FOREST_HILLS, - MUTATED_ROOFED_FOREST, - MUTATED_TAIGA_COLD, - MUTATED_REDWOOD_TAIGA, - MUTATED_REDWOOD_TAIGA_HILLS, - MUTATED_EXTREME_HILLS_WITH_TREES, - MUTATED_SAVANNA, - MUTATED_SAVANNA_ROCK, - MUTATED_MESA, - MUTATED_MESA_ROCK, - MUTATED_MESA_CLEAR_ROCK + SAVANNA_PLATEAU, + BADLANDS, + WOODED_BADLANDS_PLATEAU, + BADLANDS_PLATEAU, + SMALL_END_ISLANDS, + END_MIDLANDS, + END_HIGHLANDS, + END_BARRENS, + WARM_OCEAN, + LUKEWARM_OCEAN, + COLD_OCEAN, + DEEP_WARM_OCEAN, + DEEP_LUKEWARM_OCEAN, + DEEP_COLD_OCEAN, + DEEP_FROZEN_OCEAN, + THE_VOID, + SUNFLOWER_PLAINS, + DESERT_LAKES, + GRAVELLY_MOUNTAINS, + FLOWER_FOREST, + TAIGA_MOUNTAINS, + SWAMP_HILLS, + ICE_SPIKES, + MODIFIED_JUNGLE, + MODIFIED_JUNGLE_EDGE, + TALL_BIRCH_FOREST, + TALL_BIRCH_HILLS, + DARK_FOREST_HILLS, + SNOWY_TAIGA_MOUNTAINS, + GIANT_SPRUCE_TAIGA, + GIANT_SPRUCE_TAIGA_HILLS, + MODIFIED_GRAVELLY_MOUNTAINS, + SHATTERED_SAVANNA, + SHATTERED_SAVANNA_PLATEAU, + ERODED_BADLANDS, + MODIFIED_WOODED_BADLANDS_PLATEAU, + MODIFIED_BADLANDS_PLATEAU } diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java index 235c15bd..1aa3373f 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -6,6 +6,7 @@ import org.bukkit.Chunk; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.Location; +import org.bukkit.block.data.BlockData; import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.Metadatable; @@ -14,6 +15,11 @@ import org.bukkit.metadata.Metadatable; * any given location in a world. The state of the block may change * concurrently to your own handling of it; use block.getState() to get a * snapshot state of a block which will not be modified. + * + * <br> + * Note that parts of this class which require access to the world at large + * (i.e. lighting and power) may not be able to be safely accessed during world + * generation when used in cases like BlockPhysicsEvent!!!! */ public interface Block extends Metadatable { @@ -27,6 +33,13 @@ public interface Block extends Metadatable { byte getData(); /** + * Gets the complete block data for this block + * + * @return block specific data + */ + BlockData getBlockData(); + + /** * Gets the block at the given offsets * * @param modX X-coordinate offset @@ -73,15 +86,6 @@ public interface Block extends Metadatable { Material getType(); /** - * Gets the type-id of this block - * - * @return block type-id - * @deprecated Magic value - */ - @Deprecated - int getTypeId(); - - /** * Gets the light level between 0-15 * * @return light level @@ -180,52 +184,34 @@ public interface Block extends Metadatable { void setData(byte data, boolean applyPhysics); /** - * Sets the type of this block + * Sets the complete data for this block * - * @param type Material to change this block to + * @param data new block specific data */ - void setType(Material type); + void setBlockData(BlockData data); /** - * Sets the type of this block + * Sets the complete data for this block * - * @param type Material to change this block to - * @param applyPhysics False to cancel physics on the changed block. + * @param data new block specific data + * @param applyPhysics false to cancel physics from the changed block */ - void setType(Material type, boolean applyPhysics); + void setBlockData(BlockData data, boolean applyPhysics); /** - * Sets the type-id of this block + * Sets the type of this block * - * @param type Type-Id to change this block to - * @return whether the block was changed - * @deprecated Magic value + * @param type Material to change this block to */ - @Deprecated - boolean setTypeId(int type); + void setType(Material type); /** - * Sets the type-id of this block + * Sets the type of this block * - * @param type Type-Id to change this block to + * @param type Material to change this block to * @param applyPhysics False to cancel physics on the changed block. - * @return whether the block was changed - * @deprecated Magic value */ - @Deprecated - boolean setTypeId(int type, boolean applyPhysics); - - /** - * Sets the type-id of this block - * - * @param type Type-Id to change this block to - * @param data The data value to change this block to - * @param applyPhysics False to cancel physics on the changed block - * @return whether the block was changed - * @deprecated Magic value - */ - @Deprecated - boolean setTypeIdAndData(int type, byte data, boolean applyPhysics); + void setType(Material type, boolean applyPhysics); /** * Gets the face relation of this block compared to the given block. @@ -330,8 +316,7 @@ public interface Block extends Metadatable { * Checks if this block is liquid. * <p> * A block is considered liquid when {@link #getType()} returns {@link - * Material#WATER}, {@link Material#STATIONARY_WATER}, {@link - * Material#LAVA} or {@link Material#STATIONARY_LAVA}. + * Material#WATER} or {@link Material#LAVA}. * * @return true if this block is liquid */ diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java index 4b13d494..e6526060 100644 --- a/src/main/java/org/bukkit/block/BlockState.java +++ b/src/main/java/org/bukkit/block/BlockState.java @@ -4,6 +4,7 @@ import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; +import org.bukkit.block.data.BlockData; import org.bukkit.material.MaterialData; import org.bukkit.metadata.Metadatable; @@ -34,20 +35,18 @@ public interface BlockState extends Metadatable { MaterialData getData(); /** - * Gets the type of this block state. + * Gets the data for this block state. * - * @return block type + * @return block specific data */ - Material getType(); + BlockData getBlockData(); /** - * Gets the type-id of this block state. + * Gets the type of this block state. * - * @return block type-id - * @deprecated Magic value + * @return block type */ - @Deprecated - int getTypeId(); + Material getType(); /** * Gets the current light level of the block represented by this block state. @@ -124,21 +123,18 @@ public interface BlockState extends Metadatable { void setData(MaterialData data); /** - * Sets the type of this block state. + * Sets the data for this block state. * - * @param type Material to change this block state to + * @param data New block specific data */ - void setType(Material type); + void setBlockData(BlockData data); /** - * Sets the type-id of this block state. + * Sets the type of this block state. * - * @param type Type-Id to change this block state to - * @return Whether it worked? - * @deprecated Magic value + * @param type Material to change this block state to */ - @Deprecated - boolean setTypeId(int type); + void setType(Material type); /** * Attempts to update the block represented by this state, setting it to diff --git a/src/main/java/org/bukkit/block/Conduit.java b/src/main/java/org/bukkit/block/Conduit.java new file mode 100644 index 00000000..d889f41b --- /dev/null +++ b/src/main/java/org/bukkit/block/Conduit.java @@ -0,0 +1,6 @@ +package org.bukkit.block; + +/** + * Represents a captured state of a conduit. + */ +public interface Conduit extends BlockState { } diff --git a/src/main/java/org/bukkit/block/FlowerPot.java b/src/main/java/org/bukkit/block/FlowerPot.java index 5204717a..84029183 100644 --- a/src/main/java/org/bukkit/block/FlowerPot.java +++ b/src/main/java/org/bukkit/block/FlowerPot.java @@ -4,7 +4,9 @@ import org.bukkit.material.MaterialData; /** * Represents a captured state of a flower pot. + * @deprecated not a tile entity in future versions of Minecraft */ +@Deprecated public interface FlowerPot extends BlockState { /** diff --git a/src/main/java/org/bukkit/block/NoteBlock.java b/src/main/java/org/bukkit/block/NoteBlock.java index 2f9ac5c0..14bb68ba 100644 --- a/src/main/java/org/bukkit/block/NoteBlock.java +++ b/src/main/java/org/bukkit/block/NoteBlock.java @@ -5,7 +5,9 @@ import org.bukkit.Note; /** * Represents a captured state of a note block. + * @deprecated not a tile entity in future versions of Minecraft */ +@Deprecated public interface NoteBlock extends BlockState { /** diff --git a/src/main/java/org/bukkit/block/Skull.java b/src/main/java/org/bukkit/block/Skull.java index f69f9477..92363d33 100644 --- a/src/main/java/org/bukkit/block/Skull.java +++ b/src/main/java/org/bukkit/block/Skull.java @@ -1,7 +1,9 @@ package org.bukkit.block; +import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.SkullType; +import org.bukkit.block.data.BlockData; /** * Represents a captured state of a skull block. @@ -57,27 +59,35 @@ public interface Skull extends BlockState { * Gets the rotation of the skull in the world * * @return the rotation of the skull + * @deprecated use {@link BlockData} */ + @Deprecated public BlockFace getRotation(); /** * Sets the rotation of the skull in the world * * @param rotation the rotation of the skull + * @deprecated use {@link BlockData} */ + @Deprecated public void setRotation(BlockFace rotation); /** * Gets the type of skull * * @return the type of skull + * @deprecated check {@link Material} instead */ + @Deprecated public SkullType getSkullType(); /** * Sets the type of skull * * @param skullType the type of skull + * @deprecated check {@link Material} instead */ + @Deprecated public void setSkullType(SkullType skullType); } diff --git a/src/main/java/org/bukkit/block/data/Ageable.java b/src/main/java/org/bukkit/block/data/Ageable.java new file mode 100644 index 00000000..2f7b84a3 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/Ageable.java @@ -0,0 +1,33 @@ +package org.bukkit.block.data; + +/** + * 'age' represents the different growth stages that a crop-like block can go + * through. + * <br> + * A value of 0 indicates that the crop was freshly planted, whilst a value + * equal to {@link #getMaximumAge()} indicates that the crop is ripe and ready + * to be harvested. + */ +public interface Ageable extends BlockData { + + /** + * Gets the value of the 'age' property. + * + * @return the 'age' value + */ + int getAge(); + + /** + * Sets the value of the 'age' property. + * + * @param age the new 'age' value + */ + void setAge(int age); + + /** + * Gets the maximum allowed value of the 'age' property. + * + * @return the maximum 'age' value + */ + int getMaximumAge(); +} diff --git a/src/main/java/org/bukkit/block/data/AnaloguePowerable.java b/src/main/java/org/bukkit/block/data/AnaloguePowerable.java new file mode 100644 index 00000000..68ec26a1 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/AnaloguePowerable.java @@ -0,0 +1,31 @@ +package org.bukkit.block.data; + +/** + * 'power' represents the redstone power level currently being emitted or + * transmitted via this block. + * <br> + * May not be over 9000 or {@link #getMaximumPower()} (usually 15). + */ +public interface AnaloguePowerable extends BlockData { + + /** + * Gets the value of the 'power' property. + * + * @return the 'power' value + */ + int getPower(); + + /** + * Sets the value of the 'power' property. + * + * @param power the new 'power' value + */ + void setPower(int power); + + /** + * Gets the maximum allowed value of the 'power' property. + * + * @return the maximum 'power' value + */ + int getMaximumPower(); +} diff --git a/src/main/java/org/bukkit/block/data/Attachable.java b/src/main/java/org/bukkit/block/data/Attachable.java new file mode 100644 index 00000000..97c7fa72 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/Attachable.java @@ -0,0 +1,27 @@ +package org.bukkit.block.data; + +/** + * 'attached' denotes whether a tripwire hook or string forms a complete + * tripwire circuit and is ready to trigger. + * <br> + * Updating the property on a tripwire hook will change the texture to indicate + * a connected string, but will not have any effect when used on the tripwire + * string itself. It may however still be used to check whether the string forms + * a circuit. + */ +public interface Attachable extends BlockData { + + /** + * Gets the value of the 'attached' property. + * + * @return the 'attached' value + */ + boolean isAttached(); + + /** + * Sets the value of the 'attached' property. + * + * @param attached the new 'attached' value + */ + void setAttached(boolean attached); +} diff --git a/src/main/java/org/bukkit/block/data/Bisected.java b/src/main/java/org/bukkit/block/data/Bisected.java new file mode 100644 index 00000000..ece44a44 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/Bisected.java @@ -0,0 +1,37 @@ +package org.bukkit.block.data; + +/** + * 'half' denotes which half of a two block tall material this block is. + * <br> + * In game it may be referred to as either (top, bottom) or (upper, lower). + */ +public interface Bisected extends BlockData { + + /** + * Gets the value of the 'half' property. + * + * @return the 'half' value + */ + Half getHalf(); + + /** + * Sets the value of the 'half' property. + * + * @param half the new 'half' value + */ + void setHalf(Half half); + + /** + * The half of a vertically bisected block. + */ + public enum Half { + /** + * The top half of the block, normally with the higher y coordinate. + */ + TOP, + /** + * The bottom half of the block, normally with the lower y coordinate. + */ + BOTTOM; + } +} diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java new file mode 100644 index 00000000..b3e13733 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/BlockData.java @@ -0,0 +1,30 @@ +package org.bukkit.block.data; + +import org.bukkit.Material; +import org.bukkit.Server; + +public interface BlockData extends Cloneable { + + /** + * Get the Material represented by this block data. + * + * @return the material + */ + Material getMaterial(); + + /** + * Gets a string, which when passed into a method such as + * {@link Server#createBlockData(java.lang.String)} will unambiguously + * recreate this instance. + * + * @return serialized data string for this block + */ + String getAsString(); + + /** + * Returns a copy of this BlockData. + * + * @return a copy of the block data + */ + BlockData clone(); +} diff --git a/src/main/java/org/bukkit/block/data/Directional.java b/src/main/java/org/bukkit/block/data/Directional.java new file mode 100644 index 00000000..4e873e85 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/Directional.java @@ -0,0 +1,34 @@ +package org.bukkit.block.data; + +import java.util.Set; +import org.bukkit.block.BlockFace; + +/** + * 'facing' represents the face towards which the block is pointing. + * <br> + * Some blocks may not be able to face in all directions, use + * {@link #getFaces()} to get all possible directions for this block. + */ +public interface Directional extends BlockData { + + /** + * Gets the value of the 'facing' property. + * + * @return the 'facing' value + */ + BlockFace getFacing(); + + /** + * Sets the value of the 'facing' property. + * + * @param facing the new 'facing' value + */ + void setFacing(BlockFace facing); + + /** + * Gets the faces which are applicable to this block. + * + * @return the allowed 'facing' values + */ + Set<BlockFace> getFaces(); +} diff --git a/src/main/java/org/bukkit/block/data/Levelled.java b/src/main/java/org/bukkit/block/data/Levelled.java new file mode 100644 index 00000000..9eb10290 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/Levelled.java @@ -0,0 +1,31 @@ +package org.bukkit.block.data; + +/** + * 'level' represents the amount of fluid contained within this block, either by + * itself or inside a cauldron. + * <br> + * May not be higher than {@link #getMaximumLevel()}. + */ +public interface Levelled extends BlockData { + + /** + * Gets the value of the 'level' property. + * + * @return the 'level' value + */ + int getLevel(); + + /** + * Sets the value of the 'level' property. + * + * @param level the new 'level' value + */ + void setLevel(int level); + + /** + * Gets the maximum allowed value of the 'level' property. + * + * @return the maximum 'level' value + */ + int getMaximumLevel(); +} diff --git a/src/main/java/org/bukkit/block/data/Lightable.java b/src/main/java/org/bukkit/block/data/Lightable.java new file mode 100644 index 00000000..59a725e3 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/Lightable.java @@ -0,0 +1,22 @@ +package org.bukkit.block.data; + +/** + * 'lit' denotes whether this block (either a redstone torch or furnace) is + * currently lit - that is not burned out. + */ +public interface Lightable extends BlockData { + + /** + * Gets the value of the 'lit' property. + * + * @return the 'lit' value + */ + boolean isLit(); + + /** + * Sets the value of the 'lit' property. + * + * @param lit the new 'lit' value + */ + void setLit(boolean lit); +} diff --git a/src/main/java/org/bukkit/block/data/MultipleFacing.java b/src/main/java/org/bukkit/block/data/MultipleFacing.java new file mode 100644 index 00000000..76fda60d --- /dev/null +++ b/src/main/java/org/bukkit/block/data/MultipleFacing.java @@ -0,0 +1,45 @@ +package org.bukkit.block.data; + +import java.util.Set; +import org.bukkit.block.BlockFace; + +/** + * This class encompasses the 'north', 'east', 'south', 'west', 'up', 'down' + * boolean flags which are used to set which faces of the block textures are + * displayed on. + * <br> + * Some blocks may not be able to have faces on all directions, use + * {@link #getAllowedFaces()} to get all possible faces for this block. + */ +public interface MultipleFacing extends BlockData { + + /** + * Checks if this block has the specified face enabled. + * + * @param face to check + * @return if face is enabled + */ + boolean hasFace(BlockFace face); + + /** + * Set whether this block has the specified face enabled. + * + * @param face to set + * @param has the face + */ + void setFace(BlockFace face, boolean has); + + /** + * Get all of the faces which are enabled on this block. + * + * @return all faces enabled + */ + Set<BlockFace> getFaces(); + + /** + * Gets all of this faces which may be set on this block. + * + * @return all allowed faces + */ + Set<BlockFace> getAllowedFaces(); +} diff --git a/src/main/java/org/bukkit/block/data/Openable.java b/src/main/java/org/bukkit/block/data/Openable.java new file mode 100644 index 00000000..c04944ed --- /dev/null +++ b/src/main/java/org/bukkit/block/data/Openable.java @@ -0,0 +1,21 @@ +package org.bukkit.block.data; + +/** + * 'open' denotes whether this door-like block is currently opened. + */ +public interface Openable extends BlockData { + + /** + * Gets the value of the 'open' property. + * + * @return the 'open' value + */ + boolean isOpen(); + + /** + * Sets the value of the 'open' property. + * + * @param open the new 'open' value + */ + void setOpen(boolean open); +} diff --git a/src/main/java/org/bukkit/block/data/Orientable.java b/src/main/java/org/bukkit/block/data/Orientable.java new file mode 100644 index 00000000..f9cf2983 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/Orientable.java @@ -0,0 +1,35 @@ +package org.bukkit.block.data; + +import java.util.Set; +import org.bukkit.Axis; + +/** + * 'axis' represents the axis along whilst this block is oriented. + * <br> + * Some blocks such as the portal block may not be able to be placed in all + * orientations, use {@link #getAxes()} to retrieve all possible such + * orientations. + */ +public interface Orientable extends BlockData { + + /** + * Gets the value of the 'axis' property. + * + * @return the 'axis' value + */ + Axis getAxis(); + + /** + * Sets the value of the 'axis' property. + * + * @param axis the new 'axis' value + */ + void setAxis(Axis axis); + + /** + * Gets the axes which are applicable to this block. + * + * @return the allowed 'axis' values + */ + Set<Axis> getAxes(); +} diff --git a/src/main/java/org/bukkit/block/data/Powerable.java b/src/main/java/org/bukkit/block/data/Powerable.java new file mode 100644 index 00000000..994f72f5 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/Powerable.java @@ -0,0 +1,22 @@ +package org.bukkit.block.data; + +/** + * 'powered' indicates whether this block is in the powered state or not, i.e. + * receiving a redstone current of power > 0. + */ +public interface Powerable extends BlockData { + + /** + * Gets the value of the 'powered' property. + * + * @return the 'powered' value + */ + boolean isPowered(); + + /** + * Sets the value of the 'powered' property. + * + * @param powered the new 'powered' value + */ + void setPowered(boolean powered); +} diff --git a/src/main/java/org/bukkit/block/data/Rail.java b/src/main/java/org/bukkit/block/data/Rail.java new file mode 100644 index 00000000..18df0c09 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/Rail.java @@ -0,0 +1,84 @@ +package org.bukkit.block.data; + +import java.util.Set; + +/** + * 'shape' represents the current layout of a minecart rail. + * <br> + * Some types of rail may not be able to be laid out in all shapes, use + * {@link #getShapes()} to get those applicable to this block. + */ +public interface Rail extends BlockData { + + /** + * Gets the value of the 'shape' property. + * + * @return the 'shape' value + */ + Shape getShape(); + + /** + * Sets the value of the 'shape' property. + * + * @param shape the new 'shape' value + */ + void setShape(Shape shape); + + /** + * Gets the shapes which are applicable to this block. + * + * @return the allowed 'shape' values + */ + Set<Shape> getShapes(); + + /** + * The different types of shapes a rail block can occupy. + */ + public enum Shape { + + /** + * The rail runs flat along the north/south (Z) axis. + */ + NORTH_SOUTH, + /** + * The rail runs flat along the east/west (X) axis. + */ + EAST_WEST, + /** + * The rail ascends in the east (positive X) direction. + */ + ASCENDING_EAST, + /** + * The rail ascends in the west (negative X) direction. + */ + ASCENDING_WEST, + /** + * The rail ascends in the north (negative Z) direction. + */ + ASCENDING_NORTH, + /** + * The rail ascends in the south (positive Z) direction. + */ + ASCENDING_SOUTH, + /** + * The rail forms a curve connecting the south and east faces of the + * block. + */ + SOUTH_EAST, + /** + * The rail forms a curve connecting the south and west faces of the + * block. + */ + SOUTH_WEST, + /** + * The rail forms a curve connecting the north and west faces of the + * block. + */ + NORTH_WEST, + /** + * The rail forms a curve connecting the north and east faces of the + * block. + */ + NORTH_EAST; + } +} diff --git a/src/main/java/org/bukkit/block/data/Rotatable.java b/src/main/java/org/bukkit/block/data/Rotatable.java new file mode 100644 index 00000000..07b3f615 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/Rotatable.java @@ -0,0 +1,23 @@ +package org.bukkit.block.data; + +import org.bukkit.block.BlockFace; + +/** + * 'rotation' represents the current rotation of this block. + */ +public interface Rotatable extends BlockData { + + /** + * Gets the value of the 'rotation' property. + * + * @return the 'rotation' value + */ + BlockFace getRotation(); + + /** + * Sets the value of the 'rotation' property. + * + * @param rotation the new 'rotation' value + */ + void setRotation(BlockFace rotation); +} diff --git a/src/main/java/org/bukkit/block/data/Snowable.java b/src/main/java/org/bukkit/block/data/Snowable.java new file mode 100644 index 00000000..dbb034ed --- /dev/null +++ b/src/main/java/org/bukkit/block/data/Snowable.java @@ -0,0 +1,22 @@ +package org.bukkit.block.data; + +/** + * 'snowy' denotes whether this block has a snow covered side and top texture + * (normally because the block above is snow). + */ +public interface Snowable extends BlockData { + + /** + * Gets the value of the 'snowy' property. + * + * @return the 'snowy' value + */ + boolean isSnowy(); + + /** + * Sets the value of the 'snowy' property. + * + * @param snowy the new 'snowy' value + */ + void setSnowy(boolean snowy); +} diff --git a/src/main/java/org/bukkit/block/data/Waterlogged.java b/src/main/java/org/bukkit/block/data/Waterlogged.java new file mode 100644 index 00000000..400cc997 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/Waterlogged.java @@ -0,0 +1,21 @@ +package org.bukkit.block.data; + +/** + * 'waterlogged' denotes whether this block has fluid in it. + */ +public interface Waterlogged extends BlockData { + + /** + * Gets the value of the 'waterlogged' property. + * + * @return the 'waterlogged' value + */ + boolean isWaterlogged(); + + /** + * Sets the value of the 'waterlogged' property. + * + * @param waterlogged the new 'waterlogged' value + */ + void setWaterlogged(boolean waterlogged); +} diff --git a/src/main/java/org/bukkit/block/data/type/Bed.java b/src/main/java/org/bukkit/block/data/type/Bed.java new file mode 100644 index 00000000..bc1c95b0 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Bed.java @@ -0,0 +1,50 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Bisected; +import org.bukkit.block.data.Directional; + +/** + * Similar to {@link Bisected}, 'part' denotes which half of the bed this block + * corresponds to. + * <br> + * 'occupied' property is a quick flag to check if a player is currently + * sleeping in this bed block. + */ +public interface Bed extends Directional { + + /** + * Gets the value of the 'part' property. + * + * @return the 'part' value + */ + Part getPart(); + + /** + * Sets the value of the 'part' property. + * + * @param part the new 'part' value + */ + void setPart(Part part); + + /** + * Gets the value of the 'occupied' property. + * + * @return the 'occupied' value + */ + boolean isOccupied(); + + /** + * Horizontal half of a bed. + */ + public enum Part { + + /** + * The head is the upper part of the bed containing the pillow. + */ + HEAD, + /** + * The foot is the lower half of the bed. + */ + FOOT; + } +} diff --git a/src/main/java/org/bukkit/block/data/type/BrewingStand.java b/src/main/java/org/bukkit/block/data/type/BrewingStand.java new file mode 100644 index 00000000..76945700 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/BrewingStand.java @@ -0,0 +1,43 @@ +package org.bukkit.block.data.type; + +import java.util.Set; +import org.bukkit.block.data.BlockData; + +/** + * Interface to the 'has_bottle_0', 'has_bottle_1', 'has_bottle_2' flags on a + * brewing stand which indicate which bottles are rendered on the outside. + * <br> + * Stand may have 0, 1... {@link #getMaximumBottles()}-1 bottles. + */ +public interface BrewingStand extends BlockData { + + /** + * Checks if the stand has the following bottle + * + * @param bottle to check + * @return if bottle is present + */ + boolean hasBottle(int bottle); + + /** + * Set whether the stand has this bottle present. + * + * @param bottle to set + * @param has bottle + */ + void setBottle(int bottle, boolean has); + + /** + * Get the indexes of all the bottles present on this block. + * + * @return set of all bottles + */ + Set<Integer> getBottles(); + + /** + * Get the maximum amount of bottles present on this stand. + * + * @return maximum bottle count + */ + int getMaximumBottles(); +} diff --git a/src/main/java/org/bukkit/block/data/type/BubbleColumn.java b/src/main/java/org/bukkit/block/data/type/BubbleColumn.java new file mode 100644 index 00000000..5ab82d20 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/BubbleColumn.java @@ -0,0 +1,25 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.BlockData; + +/** + * 'drag' indicates whether a force will be applied on entities moving through + * this block. + */ +public interface BubbleColumn extends BlockData { + + /** + * Gets the value of the 'drag' property. + * + * @return the 'part' value + */ + boolean isDrag(); + + /** + * Sets the value of the 'drag' property. + * + * @param drag the new 'drag' value + */ + void setDrag(boolean drag); + +} diff --git a/src/main/java/org/bukkit/block/data/type/Cake.java b/src/main/java/org/bukkit/block/data/type/Cake.java new file mode 100644 index 00000000..65c9ea1e --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Cake.java @@ -0,0 +1,34 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.BlockData; + +/** + * 'bites' represents the amount of bites which have been taken from this slice + * of cake. + * <br> + * A value of 0 indicates that the cake has not been eaten, whilst a value of + * {@link #getMaximumBites()} indicates that it is all gone :( + */ +public interface Cake extends BlockData { + + /** + * Gets the value of the 'bites' property. + * + * @return the 'bites' value + */ + int getBites(); + + /** + * Sets the value of the 'bites' property. + * + * @param bites the new 'bites' value + */ + void setBites(int bites); + + /** + * Gets the maximum allowed value of the 'bites' property. + * + * @return the maximum 'bites' value + */ + int getMaximumBites(); +} diff --git a/src/main/java/org/bukkit/block/data/type/Chest.java b/src/main/java/org/bukkit/block/data/type/Chest.java new file mode 100644 index 00000000..4326901b --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Chest.java @@ -0,0 +1,46 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Waterlogged; + +/** + * 'type' represents which part of a double chest this block is, or if it is a + * single chest. + */ +public interface Chest extends Directional, Waterlogged { + + /** + * Gets the value of the 'type' property. + * + * @return the 'type' value + */ + Type getType(); + + /** + * Sets the value of the 'type' property. + * + * @param type the new 'type' value + */ + void setType(Type type); + + /** + * Type of this chest block. + */ + public enum Type { + /** + * The chest is not linked to any others and contains only one 27 slot + * inventory. + */ + SINGLE, + /** + * The chest is the left hand side of a double chest and shares a 54 + * block inventory with the chest to its right. + */ + LEFT, + /** + * The chest is the right hand side of a double chest and shares a 54 + * block inventory with the chest to its left. + */ + RIGHT; + } +} diff --git a/src/main/java/org/bukkit/block/data/type/Cocoa.java b/src/main/java/org/bukkit/block/data/type/Cocoa.java new file mode 100644 index 00000000..092e46c7 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Cocoa.java @@ -0,0 +1,7 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Ageable; +import org.bukkit.block.data.Directional; + +public interface Cocoa extends Ageable, Directional { +} diff --git a/src/main/java/org/bukkit/block/data/type/CommandBlock.java b/src/main/java/org/bukkit/block/data/type/CommandBlock.java new file mode 100644 index 00000000..9a7122c9 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/CommandBlock.java @@ -0,0 +1,24 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; + +/** + * 'conditional' denotes whether this command block is conditional or not, i.e. + * will only execute if the preceeding command block also executed successfully. + */ +public interface CommandBlock extends Directional { + + /** + * Gets the value of the 'conditional' property. + * + * @return the 'conditional' value + */ + boolean isConditional(); + + /** + * Sets the value of the 'conditional' property. + * + * @param conditional the new 'conditional' value + */ + void setConditional(boolean conditional); +} diff --git a/src/main/java/org/bukkit/block/data/type/Comparator.java b/src/main/java/org/bukkit/block/data/type/Comparator.java new file mode 100644 index 00000000..efc7982d --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Comparator.java @@ -0,0 +1,41 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Powerable; + +/** + * 'mode' indicates what mode this comparator will operate in. + */ +public interface Comparator extends Directional, Powerable { + + /** + * Gets the value of the 'mode' property. + * + * @return the 'mode' value + */ + Mode getMode(); + + /** + * Sets the value of the 'mode' property. + * + * @param mode the new 'mode' value + */ + void setMode(Mode mode); + + /** + * The mode in which a comparator will operate in. + */ + public enum Mode { + + /** + * The default mode, similar to a transistor. The comparator will turn + * off if either side input is greater than the rear input. + */ + COMPARE, + /** + * Alternate subtraction mode. The output signal strength will be equal + * to max(rear-max(left,right),0). + */ + SUBTRACT; + } +} diff --git a/src/main/java/org/bukkit/block/data/type/DaylightDetector.java b/src/main/java/org/bukkit/block/data/type/DaylightDetector.java new file mode 100644 index 00000000..deefb6c6 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/DaylightDetector.java @@ -0,0 +1,24 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.AnaloguePowerable; + +/** + * 'inverted' denotes whether this daylight detector is in the inverted mode, + * i.e. activates in the absence of light rather than presence." + */ +public interface DaylightDetector extends AnaloguePowerable { + + /** + * Gets the value of the 'inverted' property. + * + * @return the 'inverted' value + */ + boolean isInverted(); + + /** + * Sets the value of the 'inverted' property. + * + * @param inverted the new 'inverted' value + */ + void setInverted(boolean inverted); +} diff --git a/src/main/java/org/bukkit/block/data/type/Dispenser.java b/src/main/java/org/bukkit/block/data/type/Dispenser.java new file mode 100644 index 00000000..fea25e1c --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Dispenser.java @@ -0,0 +1,25 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Powerable; + +/** + * Similar to {@link Powerable}, 'triggered' indicates whether or not the + * dispenser is currently activated. + */ +public interface Dispenser extends Directional { + + /** + * Gets the value of the 'triggered' property. + * + * @return the 'triggered' value + */ + boolean isTriggered(); + + /** + * Sets the value of the 'triggered' property. + * + * @param triggered the new 'triggered' value + */ + void setTriggered(boolean triggered); +} diff --git a/src/main/java/org/bukkit/block/data/type/Door.java b/src/main/java/org/bukkit/block/data/type/Door.java new file mode 100644 index 00000000..dfea0933 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Door.java @@ -0,0 +1,41 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Bisected; +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Openable; +import org.bukkit.block.data.Powerable; + +/** + * 'hinge' indicates which hinge this door is attached to and will rotate around + * when opened. + */ +public interface Door extends Bisected, Directional, Openable, Powerable { + + /** + * Gets the value of the 'hinge' property. + * + * @return the 'hinge' value + */ + Hinge getHinge(); + + /** + * Sets the value of the 'hinge' property. + * + * @param hinge the new 'hinge' value + */ + void setHinge(Hinge hinge); + + /** + * The hinge of a door. + */ + public enum Hinge { + /** + * Door is attached to the left side. + */ + LEFT, + /** + * Door is attached to the right side. + */ + RIGHT; + } +} diff --git a/src/main/java/org/bukkit/block/data/type/EndPortalFrame.java b/src/main/java/org/bukkit/block/data/type/EndPortalFrame.java new file mode 100644 index 00000000..6c181d63 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/EndPortalFrame.java @@ -0,0 +1,24 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; + +/** + * 'eye' denotes whether this end portal frame has been activated by having an + * eye of ender placed in it. + */ +public interface EndPortalFrame extends Directional { + + /** + * Gets the value of the 'eye' property. + * + * @return the 'eye' value + */ + boolean hasEye(); + + /** + * Sets the value of the 'eye' property. + * + * @param eye the new 'eye' value + */ + void setEye(boolean eye); +} diff --git a/src/main/java/org/bukkit/block/data/type/EnderChest.java b/src/main/java/org/bukkit/block/data/type/EnderChest.java new file mode 100644 index 00000000..5a9e04c4 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/EnderChest.java @@ -0,0 +1,7 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Waterlogged; + +public interface EnderChest extends Directional, Waterlogged { +} diff --git a/src/main/java/org/bukkit/block/data/type/Farmland.java b/src/main/java/org/bukkit/block/data/type/Farmland.java new file mode 100644 index 00000000..a9fff6f6 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Farmland.java @@ -0,0 +1,34 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.BlockData; + +/** + * The 'moisture' level of farmland indicates how close it is to a water source + * (if any). + * <br> + * A higher moisture level leads, to faster growth of crops on this block, but + * cannot be higher than {@link #getMaximumMoisture()}. + */ +public interface Farmland extends BlockData { + + /** + * Gets the value of the 'moisture' property. + * + * @return the 'moisture' value + */ + int getMoisture(); + + /** + * Sets the value of the 'moisture' property. + * + * @param moisture the new 'moisture' value + */ + void setMoisture(int moisture); + + /** + * Gets the maximum allowed value of the 'moisture' property. + * + * @return the maximum 'moisture' value + */ + int getMaximumMoisture(); +} diff --git a/src/main/java/org/bukkit/block/data/type/Fence.java b/src/main/java/org/bukkit/block/data/type/Fence.java new file mode 100644 index 00000000..f2c62742 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Fence.java @@ -0,0 +1,7 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.MultipleFacing; +import org.bukkit.block.data.Waterlogged; + +public interface Fence extends MultipleFacing, Waterlogged { +} diff --git a/src/main/java/org/bukkit/block/data/type/Fire.java b/src/main/java/org/bukkit/block/data/type/Fire.java new file mode 100644 index 00000000..6282d021 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Fire.java @@ -0,0 +1,10 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Ageable; +import org.bukkit.block.data.MultipleFacing; + +/** + * md_5's mixtape. + */ +public interface Fire extends Ageable, MultipleFacing { +} diff --git a/src/main/java/org/bukkit/block/data/type/Furnace.java b/src/main/java/org/bukkit/block/data/type/Furnace.java new file mode 100644 index 00000000..830366ce --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Furnace.java @@ -0,0 +1,7 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Lightable; + +public interface Furnace extends Directional, Lightable { +} diff --git a/src/main/java/org/bukkit/block/data/type/Gate.java b/src/main/java/org/bukkit/block/data/type/Gate.java new file mode 100644 index 00000000..494f97d4 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Gate.java @@ -0,0 +1,26 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Openable; +import org.bukkit.block.data.Powerable; + +/** + * 'in_wall" indicates if the fence gate is attached to a wall, and if true the + * texture is lowered by a small amount to blend in better. + */ +public interface Gate extends Directional, Openable, Powerable { + + /** + * Gets the value of the 'in_wall' property. + * + * @return the 'in_wall' value + */ + boolean isInWall(); + + /** + * Sets the value of the 'in_wall' property. + * + * @param inWall the new 'in_wall' value + */ + void setInWall(boolean inWall); +} diff --git a/src/main/java/org/bukkit/block/data/type/GlassPane.java b/src/main/java/org/bukkit/block/data/type/GlassPane.java new file mode 100644 index 00000000..44eaa553 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/GlassPane.java @@ -0,0 +1,7 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.MultipleFacing; +import org.bukkit.block.data.Waterlogged; + +public interface GlassPane extends MultipleFacing, Waterlogged { +} diff --git a/src/main/java/org/bukkit/block/data/type/Hopper.java b/src/main/java/org/bukkit/block/data/type/Hopper.java new file mode 100644 index 00000000..b176fc8b --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Hopper.java @@ -0,0 +1,28 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Powerable; + +/** + * Similar to {@link Powerable}, 'enabled' indicates whether or not the hopper + * is currently activated. + * <br> + * Unlike most other blocks, a hopper is only enabled when it is <b>not</b> + * receiving any power. + */ +public interface Hopper extends Directional { + + /** + * Gets the value of the 'enabled' property. + * + * @return the 'enabled' value + */ + boolean isEnabled(); + + /** + * Sets the value of the 'enabled' property. + * + * @param enabled the new 'enabled' value + */ + void setEnabled(boolean enabled); +} diff --git a/src/main/java/org/bukkit/block/data/type/Jukebox.java b/src/main/java/org/bukkit/block/data/type/Jukebox.java new file mode 100644 index 00000000..5e371362 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Jukebox.java @@ -0,0 +1,17 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.BlockData; + +/** + * 'has_record' is a quick flag to check whether this jukebox has a record + * inside it. + */ +public interface Jukebox extends BlockData { + + /** + * Gets the value of the 'has_record' property. + * + * @return the 'has_record' value + */ + boolean hasRecord(); +} diff --git a/src/main/java/org/bukkit/block/data/type/Ladder.java b/src/main/java/org/bukkit/block/data/type/Ladder.java new file mode 100644 index 00000000..ee1b340f --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Ladder.java @@ -0,0 +1,7 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Waterlogged; + +public interface Ladder extends Directional, Waterlogged { +} diff --git a/src/main/java/org/bukkit/block/data/type/Leaves.java b/src/main/java/org/bukkit/block/data/type/Leaves.java new file mode 100644 index 00000000..3874d5d9 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Leaves.java @@ -0,0 +1,42 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.BlockData; + +/** + * 'persistent' indicates whether or not leaves will be checked by the server to + * see if they are subject to decay or not. + * <br> + * 'distance' denotes how far the block is from a tree and is used in + * conjunction with 'persistent' flag to determine if the leaves will decay or + * not. + */ +public interface Leaves extends BlockData { + + /** + * Gets the value of the 'persistent' property. + * + * @return the persistent value + */ + boolean isPersistent(); + + /** + * Sets the value of the 'persistent' property. + * + * @param persistent the new 'persistent' value + */ + void setPersistent(boolean persistent); + + /** + * Gets the value of the 'distance' property. + * + * @return the 'distance' value + */ + int getDistance(); + + /** + * Sets the value of the 'distance' property. + * + * @param distance the new 'distance' value + */ + void setDistance(int distance); +} diff --git a/src/main/java/org/bukkit/block/data/type/NoteBlock.java b/src/main/java/org/bukkit/block/data/type/NoteBlock.java new file mode 100644 index 00000000..fb3a6ce5 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/NoteBlock.java @@ -0,0 +1,41 @@ +package org.bukkit.block.data.type; + +import org.bukkit.Instrument; +import org.bukkit.Note; +import org.bukkit.block.data.Powerable; + +/** + * 'instrument' is the type of sound made when this note block is activated. + * <br> + * 'note' is the specified tuned pitch that the instrument will be played in. + */ +public interface NoteBlock extends Powerable { + + /** + * Gets the value of the 'instrument' property. + * + * @return the 'instrument' value + */ + Instrument getInstrument(); + + /** + * Sets the value of the 'instrument' property. + * + * @param instrument the new 'instrument' value + */ + void setInstrument(Instrument instrument); + + /** + * Gets the value of the 'note' property. + * + * @return the 'note' value + */ + Note getNote(); + + /** + * Sets the value of the 'note' property. + * + * @param note the new 'note' value + */ + void setNote(Note note); +} diff --git a/src/main/java/org/bukkit/block/data/type/Observer.java b/src/main/java/org/bukkit/block/data/type/Observer.java new file mode 100644 index 00000000..f40c7350 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Observer.java @@ -0,0 +1,7 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Powerable; + +public interface Observer extends Directional, Powerable { +} diff --git a/src/main/java/org/bukkit/block/data/type/Piston.java b/src/main/java/org/bukkit/block/data/type/Piston.java new file mode 100644 index 00000000..9eec7317 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Piston.java @@ -0,0 +1,23 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; + +/** + * 'extended' denotes whether the piston head is currently extended or not. + */ +public interface Piston extends Directional { + + /** + * Gets the value of the 'extended' property. + * + * @return the 'extended' value + */ + boolean isExtended(); + + /** + * Sets the value of the 'extended' property. + * + * @param extended the new 'extended' value + */ + void setExtended(boolean extended); +} diff --git a/src/main/java/org/bukkit/block/data/type/PistonHead.java b/src/main/java/org/bukkit/block/data/type/PistonHead.java new file mode 100644 index 00000000..d1eaa20a --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/PistonHead.java @@ -0,0 +1,22 @@ +package org.bukkit.block.data.type; + +/** + * 'short' denotes this piston head is shorter than the usual amount because it + * is currently retracting. + */ +public interface PistonHead extends TechnicalPiston { + + /** + * Gets the value of the 'short' property. + * + * @return the 'short' value + */ + boolean isShort(); + + /** + * Sets the value of the 'short' property. + * + * @param _short the new 'short' value + */ + void setShort(boolean _short); +} diff --git a/src/main/java/org/bukkit/block/data/type/RedstoneRail.java b/src/main/java/org/bukkit/block/data/type/RedstoneRail.java new file mode 100644 index 00000000..1cf7630c --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/RedstoneRail.java @@ -0,0 +1,10 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Powerable; +import org.bukkit.block.data.Rail; + +/** + * A type of minecart rail which interacts with redstone in one way or another. + */ +public interface RedstoneRail extends Powerable, Rail { +} diff --git a/src/main/java/org/bukkit/block/data/type/RedstoneWallTorch.java b/src/main/java/org/bukkit/block/data/type/RedstoneWallTorch.java new file mode 100644 index 00000000..7e1e0985 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/RedstoneWallTorch.java @@ -0,0 +1,7 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Lightable; + +public interface RedstoneWallTorch extends Directional, Lightable { +} diff --git a/src/main/java/org/bukkit/block/data/type/RedstoneWire.java b/src/main/java/org/bukkit/block/data/type/RedstoneWire.java new file mode 100644 index 00000000..c5e8d1ec --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/RedstoneWire.java @@ -0,0 +1,53 @@ +package org.bukkit.block.data.type; + +import java.util.Set; +import org.bukkit.block.BlockFace; +import org.bukkit.block.data.AnaloguePowerable; + +/** + * 'north', 'east', 'south', 'west' represent the types of connections this + * redstone wire has to adjacent blocks. + */ +public interface RedstoneWire extends AnaloguePowerable { + + /** + * Checks the type of connection on the specified face. + * + * @param face to check + * @return connection type + */ + Connection getFace(BlockFace face); + + /** + * Sets the type of connection on the specified face. + * + * @param face to set + * @param connection the connection type + */ + void setFace(BlockFace face, Connection connection); + + /** + * Gets all of this faces which may be set on this block. + * + * @return all allowed faces + */ + Set<BlockFace> getAllowedFaces(); + + /** + * The way in which a redstone wire can connect to an adjacent block face. + */ + public enum Connection { + /** + * The wire travels up the side of the block adjacent to this face. + */ + UP, + /** + * The wire travels flat from this face and into the adjacent block. + */ + SIDE, + /** + * The wire does not connect in this direction. + */ + NONE; + } +} diff --git a/src/main/java/org/bukkit/block/data/type/Repeater.java b/src/main/java/org/bukkit/block/data/type/Repeater.java new file mode 100644 index 00000000..a78563ed --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Repeater.java @@ -0,0 +1,62 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Powerable; + +/** + * 'delay' is the propagation delay of a repeater, i.e. how many ticks before it + * will be activated from a current change and propagate it to the next block. + * <br> + * Delay may not be lower than {@link #getMinimumDelay()} or higher than + * {@link #getMaximumDelay()}. + * <br> + * 'locked' denotes whether the repeater is in the locked state or not. + * <br> + * A locked repeater will not change its output until it is unlocked. In game, a + * locked repeater is created by having a constant current perpendicularly + * entering the block. + */ +public interface Repeater extends Directional, Powerable { + + /** + * Gets the value of the 'delay' property. + * + * @return the 'delay' value + */ + int getDelay(); + + /** + * Sets the value of the 'delay' property. + * + * @param delay the new 'delay' value + */ + void setDelay(int delay); + + /** + * Gets the minimum allowed value of the 'delay' property. + * + * @return the minimum 'delay' value + */ + int getMinimumDelay(); + + /** + * Gets the maximum allowed value of the 'delay' property. + * + * @return the maximum 'delay' value + */ + int getMaximumDelay(); + + /** + * Gets the value of the 'locked' property. + * + * @return the 'locked' value + */ + boolean isLocked(); + + /** + * Sets the value of the 'locked' property. + * + * @param locked the new 'locked' value + */ + void setLocked(boolean locked); +} diff --git a/src/main/java/org/bukkit/block/data/type/Sapling.java b/src/main/java/org/bukkit/block/data/type/Sapling.java new file mode 100644 index 00000000..a4e1c2f4 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Sapling.java @@ -0,0 +1,33 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.BlockData; + +/** + * 'stage' represents the growth stage of a sapling. + * <br> + * When the sapling reaches {@link #getMaximumStage()} it will attempt to grow + * into a tree as the next stage. + */ +public interface Sapling extends BlockData { + + /** + * Gets the value of the 'stage' property. + * + * @return the 'stage' value + */ + int getStage(); + + /** + * Sets the value of the 'stage' property. + * + * @param stage the new 'stage' value + */ + void setStage(int stage); + + /** + * Gets the maximum allowed value of the 'stage' property. + * + * @return the maximum 'stage' value + */ + int getMaximumStage(); +} diff --git a/src/main/java/org/bukkit/block/data/type/SeaPickle.java b/src/main/java/org/bukkit/block/data/type/SeaPickle.java new file mode 100644 index 00000000..62013c6a --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/SeaPickle.java @@ -0,0 +1,37 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Waterlogged; + +/** + * 'pickles' indicates the number of pickles in this block. + */ +public interface SeaPickle extends Waterlogged { + + /** + * Gets the value of the 'pickles' property. + * + * @return the 'pickles' value + */ + int getPickles(); + + /** + * Sets the value of the 'pickles' property. + * + * @param pickles the new 'pickles' value + */ + void setPickles(int pickles); + + /** + * Gets the minimum allowed value of the 'pickles' property. + * + * @return the minimum 'pickles' value + */ + int getMinimumPickles(); + + /** + * Gets the maximum allowed value of the 'pickles' property. + * + * @return the maximum 'pickles' value + */ + int getMaximumPickles(); +} diff --git a/src/main/java/org/bukkit/block/data/type/Sign.java b/src/main/java/org/bukkit/block/data/type/Sign.java new file mode 100644 index 00000000..29ef2c5b --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Sign.java @@ -0,0 +1,7 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Rotatable; +import org.bukkit.block.data.Waterlogged; + +public interface Sign extends Rotatable, Waterlogged { +} diff --git a/src/main/java/org/bukkit/block/data/type/Slab.java b/src/main/java/org/bukkit/block/data/type/Slab.java new file mode 100644 index 00000000..4e675a50 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Slab.java @@ -0,0 +1,43 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.BlockData; +import org.bukkit.block.data.Waterlogged; + +/** + * 'type' represents what state the slab is in - either top, bottom, or a double + * slab occupying the full block. + */ +public interface Slab extends BlockData, Waterlogged { + + /** + * Gets the value of the 'type' property. + * + * @return the 'type' value + */ + Type getType(); + + /** + * Sets the value of the 'type' property. + * + * @param type the new 'type' value + */ + void setType(Type type); + + /** + * The type of the slab. + */ + public enum Type { + /** + * The slab occupies the upper y half of the block. + */ + TOP, + /** + * The slab occupies the lower y half of the block. + */ + BOTTOM, + /** + * The slab occupies the entire block. + */ + DOUBLE; + } +} diff --git a/src/main/java/org/bukkit/block/data/type/Snow.java b/src/main/java/org/bukkit/block/data/type/Snow.java new file mode 100644 index 00000000..9c089cff --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Snow.java @@ -0,0 +1,41 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.BlockData; + +/** + * 'layers' represents the amount of layers of snow which are present in this + * block. + * <br> + * May not be lower than {@link #getMinimumLayers()} or higher than + * {@link #getMaximumLayers()}. + */ +public interface Snow extends BlockData { + + /** + * Gets the value of the 'layers' property. + * + * @return the 'layers' value + */ + int getLayers(); + + /** + * Sets the value of the 'layers' property. + * + * @param layers the new 'layers' value + */ + void setLayers(int layers); + + /** + * Gets the minimum allowed value of the 'layers' property. + * + * @return the minimum 'layers' value + */ + int getMinimumLayers(); + + /** + * Gets the maximum allowed value of the 'layers' property. + * + * @return the maximum 'layers' value + */ + int getMaximumLayers(); +} diff --git a/src/main/java/org/bukkit/block/data/type/Stairs.java b/src/main/java/org/bukkit/block/data/type/Stairs.java new file mode 100644 index 00000000..7bdf8de8 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Stairs.java @@ -0,0 +1,51 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Bisected; +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Waterlogged; + +/** + * 'shape' represents the texture and bounding box shape of these stairs. + */ +public interface Stairs extends Bisected, Directional, Waterlogged { + + /** + * Gets the value of the 'shape' property. + * + * @return the 'shape' value + */ + Shape getShape(); + + /** + * Sets the value of the 'shape' property. + * + * @param shape the new 'shape' value + */ + void setShape(Shape shape); + + /** + * The shape of a stair block - used for constructing corners. + */ + public enum Shape { + /** + * Regular stair block. + */ + STRAIGHT, + /** + * Inner corner stair block with higher left side. + */ + INNER_LEFT, + /** + * Inner corner stair block with higher right side. + */ + INNER_RIGHT, + /** + * Outer corner stair block with higher left side. + */ + OUTER_LEFT, + /** + * Outer corner stair block with higher right side. + */ + OUTER_RIGHT; + } +} diff --git a/src/main/java/org/bukkit/block/data/type/StructureBlock.java b/src/main/java/org/bukkit/block/data/type/StructureBlock.java new file mode 100644 index 00000000..db09bf05 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/StructureBlock.java @@ -0,0 +1,47 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.BlockData; + +/** + * 'mode' represents the different modes in which this structure block may + * operate. + */ +public interface StructureBlock extends BlockData { + + /** + * Gets the value of the 'mode' property. + * + * @return the 'mode' value + */ + Mode getMode(); + + /** + * Sets the value of the 'mode' property. + * + * @param mode the new 'mode' value + */ + void setMode(Mode mode); + + /** + * Operating mode of a structure block. + */ + public enum Mode { + /** + * Allows selection and saving of a structure. + */ + SAVE, + /** + * Allows loading of a structure. + */ + LOAD, + /** + * Used for detection of two opposite corners of a structure. + */ + CORNER, + /** + * Dummy block used to run a custom function during world generation + * before being removed. + */ + DATA; + } +} diff --git a/src/main/java/org/bukkit/block/data/type/Switch.java b/src/main/java/org/bukkit/block/data/type/Switch.java new file mode 100644 index 00000000..f6a5f55b --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Switch.java @@ -0,0 +1,45 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Powerable; + +/** + * 'face' represents the face to which a lever or button is stuck. + * <br> + * This is used in conjunction with {@link Directional} to compute the + * orientation of these blocks. + */ +public interface Switch extends Directional, Powerable { + + /** + * Gets the value of the 'face' property. + * + * @return the 'face' value + */ + Face getFace(); + + /** + * Sets the value of the 'face' property. + * + * @param face the new 'face' value + */ + void setFace(Face face); + + /** + * The face to which a switch type block is stuck. + */ + public enum Face { + /** + * The switch is mounted to the floor and pointing upwards. + */ + FLOOR, + /** + * The switch is mounted to the wall. + */ + WALL, + /** + * The switch is mounted to the ceiling and pointing dowanrds. + */ + CEILING; + } +} diff --git a/src/main/java/org/bukkit/block/data/type/TechnicalPiston.java b/src/main/java/org/bukkit/block/data/type/TechnicalPiston.java new file mode 100644 index 00000000..ca6bfba3 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/TechnicalPiston.java @@ -0,0 +1,39 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; + +/** + * 'type' represents the type of piston which this (technical) block corresponds + * to. + */ +public interface TechnicalPiston extends Directional { + + /** + * Gets the value of the 'type' property. + * + * @return the 'stage' value + */ + Type getType(); + + /** + * Sets the value of the 'type' property. + * + * @param type the new ''type value + */ + void setType(Type type); + + /** + * Different piston variants. + */ + public enum Type { + /** + * A normal piston which does not pull connected blocks backwards on + * retraction. + */ + NORMAL, + /** + * A sticky piston which will also retract connected blocks. + */ + STICKY; + } +} diff --git a/src/main/java/org/bukkit/block/data/type/TrapDoor.java b/src/main/java/org/bukkit/block/data/type/TrapDoor.java new file mode 100644 index 00000000..13876b37 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/TrapDoor.java @@ -0,0 +1,10 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Bisected; +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Openable; +import org.bukkit.block.data.Powerable; +import org.bukkit.block.data.Waterlogged; + +public interface TrapDoor extends Bisected, Directional, Openable, Powerable, Waterlogged { +} diff --git a/src/main/java/org/bukkit/block/data/type/Tripwire.java b/src/main/java/org/bukkit/block/data/type/Tripwire.java new file mode 100644 index 00000000..567f6f00 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/Tripwire.java @@ -0,0 +1,26 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Attachable; +import org.bukkit.block.data.MultipleFacing; +import org.bukkit.block.data.Powerable; + +/** + * 'disarmed' denotes that the tripwire was broken with shears and will not + * subsequently produce a current when destroyed. + */ +public interface Tripwire extends Attachable, MultipleFacing, Powerable { + + /** + * Gets the value of the 'disarmed' property. + * + * @return the 'disarmed' value + */ + boolean isDisarmed(); + + /** + * Sets the value of the 'disarmed' property. + * + * @param disarmed the new 'disarmed' value + */ + void setDisarmed(boolean disarmed); +} diff --git a/src/main/java/org/bukkit/block/data/type/TripwireHook.java b/src/main/java/org/bukkit/block/data/type/TripwireHook.java new file mode 100644 index 00000000..1e450761 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/TripwireHook.java @@ -0,0 +1,8 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Attachable; +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Powerable; + +public interface TripwireHook extends Attachable, Directional, Powerable { +} diff --git a/src/main/java/org/bukkit/block/data/type/TurtleEgg.java b/src/main/java/org/bukkit/block/data/type/TurtleEgg.java new file mode 100644 index 00000000..a88fad4a --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/TurtleEgg.java @@ -0,0 +1,60 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.BlockData; + +/** + * 'hatch' is the number of turtles which may hatch from these eggs. + * <br> + * 'eggs' is the number of eggs which appear in this block. + */ +public interface TurtleEgg extends BlockData { + + /** + * Gets the value of the 'eggs' property. + * + * @return the 'eggs' value + */ + int getEggs(); + + /** + * Sets the value of the 'eggs' property. + * + * @param eggs the new 'eggs' value + */ + void setEggs(int eggs); + + /** + * Gets the minimum allowed value of the 'eggs' property. + * + * @return the minimum 'eggs' value + */ + int getMinimumEggs(); + + /** + * Gets the maximum allowed value of the 'eggs' property. + * + * @return the maximum 'eggs' value + */ + int getMaximumEggs(); + + /** + * Gets the value of the 'hatch' property. + * + * @return the 'hatch' value + */ + int getHatch(); + + /** + * Sets the value of the 'hatch' property. + * + * @param hatch the new 'hatch' value + */ + void setHatch(int hatch); + + /** + * Gets the maximum allowed value of the 'hatch' property. + * + * @return the maximum 'hatch' value + */ + int getMaximumHatch(); +} diff --git a/src/main/java/org/bukkit/block/data/type/WallSign.java b/src/main/java/org/bukkit/block/data/type/WallSign.java new file mode 100644 index 00000000..66238859 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/WallSign.java @@ -0,0 +1,7 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.Waterlogged; + +public interface WallSign extends Directional, Waterlogged { +} diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java index ac3a7f99..2ed81910 100644 --- a/src/main/java/org/bukkit/enchantments/Enchantment.java +++ b/src/main/java/org/bukkit/enchantments/Enchantment.java @@ -3,188 +3,207 @@ package org.bukkit.enchantments; import java.util.HashMap; import java.util.Map; +import org.bukkit.Keyed; +import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; /** * The various type of enchantments that may be added to armour or weapons */ -public abstract class Enchantment { +public abstract class Enchantment implements Keyed { /** * Provides protection against environmental damage */ - public static final Enchantment PROTECTION_ENVIRONMENTAL = new EnchantmentWrapper(0); + public static final Enchantment PROTECTION_ENVIRONMENTAL = new EnchantmentWrapper("protection"); /** * Provides protection against fire damage */ - public static final Enchantment PROTECTION_FIRE = new EnchantmentWrapper(1); + public static final Enchantment PROTECTION_FIRE = new EnchantmentWrapper("fire_protection"); /** * Provides protection against fall damage */ - public static final Enchantment PROTECTION_FALL = new EnchantmentWrapper(2); + public static final Enchantment PROTECTION_FALL = new EnchantmentWrapper("feather_falling"); /** * Provides protection against explosive damage */ - public static final Enchantment PROTECTION_EXPLOSIONS = new EnchantmentWrapper(3); + public static final Enchantment PROTECTION_EXPLOSIONS = new EnchantmentWrapper("blast_protection"); /** * Provides protection against projectile damage */ - public static final Enchantment PROTECTION_PROJECTILE = new EnchantmentWrapper(4); + public static final Enchantment PROTECTION_PROJECTILE = new EnchantmentWrapper("projectile_protection"); /** * Decreases the rate of air loss whilst underwater */ - public static final Enchantment OXYGEN = new EnchantmentWrapper(5); + public static final Enchantment OXYGEN = new EnchantmentWrapper("respiration"); /** * Increases the speed at which a player may mine underwater */ - public static final Enchantment WATER_WORKER = new EnchantmentWrapper(6); + public static final Enchantment WATER_WORKER = new EnchantmentWrapper("aqua_affinity"); /** * Damages the attacker */ - public static final Enchantment THORNS = new EnchantmentWrapper(7); + public static final Enchantment THORNS = new EnchantmentWrapper("thorns"); /** * Increases walking speed while in water */ - public static final Enchantment DEPTH_STRIDER = new EnchantmentWrapper(8); + public static final Enchantment DEPTH_STRIDER = new EnchantmentWrapper("depth_strider"); /** * Freezes any still water adjacent to ice / frost which player is walking on */ - public static final Enchantment FROST_WALKER = new EnchantmentWrapper(9); + public static final Enchantment FROST_WALKER = new EnchantmentWrapper("frost_walker"); /** * Item cannot be removed */ - public static final Enchantment BINDING_CURSE = new EnchantmentWrapper(10); + public static final Enchantment BINDING_CURSE = new EnchantmentWrapper("binding_curse"); /** * Increases damage against all targets */ - public static final Enchantment DAMAGE_ALL = new EnchantmentWrapper(16); + public static final Enchantment DAMAGE_ALL = new EnchantmentWrapper("sharpness"); /** * Increases damage against undead targets */ - public static final Enchantment DAMAGE_UNDEAD = new EnchantmentWrapper(17); + public static final Enchantment DAMAGE_UNDEAD = new EnchantmentWrapper("smite"); /** * Increases damage against arthropod targets */ - public static final Enchantment DAMAGE_ARTHROPODS = new EnchantmentWrapper(18); + public static final Enchantment DAMAGE_ARTHROPODS = new EnchantmentWrapper("bane_of_arthropods"); /** * All damage to other targets will knock them back when hit */ - public static final Enchantment KNOCKBACK = new EnchantmentWrapper(19); + public static final Enchantment KNOCKBACK = new EnchantmentWrapper("knockback"); /** * When attacking a target, has a chance to set them on fire */ - public static final Enchantment FIRE_ASPECT = new EnchantmentWrapper(20); + public static final Enchantment FIRE_ASPECT = new EnchantmentWrapper("fire_aspect"); /** * Provides a chance of gaining extra loot when killing monsters */ - public static final Enchantment LOOT_BONUS_MOBS = new EnchantmentWrapper(21); + public static final Enchantment LOOT_BONUS_MOBS = new EnchantmentWrapper("looting"); /** * Increases damage against targets when using a sweep attack */ - public static final Enchantment SWEEPING_EDGE = new EnchantmentWrapper(22); + public static final Enchantment SWEEPING_EDGE = new EnchantmentWrapper("sweeping"); /** * Increases the rate at which you mine/dig */ - public static final Enchantment DIG_SPEED = new EnchantmentWrapper(32); + public static final Enchantment DIG_SPEED = new EnchantmentWrapper("efficiency"); /** * Allows blocks to drop themselves instead of fragments (for example, * stone instead of cobblestone) */ - public static final Enchantment SILK_TOUCH = new EnchantmentWrapper(33); + public static final Enchantment SILK_TOUCH = new EnchantmentWrapper("silk_touch"); /** * Decreases the rate at which a tool looses durability */ - public static final Enchantment DURABILITY = new EnchantmentWrapper(34); + public static final Enchantment DURABILITY = new EnchantmentWrapper("unbreaking"); /** * Provides a chance of gaining extra loot when destroying blocks */ - public static final Enchantment LOOT_BONUS_BLOCKS = new EnchantmentWrapper(35); + public static final Enchantment LOOT_BONUS_BLOCKS = new EnchantmentWrapper("fortune"); /** * Provides extra damage when shooting arrows from bows */ - public static final Enchantment ARROW_DAMAGE = new EnchantmentWrapper(48); + public static final Enchantment ARROW_DAMAGE = new EnchantmentWrapper("power"); /** * Provides a knockback when an entity is hit by an arrow from a bow */ - public static final Enchantment ARROW_KNOCKBACK = new EnchantmentWrapper(49); + public static final Enchantment ARROW_KNOCKBACK = new EnchantmentWrapper("punch"); /** * Sets entities on fire when hit by arrows shot from a bow */ - public static final Enchantment ARROW_FIRE = new EnchantmentWrapper(50); + public static final Enchantment ARROW_FIRE = new EnchantmentWrapper("flame"); /** * Provides infinite arrows when shooting a bow */ - public static final Enchantment ARROW_INFINITE = new EnchantmentWrapper(51); + public static final Enchantment ARROW_INFINITE = new EnchantmentWrapper("infinity"); /** * Decreases odds of catching worthless junk */ - public static final Enchantment LUCK = new EnchantmentWrapper(61); + public static final Enchantment LUCK = new EnchantmentWrapper("luck_of_the_sea"); /** * Increases rate of fish biting your hook */ - public static final Enchantment LURE = new EnchantmentWrapper(62); + public static final Enchantment LURE = new EnchantmentWrapper("lure"); + + /** + * Causes a thrown trident to return to the player who threw it + */ + public static final Enchantment LOYALTY = new EnchantmentWrapper("loyalty"); + + /** + * Deals more damage to mobs that live in the ocean + */ + public static final Enchantment IMPALING = new EnchantmentWrapper("impaling"); + + /** + * When it is rainy, launches the player in the direction their trident is thrown + */ + public static final Enchantment RIPTIDE = new EnchantmentWrapper("riptide"); + + /** + * Strikes lightning when a mob is hit with a trident if conditions are + * stormy + */ + public static final Enchantment CHANNELING = new EnchantmentWrapper("chanelling"); /** * Allows mending the item using experience orbs */ - public static final Enchantment MENDING = new EnchantmentWrapper(70); + public static final Enchantment MENDING = new EnchantmentWrapper("mending"); /** * Item disappears instead of dropping */ - public static final Enchantment VANISHING_CURSE = new EnchantmentWrapper(71); + public static final Enchantment VANISHING_CURSE = new EnchantmentWrapper("vanishing_curse"); - private static final Map<Integer, Enchantment> byId = new HashMap<Integer, Enchantment>(); + private static final Map<NamespacedKey, Enchantment> byKey = new HashMap<NamespacedKey, Enchantment>(); private static final Map<String, Enchantment> byName = new HashMap<String, Enchantment>(); private static boolean acceptingNew = true; - private final int id; + private final NamespacedKey key; - public Enchantment(int id) { - this.id = id; + public Enchantment(NamespacedKey key) { + this.key = key; } - /** - * Gets the unique ID of this enchantment - * - * @return Unique ID - * @deprecated Magic value - */ - @Deprecated - public int getId() { - return id; + @Override + public NamespacedKey getKey() { + return key; } /** * Gets the unique name of this enchantment * * @return Unique name + * @deprecated enchantments are badly named, use {@link #getKey()}. */ + @Deprecated public abstract String getName(); /** @@ -224,7 +243,11 @@ public abstract class Enchantment { * Cursed enchantments are found the same way treasure enchantments are * * @return true if the enchantment is cursed + * @deprecated cursed enchantments are no longer special. Will return true + * only for {@link Enchantment#BINDING_CURSE} and + * {@link Enchantment#VANISHING_CURSE}. */ + @Deprecated public abstract boolean isCursed(); /** @@ -256,7 +279,7 @@ public abstract class Enchantment { return false; } final Enchantment other = (Enchantment) obj; - if (this.id != other.id) { + if (!this.key.equals(other.key)) { return false; } return true; @@ -264,12 +287,12 @@ public abstract class Enchantment { @Override public int hashCode() { - return id; + return key.hashCode(); } @Override public String toString() { - return "Enchantment[" + id + ", " + getName() + "]"; + return "Enchantment[" + key + ", " + getName() + "]"; } /** @@ -280,13 +303,13 @@ public abstract class Enchantment { * @param enchantment Enchantment to register */ public static void registerEnchantment(Enchantment enchantment) { - if (byId.containsKey(enchantment.id) || byName.containsKey(enchantment.getName())) { + if (byKey.containsKey(enchantment.key) || byName.containsKey(enchantment.getName())) { throw new IllegalArgumentException("Cannot set already-set enchantment"); } else if (!isAcceptingRegistrations()) { throw new IllegalStateException("No longer accepting new enchantments (can only be done by the server implementation)"); } - byId.put(enchantment.id, enchantment); + byKey.put(enchantment.key, enchantment); byName.put(enchantment.getName(), enchantment); } @@ -307,15 +330,13 @@ public abstract class Enchantment { } /** - * Gets the Enchantment at the specified ID + * Gets the Enchantment at the specified key * - * @param id ID to fetch + * @param key key to fetch * @return Resulting Enchantment, or null if not found - * @deprecated Magic value */ - @Deprecated - public static Enchantment getById(int id) { - return byId.get(id); + public static Enchantment getByKey(NamespacedKey key) { + return byKey.get(key); } /** @@ -323,7 +344,9 @@ public abstract class Enchantment { * * @param name Name to fetch * @return Resulting Enchantment, or null if not found + * @deprecated enchantments are badly named, use {@link #getByKey(org.bukkit.NamespacedKey)}. */ + @Deprecated public static Enchantment getByName(String name) { return byName.get(name); } @@ -334,6 +357,6 @@ public abstract class Enchantment { * @return Array of enchantments */ public static Enchantment[] values() { - return byId.values().toArray(new Enchantment[byId.size()]); + return byName.values().toArray(new Enchantment[byName.size()]); } } diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java b/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java index 61067912..3e326adb 100644 --- a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java +++ b/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java @@ -40,7 +40,7 @@ public enum EnchantmentTarget { || item.equals(Material.CHAINMAIL_BOOTS) || item.equals(Material.IRON_BOOTS) || item.equals(Material.DIAMOND_BOOTS) - || item.equals(Material.GOLD_BOOTS); + || item.equals(Material.GOLDEN_BOOTS); } }, @@ -54,7 +54,7 @@ public enum EnchantmentTarget { || item.equals(Material.CHAINMAIL_LEGGINGS) || item.equals(Material.IRON_LEGGINGS) || item.equals(Material.DIAMOND_LEGGINGS) - || item.equals(Material.GOLD_LEGGINGS); + || item.equals(Material.GOLDEN_LEGGINGS); } }, @@ -68,7 +68,7 @@ public enum EnchantmentTarget { || item.equals(Material.CHAINMAIL_CHESTPLATE) || item.equals(Material.IRON_CHESTPLATE) || item.equals(Material.DIAMOND_CHESTPLATE) - || item.equals(Material.GOLD_CHESTPLATE); + || item.equals(Material.GOLDEN_CHESTPLATE); } }, @@ -82,7 +82,7 @@ public enum EnchantmentTarget { || item.equals(Material.CHAINMAIL_HELMET) || item.equals(Material.DIAMOND_HELMET) || item.equals(Material.IRON_HELMET) - || item.equals(Material.GOLD_HELMET); + || item.equals(Material.GOLDEN_HELMET); } }, @@ -92,11 +92,11 @@ public enum EnchantmentTarget { WEAPON { @Override public boolean includes(Material item) { - return item.equals(Material.WOOD_SWORD) + return item.equals(Material.WOODEN_SWORD) || item.equals(Material.STONE_SWORD) || item.equals(Material.IRON_SWORD) || item.equals(Material.DIAMOND_SWORD) - || item.equals(Material.GOLD_SWORD); + || item.equals(Material.GOLDEN_SWORD); } }, @@ -107,26 +107,26 @@ public enum EnchantmentTarget { TOOL { @Override public boolean includes(Material item) { - return item.equals(Material.WOOD_SPADE) - || item.equals(Material.STONE_SPADE) - || item.equals(Material.IRON_SPADE) - || item.equals(Material.DIAMOND_SPADE) - || item.equals(Material.GOLD_SPADE) - || item.equals(Material.WOOD_PICKAXE) + return item.equals(Material.WOODEN_SHOVEL) + || item.equals(Material.STONE_SHOVEL) + || item.equals(Material.IRON_SHOVEL) + || item.equals(Material.DIAMOND_SHOVEL) + || item.equals(Material.GOLDEN_SHOVEL) + || item.equals(Material.WOODEN_PICKAXE) || item.equals(Material.STONE_PICKAXE) || item.equals(Material.IRON_PICKAXE) || item.equals(Material.DIAMOND_PICKAXE) - || item.equals(Material.GOLD_PICKAXE) - || item.equals(Material.WOOD_HOE) + || item.equals(Material.GOLDEN_PICKAXE) + || item.equals(Material.WOODEN_HOE) || item.equals(Material.STONE_HOE) || item.equals(Material.IRON_HOE) || item.equals(Material.DIAMOND_HOE) - || item.equals(Material.GOLD_HOE) - || item.equals(Material.WOOD_AXE) + || item.equals(Material.GOLDEN_HOE) + || item.equals(Material.WOODEN_AXE) || item.equals(Material.STONE_AXE) || item.equals(Material.IRON_AXE) || item.equals(Material.DIAMOND_AXE) - || item.equals(Material.GOLD_AXE) + || item.equals(Material.GOLDEN_AXE) || item.equals(Material.SHEARS) || item.equals(Material.FLINT_AND_STEEL); } @@ -171,8 +171,24 @@ public enum EnchantmentTarget { return ARMOR.includes(item) || item.equals(Material.ELYTRA) || item.equals(Material.PUMPKIN) + || item.equals(Material.CARVED_PUMPKIN) || item.equals(Material.JACK_O_LANTERN) - || item.equals(Material.SKULL_ITEM); + || item.equals(Material.SKELETON_SKULL) + || item.equals(Material.WITHER_SKELETON_SKULL) + || item.equals(Material.ZOMBIE_HEAD) + || item.equals(Material.PLAYER_HEAD) + || item.equals(Material.CREEPER_HEAD) + || item.equals(Material.DRAGON_HEAD); + } + }, + + /** + * Allow the Enchantment to be placed on tridents. + */ + TRIDENT { + @Override + public boolean includes(Material item) { + return item.equals(Material.TRIDENT); } }; diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java index 3984e919..8fc8dfd6 100644 --- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java +++ b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java @@ -1,13 +1,14 @@ package org.bukkit.enchantments; +import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; /** * A simple wrapper for ease of selecting {@link Enchantment}s */ public class EnchantmentWrapper extends Enchantment { - public EnchantmentWrapper(int id) { - super(id); + public EnchantmentWrapper(String name) { + super(NamespacedKey.minecraft(name)); } /** @@ -16,7 +17,7 @@ public class EnchantmentWrapper extends Enchantment { * @return Enchantment */ public Enchantment getEnchantment() { - return Enchantment.getById(getId()); + return Enchantment.getByKey(getKey()); } @Override diff --git a/src/main/java/org/bukkit/entity/Cod.java b/src/main/java/org/bukkit/entity/Cod.java new file mode 100644 index 00000000..191ce6c0 --- /dev/null +++ b/src/main/java/org/bukkit/entity/Cod.java @@ -0,0 +1,7 @@ + +package org.bukkit.entity; + +/** + * Represents a cod fish. + */ +public interface Cod extends Fish { } diff --git a/src/main/java/org/bukkit/entity/Dolphin.java b/src/main/java/org/bukkit/entity/Dolphin.java new file mode 100644 index 00000000..3d6b9f32 --- /dev/null +++ b/src/main/java/org/bukkit/entity/Dolphin.java @@ -0,0 +1,3 @@ +package org.bukkit.entity; + +public interface Dolphin extends Creature { } diff --git a/src/main/java/org/bukkit/entity/Drowned.java b/src/main/java/org/bukkit/entity/Drowned.java new file mode 100644 index 00000000..1dee177a --- /dev/null +++ b/src/main/java/org/bukkit/entity/Drowned.java @@ -0,0 +1,6 @@ +package org.bukkit.entity; + +/** + * Drowned zombie. + */ +public interface Drowned extends Zombie { } diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java index f537f697..ab827f83 100644 --- a/src/main/java/org/bukkit/entity/Enderman.java +++ b/src/main/java/org/bukkit/entity/Enderman.java @@ -1,5 +1,6 @@ package org.bukkit.entity; +import org.bukkit.block.data.BlockData; import org.bukkit.material.MaterialData; /** @@ -8,16 +9,30 @@ import org.bukkit.material.MaterialData; public interface Enderman extends Monster { /** - * Get the id and data of the block that the Enderman is carrying. + * Gets the id and data of the block that the Enderman is carrying. * * @return MaterialData containing the id and data of the block */ public MaterialData getCarriedMaterial(); /** - * Set the id and data of the block that the Enderman is carrying. + * Sets the id and data of the block that the Enderman is carrying. * * @param material data to set the carried block to */ public void setCarriedMaterial(MaterialData material); + + /** + * Gets the data of the block that the Enderman is carrying. + * + * @return BlockData containing the carried block + */ + public BlockData getCarriedBlock(); + + /** + * Sets the data of the block that the Enderman is carrying. + * + * @param blockData data to set the carried block to + */ + public void setCarriedBlock(BlockData blockData); } diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java index 588e6048..636bae8b 100644 --- a/src/main/java/org/bukkit/entity/EntityType.java +++ b/src/main/java/org/bukkit/entity/EntityType.java @@ -28,7 +28,7 @@ public enum EntityType { /** * An experience orb. */ - EXPERIENCE_ORB("xp_orb", ExperienceOrb.class, 2), + EXPERIENCE_ORB("experience_orb", ExperienceOrb.class, 2), /** * @see AreaEffectCloud */ @@ -80,7 +80,7 @@ public enum EntityType { /** * An ender eye signal. */ - ENDER_SIGNAL("eye_of_ender_signal", EnderSignal.class, 15), + ENDER_SIGNAL("eye_of_ender", EnderSignal.class, 15), /** * A flying splash potion. */ @@ -88,7 +88,7 @@ public enum EntityType { /** * A flying experience bottle. */ - THROWN_EXP_BOTTLE("xp_bottle", ThrownExpBottle.class, 17), + THROWN_EXP_BOTTLE("experience_bottle", ThrownExpBottle.class, 17), /** * An item frame on a wall. */ @@ -108,7 +108,7 @@ public enum EntityType { /** * Internal representation of a Firework once it has been launched. */ - FIREWORK("fireworks_rocket", Firework.class, 22, false), + FIREWORK("firework_rocket", Firework.class, 22, false), /** * @see Husk */ @@ -152,11 +152,11 @@ public enum EntityType { /** * @see EvokerFangs */ - EVOKER_FANGS("evocation_fangs", EvokerFangs.class, 33), + EVOKER_FANGS("evoker_fangs", EvokerFangs.class, 33), /** * @see Evoker */ - EVOKER("evocation_illager", Evoker.class, 34), + EVOKER("evoker", Evoker.class, 34), /** * @see Vex */ @@ -164,15 +164,15 @@ public enum EntityType { /** * @see Vindicator */ - VINDICATOR("vindication_illager", Vindicator.class, 36), + VINDICATOR("vindicator", Vindicator.class, 36), /** * @see Illusioner */ - ILLUSIONER("illusion_illager", Illusioner.class, 37), + ILLUSIONER("illusioner", Illusioner.class, 37), /** * @see CommandMinecart */ - MINECART_COMMAND("commandblock_minecart", CommandMinecart.class, 40), + MINECART_COMMAND("command_block_minecart", CommandMinecart.class, 40), /** * A placed boat. */ @@ -228,9 +228,9 @@ public enum EntityType { SQUID("squid", Squid.class, 94), WOLF("wolf", Wolf.class, 95), MUSHROOM_COW("mooshroom", MushroomCow.class, 96), - SNOWMAN("snowman", Snowman.class, 97), + SNOWMAN("snow_golem", Snowman.class, 97), OCELOT("ocelot", Ocelot.class, 98), - IRON_GOLEM("villager_golem", IronGolem.class, 99), + IRON_GOLEM("iron_golem", IronGolem.class, 99), HORSE("horse", Horse.class, 100), RABBIT("rabbit", Rabbit.class, 101), POLAR_BEAR("polar_bear", PolarBear.class, 102), @@ -238,7 +238,16 @@ public enum EntityType { LLAMA_SPIT("llama_spit", LlamaSpit.class, 104), PARROT("parrot", Parrot.class, 105), VILLAGER("villager", Villager.class, 120), - ENDER_CRYSTAL("ender_crystal", EnderCrystal.class, 200), + ENDER_CRYSTAL("end_crystal", EnderCrystal.class, 200), + TURTLE("turtle", Turtle.class, -1), + PHANTOM("phantom", Phantom.class, -1), + TRIDENT("trident", Trident.class, -1), + COD("cod", Cod.class, -1), + SALMON("salmon", Salmon.class, -1), + PUFFERFISH("pufferfish", PufferFish.class, -1), + TROPICAL_FISH("tropical_fish", TropicalFish.class, -1), + DROWNED("drowned", Drowned.class, -1), + DOLPHIN("dolphin", Dolphin.class, -1), // These don't have an entity ID in nms.EntityTypes. /** * A flying lingering potion @@ -247,15 +256,15 @@ public enum EntityType { /** * A fishing line and bobber. */ - FISHING_HOOK(null, FishHook.class, -1, false), + FISHING_HOOK("fishing_bobber", FishHook.class, -1, false), /** * A bolt of lightning. * <p> * Spawn with {@link World#strikeLightning(Location)}. */ - LIGHTNING(null, LightningStrike.class, -1, false), + LIGHTNING("lightning_bolt", LightningStrike.class, -1, false), WEATHER(null, Weather.class, -1, false), - PLAYER(null, Player.class, -1, false), + PLAYER("player", Player.class, -1, false), COMPLEX_PART(null, ComplexEntityPart.class, -1, false), /** * Like {@link #ARROW} but tipped with a specific potion which is applied on diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java index bc56fa22..9d34e691 100644 --- a/src/main/java/org/bukkit/entity/FallingBlock.java +++ b/src/main/java/org/bukkit/entity/FallingBlock.java @@ -1,6 +1,7 @@ package org.bukkit.entity; import org.bukkit.Material; +import org.bukkit.block.data.BlockData; /** * Represents a falling block @@ -11,26 +12,18 @@ public interface FallingBlock extends Entity { * Get the Material of the falling block * * @return Material of the block - */ - Material getMaterial(); - - /** - * Get the ID of the falling block - * - * @return ID type of the block - * @deprecated Magic value + * @deprecated use {@link #getBlockData()} */ @Deprecated - int getBlockId(); + Material getMaterial(); /** * Get the data for the falling block * * @return data of the block - * @deprecated Magic value */ @Deprecated - byte getBlockData(); + BlockData getBlockData(); /** * Get if the falling block will break into an item if it cannot be placed diff --git a/src/main/java/org/bukkit/entity/Fish.java b/src/main/java/org/bukkit/entity/Fish.java index 12ed1ed7..570b7bc1 100644 --- a/src/main/java/org/bukkit/entity/Fish.java +++ b/src/main/java/org/bukkit/entity/Fish.java @@ -1,8 +1,6 @@ package org.bukkit.entity; /** - * Represents a fishing hook. - * @deprecated in favor of {@link FishHook} + * Represents a fish entity. */ -public interface Fish extends FishHook { -} +public interface Fish extends Creature { } diff --git a/src/main/java/org/bukkit/entity/Minecart.java b/src/main/java/org/bukkit/entity/Minecart.java index 904d84cb..65bd4bea 100644 --- a/src/main/java/org/bukkit/entity/Minecart.java +++ b/src/main/java/org/bukkit/entity/Minecart.java @@ -1,6 +1,7 @@ package org.bukkit.entity; import org.bukkit.Material; +import org.bukkit.block.data.BlockData; import org.bukkit.material.MaterialData; import org.bukkit.util.Vector; @@ -109,6 +110,22 @@ public interface Minecart extends Vehicle { public MaterialData getDisplayBlock(); /** + * Sets the display block for this minecart. + * Passing a null value will set the minecart to have no display block. + * + * @param blockData the material to set as display block. + */ + public void setDisplayBlockData(BlockData blockData); + + /** + * Gets the display block for this minecart. + * This function will return the type AIR if none is set. + * + * @return the block displayed by this minecart. + */ + public BlockData getDisplayBlockData(); + + /** * Sets the offset of the display block. * * @param offset the block offset to set for this minecart. diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java new file mode 100644 index 00000000..1a1044ed --- /dev/null +++ b/src/main/java/org/bukkit/entity/Phantom.java @@ -0,0 +1,17 @@ +package org.bukkit.entity; + +/** + * Represents a phantom. + */ +public interface Phantom extends Flying { + + /** + * @return The size of the phantom + */ + public int getSize(); + + /** + * @param sz The new size of the phantom. + */ + public void setSize(int sz); +} diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java index 082302d1..2596a11d 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -18,6 +18,7 @@ import org.bukkit.Statistic; import org.bukkit.WeatherType; import org.bukkit.advancement.Advancement; import org.bukkit.advancement.AdvancementProgress; +import org.bukkit.block.data.BlockData; import org.bukkit.command.CommandSender; import org.bukkit.conversations.Conversable; import org.bukkit.event.player.PlayerResourcePackStatusEvent; @@ -338,6 +339,15 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline public void sendBlockChange(Location loc, Material material, byte data); /** + * Send a block change. This fakes a block change packet for a user at a + * certain location. This will not actually change the world in any way. + * + * @param loc The location of the changed block + * @param block The new block + */ + public void sendBlockChange(Location loc, BlockData block); + + /** * Send a chunk change. This fakes a chunk change packet for a user at a * certain location. The updated cuboid must be entirely within a single * chunk. This will not actually change the world in any way. @@ -358,22 +368,10 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline public boolean sendChunkChange(Location loc, int sx, int sy, int sz, byte[] data); /** - * Send a block change. This fakes a block change packet for a user at a - * certain location. This will not actually change the world in any way. - * - * @param loc The location of the changed block - * @param material The new block ID - * @param data The block data - * @deprecated Magic value - */ - @Deprecated - public void sendBlockChange(Location loc, int material, byte data); - - /** * Send a sign change. This fakes a sign change packet for a user at * a certain location. This will not actually change the world in any way. * This method will use a sign at the location's block or a faked sign - * sent via {@link #sendBlockChange(org.bukkit.Location, int, byte)} or + * sent via * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}. * <p> * If the client does not have a sign at the given location it will diff --git a/src/main/java/org/bukkit/entity/PufferFish.java b/src/main/java/org/bukkit/entity/PufferFish.java new file mode 100644 index 00000000..2d26c19b --- /dev/null +++ b/src/main/java/org/bukkit/entity/PufferFish.java @@ -0,0 +1,21 @@ +package org.bukkit.entity; + +/** + * Represents a puffer fish. + */ +public interface PufferFish extends Fish { + + /** + * Returns the current puff state of this fish (i.e. how inflated it is). + * + * @return current puff state + */ + int getPuffState(); + + /** + * Sets the current puff state of this fish (i.e. how inflated it is). + * + * @param state new puff state + */ + void setPuffState(int state); +} diff --git a/src/main/java/org/bukkit/entity/Salmon.java b/src/main/java/org/bukkit/entity/Salmon.java new file mode 100644 index 00000000..a52a7af2 --- /dev/null +++ b/src/main/java/org/bukkit/entity/Salmon.java @@ -0,0 +1,7 @@ + +package org.bukkit.entity; + +/** + * Represents a salmon fish. + */ +public interface Salmon extends Fish { } diff --git a/src/main/java/org/bukkit/entity/Trident.java b/src/main/java/org/bukkit/entity/Trident.java new file mode 100644 index 00000000..7af949ea --- /dev/null +++ b/src/main/java/org/bukkit/entity/Trident.java @@ -0,0 +1,6 @@ +package org.bukkit.entity; + +/** + * Represents a thrown trident. + */ +public interface Trident extends Arrow { } diff --git a/src/main/java/org/bukkit/entity/TropicalFish.java b/src/main/java/org/bukkit/entity/TropicalFish.java new file mode 100644 index 00000000..51142170 --- /dev/null +++ b/src/main/java/org/bukkit/entity/TropicalFish.java @@ -0,0 +1,72 @@ +package org.bukkit.entity; + +import org.bukkit.DyeColor; + +/** + * Tropical fish. + */ +public interface TropicalFish extends Fish { + + /** + * Gets the color of the fish's pattern. + * + * @return pattern color + */ + DyeColor getPatternColor(); + + /** + * Sets the color of the fish's pattern + * + * @param color pattern color + */ + void setPatternColor(DyeColor color); + + /** + * Gets the color of the fish's body. + * + * @return pattern color + */ + DyeColor getBodyColor(); + + /** + * Sets the color of the fish's body + * + * @param color body color + */ + void setBodyColor(DyeColor color); + + /** + * Gets the fish's pattern. + * + * @return pattern + */ + Pattern getPattern(); + + /** + * Sets the fish's pattern + * + * @param pattern new pattern + */ + void setPattern(Pattern pattern); + + /** + * Enumeration of all different fish patterns. Refer to the + * <a href="https://minecraft.gamepedia.com/Fish_(mob)">Minecraft Wiki</a> + * for pictures. + */ + public static enum Pattern { + + KOB, + SUNSTREAK, + SNOOPER, + DASHER, + BRINELY, + SPOTTY, + FLOPPER, + STRIPEY, + GLITTER, + BLOCKFISH, + BETTY, + CLAYFISH; + } +} diff --git a/src/main/java/org/bukkit/entity/Turtle.java b/src/main/java/org/bukkit/entity/Turtle.java new file mode 100644 index 00000000..0a4cd299 --- /dev/null +++ b/src/main/java/org/bukkit/entity/Turtle.java @@ -0,0 +1,6 @@ +package org.bukkit.entity; + +/** + * Represents a turtle. + */ +public interface Turtle extends Animals { } diff --git a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java index 613feb91..668bfa9f 100644 --- a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java +++ b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java @@ -2,6 +2,7 @@ package org.bukkit.event.block; import org.bukkit.block.Block; import org.bukkit.Material; +import org.bukkit.block.data.BlockData; import org.bukkit.event.HandlerList; /** @@ -12,32 +13,25 @@ import org.bukkit.event.HandlerList; * <li>The Block returned by getBlock() is the block we are trying to place * on, not the block we are trying to place. * <li>If you want to figure out what is being placed, use {@link - * #getMaterial()} or {@link #getMaterialId()} instead. + * #getMaterial()} instead. * </ul> */ public class BlockCanBuildEvent extends BlockEvent { private static final HandlerList handlers = new HandlerList(); protected boolean buildable; - /** - * - * @deprecated Magic value - */ - @Deprecated - protected int material; + protected BlockData blockData; /** * - * @deprecated Magic value * @param block the block involved in this event - * @param id the id of the block to place + * @param type the id of the block to place * @param canBuild whether we can build */ - @Deprecated - public BlockCanBuildEvent(final Block block, final int id, final boolean canBuild) { + public BlockCanBuildEvent(final Block block, final BlockData type, final boolean canBuild) { super(block); buildable = canBuild; - material = id; + blockData = type; } /** @@ -68,18 +62,7 @@ public class BlockCanBuildEvent extends BlockEvent { * @return The Material that we are trying to place */ public Material getMaterial() { - return Material.getMaterial(material); - } - - /** - * Gets the Material ID for the Material that we are trying to place. - * - * @return The Material ID for the Material that we are trying to place - * @deprecated Magic value - */ - @Deprecated - public int getMaterialId() { - return material; + return blockData.getMaterial(); } @Override diff --git a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java index 01a545b4..97458897 100644 --- a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java +++ b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java @@ -2,6 +2,7 @@ package org.bukkit.event.block; import org.bukkit.block.Block; import org.bukkit.Material; +import org.bukkit.block.data.BlockData; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; @@ -10,17 +11,16 @@ import org.bukkit.event.HandlerList; */ public class BlockPhysicsEvent extends BlockEvent implements Cancellable { private static final HandlerList handlers = new HandlerList(); - private final int changed; + private final BlockData changed; private boolean cancel = false; /** * - * @deprecated Magic value * @param block the block involved in this event - * @param changed the changed block's type id + * @param changed the changed block's type */ @Deprecated - public BlockPhysicsEvent(final Block block, final int changed) { + public BlockPhysicsEvent(final Block block, final BlockData changed) { super(block); this.changed = changed; } @@ -28,21 +28,10 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable { /** * Gets the type of block that changed, causing this event * - * @return Changed block's type id - * @deprecated Magic value - */ - @Deprecated - public int getChangedTypeId() { - return changed; - } - - /** - * Gets the type of block that changed, causing this event - * * @return Changed block's type */ public Material getChangedType() { - return Material.getMaterial(changed); + return changed.getMaterial(); } public boolean isCancelled() { diff --git a/src/main/java/org/bukkit/event/block/BlockPistonEvent.java b/src/main/java/org/bukkit/event/block/BlockPistonEvent.java index 074d71ca..e5f11cbd 100644 --- a/src/main/java/org/bukkit/event/block/BlockPistonEvent.java +++ b/src/main/java/org/bukkit/event/block/BlockPistonEvent.java @@ -31,7 +31,7 @@ public abstract class BlockPistonEvent extends BlockEvent implements Cancellable * @return stickiness of the piston */ public boolean isSticky() { - return block.getType() == Material.PISTON_STICKY_BASE || block.getType() == Material.PISTON_MOVING_PIECE; + return block.getType() == Material.STICKY_PISTON || block.getType() == Material.MOVING_PISTON; } /** diff --git a/src/main/java/org/bukkit/event/block/NotePlayEvent.java b/src/main/java/org/bukkit/event/block/NotePlayEvent.java index d4d43815..627505f5 100644 --- a/src/main/java/org/bukkit/event/block/NotePlayEvent.java +++ b/src/main/java/org/bukkit/event/block/NotePlayEvent.java @@ -53,7 +53,9 @@ public class NotePlayEvent extends BlockEvent implements Cancellable { * Overrides the {@link Instrument} to be used. * * @param instrument the Instrument. Has no effect if null. + * @deprecated no effect on newer Minecraft versions */ + @Deprecated public void setInstrument(Instrument instrument) { if (instrument != null) { this.instrument = instrument; @@ -65,7 +67,9 @@ public class NotePlayEvent extends BlockEvent implements Cancellable { * Overrides the {@link Note} to be played. * * @param note the Note. Has no effect if null. + * @deprecated no effect on newer Minecraft versions */ + @Deprecated public void setNote(Note note) { if (note != null) { this.note = note; diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java index bd1cc6fc..7591a4af 100644 --- a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java +++ b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java @@ -410,7 +410,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable { */ FLY_INTO_WALL, /** - * Damage caused when an entity steps on {@link Material#MAGMA}. + * Damage caused when an entity steps on {@link Material#MAGMA_BLOCK}. * <p> * Damage: 1 */ @@ -421,6 +421,12 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable { * <p> * Damage: 6 */ - CRAMMING + CRAMMING, + /** + * Damage caused when an entity that should be in water is not. + * <p> + * Damage: 1 + */ + DRYOUT } } diff --git a/src/main/java/org/bukkit/event/player/PlayerFishEvent.java b/src/main/java/org/bukkit/event/player/PlayerFishEvent.java index 211e304f..91439b8e 100644 --- a/src/main/java/org/bukkit/event/player/PlayerFishEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerFishEvent.java @@ -1,9 +1,9 @@ package org.bukkit.event.player; -import org.bukkit.entity.Fish; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.entity.Entity; +import org.bukkit.entity.FishHook; import org.bukkit.event.HandlerList; /** @@ -15,9 +15,9 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable { private boolean cancel = false; private int exp; private final State state; - private final Fish hookEntity; + private final FishHook hookEntity; - public PlayerFishEvent(final Player player, final Entity entity, final Fish hookEntity, final State state) { + public PlayerFishEvent(final Player player, final Entity entity, final FishHook hookEntity, final State state) { super(player); this.entity = entity; this.hookEntity = hookEntity; @@ -40,9 +40,9 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable { /** * Gets the fishing hook. * - * @return Fish the entity representing the fishing hook/bobber. + * @return the entity representing the fishing hook/bobber. */ - public Fish getHook() { + public FishHook getHook() { return hookEntity; } diff --git a/src/main/java/org/bukkit/event/player/PlayerStatisticIncrementEvent.java b/src/main/java/org/bukkit/event/player/PlayerStatisticIncrementEvent.java index 7c70bbb0..bc809efe 100644 --- a/src/main/java/org/bukkit/event/player/PlayerStatisticIncrementEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerStatisticIncrementEvent.java @@ -10,8 +10,8 @@ import org.bukkit.event.HandlerList; /** * Called when a player statistic is incremented. * <p> - * This event is not called for {@link org.bukkit.Statistic#PLAY_ONE_TICK} or - * movement based statistics. + * This event is not called for some high frequency statistics, e.g. movement + * based statistics. * */ public class PlayerStatisticIncrementEvent extends PlayerEvent implements Cancellable { diff --git a/src/main/java/org/bukkit/generator/ChunkGenerator.java b/src/main/java/org/bukkit/generator/ChunkGenerator.java index 51370245..6caef007 100644 --- a/src/main/java/org/bukkit/generator/ChunkGenerator.java +++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java @@ -9,6 +9,7 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.block.Block; +import org.bukkit.block.data.BlockData; import org.bukkit.material.MaterialData; /** @@ -45,181 +46,6 @@ public abstract class ChunkGenerator { */ void setBiome(int x, int z, Biome bio); } - @Deprecated - /** - * Shapes the chunk for the given coordinates. - * <p> - * This method should return a byte[32768] in the following format: - * <pre> - * for (int x = 0; x < 16; x++) { - * for (int z = 0; z < 16; z++) { - * for (int y = 0; y < 128; y++) { - * // result[(x * 16 + z) * 128 + y] = ??; - * } - * } - * } - * </pre> - * <p> - * Note that this method should <b>never</b> attempt to get the Chunk at - * the passed coordinates, as doing so may cause an infinite loop - * <p> - * Note this deprecated method will only be called when both - * generateExtBlockSections() and generateBlockSections() are - * unimplemented and return null. - * - * @param world The world this chunk will be used for - * @param random The random generator to use - * @param x The X-coordinate of the chunk - * @param z The Z-coordinate of the chunk - * @return byte[] containing the types for each block created by this - * generator - */ - public byte[] generate(World world, Random random, int x, int z) { - throw new UnsupportedOperationException("Custom generator is missing required methods: generate(), generateBlockSections() and generateExtBlockSections()"); - } - - /** - * Shapes the chunk for the given coordinates, with extended block IDs - * supported (0-4095). - * <p> - * As of 1.2, chunks are represented by a vertical array of chunk - * sections, each of which is 16 x 16 x 16 blocks. If a section is empty - * (all zero), the section does not need to be supplied, reducing memory - * usage. - * <p> - * This method must return a short[][] array in the following format: - * <pre> - * short[][] result = new short[world-height / 16][]; - * </pre> - * Each section {@code (sectionID = (Y>>4))} that has blocks needs to be allocated - * space for the 4096 blocks in that section: - * <pre> - * result[sectionID] = new short[4096]; - * </pre> - * while sections that are not populated can be left null. - * <p> - * Setting a block at X, Y, Z within the chunk can be done with the - * following mapping function: - * <pre> - * void setBlock(short[][] result, int x, int y, int z, short blkid) { - * {@code if (result[y >> 4] == null) {} - * {@code result[y >> 4] = new short[4096];} - * } - * {@code result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = blkid;} - * } - * </pre> - * while reading a block ID can be done with the following mapping - * function: - * <pre> - * short getBlock(short[][] result, int x, int y, int z) { - * {@code if (result[y >> 4] == null) {} - * return (short)0; - * } - * {@code return result[y >> 4][((y & 0xF) << 8) | (z << 4) | x];} - * } - * </pre> - * while sections that are not populated can be left null. - * <p> - * Setting a block at X, Y, Z within the chunk can be done with the - * following mapping function: - * <pre> - * void setBlock(short[][] result, int x, int y, int z, short blkid) { - * {@code if (result[y >> 4) == null) {} - * {@code result[y >> 4] = new short[4096];} - * } - * {@code result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = blkid;} - * } - * </pre> - * while reading a block ID can be done with the following mapping - * function: - * <pre> - * short getBlock(short[][] result, int x, int y, int z) { - * {@code if (result[y >> 4) == null) {} - * return (short)0; - * } - * {@code return result[y >> 4][((y & 0xF) << 8) | (z << 4) | x];} - * } - * </pre> - * <p> - * Note that this method should <b>never</b> attempt to get the Chunk at - * the passed coordinates, as doing so may cause an infinite loop - * <p> - * Note generators that do not return block IDs above 255 should not - * implement this method, or should have it return null (which will result - * in the generateBlockSections() method being called). - * - * @param world The world this chunk will be used for - * @param random The random generator to use - * @param x The X-coordinate of the chunk - * @param z The Z-coordinate of the chunk - * @param biomes Proposed biome values for chunk - can be updated by - * generator - * @return short[][] containing the types for each block created by this - * generator - * @deprecated Magic value - */ - @Deprecated - public short[][] generateExtBlockSections(World world, Random random, int x, int z, BiomeGrid biomes) { - return null; // Default - returns null, which drives call to generateBlockSections() - } - - /** - * Shapes the chunk for the given coordinates. - * <p> - * As of 1.2, chunks are represented by a vertical array of chunk - * sections, each of which is 16 x 16 x 16 blocks. If a section is empty - * (all zero), the section does not need to be supplied, reducing memory - * usage. - * <p> - * This method must return a byte[][] array in the following format: - * <pre> - * byte[][] result = new byte[world-height / 16][]; - * </pre> - * Each section {@code (sectionID = (Y>>4))} that has blocks needs to be allocated - * space for the 4096 blocks in that section: - * <pre> - * result[sectionID] = new byte[4096]; - * </pre> - * while sections that are not populated can be left null. - * <p> - * Setting a block at X, Y, Z within the chunk can be done with the - * following mapping function: - * <pre> - * void setBlock(byte[][] result, int x, int y, int z, byte blkid) { - * {@code if (result[y >> 4) == null) {} - * {@code result[y >> 4] = new byte[4096];} - * } - * {@code result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = blkid;} - * } - * </pre> - * while reading a block ID can be done with the following mapping - * function: - * <pre> - * byte getBlock(byte[][] result, int x, int y, int z) { - * {@code if (result[y >> 4) == null) {} - * return (byte)0; - * } - * {@code return result[y >> 4][((y & 0xF) << 8) | (z << 4) | x];} - * } - * </pre> - * - * Note that this method should <b>never</b> attempt to get the Chunk at - * the passed coordinates, as doing so may cause an infinite loop - * - * @param world The world this chunk will be used for - * @param random The random generator to use - * @param x The X-coordinate of the chunk - * @param z The Z-coordinate of the chunk - * @param biomes Proposed biome values for chunk - can be updated by - * generator - * @return short[][] containing the types for each block created by this - * generator - * @deprecated Magic value - */ - @Deprecated - public byte[][] generateBlockSections(World world, Random random, int x, int z, BiomeGrid biomes) { - return null; // Default - returns null, which drives call to generate() - } /** * Shapes the chunk for the given coordinates. @@ -246,7 +72,7 @@ public abstract class ChunkGenerator { * generator */ public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome) { - return null; // Default - returns null, which drives call to generateExtBlockSections() + throw new UnsupportedOperationException("Custom generator is missing required method generateChunkData"); } /** @@ -343,21 +169,17 @@ public abstract class ChunkGenerator { public void setBlock(int x, int y, int z, MaterialData material); /** - * Set a region of this chunk from xMin, yMin, zMin (inclusive) - * to xMax, yMax, zMax (exclusive) to material. + * Set the block at x,y,z in the chunk data to material. * * Setting blocks outside the chunk's bounds does nothing. * - * @param xMin minimum x location (inclusive) in the chunk to set - * @param yMin minimum y location (inclusive) in the chunk to set - * @param zMin minimum z location (inclusive) in the chunk to set - * @param xMax maximum x location (exclusive) in the chunk to set - * @param yMax maximum y location (exclusive) in the chunk to set - * @param zMax maximum z location (exclusive) in the chunk to set - * @param material the type to set the blocks to + * @param x the x location in the chunk from 0-15 inclusive + * @param y the y location in the chunk from 0 (inclusive) - maxHeight (exclusive) + * @param z the z location in the chunk from 0-15 inclusive + * @param blockData the type to set the block to */ - public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, Material material); - + public void setBlock(int x, int y, int z, BlockData blockData); + /** * Set a region of this chunk from xMin, yMin, zMin (inclusive) * to xMax, yMax, zMax (exclusive) to material. @@ -372,35 +194,11 @@ public abstract class ChunkGenerator { * @param zMax maximum z location (exclusive) in the chunk to set * @param material the type to set the blocks to */ - public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, MaterialData material); - - /** - * Get the type of the block at x, y, z. - * - * Getting blocks outside the chunk's bounds returns air. - * - * @param x the x location in the chunk from 0-15 inclusive - * @param y the y location in the chunk from 0 (inclusive) - maxHeight (exclusive) - * @param z the z location in the chunk from 0-15 inclusive - * @return the type of the block or Material.AIR if x, y or z are outside the chunk's bounds - */ - public Material getType(int x, int y, int z); - - /** - * Get the type and data of the block at x, y ,z. - * - * Getting blocks outside the chunk's bounds returns air. - * - * @param x the x location in the chunk from 0-15 inclusive - * @param y the y location in the chunk from 0 (inclusive) - maxHeight (exclusive) - * @param z the z location in the chunk from 0-15 inclusive - * @return the type and data of the block or the MaterialData for air if x, y or z are outside the chunk's bounds - */ - public MaterialData getTypeAndData(int x, int y, int z); + public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, Material material); /** * Set a region of this chunk from xMin, yMin, zMin (inclusive) - * to xMax, yMax, zMax (exclusive) to block id. + * to xMax, yMax, zMax (exclusive) to material. * * Setting blocks outside the chunk's bounds does nothing. * @@ -410,15 +208,13 @@ public abstract class ChunkGenerator { * @param xMax maximum x location (exclusive) in the chunk to set * @param yMax maximum y location (exclusive) in the chunk to set * @param zMax maximum z location (exclusive) in the chunk to set - * @param blockId the block id to set the blocks to - * @deprecated Uses magic values. + * @param material the type to set the blocks to */ - @Deprecated - public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, int blockId); + public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, MaterialData material); /** - * Set a region of this chunk from xMin, yMin, zMin (inclusive) - * to xMax, yMax, zMax (exclusive) to block id and data. + * Set a region of this chunk from xMin, yMin, zMin (inclusive) to xMax, + * yMax, zMax (exclusive) to material. * * Setting blocks outside the chunk's bounds does nothing. * @@ -428,55 +224,45 @@ public abstract class ChunkGenerator { * @param xMax maximum x location (exclusive) in the chunk to set * @param yMax maximum y location (exclusive) in the chunk to set * @param zMax maximum z location (exclusive) in the chunk to set - * @param blockId the block id to set the blocks to - * @param data the block data to set the blocks to - * @deprecated Uses magic values. + * @param blockData the type to set the blocks to */ - @Deprecated - public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, int blockId, int data); - + public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, BlockData blockData); + /** - * Set the block at x,y,z in the chunk data to blockId. + * Get the type of the block at x, y, z. * - * Setting blocks outside the chunk's bounds does nothing. + * Getting blocks outside the chunk's bounds returns air. * * @param x the x location in the chunk from 0-15 inclusive * @param y the y location in the chunk from 0 (inclusive) - maxHeight (exclusive) * @param z the z location in the chunk from 0-15 inclusive - * @param blockId the blockId to set the block to - * @deprecated Uses magic values + * @return the type of the block or Material.AIR if x, y or z are outside the chunk's bounds */ - @Deprecated - public void setBlock(int x, int y, int z, int blockId); + public Material getType(int x, int y, int z); /** - * Set the block at x,y,z in the chunk data to blockId. + * Get the type and data of the block at x, y ,z. * - * Setting blocks outside the chunk's bounds does nothing. + * Getting blocks outside the chunk's bounds returns air. * * @param x the x location in the chunk from 0-15 inclusive * @param y the y location in the chunk from 0 (inclusive) - maxHeight (exclusive) * @param z the z location in the chunk from 0-15 inclusive - * @param blockId the blockId to set the block to - * @param data the block data to set the block to - * @deprecated Uses magic values + * @return the type and data of the block or the MaterialData for air if x, y or z are outside the chunk's bounds */ - @Deprecated - public void setBlock(int x, int y, int z, int blockId, byte data); + public MaterialData getTypeAndData(int x, int y, int z); /** - * Get the blockId at x,y,z in the chunk data. + * Get the type and data of the block at x, y ,z. * - * Getting blocks outside the chunk's bounds returns 0. + * Getting blocks outside the chunk's bounds returns air. * * @param x the x location in the chunk from 0-15 inclusive * @param y the y location in the chunk from 0 (inclusive) - maxHeight (exclusive) * @param z the z location in the chunk from 0-15 inclusive - * @return the block id or 0 if x, y or z are outside the chunk's bounds - * @deprecated Uses magic values + * @return the data of the block or the MaterialData for air if x, y or z are outside the chunk's bounds */ - @Deprecated - public int getTypeId(int x, int y, int z); + public BlockData getBlockData(int x, int y, int z); /** * Get the block data at x,y,z in the chunk data. diff --git a/src/main/java/org/bukkit/inventory/FurnaceRecipe.java b/src/main/java/org/bukkit/inventory/FurnaceRecipe.java index b1774d6d..93696606 100644 --- a/src/main/java/org/bukkit/inventory/FurnaceRecipe.java +++ b/src/main/java/org/bukkit/inventory/FurnaceRecipe.java @@ -1,76 +1,61 @@ package org.bukkit.inventory; +import com.google.common.base.Preconditions; +import org.bukkit.Keyed; import org.bukkit.Material; +import org.bukkit.NamespacedKey; import org.bukkit.material.MaterialData; /** * Represents a smelting recipe. */ -public class FurnaceRecipe implements Recipe { +public class FurnaceRecipe implements Recipe, Keyed { + private final NamespacedKey key; private ItemStack output; private ItemStack ingredient; private float experience; + private int cookingTime; - /** - * Create a furnace recipe to craft the specified ItemStack. - * - * @param result The item you want the recipe to create. - * @param source The input material. - */ + @Deprecated public FurnaceRecipe(ItemStack result, Material source) { - this(result, source, 0, 0); + this(NamespacedKey.randomKey(), result, source, 0, 0, 200); } - /** - * Create a furnace recipe to craft the specified ItemStack. - * - * @param result The item you want the recipe to create. - * @param source The input material. - */ + @Deprecated public FurnaceRecipe(ItemStack result, MaterialData source) { - this(result, source.getItemType(), source.getData(), 0); + this(NamespacedKey.randomKey(), result, source.getItemType(), source.getData(), 0, 200); } - /** - * Create a furnace recipe to craft the specified ItemStack. - * - * @param result The item you want the recipe to create. - * @param source The input material. - * @param experience The experience given by this recipe - */ + @Deprecated public FurnaceRecipe(ItemStack result, MaterialData source, float experience) { - this(result, source.getItemType(), source.getData(), experience); + this(NamespacedKey.randomKey(), result, source.getItemType(), source.getData(), experience, 200); } - /** - * Create a furnace recipe to craft the specified ItemStack. - * - * @param result The item you want the recipe to create. - * @param source The input material. - * @param data The data value. (Note: This is currently ignored by the - * CraftBukkit server.) - * @deprecated Magic value - */ @Deprecated public FurnaceRecipe(ItemStack result, Material source, int data) { - this(result, source, data, 0); + this(NamespacedKey.randomKey(), result, source, data, 0, 200); } /** * Create a furnace recipe to craft the specified ItemStack. * + * @param key The unique recipe key * @param result The item you want the recipe to create. * @param source The input material. - * @param data The data value. (Note: This is currently ignored by the - * CraftBukkit server.) * @param experience The experience given by this recipe - * @deprecated Magic value + * @param cookingTime The cooking time (in ticks) */ + public FurnaceRecipe(NamespacedKey key, ItemStack result, Material source, float experience, int cookingTime) { + this(key, result, source, 0, experience, cookingTime); + } + @Deprecated - public FurnaceRecipe(ItemStack result, Material source, int data, float experience) { + public FurnaceRecipe(NamespacedKey key, ItemStack result, Material source, int data, float experience, int cookingTime) { + this.key = key; this.output = new ItemStack(result); this.ingredient = new ItemStack(source, 1, (short) data); this.experience = experience; + this.cookingTime = cookingTime; } /** @@ -143,4 +128,28 @@ public class FurnaceRecipe implements Recipe { public float getExperience() { return experience; } + + /** + * Set the cooking time for this recipe in ticks. + * + * @param cookingTime new cooking time + */ + public void setCookingTime(int cookingTime) { + Preconditions.checkArgument(cookingTime >= 0, "cookingTime must be >= 0"); + this.cookingTime = cookingTime; + } + + /** + * Get the cooking time for this recipe in ticks. + * + * @return cooking time + */ + public int getCookingTime() { + return cookingTime; + } + + @Override + public NamespacedKey getKey() { + return key; + } } diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java index 3275e172..2dbba001 100644 --- a/src/main/java/org/bukkit/inventory/Inventory.java +++ b/src/main/java/org/bukkit/inventory/Inventory.java @@ -159,17 +159,6 @@ public interface Inventory extends Iterable<ItemStack> { /** * Checks if the inventory contains any ItemStacks with the given - * materialId - * - * @param materialId The materialId to check for - * @return true if an ItemStack in this inventory contains the materialId - * @deprecated Magic value - */ - @Deprecated - public boolean contains(int materialId); - - /** - * Checks if the inventory contains any ItemStacks with the given * material. * * @param material The material to check for @@ -193,19 +182,6 @@ public interface Inventory extends Iterable<ItemStack> { /** * Checks if the inventory contains any ItemStacks with the given - * materialId, adding to at least the minimum amount specified. - * - * @param materialId The materialId to check for - * @param amount The minimum amount to look for - * @return true if this contains any matching ItemStack with the given - * materialId and amount - * @deprecated Magic value - */ - @Deprecated - public boolean contains(int materialId, int amount); - - /** - * Checks if the inventory contains any ItemStacks with the given * material, adding to at least the minimum amount specified. * * @param material The material to check for @@ -244,21 +220,6 @@ public interface Inventory extends Iterable<ItemStack> { /** * Returns a HashMap with all slots and ItemStacks in the inventory with - * given materialId. - * <p> - * The HashMap contains entries where, the key is the slot index, and the - * value is the ItemStack in that slot. If no matching ItemStack with the - * given materialId is found, an empty map is returned. - * - * @param materialId The materialId to look for - * @return A HashMap containing the slot index, ItemStack pairs - * @deprecated Magic value - */ - @Deprecated - public HashMap<Integer, ? extends ItemStack> all(int materialId); - - /** - * Returns a HashMap with all slots and ItemStacks in the inventory with * the given Material. * <p> * The HashMap contains entries where, the key is the slot index, and the @@ -287,17 +248,6 @@ public interface Inventory extends Iterable<ItemStack> { /** * Finds the first slot in the inventory containing an ItemStack with the - * given materialId. - * - * @param materialId The materialId to look for - * @return The slot index of the given materialId or -1 if not found - * @deprecated Magic value - */ - @Deprecated - public int first(int materialId); - - /** - * Finds the first slot in the inventory containing an ItemStack with the * given material * * @param material The material to look for @@ -324,15 +274,6 @@ public interface Inventory extends Iterable<ItemStack> { public int firstEmpty(); /** - * Removes all stacks in the inventory matching the given materialId. - * - * @param materialId The material to remove - * @deprecated Magic value - */ - @Deprecated - public void remove(int materialId); - - /** * Removes all stacks in the inventory matching the given material. * * @param material The material to remove diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java index 52a8d4d8..762c43d6 100644 --- a/src/main/java/org/bukkit/inventory/ItemFactory.java +++ b/src/main/java/org/bukkit/inventory/ItemFactory.java @@ -121,4 +121,17 @@ public interface ItemFactory { * @return the default color for leather armor */ Color getDefaultLeatherColor(); + + /** + * Apply a material change for an item meta. Do not use under any + * circumstances. + * + * @param meta + * @param material + * @return updated material + * @throws IllegalArgumentException + * @deprecated for internal use only + */ + @Deprecated + Material updateMaterial(final ItemMeta meta, final Material material) throws IllegalArgumentException; } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java index cd5a91f9..6324044d 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java @@ -10,6 +10,7 @@ import org.bukkit.Material; import org.bukkit.Utility; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.meta.Damageable; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.material.MaterialData; @@ -17,10 +18,9 @@ import org.bukkit.material.MaterialData; * Represents a stack of items */ public class ItemStack implements Cloneable, ConfigurationSerializable { - private int type = 0; + private Material type = Material.AIR; private int amount = 0; private MaterialData data = null; - private short durability = 0; private ItemMeta meta; @Utility @@ -29,17 +29,6 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { /** * Defaults stack size to 1, with no extra data * - * @param type item material id - * @deprecated Magic value - */ - @Deprecated - public ItemStack(final int type) { - this(type, 1); - } - - /** - * Defaults stack size to 1, with no extra data - * * @param type item material */ public ItemStack(final Material type) { @@ -49,38 +38,11 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { /** * An item stack with no extra data * - * @param type item material id - * @param amount stack size - * @deprecated Magic value - */ - @Deprecated - public ItemStack(final int type, final int amount) { - this(type, amount, (short) 0); - } - - /** - * An item stack with no extra data - * * @param type item material * @param amount stack size */ public ItemStack(final Material type, final int amount) { - this(type.getId(), amount); - } - - /** - * An item stack with the specified damage / durability - * - * @param type item material id - * @param amount stack size - * @param damage durability / damage - * @deprecated Magic value - */ - @Deprecated - public ItemStack(final int type, final int amount, final short damage) { - this.type = type; - this.amount = amount; - this.durability = damage; + this(type, amount, (short) 0); } /** @@ -91,40 +53,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { * @param damage durability / damage */ public ItemStack(final Material type, final int amount, final short damage) { - this(type.getId(), amount, damage); + this(type, amount, damage, null); } /** - * @param type the raw type id + * @param type the type * @param amount the amount in the stack * @param damage the damage value of the item * @param data the data value or null * @deprecated this method uses an ambiguous data byte object */ @Deprecated - public ItemStack(final int type, final int amount, final short damage, final Byte data) { + public ItemStack(final Material type, final int amount, final short damage, final Byte data) { + Validate.notNull(type, "Material cannot be null"); this.type = type; this.amount = amount; - this.durability = damage; + if (damage != 0) { + setDurability(damage); + } if (data != null) { createData(data); - this.durability = data; } } /** - * @param type the type - * @param amount the amount in the stack - * @param damage the damage value of the item - * @param data the data value or null - * @deprecated this method uses an ambiguous data byte object - */ - @Deprecated - public ItemStack(final Material type, final int amount, final short damage, final Byte data) { - this(type.getId(), amount, damage, data); - } - - /** * Creates a new item stack derived from the specified stack * * @param stack the stack to copy @@ -133,12 +85,11 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { */ public ItemStack(final ItemStack stack) throws IllegalArgumentException { Validate.notNull(stack, "Cannot copy null stack"); - this.type = stack.getTypeId(); + this.type = stack.getType(); this.amount = stack.getAmount(); - this.durability = stack.getDurability(); this.data = stack.getData(); if (stack.hasItemMeta()) { - setItemMeta0(stack.getItemMeta(), getType0()); + setItemMeta0(stack.getItemMeta(), type); } } @@ -149,16 +100,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { */ @Utility public Material getType() { - return getType0(getTypeId()); - } - - private Material getType0() { - return getType0(this.type); - } - - private static Material getType0(int id) { - Material material = Material.getMaterial(id); - return material == null ? Material.AIR : material; + return type; } /** @@ -171,35 +113,13 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { @Utility public void setType(Material type) { Validate.notNull(type, "Material cannot be null"); - setTypeId(type.getId()); - } - - /** - * Gets the type id of this item - * - * @return Type Id of the items in this stack - * @deprecated Magic value - */ - @Deprecated - public int getTypeId() { - return type; - } - - /** - * Sets the type id of this item - * <p> - * Note that in doing so you will reset the MaterialData for this stack - * - * @param type New type id to set the items in this stack to - * @deprecated Magic value - */ - @Deprecated - public void setTypeId(int type) { this.type = type; if (this.meta != null) { - this.meta = Bukkit.getItemFactory().asMetaFor(meta, getType0()); + this.meta = Bukkit.getItemFactory().asMetaFor(meta, type); + } + if (type.isLegacy()) { + createData((byte) 0); } - createData((byte) 0); } /** @@ -226,7 +146,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { * @return MaterialData for this item */ public MaterialData getData() { - Material mat = getType(); + Material mat = Bukkit.getUnsafe().toLegacy(getType()); if (data == null && mat != null && mat.getData() != null) { data = mat.getNewData((byte) this.getDurability()); } @@ -240,7 +160,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { * @param data New MaterialData for this item */ public void setData(MaterialData data) { - Material mat = getType(); + Material mat = Bukkit.getUnsafe().toLegacy(getType()); if (data == null || mat == null || mat.getData() == null) { this.data = data; @@ -259,7 +179,11 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { * @param durability Durability of this item */ public void setDurability(final short durability) { - this.durability = durability; + ItemMeta meta = getItemMeta(); + if (meta != null) { + ((Damageable) meta).setDamage(durability); + setItemMeta(meta); + } } /** @@ -268,7 +192,8 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { * @return Durability of this item */ public short getDurability() { - return durability; + ItemMeta meta = getItemMeta(); + return (meta == null) ? 0 : (short) ((Damageable) meta).getDamage(); } /** @@ -287,13 +212,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { } private void createData(final byte data) { - Material mat = Material.getMaterial(type); - - if (mat == null) { - this.data = new MaterialData(type, data); - } else { - this.data = mat.getNewData(data); - } + this.data = type.getNewData(data); } @Override @@ -335,7 +254,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { if (stack == this) { return true; } - return getTypeId() == stack.getTypeId() && getDurability() == stack.getDurability() && hasItemMeta() == stack.hasItemMeta() && (hasItemMeta() ? Bukkit.getItemFactory().equals(getItemMeta(), stack.getItemMeta()) : true); + return getType()== stack.getType()&& getDurability() == stack.getDurability() && hasItemMeta() == stack.hasItemMeta() && (hasItemMeta() ? Bukkit.getItemFactory().equals(getItemMeta(), stack.getItemMeta()) : true); } @Override @@ -362,7 +281,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { public int hashCode() { int hash = 1; - hash = hash * 31 + getTypeId(); + hash = hash * 31 + getType().hashCode(); hash = hash * 31 + getAmount(); hash = hash * 31 + (getDurability() & 0xffff); hash = hash * 31 + (hasItemMeta() ? (meta == null ? getItemMeta().hashCode() : meta.hashCode()) : 0); @@ -472,7 +391,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { * @param level Level of the enchantment */ public void addUnsafeEnchantment(Enchantment ench, int level) { - (meta == null ? meta = Bukkit.getItemFactory().getItemMeta(getType0()) : meta).addEnchant(ench, level, true); + (meta == null ? meta = Bukkit.getItemFactory().getItemMeta(type) : meta).addEnchant(ench, level, true); } /** @@ -495,12 +414,9 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { public Map<String, Object> serialize() { Map<String, Object> result = new LinkedHashMap<String, Object>(); + result.put("v", Bukkit.getUnsafe().getDataVersion()); // Include version to indicate we are using modern material names (or LEGACY prefix) result.put("type", getType().name()); - if (getDurability() != 0) { - result.put("damage", getDurability()); - } - if (getAmount() != 1) { result.put("amount", getAmount()); } @@ -521,7 +437,9 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { * @see ConfigurationSerializable */ public static ItemStack deserialize(Map<String, Object> args) { - Material type = Material.getMaterial((String) args.get("type")); + int version = (args.containsKey("v")) ? ((Number) args.get("v")).intValue() : -1; + Material type = Material.getMaterial((String) args.get("type"), version < 0); + short damage = 0; int amount = 1; @@ -556,6 +474,11 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { } } + // Set damage again incase meta overwrote it + if (args.containsKey("damage")) { + result.setDurability(damage); + } + return result; } @@ -565,7 +488,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { * @return a copy of the current ItemStack's ItemData */ public ItemMeta getItemMeta() { - return this.meta == null ? Bukkit.getItemFactory().getItemMeta(getType0()) : this.meta.clone(); + return this.meta == null ? Bukkit.getItemFactory().getItemMeta(this.type) : this.meta.clone(); } /** @@ -587,7 +510,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { * the {@link ItemFactory} */ public boolean setItemMeta(ItemMeta itemMeta) { - return setItemMeta0(itemMeta, getType0()); + return setItemMeta0(itemMeta, type); } /* @@ -602,6 +525,12 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { return false; } this.meta = Bukkit.getItemFactory().asMetaFor(itemMeta, material); + + Material newType = Bukkit.getItemFactory().updateMaterial(meta, material); + if (this.type != newType) { + this.type = newType; + } + if (this.meta == itemMeta) { this.meta = itemMeta.clone(); } diff --git a/src/main/java/org/bukkit/inventory/PlayerInventory.java b/src/main/java/org/bukkit/inventory/PlayerInventory.java index 557cc04d..5d75bd49 100644 --- a/src/main/java/org/bukkit/inventory/PlayerInventory.java +++ b/src/main/java/org/bukkit/inventory/PlayerInventory.java @@ -197,18 +197,5 @@ public interface PlayerInventory extends Inventory { */ public void setHeldItemSlot(int slot); - /** - * Clears all matching items from the inventory. Setting either value to - * -1 will skip it's check, while setting both to -1 will clear all items - * in your inventory unconditionally. - * - * @param id the id of the item you want to clear from the inventory - * @param data the data of the item you want to clear from the inventory - * @return The number of items cleared - * @deprecated Magic value - */ - @Deprecated - public int clear(int id, int data); - public HumanEntity getHolder(); } diff --git a/src/main/java/org/bukkit/inventory/meta/BookMeta.java b/src/main/java/org/bukkit/inventory/meta/BookMeta.java index d66e3f59..b2851209 100644 --- a/src/main/java/org/bukkit/inventory/meta/BookMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/BookMeta.java @@ -5,7 +5,7 @@ import java.util.List; import org.bukkit.Material; /** - * Represents a book ({@link Material#BOOK_AND_QUILL} or {@link + * Represents a book ({@link Material#WRITABLE_BOOK} or {@link * Material#WRITTEN_BOOK}) that can have a title, an author, and pages. */ public interface BookMeta extends ItemMeta { diff --git a/src/main/java/org/bukkit/inventory/meta/Damageable.java b/src/main/java/org/bukkit/inventory/meta/Damageable.java new file mode 100644 index 00000000..b3c4dc43 --- /dev/null +++ b/src/main/java/org/bukkit/inventory/meta/Damageable.java @@ -0,0 +1,30 @@ +package org.bukkit.inventory.meta; + +/** + * Represents an item that has durability and can take damage. + */ +public interface Damageable { + + /** + * Checks to see if this item has damage + * + * @return true if this has damage + */ + boolean hasDamage(); + + /** + * Gets the damage + * + * @return the damage + */ + int getDamage(); + + /** + * Sets the damage + * + * @param damage item damage + */ + void setDamage(int damage); + + Damageable clone(); +} diff --git a/src/main/java/org/bukkit/inventory/meta/FireworkEffectMeta.java b/src/main/java/org/bukkit/inventory/meta/FireworkEffectMeta.java index 47046f16..f3af4bcc 100644 --- a/src/main/java/org/bukkit/inventory/meta/FireworkEffectMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/FireworkEffectMeta.java @@ -5,7 +5,7 @@ import org.bukkit.Material; /** * Represents a meta that can store a single FireworkEffect. An example - * includes {@link Material#FIREWORK_CHARGE}. + * includes {@link Material#FIREWORK_STAR}. */ public interface FireworkEffectMeta extends ItemMeta { diff --git a/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java b/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java index d3a86c7e..02486c1f 100644 --- a/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java @@ -6,7 +6,7 @@ import org.bukkit.FireworkEffect; import org.bukkit.Material; /** - * Represents a {@link Material#FIREWORK} and its effects. + * Represents a {@link Material#FIREWORK_ROCKET} and its effects. */ public interface FireworkMeta extends ItemMeta { diff --git a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java index c60860e1..15c1dfd9 100644 --- a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java @@ -1,10 +1,9 @@ package org.bukkit.inventory.meta; -import org.bukkit.Material; import org.bukkit.OfflinePlayer; /** - * Represents a skull ({@link Material#SKULL_ITEM}) that can have an owner. + * Represents a skull that can have an owner. */ public interface SkullMeta extends ItemMeta { diff --git a/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java b/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java index b89802d1..39358e22 100644 --- a/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java @@ -1,10 +1,9 @@ package org.bukkit.inventory.meta; -import org.bukkit.Material; import org.bukkit.entity.EntityType; /** - * Represents a {@link Material#MONSTER_EGG} and it's spawned type. + * Represents a spawn egg and it's spawned type. */ public interface SpawnEggMeta extends ItemMeta { @@ -12,7 +11,9 @@ public interface SpawnEggMeta extends ItemMeta { * Get the type of entity this egg will spawn. * * @return The entity type. May be null for implementation specific default. + * @deprecated different types are different items */ + @Deprecated EntityType getSpawnedType(); /** @@ -20,7 +21,9 @@ public interface SpawnEggMeta extends ItemMeta { * * @param type The entity type. May be null for implementation specific * default. + * @deprecated different types are different items */ + @Deprecated void setSpawnedType(EntityType type); @Override diff --git a/src/main/java/org/bukkit/inventory/meta/TropicalFishBucketMeta.java b/src/main/java/org/bukkit/inventory/meta/TropicalFishBucketMeta.java new file mode 100644 index 00000000..f8a11393 --- /dev/null +++ b/src/main/java/org/bukkit/inventory/meta/TropicalFishBucketMeta.java @@ -0,0 +1,80 @@ +package org.bukkit.inventory.meta; + +import org.bukkit.DyeColor; +import org.bukkit.entity.TropicalFish; + +/** + * Represents a bucket of tropical fish. + */ +public interface TropicalFishBucketMeta extends ItemMeta { + + /** + * Gets the color of the fish's pattern. + * <p> + * Plugins should check that hasVariant() returns <code>true</code> before + * calling this method. + * + * @return pattern color + */ + DyeColor getPatternColor(); + + /** + * Sets the color of the fish's pattern. + * <p> + * Setting this when hasVariant() returns <code>false</code> will initialize + * all other values to unspecified defaults. + * + * @param color pattern color + */ + void setPatternColor(DyeColor color); + + /** + * Gets the color of the fish's body. + * <p> + * Plugins should check that hasVariant() returns <code>true</code> before + * calling this method. + * + * @return pattern color + */ + DyeColor getBodyColor(); + + /** + * Sets the color of the fish's body. + * <p> + * Setting this when hasVariant() returns <code>false</code> will initialize + * all other values to unspecified defaults. + * + * @param color body color + */ + void setBodyColor(DyeColor color); + + /** + * Gets the fish's pattern. + * <p> + * Plugins should check that hasVariant() returns <code>true</code> before + * calling this method. + * + * @return pattern + */ + TropicalFish.Pattern getPattern(); + + /** + * Sets the fish's pattern. + * <p> + * Setting this when hasVariant() returns <code>false</code> will initialize + * all other values to unspecified defaults. + * + * @param pattern new pattern + */ + void setPattern(TropicalFish.Pattern pattern); + + /** + * Checks for existence of a variant tag indicating a specific fish will be + * spawned. + * + * @return if there is a variant + */ + boolean hasVariant(); + + TropicalFishBucketMeta clone(); +} diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java index b93886c6..94b26ae2 100644 --- a/src/main/java/org/bukkit/map/MapCursor.java +++ b/src/main/java/org/bukkit/map/MapCursor.java @@ -7,6 +7,7 @@ public final class MapCursor { private byte x, y; private byte direction, type; private boolean visible; + private String caption; /** * Initialize the map cursor. @@ -147,8 +148,8 @@ public final class MapCursor { */ @Deprecated public void setRawType(byte type) { - if (type < 0 || type > 15) { - throw new IllegalArgumentException("Type must be in the range 0-15"); + if (type < 0 || type > 26) { + throw new IllegalArgumentException("Type must be in the range 0-26"); } this.type = type; } @@ -163,6 +164,24 @@ public final class MapCursor { } /** + * Gets the caption on this cursor. + * + * @return caption + */ + public String getCaption() { + return caption; + } + + /** + * Sets the caption on this cursor. + * + * @param caption new caption + */ + public void setCaption(String caption) { + this.caption = caption; + } + + /** * Represents the standard types of map cursors. More may be made * available by resource packs - the value is used by the client as an * index in the file './misc/mapicons.png' from minecraft.jar or from a @@ -178,7 +197,24 @@ public final class MapCursor { WHITE_CIRCLE(6), SMALL_WHITE_CIRCLE(7), MANSION(8), - TEMPLE(9); + TEMPLE(9), + BANNER_WHITE(10), + BANNER_ORANGE(11), + BANNER_MAGENTA(12), + BANNER_LIGHT_BLUE(13), + BANNER_YELLOW(14), + BANNER_LIME(15), + BANNER_PINK(16), + BANNER_GRAY(17), + BANNER_LIGHT_GRAY(18), + BANNER_CYAN(19), + BANNER_PURPLE(20), + BANNER_BLUE(21), + BANNER_BROWN(22), + BANNER_GREEN(23), + BANNER_RED(24), + BANNER_BLACK(25), + RED_X(26); private byte value; diff --git a/src/main/java/org/bukkit/material/Banner.java b/src/main/java/org/bukkit/material/Banner.java index 80a76165..5f1843f9 100644 --- a/src/main/java/org/bukkit/material/Banner.java +++ b/src/main/java/org/bukkit/material/Banner.java @@ -6,7 +6,7 @@ import org.bukkit.block.BlockFace; public class Banner extends MaterialData implements Attachable { public Banner() { - super(Material.BANNER); + super(Material.LEGACY_BANNER); } public Banner(Material type) { @@ -14,15 +14,6 @@ public class Banner extends MaterialData implements Attachable { } /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Banner(int type) { - super(type); - } - - /** * * @param type the type * @param data the raw data value @@ -33,18 +24,8 @@ public class Banner extends MaterialData implements Attachable { super(type, data); } - /** * - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Banner(int type, byte data) { - super(type, data); - } - public boolean isWallBanner() { - return getItemType() == Material.WALL_BANNER; + return getItemType() == Material.LEGACY_WALL_BANNER; } public BlockFace getAttachedFace() { diff --git a/src/main/java/org/bukkit/material/Bed.java b/src/main/java/org/bukkit/material/Bed.java index ce94dafb..63965682 100644 --- a/src/main/java/org/bukkit/material/Bed.java +++ b/src/main/java/org/bukkit/material/Bed.java @@ -12,7 +12,7 @@ public class Bed extends MaterialData implements Directional { * Default constructor for a bed. */ public Bed() { - super(Material.BED_BLOCK); + super(Material.LEGACY_BED_BLOCK); } /** @@ -25,31 +25,11 @@ public class Bed extends MaterialData implements Directional { setFacingDirection(direction); } - /** - * - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Bed(final int type) { - super(type); - } - public Bed(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Bed(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Button.java b/src/main/java/org/bukkit/material/Button.java index fd6a7db8..62c499a1 100644 --- a/src/main/java/org/bukkit/material/Button.java +++ b/src/main/java/org/bukkit/material/Button.java @@ -8,16 +8,7 @@ import org.bukkit.Material; */ public class Button extends SimpleAttachableMaterialData implements Redstone { public Button() { - super(Material.STONE_BUTTON); - } - - /** - * @param type the type - * @deprecated Magic value - */ - @Deprecated - public Button(final int type) { - super(type); + super(Material.LEGACY_STONE_BUTTON); } public Button(final Material type) { @@ -25,16 +16,6 @@ public class Button extends SimpleAttachableMaterialData implements Redstone { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Button(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Cake.java b/src/main/java/org/bukkit/material/Cake.java index e72cb914..25e3db48 100644 --- a/src/main/java/org/bukkit/material/Cake.java +++ b/src/main/java/org/bukkit/material/Cake.java @@ -4,16 +4,7 @@ import org.bukkit.Material; public class Cake extends MaterialData { public Cake() { - super(Material.CAKE_BLOCK); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Cake(int type) { - super(type); + super(Material.LEGACY_CAKE_BLOCK); } public Cake(Material type) { @@ -21,16 +12,6 @@ public class Cake extends MaterialData { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Cake(int type, byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Cauldron.java b/src/main/java/org/bukkit/material/Cauldron.java index 0d00e501..90e7a5af 100644 --- a/src/main/java/org/bukkit/material/Cauldron.java +++ b/src/main/java/org/bukkit/material/Cauldron.java @@ -10,17 +10,17 @@ public class Cauldron extends MaterialData { private static final int CAULDRON_EMPTY = 0; public Cauldron() { - super(Material.CAULDRON); + super(Material.LEGACY_CAULDRON); } /** * - * @param type the raw type id + * @param type the type * @param data the raw data value * @deprecated Magic value */ @Deprecated - public Cauldron(int type, byte data) { + public Cauldron(final Material type, final byte data) { super(type, data); } @@ -31,7 +31,7 @@ public class Cauldron extends MaterialData { */ @Deprecated public Cauldron(byte data) { - super(Material.CAULDRON, data); + super(Material.LEGACY_CAULDRON, data); } /** diff --git a/src/main/java/org/bukkit/material/Chest.java b/src/main/java/org/bukkit/material/Chest.java index 0db8aa54..48ef0b8c 100644 --- a/src/main/java/org/bukkit/material/Chest.java +++ b/src/main/java/org/bukkit/material/Chest.java @@ -9,7 +9,7 @@ import org.bukkit.block.BlockFace; public class Chest extends DirectionalContainer { public Chest() { - super(Material.CHEST); + super(Material.LEGACY_CHEST); } /** @@ -22,30 +22,11 @@ public class Chest extends DirectionalContainer { setFacingDirection(direction); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Chest(final int type) { - super(type); - } - public Chest(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Chest(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Coal.java b/src/main/java/org/bukkit/material/Coal.java index dd940b63..1ac6faaf 100644 --- a/src/main/java/org/bukkit/material/Coal.java +++ b/src/main/java/org/bukkit/material/Coal.java @@ -8,7 +8,7 @@ import org.bukkit.Material; */ public class Coal extends MaterialData { public Coal() { - super(Material.COAL); + super(Material.LEGACY_COAL); } public Coal(CoalType type) { @@ -16,30 +16,11 @@ public class Coal extends MaterialData { setType(type); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Coal(final int type) { - super(type); - } - public Coal(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Coal(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/CocoaPlant.java b/src/main/java/org/bukkit/material/CocoaPlant.java index 6dede93c..29822200 100644 --- a/src/main/java/org/bukkit/material/CocoaPlant.java +++ b/src/main/java/org/bukkit/material/CocoaPlant.java @@ -15,25 +15,16 @@ public class CocoaPlant extends MaterialData implements Directional, Attachable } public CocoaPlant() { - super(Material.COCOA); + super(Material.LEGACY_COCOA); } /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public CocoaPlant(final int type) { - super(type); - } - - /** - * @param type the raw type id + * @param type the type * @param data the raw data value * @deprecated Magic value */ @Deprecated - public CocoaPlant(final int type, final byte data) { + public CocoaPlant(final Material type, final byte data) { super(type, data); } diff --git a/src/main/java/org/bukkit/material/Command.java b/src/main/java/org/bukkit/material/Command.java index b484229e..7f6a88d5 100644 --- a/src/main/java/org/bukkit/material/Command.java +++ b/src/main/java/org/bukkit/material/Command.java @@ -7,16 +7,7 @@ import org.bukkit.Material; */ public class Command extends MaterialData implements Redstone { public Command() { - super(Material.COMMAND); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Command(final int type) { - super(type); + super(Material.LEGACY_COMMAND); } public Command(final Material type) { @@ -24,16 +15,6 @@ public class Command extends MaterialData implements Redstone { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Command(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Comparator.java b/src/main/java/org/bukkit/material/Comparator.java index b5b44b65..3464e8b7 100644 --- a/src/main/java/org/bukkit/material/Comparator.java +++ b/src/main/java/org/bukkit/material/Comparator.java @@ -6,8 +6,8 @@ import org.bukkit.block.BlockFace; /** * Represents a comparator in the on or off state, in normal or subtraction mode and facing in a specific direction. * - * @see Material#REDSTONE_COMPARATOR_OFF - * @see Material#REDSTONE_COMPARATOR_ON + * @see Material#LEGACY_REDSTONE_COMPARATOR_OFF + * @see Material#LEGACY_REDSTONE_COMPARATOR_ON */ public class Comparator extends MaterialData implements Directional, Redstone { protected static final BlockFace DEFAULT_DIRECTION = BlockFace.NORTH; @@ -54,35 +54,16 @@ public class Comparator extends MaterialData implements Directional, Redstone { * @see BlockFace */ public Comparator(BlockFace facingDirection, boolean isSubtraction, boolean state) { - super(state ? Material.REDSTONE_COMPARATOR_ON : Material.REDSTONE_COMPARATOR_OFF); + super(state ? Material.LEGACY_REDSTONE_COMPARATOR_ON : Material.LEGACY_REDSTONE_COMPARATOR_OFF); setFacingDirection(facingDirection); setSubtractionMode(isSubtraction); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Comparator(int type) { - super(type); - } - public Comparator(Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Comparator(int type, byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value @@ -186,7 +167,7 @@ public class Comparator extends MaterialData implements Directional, Redstone { */ @Override public boolean isPowered() { - return getItemType() == Material.REDSTONE_COMPARATOR_ON; + return getItemType() == Material.LEGACY_REDSTONE_COMPARATOR_ON; } /** diff --git a/src/main/java/org/bukkit/material/Crops.java b/src/main/java/org/bukkit/material/Crops.java index f149831c..0706f7a2 100644 --- a/src/main/java/org/bukkit/material/Crops.java +++ b/src/main/java/org/bukkit/material/Crops.java @@ -6,14 +6,14 @@ import org.bukkit.Material; /** * Represents the different types of crops in different states of growth. * - * @see Material#CROPS - * @see Material#CARROT - * @see Material#POTATO - * @see Material#BEETROOT_BLOCK - * @see Material#NETHER_WARTS + * @see Material#LEGACY_CROPS + * @see Material#LEGACY_CARROT + * @see Material#LEGACY_POTATO + * @see Material#LEGACY_BEETROOT_BLOCK + * @see Material#LEGACY_NETHER_WARTS */ public class Crops extends MaterialData { - protected static final Material DEFAULT_TYPE = Material.CROPS; + protected static final Material DEFAULT_TYPE = Material.LEGACY_CROPS; protected static final CropState DEFAULT_STATE = CropState.SEEDED; /** @@ -45,15 +45,6 @@ public class Crops extends MaterialData { } /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Crops(final int type) { - super(type); - } - - /** * Constructs a crop block of the given type and in the seeded state * * @param type The type of crops @@ -63,16 +54,6 @@ public class Crops extends MaterialData { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Crops(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value @@ -92,13 +73,13 @@ public class Crops extends MaterialData { */ public CropState getState() { switch (getItemType()) { - case CROPS: - case CARROT: - case POTATO: + case LEGACY_CROPS: + case LEGACY_CARROT: + case LEGACY_POTATO: // Mask the data just in case top bit set return CropState.getByData((byte) (getData() & 0x7)); - case BEETROOT_BLOCK: - case NETHER_WARTS: + case LEGACY_BEETROOT_BLOCK: + case LEGACY_NETHER_WARTS: // Mask the data just in case top bits are set // Will return SEEDED, SMALL, TALL, RIPE for the three growth data values return CropState.getByData((byte) (((getData() & 0x3) * 7 + 2) / 3)); @@ -123,14 +104,14 @@ public class Crops extends MaterialData { */ public void setState(CropState state) { switch (getItemType()) { - case CROPS: - case CARROT: - case POTATO: + case LEGACY_CROPS: + case LEGACY_CARROT: + case LEGACY_POTATO: // Preserve the top bit in case it is set setData((byte) ((getData() & 0x8) | state.getData())); break; - case NETHER_WARTS: - case BEETROOT_BLOCK: + case LEGACY_NETHER_WARTS: + case LEGACY_BEETROOT_BLOCK: // Preserve the top bits in case they are set setData((byte) ((getData() & 0xC) | (state.getData() >> 1))); break; diff --git a/src/main/java/org/bukkit/material/DetectorRail.java b/src/main/java/org/bukkit/material/DetectorRail.java index 652a4b5e..32d5db52 100644 --- a/src/main/java/org/bukkit/material/DetectorRail.java +++ b/src/main/java/org/bukkit/material/DetectorRail.java @@ -7,16 +7,7 @@ import org.bukkit.Material; */ public class DetectorRail extends ExtendedRails implements PressureSensor { public DetectorRail() { - super(Material.DETECTOR_RAIL); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public DetectorRail(final int type) { - super(type); + super(Material.LEGACY_DETECTOR_RAIL); } public DetectorRail(final Material type) { @@ -24,16 +15,6 @@ public class DetectorRail extends ExtendedRails implements PressureSensor { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public DetectorRail(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Diode.java b/src/main/java/org/bukkit/material/Diode.java index 84014c4f..9b7d02ef 100644 --- a/src/main/java/org/bukkit/material/Diode.java +++ b/src/main/java/org/bukkit/material/Diode.java @@ -7,8 +7,8 @@ import org.bukkit.block.BlockFace; * Represents a diode/repeater in the on or off state, with a delay and facing * in a specific direction. * - * @see Material#DIODE_BLOCK_OFF - * @see Material#DIODE_BLOCK_ON + * @see Material#LEGACY_DIODE_BLOCK_OFF + * @see Material#LEGACY_DIODE_BLOCK_ON */ public class Diode extends MaterialData implements Directional, Redstone { @@ -65,35 +65,16 @@ public class Diode extends MaterialData implements Directional, Redstone { * @see BlockFace */ public Diode(BlockFace facingDirection, int delay, boolean state) { - super(state ? Material.DIODE_BLOCK_ON : Material.DIODE_BLOCK_OFF); + super(state ? Material.LEGACY_DIODE_BLOCK_ON : Material.LEGACY_DIODE_BLOCK_OFF); setFacingDirection(facingDirection); setDelay(delay); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Diode(int type) { - super(type); - } - public Diode(Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Diode(int type, byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value @@ -204,6 +185,6 @@ public class Diode extends MaterialData implements Directional, Redstone { */ @Override public boolean isPowered() { - return getItemType() == Material.DIODE_BLOCK_ON; + return getItemType() == Material.LEGACY_DIODE_BLOCK_ON; } } diff --git a/src/main/java/org/bukkit/material/DirectionalContainer.java b/src/main/java/org/bukkit/material/DirectionalContainer.java index b56f0988..51433631 100644 --- a/src/main/java/org/bukkit/material/DirectionalContainer.java +++ b/src/main/java/org/bukkit/material/DirectionalContainer.java @@ -7,30 +7,12 @@ import org.bukkit.block.BlockFace; * Represents a furnace or a dispenser. */ public class DirectionalContainer extends MaterialData implements Directional { - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public DirectionalContainer(final int type) { - super(type); - } public DirectionalContainer(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public DirectionalContainer(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Dispenser.java b/src/main/java/org/bukkit/material/Dispenser.java index 988407cf..d078664a 100644 --- a/src/main/java/org/bukkit/material/Dispenser.java +++ b/src/main/java/org/bukkit/material/Dispenser.java @@ -9,7 +9,7 @@ import org.bukkit.block.BlockFace; public class Dispenser extends FurnaceAndDispenser { public Dispenser() { - super(Material.DISPENSER); + super(Material.LEGACY_DISPENSER); } public Dispenser(BlockFace direction) { @@ -17,30 +17,11 @@ public class Dispenser extends FurnaceAndDispenser { setFacingDirection(direction); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Dispenser(final int type) { - super(type); - } - public Dispenser(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Dispenser(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Door.java b/src/main/java/org/bukkit/material/Door.java index 07a40a00..15f2928e 100644 --- a/src/main/java/org/bukkit/material/Door.java +++ b/src/main/java/org/bukkit/material/Door.java @@ -11,13 +11,13 @@ import org.bukkit.block.BlockFace; * work with modern doors. Some methods are undefined dependant on <code>isTopHalf()</code> * due to Minecraft's internal representation of doors. * - * @see Material#WOODEN_DOOR - * @see Material#IRON_DOOR_BLOCK - * @see Material#SPRUCE_DOOR - * @see Material#BIRCH_DOOR - * @see Material#JUNGLE_DOOR - * @see Material#ACACIA_DOOR - * @see Material#DARK_OAK_DOOR + * @see Material#LEGACY_WOODEN_DOOR + * @see Material#LEGACY_IRON_DOOR_BLOCK + * @see Material#LEGACY_SPRUCE_DOOR + * @see Material#LEGACY_BIRCH_DOOR + * @see Material#LEGACY_JUNGLE_DOOR + * @see Material#LEGACY_ACACIA_DOOR + * @see Material#LEGACY_DARK_OAK_DOOR */ public class Door extends MaterialData implements Directional, Openable { @@ -25,20 +25,11 @@ public class Door extends MaterialData implements Directional, Openable { // of the way doors are currently implemented. Beware! /** - * @deprecated Artifact of old API, equivalent to new <code>Door(Material.WOODEN_DOOR);</code> + * @deprecated Artifact of old API, equivalent to new <code>Door(Material.LEGACY_WOODEN_DOOR);</code> */ @Deprecated public Door() { - super(Material.WOODEN_DOOR); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Door(final int type) { - super(type); + super(Material.LEGACY_WOODEN_DOOR); } public Door(final Material type) { @@ -51,13 +42,13 @@ public class Door extends MaterialData implements Directional, Openable { * @param type The type of material this door is made of. This must match the type of the block above. * @param face The direction the door is facing. * - * @see Material#WOODEN_DOOR - * @see Material#IRON_DOOR_BLOCK - * @see Material#SPRUCE_DOOR - * @see Material#BIRCH_DOOR - * @see Material#JUNGLE_DOOR - * @see Material#ACACIA_DOOR - * @see Material#DARK_OAK_DOOR + * @see Material#LEGACY_WOODEN_DOOR + * @see Material#LEGACY_IRON_DOOR_BLOCK + * @see Material#LEGACY_SPRUCE_DOOR + * @see Material#LEGACY_BIRCH_DOOR + * @see Material#LEGACY_JUNGLE_DOOR + * @see Material#LEGACY_ACACIA_DOOR + * @see Material#LEGACY_DARK_OAK_DOOR * * @see BlockFace#WEST * @see BlockFace#NORTH @@ -76,13 +67,13 @@ public class Door extends MaterialData implements Directional, Openable { * @param face The direction the door is facing. * @param isOpen Whether the door is currently opened. * - * @see Material#WOODEN_DOOR - * @see Material#IRON_DOOR_BLOCK - * @see Material#SPRUCE_DOOR - * @see Material#BIRCH_DOOR - * @see Material#JUNGLE_DOOR - * @see Material#ACACIA_DOOR - * @see Material#DARK_OAK_DOOR + * @see Material#LEGACY_WOODEN_DOOR + * @see Material#LEGACY_IRON_DOOR_BLOCK + * @see Material#LEGACY_SPRUCE_DOOR + * @see Material#LEGACY_BIRCH_DOOR + * @see Material#LEGACY_JUNGLE_DOOR + * @see Material#LEGACY_ACACIA_DOOR + * @see Material#LEGACY_DARK_OAK_DOOR * * @see BlockFace#WEST * @see BlockFace#NORTH @@ -102,13 +93,13 @@ public class Door extends MaterialData implements Directional, Openable { * @param type The type of material this door is made of. This must match the type of the block below. * @param isHingeRight True if the hinge is on the right hand side, false if the hinge is on the left hand side. * - * @see Material#WOODEN_DOOR - * @see Material#IRON_DOOR_BLOCK - * @see Material#SPRUCE_DOOR - * @see Material#BIRCH_DOOR - * @see Material#JUNGLE_DOOR - * @see Material#ACACIA_DOOR - * @see Material#DARK_OAK_DOOR + * @see Material#LEGACY_WOODEN_DOOR + * @see Material#LEGACY_IRON_DOOR_BLOCK + * @see Material#LEGACY_SPRUCE_DOOR + * @see Material#LEGACY_BIRCH_DOOR + * @see Material#LEGACY_JUNGLE_DOOR + * @see Material#LEGACY_ACACIA_DOOR + * @see Material#LEGACY_DARK_OAK_DOOR */ public Door(final Material type, boolean isHingeRight) { super(type); @@ -166,16 +157,6 @@ public class Door extends MaterialData implements Directional, Openable { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Door(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value @@ -191,28 +172,28 @@ public class Door extends MaterialData implements Directional, Openable { * @param species The species of wood door required. * @return The item type for the given species. * - * @see Material#WOODEN_DOOR - * @see Material#SPRUCE_DOOR - * @see Material#BIRCH_DOOR - * @see Material#JUNGLE_DOOR - * @see Material#ACACIA_DOOR - * @see Material#DARK_OAK_DOOR + * @see Material#LEGACY_WOODEN_DOOR + * @see Material#LEGACY_SPRUCE_DOOR + * @see Material#LEGACY_BIRCH_DOOR + * @see Material#LEGACY_JUNGLE_DOOR + * @see Material#LEGACY_ACACIA_DOOR + * @see Material#LEGACY_DARK_OAK_DOOR */ public static Material getWoodDoorOfSpecies(TreeSpecies species) { switch (species) { default: case GENERIC: - return Material.WOODEN_DOOR; + return Material.LEGACY_WOODEN_DOOR; case BIRCH: - return Material.BIRCH_DOOR; + return Material.LEGACY_BIRCH_DOOR; case REDWOOD: - return Material.SPRUCE_DOOR; + return Material.LEGACY_SPRUCE_DOOR; case JUNGLE: - return Material.JUNGLE_DOOR; + return Material.LEGACY_JUNGLE_DOOR; case ACACIA: - return Material.ACACIA_DOOR; + return Material.LEGACY_ACACIA_DOOR; case DARK_OAK: - return Material.DARK_OAK_DOOR; + return Material.LEGACY_DARK_OAK_DOOR; } } diff --git a/src/main/java/org/bukkit/material/Dye.java b/src/main/java/org/bukkit/material/Dye.java index 7174fdbf..5752be0e 100644 --- a/src/main/java/org/bukkit/material/Dye.java +++ b/src/main/java/org/bukkit/material/Dye.java @@ -8,16 +8,7 @@ import org.bukkit.Material; */ public class Dye extends MaterialData implements Colorable { public Dye() { - super(Material.INK_SACK); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Dye(final int type) { - super(type); + super(Material.LEGACY_INK_SACK); } public Dye(final Material type) { @@ -25,16 +16,6 @@ public class Dye extends MaterialData implements Colorable { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Dye(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value @@ -48,7 +29,7 @@ public class Dye extends MaterialData implements Colorable { * @param color color of the dye */ public Dye(final DyeColor color) { - super(Material.INK_SACK, color.getDyeData()); + super(Material.LEGACY_INK_SACK, color.getDyeData()); } /** diff --git a/src/main/java/org/bukkit/material/EnderChest.java b/src/main/java/org/bukkit/material/EnderChest.java index d3a60196..c03eb018 100644 --- a/src/main/java/org/bukkit/material/EnderChest.java +++ b/src/main/java/org/bukkit/material/EnderChest.java @@ -9,7 +9,7 @@ import org.bukkit.block.BlockFace; public class EnderChest extends DirectionalContainer { public EnderChest() { - super(Material.ENDER_CHEST); + super(Material.LEGACY_ENDER_CHEST); } /** @@ -22,30 +22,11 @@ public class EnderChest extends DirectionalContainer { setFacingDirection(direction); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public EnderChest(final int type) { - super(type); - } - public EnderChest(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public EnderChest(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/ExtendedRails.java b/src/main/java/org/bukkit/material/ExtendedRails.java index 34fb55e1..9d7906c1 100644 --- a/src/main/java/org/bukkit/material/ExtendedRails.java +++ b/src/main/java/org/bukkit/material/ExtendedRails.java @@ -8,30 +8,12 @@ import org.bukkit.block.BlockFace; * classes */ public class ExtendedRails extends Rails { - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public ExtendedRails(final int type) { - super(type); - } public ExtendedRails(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public ExtendedRails(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/FlowerPot.java b/src/main/java/org/bukkit/material/FlowerPot.java index a3951e7a..8aa6918e 100644 --- a/src/main/java/org/bukkit/material/FlowerPot.java +++ b/src/main/java/org/bukkit/material/FlowerPot.java @@ -17,16 +17,7 @@ public class FlowerPot extends MaterialData { * Default constructor for a flower pot. */ public FlowerPot() { - super(Material.FLOWER_POT); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public FlowerPot(final int type) { - super(type); + super(Material.LEGACY_FLOWER_POT); } public FlowerPot(final Material type) { @@ -34,16 +25,6 @@ public class FlowerPot extends MaterialData { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public FlowerPot(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value @@ -62,9 +43,9 @@ public class FlowerPot extends MaterialData { public MaterialData getContents() { switch (getData()) { case 1: - return new MaterialData(Material.RED_ROSE); + return new MaterialData(Material.LEGACY_RED_ROSE); case 2: - return new MaterialData(Material.YELLOW_FLOWER); + return new MaterialData(Material.LEGACY_YELLOW_FLOWER); case 3: return new Tree(TreeSpecies.GENERIC); case 4: @@ -74,13 +55,13 @@ public class FlowerPot extends MaterialData { case 6: return new Tree(TreeSpecies.JUNGLE); case 7: - return new MaterialData(Material.RED_MUSHROOM); + return new MaterialData(Material.LEGACY_RED_MUSHROOM); case 8: - return new MaterialData(Material.BROWN_MUSHROOM); + return new MaterialData(Material.LEGACY_BROWN_MUSHROOM); case 9: - return new MaterialData(Material.CACTUS); + return new MaterialData(Material.LEGACY_CACTUS); case 10: - return new MaterialData(Material.DEAD_BUSH); + return new MaterialData(Material.LEGACY_DEAD_BUSH); case 11: return new LongGrass(GrassSpecies.FERN_LIKE); default: @@ -96,19 +77,19 @@ public class FlowerPot extends MaterialData { public void setContents(MaterialData materialData) { Material mat = materialData.getItemType(); - if (mat == Material.RED_ROSE) { + if (mat == Material.LEGACY_RED_ROSE) { setData((byte) 1); - } else if (mat == Material.YELLOW_FLOWER) { + } else if (mat == Material.LEGACY_YELLOW_FLOWER) { setData((byte) 2); - } else if (mat == Material.RED_MUSHROOM) { + } else if (mat == Material.LEGACY_RED_MUSHROOM) { setData((byte) 7); - } else if (mat == Material.BROWN_MUSHROOM) { + } else if (mat == Material.LEGACY_BROWN_MUSHROOM) { setData((byte) 8); - } else if (mat == Material.CACTUS) { + } else if (mat == Material.LEGACY_CACTUS) { setData((byte) 9); - } else if (mat == Material.DEAD_BUSH) { + } else if (mat == Material.LEGACY_DEAD_BUSH) { setData((byte) 10); - } else if (mat == Material.SAPLING) { + } else if (mat == Material.LEGACY_SAPLING) { TreeSpecies species = ((Tree) materialData).getSpecies(); if (species == TreeSpecies.GENERIC) { @@ -120,7 +101,7 @@ public class FlowerPot extends MaterialData { } else { setData((byte) 6); } - } else if (mat == Material.LONG_GRASS) { + } else if (mat == Material.LEGACY_LONG_GRASS) { GrassSpecies species = ((LongGrass) materialData).getSpecies(); if (species == GrassSpecies.FERN_LIKE) { diff --git a/src/main/java/org/bukkit/material/Furnace.java b/src/main/java/org/bukkit/material/Furnace.java index c607226f..1a9190fe 100644 --- a/src/main/java/org/bukkit/material/Furnace.java +++ b/src/main/java/org/bukkit/material/Furnace.java @@ -9,7 +9,7 @@ import org.bukkit.block.BlockFace; public class Furnace extends FurnaceAndDispenser { public Furnace() { - super(Material.FURNACE); + super(Material.LEGACY_FURNACE); } /** @@ -22,30 +22,11 @@ public class Furnace extends FurnaceAndDispenser { setFacingDirection(direction); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Furnace(final int type) { - super(type); - } - public Furnace(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Furnace(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/FurnaceAndDispenser.java b/src/main/java/org/bukkit/material/FurnaceAndDispenser.java index 184fda21..fbe40830 100644 --- a/src/main/java/org/bukkit/material/FurnaceAndDispenser.java +++ b/src/main/java/org/bukkit/material/FurnaceAndDispenser.java @@ -7,30 +7,11 @@ import org.bukkit.Material; */ public class FurnaceAndDispenser extends DirectionalContainer { - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public FurnaceAndDispenser(final int type) { - super(type); - } - public FurnaceAndDispenser(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public FurnaceAndDispenser(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Gate.java b/src/main/java/org/bukkit/material/Gate.java index 19a66ee9..ff042061 100644 --- a/src/main/java/org/bukkit/material/Gate.java +++ b/src/main/java/org/bukkit/material/Gate.java @@ -15,15 +15,21 @@ public class Gate extends MaterialData implements Directional, Openable { private static final byte GATE_EAST = 0x3; public Gate() { - super(Material.FENCE_GATE); + super(Material.LEGACY_FENCE_GATE); } - public Gate(int type, byte data) { + /** + * @param type the type + * @param data the raw data value + * @deprecated Magic value + */ + @Deprecated + public Gate(final Material type, final byte data) { super(type, data); } public Gate(byte data) { - super(Material.FENCE_GATE, data); + super(Material.LEGACY_FENCE_GATE, data); } public void setFacingDirection(BlockFace face) { diff --git a/src/main/java/org/bukkit/material/Hopper.java b/src/main/java/org/bukkit/material/Hopper.java index d1516f25..832d148a 100644 --- a/src/main/java/org/bukkit/material/Hopper.java +++ b/src/main/java/org/bukkit/material/Hopper.java @@ -44,35 +44,16 @@ public class Hopper extends MaterialData implements Directional, Redstone { * @see BlockFace */ public Hopper(BlockFace facingDirection, boolean isActive) { - super(Material.HOPPER); + super(Material.LEGACY_HOPPER); setFacingDirection(facingDirection); setActive(isActive); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Hopper(int type) { - super(type); - } - public Hopper(Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Hopper(int type, byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Ladder.java b/src/main/java/org/bukkit/material/Ladder.java index cd4d6911..b4f9db90 100644 --- a/src/main/java/org/bukkit/material/Ladder.java +++ b/src/main/java/org/bukkit/material/Ladder.java @@ -8,16 +8,7 @@ import org.bukkit.Material; */ public class Ladder extends SimpleAttachableMaterialData { public Ladder() { - super(Material.LADDER); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Ladder(final int type) { - super(type); + super(Material.LEGACY_LADDER); } public Ladder(final Material type) { @@ -25,16 +16,6 @@ public class Ladder extends SimpleAttachableMaterialData { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Ladder(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Leaves.java b/src/main/java/org/bukkit/material/Leaves.java index 904659b1..f118fbab 100644 --- a/src/main/java/org/bukkit/material/Leaves.java +++ b/src/main/java/org/bukkit/material/Leaves.java @@ -7,11 +7,11 @@ import org.bukkit.TreeSpecies; * Represents the different types of leaf block that may be permanent or can * decay when too far from a log. * - * @see Material#LEAVES - * @see Material#LEAVES_2 + * @see Material#LEGACY_LEAVES + * @see Material#LEGACY_LEAVES_2 */ public class Leaves extends Wood { - protected static final Material DEFAULT_TYPE = Material.LEAVES; + protected static final Material DEFAULT_TYPE = Material.LEGACY_LEAVES; protected static final boolean DEFAULT_DECAYABLE = true; /** @@ -42,15 +42,6 @@ public class Leaves extends Wood { } /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Leaves(final int type) { - super(type); - } - - /** * Constructs a leaf block of the given type. * * @param type the type of leaf block @@ -83,16 +74,6 @@ public class Leaves extends Wood { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Leaves(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Lever.java b/src/main/java/org/bukkit/material/Lever.java index c6d3882c..5bc83533 100644 --- a/src/main/java/org/bukkit/material/Lever.java +++ b/src/main/java/org/bukkit/material/Lever.java @@ -8,16 +8,7 @@ import org.bukkit.Material; */ public class Lever extends SimpleAttachableMaterialData implements Redstone { public Lever() { - super(Material.LEVER); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Lever(final int type) { - super(type); + super(Material.LEGACY_LEVER); } public Lever(final Material type) { @@ -25,16 +16,6 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Lever(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/LongGrass.java b/src/main/java/org/bukkit/material/LongGrass.java index 5cd8d200..7592ca7f 100644 --- a/src/main/java/org/bukkit/material/LongGrass.java +++ b/src/main/java/org/bukkit/material/LongGrass.java @@ -8,7 +8,7 @@ import org.bukkit.Material; */ public class LongGrass extends MaterialData { public LongGrass() { - super(Material.LONG_GRASS); + super(Material.LEGACY_LONG_GRASS); } public LongGrass(GrassSpecies species) { @@ -16,30 +16,11 @@ public class LongGrass extends MaterialData { setSpecies(species); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public LongGrass(final int type) { - super(type); - } - public LongGrass(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public LongGrass(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/MaterialData.java b/src/main/java/org/bukkit/material/MaterialData.java index 29826bc3..9f6a0ca6 100644 --- a/src/main/java/org/bukkit/material/MaterialData.java +++ b/src/main/java/org/bukkit/material/MaterialData.java @@ -2,46 +2,32 @@ package org.bukkit.material; import org.bukkit.inventory.ItemStack; import org.bukkit.Material; +import org.bukkit.block.data.BlockData; /** * Handles specific metadata for certain items or blocks + * + * @deprecated all usage of MaterialData is deprecated and subject to removal. + * Use {@link BlockData}. */ +@Deprecated public class MaterialData implements Cloneable { - private final int type; + private final Material type; private byte data = 0; - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public MaterialData(final int type) { - this(type, (byte) 0); - } - public MaterialData(final Material type) { this(type, (byte) 0); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public MaterialData(final int type, final byte data) { - this.type = type; - this.data = data; - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value */ @Deprecated public MaterialData(final Material type, final byte data) { - this(type.getId(), data); + this.type = type; + this.data = data; } /** @@ -72,17 +58,6 @@ public class MaterialData implements Cloneable { * @return Material represented by this MaterialData */ public Material getItemType() { - return Material.getMaterial(type); - } - - /** - * Gets the Material Id that this MaterialData represents - * - * @return Material Id represented by this MaterialData - * @deprecated Magic value - */ - @Deprecated - public int getItemTypeId() { return type; } @@ -115,7 +90,7 @@ public class MaterialData implements Cloneable { @Override public int hashCode() { - return ((getItemTypeId() << 8) ^ getData()); + return ((getItemType().hashCode() << 8) ^ getData()); } @Override @@ -123,7 +98,7 @@ public class MaterialData implements Cloneable { if (obj != null && obj instanceof MaterialData) { MaterialData md = (MaterialData) obj; - return (md.getItemTypeId() == getItemTypeId() && md.getData() == getData()); + return (md.getItemType() == getItemType() && md.getData() == getData()); } else { return false; } diff --git a/src/main/java/org/bukkit/material/MonsterEggs.java b/src/main/java/org/bukkit/material/MonsterEggs.java index a6897b7e..3e483fdf 100644 --- a/src/main/java/org/bukkit/material/MonsterEggs.java +++ b/src/main/java/org/bukkit/material/MonsterEggs.java @@ -12,42 +12,23 @@ public class MonsterEggs extends TexturedMaterial { private static final List<Material> textures = new ArrayList<Material>(); static { - textures.add(Material.STONE); - textures.add(Material.COBBLESTONE); - textures.add(Material.SMOOTH_BRICK); + textures.add(Material.LEGACY_STONE); + textures.add(Material.LEGACY_COBBLESTONE); + textures.add(Material.LEGACY_SMOOTH_BRICK); } public MonsterEggs() { - super(Material.MONSTER_EGGS); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public MonsterEggs(final int type) { - super(type); + super(Material.LEGACY_MONSTER_EGGS); } public MonsterEggs(final Material type) { - super((textures.contains(type)) ? Material.MONSTER_EGGS : type); + super((textures.contains(type)) ? Material.LEGACY_MONSTER_EGGS : type); if (textures.contains(type)) { setMaterial(type); } } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public MonsterEggs(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Mushroom.java b/src/main/java/org/bukkit/material/Mushroom.java index 16453073..cbc7d9bf 100644 --- a/src/main/java/org/bukkit/material/Mushroom.java +++ b/src/main/java/org/bukkit/material/Mushroom.java @@ -12,8 +12,8 @@ import org.bukkit.material.types.MushroomBlockTexture; * Represents a huge mushroom block with certain combinations of faces set to * cap, pores or stem. * - * @see Material#HUGE_MUSHROOM_1 - * @see Material#HUGE_MUSHROOM_2 + * @see Material#LEGACY_HUGE_MUSHROOM_1 + * @see Material#LEGACY_HUGE_MUSHROOM_2 */ public class Mushroom extends MaterialData { private static final byte NORTH_LIMIT = 4; @@ -29,12 +29,12 @@ public class Mushroom extends MaterialData { * * @param shroom A brown or red mushroom material type. * - * @see Material#HUGE_MUSHROOM_1 - * @see Material#HUGE_MUSHROOM_2 + * @see Material#LEGACY_HUGE_MUSHROOM_1 + * @see Material#LEGACY_HUGE_MUSHROOM_2 */ public Mushroom(Material shroom) { super(shroom); - Validate.isTrue(shroom == Material.HUGE_MUSHROOM_1 || shroom == Material.HUGE_MUSHROOM_2, "Not a mushroom!"); + Validate.isTrue(shroom == Material.LEGACY_HUGE_MUSHROOM_1 || shroom == Material.LEGACY_HUGE_MUSHROOM_2, "Not a mushroom!"); } /** @@ -50,8 +50,8 @@ public class Mushroom extends MaterialData { * @param shroom A brown or red mushroom material type. * @param capFace The face or faces to set to mushroom cap texture. * - * @see Material#HUGE_MUSHROOM_1 - * @see Material#HUGE_MUSHROOM_2 + * @see Material#LEGACY_HUGE_MUSHROOM_1 + * @see Material#LEGACY_HUGE_MUSHROOM_2 * @see BlockFace */ public Mushroom(Material shroom, BlockFace capFace) { @@ -64,8 +64,8 @@ public class Mushroom extends MaterialData { * @param shroom A brown or red mushroom material type. * @param texture The textured mushroom faces. * - * @see Material#HUGE_MUSHROOM_1 - * @see Material#HUGE_MUSHROOM_2 + * @see Material#LEGACY_HUGE_MUSHROOM_1 + * @see Material#LEGACY_HUGE_MUSHROOM_2 */ public Mushroom(Material shroom, MushroomBlockTexture texture) { this(shroom, texture.getData()); @@ -79,18 +79,7 @@ public class Mushroom extends MaterialData { @Deprecated public Mushroom(Material shroom, byte data) { super(shroom, data); - Validate.isTrue(shroom == Material.HUGE_MUSHROOM_1 || shroom == Material.HUGE_MUSHROOM_2, "Not a mushroom!"); - } - - /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Mushroom(int type, byte data) { - super(type, data); - Validate.isTrue(type == Material.HUGE_MUSHROOM_1.getId() || type == Material.HUGE_MUSHROOM_2.getId(), "Not a mushroom!"); + Validate.isTrue(shroom == Material.LEGACY_HUGE_MUSHROOM_1 || shroom == Material.LEGACY_HUGE_MUSHROOM_2, "Not a mushroom!"); } /** @@ -284,7 +273,7 @@ public class Mushroom extends MaterialData { @Override public String toString() { - return Material.getMaterial(getItemTypeId()).toString() + (isStem() ? " STEM " : " CAP ") + getPaintedFaces(); + return getItemType() + (isStem() ? " STEM " : " CAP ") + getPaintedFaces(); } @Override diff --git a/src/main/java/org/bukkit/material/NetherWarts.java b/src/main/java/org/bukkit/material/NetherWarts.java index 663b1a10..09d5a9f8 100644 --- a/src/main/java/org/bukkit/material/NetherWarts.java +++ b/src/main/java/org/bukkit/material/NetherWarts.java @@ -8,7 +8,7 @@ import org.bukkit.NetherWartsState; */ public class NetherWarts extends MaterialData { public NetherWarts() { - super(Material.NETHER_WARTS); + super(Material.LEGACY_NETHER_WARTS); } public NetherWarts(NetherWartsState state) { @@ -16,30 +16,11 @@ public class NetherWarts extends MaterialData { setState(state); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public NetherWarts(final int type) { - super(type); - } - public NetherWarts(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public NetherWarts(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Observer.java b/src/main/java/org/bukkit/material/Observer.java index fc3a7b17..afedb930 100644 --- a/src/main/java/org/bukkit/material/Observer.java +++ b/src/main/java/org/bukkit/material/Observer.java @@ -9,7 +9,7 @@ import org.bukkit.block.BlockFace; public class Observer extends MaterialData implements Directional, Redstone { public Observer() { - super(Material.OBSERVER); + super(Material.LEGACY_OBSERVER); } public Observer(BlockFace direction) { @@ -17,30 +17,11 @@ public class Observer extends MaterialData implements Directional, Redstone { setFacingDirection(direction); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Observer(final int type) { - super(type); - } - public Observer(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Observer(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/PistonBaseMaterial.java b/src/main/java/org/bukkit/material/PistonBaseMaterial.java index bbf1565d..805f9e57 100644 --- a/src/main/java/org/bukkit/material/PistonBaseMaterial.java +++ b/src/main/java/org/bukkit/material/PistonBaseMaterial.java @@ -8,17 +8,6 @@ import org.bukkit.block.BlockFace; */ public class PistonBaseMaterial extends MaterialData implements Directional, Redstone { - /** - * Constructs a PistonBaseMaterial - * - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public PistonBaseMaterial(final int type) { - super(type); - } - public PistonBaseMaterial(final Material type) { super(type); } @@ -26,18 +15,6 @@ public class PistonBaseMaterial extends MaterialData implements Directional, Red /** * Constructs a PistonBaseMaterial. * - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public PistonBaseMaterial(final int type, final byte data) { - super(type, data); - } - - /** - * Constructs a PistonBaseMaterial. - * * @param type the material type to use * @param data the raw data value * @deprecated Magic value @@ -113,7 +90,7 @@ public class PistonBaseMaterial extends MaterialData implements Directional, Red * @return true if this piston is "sticky", or false */ public boolean isSticky() { - return this.getItemType() == Material.PISTON_STICKY_BASE; + return this.getItemType() == Material.LEGACY_PISTON_STICKY_BASE; } @Override diff --git a/src/main/java/org/bukkit/material/PistonExtensionMaterial.java b/src/main/java/org/bukkit/material/PistonExtensionMaterial.java index 8076ec97..f293b9ca 100644 --- a/src/main/java/org/bukkit/material/PistonExtensionMaterial.java +++ b/src/main/java/org/bukkit/material/PistonExtensionMaterial.java @@ -7,30 +7,12 @@ import org.bukkit.block.BlockFace; * Material data for the piston extension block */ public class PistonExtensionMaterial extends MaterialData implements Attachable { - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public PistonExtensionMaterial(final int type) { - super(type); - } public PistonExtensionMaterial(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public PistonExtensionMaterial(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/PoweredRail.java b/src/main/java/org/bukkit/material/PoweredRail.java index 4a9d6a97..bdccff94 100644 --- a/src/main/java/org/bukkit/material/PoweredRail.java +++ b/src/main/java/org/bukkit/material/PoweredRail.java @@ -7,16 +7,7 @@ import org.bukkit.Material; */ public class PoweredRail extends ExtendedRails implements Redstone { public PoweredRail() { - super(Material.POWERED_RAIL); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public PoweredRail(final int type) { - super(type); + super(Material.LEGACY_POWERED_RAIL); } public PoweredRail(final Material type) { @@ -24,16 +15,6 @@ public class PoweredRail extends ExtendedRails implements Redstone { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public PoweredRail(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/PressurePlate.java b/src/main/java/org/bukkit/material/PressurePlate.java index d7747b5c..95ce6648 100644 --- a/src/main/java/org/bukkit/material/PressurePlate.java +++ b/src/main/java/org/bukkit/material/PressurePlate.java @@ -7,16 +7,7 @@ import org.bukkit.Material; */ public class PressurePlate extends MaterialData implements PressureSensor { public PressurePlate() { - super(Material.WOOD_PLATE); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public PressurePlate(int type) { - super(type); + super(Material.LEGACY_WOOD_PLATE); } public PressurePlate(Material type) { @@ -24,16 +15,6 @@ public class PressurePlate extends MaterialData implements PressureSensor { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public PressurePlate(int type, byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Pumpkin.java b/src/main/java/org/bukkit/material/Pumpkin.java index afd200a1..1fad246b 100644 --- a/src/main/java/org/bukkit/material/Pumpkin.java +++ b/src/main/java/org/bukkit/material/Pumpkin.java @@ -9,7 +9,7 @@ import org.bukkit.block.BlockFace; public class Pumpkin extends MaterialData implements Directional { public Pumpkin() { - super(Material.PUMPKIN); + super(Material.LEGACY_PUMPKIN); } /** @@ -22,30 +22,11 @@ public class Pumpkin extends MaterialData implements Directional { setFacingDirection(direction); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Pumpkin(final int type) { - super(type); - } - public Pumpkin(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Pumpkin(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value @@ -56,7 +37,7 @@ public class Pumpkin extends MaterialData implements Directional { } public boolean isLit() { - return getItemType() == Material.JACK_O_LANTERN; + return getItemType() == Material.LEGACY_JACK_O_LANTERN; } public void setFacingDirection(BlockFace face) { diff --git a/src/main/java/org/bukkit/material/Rails.java b/src/main/java/org/bukkit/material/Rails.java index 10044ee8..2c2420ef 100644 --- a/src/main/java/org/bukkit/material/Rails.java +++ b/src/main/java/org/bukkit/material/Rails.java @@ -9,16 +9,7 @@ import org.bukkit.block.BlockFace; public class Rails extends MaterialData { public Rails() { - super(Material.RAILS); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Rails(final int type) { - super(type); + super(Material.LEGACY_RAILS); } public Rails(final Material type) { @@ -26,16 +17,6 @@ public class Rails extends MaterialData { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Rails(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/RedstoneTorch.java b/src/main/java/org/bukkit/material/RedstoneTorch.java index 45c3e47f..b42ec940 100644 --- a/src/main/java/org/bukkit/material/RedstoneTorch.java +++ b/src/main/java/org/bukkit/material/RedstoneTorch.java @@ -7,16 +7,7 @@ import org.bukkit.Material; */ public class RedstoneTorch extends Torch implements Redstone { public RedstoneTorch() { - super(Material.REDSTONE_TORCH_ON); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public RedstoneTorch(final int type) { - super(type); + super(Material.LEGACY_REDSTONE_TORCH_ON); } public RedstoneTorch(final Material type) { @@ -24,16 +15,6 @@ public class RedstoneTorch extends Torch implements Redstone { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public RedstoneTorch(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value @@ -50,7 +31,7 @@ public class RedstoneTorch extends Torch implements Redstone { * @return true if powered, otherwise false */ public boolean isPowered() { - return getItemType() == Material.REDSTONE_TORCH_ON; + return getItemType() == Material.LEGACY_REDSTONE_TORCH_ON; } @Override diff --git a/src/main/java/org/bukkit/material/RedstoneWire.java b/src/main/java/org/bukkit/material/RedstoneWire.java index d13ae4bf..709c395a 100644 --- a/src/main/java/org/bukkit/material/RedstoneWire.java +++ b/src/main/java/org/bukkit/material/RedstoneWire.java @@ -7,16 +7,7 @@ import org.bukkit.Material; */ public class RedstoneWire extends MaterialData implements Redstone { public RedstoneWire() { - super(Material.REDSTONE_WIRE); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public RedstoneWire(final int type) { - super(type); + super(Material.LEGACY_REDSTONE_WIRE); } public RedstoneWire(final Material type) { @@ -24,16 +15,6 @@ public class RedstoneWire extends MaterialData implements Redstone { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public RedstoneWire(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Sandstone.java b/src/main/java/org/bukkit/material/Sandstone.java index be88d43b..c2f882c2 100644 --- a/src/main/java/org/bukkit/material/Sandstone.java +++ b/src/main/java/org/bukkit/material/Sandstone.java @@ -8,7 +8,7 @@ import org.bukkit.SandstoneType; */ public class Sandstone extends MaterialData { public Sandstone() { - super(Material.SANDSTONE); + super(Material.LEGACY_SANDSTONE); } public Sandstone(SandstoneType type) { @@ -16,30 +16,11 @@ public class Sandstone extends MaterialData { setType(type); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Sandstone(final int type) { - super(type); - } - public Sandstone(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Sandstone(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Sapling.java b/src/main/java/org/bukkit/material/Sapling.java index 08ef2de7..db2bae9f 100644 --- a/src/main/java/org/bukkit/material/Sapling.java +++ b/src/main/java/org/bukkit/material/Sapling.java @@ -6,7 +6,7 @@ import org.bukkit.TreeSpecies; /** * Represents the different types of Tree block that face a direction. * - * @see Material#SAPLING + * @see Material#LEGACY_SAPLING */ public class Sapling extends Wood { @@ -34,7 +34,7 @@ public class Sapling extends Wood { * @param isInstantGrowable true if the Sapling should grow when next ticked with bonemeal */ public Sapling(TreeSpecies species, boolean isInstantGrowable) { - this(Material.SAPLING, species, isInstantGrowable); + this(Material.LEGACY_SAPLING, species, isInstantGrowable); } /** @@ -71,16 +71,6 @@ public class Sapling extends Wood { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Sapling(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Sign.java b/src/main/java/org/bukkit/material/Sign.java index 0accdbce..d33b8ed2 100644 --- a/src/main/java/org/bukkit/material/Sign.java +++ b/src/main/java/org/bukkit/material/Sign.java @@ -8,16 +8,7 @@ import org.bukkit.Material; */ public class Sign extends MaterialData implements Attachable { public Sign() { - super(Material.SIGN_POST); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Sign(final int type) { - super(type); + super(Material.LEGACY_SIGN_POST); } public Sign(final Material type) { @@ -30,16 +21,6 @@ public class Sign extends MaterialData implements Attachable { * @deprecated Magic value */ @Deprecated - public Sign(final int type, final byte data) { - super(type, data); - } - - /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated public Sign(final Material type, final byte data) { super(type, data); } @@ -51,7 +32,7 @@ public class Sign extends MaterialData implements Attachable { * a block */ public boolean isWallSign() { - return getItemType() == Material.WALL_SIGN; + return getItemType() == Material.LEGACY_WALL_SIGN; } /** diff --git a/src/main/java/org/bukkit/material/SimpleAttachableMaterialData.java b/src/main/java/org/bukkit/material/SimpleAttachableMaterialData.java index b1897b7b..fb92f658 100644 --- a/src/main/java/org/bukkit/material/SimpleAttachableMaterialData.java +++ b/src/main/java/org/bukkit/material/SimpleAttachableMaterialData.java @@ -8,20 +8,6 @@ import org.bukkit.block.BlockFace; */ public abstract class SimpleAttachableMaterialData extends MaterialData implements Attachable { - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public SimpleAttachableMaterialData(int type) { - super(type); - } - - public SimpleAttachableMaterialData(int type, BlockFace direction) { - this(type); - setFacingDirection(direction); - } - public SimpleAttachableMaterialData(Material type, BlockFace direction) { this(type); setFacingDirection(direction); @@ -32,16 +18,6 @@ public abstract class SimpleAttachableMaterialData extends MaterialData implemen } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public SimpleAttachableMaterialData(int type, byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Skull.java b/src/main/java/org/bukkit/material/Skull.java index 498deb65..a0abe748 100644 --- a/src/main/java/org/bukkit/material/Skull.java +++ b/src/main/java/org/bukkit/material/Skull.java @@ -8,7 +8,7 @@ import org.bukkit.block.BlockFace; */ public class Skull extends MaterialData implements Directional { public Skull() { - super(Material.SKULL); + super(Material.LEGACY_SKULL); } /** @@ -21,30 +21,11 @@ public class Skull extends MaterialData implements Directional { setFacingDirection(direction); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Skull(final int type) { - super(type); - } - public Skull(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Skull(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/SmoothBrick.java b/src/main/java/org/bukkit/material/SmoothBrick.java index a6d8931e..3e4a8525 100644 --- a/src/main/java/org/bukkit/material/SmoothBrick.java +++ b/src/main/java/org/bukkit/material/SmoothBrick.java @@ -12,43 +12,24 @@ public class SmoothBrick extends TexturedMaterial { private static final List<Material> textures = new ArrayList<Material>(); static { - textures.add(Material.STONE); - textures.add(Material.MOSSY_COBBLESTONE); - textures.add(Material.COBBLESTONE); - textures.add(Material.SMOOTH_BRICK); + textures.add(Material.LEGACY_STONE); + textures.add(Material.LEGACY_MOSSY_COBBLESTONE); + textures.add(Material.LEGACY_COBBLESTONE); + textures.add(Material.LEGACY_SMOOTH_BRICK); } public SmoothBrick() { - super(Material.SMOOTH_BRICK); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public SmoothBrick(final int type) { - super(type); + super(Material.LEGACY_SMOOTH_BRICK); } public SmoothBrick(final Material type) { - super((textures.contains(type)) ? Material.SMOOTH_BRICK : type); + super((textures.contains(type)) ? Material.LEGACY_SMOOTH_BRICK : type); if (textures.contains(type)) { setMaterial(type); } } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public SmoothBrick(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/SpawnEgg.java b/src/main/java/org/bukkit/material/SpawnEgg.java index a8613a0c..a177021d 100644 --- a/src/main/java/org/bukkit/material/SpawnEgg.java +++ b/src/main/java/org/bukkit/material/SpawnEgg.java @@ -12,16 +12,16 @@ import org.bukkit.inventory.meta.SpawnEggMeta; public class SpawnEgg extends MaterialData { public SpawnEgg() { - super(Material.MONSTER_EGG); + super(Material.LEGACY_MONSTER_EGG); } /** - * @param type the raw type id + * @param type the type * @param data the raw data value * @deprecated Magic value */ @Deprecated - public SpawnEgg(int type, byte data) { + public SpawnEgg(final Material type, final byte data) { super(type, data); } @@ -31,7 +31,7 @@ public class SpawnEgg extends MaterialData { */ @Deprecated public SpawnEgg(byte data) { - super(Material.MONSTER_EGG, data); + super(Material.LEGACY_MONSTER_EGG, data); } public SpawnEgg(EntityType type) { diff --git a/src/main/java/org/bukkit/material/Stairs.java b/src/main/java/org/bukkit/material/Stairs.java index 80c6fb1b..29ef66c4 100644 --- a/src/main/java/org/bukkit/material/Stairs.java +++ b/src/main/java/org/bukkit/material/Stairs.java @@ -8,30 +8,11 @@ import org.bukkit.block.BlockFace; */ public class Stairs extends MaterialData implements Directional { - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Stairs(final int type) { - super(type); - } - public Stairs(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Stairs(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Step.java b/src/main/java/org/bukkit/material/Step.java index 7f46af26..8c255ba0 100644 --- a/src/main/java/org/bukkit/material/Step.java +++ b/src/main/java/org/bukkit/material/Step.java @@ -11,47 +11,28 @@ import org.bukkit.Material; public class Step extends TexturedMaterial { private static final List<Material> textures = new ArrayList<Material>(); static { - textures.add(Material.STONE); - textures.add(Material.SANDSTONE); - textures.add(Material.WOOD); - textures.add(Material.COBBLESTONE); - textures.add(Material.BRICK); - textures.add(Material.SMOOTH_BRICK); - textures.add(Material.NETHER_BRICK); - textures.add(Material.QUARTZ_BLOCK); + textures.add(Material.LEGACY_STONE); + textures.add(Material.LEGACY_SANDSTONE); + textures.add(Material.LEGACY_WOOD); + textures.add(Material.LEGACY_COBBLESTONE); + textures.add(Material.LEGACY_BRICK); + textures.add(Material.LEGACY_SMOOTH_BRICK); + textures.add(Material.LEGACY_NETHER_BRICK); + textures.add(Material.LEGACY_QUARTZ_BLOCK); } public Step() { - super(Material.STEP); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Step(final int type) { - super(type); + super(Material.LEGACY_STEP); } public Step(final Material type) { - super((textures.contains(type)) ? Material.STEP : type); + super((textures.contains(type)) ? Material.LEGACY_STEP : type); if (textures.contains(type)) { setMaterial(type); } } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Step(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/TexturedMaterial.java b/src/main/java/org/bukkit/material/TexturedMaterial.java index 93f56643..ea3433ac 100644 --- a/src/main/java/org/bukkit/material/TexturedMaterial.java +++ b/src/main/java/org/bukkit/material/TexturedMaterial.java @@ -14,25 +14,6 @@ public abstract class TexturedMaterial extends MaterialData { } /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public TexturedMaterial(int type) { - super(type); - } - - /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public TexturedMaterial(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Torch.java b/src/main/java/org/bukkit/material/Torch.java index 60be6bd1..0c34004d 100644 --- a/src/main/java/org/bukkit/material/Torch.java +++ b/src/main/java/org/bukkit/material/Torch.java @@ -8,16 +8,7 @@ import org.bukkit.Material; */ public class Torch extends SimpleAttachableMaterialData { public Torch() { - super(Material.TORCH); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Torch(final int type) { - super(type); + super(Material.LEGACY_TORCH); } public Torch(final Material type) { @@ -25,16 +16,6 @@ public class Torch extends SimpleAttachableMaterialData { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Torch(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/TrapDoor.java b/src/main/java/org/bukkit/material/TrapDoor.java index 2ae33621..2bbfe2b3 100644 --- a/src/main/java/org/bukkit/material/TrapDoor.java +++ b/src/main/java/org/bukkit/material/TrapDoor.java @@ -8,16 +8,7 @@ import org.bukkit.block.BlockFace; */ public class TrapDoor extends SimpleAttachableMaterialData implements Openable { public TrapDoor() { - super(Material.TRAP_DOOR); - } - - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public TrapDoor(final int type) { - super(type); + super(Material.LEGACY_TRAP_DOOR); } public TrapDoor(final Material type) { @@ -25,16 +16,6 @@ public class TrapDoor extends SimpleAttachableMaterialData implements Openable { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public TrapDoor(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Tree.java b/src/main/java/org/bukkit/material/Tree.java index e28499d0..2c4b0c40 100644 --- a/src/main/java/org/bukkit/material/Tree.java +++ b/src/main/java/org/bukkit/material/Tree.java @@ -7,11 +7,11 @@ import org.bukkit.block.BlockFace; /** * Represents the different types of Tree block that face a direction. * - * @see Material#LOG - * @see Material#LOG_2 + * @see Material#LEGACY_LOG + * @see Material#LEGACY_LOG_2 */ public class Tree extends Wood { - protected static final Material DEFAULT_TYPE = Material.LOG; + protected static final Material DEFAULT_TYPE = Material.LEGACY_LOG; protected static final BlockFace DEFAULT_DIRECTION = BlockFace.UP; /** @@ -42,15 +42,6 @@ public class Tree extends Wood { } /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Tree(final int type) { - super(type); - } - - /** * Constructs a tree block of the given type. * * @param type the type of tree block @@ -83,16 +74,6 @@ public class Tree extends Wood { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Tree(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Tripwire.java b/src/main/java/org/bukkit/material/Tripwire.java index c95ed999..89b85a61 100644 --- a/src/main/java/org/bukkit/material/Tripwire.java +++ b/src/main/java/org/bukkit/material/Tripwire.java @@ -8,25 +8,16 @@ import org.bukkit.Material; public class Tripwire extends MaterialData { public Tripwire() { - super(Material.TRIPWIRE); + super(Material.LEGACY_TRIPWIRE); } /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Tripwire(final int type) { - super(type); - } - - /** - * @param type the raw type id + * @param type the type * @param data the raw data value * @deprecated Magic value */ @Deprecated - public Tripwire(final int type, final byte data) { + public Tripwire(final Material type, final byte data) { super(type, data); } diff --git a/src/main/java/org/bukkit/material/TripwireHook.java b/src/main/java/org/bukkit/material/TripwireHook.java index 72a1fb4f..97f97eab 100644 --- a/src/main/java/org/bukkit/material/TripwireHook.java +++ b/src/main/java/org/bukkit/material/TripwireHook.java @@ -9,25 +9,16 @@ import org.bukkit.block.BlockFace; public class TripwireHook extends SimpleAttachableMaterialData implements Redstone { public TripwireHook() { - super(Material.TRIPWIRE_HOOK); + super(Material.LEGACY_TRIPWIRE_HOOK); } /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public TripwireHook(final int type) { - super(type); - } - - /** - * @param type the raw type id + * @param type the type * @param data the raw data value * @deprecated Magic value */ @Deprecated - public TripwireHook(final int type, final byte data) { + public TripwireHook(final Material type, final byte data) { super(type, data); } diff --git a/src/main/java/org/bukkit/material/Vine.java b/src/main/java/org/bukkit/material/Vine.java index da84d419..abfc211c 100644 --- a/src/main/java/org/bukkit/material/Vine.java +++ b/src/main/java/org/bukkit/material/Vine.java @@ -17,16 +17,16 @@ public class Vine extends MaterialData { private static final EnumSet<BlockFace> possibleFaces = EnumSet.of(BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST); public Vine() { - super(Material.VINE); + super(Material.LEGACY_VINE); } /** - * @param type the raw type id + * @param type the type * @param data the raw data value * @deprecated Magic value */ @Deprecated - public Vine(int type, byte data) { + public Vine(final Material type, final byte data) { super(type, data); } @@ -36,7 +36,7 @@ public class Vine extends MaterialData { */ @Deprecated public Vine(byte data) { - super(Material.VINE, data); + super(Material.LEGACY_VINE, data); } public Vine(BlockFace... faces) { diff --git a/src/main/java/org/bukkit/material/Wood.java b/src/main/java/org/bukkit/material/Wood.java index 794cfd4d..c77664ee 100644 --- a/src/main/java/org/bukkit/material/Wood.java +++ b/src/main/java/org/bukkit/material/Wood.java @@ -6,12 +6,12 @@ import org.bukkit.TreeSpecies; /** * Represents wood blocks of different species. * - * @see Material#WOOD - * @see Material#SAPLING - * @see Material#WOOD_DOUBLE_STEP + * @see Material#LEGACY_WOOD + * @see Material#LEGACY_SAPLING + * @see Material#LEGACY_WOOD_DOUBLE_STEP */ public class Wood extends MaterialData { - protected static final Material DEFAULT_TYPE = Material.WOOD; + protected static final Material DEFAULT_TYPE = Material.LEGACY_WOOD; protected static final TreeSpecies DEFAULT_SPECIES = TreeSpecies.GENERIC; /** @@ -31,15 +31,6 @@ public class Wood extends MaterialData { } /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Wood(final int type) { - super(type); - } - - /** * Constructs a wood block of the given type. * * @param type the type of wood block @@ -61,16 +52,6 @@ public class Wood extends MaterialData { } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Wood(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value @@ -87,17 +68,17 @@ public class Wood extends MaterialData { */ public TreeSpecies getSpecies() { switch (getItemType()) { - case WOOD: - case WOOD_DOUBLE_STEP: + case LEGACY_WOOD: + case LEGACY_WOOD_DOUBLE_STEP: return TreeSpecies.getByData((byte) getData()); - case LOG: - case LEAVES: + case LEGACY_LOG: + case LEGACY_LEAVES: return TreeSpecies.getByData((byte) (getData() & 0x3)); - case LOG_2: - case LEAVES_2: + case LEGACY_LOG_2: + case LEGACY_LEAVES_2: return TreeSpecies.getByData((byte) ((getData() & 0x3) | 0x4)); - case SAPLING: - case WOOD_STEP: + case LEGACY_SAPLING: + case LEGACY_WOOD_STEP: return TreeSpecies.getByData((byte) (getData() & 0x7)); default: throw new IllegalArgumentException("Invalid block type for tree species"); @@ -118,20 +99,20 @@ public class Wood extends MaterialData { case BIRCH: case JUNGLE: switch (type) { - case LOG_2: - return Material.LOG; - case LEAVES_2: - return Material.LEAVES; + case LEGACY_LOG_2: + return Material.LEGACY_LOG; + case LEGACY_LEAVES_2: + return Material.LEGACY_LEAVES; default: } break; case ACACIA: case DARK_OAK: switch (type) { - case LOG: - return Material.LOG_2; - case LEAVES: - return Material.LEAVES_2; + case LEGACY_LOG: + return Material.LEGACY_LOG_2; + case LEGACY_LEAVES: + return Material.LEGACY_LEAVES_2; default: } break; @@ -147,16 +128,16 @@ public class Wood extends MaterialData { public void setSpecies(final TreeSpecies species) { boolean firstType = false; switch (getItemType()) { - case WOOD: - case WOOD_DOUBLE_STEP: + case LEGACY_WOOD: + case LEGACY_WOOD_DOUBLE_STEP: setData(species.getData()); break; - case LOG: - case LEAVES: + case LEGACY_LOG: + case LEGACY_LEAVES: firstType = true; // fall through to next switch statement below - case LOG_2: - case LEAVES_2: + case LEGACY_LOG_2: + case LEGACY_LEAVES_2: switch (species) { case GENERIC: case REDWOOD: @@ -175,8 +156,8 @@ public class Wood extends MaterialData { } setData((byte) ((getData() & 0xC) | (species.getData() & 0x3))); break; - case SAPLING: - case WOOD_STEP: + case LEGACY_SAPLING: + case LEGACY_WOOD_STEP: setData((byte) ((getData() & 0x8) | species.getData())); break; default: diff --git a/src/main/java/org/bukkit/material/WoodenStep.java b/src/main/java/org/bukkit/material/WoodenStep.java index 17b7050e..34886cfc 100644 --- a/src/main/java/org/bukkit/material/WoodenStep.java +++ b/src/main/java/org/bukkit/material/WoodenStep.java @@ -6,10 +6,10 @@ import org.bukkit.TreeSpecies; /** * Represents the different types of wooden steps. * - * @see Material#WOOD_STEP + * @see Material#LEGACY_WOOD_STEP */ public class WoodenStep extends Wood { - protected static final Material DEFAULT_TYPE = Material.WOOD_STEP; + protected static final Material DEFAULT_TYPE = Material.LEGACY_WOOD_STEP; protected static final boolean DEFAULT_INVERTED = false; /** @@ -41,25 +41,6 @@ public class WoodenStep extends Wood { } /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public WoodenStep(final int type) { - super(type); - } - - /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public WoodenStep(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/material/Wool.java b/src/main/java/org/bukkit/material/Wool.java index c4e4bfa0..87f35f58 100644 --- a/src/main/java/org/bukkit/material/Wool.java +++ b/src/main/java/org/bukkit/material/Wool.java @@ -8,7 +8,7 @@ import org.bukkit.Material; */ public class Wool extends MaterialData implements Colorable { public Wool() { - super(Material.WOOL); + super(Material.LEGACY_WOOL); } public Wool(DyeColor color) { @@ -16,30 +16,11 @@ public class Wool extends MaterialData implements Colorable { setColor(color); } - /** - * @param type the raw type id - * @deprecated Magic value - */ - @Deprecated - public Wool(final int type) { - super(type); - } - public Wool(final Material type) { super(type); } /** - * @param type the raw type id - * @param data the raw data value - * @deprecated Magic value - */ - @Deprecated - public Wool(final int type, final byte data) { - super(type, data); - } - - /** * @param type the type * @param data the raw data value * @deprecated Magic value diff --git a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java index 27a64828..adce0ed1 100644 --- a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java +++ b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java @@ -118,6 +118,10 @@ import com.google.common.collect.ImmutableSet; * <td><code>awareness</code></td> * <td>{@link #getAwareness()}</td> * <td>The concepts that the plugin acknowledges</td> + * </tr><tr> + * <td><code>api-version</code></td> + * <td>{@link #getAPIVersion()}</td> + * <td>The API version which this plugin was programmed against</td> * </tr> * </table> * <p> @@ -134,6 +138,7 @@ import com.google.common.collect.ImmutableSet; * *main: com.captaininflamo.bukkit.inferno.Inferno *depend: [NewFire, FlameWire] + *api-version: 1.13 * *commands: * flagrate: @@ -223,6 +228,7 @@ public final class PluginDescriptionFile { private Map<?, ?> lazyPermissions = null; private PermissionDefault defaultPerm = PermissionDefault.OP; private Set<PluginAwareness> awareness = ImmutableSet.of(); + private String apiVersion = null; public PluginDescriptionFile(final InputStream stream) throws InvalidDescriptionException { loadMap(asMap(YAML.get().load(stream))); @@ -847,6 +853,23 @@ public final class PluginDescriptionFile { } /** + * Gives the API version which this plugin is designed to support. No + * specific format is guaranteed. + * <ul> + * <li>Refer to release notes for supported API versions. + * </ul> + * <p> + * In the plugin.yml, this entry is named <code>api-version</code>. + * <p> + * Example:<blockquote><pre>api-version: 1.13</pre></blockquote> + * + * @return the version of the plugin + */ + public String getAPIVersion() { + return apiVersion; + } + + /** * @return unused * @deprecated unused */ @@ -995,6 +1018,14 @@ public final class PluginDescriptionFile { this.awareness = ImmutableSet.copyOf(awareness); } + if (map.get("api-version") != null) { + try { + apiVersion = map.get("api-version").toString(); + } catch (ClassCastException ex) { + throw new InvalidDescriptionException(ex, "api-version is of wrong type"); + } + } + try { lazyPermissions = (Map<?, ?>) map.get("permissions"); } catch (ClassCastException ex) { @@ -1056,6 +1087,10 @@ public final class PluginDescriptionFile { map.put("authors", authors); } + if (apiVersion != null) { + map.put("api-version", apiVersion); + } + if (classLoaderOf != null) { map.put("class-loader-of", classLoaderOf); } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index df613b0c..8d54297f 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -122,6 +122,8 @@ public final class JavaPluginLoader implements PluginLoader { } } + server.getUnsafe().checkSupported(description); + final PluginClassLoader loader; try { loader = new PluginClassLoader(this, getClass().getClassLoader(), description, dataFolder, file); diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java index 7e41e79a..5eb42df3 100644 --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java @@ -100,6 +100,8 @@ final class PluginClassLoader extends URLClassLoader { throw new ClassNotFoundException(name, ex); } + classBytes = loader.server.getUnsafe().processClass(description, classBytes); + int dot = name.lastIndexOf('.'); if (dot != -1) { String pkgName = name.substring(0, dot); diff --git a/src/main/java/org/bukkit/plugin/messaging/Messenger.java b/src/main/java/org/bukkit/plugin/messaging/Messenger.java index 655afaf4..c9ef7e84 100644 --- a/src/main/java/org/bukkit/plugin/messaging/Messenger.java +++ b/src/main/java/org/bukkit/plugin/messaging/Messenger.java @@ -1,12 +1,17 @@ package org.bukkit.plugin.messaging; import java.util.Set; +import org.bukkit.NamespacedKey; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; /** * A class responsible for managing the registrations of plugin channels and * their listeners. + * + * Channel names must contain a colon separator and consist of only [a-z0-9/._-] + * - i.e. they MUST be valid {@link NamespacedKey}. The "BungeeCord" channel is + * an exception and may only take this form. */ public interface Messenger { @@ -18,7 +23,7 @@ public interface Messenger { /** * Represents the largest size that a Plugin Channel may be. */ - public static final int MAX_CHANNEL_SIZE = 20; + public static final int MAX_CHANNEL_SIZE = 32; /** * Checks if the specified channel is a reserved name. diff --git a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java index c7ecc9d9..ddb9f769 100644 --- a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java +++ b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java @@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet.Builder; import java.util.HashMap; import java.util.HashSet; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.logging.Level; @@ -167,16 +168,16 @@ public class StandardMessenger implements Messenger { } public boolean isReservedChannel(String channel) { - validateChannel(channel); + channel = validateAndCorrectChannel(channel); - return channel.equals("REGISTER") || channel.equals("UNREGISTER"); + return channel.contains("minecraft"); } public void registerOutgoingPluginChannel(Plugin plugin, String channel) { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } - validateChannel(channel); + channel = validateAndCorrectChannel(channel); if (isReservedChannel(channel)) { throw new ReservedChannelException(channel); } @@ -188,7 +189,7 @@ public class StandardMessenger implements Messenger { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } - validateChannel(channel); + channel = validateAndCorrectChannel(channel); removeFromOutgoing(plugin, channel); } @@ -205,7 +206,7 @@ public class StandardMessenger implements Messenger { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } - validateChannel(channel); + channel = validateAndCorrectChannel(channel); if (isReservedChannel(channel)) { throw new ReservedChannelException(channel); } @@ -227,7 +228,7 @@ public class StandardMessenger implements Messenger { if (listener == null) { throw new IllegalArgumentException("Listener cannot be null"); } - validateChannel(channel); + channel = validateAndCorrectChannel(channel); removeFromIncoming(new PluginMessageListenerRegistration(this, plugin, channel, listener)); } @@ -236,7 +237,7 @@ public class StandardMessenger implements Messenger { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } - validateChannel(channel); + channel = validateAndCorrectChannel(channel); removeFromIncoming(plugin, channel); } @@ -318,7 +319,7 @@ public class StandardMessenger implements Messenger { } public Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(String channel) { - validateChannel(channel); + channel = validateAndCorrectChannel(channel); synchronized (incomingLock) { Set<PluginMessageListenerRegistration> registrations = incomingByChannel.get(channel); @@ -335,7 +336,7 @@ public class StandardMessenger implements Messenger { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } - validateChannel(channel); + channel = validateAndCorrectChannel(channel); synchronized (incomingLock) { Set<PluginMessageListenerRegistration> registrations = incomingByPlugin.get(plugin); @@ -376,7 +377,7 @@ public class StandardMessenger implements Messenger { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } - validateChannel(channel); + channel = validateAndCorrectChannel(channel); synchronized (incomingLock) { Set<PluginMessageListenerRegistration> registrations = incomingByPlugin.get(plugin); @@ -397,7 +398,7 @@ public class StandardMessenger implements Messenger { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } - validateChannel(channel); + channel = validateAndCorrectChannel(channel); synchronized (outgoingLock) { Set<String> channels = outgoingByPlugin.get(plugin); @@ -417,7 +418,7 @@ public class StandardMessenger implements Messenger { if (message == null) { throw new IllegalArgumentException("Message cannot be null"); } - validateChannel(channel); + channel = validateAndCorrectChannel(channel); Set<PluginMessageListenerRegistration> registrations = getIncomingChannelRegistrations(channel); @@ -437,14 +438,46 @@ public class StandardMessenger implements Messenger { * Validates a Plugin Channel name. * * @param channel Channel name to validate. + * @deprecated not an API method */ + @Deprecated public static void validateChannel(String channel) { + validateAndCorrectChannel(channel); + } + + /** + * Validates and corrects a Plugin Channel name. Method is not reentrant / idempotent. + * + * @param channel Channel name to validate. + * @return corrected channel name + * @deprecated not an API method + */ + @Deprecated + public static String validateAndCorrectChannel(String channel) { if (channel == null) { throw new IllegalArgumentException("Channel cannot be null"); } + // This will correct registrations / outgoing messages + // It is not legal to send "BungeeCord" incoming anymore so we are fine there, + // but we must make sure that none of the API methods repeatedly call validate + if (channel.equals("BungeeCord")) { + return "bungeecord:main"; + } + // And this will correct incoming messages. + if (channel.equals("bungeecord:main")) { + return "BungeeCord"; + } if (channel.length() > Messenger.MAX_CHANNEL_SIZE) { throw new ChannelNameTooLongException(channel); } + if (channel.indexOf(':') == -1) { + throw new IllegalArgumentException("Channel must contain : separator"); + } + if (!channel.toLowerCase(Locale.ROOT).equals(channel)) { + // TODO: use NamespacedKey validation here + throw new IllegalArgumentException("Channel must be entirely lowercase"); + } + return channel; } /** diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java index b7c068b5..261fa913 100644 --- a/src/main/java/org/bukkit/potion/PotionEffectType.java +++ b/src/main/java/org/bukkit/potion/PotionEffectType.java @@ -147,6 +147,21 @@ public abstract class PotionEffectType { */ public static final PotionEffectType UNLUCK = new PotionEffectTypeWrapper(27); + /** + * Slows entity fall rate. + */ + public static final PotionEffectType SLOW_FALLING = new PotionEffectTypeWrapper(28); + + /** + * Effects granted by a nearby conduit. Includes enhanced underwater abilities. + */ + public static final PotionEffectType CONDUIT_POWER = new PotionEffectTypeWrapper(29); + + /** + * Squee'ek uh'k kk'kkkk squeek eee'eek. + */ + public static final PotionEffectType DOLPHINS_GRACE = new PotionEffectTypeWrapper(29); + private final int id; protected PotionEffectType(int id) { @@ -230,7 +245,7 @@ public abstract class PotionEffectType { return "PotionEffectType[" + id + ", " + getName() + "]"; } - private static final PotionEffectType[] byId = new PotionEffectType[28]; + private static final PotionEffectType[] byId = new PotionEffectType[31]; private static final Map<String, PotionEffectType> byName = new HashMap<String, PotionEffectType>(); // will break on updates. private static boolean acceptingNew = true; diff --git a/src/main/java/org/bukkit/potion/PotionType.java b/src/main/java/org/bukkit/potion/PotionType.java index 60470b88..034421a7 100644 --- a/src/main/java/org/bukkit/potion/PotionType.java +++ b/src/main/java/org/bukkit/potion/PotionType.java @@ -15,7 +15,7 @@ public enum PotionType { JUMP(PotionEffectType.JUMP, true, true), FIRE_RESISTANCE(PotionEffectType.FIRE_RESISTANCE, false, true), SPEED(PotionEffectType.SPEED, true, true), - SLOWNESS(PotionEffectType.SLOW, false, true), + SLOWNESS(PotionEffectType.SLOW, true, true), WATER_BREATHING(PotionEffectType.WATER_BREATHING, false, true), INSTANT_HEAL(PotionEffectType.HEAL, true, false), INSTANT_DAMAGE(PotionEffectType.HARM, true, false), @@ -23,7 +23,9 @@ public enum PotionType { REGEN(PotionEffectType.REGENERATION, true, true), STRENGTH(PotionEffectType.INCREASE_DAMAGE, true, true), WEAKNESS(PotionEffectType.WEAKNESS, false, true), - LUCK(PotionEffectType.LUCK, false, false); + LUCK(PotionEffectType.LUCK, false, false), + TURTLE_MASTER(PotionEffectType.SLOW, true, true), // TODO: multiple effects + SLOW_FALLING(PotionEffectType.SLOW_FALLING, false, true), ; private final PotionEffectType effect; diff --git a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java index 6e28205f..3e696ec5 100644 --- a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java +++ b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java @@ -156,11 +156,6 @@ public interface BukkitScheduler { public void cancelTasks(Plugin plugin); /** - * Removes all tasks from the scheduler. - */ - public void cancelAllTasks(); - - /** * Check if the task currently running. * <p> * A repeating task might not be running currently, but will be running in diff --git a/src/main/java/org/bukkit/scoreboard/Scoreboard.java b/src/main/java/org/bukkit/scoreboard/Scoreboard.java index 70086109..4ed437a5 100644 --- a/src/main/java/org/bukkit/scoreboard/Scoreboard.java +++ b/src/main/java/org/bukkit/scoreboard/Scoreboard.java @@ -16,13 +16,36 @@ public interface Scoreboard { * @param criteria Criteria for the Objective * @return The registered Objective * @throws IllegalArgumentException if name is null + * @throws IllegalArgumentException if name is longer than 16 + * characters. * @throws IllegalArgumentException if criteria is null * @throws IllegalArgumentException if an objective by that name already * exists + * @deprecated a displayName should be explicitly specified */ + @Deprecated Objective registerNewObjective(String name, String criteria) throws IllegalArgumentException; /** + * Registers an Objective on this Scoreboard + * + * @param name Name of the Objective + * @param criteria Criteria for the Objective + * @param displayName Name displayed to players for the Objective. + * @return The registered Objective + * @throws IllegalArgumentException if name is null + * @throws IllegalArgumentException if name is longer than 16 + * characters. + * @throws IllegalArgumentException if criteria is null + * @throws IllegalArgumentException if displayName is null + * @throws IllegalArgumentException if displayName is longer than 32 + * characters. + * @throws IllegalArgumentException if an objective by that name already + * exists + */ + Objective registerNewObjective(String name, String criteria, String displayName) throws IllegalArgumentException; + + /** * Gets an Objective on this Scoreboard by name * * @param name Name of the Objective diff --git a/src/test/java/org/bukkit/BukkitMirrorTest.java b/src/test/java/org/bukkit/BukkitMirrorTest.java index 219788fb..9d7b9eb6 100644 --- a/src/test/java/org/bukkit/BukkitMirrorTest.java +++ b/src/test/java/org/bukkit/BukkitMirrorTest.java @@ -60,12 +60,12 @@ public class BukkitMirrorTest { @Test public void returnType() throws Throwable { assertThat(bukkit.getReturnType(), is((Object) server.getReturnType())); - assertThat(bukkit.getGenericReturnType(), is(server.getGenericReturnType())); + // assertThat(bukkit.getGenericReturnType(), is(server.getGenericReturnType())); // too strict on <T> type generics } @Test public void parameterTypes() throws Throwable { - assertThat(bukkit.getGenericParameterTypes(), is(server.getGenericParameterTypes())); + // assertThat(bukkit.getGenericParameterTypes(), is(server.getGenericParameterTypes())); // too strict on <T> type generics } @Test diff --git a/src/test/java/org/bukkit/DyeColorTest.java b/src/test/java/org/bukkit/DyeColorTest.java index 6dcfac6b..c5aaecf5 100644 --- a/src/test/java/org/bukkit/DyeColorTest.java +++ b/src/test/java/org/bukkit/DyeColorTest.java @@ -56,13 +56,13 @@ public class DyeColorTest { @Test public void getDyeDyeColor() { - testColorable(new Dye(Material.INK_SACK, dye.getDyeData())); + testColorable(new Dye(Material.LEGACY_INK_SACK, dye.getDyeData())); testColorable(new Dye(dye)); } @Test public void getWoolDyeColor() { - testColorable(new Wool(Material.WOOL, dye.getWoolData())); + testColorable(new Wool(Material.LEGACY_WOOL, dye.getWoolData())); } private void testColorable(final Colorable colorable) { diff --git a/src/test/java/org/bukkit/MaterialTest.java b/src/test/java/org/bukkit/MaterialTest.java index 61c68711..692bb920 100644 --- a/src/test/java/org/bukkit/MaterialTest.java +++ b/src/test/java/org/bukkit/MaterialTest.java @@ -15,31 +15,6 @@ public class MaterialTest { } @Test - public void getById() throws Throwable { - for (Material material : Material.values()) { - if (material.getClass().getField(material.name()).getAnnotation(Deprecated.class) != null) { - continue; - } - assertThat(Material.getMaterial(material.getId()), is(material)); - } - } - - @Test - public void isBlock() { - for (Material material : Material.values()) { - if (material.getId() > 255) continue; - - assertTrue(String.format("[%d] %s", material.getId(), material.toString()), material.isBlock()); - } - } - - @Test - public void getByOutOfRangeId() { - assertThat(Material.getMaterial(Integer.MAX_VALUE), is(nullValue())); - assertThat(Material.getMaterial(Integer.MIN_VALUE), is(nullValue())); - } - - @Test public void getByNameNull() { assertThat(Material.getMaterial(null), is(nullValue())); } @@ -47,6 +22,9 @@ public class MaterialTest { @Test public void getData() { for (Material material : Material.values()) { + if (!material.isLegacy()) { + continue; + } Class<? extends MaterialData> clazz = material.getData(); assertThat(material.getNewData((byte) 0), is(instanceOf(clazz))); @@ -59,16 +37,6 @@ public class MaterialTest { } @Test - public void matchMaterialById() throws Throwable { - for (Material material : Material.values()) { - if (material.getClass().getField(material.name()).getAnnotation(Deprecated.class) != null) { - continue; - } - assertThat(Material.matchMaterial(String.valueOf(material.getId())), is(material)); - } - } - - @Test public void matchMaterialByName() { for (Material material : Material.values()) { assertThat(Material.matchMaterial(material.toString()), is(material)); diff --git a/src/test/java/org/bukkit/configuration/ConfigurationSectionTest.java b/src/test/java/org/bukkit/configuration/ConfigurationSectionTest.java index cb818418..56a34f0b 100644 --- a/src/test/java/org/bukkit/configuration/ConfigurationSectionTest.java +++ b/src/test/java/org/bukkit/configuration/ConfigurationSectionTest.java @@ -498,7 +498,7 @@ public abstract class ConfigurationSectionTest { public void testGetItemStack_String() { ConfigurationSection section = getConfigurationSection(); String key = "exists"; - ItemStack value = new ItemStack(Material.WOOD, 50, (short) 2); + ItemStack value = new ItemStack(Material.ACACIA_WOOD, 50); section.set(key, value); @@ -510,7 +510,7 @@ public abstract class ConfigurationSectionTest { public void testGetItemStack_String_ItemStack() { ConfigurationSection section = getConfigurationSection(); String key = "exists"; - ItemStack value = new ItemStack(Material.WOOD, 50, (short) 2); + ItemStack value = new ItemStack(Material.ACACIA_WOOD, 50); ItemStack def = new ItemStack(Material.STONE, 1); section.set(key, value); @@ -523,7 +523,7 @@ public abstract class ConfigurationSectionTest { public void testIsItemStack() { ConfigurationSection section = getConfigurationSection(); String key = "exists"; - ItemStack value = new ItemStack(Material.WOOD, 50, (short) 2); + ItemStack value = new ItemStack(Material.ACACIA_WOOD, 50); section.set(key, value); diff --git a/src/test/java/org/bukkit/materials/MaterialDataTest.java b/src/test/java/org/bukkit/materials/MaterialDataTest.java index 0e7b6667..eb55c02e 100644 --- a/src/test/java/org/bukkit/materials/MaterialDataTest.java +++ b/src/test/java/org/bukkit/materials/MaterialDataTest.java @@ -30,15 +30,15 @@ public class MaterialDataTest { { @SuppressWarnings("deprecation") Door door = new Door(); - assertThat("Constructed with default door type",door.getItemType(),equalTo(Material.WOODEN_DOOR)); + assertThat("Constructed with default door type",door.getItemType(),equalTo(Material.LEGACY_WOODEN_DOOR)); assertThat("Constructed with default top or bottom",door.isTopHalf(),equalTo(false)); assertThat("Constructed with default direction",door.getFacing(),equalTo(BlockFace.WEST)); assertThat("Constructed with default open state",door.isOpen(),equalTo(false)); - Material[] types = new Material[] { Material.WOODEN_DOOR, - Material.IRON_DOOR_BLOCK, Material.SPRUCE_DOOR, - Material.BIRCH_DOOR, Material.JUNGLE_DOOR, - Material.ACACIA_DOOR, Material.DARK_OAK_DOOR }; + Material[] types = new Material[] { Material.LEGACY_WOODEN_DOOR, + Material.LEGACY_IRON_DOOR_BLOCK, Material.LEGACY_SPRUCE_DOOR, + Material.LEGACY_BIRCH_DOOR, Material.LEGACY_JUNGLE_DOOR, + Material.LEGACY_ACACIA_DOOR, Material.LEGACY_DARK_OAK_DOOR }; BlockFace[] directions = new BlockFace[] { BlockFace.WEST, BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH }; boolean[] openStates = new boolean[] {false, true}; boolean[] hingeStates = new boolean[] {false, true}; @@ -77,17 +77,17 @@ public class MaterialDataTest { @Test public void testWood() { Wood wood = new Wood(); - assertThat("Constructed with default wood type", wood.getItemType(), equalTo(Material.WOOD)); + assertThat("Constructed with default wood type", wood.getItemType(), equalTo(Material.LEGACY_WOOD)); assertThat("Constructed with default tree species", wood.getSpecies(), equalTo(TreeSpecies.GENERIC)); TreeSpecies[] allSpecies = TreeSpecies.values(); for (TreeSpecies species : allSpecies) { wood = new Wood(species); - assertThat("Constructed with default wood type", wood.getItemType(), equalTo(Material.WOOD)); + assertThat("Constructed with default wood type", wood.getItemType(), equalTo(Material.LEGACY_WOOD)); assertThat("Constructed with correct tree species", wood.getSpecies(), equalTo(species)); } - Material[] types = new Material[]{Material.WOOD, Material.WOOD_DOUBLE_STEP}; + Material[] types = new Material[]{Material.LEGACY_WOOD, Material.LEGACY_WOOD_DOUBLE_STEP}; for (Material type : types) { wood = new Wood(type); assertThat("Constructed with correct wood type", wood.getItemType(), equalTo(type)); @@ -104,16 +104,16 @@ public class MaterialDataTest { @Test public void testTree() { Tree tree = new Tree(); - assertThat("Constructed with default tree type", tree.getItemType(), equalTo(Material.LOG)); + assertThat("Constructed with default tree type", tree.getItemType(), equalTo(Material.LEGACY_LOG)); assertThat("Constructed with default tree species", tree.getSpecies(), equalTo(TreeSpecies.GENERIC)); assertThat("Constructed with default direction", tree.getDirection(), equalTo(BlockFace.UP)); - tree = new Tree(Material.LOG); - assertThat("Constructed with correct tree type", tree.getItemType(), equalTo(Material.LOG)); + tree = new Tree(Material.LEGACY_LOG); + assertThat("Constructed with correct tree type", tree.getItemType(), equalTo(Material.LEGACY_LOG)); assertThat("Constructed with default tree species", tree.getSpecies(), equalTo(TreeSpecies.GENERIC)); assertThat("Constructed with default direction", tree.getDirection(), equalTo(BlockFace.UP)); - Material[] types = new Material[]{Material.LOG, Material.LOG_2}; + Material[] types = new Material[]{Material.LEGACY_LOG, Material.LEGACY_LOG_2}; TreeSpecies[][] allSpecies = new TreeSpecies[][]{ {TreeSpecies.GENERIC, TreeSpecies.REDWOOD, TreeSpecies.BIRCH, TreeSpecies.JUNGLE}, {TreeSpecies.ACACIA, TreeSpecies.DARK_OAK} @@ -144,18 +144,18 @@ public class MaterialDataTest { @Test public void testLeaves() { Leaves leaves = new Leaves(); - assertThat("Constructed with default leaf type", leaves.getItemType(), equalTo(Material.LEAVES)); + assertThat("Constructed with default leaf type", leaves.getItemType(), equalTo(Material.LEGACY_LEAVES)); assertThat("Constructed with default tree species", leaves.getSpecies(), equalTo(TreeSpecies.GENERIC)); assertThat("Constructed with default decayable", leaves.isDecayable(), equalTo(true)); assertThat("Constructed with default decaying", leaves.isDecaying(), equalTo(false)); - leaves = new Leaves(Material.LEAVES); - assertThat("Constructed with correct leaf type", leaves.getItemType(), equalTo(Material.LEAVES)); + leaves = new Leaves(Material.LEGACY_LEAVES); + assertThat("Constructed with correct leaf type", leaves.getItemType(), equalTo(Material.LEGACY_LEAVES)); assertThat("Constructed with default tree species", leaves.getSpecies(), equalTo(TreeSpecies.GENERIC)); assertThat("Constructed with default decayable", leaves.isDecayable(), equalTo(true)); assertThat("Constructed with default decaying", leaves.isDecaying(), equalTo(false)); - Material[] types = new Material[]{Material.LEAVES, Material.LEAVES_2}; + Material[] types = new Material[]{Material.LEGACY_LEAVES, Material.LEGACY_LEAVES_2}; TreeSpecies[][] allSpecies = new TreeSpecies[][]{ {TreeSpecies.GENERIC, TreeSpecies.REDWOOD, TreeSpecies.BIRCH, TreeSpecies.JUNGLE}, {TreeSpecies.ACACIA, TreeSpecies.DARK_OAK} @@ -198,7 +198,7 @@ public class MaterialDataTest { @Test public void testWoodenStep() { WoodenStep woodenStep = new WoodenStep(); - assertThat("Constructed with default step type", woodenStep.getItemType(), equalTo(Material.WOOD_STEP)); + assertThat("Constructed with default step type", woodenStep.getItemType(), equalTo(Material.LEGACY_WOOD_STEP)); assertThat("Constructed with default tree species", woodenStep.getSpecies(), equalTo(TreeSpecies.GENERIC)); assertThat("Constructed with default inversion", woodenStep.isInverted(), equalTo(false)); @@ -206,12 +206,12 @@ public class MaterialDataTest { boolean[] inversion = new boolean[]{true, false}; for (TreeSpecies species : allSpecies) { woodenStep = new WoodenStep(species); - assertThat("Constructed with default step type", woodenStep.getItemType(), equalTo(Material.WOOD_STEP)); + assertThat("Constructed with default step type", woodenStep.getItemType(), equalTo(Material.LEGACY_WOOD_STEP)); assertThat("Constructed with correct tree species", woodenStep.getSpecies(), equalTo(species)); assertThat("Constructed with default inversion", woodenStep.isInverted(), equalTo(false)); for (boolean isInverted : inversion) { woodenStep = new WoodenStep(species, isInverted); - assertThat("Constructed with default step type", woodenStep.getItemType(), equalTo(Material.WOOD_STEP)); + assertThat("Constructed with default step type", woodenStep.getItemType(), equalTo(Material.LEGACY_WOOD_STEP)); assertThat("Constructed with correct tree species", woodenStep.getSpecies(), equalTo(species)); assertThat("Constructed with correct inversion", woodenStep.isInverted(), equalTo(isInverted)); } @@ -221,7 +221,7 @@ public class MaterialDataTest { @Test public void testSapling() { Sapling sapling = new Sapling(); - assertThat("Constructed with default sapling type", sapling.getItemType(), equalTo(Material.SAPLING)); + assertThat("Constructed with default sapling type", sapling.getItemType(), equalTo(Material.LEGACY_SAPLING)); assertThat("Constructed with default tree species", sapling.getSpecies(), equalTo(TreeSpecies.GENERIC)); assertThat("Constructed with default growable", sapling.isInstantGrowable(), equalTo(false)); @@ -229,12 +229,12 @@ public class MaterialDataTest { boolean[] growable = new boolean[]{true, false}; for (TreeSpecies species : allSpecies) { sapling = new Sapling(species); - assertThat("Constructed with default sapling type", sapling.getItemType(), equalTo(Material.SAPLING)); + assertThat("Constructed with default sapling type", sapling.getItemType(), equalTo(Material.LEGACY_SAPLING)); assertThat("Constructed with correct tree species", sapling.getSpecies(), equalTo(species)); assertThat("Constructed with default growable", sapling.isInstantGrowable(), equalTo(false)); for (boolean isInstantGrowable : growable) { sapling = new Sapling(species, isInstantGrowable); - assertThat("Constructed with default sapling type", sapling.getItemType(), equalTo(Material.SAPLING)); + assertThat("Constructed with default sapling type", sapling.getItemType(), equalTo(Material.LEGACY_SAPLING)); assertThat("Constructed with correct tree species", sapling.getSpecies(), equalTo(species)); assertThat("Constructed with correct growable", sapling.isInstantGrowable(), equalTo(isInstantGrowable)); } @@ -243,7 +243,7 @@ public class MaterialDataTest { @Test public void testMushroom() { - Material[] mushroomTypes = new Material[] { Material.HUGE_MUSHROOM_1, Material.HUGE_MUSHROOM_2 }; + Material[] mushroomTypes = new Material[] { Material.LEGACY_HUGE_MUSHROOM_1, Material.LEGACY_HUGE_MUSHROOM_2 }; BlockFace[] setFaces = new BlockFace[] { BlockFace.SELF, BlockFace.UP, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH_EAST, BlockFace.NORTH_WEST, BlockFace.SOUTH_EAST, BlockFace.SOUTH_WEST }; @@ -270,18 +270,18 @@ public class MaterialDataTest { @Test public void testCrops() { Crops crops = new Crops(); - assertThat("Constructed with default crops type", crops.getItemType(), equalTo(Material.CROPS)); + assertThat("Constructed with default crops type", crops.getItemType(), equalTo(Material.LEGACY_CROPS)); assertThat("Constructed with default crop state", crops.getState(), equalTo(CropState.SEEDED)); CropState[] allStates = CropState.values(); for (CropState state : allStates) { crops = new Crops(state); - assertThat("Constructed with default crops type", crops.getItemType(), equalTo(Material.CROPS)); + assertThat("Constructed with default crops type", crops.getItemType(), equalTo(Material.LEGACY_CROPS)); assertThat("Constructed with correct crop state", crops.getState(), equalTo(state)); } // The crops which fully implement all crop states - Material[] allCrops = new Material[] {Material.CROPS, Material.CARROT, Material.POTATO}; + Material[] allCrops = new Material[] {Material.LEGACY_CROPS, Material.LEGACY_CARROT, Material.LEGACY_POTATO}; for (Material crop : allCrops) { crops = new Crops(crop); assertThat("Constructed with correct crops type", crops.getItemType(), equalTo(crop)); @@ -298,17 +298,17 @@ public class MaterialDataTest { // Setting different crop states for beetroot will return the following when retrieved back CropState[] beetrootStates = new CropState[] {CropState.SEEDED, CropState.SEEDED, CropState.SMALL, CropState.SMALL, CropState.TALL, CropState.TALL, CropState.RIPE, CropState.RIPE}; assertThat("Beetroot state translations match size", beetrootStates.length, equalTo(allStates.length)); - crops = new Crops(Material.BEETROOT_BLOCK); - assertThat("Constructed with correct crops type", crops.getItemType(), equalTo(Material.BEETROOT_BLOCK)); + crops = new Crops(Material.LEGACY_BEETROOT_BLOCK); + assertThat("Constructed with correct crops type", crops.getItemType(), equalTo(Material.LEGACY_BEETROOT_BLOCK)); assertThat("Constructed with default crop state", crops.getState(), equalTo(CropState.SEEDED)); for (int s = 0; s < beetrootStates.length; s++) { - crops = new Crops(Material.BEETROOT_BLOCK, allStates[s]); - assertThat("Constructed with correct crops type", crops.getItemType(), equalTo(Material.BEETROOT_BLOCK)); + crops = new Crops(Material.LEGACY_BEETROOT_BLOCK, allStates[s]); + assertThat("Constructed with correct crops type", crops.getItemType(), equalTo(Material.LEGACY_BEETROOT_BLOCK)); assertThat("Constructed with correct crop state", crops.getState(), equalTo(beetrootStates[s])); } // In case you want to treat NetherWarts as Crops, although they really aren't - crops = new Crops(Material.NETHER_WARTS); + crops = new Crops(Material.LEGACY_NETHER_WARTS); NetherWarts warts = new NetherWarts(); assertThat("Constructed with correct crops type", crops.getItemType(), equalTo(warts.getItemType())); assertThat("Constructed with default crop state", crops.getState(), equalTo(CropState.SEEDED)); @@ -317,7 +317,7 @@ public class MaterialDataTest { NetherWartsState[] allWartStates = NetherWartsState.values(); assertThat("Nether Warts state translations match size", allWartStates.length, equalTo(allStates.length)); for (int s = 0; s < allStates.length; s++) { - crops = new Crops(Material.NETHER_WARTS, allStates[s]); + crops = new Crops(Material.LEGACY_NETHER_WARTS, allStates[s]); warts = new NetherWarts(allWartStates[s]); assertThat("Constructed with correct crops type", crops.getItemType(), equalTo(warts.getItemType())); assertThat("Constructed with correct crop state", crops.getState(), equalTo(allStates[s])); @@ -328,7 +328,7 @@ public class MaterialDataTest { @Test public void testDiode() { Diode diode = new Diode(); - assertThat("Constructed with backward compatible diode state", diode.getItemType(), equalTo(Material.DIODE_BLOCK_ON)); + assertThat("Constructed with backward compatible diode state", diode.getItemType(), equalTo(Material.LEGACY_DIODE_BLOCK_ON)); assertThat("Constructed with backward compatible powered", diode.isPowered(), equalTo(true)); assertThat("Constructed with default delay", diode.getDelay(), equalTo(1)); assertThat("Constructed with default direction", diode.getFacing(), equalTo(BlockFace.NORTH)); @@ -338,19 +338,19 @@ public class MaterialDataTest { boolean[] states = new boolean[] {false, true}; for (BlockFace direction : directions) { diode = new Diode(direction); - assertThat("Constructed with default diode state", diode.getItemType(), equalTo(Material.DIODE_BLOCK_OFF)); + assertThat("Constructed with default diode state", diode.getItemType(), equalTo(Material.LEGACY_DIODE_BLOCK_OFF)); assertThat("Constructed with default powered", diode.isPowered(), equalTo(false)); assertThat("Constructed with default delay", diode.getDelay(), equalTo(1)); assertThat("Constructed with correct direction", diode.getFacing(), equalTo(direction)); for (int delay : delays) { diode = new Diode(direction, delay); - assertThat("Constructed with default diode state", diode.getItemType(), equalTo(Material.DIODE_BLOCK_OFF)); + assertThat("Constructed with default diode state", diode.getItemType(), equalTo(Material.LEGACY_DIODE_BLOCK_OFF)); assertThat("Constructed with default powered", diode.isPowered(), equalTo(false)); assertThat("Constructed with correct delay", diode.getDelay(), equalTo(delay)); assertThat("Constructed with correct direction", diode.getFacing(), equalTo(direction)); for (boolean state : states) { diode = new Diode(direction, delay, state); - assertThat("Constructed with correct diode state", diode.getItemType(), equalTo(state ? Material.DIODE_BLOCK_ON : Material.DIODE_BLOCK_OFF)); + assertThat("Constructed with correct diode state", diode.getItemType(), equalTo(state ? Material.LEGACY_DIODE_BLOCK_ON : Material.LEGACY_DIODE_BLOCK_OFF)); assertThat("Constructed with default powered", diode.isPowered(), equalTo(state)); assertThat("Constructed with correct delay", diode.getDelay(), equalTo(delay)); assertThat("Constructed with correct direction", diode.getFacing(), equalTo(direction)); @@ -362,7 +362,7 @@ public class MaterialDataTest { @Test public void testComparator() { Comparator comparator = new Comparator(); - assertThat("Constructed with default comparator state", comparator.getItemType(), equalTo(Material.REDSTONE_COMPARATOR_OFF)); + assertThat("Constructed with default comparator state", comparator.getItemType(), equalTo(Material.LEGACY_REDSTONE_COMPARATOR_OFF)); assertThat("Constructed with default powered", comparator.isPowered(), equalTo(false)); assertThat("Constructed with default being powered", comparator.isBeingPowered(), equalTo(false)); assertThat("Constructed with default mode", comparator.isSubtractionMode(), equalTo(false)); @@ -373,21 +373,21 @@ public class MaterialDataTest { boolean[] states = new boolean[] {false, true}; for (BlockFace direction : directions) { comparator = new Comparator(direction); - assertThat("Constructed with default comparator state", comparator.getItemType(), equalTo(Material.REDSTONE_COMPARATOR_OFF)); + assertThat("Constructed with default comparator state", comparator.getItemType(), equalTo(Material.LEGACY_REDSTONE_COMPARATOR_OFF)); assertThat("Constructed with default powered", comparator.isPowered(), equalTo(false)); assertThat("Constructed with default being powered", comparator.isBeingPowered(), equalTo(false)); assertThat("Constructed with default mode", comparator.isSubtractionMode(), equalTo(false)); assertThat("Constructed with correct direction", comparator.getFacing(), equalTo(direction)); for (boolean mode : modes) { comparator = new Comparator(direction, mode); - assertThat("Constructed with default comparator state", comparator.getItemType(), equalTo(Material.REDSTONE_COMPARATOR_OFF)); + assertThat("Constructed with default comparator state", comparator.getItemType(), equalTo(Material.LEGACY_REDSTONE_COMPARATOR_OFF)); assertThat("Constructed with default powered", comparator.isPowered(), equalTo(false)); assertThat("Constructed with default being powered", comparator.isBeingPowered(), equalTo(false)); assertThat("Constructed with correct mode", comparator.isSubtractionMode(), equalTo(mode)); assertThat("Constructed with correct direction", comparator.getFacing(), equalTo(direction)); for (boolean state : states) { comparator = new Comparator(direction, mode, state); - assertThat("Constructed with correct comparator state", comparator.getItemType(), equalTo(state ? Material.REDSTONE_COMPARATOR_ON : Material.REDSTONE_COMPARATOR_OFF)); + assertThat("Constructed with correct comparator state", comparator.getItemType(), equalTo(state ? Material.LEGACY_REDSTONE_COMPARATOR_ON : Material.LEGACY_REDSTONE_COMPARATOR_OFF)); assertThat("Constructed with correct powered", comparator.isPowered(), equalTo(state)); assertThat("Constructed with default being powered", comparator.isBeingPowered(), equalTo(false)); assertThat("Constructed with correct mode", comparator.isSubtractionMode(), equalTo(mode)); @@ -395,7 +395,7 @@ public class MaterialDataTest { // Check if the game sets the fourth bit, that block data is still interpreted correctly comparator.setData((byte)((comparator.getData() & 0x7) | 0x8)); - assertThat("Constructed with correct comparator state", comparator.getItemType(), equalTo(state ? Material.REDSTONE_COMPARATOR_ON : Material.REDSTONE_COMPARATOR_OFF)); + assertThat("Constructed with correct comparator state", comparator.getItemType(), equalTo(state ? Material.LEGACY_REDSTONE_COMPARATOR_ON : Material.LEGACY_REDSTONE_COMPARATOR_OFF)); assertThat("Constructed with correct powered", comparator.isPowered(), equalTo(state)); assertThat("Constructed with correct being powered", comparator.isBeingPowered(), equalTo(true)); assertThat("Constructed with correct mode", comparator.isSubtractionMode(), equalTo(mode)); @@ -408,7 +408,7 @@ public class MaterialDataTest { @Test public void testHopper() { Hopper hopper = new Hopper(); - assertThat("Constructed with default hopper type", hopper.getItemType(), equalTo(Material.HOPPER)); + assertThat("Constructed with default hopper type", hopper.getItemType(), equalTo(Material.LEGACY_HOPPER)); assertThat("Constructed with default active state", hopper.isActive(), equalTo(true)); assertThat("Constructed with default powered state", hopper.isPowered(), equalTo(false)); assertThat("Constructed with default direction", hopper.getFacing(), equalTo(BlockFace.DOWN)); @@ -417,13 +417,13 @@ public class MaterialDataTest { boolean[] activeStates = new boolean[] {true, false}; for (BlockFace direction : directions) { hopper = new Hopper(direction); - assertThat("Constructed with default hopper type", hopper.getItemType(), equalTo(Material.HOPPER)); + assertThat("Constructed with default hopper type", hopper.getItemType(), equalTo(Material.LEGACY_HOPPER)); assertThat("Constructed with default active state", hopper.isActive(), equalTo(true)); assertThat("Constructed with correct powered state", hopper.isPowered(), equalTo(false)); assertThat("Constructed with correct direction", hopper.getFacing(), equalTo(direction)); for(boolean isActive : activeStates) { hopper = new Hopper(direction, isActive); - assertThat("Constructed with default hopper type", hopper.getItemType(), equalTo(Material.HOPPER)); + assertThat("Constructed with default hopper type", hopper.getItemType(), equalTo(Material.LEGACY_HOPPER)); assertThat("Constructed with correct active state", hopper.isActive(), equalTo(isActive)); assertThat("Constructed with correct powered state", hopper.isPowered(), equalTo(!isActive)); assertThat("Constructed with correct direction", hopper.getFacing(), equalTo(direction)); diff --git a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java index 644e6d1b..cefbb0f9 100644 --- a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java +++ b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java @@ -4,6 +4,7 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.TestPlugin; import java.util.Collection; import org.junit.Test; +import org.junit.Assert; import static org.junit.Assert.*; import static org.hamcrest.CoreMatchers.*; @@ -21,11 +22,11 @@ public class StandardMessengerTest { public void testIsReservedChannel() { Messenger messenger = getMessenger(); - assertTrue(messenger.isReservedChannel("REGISTER")); - assertFalse(messenger.isReservedChannel("register")); - assertTrue(messenger.isReservedChannel("UNREGISTER")); - assertFalse(messenger.isReservedChannel("unregister")); - assertFalse(messenger.isReservedChannel("notReserved")); + assertTrue(messenger.isReservedChannel("minecraft:register")); + assertFalse(messenger.isReservedChannel("test:register")); + assertTrue(messenger.isReservedChannel("minecraft:unregister")); + assertFalse(messenger.isReservedChannel("test:nregister")); + assertTrue(messenger.isReservedChannel("minecraft:something")); } @Test @@ -33,13 +34,13 @@ public class StandardMessengerTest { Messenger messenger = getMessenger(); TestPlugin plugin = getPlugin(); - assertFalse(messenger.isOutgoingChannelRegistered(plugin, "foo")); - messenger.registerOutgoingPluginChannel(plugin, "foo"); - assertTrue(messenger.isOutgoingChannelRegistered(plugin, "foo")); - assertFalse(messenger.isOutgoingChannelRegistered(plugin, "bar")); + assertFalse(messenger.isOutgoingChannelRegistered(plugin, "test:foo")); + messenger.registerOutgoingPluginChannel(plugin, "test:foo"); + assertTrue(messenger.isOutgoingChannelRegistered(plugin, "test:foo")); + assertFalse(messenger.isOutgoingChannelRegistered(plugin, "test:bar")); - messenger.unregisterOutgoingPluginChannel(plugin, "foo"); - assertFalse(messenger.isOutgoingChannelRegistered(plugin, "foo")); + messenger.unregisterOutgoingPluginChannel(plugin, "test:foo"); + assertFalse(messenger.isOutgoingChannelRegistered(plugin, "test:foo")); } @Test(expected = ReservedChannelException.class) @@ -47,7 +48,7 @@ public class StandardMessengerTest { Messenger messenger = getMessenger(); TestPlugin plugin = getPlugin(); - messenger.registerOutgoingPluginChannel(plugin, "REGISTER"); + messenger.registerOutgoingPluginChannel(plugin, "minecraft:register"); } @Test @@ -55,36 +56,36 @@ public class StandardMessengerTest { Messenger messenger = getMessenger(); TestPlugin plugin = getPlugin(); - assertFalse(messenger.isOutgoingChannelRegistered(plugin, "foo")); - messenger.registerOutgoingPluginChannel(plugin, "foo"); - messenger.registerOutgoingPluginChannel(plugin, "bar"); - assertTrue(messenger.isOutgoingChannelRegistered(plugin, "foo")); - assertTrue(messenger.isOutgoingChannelRegistered(plugin, "bar")); + assertFalse(messenger.isOutgoingChannelRegistered(plugin, "test:foo")); + messenger.registerOutgoingPluginChannel(plugin, "test:foo"); + messenger.registerOutgoingPluginChannel(plugin, "test:bar"); + assertTrue(messenger.isOutgoingChannelRegistered(plugin, "test:foo")); + assertTrue(messenger.isOutgoingChannelRegistered(plugin, "test:bar")); messenger.unregisterOutgoingPluginChannel(plugin); - assertFalse(messenger.isOutgoingChannelRegistered(plugin, "foo")); - assertFalse(messenger.isOutgoingChannelRegistered(plugin, "bar")); + assertFalse(messenger.isOutgoingChannelRegistered(plugin, "test:foo")); + assertFalse(messenger.isOutgoingChannelRegistered(plugin, "test:bar")); } @Test public void testRegisterIncomingPluginChannel() { Messenger messenger = getMessenger(); TestPlugin plugin = getPlugin(); - TestMessageListener listener = new TestMessageListener("foo", "bar".getBytes()); + TestMessageListener listener = new TestMessageListener("test:foo", "test:bar".getBytes()); Player player = TestPlayer.getInstance(); - PluginMessageListenerRegistration registration = messenger.registerIncomingPluginChannel(plugin, "foo", listener); + PluginMessageListenerRegistration registration = messenger.registerIncomingPluginChannel(plugin, "test:foo", listener); assertTrue(registration.isValid()); - assertTrue(messenger.isIncomingChannelRegistered(plugin, "foo")); - messenger.dispatchIncomingMessage(player, "foo", "bar".getBytes()); + assertTrue(messenger.isIncomingChannelRegistered(plugin, "test:foo")); + messenger.dispatchIncomingMessage(player, "test:foo", "test:bar".getBytes()); assertTrue(listener.hasReceived()); - messenger.unregisterIncomingPluginChannel(plugin, "foo", listener); + messenger.unregisterIncomingPluginChannel(plugin, "test:foo", listener); listener.reset(); assertFalse(registration.isValid()); - assertFalse(messenger.isIncomingChannelRegistered(plugin, "foo")); - messenger.dispatchIncomingMessage(player, "foo", "bar".getBytes()); + assertFalse(messenger.isIncomingChannelRegistered(plugin, "test:foo")); + messenger.dispatchIncomingMessage(player, "test:foo", "test:bar".getBytes()); assertFalse(listener.hasReceived()); } @@ -93,44 +94,44 @@ public class StandardMessengerTest { Messenger messenger = getMessenger(); TestPlugin plugin = getPlugin(); - messenger.registerIncomingPluginChannel(plugin, "REGISTER", new TestMessageListener("foo", "bar".getBytes())); + messenger.registerIncomingPluginChannel(plugin, "minecraft:register", new TestMessageListener("test:foo", "test:bar".getBytes())); } @Test(expected = IllegalArgumentException.class) public void testDuplicateIncomingRegistration() { Messenger messenger = getMessenger(); TestPlugin plugin = getPlugin(); - TestMessageListener listener = new TestMessageListener("foo", "bar".getBytes()); + TestMessageListener listener = new TestMessageListener("test:foo", "test:bar".getBytes()); - messenger.registerIncomingPluginChannel(plugin, "baz", listener); - messenger.registerIncomingPluginChannel(plugin, "baz", listener); + messenger.registerIncomingPluginChannel(plugin, "test:baz", listener); + messenger.registerIncomingPluginChannel(plugin, "test:baz", listener); } @Test public void testUnregisterIncomingPluginChannel_Plugin_String() { Messenger messenger = getMessenger(); TestPlugin plugin = getPlugin(); - TestMessageListener listener1 = new TestMessageListener("foo", "bar".getBytes()); - TestMessageListener listener2 = new TestMessageListener("baz", "qux".getBytes()); + TestMessageListener listener1 = new TestMessageListener("test:foo", "test:bar".getBytes()); + TestMessageListener listener2 = new TestMessageListener("test:baz", "test:qux".getBytes()); Player player = TestPlayer.getInstance(); - PluginMessageListenerRegistration registration1 = messenger.registerIncomingPluginChannel(plugin, "foo", listener1); - PluginMessageListenerRegistration registration2 = messenger.registerIncomingPluginChannel(plugin, "baz", listener2); + PluginMessageListenerRegistration registration1 = messenger.registerIncomingPluginChannel(plugin, "test:foo", listener1); + PluginMessageListenerRegistration registration2 = messenger.registerIncomingPluginChannel(plugin, "test:baz", listener2); assertTrue(registration1.isValid()); assertTrue(registration2.isValid()); - messenger.dispatchIncomingMessage(player, "foo", "bar".getBytes()); - messenger.dispatchIncomingMessage(player, "baz", "qux".getBytes()); + messenger.dispatchIncomingMessage(player, "test:foo", "test:bar".getBytes()); + messenger.dispatchIncomingMessage(player, "test:baz", "test:qux".getBytes()); assertTrue(listener1.hasReceived()); assertTrue(listener2.hasReceived()); - messenger.unregisterIncomingPluginChannel(plugin, "foo"); + messenger.unregisterIncomingPluginChannel(plugin, "test:foo"); listener1.reset(); listener2.reset(); assertFalse(registration1.isValid()); assertTrue(registration2.isValid()); - messenger.dispatchIncomingMessage(player, "foo", "bar".getBytes()); - messenger.dispatchIncomingMessage(player, "baz", "qux".getBytes()); + messenger.dispatchIncomingMessage(player, "test:foo", "test:bar".getBytes()); + messenger.dispatchIncomingMessage(player, "test:baz", "test:qux".getBytes()); assertFalse(listener1.hasReceived()); assertTrue(listener2.hasReceived()); } @@ -139,16 +140,16 @@ public class StandardMessengerTest { public void testUnregisterIncomingPluginChannel_Plugin() { Messenger messenger = getMessenger(); TestPlugin plugin = getPlugin(); - TestMessageListener listener1 = new TestMessageListener("foo", "bar".getBytes()); - TestMessageListener listener2 = new TestMessageListener("baz", "qux".getBytes()); + TestMessageListener listener1 = new TestMessageListener("test:foo", "test:bar".getBytes()); + TestMessageListener listener2 = new TestMessageListener("test:baz", "test:qux".getBytes()); Player player = TestPlayer.getInstance(); - PluginMessageListenerRegistration registration1 = messenger.registerIncomingPluginChannel(plugin, "foo", listener1); - PluginMessageListenerRegistration registration2 = messenger.registerIncomingPluginChannel(plugin, "baz", listener2); + PluginMessageListenerRegistration registration1 = messenger.registerIncomingPluginChannel(plugin, "test:foo", listener1); + PluginMessageListenerRegistration registration2 = messenger.registerIncomingPluginChannel(plugin, "test:baz", listener2); assertTrue(registration1.isValid()); assertTrue(registration2.isValid()); - messenger.dispatchIncomingMessage(player, "foo", "bar".getBytes()); - messenger.dispatchIncomingMessage(player, "baz", "qux".getBytes()); + messenger.dispatchIncomingMessage(player, "test:foo", "test:bar".getBytes()); + messenger.dispatchIncomingMessage(player, "test:baz", "test:qux".getBytes()); assertTrue(listener1.hasReceived()); assertTrue(listener2.hasReceived()); @@ -158,8 +159,8 @@ public class StandardMessengerTest { assertFalse(registration1.isValid()); assertFalse(registration2.isValid()); - messenger.dispatchIncomingMessage(player, "foo", "bar".getBytes()); - messenger.dispatchIncomingMessage(player, "baz", "qux".getBytes()); + messenger.dispatchIncomingMessage(player, "test:foo", "test:bar".getBytes()); + messenger.dispatchIncomingMessage(player, "test:baz", "test:qux".getBytes()); assertFalse(listener1.hasReceived()); assertFalse(listener2.hasReceived()); } @@ -172,12 +173,12 @@ public class StandardMessengerTest { assertEquals(messenger.getOutgoingChannels()); - messenger.registerOutgoingPluginChannel(plugin1, "foo"); - messenger.registerOutgoingPluginChannel(plugin1, "bar"); - messenger.registerOutgoingPluginChannel(plugin2, "baz"); - messenger.registerOutgoingPluginChannel(plugin2, "baz"); + messenger.registerOutgoingPluginChannel(plugin1, "test:foo"); + messenger.registerOutgoingPluginChannel(plugin1, "test:bar"); + messenger.registerOutgoingPluginChannel(plugin2, "test:baz"); + messenger.registerOutgoingPluginChannel(plugin2, "test:baz"); - assertEquals(messenger.getOutgoingChannels(), "foo", "bar", "baz"); + assertEquals(messenger.getOutgoingChannels(), "test:foo", "test:bar", "test:baz"); } @Test @@ -187,13 +188,13 @@ public class StandardMessengerTest { TestPlugin plugin2 = getPlugin(); TestPlugin plugin3 = getPlugin(); - messenger.registerOutgoingPluginChannel(plugin1, "foo"); - messenger.registerOutgoingPluginChannel(plugin1, "bar"); - messenger.registerOutgoingPluginChannel(plugin2, "baz"); - messenger.registerOutgoingPluginChannel(plugin2, "qux"); + messenger.registerOutgoingPluginChannel(plugin1, "test:foo"); + messenger.registerOutgoingPluginChannel(plugin1, "test:bar"); + messenger.registerOutgoingPluginChannel(plugin2, "test:baz"); + messenger.registerOutgoingPluginChannel(plugin2, "test:qux"); - assertEquals(messenger.getOutgoingChannels(plugin1), "foo", "bar"); - assertEquals(messenger.getOutgoingChannels(plugin2), "baz", "qux"); + assertEquals(messenger.getOutgoingChannels(plugin1), "test:foo", "test:bar"); + assertEquals(messenger.getOutgoingChannels(plugin2), "test:baz", "test:qux"); assertEquals(messenger.getOutgoingChannels(plugin3)); } @@ -205,12 +206,12 @@ public class StandardMessengerTest { assertEquals(messenger.getIncomingChannels()); - messenger.registerIncomingPluginChannel(plugin1, "foo", new TestMessageListener("foo", "bar".getBytes())); - messenger.registerIncomingPluginChannel(plugin1, "bar", new TestMessageListener("foo", "bar".getBytes())); - messenger.registerIncomingPluginChannel(plugin2, "baz", new TestMessageListener("foo", "bar".getBytes())); - messenger.registerIncomingPluginChannel(plugin2, "baz", new TestMessageListener("foo", "bar".getBytes())); + messenger.registerIncomingPluginChannel(plugin1, "test:foo", new TestMessageListener("test:foo", "test:bar".getBytes())); + messenger.registerIncomingPluginChannel(plugin1, "test:bar", new TestMessageListener("test:foo", "test:bar".getBytes())); + messenger.registerIncomingPluginChannel(plugin2, "test:baz", new TestMessageListener("test:foo", "test:bar".getBytes())); + messenger.registerIncomingPluginChannel(plugin2, "test:baz", new TestMessageListener("test:foo", "test:bar".getBytes())); - assertEquals(messenger.getIncomingChannels(), "foo", "bar", "baz"); + assertEquals(messenger.getIncomingChannels(), "test:foo", "test:bar", "test:baz"); } @Test @@ -220,13 +221,13 @@ public class StandardMessengerTest { TestPlugin plugin2 = getPlugin(); TestPlugin plugin3 = getPlugin(); - messenger.registerIncomingPluginChannel(plugin1, "foo", new TestMessageListener("foo", "bar".getBytes())); - messenger.registerIncomingPluginChannel(plugin1, "bar", new TestMessageListener("foo", "bar".getBytes())); - messenger.registerIncomingPluginChannel(plugin2, "baz", new TestMessageListener("foo", "bar".getBytes())); - messenger.registerIncomingPluginChannel(plugin2, "qux", new TestMessageListener("foo", "bar".getBytes())); + messenger.registerIncomingPluginChannel(plugin1, "test:foo", new TestMessageListener("test:foo", "test:bar".getBytes())); + messenger.registerIncomingPluginChannel(plugin1, "test:bar", new TestMessageListener("test:foo", "test:bar".getBytes())); + messenger.registerIncomingPluginChannel(plugin2, "test:baz", new TestMessageListener("test:foo", "test:bar".getBytes())); + messenger.registerIncomingPluginChannel(plugin2, "test:qux", new TestMessageListener("test:foo", "test:bar".getBytes())); - assertEquals(messenger.getIncomingChannels(plugin1), "foo", "bar"); - assertEquals(messenger.getIncomingChannels(plugin2), "baz", "qux"); + assertEquals(messenger.getIncomingChannels(plugin1), "test:foo", "test:bar"); + assertEquals(messenger.getIncomingChannels(plugin2), "test:baz", "test:qux"); assertEquals(messenger.getIncomingChannels(plugin3)); } @@ -236,10 +237,10 @@ public class StandardMessengerTest { TestPlugin plugin1 = getPlugin(); TestPlugin plugin2 = getPlugin(); TestPlugin plugin3 = getPlugin(); - PluginMessageListenerRegistration registration1 = messenger.registerIncomingPluginChannel(plugin1, "foo", new TestMessageListener("foo", "bar".getBytes())); - PluginMessageListenerRegistration registration2 = messenger.registerIncomingPluginChannel(plugin1, "bar", new TestMessageListener("foo", "bar".getBytes())); - PluginMessageListenerRegistration registration3 = messenger.registerIncomingPluginChannel(plugin2, "baz", new TestMessageListener("foo", "bar".getBytes())); - PluginMessageListenerRegistration registration4 = messenger.registerIncomingPluginChannel(plugin2, "qux", new TestMessageListener("foo", "bar".getBytes())); + PluginMessageListenerRegistration registration1 = messenger.registerIncomingPluginChannel(plugin1, "test:foo", new TestMessageListener("test:foo", "test:bar".getBytes())); + PluginMessageListenerRegistration registration2 = messenger.registerIncomingPluginChannel(plugin1, "test:bar", new TestMessageListener("test:foo", "test:bar".getBytes())); + PluginMessageListenerRegistration registration3 = messenger.registerIncomingPluginChannel(plugin2, "test:baz", new TestMessageListener("test:foo", "test:bar".getBytes())); + PluginMessageListenerRegistration registration4 = messenger.registerIncomingPluginChannel(plugin2, "test:qux", new TestMessageListener("test:foo", "test:bar".getBytes())); assertEquals(messenger.getIncomingChannelRegistrations(plugin1), registration1, registration2); assertEquals(messenger.getIncomingChannelRegistrations(plugin2), registration3, registration4); @@ -251,14 +252,14 @@ public class StandardMessengerTest { Messenger messenger = getMessenger(); TestPlugin plugin1 = getPlugin(); TestPlugin plugin2 = getPlugin(); - PluginMessageListenerRegistration registration1 = messenger.registerIncomingPluginChannel(plugin1, "foo", new TestMessageListener("foo", "bar".getBytes())); - PluginMessageListenerRegistration registration2 = messenger.registerIncomingPluginChannel(plugin1, "bar", new TestMessageListener("foo", "bar".getBytes())); - PluginMessageListenerRegistration registration3 = messenger.registerIncomingPluginChannel(plugin2, "foo", new TestMessageListener("foo", "bar".getBytes())); - PluginMessageListenerRegistration registration4 = messenger.registerIncomingPluginChannel(plugin2, "bar", new TestMessageListener("foo", "bar".getBytes())); - - assertEquals(messenger.getIncomingChannelRegistrations("foo"), registration1, registration3); - assertEquals(messenger.getIncomingChannelRegistrations("bar"), registration2, registration4); - assertEquals(messenger.getIncomingChannelRegistrations("baz")); + PluginMessageListenerRegistration registration1 = messenger.registerIncomingPluginChannel(plugin1, "test:foo", new TestMessageListener("test:foo", "test:bar".getBytes())); + PluginMessageListenerRegistration registration2 = messenger.registerIncomingPluginChannel(plugin1, "test:bar", new TestMessageListener("test:foo", "test:bar".getBytes())); + PluginMessageListenerRegistration registration3 = messenger.registerIncomingPluginChannel(plugin2, "test:foo", new TestMessageListener("test:foo", "test:bar".getBytes())); + PluginMessageListenerRegistration registration4 = messenger.registerIncomingPluginChannel(plugin2, "test:bar", new TestMessageListener("test:foo", "test:bar".getBytes())); + + assertEquals(messenger.getIncomingChannelRegistrations("test:foo"), registration1, registration3); + assertEquals(messenger.getIncomingChannelRegistrations("test:bar"), registration2, registration4); + assertEquals(messenger.getIncomingChannelRegistrations("test:baz")); } @Test @@ -267,19 +268,33 @@ public class StandardMessengerTest { TestPlugin plugin1 = getPlugin(); TestPlugin plugin2 = getPlugin(); TestPlugin plugin3 = getPlugin(); - PluginMessageListenerRegistration registration1 = messenger.registerIncomingPluginChannel(plugin1, "foo", new TestMessageListener("foo", "bar".getBytes())); - PluginMessageListenerRegistration registration2 = messenger.registerIncomingPluginChannel(plugin1, "foo", new TestMessageListener("foo", "bar".getBytes())); - PluginMessageListenerRegistration registration3 = messenger.registerIncomingPluginChannel(plugin1, "bar", new TestMessageListener("foo", "bar".getBytes())); - PluginMessageListenerRegistration registration4 = messenger.registerIncomingPluginChannel(plugin2, "bar", new TestMessageListener("foo", "bar".getBytes())); - PluginMessageListenerRegistration registration5 = messenger.registerIncomingPluginChannel(plugin2, "baz", new TestMessageListener("foo", "bar".getBytes())); - PluginMessageListenerRegistration registration6 = messenger.registerIncomingPluginChannel(plugin2, "baz", new TestMessageListener("foo", "bar".getBytes())); - - assertEquals(messenger.getIncomingChannelRegistrations(plugin1, "foo"), registration1, registration2); - assertEquals(messenger.getIncomingChannelRegistrations(plugin1, "bar"), registration3); - assertEquals(messenger.getIncomingChannelRegistrations(plugin2, "bar"), registration4); - assertEquals(messenger.getIncomingChannelRegistrations(plugin2, "baz"), registration5, registration6); - assertEquals(messenger.getIncomingChannelRegistrations(plugin1, "baz")); - assertEquals(messenger.getIncomingChannelRegistrations(plugin3, "qux")); + PluginMessageListenerRegistration registration1 = messenger.registerIncomingPluginChannel(plugin1, "test:foo", new TestMessageListener("test:foo", "test:bar".getBytes())); + PluginMessageListenerRegistration registration2 = messenger.registerIncomingPluginChannel(plugin1, "test:foo", new TestMessageListener("test:foo", "test:bar".getBytes())); + PluginMessageListenerRegistration registration3 = messenger.registerIncomingPluginChannel(plugin1, "test:bar", new TestMessageListener("test:foo", "test:bar".getBytes())); + PluginMessageListenerRegistration registration4 = messenger.registerIncomingPluginChannel(plugin2, "test:bar", new TestMessageListener("test:foo", "test:bar".getBytes())); + PluginMessageListenerRegistration registration5 = messenger.registerIncomingPluginChannel(plugin2, "test:baz", new TestMessageListener("test:foo", "test:bar".getBytes())); + PluginMessageListenerRegistration registration6 = messenger.registerIncomingPluginChannel(plugin2, "test:baz", new TestMessageListener("test:foo", "test:bar".getBytes())); + + assertEquals(messenger.getIncomingChannelRegistrations(plugin1, "test:foo"), registration1, registration2); + assertEquals(messenger.getIncomingChannelRegistrations(plugin1, "test:bar"), registration3); + assertEquals(messenger.getIncomingChannelRegistrations(plugin2, "test:bar"), registration4); + assertEquals(messenger.getIncomingChannelRegistrations(plugin2, "test:baz"), registration5, registration6); + assertEquals(messenger.getIncomingChannelRegistrations(plugin1, "test:baz")); + assertEquals(messenger.getIncomingChannelRegistrations(plugin3, "test:qux")); + } + + @Test(expected = IllegalArgumentException.class) + public void testInvalidChannel() { + Messenger messenger = getMessenger(); + TestPlugin plugin = getPlugin(); + + messenger.registerOutgoingPluginChannel(plugin, "foo"); + } + + @Test + public void testValidateAndCorrectChannel() { + Assert.assertEquals("bungeecord:main", StandardMessenger.validateAndCorrectChannel("BungeeCord")); + Assert.assertEquals("BungeeCord", StandardMessenger.validateAndCorrectChannel("bungeecord:main")); } private static <T> void assertEquals(Collection<T> actual, T... expected) { |