diff --git a/pom.xml b/pom.xml index ab61a62..5c1b77d 100644 --- a/pom.xml +++ b/pom.xml @@ -157,7 +157,7 @@ org.spigotmc spigot-api - 1.16.1-R0.1-SNAPSHOT + 1.16.3-R0.1-SNAPSHOT provided diff --git a/src/main/lombok/nl/SBDeveloper/V10Lift/utils/XMaterial.java b/src/main/lombok/nl/SBDeveloper/V10Lift/utils/XMaterial.java index 14ae63b..381312a 100644 --- a/src/main/lombok/nl/SBDeveloper/V10Lift/utils/XMaterial.java +++ b/src/main/lombok/nl/SBDeveloper/V10Lift/utils/XMaterial.java @@ -25,9 +25,8 @@ package nl.SBDeveloper.V10Lift.utils; import com.google.common.base.Enums; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.Validate; import org.apache.commons.lang.WordUtils; @@ -40,14 +39,14 @@ import javax.annotation.Nullable; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; /** * XMaterial - Data Values/Pre-flattening
* 1.13 and above as priority. *

- * This class is mainly designed to support ItemStacks. - * If you want to use it on blocks you'll have to - * use XBlock + * This class is mainly designed to support ItemStacks. If you want to use it on blocks, you'll have to use + * XBlock *

* Pre-flattening: https://minecraft.gamepedia.com/Java_Edition_data_values/Pre-flattening * Materials: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html @@ -55,16 +54,20 @@ import java.util.regex.Pattern; * Material IDs: https://minecraft-ids.grahamedgecombe.com/ * Material Source Code: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/Material.java * XMaterial v1: https://www.spigotmc.org/threads/329630/ + *

+ * This class will throw a "unsupported material" error if someone tries to use an item with an invalid data value which can only happen in 1.12 servers and below. + * To get an invalid item, (aka Missing Texture Block) you can use the command + * /give @p minecraft:dirt 1 10 where 1 is the item amount, and 10 is the data value. The material {@link #DIRT} with a data value of {@code 10} doesn't exist. * * @author Crypto Morin - * @version 5.0.1 + * @version 7.0.0 * @see Material * @see ItemStack */ public enum XMaterial { ACACIA_BOAT("BOAT_ACACIA"), ACACIA_BUTTON("WOOD_BUTTON"), - ACACIA_DOOR("ACACIA_DOOR_ITEM", "ACACIA_DOOR"), + ACACIA_DOOR("ACACIA_DOOR", "ACACIA_DOOR_ITEM"), ACACIA_FENCE, ACACIA_FENCE_GATE, ACACIA_LEAVES("LEAVES_2"), @@ -72,11 +75,11 @@ public enum XMaterial { ACACIA_PLANKS(4, "WOOD"), ACACIA_PRESSURE_PLATE("WOOD_PLATE"), ACACIA_SAPLING(4, "SAPLING"), - ACACIA_SIGN("SIGN"), - ACACIA_SLAB(4, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"), + ACACIA_SIGN("SIGN_POST", "SIGN"), + ACACIA_SLAB(4, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), ACACIA_STAIRS, ACACIA_TRAPDOOR("TRAP_DOOR"), - ACACIA_WALL_SIGN("SIGN_POST", "WALL_SIGN"), + ACACIA_WALL_SIGN("WALL_SIGN"), ACACIA_WOOD("LOG_2"), ACTIVATOR_RAIL, /** @@ -88,7 +91,7 @@ public enum XMaterial { */ AIR, ALLIUM(2, "RED_ROSE"), - ANCIENT_DEBRIS("1.16"), + ANCIENT_DEBRIS(16), ANDESITE(5, "STONE"), ANDESITE_SLAB, ANDESITE_STAIRS, @@ -101,16 +104,16 @@ public enum XMaterial { ATTACHED_PUMPKIN_STEM(7, "PUMPKIN_STEM"), AZURE_BLUET(3, "RED_ROSE"), BAKED_POTATO, - BAMBOO("1.14", "SUGAR_CANE", ""), - BAMBOO_SAPLING("1.14"), - BARREL("1.14", "CHEST", ""), + BAMBOO(0, 14, "SUGAR_CANE", ""), + BAMBOO_SAPLING(14), + BARREL(0, 14, "CHEST", ""), BARRIER, - BASALT("1.16"), + BASALT(16), BAT_SPAWN_EGG(65, "MONSTER_EGG"), BEACON, BEDROCK, BEEF("RAW_BEEF"), - BEEHIVE("1.15"), + BEEHIVE(15), /** * Beetroot is a known material in pre-1.13 * Use XBlock when comparing block types. @@ -119,12 +122,12 @@ public enum XMaterial { BEETROOTS("BEETROOT"), BEETROOT_SEEDS, BEETROOT_SOUP, - BEE_NEST("1.15"), - BEE_SPAWN_EGG("1.15"), - BELL("1.14"), + BEE_NEST(15), + BEE_SPAWN_EGG(15), + BELL(14), BIRCH_BOAT("BOAT_BIRCH"), BIRCH_BUTTON("WOOD_BUTTON"), - BIRCH_DOOR("BIRCH_DOOR_ITEM", "BIRCH_DOOR"), + BIRCH_DOOR("BIRCH_DOOR", "BIRCH_DOOR_ITEM"), BIRCH_FENCE, BIRCH_FENCE_GATE, BIRCH_LEAVES(2, "LEAVES"), @@ -132,41 +135,41 @@ public enum XMaterial { BIRCH_PLANKS(2, "WOOD"), BIRCH_PRESSURE_PLATE("WOOD_PLATE"), BIRCH_SAPLING(2, "SAPLING"), - BIRCH_SIGN("SIGN"), - BIRCH_SLAB(2, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"), + BIRCH_SIGN("SIGN_POST", "SIGN"), + BIRCH_SLAB(2, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), BIRCH_STAIRS("BIRCH_WOOD_STAIRS"), BIRCH_TRAPDOOR("TRAP_DOOR"), - BIRCH_WALL_SIGN("SIGN_POST", "WALL_SIGN"), + BIRCH_WALL_SIGN("WALL_SIGN"), BIRCH_WOOD(2, "LOG"), - BLACKSTONE("1.16"), - BLACKSTONE_SLAB("1.16"), - BLACKSTONE_STAIRS("1.16"), - BLACKSTONE_WALL("1.16"), - BLACK_BANNER("BANNER", "STANDING_BANNER"), + BLACKSTONE(16), + BLACKSTONE_SLAB(16), + BLACKSTONE_STAIRS(16), + BLACKSTONE_WALL(16), + BLACK_BANNER("STANDING_BANNER", "BANNER"), BLACK_BED(15, "BED_BLOCK", "BED"), BLACK_CARPET(15, "CARPET"), BLACK_CONCRETE(15, "CONCRETE"), BLACK_CONCRETE_POWDER(15, "CONCRETE_POWDER"), - BLACK_DYE("1.14", "INK_SACK"), - BLACK_GLAZED_TERRACOTTA(15, "1.12", "HARD_CLAY", "STAINED_CLAY", "BLACK_TERRACOTTA"), + BLACK_DYE(0, 14, "INK_SACK", "INK_SAC"), + BLACK_GLAZED_TERRACOTTA(15, 12, "HARD_CLAY", "STAINED_CLAY", "BLACK_TERRACOTTA"), BLACK_SHULKER_BOX, BLACK_STAINED_GLASS(15, "STAINED_GLASS"), BLACK_STAINED_GLASS_PANE(15, "STAINED_GLASS_PANE"), BLACK_TERRACOTTA(15, "HARD_CLAY", "STAINED_CLAY"), BLACK_WALL_BANNER("WALL_BANNER"), BLACK_WOOL(15, "WOOL"), - BLAST_FURNACE("1.14", "FURNACE", ""), + BLAST_FURNACE(0, 14, "FURNACE", ""), BLAZE_POWDER, BLAZE_ROD, BLAZE_SPAWN_EGG(61, "MONSTER_EGG"), - BLUE_BANNER(4, "BANNER", "STANDING_BANNER"), + BLUE_BANNER(4, "STANDING_BANNER", "BANNER"), BLUE_BED(11, "BED_BLOCK", "BED"), BLUE_CARPET(11, "CARPET"), BLUE_CONCRETE(11, "CONCRETE"), BLUE_CONCRETE_POWDER(11, "CONCRETE_POWDER"), BLUE_DYE(4, "INK_SACK", "LAPIS_LAZULI"), - BLUE_GLAZED_TERRACOTTA(11, "1.12", "HARD_CLAY", "STAINED_CLAY", "BLUE_TERRACOTTA"), - BLUE_ICE("1.13", "PACKED_ICE", ""), + BLUE_GLAZED_TERRACOTTA(11, 12, "HARD_CLAY", "STAINED_CLAY", "BLUE_TERRACOTTA"), + BLUE_ICE(0, 13, "PACKED_ICE", ""), BLUE_ORCHID(1, "RED_ROSE"), BLUE_SHULKER_BOX, BLUE_STAINED_GLASS(11, "STAINED_GLASS"), @@ -181,24 +184,24 @@ public enum XMaterial { BOOKSHELF, BOW, BOWL, - BRAIN_CORAL("1.13"), - BRAIN_CORAL_BLOCK("1.13"), - BRAIN_CORAL_FAN("1.13"), + BRAIN_CORAL(13), + BRAIN_CORAL_BLOCK(13), + BRAIN_CORAL_FAN(13), BRAIN_CORAL_WALL_FAN, BREAD, - BREWING_STAND("BREWING_STAND_ITEM"), + BREWING_STAND("BREWING_STAND", "BREWING_STAND_ITEM"), BRICK("CLAY_BRICK"), BRICKS("BRICK"), BRICK_SLAB(4, "STEP"), BRICK_STAIRS, BRICK_WALL, - BROWN_BANNER(3, "BANNER", "STANDING_BANNER"), + BROWN_BANNER(3, "STANDING_BANNER", "BANNER"), BROWN_BED(12, "BED_BLOCK", "BED"), BROWN_CARPET(12, "CARPET"), BROWN_CONCRETE(12, "CONCRETE"), BROWN_CONCRETE_POWDER(12, "CONCRETE_POWDER"), - BROWN_DYE(3, "INK_SACK", "COCOA", "COCOA_BEANS"), - BROWN_GLAZED_TERRACOTTA(12, "1.12", "HARD_CLAY", "STAINED_CLAY", "BROWN_TERRACOTTA"), + BROWN_DYE(3, "INK_SACK", "DYE", "COCOA_BEANS"), + BROWN_GLAZED_TERRACOTTA(12, 12, "HARD_CLAY", "STAINED_CLAY", "BROWN_TERRACOTTA"), BROWN_MUSHROOM, BROWN_MUSHROOM_BLOCK("BROWN_MUSHROOM", "HUGE_MUSHROOM_1"), BROWN_SHULKER_BOX, @@ -207,22 +210,22 @@ public enum XMaterial { BROWN_TERRACOTTA(12, "STAINED_CLAY"), BROWN_WALL_BANNER(3, "WALL_BANNER"), BROWN_WOOL(12, "WOOL"), - BUBBLE_COLUMN("1.13"), - BUBBLE_CORAL("1.13"), - BUBBLE_CORAL_BLOCK("1.13"), - BUBBLE_CORAL_FAN("1.13"), + BUBBLE_COLUMN(13), + BUBBLE_CORAL(13), + BUBBLE_CORAL_BLOCK(13), + BUBBLE_CORAL_FAN(13), BUBBLE_CORAL_WALL_FAN, BUCKET, CACTUS, CAKE("CAKE_BLOCK"), - CAMPFIRE("1.14"), + CAMPFIRE(14), CARROT("CARROT_ITEM"), CARROTS("CARROT"), CARROT_ON_A_STICK("CARROT_STICK"), - CARTOGRAPHY_TABLE("1.14", "CRAFTING_TABLE", ""), - CARVED_PUMPKIN(1, "1.13", "PUMPKIN", ""), + CARTOGRAPHY_TABLE(0, 14, "CRAFTING_TABLE", ""), + CARVED_PUMPKIN(1, 13, "PUMPKIN", ""), CAT_SPAWN_EGG, - CAULDRON("CAULDRON_ITEM"), + CAULDRON("CAULDRON", "CAULDRON_ITEM"), /** * 1.13 tag is not added because it's the same thing as {@link #AIR} * @@ -230,7 +233,7 @@ public enum XMaterial { */ CAVE_AIR("AIR"), CAVE_SPIDER_SPAWN_EGG(59, "MONSTER_EGG"), - CHAIN("1.16"), + CHAIN(16), CHAINMAIL_BOOTS, CHAINMAIL_CHESTPLATE, CHAINMAIL_HELMET, @@ -243,14 +246,14 @@ public enum XMaterial { CHICKEN_SPAWN_EGG(93, "MONSTER_EGG"), CHIPPED_ANVIL(1, "ANVIL"), CHISELED_NETHER_BRICKS(1, "NETHER_BRICKS"), - CHISELED_POLISHED_BLACKSTONE("1.16", "POLISHED_BLACKSTONE"), + CHISELED_POLISHED_BLACKSTONE(0, 16, "POLISHED_BLACKSTONE"), CHISELED_QUARTZ_BLOCK(1, "QUARTZ_BLOCK"), CHISELED_RED_SANDSTONE(1, "RED_SANDSTONE"), CHISELED_SANDSTONE(1, "SANDSTONE"), CHISELED_STONE_BRICKS(3, "SMOOTH_BRICK"), - CHORUS_FLOWER("1.9"), - CHORUS_FRUIT("1.9"), - CHORUS_PLANT("1.9"), + CHORUS_FLOWER(0, 9), + CHORUS_FRUIT(0, 9), + CHORUS_PLANT(0, 9), CLAY, CLAY_BALL, CLOCK("WATCH"), @@ -263,11 +266,11 @@ public enum XMaterial { COBBLESTONE_STAIRS, COBBLESTONE_WALL("COBBLE_WALL"), COBWEB("WEB"), - COCOA("1.15"), - COCOA_BEANS(3, "INK_SACK", "COCOA"), + COCOA(15), + COCOA_BEANS(3, "INK_SACK"), COD("RAW_FISH"), - COD_BUCKET("1.13", "BUCKET", "WATER_BUCKET", ""), - COD_SPAWN_EGG("1.13", "MONSTER_EGG", ""), + COD_BUCKET(0, 13, "BUCKET", "WATER_BUCKET", ""), + COD_SPAWN_EGG(0, 13, "MONSTER_EGG", ""), COMMAND_BLOCK("COMMAND"), COMMAND_BLOCK_MINECART("COMMAND_MINECART"), /** @@ -279,8 +282,8 @@ public enum XMaterial { */ COMPARATOR("REDSTONE_COMPARATOR_OFF", "REDSTONE_COMPARATOR_ON", "REDSTONE_COMPARATOR"), COMPASS, - COMPOSTER("1.14", "CAULDRON", ""), - CONDUIT("1.13", "BEACON"), + COMPOSTER(0, 14, "CAULDRON", ""), + CONDUIT(0, 13, "BEACON"), COOKED_BEEF, COOKED_CHICKEN, COOKED_COD("COOKED_FISH"), @@ -289,45 +292,45 @@ public enum XMaterial { COOKED_RABBIT, COOKED_SALMON(1, "COOKED_FISH"), COOKIE, - CORNFLOWER(4, "1.14", "BLUE_DYE", ""), + CORNFLOWER(4, 14, "BLUE_DYE", ""), COW_SPAWN_EGG(92, "MONSTER_EGG"), CRACKED_NETHER_BRICKS(2, "NETHER_BRICKS"), - CRACKED_POLISHED_BLACKSTONE_BRICKS("1.16", "POLISHED_BLACKSTONE_BRICKS"), + CRACKED_POLISHED_BLACKSTONE_BRICKS(0, 16, "POLISHED_BLACKSTONE_BRICKS"), CRACKED_STONE_BRICKS(2, "SMOOTH_BRICK"), CRAFTING_TABLE("WORKBENCH"), CREEPER_BANNER_PATTERN, CREEPER_HEAD(4, "SKULL", "SKULL_ITEM"), CREEPER_SPAWN_EGG(50, "MONSTER_EGG"), CREEPER_WALL_HEAD(4, "SKULL", "SKULL_ITEM"), - CRIMSON_BUTTON("1.16"), - CRIMSON_DOOR("1.16"), - CRIMSON_FENCE("1.16"), - CRIMSON_FENCE_GATE("1.16"), - CRIMSON_FUNGUS("1.16"), - CRIMSON_HYPHAE("1.16"), - CRIMSON_NYLIUM("1.16"), - CRIMSON_PLANKS("1.16"), - CRIMSON_PRESSURE_PLATE("1.16"), - CRIMSON_ROOTS("1.16"), - CRIMSON_SIGN("1.16"), - CRIMSON_SLAB("1.16"), - CRIMSON_STAIRS("1.16"), - CRIMSON_STEM("1.16"), - CRIMSON_TRAPDOOR("1.16"), - CRIMSON_WALL_SIGN("1.16"), + CRIMSON_BUTTON(16), + CRIMSON_DOOR(16), + CRIMSON_FENCE(16), + CRIMSON_FENCE_GATE(16), + CRIMSON_FUNGUS(16), + CRIMSON_HYPHAE(16), + CRIMSON_NYLIUM(16), + CRIMSON_PLANKS(16), + CRIMSON_PRESSURE_PLATE(16), + CRIMSON_ROOTS(16), + CRIMSON_SIGN(0, 16, "SIGN_POST"), + CRIMSON_SLAB(16), + CRIMSON_STAIRS(16), + CRIMSON_STEM(16), + CRIMSON_TRAPDOOR(16), + CRIMSON_WALL_SIGN(0, 16, "WALL_SIGN"), CROSSBOW, - CRYING_OBSIDIAN("1.16"), - CUT_RED_SANDSTONE("1.13"), + CRYING_OBSIDIAN(16), + CUT_RED_SANDSTONE(13), CUT_RED_SANDSTONE_SLAB("STONE_SLAB2"), - CUT_SANDSTONE("1.13"), + CUT_SANDSTONE(13), CUT_SANDSTONE_SLAB("STEP"), - CYAN_BANNER(6, "BANNER", "STANDING_BANNER"), + CYAN_BANNER(6, "STANDING_BANNER", "BANNER"), CYAN_BED(9, "BED_BLOCK", "BED"), CYAN_CARPET(9, "CARPET"), CYAN_CONCRETE(9, "CONCRETE"), CYAN_CONCRETE_POWDER(9, "CONCRETE_POWDER"), CYAN_DYE(6, "INK_SACK"), - CYAN_GLAZED_TERRACOTTA(9, "1.12", "HARD_CLAY", "STAINED_CLAY", "CYAN_TERRACOTTA"), + CYAN_GLAZED_TERRACOTTA(9, 12, "HARD_CLAY", "STAINED_CLAY", "CYAN_TERRACOTTA"), CYAN_SHULKER_BOX, CYAN_STAINED_GLASS(9, "STAINED_GLASS"), CYAN_STAINED_GLASS_PANE(9, "STAINED_GLASS_PANE"), @@ -338,7 +341,7 @@ public enum XMaterial { DANDELION("YELLOW_FLOWER"), DARK_OAK_BOAT("BOAT_DARK_OAK"), DARK_OAK_BUTTON("WOOD_BUTTON"), - DARK_OAK_DOOR("DARK_OAK_DOOR_ITEM", "DARK_OAK_DOOR"), + DARK_OAK_DOOR("DARK_OAK_DOOR", "DARK_OAK_DOOR_ITEM"), DARK_OAK_FENCE, DARK_OAK_FENCE_GATE, DARK_OAK_LEAVES(4, "LEAVES", "LEAVES_2"), @@ -346,38 +349,38 @@ public enum XMaterial { DARK_OAK_PLANKS(5, "WOOD"), DARK_OAK_PRESSURE_PLATE("WOOD_PLATE"), DARK_OAK_SAPLING(5, "SAPLING"), - DARK_OAK_SIGN("SIGN"), - DARK_OAK_SLAB(5, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"), + DARK_OAK_SIGN("SIGN_POST", "SIGN"), + DARK_OAK_SLAB(5, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), DARK_OAK_STAIRS, DARK_OAK_TRAPDOOR("TRAP_DOOR"), - DARK_OAK_WALL_SIGN("SIGN_POST", "WALL_SIGN"), + DARK_OAK_WALL_SIGN("WALL_SIGN"), DARK_OAK_WOOD(1, "LOG", "LOG_2"), DARK_PRISMARINE(1, "PRISMARINE"), - DARK_PRISMARINE_SLAB("1.13"), - DARK_PRISMARINE_STAIRS("1.13"), + DARK_PRISMARINE_SLAB(13), + DARK_PRISMARINE_STAIRS(13), DAYLIGHT_DETECTOR("DAYLIGHT_DETECTOR_INVERTED"), - DEAD_BRAIN_CORAL("1.13"), - DEAD_BRAIN_CORAL_BLOCK("1.13"), - DEAD_BRAIN_CORAL_FAN("1.13"), - DEAD_BRAIN_CORAL_WALL_FAN("1.13"), - DEAD_BUBBLE_CORAL("1.13"), - DEAD_BUBBLE_CORAL_BLOCK("1.13"), - DEAD_BUBBLE_CORAL_FAN("1.13"), - DEAD_BUBBLE_CORAL_WALL_FAN("1.13"), + DEAD_BRAIN_CORAL(13), + DEAD_BRAIN_CORAL_BLOCK(13), + DEAD_BRAIN_CORAL_FAN(13), + DEAD_BRAIN_CORAL_WALL_FAN(13), + DEAD_BUBBLE_CORAL(13), + DEAD_BUBBLE_CORAL_BLOCK(13), + DEAD_BUBBLE_CORAL_FAN(13), + DEAD_BUBBLE_CORAL_WALL_FAN(13), DEAD_BUSH, - DEAD_FIRE_CORAL("1.13"), - DEAD_FIRE_CORAL_BLOCK("1.13"), - DEAD_FIRE_CORAL_FAN("1.13"), - DEAD_FIRE_CORAL_WALL_FAN("1.13"), - DEAD_HORN_CORAL("1.13"), - DEAD_HORN_CORAL_BLOCK("1.13"), - DEAD_HORN_CORAL_FAN("1.13"), - DEAD_HORN_CORAL_WALL_FAN("1.13"), - DEAD_TUBE_CORAL("1.13"), - DEAD_TUBE_CORAL_BLOCK("1.13"), - DEAD_TUBE_CORAL_FAN("1.13"), - DEAD_TUBE_CORAL_WALL_FAN("1.13"), - DEBUG_STICK("1.13", "STICK", ""), + DEAD_FIRE_CORAL(13), + DEAD_FIRE_CORAL_BLOCK(13), + DEAD_FIRE_CORAL_FAN(13), + DEAD_FIRE_CORAL_WALL_FAN(13), + DEAD_HORN_CORAL(13), + DEAD_HORN_CORAL_BLOCK(13), + DEAD_HORN_CORAL_FAN(13), + DEAD_HORN_CORAL_WALL_FAN(13), + DEAD_TUBE_CORAL(13), + DEAD_TUBE_CORAL_BLOCK(13), + DEAD_TUBE_CORAL_FAN(13), + DEAD_TUBE_CORAL_WALL_FAN(13), + DEBUG_STICK(0, 13, "STICK", ""), DETECTOR_RAIL, DIAMOND, DIAMOND_AXE, @@ -398,16 +401,16 @@ public enum XMaterial { DIORITE_WALL, DIRT, DISPENSER, - DOLPHIN_SPAWN_EGG("1.13", "MONSTER_EGG", ""), + DOLPHIN_SPAWN_EGG(0, 13, "MONSTER_EGG", ""), DONKEY_SPAWN_EGG(32, "MONSTER_EGG"), DRAGON_BREATH("DRAGONS_BREATH"), DRAGON_EGG, - DRAGON_HEAD(5, "1.9", "SKULL", "SKULL_ITEM"), + DRAGON_HEAD(5, 9, "SKULL", "SKULL_ITEM"), DRAGON_WALL_HEAD(5, "SKULL", "SKULL_ITEM"), - DRIED_KELP("1.13"), - DRIED_KELP_BLOCK("1.13"), + DRIED_KELP(13), + DRIED_KELP_BLOCK(13), DROPPER, - DROWNED_SPAWN_EGG("1.13", "MONSTER_EGG", ""), + DROWNED_SPAWN_EGG(0, 13, "MONSTER_EGG", ""), EGG, ELDER_GUARDIAN_SPAWN_EGG(4, "MONSTER_EGG"), ELYTRA, @@ -423,10 +426,10 @@ public enum XMaterial { ENDER_EYE("EYE_OF_ENDER"), ENDER_PEARL, END_CRYSTAL, - END_GATEWAY("1.9"), + END_GATEWAY(0, 9), END_PORTAL("ENDER_PORTAL"), END_PORTAL_FRAME("ENDER_PORTAL_FRAME"), - END_ROD("1.9", "BLAZE_ROD", ""), + END_ROD(0, 9, "BLAZE_ROD", ""), END_STONE("ENDER_STONE"), END_STONE_BRICKS("END_BRICKS"), END_STONE_BRICK_SLAB(6, "STEP"), @@ -437,7 +440,7 @@ public enum XMaterial { FARMLAND("SOIL"), FEATHER, FERMENTED_SPIDER_EYE, - FERN(1, "LONG_GRASS"), + FERN(2, "LONG_GRASS"), /** * For some reasons filled map items are really special. * Their data value starts from 0 and every time a player @@ -448,25 +451,26 @@ public enum XMaterial { FIREWORK_ROCKET("FIREWORK"), FIREWORK_STAR("FIREWORK_CHARGE"), FIRE_CHARGE("FIREBALL"), - FIRE_CORAL("1.13"), - FIRE_CORAL_BLOCK("1.13"), - FIRE_CORAL_FAN("1.13"), + FIRE_CORAL(13), + FIRE_CORAL_BLOCK(13), + FIRE_CORAL_FAN(13), FIRE_CORAL_WALL_FAN, FISHING_ROD, - FLETCHING_TABLE("1.14", "CRAFTING_TABLE", ""), + FLETCHING_TABLE(0, 14, "CRAFTING_TABLE", ""), FLINT, FLINT_AND_STEEL, FLOWER_BANNER_PATTERN, - FLOWER_POT("FLOWER_POT_ITEM"), - FOX_SPAWN_EGG("1.14"), + FLOWER_POT("FLOWER_POT", "FLOWER_POT_ITEM"), + FOX_SPAWN_EGG(14), /** * This special material cannot be obtained as an item. */ - FROSTED_ICE("1.9", "PACKED_ICE", ""), + FROSTED_ICE(0, 9, "PACKED_ICE", ""), FURNACE("BURNING_FURNACE"), FURNACE_MINECART("POWERED_MINECART"), GHAST_SPAWN_EGG(56, "MONSTER_EGG"), GHAST_TEAR, + GILDED_BLACKSTONE(16), GLASS, GLASS_BOTTLE, GLASS_PANE("THIN_GLASS"), @@ -494,52 +498,52 @@ public enum XMaterial { GRANITE_SLAB, GRANITE_STAIRS, GRANITE_WALL, - GRASS, + GRASS(1, "LONG_GRASS"), GRASS_BLOCK("GRASS"), GRASS_PATH, GRAVEL, - GRAY_BANNER(8, "BANNER", "STANDING_BANNER"), + GRAY_BANNER(8, "STANDING_BANNER", "BANNER"), GRAY_BED(7, "BED_BLOCK", "BED"), GRAY_CARPET(7, "CARPET"), GRAY_CONCRETE(7, "CONCRETE"), GRAY_CONCRETE_POWDER(7, "CONCRETE_POWDER"), GRAY_DYE(8, "INK_SACK"), - GRAY_GLAZED_TERRACOTTA(7, "1.12", "HARD_CLAY", "STAINED_CLAY", "GRAY_TERRACOTTA"), + GRAY_GLAZED_TERRACOTTA(7, 12, "HARD_CLAY", "STAINED_CLAY", "GRAY_TERRACOTTA"), GRAY_SHULKER_BOX, GRAY_STAINED_GLASS(7, "STAINED_GLASS"), GRAY_STAINED_GLASS_PANE(7, "THIN_GLASS", "STAINED_GLASS_PANE"), GRAY_TERRACOTTA(7, "HARD_CLAY", "STAINED_CLAY"), GRAY_WALL_BANNER(8, "WALL_BANNER"), GRAY_WOOL(7, "WOOL"), - GREEN_BANNER(2, "BANNER", "STANDING_BANNER"), + GREEN_BANNER(2, "STANDING_BANNER", "BANNER"), GREEN_BED(13, "BED_BLOCK", "BED"), GREEN_CARPET(13, "CARPET"), GREEN_CONCRETE(13, "CONCRETE"), GREEN_CONCRETE_POWDER(13, "CONCRETE_POWDER"), GREEN_DYE(2, "INK_SACK", "CACTUS_GREEN"), - GREEN_GLAZED_TERRACOTTA(13, "1.12", "HARD_CLAY", "STAINED_CLAY", "GREEN_TERRACOTTA"), + GREEN_GLAZED_TERRACOTTA(13, 12, "HARD_CLAY", "STAINED_CLAY", "GREEN_TERRACOTTA"), GREEN_SHULKER_BOX, GREEN_STAINED_GLASS(13, "STAINED_GLASS"), GREEN_STAINED_GLASS_PANE(13, "THIN_GLASS", "STAINED_GLASS_PANE"), GREEN_TERRACOTTA(13, "HARD_CLAY", "STAINED_CLAY"), GREEN_WALL_BANNER(2, "WALL_BANNER"), GREEN_WOOL(13, "WOOL"), - GRINDSTONE("1.14", "ANVIL", ""), + GRINDSTONE(0, 14, "ANVIL", ""), GUARDIAN_SPAWN_EGG(68, "MONSTER_EGG"), GUNPOWDER("SULPHUR"), HAY_BLOCK, - HEART_OF_THE_SEA("1.13"), + HEART_OF_THE_SEA(13), HEAVY_WEIGHTED_PRESSURE_PLATE("IRON_PLATE"), - HOGLIN_SPAWN_EGG("1.16", "MONSTER_EGG"), - HONEYCOMB("1.15"), - HONEYCOMB_BLOCK("1.15"), - HONEY_BLOCK("1.15", "SLIME_BLOCK", ""), - HONEY_BOTTLE("1.15", "GLASS_BOTTLE", ""), + HOGLIN_SPAWN_EGG(0, 16, "MONSTER_EGG"), + HONEYCOMB(15), + HONEYCOMB_BLOCK(15), + HONEY_BLOCK(0, 15, "SLIME_BLOCK", ""), + HONEY_BOTTLE(0, 15, "GLASS_BOTTLE", ""), HOPPER, HOPPER_MINECART, - HORN_CORAL("1.13"), - HORN_CORAL_BLOCK("1.13"), - HORN_CORAL_FAN("1.13"), + HORN_CORAL(13), + HORN_CORAL_BLOCK(13), + HORN_CORAL_FAN(13), HORN_CORAL_WALL_FAN, HORSE_SPAWN_EGG(100, "MONSTER_EGG"), HUSK_SPAWN_EGG(23, "MONSTER_EGG"), @@ -550,6 +554,11 @@ public enum XMaterial { INFESTED_MOSSY_STONE_BRICKS(3, "MONSTER_EGGS"), INFESTED_STONE("MONSTER_EGGS"), INFESTED_STONE_BRICKS(2, "MONSTER_EGGS", "SMOOTH_BRICK"), + /** + * We will only add "INK_SAC" for {@link #BLACK_DYE} since it's + * the only material (linked with this material) that is added + * after 1.13, which means it can use both INK_SACK and INK_SAC. + */ INK_SAC("INK_SACK"), IRON_AXE, IRON_BARS("IRON_FENCE"), @@ -570,11 +579,11 @@ public enum XMaterial { IRON_TRAPDOOR, ITEM_FRAME, JACK_O_LANTERN, - JIGSAW("1.14", "COMMAND_BLOCK", "STRUCTURE_BLOCK", ""), + JIGSAW(0, 14, "COMMAND_BLOCK", "STRUCTURE_BLOCK", ""), JUKEBOX, JUNGLE_BOAT("BOAT_JUNGLE"), JUNGLE_BUTTON("WOOD_BUTTON"), - JUNGLE_DOOR("JUNGLE_DOOR_ITEM", "JUNGLE_DOOR"), + JUNGLE_DOOR("JUNGLE_DOOR", "JUNGLE_DOOR_ITEM"), JUNGLE_FENCE, JUNGLE_FENCE_GATE, JUNGLE_LEAVES(3, "LEAVES"), @@ -582,17 +591,17 @@ public enum XMaterial { JUNGLE_PLANKS(3, "WOOD"), JUNGLE_PRESSURE_PLATE("WOOD_PLATE"), JUNGLE_SAPLING(3, "SAPLING"), - JUNGLE_SIGN("SIGN"), - JUNGLE_SLAB(3, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"), + JUNGLE_SIGN("SIGN_POST", "SIGN"), + JUNGLE_SLAB(3, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), JUNGLE_STAIRS("JUNGLE_WOOD_STAIRS"), JUNGLE_TRAPDOOR("TRAP_DOOR"), - JUNGLE_WALL_SIGN("SIGN_POST", "WALL_SIGN"), + JUNGLE_WALL_SIGN("WALL_SIGN"), JUNGLE_WOOD(3, "LOG"), - KELP("1.13"), - KELP_PLANT("1.13"), - KNOWLEDGE_BOOK("1.12", "BOOK"), + KELP(13), + KELP_PLANT(13), + KNOWLEDGE_BOOK(0, 12, "BOOK"), LADDER, - LANTERN("1.14", "SEA_LANTERN", ""), + LANTERN(0, 14, "SEA_LANTERN", ""), LAPIS_BLOCK, LAPIS_LAZULI(4, "INK_SACK"), LAPIS_ORE, @@ -604,24 +613,24 @@ public enum XMaterial { LEATHER_BOOTS, LEATHER_CHESTPLATE, LEATHER_HELMET, - LEATHER_HORSE_ARMOR("1.14", "IRON_HORSE_ARMOR", ""), + LEATHER_HORSE_ARMOR(0, 14, "IRON_HORSE_ARMOR", ""), LEATHER_LEGGINGS, - LECTERN("1.14", "BOOKSHELF", ""), + LECTERN(0, 14, "BOOKSHELF", ""), LEVER, - LIGHT_BLUE_BANNER(12, "BANNER", "STANDING_BANNER"), + LIGHT_BLUE_BANNER(12, "STANDING_BANNER", "BANNER"), LIGHT_BLUE_BED(3, "BED_BLOCK", "BED"), LIGHT_BLUE_CARPET(3, "CARPET"), LIGHT_BLUE_CONCRETE(3, "CONCRETE"), LIGHT_BLUE_CONCRETE_POWDER(3, "CONCRETE_POWDER"), LIGHT_BLUE_DYE(12, "INK_SACK"), - LIGHT_BLUE_GLAZED_TERRACOTTA(3, "1.12", "HARD_CLAY", "STAINED_CLAY", "LIGHT_BLUE_TERRACOTTA"), + LIGHT_BLUE_GLAZED_TERRACOTTA(3, 12, "HARD_CLAY", "STAINED_CLAY", "LIGHT_BLUE_TERRACOTTA"), LIGHT_BLUE_SHULKER_BOX, LIGHT_BLUE_STAINED_GLASS(3, "STAINED_GLASS"), LIGHT_BLUE_STAINED_GLASS_PANE(3, "THIN_GLASS", "STAINED_GLASS_PANE"), LIGHT_BLUE_TERRACOTTA(3, "STAINED_CLAY"), - LIGHT_BLUE_WALL_BANNER(12, "WALL_BANNER", "BANNER", "STANDING_BANNER"), + LIGHT_BLUE_WALL_BANNER(12, "WALL_BANNER", "STANDING_BANNER", "BANNER"), LIGHT_BLUE_WOOL(3, "WOOL"), - LIGHT_GRAY_BANNER(7, "BANNER", "STANDING_BANNER"), + LIGHT_GRAY_BANNER(7, "STANDING_BANNER", "BANNER"), LIGHT_GRAY_BED(8, "BED_BLOCK", "BED"), LIGHT_GRAY_CARPET(8, "CARPET"), LIGHT_GRAY_CONCRETE(8, "CONCRETE"), @@ -631,7 +640,7 @@ public enum XMaterial { * Renamed to SILVER_GLAZED_TERRACOTTA in 1.12 * Renamed to LIGHT_GRAY_GLAZED_TERRACOTTA in 1.14 */ - LIGHT_GRAY_GLAZED_TERRACOTTA("1.12", "HARD_CLAY", "STAINED_CLAY", "LIGHT_GRAY_TERRACOTTA", "SILVER_GLAZED_TERRACOTTA"), + LIGHT_GRAY_GLAZED_TERRACOTTA(0, 12, "HARD_CLAY", "STAINED_CLAY", "LIGHT_GRAY_TERRACOTTA", "SILVER_GLAZED_TERRACOTTA"), LIGHT_GRAY_SHULKER_BOX("SILVER_SHULKER_BOX"), LIGHT_GRAY_STAINED_GLASS(8, "STAINED_GLASS"), LIGHT_GRAY_STAINED_GLASS_PANE(8, "THIN_GLASS", "STAINED_GLASS_PANE"), @@ -640,15 +649,15 @@ public enum XMaterial { LIGHT_GRAY_WOOL(8, "WOOL"), LIGHT_WEIGHTED_PRESSURE_PLATE("GOLD_PLATE"), LILAC(1, "DOUBLE_PLANT"), - LILY_OF_THE_VALLEY(15, "1.14", "WHITE_DYE", ""), + LILY_OF_THE_VALLEY(15, 14, "WHITE_DYE", ""), LILY_PAD("WATER_LILY"), - LIME_BANNER(10, "BANNER", "STANDING_BANNER"), + LIME_BANNER(10, "STANDING_BANNER", "BANNER"), LIME_BED(5, "BED_BLOCK", "BED"), LIME_CARPET(5, "CARPET"), LIME_CONCRETE(5, "CONCRETE"), LIME_CONCRETE_POWDER(5, "CONCRETE_POWDER"), LIME_DYE(10, "INK_SACK"), - LIME_GLAZED_TERRACOTTA(5, "1.12", "HARD_CLAY", "STAINED_CLAY", "LIME_TERRACOTTA"), + LIME_GLAZED_TERRACOTTA(5, 12, "HARD_CLAY", "STAINED_CLAY", "LIME_TERRACOTTA"), LIME_SHULKER_BOX, LIME_STAINED_GLASS(5, "STAINED_GLASS"), LIME_STAINED_GLASS_PANE(5, "STAINED_GLASS_PANE"), @@ -657,22 +666,22 @@ public enum XMaterial { LIME_WOOL(5, "WOOL"), LINGERING_POTION, LLAMA_SPAWN_EGG(103, "MONSTER_EGG"), - LODESTONE("1.16"), - LOOM("1.14"), - MAGENTA_BANNER(13, "BANNER", "STANDING_BANNER"), + LODESTONE(16), + LOOM(14), + MAGENTA_BANNER(13, "STANDING_BANNER", "BANNER"), MAGENTA_BED(2, "BED_BLOCK", "BED"), MAGENTA_CARPET(2, "CARPET"), MAGENTA_CONCRETE(2, "CONCRETE"), MAGENTA_CONCRETE_POWDER(2, "CONCRETE_POWDER"), MAGENTA_DYE(13, "INK_SACK"), - MAGENTA_GLAZED_TERRACOTTA(2, "1.12", "HARD_CLAY", "STAINED_CLAY", "MAGENTA_TERRACOTTA"), + MAGENTA_GLAZED_TERRACOTTA(2, 12, "HARD_CLAY", "STAINED_CLAY", "MAGENTA_TERRACOTTA"), MAGENTA_SHULKER_BOX, MAGENTA_STAINED_GLASS(2, "STAINED_GLASS"), MAGENTA_STAINED_GLASS_PANE(2, "THIN_GLASS", "STAINED_GLASS_PANE"), MAGENTA_TERRACOTTA(2, "HARD_CLAY", "STAINED_CLAY"), MAGENTA_WALL_BANNER(13, "WALL_BANNER"), MAGENTA_WOOL(2, "WOOL"), - MAGMA_BLOCK("1.10", "MAGMA"), + MAGMA_BLOCK(0, 10, "MAGMA"), MAGMA_CREAM, MAGMA_CUBE_SPAWN_EGG(62, "MONSTER_EGG"), /** @@ -711,6 +720,7 @@ public enum XMaterial { MUSIC_DISC_FAR("RECORD_6"), MUSIC_DISC_MALL("RECORD_7"), MUSIC_DISC_MELLOHI("RECORD_8"), + MUSIC_DISC_PIGSTEP(16), MUSIC_DISC_STAL("RECORD_9"), MUSIC_DISC_STRAD("RECORD_10"), MUSIC_DISC_WAIT("RECORD_11"), @@ -718,19 +728,19 @@ public enum XMaterial { MUTTON, MYCELIUM("MYCEL"), NAME_TAG, - NAUTILUS_SHELL("1.13"), - NETHERITE_AXE("1.16"), - NETHERITE_BLOCK("1.16"), - NETHERITE_BOOTS("1.16"), - NETHERITE_CHESTPLATE("1.16"), - NETHERITE_HELMET("1.16"), - NETHERITE_HOE("1.16"), - NETHERITE_INGOT("1.16"), - NETHERITE_LEGGINGS("1.16"), - NETHERITE_PICKAXE("1.16"), - NETHERITE_SCRAP("1.16"), - NETHERITE_SHOVEL("1.16"), - NETHERITE_SWORD("1.16"), + NAUTILUS_SHELL(13), + NETHERITE_AXE(16), + NETHERITE_BLOCK(16), + NETHERITE_BOOTS(16), + NETHERITE_CHESTPLATE(16), + NETHERITE_HELMET(16), + NETHERITE_HOE(16), + NETHERITE_INGOT(16), + NETHERITE_LEGGINGS(16), + NETHERITE_PICKAXE(16), + NETHERITE_SCRAP(16), + NETHERITE_SHOVEL(16), + NETHERITE_SWORD(16), NETHERRACK, NETHER_BRICK("NETHER_BRICK_ITEM"), NETHER_BRICKS("NETHER_BRICK"), @@ -738,10 +748,10 @@ public enum XMaterial { NETHER_BRICK_SLAB(6, "STEP"), NETHER_BRICK_STAIRS, NETHER_BRICK_WALL, - NETHER_GOLD_ORE("1.16"), + NETHER_GOLD_ORE(16), NETHER_PORTAL("PORTAL"), NETHER_QUARTZ_ORE("QUARTZ_ORE"), - NETHER_SPROUTS("1.16"), + NETHER_SPROUTS(16), NETHER_STAR, /** * Just like mentioned in https://minecraft.gamepedia.com/Nether_Wart @@ -753,7 +763,7 @@ public enum XMaterial { NOTE_BLOCK, OAK_BOAT("BOAT"), OAK_BUTTON("WOOD_BUTTON"), - OAK_DOOR("WOOD_DOOR", "WOODEN_DOOR"), + OAK_DOOR("WOODEN_DOOR", "WOOD_DOOR"), OAK_FENCE("FENCE"), OAK_FENCE_GATE("FENCE_GATE"), OAK_LEAVES("LEAVES"), @@ -761,22 +771,22 @@ public enum XMaterial { OAK_PLANKS("WOOD"), OAK_PRESSURE_PLATE("WOOD_PLATE"), OAK_SAPLING("SAPLING"), - OAK_SIGN("SIGN"), - OAK_SLAB("WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"), + OAK_SIGN("SIGN_POST", "SIGN"), + OAK_SLAB("WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), OAK_STAIRS("WOOD_STAIRS"), OAK_TRAPDOOR("TRAP_DOOR"), - OAK_WALL_SIGN("SIGN_POST", "WALL_SIGN"), + OAK_WALL_SIGN("WALL_SIGN"), OAK_WOOD("LOG"), OBSERVER, OBSIDIAN, OCELOT_SPAWN_EGG(98, "MONSTER_EGG"), - ORANGE_BANNER(14, "BANNER", "STANDING_BANNER"), + ORANGE_BANNER(14, "STANDING_BANNER", "BANNER"), ORANGE_BED(1, "BED_BLOCK", "BED"), ORANGE_CARPET(1, "CARPET"), ORANGE_CONCRETE(1, "CONCRETE"), ORANGE_CONCRETE_POWDER(1, "CONCRETE_POWDER"), ORANGE_DYE(14, "INK_SACK"), - ORANGE_GLAZED_TERRACOTTA(1, "1.12", "HARD_CLAY", "STAINED_CLAY", "ORANGE_TERRACOTTA"), + ORANGE_GLAZED_TERRACOTTA(1, 12, "HARD_CLAY", "STAINED_CLAY", "ORANGE_TERRACOTTA"), ORANGE_SHULKER_BOX, ORANGE_STAINED_GLASS(1, "STAINED_GLASS"), ORANGE_STAINED_GLASS_PANE(1, "STAINED_GLASS_PANE"), @@ -787,22 +797,25 @@ public enum XMaterial { OXEYE_DAISY(8, "RED_ROSE"), PACKED_ICE, PAINTING, - PANDA_SPAWN_EGG("1.14"), + PANDA_SPAWN_EGG(14), PAPER, PARROT_SPAWN_EGG(105, "MONSTER_EGG"), PEONY(5, "DOUBLE_PLANT"), PETRIFIED_OAK_SLAB("WOOD_STEP"), - PHANTOM_MEMBRANE("1.13"), - PHANTOM_SPAWN_EGG("1.13", "MONSTER_EGG", ""), + PHANTOM_MEMBRANE(13), + PHANTOM_SPAWN_EGG(0, 13, "MONSTER_EGG", ""), + PIGLIN_BANNER_PATTERN(16), + PIGLIN_BRUTE_SPAWN_EGG(16), + PIGLIN_SPAWN_EGG(57, "MONSTER_EGG"), PIG_SPAWN_EGG(90, "MONSTER_EGG"), - PILLAGER_SPAWN_EGG("1.14"), - PINK_BANNER(9, "BANNER", "STANDING_BANNER"), + PILLAGER_SPAWN_EGG(14), + PINK_BANNER(9, "STANDING_BANNER", "BANNER"), PINK_BED(6, "BED_BLOCK", "BED"), PINK_CARPET(6, "CARPET"), PINK_CONCRETE(6, "CONCRETE"), PINK_CONCRETE_POWDER(6, "CONCRETE_POWDER"), PINK_DYE(9, "INK_SACK"), - PINK_GLAZED_TERRACOTTA(6, "1.12", "HARD_CLAY", "STAINED_CLAY", "PINK_TERRACOTTA"), + PINK_GLAZED_TERRACOTTA(6, 12, "HARD_CLAY", "STAINED_CLAY", "PINK_TERRACOTTA"), PINK_SHULKER_BOX, PINK_STAINED_GLASS(6, "STAINED_GLASS"), PINK_STAINED_GLASS_PANE(6, "THIN_GLASS", "STAINED_GLASS_PANE"), @@ -820,17 +833,17 @@ public enum XMaterial { POLISHED_ANDESITE(6, "STONE"), POLISHED_ANDESITE_SLAB, POLISHED_ANDESITE_STAIRS, - POLISHED_BASALT("1.16"), - POLISHED_BLACKSTONE("1.16"), - POLISHED_BLACKSTONE_BRICKS("1.16"), - POLISHED_BLACKSTONE_BRICK_SLAB("1.16"), - POLISHED_BLACKSTONE_BRICK_STAIRS("1.16"), - POLISHED_BLACKSTONE_BRICK_WALL("1.16"), - POLISHED_BLACKSTONE_BUTTON("1.16"), - POLISHED_BLACKSTONE_PRESSURE_PLATE("1.16"), - POLISHED_BLACKSTONE_SLAB("1.16"), - POLISHED_BLACKSTONE_STAIRS("1.16"), - POLISHED_BLACKSTONE_WALL("1.16"), + POLISHED_BASALT(16), + POLISHED_BLACKSTONE(16), + POLISHED_BLACKSTONE_BRICKS(16), + POLISHED_BLACKSTONE_BRICK_SLAB(16), + POLISHED_BLACKSTONE_BRICK_STAIRS(16), + POLISHED_BLACKSTONE_BRICK_WALL(16), + POLISHED_BLACKSTONE_BUTTON(16), + POLISHED_BLACKSTONE_PRESSURE_PLATE(16), + POLISHED_BLACKSTONE_SLAB(16), + POLISHED_BLACKSTONE_STAIRS(16), + POLISHED_BLACKSTONE_WALL(16), POLISHED_DIORITE(4, "STONE"), POLISHED_DIORITE_SLAB, POLISHED_DIORITE_STAIRS, @@ -852,6 +865,8 @@ public enum XMaterial { POTTED_BROWN_MUSHROOM("FLOWER_POT"), POTTED_CACTUS("FLOWER_POT"), POTTED_CORNFLOWER, + POTTED_CRIMSON_FUNGUS(16), + POTTED_CRIMSON_ROOTS(16), POTTED_DANDELION("YELLOW_FLOWER", "FLOWER_POT"), POTTED_DARK_OAK_SAPLING(5, "SAPLING", "FLOWER_POT"), POTTED_DEAD_BUSH("FLOWER_POT"), @@ -866,32 +881,34 @@ public enum XMaterial { POTTED_RED_MUSHROOM("FLOWER_POT"), POTTED_RED_TULIP(4, "RED_ROSE", "FLOWER_POT"), POTTED_SPRUCE_SAPLING(1, "SAPLING", "FLOWER_POT"), + POTTED_WARPED_FUNGUS(16), + POTTED_WARPED_ROOTS(16), POTTED_WHITE_TULIP(6, "RED_ROSE", "FLOWER_POT"), POTTED_WITHER_ROSE, POWERED_RAIL, PRISMARINE, PRISMARINE_BRICKS(2, "PRISMARINE"), PRISMARINE_BRICK_SLAB(4, "STEP"), - PRISMARINE_BRICK_STAIRS("1.13"), + PRISMARINE_BRICK_STAIRS(13), PRISMARINE_CRYSTALS, PRISMARINE_SHARD, - PRISMARINE_SLAB("1.13"), - PRISMARINE_STAIRS("1.13"), + PRISMARINE_SLAB(13), + PRISMARINE_STAIRS(13), PRISMARINE_WALL, PUFFERFISH(3, "RAW_FISH"), - PUFFERFISH_BUCKET("1.13", "BUCKET", "WATER_BUCKET", ""), - PUFFERFISH_SPAWN_EGG("1.13", "MONSTER_EGG", ""), + PUFFERFISH_BUCKET(0, 13, "BUCKET", "WATER_BUCKET", ""), + PUFFERFISH_SPAWN_EGG(0, 13, "MONSTER_EGG", ""), PUMPKIN, PUMPKIN_PIE, PUMPKIN_SEEDS, PUMPKIN_STEM, - PURPLE_BANNER(5, "BANNER", "STANDING_BANNER"), + PURPLE_BANNER(5, "STANDING_BANNER", "BANNER"), PURPLE_BED(10, "BED_BLOCK", "BED"), PURPLE_CARPET(10, "CARPET"), PURPLE_CONCRETE(10, "CONCRETE"), PURPLE_CONCRETE_POWDER(10, "CONCRETE_POWDER"), PURPLE_DYE(5, "INK_SACK"), - PURPLE_GLAZED_TERRACOTTA(10, "1.12", "HARD_CLAY", "STAINED_CLAY", "PURPLE_TERRACOTTA"), + PURPLE_GLAZED_TERRACOTTA(10, 12, "HARD_CLAY", "STAINED_CLAY", "PURPLE_TERRACOTTA"), PURPLE_SHULKER_BOX, PURPLE_STAINED_GLASS(10, "STAINED_GLASS"), PURPLE_STAINED_GLASS_PANE(10, "THIN_GLASS", "STAINED_GLASS_PANE"), @@ -904,6 +921,7 @@ public enum XMaterial { PURPUR_STAIRS, QUARTZ, QUARTZ_BLOCK, + QUARTZ_BRICKS(16), QUARTZ_PILLAR(2, "QUARTZ_BLOCK"), QUARTZ_SLAB(7, "STEP"), QUARTZ_STAIRS, @@ -913,7 +931,7 @@ public enum XMaterial { RABBIT_SPAWN_EGG(101, "MONSTER_EGG"), RABBIT_STEW, RAIL("RAILS"), - RAVAGER_SPAWN_EGG("1.14"), + RAVAGER_SPAWN_EGG(14), REDSTONE, REDSTONE_BLOCK, /** @@ -932,7 +950,7 @@ public enum XMaterial { REDSTONE_TORCH("REDSTONE_TORCH_OFF", "REDSTONE_TORCH_ON"), REDSTONE_WALL_TORCH, REDSTONE_WIRE, - RED_BANNER(1, "BANNER", "STANDING_BANNER"), + RED_BANNER(1, "STANDING_BANNER", "BANNER"), /** * Data value 14 or 0 */ @@ -940,11 +958,8 @@ public enum XMaterial { RED_CARPET(14, "CARPET"), RED_CONCRETE(14, "CONCRETE"), RED_CONCRETE_POWDER(14, "CONCRETE_POWDER"), - /** - * Data value 0 or 1? - */ - RED_DYE(0, "INK_SACK", "ROSE_RED"), - RED_GLAZED_TERRACOTTA(14, "1.12", "HARD_CLAY", "STAINED_CLAY", "RED_TERRACOTTA"), + RED_DYE(1, "INK_SACK", "ROSE_RED"), + RED_GLAZED_TERRACOTTA(14, 12, "HARD_CLAY", "STAINED_CLAY", "RED_TERRACOTTA"), RED_MUSHROOM, RED_MUSHROOM_BLOCK("RED_MUSHROOM", "HUGE_MUSHROOM_2"), RED_NETHER_BRICKS("RED_NETHER_BRICK"), @@ -953,7 +968,7 @@ public enum XMaterial { RED_NETHER_BRICK_WALL, RED_SAND(1, "SAND"), RED_SANDSTONE, - RED_SANDSTONE_SLAB("STONE_SLAB2", "DOUBLE_STONE_SLAB2"), + RED_SANDSTONE_SLAB("DOUBLE_STONE_SLAB2", "STONE_SLAB2"), RED_SANDSTONE_STAIRS, RED_SANDSTONE_WALL, RED_SHULKER_BOX, @@ -963,29 +978,29 @@ public enum XMaterial { RED_TULIP(4, "RED_ROSE"), RED_WALL_BANNER(1, "WALL_BANNER"), RED_WOOL(14, "WOOL"), - REPEATER("DIODE", "DIODE_BLOCK_ON", "DIODE_BLOCK_OFF"), + REPEATER("DIODE_BLOCK_ON", "DIODE_BLOCK_OFF", "DIODE"), REPEATING_COMMAND_BLOCK("COMMAND", "COMMAND_REPEATING"), - RESPAWN_ANCHOR("1.16"), + RESPAWN_ANCHOR(16), ROSE_BUSH(4, "DOUBLE_PLANT"), ROTTEN_FLESH, SADDLE, SALMON(1, "RAW_FISH"), - SALMON_BUCKET("1.13", "BUCKET", "WATER_BUCKET", ""), - SALMON_SPAWN_EGG("1.13", "MONSTER_EGG", ""), + SALMON_BUCKET(0, 13, "BUCKET", "WATER_BUCKET", ""), + SALMON_SPAWN_EGG(0, 13, "MONSTER_EGG", ""), SAND, SANDSTONE, - SANDSTONE_SLAB(1, "STEP", "STONE_SLAB", "DOUBLE_STEP"), + SANDSTONE_SLAB(1, "DOUBLE_STEP", "STEP", "STONE_SLAB"), SANDSTONE_STAIRS, SANDSTONE_WALL, - SCAFFOLDING("1.14", "SLIME_BLOCK", ""), - SCUTE("1.13"), - SEAGRASS("1.13", "GRASS", ""), + SCAFFOLDING(0, 14, "SLIME_BLOCK", ""), + SCUTE(13), + SEAGRASS(0, 13, "GRASS", ""), SEA_LANTERN, - SEA_PICKLE("1.13"), + SEA_PICKLE(13), SHEARS, SHEEP_SPAWN_EGG(91, "MONSTER_EGG"), SHIELD, - SHROOMLIGHT("1.16"), + SHROOMLIGHT(16), SHULKER_BOX("PURPLE_SHULKER_BOX"), SHULKER_SHELL, SHULKER_SPAWN_EGG(69, "MONSTER_EGG"), @@ -999,8 +1014,8 @@ public enum XMaterial { SLIME_BLOCK, SLIME_SPAWN_EGG(55, "MONSTER_EGG"), SMITHING_TABLE, - SMOKER("1.14", "FURNACE", ""), - SMOOTH_QUARTZ("1.13", "QUARTZ", ""), + SMOKER(0, 14, "FURNACE", ""), + SMOOTH_QUARTZ(0, 13, "QUARTZ", ""), SMOOTH_QUARTZ_SLAB(7, "STEP"), SMOOTH_QUARTZ_STAIRS, SMOOTH_RED_SANDSTONE(2, "RED_SANDSTONE"), @@ -1014,43 +1029,43 @@ public enum XMaterial { SNOW, SNOWBALL("SNOW_BALL"), SNOW_BLOCK, - SOUL_CAMPFIRE("1.16"), - SOUL_FIRE("1.16"), - SOUL_LANTERN("1.16"), + SOUL_CAMPFIRE(16), + SOUL_FIRE(16), + SOUL_LANTERN(16), SOUL_SAND, - SOUL_SOIL("1.16"), - SOUL_TORCH("1.16"), - SOUL_WALL_TORCH("1.16"), + SOUL_SOIL(16), + SOUL_TORCH(16), + SOUL_WALL_TORCH(16), SPAWNER("MOB_SPAWNER"), - SPECTRAL_ARROW("1.9", "ARROW", ""), + SPECTRAL_ARROW(0, 9, "ARROW", ""), SPIDER_EYE, SPIDER_SPAWN_EGG(52, "MONSTER_EGG"), SPLASH_POTION, SPONGE, SPRUCE_BOAT("BOAT_SPRUCE"), SPRUCE_BUTTON("WOOD_BUTTON"), - SPRUCE_DOOR("SPRUCE_DOOR_ITEM", "SPRUCE_DOOR"), + SPRUCE_DOOR("SPRUCE_DOOR", "SPRUCE_DOOR_ITEM"), SPRUCE_FENCE, SPRUCE_FENCE_GATE, - SPRUCE_LEAVES(1, "LEAVES"), + SPRUCE_LEAVES(1, "LEAVES", "LEAVES_2"), SPRUCE_LOG(1, "LOG"), SPRUCE_PLANKS(1, "WOOD"), SPRUCE_PRESSURE_PLATE("WOOD_PLATE"), SPRUCE_SAPLING(1, "SAPLING"), - SPRUCE_SIGN("SIGN"), - SPRUCE_SLAB(1, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"), + SPRUCE_SIGN("SIGN_POST", "SIGN"), + SPRUCE_SLAB(1, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), SPRUCE_STAIRS("SPRUCE_WOOD_STAIRS"), SPRUCE_TRAPDOOR("TRAP_DOOR"), - SPRUCE_WALL_SIGN("SIGN_POST", "WALL_SIGN"), + SPRUCE_WALL_SIGN("WALL_SIGN"), SPRUCE_WOOD(1, "LOG"), SQUID_SPAWN_EGG(94, "MONSTER_EGG"), STICK, STICKY_PISTON("PISTON_BASE", "PISTON_STICKY_BASE"), STONE, - STONECUTTER("1.14"), + STONECUTTER(14), STONE_AXE, STONE_BRICKS("SMOOTH_BRICK"), - STONE_BRICK_SLAB(4, "STEP", "STONE_SLAB", "DOUBLE_STEP"), + STONE_BRICK_SLAB(4, "DOUBLE_STEP", "STEP", "STONE_SLAB"), STONE_BRICK_STAIRS("SMOOTH_STAIRS"), STONE_BRICK_WALL, STONE_BUTTON, @@ -1058,17 +1073,18 @@ public enum XMaterial { STONE_PICKAXE, STONE_PRESSURE_PLATE("STONE_PLATE"), STONE_SHOVEL("STONE_SPADE"), - STONE_SLAB("STEP", "DOUBLE_STEP"), + STONE_SLAB("DOUBLE_STEP", "STEP"), STONE_STAIRS, STONE_SWORD, STRAY_SPAWN_EGG(6, "MONSTER_EGG"), + STRIDER_SPAWN_EGG(16), STRING, STRIPPED_ACACIA_LOG("LOG_2"), STRIPPED_ACACIA_WOOD("LOG_2"), STRIPPED_BIRCH_LOG(2, "LOG"), STRIPPED_BIRCH_WOOD(2, "LOG"), - STRIPPED_CRIMSON_HYPHAE("1.16"), - STRIPPED_CRIMSON_STEM("1.16"), + STRIPPED_CRIMSON_HYPHAE(16), + STRIPPED_CRIMSON_STEM(16), STRIPPED_DARK_OAK_LOG("LOG"), STRIPPED_DARK_OAK_WOOD("LOG"), STRIPPED_JUNGLE_LOG(3, "LOG"), @@ -1077,14 +1093,14 @@ public enum XMaterial { STRIPPED_OAK_WOOD("LOG"), STRIPPED_SPRUCE_LOG(1, "LOG"), STRIPPED_SPRUCE_WOOD(1, "LOG"), - STRIPPED_WARPED_HYPHAE("1.16"), - STRIPPED_WARPED_STEM("1.16"), + STRIPPED_WARPED_HYPHAE(16), + STRIPPED_WARPED_STEM(16), STRUCTURE_BLOCK, /** * Originally developers used barrier blocks for its purpose. * So technically this isn't really considered as a suggested material. */ - STRUCTURE_VOID("1.10", "", "BARRIER"), + STRUCTURE_VOID(10, "", "BARRIER"), SUGAR, /** * Sugar Cane is a known material in pre-1.13 @@ -1092,35 +1108,35 @@ public enum XMaterial { */ SUGAR_CANE("SUGAR_CANE_BLOCK"), SUNFLOWER("DOUBLE_PLANT"), - SUSPICIOUS_STEW("1.14", "MUSHROOM_STEW", ""), - SWEET_BERRIES("1.14"), - SWEET_BERRY_BUSH("1.14", "GRASS", ""), + SUSPICIOUS_STEW(0, 14, "MUSHROOM_STEW", ""), + SWEET_BERRIES(14), + SWEET_BERRY_BUSH(0, 14, "GRASS", ""), TALL_GRASS(2, "DOUBLE_PLANT"), - TALL_SEAGRASS(2, "1.13", "TALL_GRASS", ""), - TARGET("1.16"), + TALL_SEAGRASS(2, 13, "TALL_GRASS", ""), + TARGET(16), TERRACOTTA("HARD_CLAY"), - TIPPED_ARROW("1.9", "ARROW", ""), + TIPPED_ARROW(0, 9, "ARROW", ""), TNT, TNT_MINECART("EXPLOSIVE_MINECART"), TORCH, TOTEM_OF_UNDYING("TOTEM"), - TRADER_LLAMA_SPAWN_EGG(103, "1.14", "MONSTER_EGG", ""), + TRADER_LLAMA_SPAWN_EGG(103, 14, "MONSTER_EGG", ""), TRAPPED_CHEST, - TRIDENT("1.13"), + TRIDENT(13), TRIPWIRE, TRIPWIRE_HOOK, TROPICAL_FISH(2, "RAW_FISH"), - TROPICAL_FISH_BUCKET("1.13", "BUCKET", "WATER_BUCKET"), - TROPICAL_FISH_SPAWN_EGG("1.13", "MONSTER_EGG"), - TUBE_CORAL("1.13"), - TUBE_CORAL_BLOCK("1.13"), - TUBE_CORAL_FAN("1.13"), + TROPICAL_FISH_BUCKET(0, 13, "BUCKET", "WATER_BUCKET"), + TROPICAL_FISH_SPAWN_EGG(0, 13, "MONSTER_EGG"), + TUBE_CORAL(13), + TUBE_CORAL_BLOCK(13), + TUBE_CORAL_FAN(13), TUBE_CORAL_WALL_FAN, - TURTLE_EGG("1.13", "EGG", ""), - TURTLE_HELMET("1.13", "IRON_HELMET", ""), - TURTLE_SPAWN_EGG("1.13", "CHICKEN_SPAWN_EGG", ""), - TWISTING_VINES("1.16"), - TWISTING_VINES_PLANT("1.16"), + TURTLE_EGG(0, 13, "EGG", ""), + TURTLE_HELMET(0, 13, "IRON_HELMET", ""), + TURTLE_SPAWN_EGG(0, 13, "CHICKEN_SPAWN_EGG", ""), + TWISTING_VINES(16), + TWISTING_VINES_PLANT(16), VEX_SPAWN_EGG(35, "MONSTER_EGG"), VILLAGER_SPAWN_EGG(120, "MONSTER_EGG"), VINDICATOR_SPAWN_EGG(36, "MONSTER_EGG"), @@ -1132,25 +1148,25 @@ public enum XMaterial { */ VOID_AIR("AIR"), WALL_TORCH("TORCH"), - WANDERING_TRADER_SPAWN_EGG("1.14", "VILLAGER_SPAWN_EGG", ""), - WARPED_BUTTON("1.16"), - WARPED_DOOR("1.16"), - WARPED_FENCE("1.16"), - WARPED_FENCE_GATE("1.16"), - WARPED_FUNGUS("1.16"), - WARPED_FUNGUS_ON_A_STICK("1.16"), - WARPED_HYPHAE("1.16"), - WARPED_NYLIUM("1.16"), - WARPED_PLANKS("1.16"), - WARPED_PRESSURE_PLATE("1.16"), - WARPED_ROOTS("1.16"), - WARPED_SIGN("1.16"), - WARPED_SLAB("1.16"), - WARPED_STAIRS("1.16"), - WARPED_STEM("1.16"), - WARPED_TRAPDOOR("1.16"), - WARPED_WALL_SIGN("1.16"), - WARPED_WART_BLOCK("1.16"), + WANDERING_TRADER_SPAWN_EGG(0, 14, "VILLAGER_SPAWN_EGG", ""), + WARPED_BUTTON(16), + WARPED_DOOR(16), + WARPED_FENCE(16), + WARPED_FENCE_GATE(16), + WARPED_FUNGUS(16), + WARPED_FUNGUS_ON_A_STICK(16), + WARPED_HYPHAE(16), + WARPED_NYLIUM(16), + WARPED_PLANKS(16), + WARPED_PRESSURE_PLATE(16), + WARPED_ROOTS(16), + WARPED_SIGN(0, 16, "SIGN_POST"), + WARPED_SLAB(16), + WARPED_STAIRS(16), + WARPED_STEM(16), + WARPED_TRAPDOOR(16), + WARPED_WALL_SIGN(0, 16, "WALL_SIGN"), + WARPED_WART_BLOCK(16), /** * This is used for blocks only. * In 1.13- WATER will turn into STATIONARY_WATER after it finished spreading. @@ -1160,8 +1176,8 @@ public enum XMaterial { */ WATER("STATIONARY_WATER"), WATER_BUCKET, - WEEPING_VINES("1.16"), - WEEPING_VINES_PLANT("1.16"), + WEEPING_VINES(16), + WEEPING_VINES_PLANT(16), WET_SPONGE(1, "SPONGE"), /** * Wheat is a known material in pre-1.13 @@ -1169,13 +1185,13 @@ public enum XMaterial { */ WHEAT("CROPS"), WHEAT_SEEDS("SEEDS"), - WHITE_BANNER(15, "BANNER", "STANDING_BANNER"), + WHITE_BANNER(15, "STANDING_BANNER", "BANNER"), WHITE_BED("BED_BLOCK", "BED"), WHITE_CARPET("CARPET"), WHITE_CONCRETE("CONCRETE"), WHITE_CONCRETE_POWDER("CONCRETE_POWDER"), - WHITE_DYE(15, "1.14", "INK_SACK", "BONE_MEAL"), - WHITE_GLAZED_TERRACOTTA("1.12", "HARD_CLAY", "STAINED_CLAY"), + WHITE_DYE(15, 14, "INK_SACK", "BONE_MEAL"), + WHITE_GLAZED_TERRACOTTA(0, 12, "HARD_CLAY", "STAINED_CLAY"), WHITE_SHULKER_BOX, WHITE_STAINED_GLASS("STAINED_GLASS"), WHITE_STAINED_GLASS_PANE("THIN_GLASS", "STAINED_GLASS_PANE"), @@ -1184,7 +1200,7 @@ public enum XMaterial { WHITE_WALL_BANNER(15, "WALL_BANNER"), WHITE_WOOL("WOOL"), WITCH_SPAWN_EGG(66, "MONSTER_EGG"), - WITHER_ROSE("1.14", "BLACK_DYE", ""), + WITHER_ROSE(0, 14, "BLACK_DYE", ""), WITHER_SKELETON_SKULL(1, "SKULL", "SKULL_ITEM"), WITHER_SKELETON_SPAWN_EGG(5, "MONSTER_EGG"), WITHER_SKELETON_WALL_SKULL(1, "SKULL", "SKULL_ITEM"), @@ -1196,50 +1212,62 @@ public enum XMaterial { WOODEN_SWORD("WOOD_SWORD"), WRITABLE_BOOK("BOOK_AND_QUILL"), WRITTEN_BOOK, - YELLOW_BANNER(11, "BANNER", "STANDING_BANNER"), + YELLOW_BANNER(11, "STANDING_BANNER", "BANNER"), YELLOW_BED(4, "BED_BLOCK", "BED"), YELLOW_CARPET(4, "CARPET"), YELLOW_CONCRETE(4, "CONCRETE"), YELLOW_CONCRETE_POWDER(4, "CONCRETE_POWDER"), YELLOW_DYE(11, "INK_SACK", "DANDELION_YELLOW"), - YELLOW_GLAZED_TERRACOTTA(4, "1.12", "HARD_CLAY", "STAINED_CLAY", "YELLOW_TERRACOTTA"), + YELLOW_GLAZED_TERRACOTTA(4, 12, "HARD_CLAY", "STAINED_CLAY", "YELLOW_TERRACOTTA"), YELLOW_SHULKER_BOX, YELLOW_STAINED_GLASS(4, "STAINED_GLASS"), YELLOW_STAINED_GLASS_PANE(4, "THIN_GLASS", "STAINED_GLASS_PANE"), YELLOW_TERRACOTTA(4, "HARD_CLAY", "STAINED_CLAY"), YELLOW_WALL_BANNER(11, "WALL_BANNER"), YELLOW_WOOL(4, "WOOL"), + ZOGLIN_SPAWN_EGG(16), ZOMBIE_HEAD(2, "SKULL", "SKULL_ITEM"), ZOMBIE_HORSE_SPAWN_EGG(29, "MONSTER_EGG"), ZOMBIE_SPAWN_EGG(54, "MONSTER_EGG"), ZOMBIE_VILLAGER_SPAWN_EGG(27, "MONSTER_EGG"), ZOMBIE_WALL_HEAD(2, "SKULL", "SKULL_ITEM"), - PIGLIN_SPAWN_EGG(57, "MONSTER_EGG"), ZOMBIFIED_PIGLIN_SPAWN_EGG(57, "MONSTER_EGG", "ZOMBIE_PIGMAN_SPAWN_EGG"); /** - * An immutable cached set of {@link XMaterial#values()} to avoid allocating memory for + * Cached array of {@link XMaterial#values()} to avoid allocating memory for * calling the method every time. + * This list is unmodifiable. * * @since 2.0.0 */ - public static final EnumSet VALUES = EnumSet.allOf(XMaterial.class); + public static final XMaterial[] VALUES = values(); + /** - * A set of material names that can be damaged. + * We don't want to use {@link Enums#getIfPresent(Class, String)} to avoid a few checks. + * + * @since 5.1.0 + */ + private static final Map NAMES = new HashMap<>(); + + /** + * An array of material names that can be damaged. *

* Most of the names are not complete as this list is intended to be - * checked with {@link String#contains} for memory usage. + * checked with {@link String#contains} for memory usage and maintainability. + *

+ * New items will probably not be added to the list since they're new and it + * doesn't matter what their data value is. * * @since 1.0.0 */ - private static final ImmutableSet DAMAGEABLE = ImmutableSet.of( + private static final String[] DAMAGEABLE = { "HELMET", "CHESTPLATE", "LEGGINGS", "BOOTS", "SWORD", "AXE", "PICKAXE", "SHOVEL", "HOE", "ELYTRA", "TRIDENT", "HORSE_ARMOR", "BARDING", "SHEARS", "FLINT_AND_STEEL", "BOW", "FISHING_ROD", "CARROT_ON_A_STICK", "CARROT_STICK", "SPADE", "SHIELD" - ); + }; /** * XMaterial Paradox (Duplication Check) *

@@ -1250,30 +1278,25 @@ public enum XMaterial { * * @since 3.0.0 */ - @SuppressWarnings("UnstableApiUsage") - private static final ImmutableMap duplicated = Maps.immutableEnumMap(ImmutableMap.builder() - .put(MELON, MELON_SLICE) - .put(CARROT, CARROTS) - .put(POTATO, POTATOES) - .put(BEETROOT, BEETROOTS) - .put(BROWN_MUSHROOM, BROWN_MUSHROOM_BLOCK) - .put(BRICK, BRICKS) - .put(NETHER_BRICK, NETHER_BRICKS) - - // Illegal Elements - // Since both 1.12 and 1.13 have _DOOR XMaterial will use it - // for 1.12 to parse the material, but it needs _DOOR_ITEM. - // We'll trick XMaterial into thinking this needs to be parsed - // using the old methods. - // These materials have their enum name added to the legacy list as well. - .put(DARK_OAK_DOOR, DARK_OAK_DOOR) - .put(ACACIA_DOOR, ACACIA_DOOR) - .put(BIRCH_DOOR, BIRCH_DOOR) - .put(JUNGLE_DOOR, JUNGLE_DOOR) - .put(SPRUCE_DOOR, SPRUCE_DOOR) - - .build() - ); + private static final EnumMap DUPLICATED = new EnumMap<>(XMaterial.class); + /** + * Guava (Google Core Libraries for Java)'s cache for performance and timed caches. + * For strings that match a certain XMaterial. Mostly cached for configs. + * + * @since 1.0.0 + */ + private static final Cache NAME_CACHE = CacheBuilder.newBuilder() + .expireAfterAccess(30, TimeUnit.MINUTES) + .build(); + /** + * Guava (Google Core Libraries for Java)'s cache for performance and timed caches. + * For XMaterials that are already parsed once. + * + * @since 3.0.0 + */ + private static final Cache> PARSED_CACHE = CacheBuilder.newBuilder() + .expireAfterAccess(10, TimeUnit.MINUTES) + .build(); /* * A set of all the legacy names without duplicates. *

@@ -1288,36 +1311,24 @@ public enum XMaterial { .filter(m -> m.charAt(1) == '.') .collect(Collectors.collectingAndThen(Collectors.toSet(), ImmutableSet::copyOf)); */ - /** - * Guava (Google Core Libraries for Java)'s cache for performance and timed caches. - * For strings that match a certain XMaterial. Mostly cached for configs. + * This is used for {@link #isOneOf(Collection)} * - * @since 1.0.0 + * @since 3.4.0 */ - private static final Cache NAME_CACHE = CacheBuilder.newBuilder() - .softValues() - .expireAfterAccess(15, TimeUnit.MINUTES) - .build(); - /** - * Guava (Google Core Libraries for Java)'s cache for performance and timed caches. - * For XMaterials that are already parsed once. - * - * @since 3.0.0 - */ - private static final Cache> PARSED_CACHE = CacheBuilder.newBuilder() - .softValues() - .expireAfterAccess(10, TimeUnit.MINUTES) - .concurrencyLevel(Runtime.getRuntime().availableProcessors()) - .build(); - - /** - * Pre-compiled RegEx pattern. - * Include both replacements to avoid recreating string multiple times with multiple RegEx checks. - * - * @since 3.0.0 - */ - private static final Pattern FORMAT_PATTERN = Pattern.compile("\\W+"); + private static final LoadingCache CACHED_REGEX = CacheBuilder.newBuilder() + .expireAfterAccess(1, TimeUnit.HOURS) + .build(new CacheLoader() { + @Override + public Pattern load(@Nonnull String str) { + try { + return Pattern.compile(str); + } catch (PatternSyntaxException ex) { + ex.printStackTrace(); + return null; + } + } + }); /** * The current version of the server in the a form of a major version. * @@ -1326,17 +1337,52 @@ public enum XMaterial { private static final int VERSION = Integer.parseInt(getMajorVersion(Bukkit.getVersion()).substring(2)); /** * Cached result if the server version is after the v1.13 flattening update. - * Please don't mistake this with flat-chested people. It happened. * * @since 3.0.0 */ private static final boolean ISFLAT = supports(13); + + static { + DUPLICATED.put(MELON, MELON_SLICE); + DUPLICATED.put(CARROT, CARROTS); + DUPLICATED.put(POTATO, POTATOES); + DUPLICATED.put(BEETROOT, BEETROOTS); + DUPLICATED.put(BROWN_MUSHROOM, BROWN_MUSHROOM_BLOCK); + DUPLICATED.put(BRICK, BRICKS); + DUPLICATED.put(NETHER_BRICK, NETHER_BRICKS); + + // Illegal Elements + // Since both 1.12 and 1.13 have _DOOR XMaterial will use it + // for 1.12 to parse the material, but it needs _DOOR_ITEM. + // We'll trick XMaterial into thinking this needs to be parsed + // using the old methods. + // Some of these materials have their enum name added to the legacy list as well. + DUPLICATED.put(DARK_OAK_DOOR, DARK_OAK_DOOR); + DUPLICATED.put(ACACIA_DOOR, ACACIA_DOOR); + DUPLICATED.put(BIRCH_DOOR, BIRCH_DOOR); + DUPLICATED.put(JUNGLE_DOOR, JUNGLE_DOOR); + DUPLICATED.put(SPRUCE_DOOR, SPRUCE_DOOR); + DUPLICATED.put(CAULDRON, CAULDRON); + DUPLICATED.put(BREWING_STAND, BREWING_STAND); + DUPLICATED.put(FLOWER_POT, FLOWER_POT); + } + + static { + for (XMaterial material : VALUES) NAMES.put(material.name(), material); + } + /** * The data value of this material https://minecraft.gamepedia.com/Java_Edition_data_values/Pre-flattening * * @see #getData() */ private final byte data; + /** + * The version that this material was added in. + * + * @since 7.0.0 + */ + private final byte version; /** * A list of material names that was being used for older verions. * @@ -1344,17 +1390,26 @@ public enum XMaterial { */ private final String[] legacy; - XMaterial(int data, String... legacy) { + XMaterial(int data, int version, String... legacy) { this.data = (byte) data; + this.version = (byte) version; this.legacy = legacy; } + XMaterial(int data, String... legacy) { + this(data, 0, legacy); + } + + XMaterial(int version) { + this(0, version); + } + XMaterial() { - this(0); + this(0, 0); } XMaterial(String... legacy) { - this(0, legacy); + this(0, 0, legacy); } /** @@ -1383,7 +1438,7 @@ public enum XMaterial { * An invocation of this method yields exactly the same result as the expression: *

*

- * {@link #getVersion()} == 1.8 + * !{@link #supports(int)} 9 *
* * @since 2.0.0 @@ -1392,6 +1447,18 @@ public enum XMaterial { return !supports(9); } + /** + * Gets the {@link XMaterial} with this name without throwing an exception. + * + * @param name the name of the material. + * @return an optional that can be empty. + * @since 5.1.0 + */ + @Nonnull + private static Optional getIfPresent(@Nonnull String name) { + return Optional.ofNullable(NAMES.get(name)); + } + /** * The current version of the server. * @@ -1399,7 +1466,7 @@ public enum XMaterial { * @see #isNewVersion() * @since 2.0.0 */ - public static double getVersion() { + public static int getVersion() { return VERSION; } @@ -1427,27 +1494,6 @@ public enum XMaterial { return null; } - /** - * Checks if XMaterial enum contains a material with the given name. - *

- * You should use {@link #matchXMaterial(String)} instead if you're going - * to get the XMaterial object after checking if it's available in the list - * by doing a simple {@link Optional#isPresent()} check. - * This is just to avoid multiple loops for maximum performance. - * - * @param name name of the material. - * @return true if XMaterial enum has this material. - * @since 1.0.0 - */ - public static boolean contains(@Nonnull String name) { - Validate.notEmpty(name, "Cannot check for null or empty material name"); - name = format(name); - - for (XMaterial materials : VALUES) - if (materials.name().equals(name)) return true; - return false; - } - /** * Parses the given material name as an XMaterial with unspecified data value. * @@ -1464,13 +1510,13 @@ public enum XMaterial { /** * Parses material name and data value from the specified string. - * The seperators are: , or : + * The separator for the material name and its data value is {@code :} * Spaces are allowed. Mostly used when getting materials from config for old school minecrafters. *

* Examples *

      *     {@code INK_SACK:1 -> RED_DYE}
-     *     {@code WOOL, 14  -> RED_WOOL}
+     *     {@code WOOL: 14  -> RED_WOOL}
      * 
* * @param name the material string that consists of the material name, data and separator character. @@ -1478,14 +1524,17 @@ public enum XMaterial { * @see #matchXMaterial(String) * @since 3.0.0 */ + @Nonnull private static Optional matchXMaterialWithData(String name) { - for (char separator : new char[]{',', ':'}) { - int index = name.indexOf(separator); - if (index == -1) continue; - + int index = name.indexOf(':'); + if (index != -1) { String mat = format(name.substring(0, index)); - byte data = Byte.parseByte(StringUtils.deleteWhitespace(name.substring(index + 1))); - return matchDefinedXMaterial(mat, data); + + try { + byte data = (byte) Byte.parseByte(StringUtils.deleteWhitespace(name.substring(index + 1))); + return matchDefinedXMaterial(mat, data); + } catch (NumberFormatException ignored) { + } } return Optional.empty(); @@ -1503,7 +1552,7 @@ public enum XMaterial { public static XMaterial matchXMaterial(@Nonnull Material material) { Objects.requireNonNull(material, "Cannot match null material"); return matchDefinedXMaterial(material.name(), (byte) -1) - .orElseThrow(() -> new IllegalArgumentException("Unsupported Material With No Bytes: " + material.name())); + .orElseThrow(() -> new IllegalArgumentException("Unsupported material with no data value: " + material.name())); } /** @@ -1523,7 +1572,7 @@ public enum XMaterial { byte data = (byte) (ISFLAT || isDamageable(material) ? 0 : item.getDurability()); return matchDefinedXMaterial(material, data) - .orElseThrow(() -> new IllegalArgumentException("Unsupported Material: " + material + " (" + data + ')')); + .orElseThrow(() -> new IllegalArgumentException("Unsupported material: " + material + " (" + data + ')')); } /** @@ -1538,6 +1587,7 @@ public enum XMaterial { * @see #matchXMaterial(ItemStack) * @since 3.0.0 */ + @SuppressWarnings("OptionalAssignedToNull") @Nonnull private static Optional matchDefinedXMaterial(@Nonnull String name, byte data) { boolean duplicated = isDuplicated(name); @@ -1545,11 +1595,12 @@ public enum XMaterial { // Do basic number and boolean checks before accessing more complex enum stuff. // Maybe we can simplify (ISFLAT || !duplicated) with the (!ISFLAT && duplicated) under it to save a few nanoseconds? // if (!Boolean.valueOf(Boolean.getBoolean(Boolean.TRUE.toString())).equals(Boolean.FALSE.booleanValue())) return null; - if (data <= 0 && !duplicated) { + Optional xMaterial = null; + if (data <= 0 && (ISFLAT || !duplicated)) { // Apparently the transform method is more efficient than toJavaUtil() // toJavaUtil isn't even supported in older versions. - Optional xMat = Enums.getIfPresent(XMaterial.class, name).transform(Optional::of).or(Optional.empty()); - if (xMat.isPresent()) return xMat; + xMaterial = getIfPresent(name); + if (xMaterial.isPresent()) return xMaterial; } // XMaterial Paradox (Duplication Check) @@ -1567,7 +1618,7 @@ public enum XMaterial { // A solution for XMaterial Paradox. // Manually parses the duplicated materials to find the exact material based on the server version. // If ends with "S" -> Plural Form Material - return Enums.getIfPresent(XMaterial.class, name).transform(Optional::of).or(Optional.empty()); + return xMaterial == null ? getIfPresent(name) : xMaterial; } return Optional.ofNullable(xMat); } @@ -1586,7 +1637,7 @@ public enum XMaterial { */ private static boolean isDuplicated(@Nonnull String name) { // Don't use matchXMaterial() since this method is being called from matchXMaterial() itself and will cause a StackOverflowError. - for (Map.Entry duplicated : duplicated.entrySet()) { + for (Map.Entry duplicated : DUPLICATED.entrySet()) { XMaterial material = duplicated.getKey(); if (material.name().equals(name) || material.anyMatchLegacy(name)) return true; } @@ -1608,23 +1659,49 @@ public enum XMaterial { if (id < 0 || data < 0) return Optional.empty(); // Looping through Material.values() will take longer. - for (XMaterial materials : VALUES) + for (XMaterial materials : VALUES) { if (materials.data == data && materials.getId() == id) return Optional.of(materials); + } return Optional.empty(); } /** * Attempts to build the string like an enum name. - * Removes all the spaces, numbers and extra non-English characters. Also removes some config/in-game based strings. + * Removes all the spaces, and extra non-English characters. Also removes some config/in-game based strings. + * While this method is hard to maintain, it's extremely efficient. It's approximately more than x5 times faster than + * the normal RegEx + String Methods approach for both formatted and unformatted material names. * * @param name the material name to modify. * @return a Material enum name. * @since 2.0.0 */ @Nonnull - private static String format(@Nonnull String name) { - return FORMAT_PATTERN.matcher( - name.trim().replace('-', '_').replace(' ', '_')).replaceAll("").toUpperCase(Locale.ENGLISH); + protected static String format(@Nonnull String name) { + int len = name.length(); + char[] chs = new char[len]; + int count = 0; + boolean appendUnderline = false; + + for (int i = 0; i < len; i++) { + char ch = name.charAt(i); + + if (!appendUnderline && count != 0 && (ch == '-' || ch == ' ' || ch == '_') && chs[count] != '_') appendUnderline = true; + else { + boolean number = false; + // Old materials have numbers in them. + if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (number = (ch >= '0' && ch <= '9'))) { + if (appendUnderline) { + chs[count++] = '_'; + appendUnderline = false; + } + + if (number) chs[count++] = ch; + else chs[count++] = (char) (ch & 0x5f); + } + } + } + + return new String(chs, 0, count); } /** @@ -1710,8 +1787,9 @@ public enum XMaterial { */ public static boolean isDamageable(@Nonnull String name) { Objects.requireNonNull(name, "Material name cannot be null"); - for (String damageable : DAMAGEABLE) + for (String damageable : DAMAGEABLE) { if (name.contains(damageable)) return true; + } return false; } @@ -1751,51 +1829,35 @@ public enum XMaterial { *

* Want to learn RegEx? You can mess around in RegExr website. * - * @param material the base material to match other materials with. * @param materials the material names to check base material on. * @return true if one of the given material names is similar to the base material. * @since 3.1.1 */ - public static boolean isOneOf(@Nonnull Material material, @Nullable List materials) { + public boolean isOneOf(@Nullable Collection materials) { if (materials == null || materials.isEmpty()) return false; - Objects.requireNonNull(material, "Cannot match materials with a null material"); - String name = material.name(); + String name = this.name(); for (String comp : materials) { - comp = comp.toUpperCase(); - if (comp.startsWith("CONTAINS:")) { - comp = format(comp.substring(9)); + String checker = comp.toUpperCase(Locale.ENGLISH); + if (checker.startsWith("CONTAINS:")) { + comp = format(checker.substring(9)); if (name.contains(comp)) return true; continue; } - if (comp.startsWith("REGEX:")) { + if (checker.startsWith("REGEX:")) { comp = comp.substring(6); - if (name.matches(comp)) return true; + Pattern pattern = CACHED_REGEX.getUnchecked(comp); + if (pattern != null && pattern.matcher(name).matches()) return true; continue; } // Direct Object Equals - Optional mat = matchXMaterial(comp); - if (mat.isPresent() && mat.get().parseMaterial() == material) return true; + Optional xMat = matchXMaterial(comp); + if (xMat.isPresent() && xMat.get() == this) return true; } return false; } - /** - * Gets the version which this material was added in. - * If the material doesn't have a version it'll return 0; - * - * @return the Minecraft version which tihs material was added in. - * @since 3.0.0 - */ - public int getMaterialVersion() { - if (this.legacy.length == 0) return 0; - String version = this.legacy[0]; - if (version.charAt(1) != '.') return 0; - - return Integer.parseInt(version.substring(2)); - } - /** * Sets the {@link Material} (and data value on older versions) of an item. * Damageable materials will not have their durability changed. @@ -1810,27 +1872,14 @@ public enum XMaterial { @SuppressWarnings("deprecation") public ItemStack setType(@Nonnull ItemStack item) { Objects.requireNonNull(item, "Cannot set material for null ItemStack"); + Material material = this.parseMaterial(); + Objects.requireNonNull(material, "Unsupported material: " + this.name()); - item.setType(this.parseMaterial()); + item.setType(material); if (!ISFLAT && !this.isDamageable()) item.setDurability(this.data); return item; } - /** - * Checks if the list of given material names matches the given base material. - * Mostly used for configs. - * - * @param materials the material names to check base material on. - * @return true if one of the given material names is similar to the base material. - * @see #isOneOf(Material, List) - * @since 3.0.0 - */ - public boolean isOneOf(@Nullable List materials) { - Material material = this.parseMaterial(); - if (material == null) return false; - return isOneOf(material, materials); - } - /** * Checks if the given string matches any of this material's legacy material names. * All the values passed to this method will not be null or empty and are formatted correctly. @@ -1869,7 +1918,7 @@ public enum XMaterial { */ @SuppressWarnings("deprecation") public int getId() { - if (this.data != 0 || (this.legacy.length != 0 && Integer.parseInt(this.legacy[0].substring(2)) >= 13)) return -1; + if (this.data != 0 || (this.version >= 13)) return -1; Material material = this.parseMaterial(); return material == null ? -1 : material.getId(); } @@ -1882,7 +1931,7 @@ public enum XMaterial { * @since 2.0.0 */ public boolean isDuplicated() { - return duplicated.containsKey(this); + return DUPLICATED.containsKey(this); } /** @@ -1987,7 +2036,8 @@ public enum XMaterial { if (mat == null) mat = requestOldMaterial(suggest); } - if (mat != null) PARSED_CACHE.put(this, Optional.ofNullable(mat)); + Optional opt = Optional.ofNullable(mat); + PARSED_CACHE.put(this, opt); return mat; } @@ -2047,7 +2097,7 @@ public enum XMaterial { */ @Nonnull public List getSuggestions() { - if (this.legacy.length == 0 || this.legacy[0].charAt(1) != '.') return new ArrayList<>(); + if (this.legacy.length == 0 || this.version == 0) return new ArrayList<>(); List suggestions = new ArrayList<>(); for (String legacy : this.legacy) { if (legacy.isEmpty()) break; @@ -2067,22 +2117,14 @@ public enum XMaterial { * @since 2.0.0 */ public boolean isSupported() { - int version = this.getMaterialVersion(); - if (version != 0) return supports(version); + if (this.version != 0) return supports(this.version); Material material = Material.getMaterial(this.name()); if (material != null) return true; return requestOldMaterial(false) != null; } - /** - * Checks if the material is newly added after the 1.13 Aquatic Update. - * - * @return true if the material was newly added, otherwise false. - * @see #getMaterialVersion() - * @since 2.0.0 - */ - public boolean isFromNewSystem() { - return this.legacy.length != 0 && Integer.parseInt(this.legacy[0].substring(2)) > 13; + public byte getMaterialVersion() { + return version; } } \ No newline at end of file diff --git a/src/main/lombok/nl/SBDeveloper/V10Lift/utils/XSound.java b/src/main/lombok/nl/SBDeveloper/V10Lift/utils/XSound.java index 3ed9c54..9d4839d 100644 --- a/src/main/lombok/nl/SBDeveloper/V10Lift/utils/XSound.java +++ b/src/main/lombok/nl/SBDeveloper/V10Lift/utils/XSound.java @@ -33,13 +33,13 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; -import java.util.regex.Pattern; /** * XSound - Universal Minecraft Sound Support
@@ -57,17 +57,37 @@ import java.util.regex.Pattern; * play command: https://minecraft.gamepedia.com/Commands/play * * @author Crypto Morin - * @version 3.0.0 + * @version 4.0.0 * @see Sound */ public enum XSound { + AMBIENT_BASALT_DELTAS_ADDITIONS, + AMBIENT_BASALT_DELTAS_LOOP, + AMBIENT_BASALT_DELTAS_MOOD, AMBIENT_CAVE("AMBIENCE_CAVE"), + AMBIENT_CRIMSON_FOREST_ADDITIONS, + AMBIENT_CRIMSON_FOREST_LOOP, + AMBIENT_CRIMSON_FOREST_MOOD, + AMBIENT_NETHER_WASTES_ADDITIONS, + AMBIENT_NETHER_WASTES_LOOP, + AMBIENT_NETHER_WASTES_MOOD, + AMBIENT_SOUL_SAND_VALLEY_ADDITIONS, + AMBIENT_SOUL_SAND_VALLEY_LOOP, + AMBIENT_SOUL_SAND_VALLEY_MOOD, AMBIENT_UNDERWATER_ENTER, AMBIENT_UNDERWATER_EXIT, AMBIENT_UNDERWATER_LOOP("AMBIENT_UNDERWATER_EXIT"), AMBIENT_UNDERWATER_LOOP_ADDITIONS("AMBIENT_UNDERWATER_EXIT"), AMBIENT_UNDERWATER_LOOP_ADDITIONS_RARE("AMBIENT_UNDERWATER_EXIT"), AMBIENT_UNDERWATER_LOOP_ADDITIONS_ULTRA_RARE("AMBIENT_UNDERWATER_EXIT"), + AMBIENT_WARPED_FOREST_ADDITIONS, + AMBIENT_WARPED_FOREST_LOOP, + AMBIENT_WARPED_FOREST_MOOD, + BLOCK_ANCIENT_DEBRIS_BREAK, + BLOCK_ANCIENT_DEBRIS_FALL, + BLOCK_ANCIENT_DEBRIS_HIT, + BLOCK_ANCIENT_DEBRIS_PLACE, + BLOCK_ANCIENT_DEBRIS_STEP, BLOCK_ANVIL_BREAK("ANVIL_BREAK"), BLOCK_ANVIL_DESTROY, BLOCK_ANVIL_FALL, @@ -86,6 +106,11 @@ public enum XSound { BLOCK_BAMBOO_STEP, BLOCK_BARREL_CLOSE, BLOCK_BARREL_OPEN, + BLOCK_BASALT_BREAK, + BLOCK_BASALT_FALL, + BLOCK_BASALT_HIT, + BLOCK_BASALT_PLACE, + BLOCK_BASALT_STEP, BLOCK_BEACON_ACTIVATE, BLOCK_BEACON_AMBIENT, BLOCK_BEACON_DEACTIVATE("BLOCK_BEACON_AMBIENT"), @@ -98,6 +123,11 @@ public enum XSound { BLOCK_BELL_RESONATE, BLOCK_BELL_USE, BLOCK_BLASTFURNACE_FIRE_CRACKLE, + BLOCK_BONE_BLOCK_BREAK, + BLOCK_BONE_BLOCK_FALL, + BLOCK_BONE_BLOCK_HIT, + BLOCK_BONE_BLOCK_PLACE, + BLOCK_BONE_BLOCK_STEP, BLOCK_BREWING_STAND_BREW, BLOCK_BUBBLE_COLUMN_BUBBLE_POP, BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT, @@ -105,6 +135,11 @@ public enum XSound { BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT, BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE, BLOCK_CAMPFIRE_CRACKLE, + BLOCK_CHAIN_BREAK, + BLOCK_CHAIN_FALL, + BLOCK_CHAIN_HIT, + BLOCK_CHAIN_PLACE, + BLOCK_CHAIN_STEP, BLOCK_CHEST_CLOSE("CHEST_CLOSE", "ENTITY_CHEST_CLOSE"), BLOCK_CHEST_LOCKED, BLOCK_CHEST_OPEN("CHEST_OPEN", "ENTITY_CHEST_OPEN"), @@ -139,7 +174,17 @@ public enum XSound { BLOCK_FENCE_GATE_OPEN, BLOCK_FIRE_AMBIENT("FIRE"), BLOCK_FIRE_EXTINGUISH("FIZZ"), + BLOCK_FUNGUS_BREAK, + BLOCK_FUNGUS_FALL, + BLOCK_FUNGUS_HIT, + BLOCK_FUNGUS_PLACE, + BLOCK_FUNGUS_STEP, BLOCK_FURNACE_FIRE_CRACKLE, + BLOCK_GILDED_BLACKSTONE_BREAK, + BLOCK_GILDED_BLACKSTONE_FALL, + BLOCK_GILDED_BLACKSTONE_HIT, + BLOCK_GILDED_BLACKSTONE_PLACE, + BLOCK_GILDED_BLACKSTONE_STEP, BLOCK_GLASS_BREAK("GLASS"), BLOCK_GLASS_FALL, BLOCK_GLASS_HIT, @@ -181,6 +226,11 @@ public enum XSound { BLOCK_LAVA_POP("LAVA_POP"), BLOCK_LEVER_CLICK, BLOCK_LILY_PAD_PLACE("BLOCK_WATERLILY_PLACE"), + BLOCK_LODESTONE_BREAK, + BLOCK_LODESTONE_FALL, + BLOCK_LODESTONE_HIT, + BLOCK_LODESTONE_PLACE, + BLOCK_LODESTONE_STEP, BLOCK_METAL_BREAK, BLOCK_METAL_FALL, BLOCK_METAL_HIT, @@ -188,165 +238,6 @@ public enum XSound { BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF("BLOCK_METAL_PRESSUREPLATE_CLICK_OFF"), BLOCK_METAL_PRESSURE_PLATE_CLICK_ON("BLOCK_METAL_PRESSUREPLATE_CLICK_ON"), BLOCK_METAL_STEP, - BLOCK_NETHER_WART_BREAK, - BLOCK_NOTE_BLOCK_BANJO, - BLOCK_NOTE_BLOCK_BASEDRUM("NOTE_BASS_DRUM", "BLOCK_NOTE_BASEDRUM"), - BLOCK_NOTE_BLOCK_BASS("NOTE_BASS", "BLOCK_NOTE_BASS"), - BLOCK_NOTE_BLOCK_BELL("BLOCK_NOTE_BELL"), - BLOCK_NOTE_BLOCK_BIT, - BLOCK_NOTE_BLOCK_CHIME("BLOCK_NOTE_CHIME"), - BLOCK_NOTE_BLOCK_COW_BELL, - BLOCK_NOTE_BLOCK_DIDGERIDOO, - BLOCK_NOTE_BLOCK_FLUTE("BLOCK_NOTE_FLUTE"), - BLOCK_NOTE_BLOCK_GUITAR("NOTE_BASS_GUITAR", "BLOCK_NOTE_GUITAR"), - BLOCK_NOTE_BLOCK_HARP("NOTE_PIANO", "BLOCK_NOTE_HARP"), - BLOCK_NOTE_BLOCK_HAT("NOTE_STICKS", "BLOCK_NOTE_HAT"), - BLOCK_NOTE_BLOCK_IRON_XYLOPHONE, - BLOCK_NOTE_BLOCK_PLING("NOTE_PLING", "BLOCK_NOTE_PLING"), - BLOCK_NOTE_BLOCK_SNARE("NOTE_SNARE_DRUM", "BLOCK_NOTE_SNARE"), - BLOCK_NOTE_BLOCK_XYLOPHONE("BLOCK_NOTE_XYLOPHONE"), - BLOCK_PISTON_CONTRACT("PISTON_RETRACT"), - BLOCK_PISTON_EXTEND("PISTON_EXTEND"), - BLOCK_PORTAL_AMBIENT("PORTAL"), - BLOCK_PORTAL_TRAVEL("PORTAL_TRAVEL"), - BLOCK_PORTAL_TRIGGER("PORTAL_TRIGGER"), - BLOCK_PUMPKIN_CARVE, - BLOCK_REDSTONE_TORCH_BURNOUT, - BLOCK_SAND_BREAK("DIG_SAND"), - BLOCK_SAND_FALL, - BLOCK_SAND_HIT, - BLOCK_SAND_PLACE, - BLOCK_SAND_STEP("STEP_SAND"), - BLOCK_SCAFFOLDING_BREAK, - BLOCK_SCAFFOLDING_FALL, - BLOCK_SCAFFOLDING_HIT, - BLOCK_SCAFFOLDING_PLACE, - BLOCK_SCAFFOLDING_STEP, - BLOCK_SHULKER_BOX_CLOSE, - BLOCK_SHULKER_BOX_OPEN, - BLOCK_SLIME_BLOCK_BREAK("BLOCK_SLIME_BREAK"), - BLOCK_SLIME_BLOCK_FALL("BLOCK_SLIME_FALL"), - BLOCK_SLIME_BLOCK_HIT("BLOCK_SLIME_HIT"), - BLOCK_SLIME_BLOCK_PLACE("BLOCK_SLIME_PLACE"), - BLOCK_SLIME_BLOCK_STEP("BLOCK_SLIME_STEP"), - BLOCK_SMOKER_SMOKE, - BLOCK_SNOW_BREAK("DIG_SNOW"), - BLOCK_SNOW_FALL, - BLOCK_SNOW_HIT, - BLOCK_SNOW_PLACE, - BLOCK_SNOW_STEP("STEP_SNOW"), - BLOCK_STONE_BREAK("DIG_STONE"), - BLOCK_STONE_BUTTON_CLICK_OFF, - BLOCK_STONE_BUTTON_CLICK_ON, - BLOCK_STONE_FALL, - BLOCK_STONE_HIT, - BLOCK_STONE_PLACE, - BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF("BLOCK_STONE_PRESSUREPLATE_CLICK_OFF"), - BLOCK_STONE_PRESSURE_PLATE_CLICK_ON("BLOCK_STONE_PRESSUREPLATE_CLICK_ON"), - BLOCK_STONE_STEP("STEP_STONE"), - BLOCK_SWEET_BERRY_BUSH_BREAK, - BLOCK_SWEET_BERRY_BUSH_PLACE, - BLOCK_TRIPWIRE_ATTACH, - BLOCK_TRIPWIRE_CLICK_OFF, - BLOCK_TRIPWIRE_CLICK_ON, - BLOCK_TRIPWIRE_DETACH, - BLOCK_WATER_AMBIENT("WATER"), - BLOCK_WET_GRASS_BREAK, - BLOCK_WET_GRASS_FALL, - BLOCK_WET_GRASS_HIT, - BLOCK_WET_GRASS_PLACE("BLOCK_WET_GRASS_HIT"), - BLOCK_WET_GRASS_STEP("BLOCK_WET_GRASS_HIT"), - BLOCK_WOODEN_BUTTON_CLICK_OFF("WOOD_CLICK", "BLOCK_WOOD_BUTTON_CLICK_OFF"), - BLOCK_WOODEN_BUTTON_CLICK_ON("WOOD_CLICK", "BLOCK_WOOD_BUTTON_CLICK_ON"), - BLOCK_WOODEN_DOOR_CLOSE("DOOR_CLOSE"), - BLOCK_WOODEN_DOOR_OPEN("DOOR_OPEN"), - BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF("BLOCK_WOOD_PRESSUREPLATE_CLICK_OFF"), - BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON("BLOCK_WOOD_PRESSUREPLATE_CLICK_ON"), - BLOCK_WOODEN_TRAPDOOR_CLOSE, - BLOCK_WOODEN_TRAPDOOR_OPEN, - BLOCK_WOOD_BREAK("DIG_WOOD"), - BLOCK_WOOD_FALL, - BLOCK_WOOD_HIT, - BLOCK_WOOD_PLACE, - BLOCK_WOOD_STEP("STEP_WOOD"), - BLOCK_WOOL_BREAK("DIG_WOOL", "BLOCK_CLOTH_BREAK"), - BLOCK_WOOL_FALL, - BLOCK_WOOL_HIT("BLOCK_WOOL_FALL"), - BLOCK_WOOL_PLACE("BLOCK_WOOL_FALL"), - BLOCK_WOOL_STEP("STEP_WOOL", "BLOCK_CLOTH_STEP"), - ENCHANT_THORNS_HIT, - ENTITY_ARMOR_STAND_BREAK("ENTITY_ARMORSTAND_BREAK"), - ENTITY_ARMOR_STAND_FALL("ENTITY_ARMORSTAND_FALL"), - ENTITY_ARMOR_STAND_HIT("ENTITY_ARMORSTAND_HIT"), - ENTITY_ARMOR_STAND_PLACE("ENTITY_ARMORSTAND_PLACE"), - ENTITY_ARROW_HIT("ARROW_HIT"), - ENTITY_ARROW_HIT_PLAYER, - ENTITY_ARROW_SHOOT("SHOOT_ARROW"), - ENTITY_BAT_AMBIENT("BAT_IDLE"), - ENTITY_BAT_DEATH("BAT_DEATH"), - ENTITY_BAT_HURT("BAT_HURT"), - ENTITY_BAT_LOOP("BAT_LOOP"), - ENTITY_BAT_TAKEOFF("BAT_TAKEOFF"), - ENTITY_BEE_DEATH, - ENTITY_BEE_HURT, - ENTITY_BEE_LOOP, - ENTITY_BEE_LOOP_AGGRESSIVE, - ENTITY_BEE_POLLINATE, - ENTITY_BEE_STING, - ENTITY_BLAZE_AMBIENT("BLAZE_BREATH"), - ENTITY_BLAZE_BURN, - ENTITY_BLAZE_DEATH("BLAZE_DEATH"), - ENTITY_BLAZE_HURT("BLAZE_HIT"), - ENTITY_BLAZE_SHOOT, - ENTITY_BOAT_PADDLE_LAND, - AMBIENT_BASALT_DELTAS_ADDITIONS, - AMBIENT_BASALT_DELTAS_LOOP, - AMBIENT_BASALT_DELTAS_MOOD, - AMBIENT_CRIMSON_FOREST_ADDITIONS, - AMBIENT_CRIMSON_FOREST_LOOP, - AMBIENT_CRIMSON_FOREST_MOOD, - AMBIENT_NETHER_WASTES_ADDITIONS, - AMBIENT_NETHER_WASTES_LOOP, - AMBIENT_NETHER_WASTES_MOOD, - AMBIENT_SOUL_SAND_VALLEY_ADDITIONS, - AMBIENT_SOUL_SAND_VALLEY_LOOP, - AMBIENT_SOUL_SAND_VALLEY_MOOD, - ENTITY_BOAT_PADDLE_WATER, - ENTITY_CAT_AMBIENT("CAT_MEOW"), - ENTITY_CAT_BEG_FOR_FOOD, - AMBIENT_WARPED_FOREST_ADDITIONS, - AMBIENT_WARPED_FOREST_LOOP, - AMBIENT_WARPED_FOREST_MOOD, - BLOCK_ANCIENT_DEBRIS_BREAK, - BLOCK_ANCIENT_DEBRIS_FALL, - BLOCK_ANCIENT_DEBRIS_HIT, - BLOCK_ANCIENT_DEBRIS_PLACE, - BLOCK_ANCIENT_DEBRIS_STEP, - BLOCK_BASALT_BREAK, - BLOCK_BASALT_FALL, - BLOCK_BASALT_HIT, - BLOCK_BASALT_PLACE, - BLOCK_BASALT_STEP, - BLOCK_BONE_BLOCK_BREAK, - BLOCK_BONE_BLOCK_FALL, - BLOCK_BONE_BLOCK_HIT, - BLOCK_BONE_BLOCK_PLACE, - BLOCK_BONE_BLOCK_STEP, - BLOCK_CHAIN_BREAK, - BLOCK_CHAIN_FALL, - BLOCK_CHAIN_HIT, - BLOCK_CHAIN_PLACE, - BLOCK_CHAIN_STEP, - BLOCK_FUNGUS_BREAK, - BLOCK_FUNGUS_FALL, - BLOCK_FUNGUS_HIT, - BLOCK_FUNGUS_PLACE, - BLOCK_FUNGUS_STEP, - BLOCK_LODESTONE_BREAK, - BLOCK_LODESTONE_FALL, - BLOCK_LODESTONE_HIT, - BLOCK_LODESTONE_PLACE, - BLOCK_LODESTONE_STEP, BLOCK_NETHERITE_BLOCK_BREAK, BLOCK_NETHERITE_BLOCK_FALL, BLOCK_NETHERITE_BLOCK_HIT, @@ -377,11 +268,35 @@ public enum XSound { BLOCK_NETHER_SPROUTS_HIT, BLOCK_NETHER_SPROUTS_PLACE, BLOCK_NETHER_SPROUTS_STEP, + BLOCK_NETHER_WART_BREAK, + BLOCK_NOTE_BLOCK_BANJO, + BLOCK_NOTE_BLOCK_BASEDRUM("NOTE_BASS_DRUM", "BLOCK_NOTE_BASEDRUM"), + BLOCK_NOTE_BLOCK_BASS("NOTE_BASS", "BLOCK_NOTE_BASS"), + BLOCK_NOTE_BLOCK_BELL("BLOCK_NOTE_BELL"), + BLOCK_NOTE_BLOCK_BIT, + BLOCK_NOTE_BLOCK_CHIME("BLOCK_NOTE_CHIME"), + BLOCK_NOTE_BLOCK_COW_BELL, + BLOCK_NOTE_BLOCK_DIDGERIDOO, + BLOCK_NOTE_BLOCK_FLUTE("BLOCK_NOTE_FLUTE"), + BLOCK_NOTE_BLOCK_GUITAR("NOTE_BASS_GUITAR", "BLOCK_NOTE_GUITAR"), + BLOCK_NOTE_BLOCK_HARP("NOTE_PIANO", "BLOCK_NOTE_HARP"), + BLOCK_NOTE_BLOCK_HAT("NOTE_STICKS", "BLOCK_NOTE_HAT"), + BLOCK_NOTE_BLOCK_IRON_XYLOPHONE, + BLOCK_NOTE_BLOCK_PLING("NOTE_PLING", "BLOCK_NOTE_PLING"), + BLOCK_NOTE_BLOCK_SNARE("NOTE_SNARE_DRUM", "BLOCK_NOTE_SNARE"), + BLOCK_NOTE_BLOCK_XYLOPHONE("BLOCK_NOTE_XYLOPHONE"), BLOCK_NYLIUM_BREAK, BLOCK_NYLIUM_FALL, BLOCK_NYLIUM_HIT, BLOCK_NYLIUM_PLACE, BLOCK_NYLIUM_STEP, + BLOCK_PISTON_CONTRACT("PISTON_RETRACT"), + BLOCK_PISTON_EXTEND("PISTON_EXTEND"), + BLOCK_PORTAL_AMBIENT("PORTAL"), + BLOCK_PORTAL_TRAVEL("PORTAL_TRAVEL"), + BLOCK_PORTAL_TRIGGER("PORTAL_TRIGGER"), + BLOCK_PUMPKIN_CARVE, + BLOCK_REDSTONE_TORCH_BURNOUT, BLOCK_RESPAWN_ANCHOR_AMBIENT, BLOCK_RESPAWN_ANCHOR_CHARGE, BLOCK_RESPAWN_ANCHOR_DEPLETE, @@ -391,12 +306,35 @@ public enum XSound { BLOCK_ROOTS_HIT, BLOCK_ROOTS_PLACE, BLOCK_ROOTS_STEP, + BLOCK_SAND_BREAK("DIG_SAND"), + BLOCK_SAND_FALL, + BLOCK_SAND_HIT, + BLOCK_SAND_PLACE, + BLOCK_SAND_STEP("STEP_SAND"), + BLOCK_SCAFFOLDING_BREAK, + BLOCK_SCAFFOLDING_FALL, + BLOCK_SCAFFOLDING_HIT, + BLOCK_SCAFFOLDING_PLACE, + BLOCK_SCAFFOLDING_STEP, BLOCK_SHROOMLIGHT_BREAK, BLOCK_SHROOMLIGHT_FALL, BLOCK_SHROOMLIGHT_HIT, BLOCK_SHROOMLIGHT_PLACE, BLOCK_SHROOMLIGHT_STEP, + BLOCK_SHULKER_BOX_CLOSE, + BLOCK_SHULKER_BOX_OPEN, + BLOCK_SLIME_BLOCK_BREAK("BLOCK_SLIME_BREAK"), + BLOCK_SLIME_BLOCK_FALL("BLOCK_SLIME_FALL"), + BLOCK_SLIME_BLOCK_HIT("BLOCK_SLIME_HIT"), + BLOCK_SLIME_BLOCK_PLACE("BLOCK_SLIME_PLACE"), + BLOCK_SLIME_BLOCK_STEP("BLOCK_SLIME_STEP"), BLOCK_SMITHING_TABLE_USE, + BLOCK_SMOKER_SMOKE, + BLOCK_SNOW_BREAK("DIG_SNOW"), + BLOCK_SNOW_FALL, + BLOCK_SNOW_HIT, + BLOCK_SNOW_PLACE, + BLOCK_SNOW_STEP("STEP_SNOW"), BLOCK_SOUL_SAND_BREAK, BLOCK_SOUL_SAND_FALL, BLOCK_SOUL_SAND_HIT, @@ -412,63 +350,84 @@ public enum XSound { BLOCK_STEM_HIT, BLOCK_STEM_PLACE, BLOCK_STEM_STEP, + BLOCK_STONE_BREAK("DIG_STONE"), + BLOCK_STONE_BUTTON_CLICK_OFF, + BLOCK_STONE_BUTTON_CLICK_ON, + BLOCK_STONE_FALL, + BLOCK_STONE_HIT, + BLOCK_STONE_PLACE, + BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF("BLOCK_STONE_PRESSUREPLATE_CLICK_OFF"), + BLOCK_STONE_PRESSURE_PLATE_CLICK_ON("BLOCK_STONE_PRESSUREPLATE_CLICK_ON"), + BLOCK_STONE_STEP("STEP_STONE"), + BLOCK_SWEET_BERRY_BUSH_BREAK, + BLOCK_SWEET_BERRY_BUSH_PLACE, + BLOCK_TRIPWIRE_ATTACH, + BLOCK_TRIPWIRE_CLICK_OFF, + BLOCK_TRIPWIRE_CLICK_ON, + BLOCK_TRIPWIRE_DETACH, BLOCK_VINE_STEP, BLOCK_WART_BLOCK_BREAK, BLOCK_WART_BLOCK_FALL, BLOCK_WART_BLOCK_HIT, BLOCK_WART_BLOCK_PLACE, BLOCK_WART_BLOCK_STEP, - ENTITY_DONKEY_EAT, - ENTITY_FOX_TELEPORT, - ENTITY_HOGLIN_AMBIENT, - ENTITY_HOGLIN_ANGRY, - ENTITY_HOGLIN_ATTACK, - ENTITY_HOGLIN_CONVERTED_TO_ZOMBIFIED, - ENTITY_HOGLIN_DEATH, - ENTITY_HOGLIN_HURT, - ENTITY_HOGLIN_RETREAT, - ENTITY_HOGLIN_STEP, - ENTITY_MULE_EAT, - ENTITY_MULE_ANGRY, - ENTITY_PARROT_IMITATE_HOGLIN, - ENTITY_PARROT_IMITATE_PIGLIN, - ENTITY_PARROT_IMITATE_ZOGLIN, - ENTITY_PIGLIN_ADMIRING_ITEM, - ENTITY_PIGLIN_AMBIENT, - ENTITY_PIGLIN_ANGRY, - ENTITY_PIGLIN_CELEBRATE, - ENTITY_PIGLIN_CONVERTED_TO_ZOMBIFIED, - ENTITY_PIGLIN_DEATH, - ENTITY_PIGLIN_HURT, - ENTITY_PIGLIN_JEALOUS, - ENTITY_PIGLIN_RETREAT, - ENTITY_PIGLIN_STEP, - ENTITY_SNOW_GOLEM_SHEAR, - ENTITY_STRIDER_AMBIENT, - ENTITY_STRIDER_DEATH, - ENTITY_STRIDER_EAT, - ENTITY_STRIDER_HAPPY, - ENTITY_STRIDER_HURT, - ENTITY_STRIDER_RETREAT, - ENTITY_STRIDER_SADDLE, - ENTITY_STRIDER_STEP, - ENTITY_STRIDER_STEP_LAVA, - ENTITY_ZOGLIN_AMBIENT, - ENTITY_ZOGLIN_ANGRY, - ENTITY_ZOGLIN_ATTACK, - ENTITY_ZOGLIN_DEATH, - ENTITY_ZOGLIN_HURT, - ENTITY_ZOGLIN_STEP, + BLOCK_WATER_AMBIENT("WATER"), BLOCK_WEEPING_VINES_BREAK, BLOCK_WEEPING_VINES_FALL, BLOCK_WEEPING_VINES_HIT, BLOCK_WEEPING_VINES_PLACE, BLOCK_WEEPING_VINES_STEP, - BLOCK_GILDED_BLACKSTONE_BREAK, - BLOCK_GILDED_BLACKSTONE_FALL, - BLOCK_GILDED_BLACKSTONE_HIT, - BLOCK_GILDED_BLACKSTONE_PLACE, - BLOCK_GILDED_BLACKSTONE_STEP, + BLOCK_WET_GRASS_BREAK, + BLOCK_WET_GRASS_FALL, + BLOCK_WET_GRASS_HIT, + BLOCK_WET_GRASS_PLACE("BLOCK_WET_GRASS_HIT"), + BLOCK_WET_GRASS_STEP("BLOCK_WET_GRASS_HIT"), + BLOCK_WOODEN_BUTTON_CLICK_OFF("WOOD_CLICK", "BLOCK_WOOD_BUTTON_CLICK_OFF"), + BLOCK_WOODEN_BUTTON_CLICK_ON("WOOD_CLICK", "BLOCK_WOOD_BUTTON_CLICK_ON"), + BLOCK_WOODEN_DOOR_CLOSE("DOOR_CLOSE"), + BLOCK_WOODEN_DOOR_OPEN("DOOR_OPEN"), + BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF("BLOCK_WOOD_PRESSUREPLATE_CLICK_OFF"), + BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON("BLOCK_WOOD_PRESSUREPLATE_CLICK_ON"), + BLOCK_WOODEN_TRAPDOOR_CLOSE, + BLOCK_WOODEN_TRAPDOOR_OPEN, + BLOCK_WOOD_BREAK("DIG_WOOD"), + BLOCK_WOOD_FALL, + BLOCK_WOOD_HIT, + BLOCK_WOOD_PLACE, + BLOCK_WOOD_STEP("STEP_WOOD"), + BLOCK_WOOL_BREAK("DIG_WOOL", "BLOCK_CLOTH_BREAK"), + BLOCK_WOOL_FALL, + BLOCK_WOOL_HIT("BLOCK_WOOL_FALL"), + BLOCK_WOOL_PLACE("BLOCK_WOOL_FALL"), + BLOCK_WOOL_STEP("STEP_WOOL", "BLOCK_CLOTH_STEP"), + ENCHANT_THORNS_HIT, + ENTITY_ARMOR_STAND_BREAK("ENTITY_ARMORSTAND_BREAK"), + ENTITY_ARMOR_STAND_FALL("ENTITY_ARMORSTAND_FALL"), + ENTITY_ARMOR_STAND_HIT("ENTITY_ARMORSTAND_HIT"), + ENTITY_ARMOR_STAND_PLACE("ENTITY_ARMORSTAND_PLACE"), + ENTITY_ARROW_HIT("ARROW_HIT"), + ENTITY_ARROW_HIT_PLAYER("SUCCESSFUL_HIT"), + ENTITY_ARROW_SHOOT("SHOOT_ARROW"), + ENTITY_BAT_AMBIENT("BAT_IDLE"), + ENTITY_BAT_DEATH("BAT_DEATH"), + ENTITY_BAT_HURT("BAT_HURT"), + ENTITY_BAT_LOOP("BAT_LOOP"), + ENTITY_BAT_TAKEOFF("BAT_TAKEOFF"), + ENTITY_BEE_DEATH, + ENTITY_BEE_HURT, + ENTITY_BEE_LOOP, + ENTITY_BEE_LOOP_AGGRESSIVE, + ENTITY_BEE_POLLINATE, + ENTITY_BEE_STING, + ENTITY_BLAZE_AMBIENT("BLAZE_BREATH"), + ENTITY_BLAZE_BURN, + ENTITY_BLAZE_DEATH("BLAZE_DEATH"), + ENTITY_BLAZE_HURT("BLAZE_HIT"), + ENTITY_BLAZE_SHOOT, + ENTITY_BOAT_PADDLE_LAND, + ENTITY_BOAT_PADDLE_WATER, + ENTITY_CAT_AMBIENT("CAT_MEOW"), + ENTITY_CAT_BEG_FOR_FOOD, ENTITY_CAT_DEATH, ENTITY_CAT_EAT, ENTITY_CAT_HISS("CAT_HISS"), @@ -507,6 +466,7 @@ public enum XSound { ENTITY_DONKEY_ANGRY("DONKEY_ANGRY"), ENTITY_DONKEY_CHEST, ENTITY_DONKEY_DEATH("DONKEY_DEATH"), + ENTITY_DONKEY_EAT, ENTITY_DONKEY_HURT("DONKEY_HIT"), ENTITY_DRAGON_FIREBALL_EXPLODE("ENTITY_ENDERDRAGON_FIREBALL_EXPLODE"), ENTITY_DROWNED_AMBIENT, @@ -579,6 +539,7 @@ public enum XSound { ENTITY_FOX_SLEEP, ENTITY_FOX_SNIFF, ENTITY_FOX_SPIT, + ENTITY_FOX_TELEPORT, ENTITY_GENERIC_BIG_FALL("FALL_BIG"), ENTITY_GENERIC_BURN, ENTITY_GENERIC_DEATH, @@ -604,6 +565,14 @@ public enum XSound { ENTITY_GUARDIAN_FLOP, ENTITY_GUARDIAN_HURT, ENTITY_GUARDIAN_HURT_LAND, + ENTITY_HOGLIN_AMBIENT, + ENTITY_HOGLIN_ANGRY, + ENTITY_HOGLIN_ATTACK, + ENTITY_HOGLIN_CONVERTED_TO_ZOMBIFIED, + ENTITY_HOGLIN_DEATH, + ENTITY_HOGLIN_HURT, + ENTITY_HOGLIN_RETREAT, + ENTITY_HOGLIN_STEP, ENTITY_HORSE_AMBIENT("HORSE_IDLE"), ENTITY_HORSE_ANGRY("HORSE_ANGRY"), ENTITY_HORSE_ARMOR("HORSE_ARMOR"), @@ -677,8 +646,10 @@ public enum XSound { ENTITY_MOOSHROOM_SHEAR, ENTITY_MOOSHROOM_SUSPICIOUS_MILK, ENTITY_MULE_AMBIENT, + ENTITY_MULE_ANGRY, ENTITY_MULE_CHEST("ENTITY_MULE_AMBIENT"), ENTITY_MULE_DEATH("ENTITY_MULE_AMBIENT"), + ENTITY_MULE_EAT, ENTITY_MULE_HURT("ENTITY_MULE_AMBIENT"), ENTITY_OCELOT_AMBIENT, ENTITY_OCELOT_DEATH, @@ -705,17 +676,25 @@ public enum XSound { ENTITY_PARROT_IMITATE_CREEPER, ENTITY_PARROT_IMITATE_DROWNED, ENTITY_PARROT_IMITATE_ELDER_GUARDIAN, + /** + * Removed in 1.15 + */ ENTITY_PARROT_IMITATE_ENDERMAN, ENTITY_PARROT_IMITATE_ENDERMITE, ENTITY_PARROT_IMITATE_ENDER_DRAGON, ENTITY_PARROT_IMITATE_EVOKER, ENTITY_PARROT_IMITATE_GHAST, ENTITY_PARROT_IMITATE_GUARDIAN, + ENTITY_PARROT_IMITATE_HOGLIN, ENTITY_PARROT_IMITATE_HUSK, ENTITY_PARROT_IMITATE_ILLUSIONER, ENTITY_PARROT_IMITATE_MAGMA_CUBE, ENTITY_PARROT_IMITATE_PHANTOM, + ENTITY_PARROT_IMITATE_PIGLIN, ENTITY_PARROT_IMITATE_PILLAGER, + /** + * Removed in 1.15 + */ ENTITY_PARROT_IMITATE_POLAR_BEAR, ENTITY_PARROT_IMITATE_RAVAGER, ENTITY_PARROT_IMITATE_SHULKER, @@ -729,7 +708,11 @@ public enum XSound { ENTITY_PARROT_IMITATE_WITCH, ENTITY_PARROT_IMITATE_WITHER, ENTITY_PARROT_IMITATE_WITHER_SKELETON, + /** + * Removed in 1.15 + */ ENTITY_PARROT_IMITATE_WOLF, + ENTITY_PARROT_IMITATE_ZOGLIN, ENTITY_PARROT_IMITATE_ZOMBIE, ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER, ENTITY_PARROT_STEP, @@ -739,6 +722,16 @@ public enum XSound { ENTITY_PHANTOM_FLAP, ENTITY_PHANTOM_HURT, ENTITY_PHANTOM_SWOOP, + ENTITY_PIGLIN_ADMIRING_ITEM, + ENTITY_PIGLIN_AMBIENT, + ENTITY_PIGLIN_ANGRY, + ENTITY_PIGLIN_CELEBRATE, + ENTITY_PIGLIN_CONVERTED_TO_ZOMBIFIED, + ENTITY_PIGLIN_DEATH, + ENTITY_PIGLIN_HURT, + ENTITY_PIGLIN_JEALOUS, + ENTITY_PIGLIN_RETREAT, + ENTITY_PIGLIN_STEP, ENTITY_PIG_AMBIENT("PIG_IDLE"), ENTITY_PIG_DEATH("PIG_DEATH"), ENTITY_PIG_HURT, @@ -842,6 +835,7 @@ public enum XSound { ENTITY_SNOW_GOLEM_AMBIENT("ENTITY_SNOWMAN_AMBIENT"), ENTITY_SNOW_GOLEM_DEATH("ENTITY_SNOWMAN_DEATH"), ENTITY_SNOW_GOLEM_HURT("ENTITY_SNOWMAN_HURT"), + ENTITY_SNOW_GOLEM_SHEAR, ENTITY_SNOW_GOLEM_SHOOT("ENTITY_SNOWMAN_SHOOT"), ENTITY_SPIDER_AMBIENT("SPIDER_IDLE"), ENTITY_SPIDER_DEATH("SPIDER_DEATH"), @@ -857,6 +851,15 @@ public enum XSound { ENTITY_STRAY_DEATH, ENTITY_STRAY_HURT, ENTITY_STRAY_STEP, + ENTITY_STRIDER_AMBIENT, + ENTITY_STRIDER_DEATH, + ENTITY_STRIDER_EAT, + ENTITY_STRIDER_HAPPY, + ENTITY_STRIDER_HURT, + ENTITY_STRIDER_RETREAT, + ENTITY_STRIDER_SADDLE, + ENTITY_STRIDER_STEP, + ENTITY_STRIDER_STEP_LAVA, ENTITY_TNT_PRIMED("FUSE"), ENTITY_TROPICAL_FISH_AMBIENT, ENTITY_TROPICAL_FISH_DEATH, @@ -937,6 +940,12 @@ public enum XSound { ENTITY_WOLF_SHAKE("WOLF_SHAKE"), ENTITY_WOLF_STEP("WOLF_WALK"), ENTITY_WOLF_WHINE("WOLF_WHINE"), + ENTITY_ZOGLIN_AMBIENT, + ENTITY_ZOGLIN_ANGRY, + ENTITY_ZOGLIN_ATTACK, + ENTITY_ZOGLIN_DEATH, + ENTITY_ZOGLIN_HURT, + ENTITY_ZOGLIN_STEP, ENTITY_ZOMBIE_AMBIENT("ZOMBIE_IDLE"), ENTITY_ZOMBIE_ATTACK_IRON_DOOR("ZOMBIE_METAL"), ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR("ZOMBIE_WOOD", "ENTITY_ZOMBIE_ATTACK_DOOR_WOOD"), @@ -949,21 +958,18 @@ public enum XSound { ENTITY_ZOMBIE_HORSE_HURT("HORSE_ZOMBIE_HIT"), ENTITY_ZOMBIE_HURT("ZOMBIE_HURT"), ENTITY_ZOMBIE_INFECT("ZOMBIE_INFECT"), - ITEM_ARMOR_EQUIP_NETHERITE, - ITEM_LODESTONE_COMPASS_LOCK, - MUSIC_DISC_PIGSTEP, - - ENTITY_ZOMBIFIED_PIGLIN_AMBIENT("ZOMBE_PIG_IDLE", "ENTITY_ZOMBIE_PIG_AMBIENT", "ENTITY_ZOMBIE_PIGMAN_AMBIENT"), - ENTITY_ZOMBIFIED_PIGLIN_ANGRY("ZOMBIE_PIG_ANGRY", "ENTITY_ZOMBIE_PIG_ANGRY", "ENTITY_ZOMBIE_PIGMAN_ANGRY"), - ENTITY_ZOMBIFIED_PIGLIN_DEATH("ZOMBIE_PIG_DEATH", "ENTITY_ZOMBIE_PIG_DEATH", "ENTITY_ZOMBIE_PIGMAN_DEATH"), - ENTITY_ZOMBIFIED_PIGLIN_HURT("ZOMBIE_PIG_HURT", "ENTITY_ZOMBIE_PIG_HURT", "ENTITY_ZOMBIE_PIGMAN_HURT"), ENTITY_ZOMBIE_STEP("ZOMBIE_WALK"), ENTITY_ZOMBIE_VILLAGER_AMBIENT, ENTITY_ZOMBIE_VILLAGER_CONVERTED("ZOMBIE_UNFECT"), + ENTITY_ZOMBIE_VILLAGER_CURE("ZOMBIE_REMEDY"), ENTITY_ZOMBIE_VILLAGER_DEATH, ENTITY_ZOMBIE_VILLAGER_HURT, ENTITY_ZOMBIE_VILLAGER_STEP, + ENTITY_ZOMBIFIED_PIGLIN_AMBIENT("ZOMBE_PIG_IDLE", "ENTITY_ZOMBIE_PIG_AMBIENT", "ENTITY_ZOMBIE_PIGMAN_AMBIENT"), + ENTITY_ZOMBIFIED_PIGLIN_ANGRY("ZOMBIE_PIG_ANGRY", "ENTITY_ZOMBIE_PIG_ANGRY", "ENTITY_ZOMBIE_PIGMAN_ANGRY"), + ENTITY_ZOMBIFIED_PIGLIN_DEATH("ZOMBIE_PIG_DEATH", "ENTITY_ZOMBIE_PIG_DEATH", "ENTITY_ZOMBIE_PIGMAN_DEATH"), + ENTITY_ZOMBIFIED_PIGLIN_HURT("ZOMBIE_PIG_HURT", "ENTITY_ZOMBIE_PIG_HURT", "ENTITY_ZOMBIE_PIGMAN_HURT"), EVENT_RAID_HORN, ITEM_ARMOR_EQUIP_CHAIN, ITEM_ARMOR_EQUIP_DIAMOND, @@ -972,6 +978,7 @@ public enum XSound { ITEM_ARMOR_EQUIP_GOLD, ITEM_ARMOR_EQUIP_IRON, ITEM_ARMOR_EQUIP_LEATHER, + ITEM_ARMOR_EQUIP_NETHERITE, ITEM_ARMOR_EQUIP_TURTLE, ITEM_AXE_STRIP, ITEM_BOOK_PAGE_TURN, @@ -1000,6 +1007,7 @@ public enum XSound { ITEM_FLINTANDSTEEL_USE("FIRE_IGNITE"), ITEM_HOE_TILL, ITEM_HONEY_BOTTLE_DRINK, + ITEM_LODESTONE_COMPASS_LOCK, ITEM_NETHER_WART_PLANT, ITEM_SHIELD_BLOCK, ITEM_SHIELD_BREAK, @@ -1024,6 +1032,7 @@ public enum XSound { MUSIC_DISC_FAR("RECORD_FAR"), MUSIC_DISC_MALL("RECORD_MALL"), MUSIC_DISC_MELLOHI("RECORD_MELLOHI"), + MUSIC_DISC_PIGSTEP, MUSIC_DISC_STAL("RECORD_STAL"), MUSIC_DISC_STRAD("RECORD_STRAD"), MUSIC_DISC_WAIT("RECORD_WAIT"), @@ -1033,12 +1042,12 @@ public enum XSound { MUSIC_GAME, MUSIC_MENU, MUSIC_NETHER_BASALT_DELTAS("MUSIC_NETHER"), - PARTICLE_SOUL_ESCAPE, MUSIC_NETHER_CRIMSON_FOREST, MUSIC_NETHER_NETHER_WASTES, MUSIC_NETHER_SOUL_SAND_VALLEY, MUSIC_NETHER_WARPED_FOREST, MUSIC_UNDER_WATER, + PARTICLE_SOUL_ESCAPE, UI_BUTTON_CLICK("CLICK"), UI_CARTOGRAPHY_TABLE_TAKE_RESULT, UI_LOOM_SELECT_PATTERN, @@ -1053,12 +1062,14 @@ public enum XSound { /** - * An immutable cached list of {@link XSound#values()} to avoid allocating memory for + * Cached list of {@link XSound#values()} to avoid allocating memory for * calling the method every time. + * This list is unmodifiable. * * @since 2.0.0 */ - public static final EnumSet VALUES = EnumSet.allOf(XSound.class); + public static final XSound[] VALUES = values(); + /** * Guava (Google Core Libraries for Java)'s cache for performance and timed caches. * Caches the parsed {@link Sound} objects instead of string. Because it has to go through catching exceptions again @@ -1067,18 +1078,33 @@ public enum XSound { * * @since 2.0.0 */ - private static final Cache> CACHE = CacheBuilder.newBuilder() + private static final Cache> CACHE = CacheBuilder.newBuilder() .expireAfterAccess(10, TimeUnit.MINUTES) - .softValues() .build(); + /** - * Pre-compiled RegEx pattern. - * Include both replacements to avoid creating string multiple times and multiple RegEx checks. + * We don't want to use {@link Enums#getIfPresent(Class, String)} to avoid a few checks. * - * @since 1.0.0 + * @since 3.1.0 */ - private static final Pattern FORMAT_PATTERN = Pattern.compile("\\d+|\\W+"); - private static final Pattern DOUBLE_SPACE = Pattern.compile(" +"); + private static final Map NAMES = new HashMap<>(); + /** + * Since {@link Sound} doesn't provde a method to get a sound from a method like {@link Material#getMaterial(String)} + * + * @since 3.1.0 + */ + private static final Map BUKKIT_NAMES = new HashMap<>(); + + static { + for (Sound sound : Sound.values()) BUKKIT_NAMES.put(sound.name(), sound); + for (XSound sound : VALUES) { + NAMES.put(sound.name(), sound); + for (String legacy : sound.getLegacy()) { + NAMES.putIfAbsent(legacy, sound); + } + } + } + private final String[] legacy; XSound(String... legacy) { @@ -1088,6 +1114,8 @@ public enum XSound { /** * Attempts to build the string like an enum name.
* Removes all the spaces, numbers and extra non-English characters. Also removes some config/in-game based strings. + * While this method is hard to maintain, it's extremely efficient. It's approximately more than x5 times faster than + * the normal RegEx + String Methods approach for both formatted and unformatted material names. * * @param name the sound name to modify. * @return a Sound enum name. @@ -1095,24 +1123,30 @@ public enum XSound { */ @Nonnull private static String format(@Nonnull String name) { - return FORMAT_PATTERN.matcher( - name.trim().replace('-', '_').replace(' ', '_')).replaceAll("").toUpperCase(Locale.ENGLISH); - } + int len = name.length(); + char[] chs = new char[len]; + int count = 0; + boolean appendUnderline = false; - /** - * Checks if XSound enum and the legacy names contains a sound with this name. - * - * @param sound name of the sound - * @return true if XSound enum has this sound. - * @since 1.0.0 - */ - public static boolean contains(@Nonnull String sound) { - Validate.notEmpty(sound, "Cannot check for null or empty sound name"); - sound = format(sound); + for (int i = 0; i < len; i++) { + char ch = name.charAt(i); - for (XSound sounds : VALUES) - if (sounds.name().equals(sound) || sounds.anyMatchLegacy(sound)) return true; - return false; + if (!appendUnderline && count != 0 && (ch == '-' || ch == ' ' || ch == '_') && chs[count] != '_') appendUnderline = true; + else { + boolean number = false; + if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) { + if (appendUnderline) { + chs[count++] = '_'; + appendUnderline = false; + } + + if (number) chs[count++] = ch; + else chs[count++] = (char) (ch & 0x5f); + } + } + } + + return new String(chs, 0, count); } /** @@ -1125,11 +1159,7 @@ public enum XSound { @Nonnull public static Optional matchXSound(@Nonnull String sound) { Validate.notEmpty(sound, "Cannot match XSound of a null or empty sound name"); - sound = format(sound); - - for (XSound sounds : VALUES) - if (sounds.name().equals(sound) || sounds.anyMatchLegacy(sound)) return Optional.of(sounds); - return Optional.empty(); + return getIfPresent(format(sound)); } /** @@ -1151,8 +1181,8 @@ public enum XSound { * @see #play(Location, String) * @since 1.0.0 */ - @Nonnull - public static CompletableFuture play(@Nullable Player player, @Nullable String sound) { + @Nullable + public static CompletableFuture play(@Nonnull Player player, @Nullable String sound) { Objects.requireNonNull(player, "Cannot play sound to null player"); return parse(player, player.getLocation(), sound, true); } @@ -1161,7 +1191,7 @@ public enum XSound { * @see #play(Location, String) * @since 3.0.0 */ - @Nonnull + @Nullable public static CompletableFuture play(@Nonnull Location location, @Nullable String sound) { return parse(null, location, sound, true); } @@ -1204,21 +1234,20 @@ public enum XSound { * @param play if the sound should be played right away. * @since 3.0.0 */ - @Nonnull + @Nullable public static CompletableFuture parse(@Nullable Player player, @Nonnull Location location, @Nullable String sound, boolean play) { - Objects.requireNonNull(player, "Cannot play sound to null location"); + Objects.requireNonNull(location, "Cannot play sound to null location"); if (Strings.isNullOrEmpty(sound) || sound.equalsIgnoreCase("none")) return null; return CompletableFuture.supplyAsync(() -> { - String[] split = StringUtils.contains(sound, ',') ? - StringUtils.split(StringUtils.deleteWhitespace(sound), ',') : - StringUtils.split(DOUBLE_SPACE.matcher(sound).replaceAll(" "), ' '); + String[] split = StringUtils.split(StringUtils.deleteWhitespace(sound), ','); + if (split.length == 0) split = StringUtils.split(sound, ' '); String name = split[0]; - boolean playForEveryone = player == null; - if (!playForEveryone && StringUtils.startsWithIgnoreCase(name, "loc:")) { + boolean playAtLocation = player == null; + if (!playAtLocation && StringUtils.startsWithIgnoreCase(name, "loc:")) { name = name.substring(4); - playForEveryone = true; + playAtLocation = true; } Optional typeOpt = matchXSound(name); if (!typeOpt.isPresent()) return null; @@ -1236,7 +1265,7 @@ public enum XSound { } catch (NumberFormatException ignored) { } - Record record = new Record(type, player, location, volume, pitch, playForEveryone); + Record record = new Record(type, player, location, volume, pitch, playAtLocation); if (play) record.play(); return record; }).exceptionally((ex) -> { @@ -1258,17 +1287,19 @@ public enum XSound { * @see #stopSound(Player) * @since 2.0.0 */ + @Nonnull public static CompletableFuture stopMusic(@Nonnull Player player) { Objects.requireNonNull(player, "Cannot stop playing musics from null player"); - // We don't need to cache because it's rarely used. - EnumSet musics = EnumSet.of(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_BASALT_DELTAS, MUSIC_UNDER_WATER); - return CompletableFuture.runAsync(() -> { + // We don't need to cache because it's rarely used. + XSound[] musics = {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_BASALT_DELTAS, MUSIC_UNDER_WATER, + MUSIC_NETHER_CRIMSON_FOREST, MUSIC_NETHER_WARPED_FOREST}; + for (XSound music : musics) { Sound sound = music.parseSound(); if (sound != null) player.stopSound(sound); @@ -1276,6 +1307,18 @@ public enum XSound { }); } + /** + * Gets the {@link XSound} with this name without throwing an exception. + * + * @param name the name of the sound. + * @return an optional that can be empty. + * @since 5.1.0 + */ + @Nonnull + private static Optional getIfPresent(@Nonnull String name) { + return Optional.ofNullable(NAMES.get(name)); + } + /** * In most cases your should be using {@link #name()} instead. * @@ -1304,26 +1347,26 @@ public enum XSound { * @since 1.0.0 */ @Nullable - @SuppressWarnings({"Guava", "OptionalAssignedToNull"}) + @SuppressWarnings("OptionalAssignedToNull") public Sound parseSound() { - com.google.common.base.Optional cachedSound = CACHE.getIfPresent(this); - if (cachedSound != null) return cachedSound.orNull(); - com.google.common.base.Optional sound; + Optional cachedSound = CACHE.getIfPresent(this); + if (cachedSound != null) return cachedSound.orElse(null); + Sound sound; // Since Sound class doesn't have a getSound() method we'll use Guava so // it can cache it for us. - sound = Enums.getIfPresent(Sound.class, this.name()); + sound = BUKKIT_NAMES.get(this.name()); - if (!sound.isPresent()) { + if (sound == null) { for (String legacy : this.legacy) { - sound = Enums.getIfPresent(Sound.class, legacy); - if (sound.isPresent()) break; + sound = BUKKIT_NAMES.get(legacy); + if (sound != null) break; } } // Put nulls too, because there's no point of parsing them again if it's going to give us null again. - CACHE.put(this, sound); - return sound.orNull(); + CACHE.put(this, Optional.ofNullable(sound)); + return sound; } /** @@ -1342,18 +1385,6 @@ public enum XSound { return this.parseSound() != null; } - /** - * Checks if the given string matches any of this sound's legacy sound names. - * - * @param name the sound name to check - * @return true if it's one of the legacy names. - * @since 1.0.0 - */ - public boolean anyMatchLegacy(@Nonnull String name) { - Validate.notEmpty(name, "Cannot check for legacy name for null or empty sound name"); - return Arrays.asList(this.legacy).contains(format(name)); - } - /** * Plays a sound repeatedly with the given delay at a moving target's location. * @@ -1366,14 +1397,15 @@ public enum XSound { * @see #play(Location, float, float) * @since 2.0.0 */ - public void playRepeatedly(JavaPlugin plugin, Entity entity, float volume, float pitch, int repeat, int delay) { + @Nonnull + public BukkitTask playRepeatedly(@Nonnull JavaPlugin plugin, @Nonnull Entity entity, float volume, float pitch, int repeat, int delay) { Objects.requireNonNull(plugin, "Cannot play repeating sound from null plugin"); Objects.requireNonNull(entity, "Cannot play repeating sound at null location"); Validate.isTrue(repeat > 0, "Cannot repeat playing sound " + repeat + " times"); Validate.isTrue(delay > 0, "Delay ticks must be at least 1"); - new BukkitRunnable() { + return new BukkitRunnable() { int repeating = repeat; @Override @@ -1396,7 +1428,8 @@ public enum XSound { * @param delay the delay between each play. * @since 2.0.0 */ - public void playAscendingNote(@Nonnull JavaPlugin plugin, @Nonnull Player player, @Nonnull Entity playTo, Instrument instrument, int ascendLevel, int delay) { + @Nonnull + public BukkitTask playAscendingNote(@Nonnull JavaPlugin plugin, @Nonnull Player player, @Nonnull Entity playTo, @Nonnull Instrument instrument, int ascendLevel, int delay) { Objects.requireNonNull(player, "Cannot play note from null player"); Objects.requireNonNull(playTo, "Cannot play note to null entity"); @@ -1404,7 +1437,7 @@ public enum XSound { Validate.isTrue(ascendLevel <= 7, "Note ascend level cannot be greater than 7"); Validate.isTrue(delay > 0, "Delay ticks must be at least 1"); - new BukkitRunnable() { + return new BukkitRunnable() { int repeating = ascendLevel; @Override @@ -1496,7 +1529,7 @@ public enum XSound { public final float pitch; public final boolean playAtLocation; - public Record(Sound sound, Player player, Location location, float volume, float pitch, boolean playAtLocation) { + public Record(@Nonnull Sound sound, @Nullable Player player, @Nonnull Location location, float volume, float pitch, boolean playAtLocation) { this.sound = sound; this.player = player; this.location = location;