diff --git a/pom.xml b/pom.xml index 699ff3b..45c2e54 100644 --- a/pom.xml +++ b/pom.xml @@ -6,14 +6,13 @@ nl.SBDeveloper ThemeParkPlus - 2.1.4 + 3.0.0 jar ThemeParkPlus Plus version of ThemePark! - 1.8 UTF-8 https://sbdplugins.nl @@ -26,8 +25,7 @@ maven-compiler-plugin 3.8.1 - ${java.version} - ${java.version} + 11 @@ -83,7 +81,7 @@ maven-javadoc-plugin 3.2.0 - 8 + 11 nl/sbdeveloper/themeparkplus/api/*.java nl/sbdeveloper/themeparkplus/api/enums/*.java @@ -128,15 +126,15 @@ org.spigotmc spigot-api - 1.16.4-R0.1-SNAPSHOT + 1.17-R0.1-SNAPSHOT provided me.paradoxpixel themepark - 2.1.3 + 3.0.0 system - ${pom.basedir}/src/lib/themepark-2.1.3.jar + ${pom.basedir}/src/lib/themepark-3.0.0.jar org.projectlombok diff --git a/src/lib/themepark-2.1.3.jar b/src/lib/themepark-2.1.3.jar deleted file mode 100644 index 4e3ba38..0000000 Binary files a/src/lib/themepark-2.1.3.jar and /dev/null differ diff --git a/src/lib/themepark-3.0.0.jar b/src/lib/themepark-3.0.0.jar new file mode 100644 index 0000000..64f4c50 Binary files /dev/null and b/src/lib/themepark-3.0.0.jar differ diff --git a/src/main/lombok/nl/sbdeveloper/themeparkplus/api/PlusAPI.java b/src/main/lombok/nl/sbdeveloper/themeparkplus/api/PlusAPI.java index 514b198..42af8a1 100644 --- a/src/main/lombok/nl/sbdeveloper/themeparkplus/api/PlusAPI.java +++ b/src/main/lombok/nl/sbdeveloper/themeparkplus/api/PlusAPI.java @@ -173,7 +173,7 @@ public class PlusAPI { * @return The ticket as ItemStack */ @Nullable - public static ItemStack getFastpassTicket(nl.iobyte.themepark.api.attraction.Attraction att) { + public static ItemStack getFastpassTicket(nl.iobyte.themepark.api.attraction.objects.Attraction att) { String ticketName = ConfigUtil.makecolored(ThemeParkPlus.getSConfig().getFile().getString("Fastpass.Item.DisplayName")); ItemStack ticket = XMaterial.PAPER.parseItem(); @@ -186,7 +186,7 @@ public class PlusAPI { ticket.setItemMeta(meta); NBTItem item = new NBTItem(ticket); - item.setString("RideID", att.getId()); + item.setString("RideID", att.getID()); ticket = item.getItem(); return ticket; } diff --git a/src/main/lombok/nl/sbdeveloper/themeparkplus/commands/TPPTabComplete.java b/src/main/lombok/nl/sbdeveloper/themeparkplus/commands/TPPTabComplete.java index b5926d5..af8c217 100644 --- a/src/main/lombok/nl/sbdeveloper/themeparkplus/commands/TPPTabComplete.java +++ b/src/main/lombok/nl/sbdeveloper/themeparkplus/commands/TPPTabComplete.java @@ -1,6 +1,6 @@ package nl.sbdeveloper.themeparkplus.commands; -import nl.iobyte.themepark.api.API; +import nl.iobyte.themepark.ThemePark; import nl.sbdeveloper.themeparkplus.api.enums.WalkingDirection; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -40,7 +40,7 @@ public class TPPTabComplete implements TabCompleter { return StringUtil.copyPartialMatches(args[1], Collections.singletonList("" + targetLoc.getWorld().getName()), new ArrayList<>()); } } else if (args[0].equalsIgnoreCase("givefpticket")) { - return StringUtil.copyPartialMatches(args[1], API.getAttractions().keySet(), new ArrayList<>()); + return StringUtil.copyPartialMatches(args[1], ThemePark.getInstance().getAPI().getAttractionService().getAttractions().keySet(), new ArrayList<>()); } } else if (args.length == 3) { if (args[0].equalsIgnoreCase("opengate") diff --git a/src/main/lombok/nl/sbdeveloper/themeparkplus/gui/MalfunctionGUI.java b/src/main/lombok/nl/sbdeveloper/themeparkplus/gui/MalfunctionGUI.java index 23fd1f1..e1751f6 100644 --- a/src/main/lombok/nl/sbdeveloper/themeparkplus/gui/MalfunctionGUI.java +++ b/src/main/lombok/nl/sbdeveloper/themeparkplus/gui/MalfunctionGUI.java @@ -3,9 +3,9 @@ package nl.sbdeveloper.themeparkplus.gui; import com.samjakob.spigui.SGMenu; import com.samjakob.spigui.buttons.SGButton; import com.samjakob.spigui.item.ItemBuilder; -import nl.iobyte.themepark.api.API; -import nl.iobyte.themepark.api.attraction.Attraction; -import nl.iobyte.themepark.api.attraction.component.Status; +import nl.iobyte.themepark.ThemePark; +import nl.iobyte.themepark.api.attraction.enums.Status; +import nl.iobyte.themepark.api.attraction.objects.Attraction; import nl.sbdeveloper.themeparkplus.ThemeParkPlus; import nl.sbdeveloper.themeparkplus.api.PlusAPI; import nl.sbdeveloper.themeparkplus.api.objects.MalfunctionReport; @@ -24,13 +24,13 @@ import java.util.Optional; public class MalfunctionGUI { public static void open(Attraction att, Player p) { - SGMenu menu = ThemeParkPlus.getSpiGUI().create(ConfigUtil.makecolored(ThemeParkPlus.getSConfig().getFile().getString("Malfunction.GUI.Title").replace("%ridename%", att.getId())), 1); + SGMenu menu = ThemeParkPlus.getSpiGUI().create(ConfigUtil.makecolored(ThemeParkPlus.getSConfig().getFile().getString("Malfunction.GUI.Title").replace("%ridename%", att.getName())), 1); SGButton report = new SGButton(getItem("Report", ConfigUtil.makecolored(att.getName()))).withListener((InventoryClickEvent e) -> { - if (!PlusAPI.isReported(att.getId())) { - MalfunctionReport malfunctionReport = new MalfunctionReport(att.getId(), p.getUniqueId()); + if (!PlusAPI.isReported(att.getID())) { + MalfunctionReport malfunctionReport = new MalfunctionReport(att.getID(), p.getUniqueId()); PlusAPI.addReport(malfunctionReport); - att.setStatus(Status.MALFUNCTION, null); //Player must be null, otherwise we will get a loop in the listener + att.setStatus(Status.MALFUNCTION); p.sendMessage(ConfigUtil.getMessage("Malfunction.Reported", Collections.singletonMap("%ride%", att.getName()))); } else { @@ -40,11 +40,11 @@ public class MalfunctionGUI { }); menu.setButton(getSlot("Report"), report); - SGButton fix = new SGButton(getItem("Fix", PlusAPI.getReport(att.getId()))).withListener((InventoryClickEvent e) -> { - if (PlusAPI.isReported(att.getId())) { + SGButton fix = new SGButton(getItem("Fix", PlusAPI.getReport(att.getID()))).withListener((InventoryClickEvent e) -> { + if (PlusAPI.isReported(att.getID())) { - PlusAPI.removeReport(att.getId()); - att.setStatus(Status.CLOSED, null); //Player must be null, otherwise we will get a loop in the listener + PlusAPI.removeReport(att.getID()); + att.setStatus(Status.CLOSED); p.sendMessage(ConfigUtil.getMessage("Malfunction.Fixed", Collections.singletonMap("%ride%", att.getName()))); } else { @@ -82,7 +82,7 @@ public class MalfunctionGUI { String date = "-"; String reason = "-"; if (data[0] != null) { - ridename = API.getAttraction(((MalfunctionReport) data[0]).getRideID()).getName(); + ridename = ThemePark.getInstance().getAPI().getAttractionService().getAttraction(((MalfunctionReport) data[0]).getRideID()).getName(); reporter = Bukkit.getOfflinePlayer(((MalfunctionReport) data[0]).getReporterUUID()).getName(); date = ((MalfunctionReport) data[0]).getReportDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss")); reason = ((MalfunctionReport) data[0]).getReason(); diff --git a/src/main/lombok/nl/sbdeveloper/themeparkplus/listeners/FastpassListeners.java b/src/main/lombok/nl/sbdeveloper/themeparkplus/listeners/FastpassListeners.java index f4752a9..ad877f4 100644 --- a/src/main/lombok/nl/sbdeveloper/themeparkplus/listeners/FastpassListeners.java +++ b/src/main/lombok/nl/sbdeveloper/themeparkplus/listeners/FastpassListeners.java @@ -1,9 +1,9 @@ package nl.sbdeveloper.themeparkplus.listeners; import de.tr7zw.changeme.nbtapi.NBTItem; -import nl.iobyte.themepark.api.API; -import nl.iobyte.themepark.api.attraction.Attraction; -import nl.iobyte.themepark.api.attraction.component.Status; +import nl.iobyte.themepark.ThemePark; +import nl.iobyte.themepark.api.attraction.enums.Status; +import nl.iobyte.themepark.api.attraction.objects.Attraction; import nl.sbdeveloper.themeparkplus.ThemeParkPlus; import nl.sbdeveloper.themeparkplus.api.PlusAPI; import nl.sbdeveloper.themeparkplus.util.ConfigUtil; @@ -45,8 +45,8 @@ public class FastpassListeners implements Listener { if (ChatColor.stripColor(sign.getLine(1)).equalsIgnoreCase(mLineTwo)) { //Buy a ticket String attID = sign.getLine(2); - if (!API.isAttraction(attID)) return; - Attraction att = API.getAttraction(attID); + if (!ThemePark.getInstance().getAPI().getAttractionService().hasAttraction(attID)) return; + Attraction att = ThemePark.getInstance().getAPI().getAttractionService().getAttraction(attID); double price; try { @@ -83,11 +83,11 @@ public class FastpassListeners implements Listener { e.getPlayer().sendMessage(ConfigUtil.getMessage("Fastpass.Bought", vars)); } else if (ChatColor.stripColor(sign.getLine(1)).equalsIgnoreCase(sLineTwo)) { //Scan a ticket - if (!API.isAttraction(sign.getLine(2))) { + if (!ThemePark.getInstance().getAPI().getAttractionService().hasAttraction(sign.getLine(2))) { e.getPlayer().sendMessage(ConfigUtil.getMessage("Fastpass.UnknownRide", Collections.singletonMap("%ridename%", sign.getLine(2)))); return; } - Attraction att = API.getAttraction(sign.getLine(2)); + Attraction att = ThemePark.getInstance().getAPI().getAttractionService().getAttraction(sign.getLine(2)); ItemStack content = e.getPlayer().getInventory().getItemInMainHand(); if (content.getType() == Material.AIR @@ -102,12 +102,12 @@ public class FastpassListeners implements Listener { return; } - if (!nbtContent.getString("RideID").equals(att.getId())) { + if (!nbtContent.getString("RideID").equals(att.getID())) { e.getPlayer().sendMessage(ConfigUtil.getMessage("Fastpass.IncorrectTicket")); return; } - if (att.getStatus() != Status.OPEN && att.getStatus() != Status.ACTIVE) { + if (att.getStatus() != Status.OPEN) { e.getPlayer().sendMessage(ConfigUtil.getMessage("Fastpass.RideClosed")); return; } diff --git a/src/main/lombok/nl/sbdeveloper/themeparkplus/listeners/MalfunctionListener.java b/src/main/lombok/nl/sbdeveloper/themeparkplus/listeners/MalfunctionListener.java index c6db944..7b28f5d 100644 --- a/src/main/lombok/nl/sbdeveloper/themeparkplus/listeners/MalfunctionListener.java +++ b/src/main/lombok/nl/sbdeveloper/themeparkplus/listeners/MalfunctionListener.java @@ -1,7 +1,7 @@ package nl.sbdeveloper.themeparkplus.listeners; -import nl.iobyte.themepark.api.API; -import nl.iobyte.themepark.api.attraction.Attraction; +import nl.iobyte.themepark.ThemePark; +import nl.iobyte.themepark.api.attraction.objects.Attraction; import nl.sbdeveloper.themeparkplus.ThemeParkPlus; import nl.sbdeveloper.themeparkplus.gui.MalfunctionGUI; import nl.sbdeveloper.themeparkplus.util.ConfigUtil; @@ -24,8 +24,8 @@ public class MalfunctionListener implements Listener { Sign sign = (Sign) e.getClickedBlock().getState(); if (ChatColor.stripColor(sign.getLine(0)).equalsIgnoreCase(mrLineOne) && ChatColor.stripColor(sign.getLine(1)).equalsIgnoreCase(mrLineTwo)) { String attID = sign.getLine(2); - if (!API.isAttraction(attID)) return; - Attraction att = API.getAttraction(attID); + if (!ThemePark.getInstance().getAPI().getAttractionService().hasAttraction(attID)) return; + Attraction att = ThemePark.getInstance().getAPI().getAttractionService().getAttraction(attID); MalfunctionGUI.open(att, e.getPlayer()); } diff --git a/src/main/lombok/nl/sbdeveloper/themeparkplus/listeners/StatusChangeListener.java b/src/main/lombok/nl/sbdeveloper/themeparkplus/listeners/StatusChangeListener.java index 0025ae4..f0a55e2 100644 --- a/src/main/lombok/nl/sbdeveloper/themeparkplus/listeners/StatusChangeListener.java +++ b/src/main/lombok/nl/sbdeveloper/themeparkplus/listeners/StatusChangeListener.java @@ -1,10 +1,9 @@ package nl.sbdeveloper.themeparkplus.listeners; -import nl.iobyte.themepark.api.attraction.Attraction; -import nl.iobyte.themepark.api.attraction.component.Status; -import nl.iobyte.themepark.api.attraction.manager.StatusManager; -import nl.iobyte.themepark.api.events.attraction.ChangeStatusEvent; -import nl.iobyte.themepark.api.events.attraction.PreChangeStatusEvent; +import nl.iobyte.themepark.api.attraction.enums.Status; +import nl.iobyte.themepark.api.attraction.objects.Attraction; +import nl.iobyte.themepark.api.event.attraction.AttractionPreStatusChangeEvent; +import nl.iobyte.themepark.api.event.attraction.AttractionStatusChangeEvent; import nl.sbdeveloper.themeparkplus.ThemeParkPlus; import nl.sbdeveloper.themeparkplus.api.PlusAPI; import nl.sbdeveloper.themeparkplus.api.objects.MalfunctionReport; @@ -14,7 +13,6 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.jetbrains.annotations.NotNull; import java.awt.*; import java.io.IOException; @@ -24,12 +22,12 @@ import java.io.IOException; */ public class StatusChangeListener implements Listener { @EventHandler - public void onStatusChange(PreChangeStatusEvent e) { + public void onStatusChange(AttractionPreStatusChangeEvent e) { Attraction att = e.getAttraction(); - if (!PlusAPI.isReported(att.getId()) && e.getAfter() == Status.MALFUNCTION && e.getPlayer() != null) { + if (!PlusAPI.isReported(att.getID()) && e.getCurrent() == Status.MALFUNCTION && e.getPlayer() != null) { if (ThemeParkPlus.getSConfig().getFile().getBoolean("Malfunction.AllowCommandReport")) { - MalfunctionReport malfunctionReport = new MalfunctionReport(att.getId(), e.getPlayer().getUniqueId()); + MalfunctionReport malfunctionReport = new MalfunctionReport(att.getID(), e.getPlayer().getUniqueId()); PlusAPI.addReport(malfunctionReport); } else { e.setCancelled(true); @@ -37,9 +35,9 @@ public class StatusChangeListener implements Listener { } } - if (PlusAPI.isReported(att.getId()) && e.getAfter() != Status.MALFUNCTION && e.getPlayer() != null) { + if (PlusAPI.isReported(att.getID()) && e.getCurrent() != Status.MALFUNCTION && e.getPlayer() != null) { if (ThemeParkPlus.getSConfig().getFile().getBoolean("Malfunction.AllowCommandFix")) { - PlusAPI.removeReport(att.getId()); + PlusAPI.removeReport(att.getID()); } else { e.setCancelled(true); e.getPlayer().sendMessage(ConfigUtil.getMessage("Malfunction.NoCommand")); @@ -48,37 +46,35 @@ public class StatusChangeListener implements Listener { } @EventHandler - public void onStatusChange(@NotNull ChangeStatusEvent e) { - if (e.getAfter() != Status.GLOBAL) { - String title = ThemeParkPlus.getSConfig().getFile().getString("DiscordWebhook.Embed.Title"); - if (title == null) return; + public void onStatusChange(AttractionStatusChangeEvent e) { + String title = ThemeParkPlus.getSConfig().getFile().getString("DiscordWebhook.Embed.Title"); + if (title == null) return; - String rideName = ChatColor.stripColor(ConfigUtil.makecolored(e.getAttraction().getName())); - String regionName = ChatColor.stripColor(ConfigUtil.makecolored(e.getAttraction().getRegion().getName())); - String statusAfter = ChatColor.stripColor(ConfigUtil.makecolored(StatusManager.getName(e.getAfter()))); + String rideName = ChatColor.stripColor(ConfigUtil.makecolored(e.getAttraction().getName())); + String regionName = ChatColor.stripColor(ConfigUtil.makecolored(e.getAttraction().getRegionID())); + String statusAfter = ChatColor.stripColor(ConfigUtil.makecolored(e.getCurrent().getColor() + e.getCurrent().getName())); - title = title.replaceAll("%RideName%", rideName); - title = title.replaceAll("%Region%", regionName); - String copy = ThemeParkPlus.getSConfig().getFile().getString("DiscordWebhook.Embed.Copyright"); - String copyimg = ThemeParkPlus.getSConfig().getFile().getString("DiscordWebhook.Embed.CopyrightImage"); - Color color = new Color(ThemeParkPlus.getSConfig().getFile().getInt("DiscordWebhook.Embed.Colors." + e.getAfter().toString())); - if (copy == null || copyimg == null) return; + title = title.replaceAll("%RideName%", rideName); + title = title.replaceAll("%Region%", regionName); + String copy = ThemeParkPlus.getSConfig().getFile().getString("DiscordWebhook.Embed.Copyright"); + String copyimg = ThemeParkPlus.getSConfig().getFile().getString("DiscordWebhook.Embed.CopyrightImage"); + Color color = new Color(ThemeParkPlus.getSConfig().getFile().getInt("DiscordWebhook.Embed.Colors." + e.getCurrent().name())); + if (copy == null || copyimg == null) return; - DiscordWebhook webhook = new DiscordWebhook(ThemeParkPlus.getWebhookURL()); + DiscordWebhook webhook = new DiscordWebhook(ThemeParkPlus.getWebhookURL()); - DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject() - .setTitle(title) - .setFooter(copy, copyimg) - .setColor(color) - .addField(rideName, statusAfter, false); + DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject() + .setTitle(title) + .setFooter(copy, copyimg) + .setColor(color) + .addField(rideName, statusAfter, false); - webhook.addEmbed(embed); - try { - webhook.execute(); - } catch (IOException ex) { - Bukkit.getLogger().severe("[ThemeParkPlus] Could not send the status update to Discord! See the error below:"); - ex.printStackTrace(); - } + webhook.addEmbed(embed); + try { + webhook.execute(); + } catch (IOException ex) { + Bukkit.getLogger().severe("[ThemeParkPlus] Could not send the status update to Discord! See the error below:"); + ex.printStackTrace(); } } } diff --git a/src/main/lombok/nl/sbdeveloper/themeparkplus/util/XMaterial.java b/src/main/lombok/nl/sbdeveloper/themeparkplus/util/XMaterial.java index dc858b5..60d41c7 100644 --- a/src/main/lombok/nl/sbdeveloper/themeparkplus/util/XMaterial.java +++ b/src/main/lombok/nl/sbdeveloper/themeparkplus/util/XMaterial.java @@ -2,7 +2,7 @@ * The MIT License (MIT) * * Copyright (c) 2018 Hex_27 - * Copyright (c) 2020 Crypto Morin + * Copyright (c) 2021 Crypto Morin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -33,8 +33,6 @@ import org.apache.commons.lang.WordUtils; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.concurrent.TimeUnit; @@ -45,7 +43,7 @@ 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 + * This class is mainly designed to support {@link ItemStack}. 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 @@ -55,19 +53,20 @@ import java.util.regex.PatternSyntaxException; * 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. + * 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 or when the + * utility is missing a new material in that specific version. * 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 6.0.1 + * @version 10.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"), @@ -76,7 +75,7 @@ public enum XMaterial { ACACIA_PRESSURE_PLATE("WOOD_PLATE"), ACACIA_SAPLING(4, "SAPLING"), ACACIA_SIGN("SIGN_POST", "SIGN"), - ACACIA_SLAB(4, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"), + ACACIA_SLAB(4, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), ACACIA_STAIRS, ACACIA_TRAPDOOR("TRAP_DOOR"), ACACIA_WALL_SIGN("WALL_SIGN"), @@ -91,7 +90,10 @@ public enum XMaterial { */ AIR, ALLIUM(2, "RED_ROSE"), - ANCIENT_DEBRIS("1.16"), + AMETHYST_BLOCK, + AMETHYST_CLUSTER, + AMETHYST_SHARD, + ANCIENT_DEBRIS(16), ANDESITE(5, "STONE"), ANDESITE_SLAB, ANDESITE_STAIRS, @@ -102,32 +104,37 @@ public enum XMaterial { ARROW, ATTACHED_MELON_STEM(7, "MELON_STEM"), ATTACHED_PUMPKIN_STEM(7, "PUMPKIN_STEM"), + AXOLOTL_BUCKET, + AXOLOTL_SPAWN_EGG, + AZALEA, + AZALEA_LEAVES, AZURE_BLUET(3, "RED_ROSE"), BAKED_POTATO, - BAMBOO("1.14", "SUGAR_CANE", ""), - BAMBOO_SAPLING("1.14"), - BARREL("1.14", "CHEST", ""), + BAMBOO(0, 14), + BAMBOO_SAPLING(14), + BARREL(0, 14), 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. */ BEETROOT("BEETROOT_BLOCK"), 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), + BIG_DRIPLEAF, + BIG_DRIPLEAF_STEM, 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"), @@ -136,45 +143,49 @@ public enum XMaterial { BIRCH_PRESSURE_PLATE("WOOD_PLATE"), BIRCH_SAPLING(2, "SAPLING"), BIRCH_SIGN("SIGN_POST", "SIGN"), - BIRCH_SLAB(2, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"), + BIRCH_SLAB(2, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), BIRCH_STAIRS("BIRCH_WOOD_STAIRS"), BIRCH_TRAPDOOR("TRAP_DOOR"), 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_CANDLE, + BLACK_CANDLE_CAKE, BLACK_CARPET(15, "CARPET"), BLACK_CONCRETE(15, "CONCRETE"), BLACK_CONCRETE_POWDER(15, "CONCRETE_POWDER"), - BLACK_DYE("1.14", "INK_SACK", "INK_SAC"), - 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), 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_TERRACOTTA(15, "STAINED_CLAY"), BLACK_WALL_BANNER("WALL_BANNER"), BLACK_WOOL(15, "WOOL"), - BLAST_FURNACE("1.14", "FURNACE", ""), + BLAST_FURNACE(0, 14), 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_CANDLE, + BLUE_CANDLE_CAKE, 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), + BLUE_ICE(0, 13), BLUE_ORCHID(1, "RED_ROSE"), BLUE_SHULKER_BOX, BLUE_STAINED_GLASS(11, "STAINED_GLASS"), BLUE_STAINED_GLASS_PANE(11, "THIN_GLASS", "STAINED_GLASS_PANE"), - BLUE_TERRACOTTA(11, "HARD_CLAY", "STAINED_CLAY"), + BLUE_TERRACOTTA(11, "STAINED_CLAY"), BLUE_WALL_BANNER(4, "WALL_BANNER"), BLUE_WOOL(11, "WOOL"), BONE, @@ -184,24 +195,26 @@ 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"), + BRICKS("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_CANDLE, + BROWN_CANDLE_CAKE, 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), BROWN_MUSHROOM, BROWN_MUSHROOM_BLOCK("BROWN_MUSHROOM", "HUGE_MUSHROOM_1"), BROWN_SHULKER_BOX, @@ -210,22 +223,27 @@ 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, + BUDDING_AMETHYST, + BUNDLE, CACTUS, CAKE("CAKE_BLOCK"), - CAMPFIRE("1.14"), + CALCITE, + CAMPFIRE(14), + CANDLE, + CANDLE_CAKE, 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), + CARVED_PUMPKIN(1, 13), 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} * @@ -233,7 +251,9 @@ public enum XMaterial { */ CAVE_AIR("AIR"), CAVE_SPIDER_SPAWN_EGG(59, "MONSTER_EGG"), - CHAIN("1.16"), + CAVE_VINES, + CAVE_VINES_PLANT, + CHAIN(16), CHAINMAIL_BOOTS, CHAINMAIL_CHESTPLATE, CHAINMAIL_HELMET, @@ -245,32 +265,37 @@ public enum XMaterial { CHICKEN("RAW_CHICKEN"), CHICKEN_SPAWN_EGG(93, "MONSTER_EGG"), CHIPPED_ANVIL(1, "ANVIL"), + CHISELED_DEEPSLATE, 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"), - CLAY, + CHORUS_FLOWER(0, 9), + CHORUS_FRUIT(0, 9), + CHORUS_PLANT(0, 9), + CLAY("HARD_CLAY"), CLAY_BALL, CLOCK("WATCH"), COAL, COAL_BLOCK, COAL_ORE, COARSE_DIRT(1, "DIRT"), + COBBLED_DEEPSLATE, + COBBLED_DEEPSLATE_SLAB, + COBBLED_DEEPSLATE_STAIRS, + COBBLED_DEEPSLATE_WALL, COBBLESTONE, COBBLESTONE_SLAB(3, "STEP"), 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), + COD_SPAWN_EGG(0, 13), COMMAND_BLOCK("COMMAND"), COMMAND_BLOCK_MINECART("COMMAND_MINECART"), /** @@ -282,8 +307,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), + CONDUIT(0, 13, "BEACON"), COOKED_BEEF, COOKED_CHICKEN, COOKED_COD("COOKED_FISH"), @@ -292,95 +317,122 @@ public enum XMaterial { COOKED_RABBIT, COOKED_SALMON(1, "COOKED_FISH"), COOKIE, - CORNFLOWER(4, "1.14", "BLUE_DYE", ""), + COPPER_BLOCK, + COPPER_INGOT, + COPPER_ORE, + CORNFLOWER(4, 14), COW_SPAWN_EGG(92, "MONSTER_EGG"), + CRACKED_DEEPSLATE_BRICKS, + CRACKED_DEEPSLATE_TILES, 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", "SIGN_POST"), - CRIMSON_SLAB("1.16"), - CRIMSON_STAIRS("1.16"), - CRIMSON_STEM("1.16"), - CRIMSON_TRAPDOOR("1.16"), - CRIMSON_WALL_SIGN("1.16", "WALL_SIGN"), + 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_COPPER, + CUT_COPPER_SLAB, + CUT_COPPER_STAIRS, + 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_CANDLE, + CYAN_CANDLE_CAKE, 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), CYAN_SHULKER_BOX, CYAN_STAINED_GLASS(9, "STAINED_GLASS"), CYAN_STAINED_GLASS_PANE(9, "STAINED_GLASS_PANE"), - CYAN_TERRACOTTA(9, "HARD_CLAY", "STAINED_CLAY"), + CYAN_TERRACOTTA(9, "STAINED_CLAY"), CYAN_WALL_BANNER(6, "WALL_BANNER"), CYAN_WOOL(9, "WOOL"), DAMAGED_ANVIL(2, "ANVIL"), 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"), - DARK_OAK_LOG(1, "LOG", "LOG_2"), + DARK_OAK_LOG(1, "LOG_2"), DARK_OAK_PLANKS(5, "WOOD"), DARK_OAK_PRESSURE_PLATE("WOOD_PLATE"), DARK_OAK_SAPLING(5, "SAPLING"), DARK_OAK_SIGN("SIGN_POST", "SIGN"), - DARK_OAK_SLAB(5, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"), + DARK_OAK_SLAB(5, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), DARK_OAK_STAIRS, DARK_OAK_TRAPDOOR("TRAP_DOOR"), DARK_OAK_WALL_SIGN("WALL_SIGN"), - DARK_OAK_WOOD(1, "LOG", "LOG_2"), + DARK_OAK_WOOD(1, "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), + DEEPSLATE, + DEEPSLATE_BRICKS, + DEEPSLATE_BRICK_SLAB, + DEEPSLATE_BRICK_STAIRS, + DEEPSLATE_BRICK_WALL, + DEEPSLATE_COAL_ORE, + DEEPSLATE_COPPER_ORE, + DEEPSLATE_DIAMOND_ORE, + DEEPSLATE_EMERALD_ORE, + DEEPSLATE_GOLD_ORE, + DEEPSLATE_IRON_ORE, + DEEPSLATE_LAPIS_ORE, + DEEPSLATE_REDSTONE_ORE, + DEEPSLATE_TILES, + DEEPSLATE_TILE_SLAB, + DEEPSLATE_TILE_STAIRS, + DEEPSLATE_TILE_WALL, DETECTOR_RAIL, DIAMOND, DIAMOND_AXE, @@ -400,17 +452,22 @@ public enum XMaterial { DIORITE_STAIRS, DIORITE_WALL, DIRT, + /** + * Changed in 1.17 + */ + DIRT_PATH("GRASS_PATH"), DISPENSER, - DOLPHIN_SPAWN_EGG("1.13", "MONSTER_EGG", ""), + DOLPHIN_SPAWN_EGG(0, 13), 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), + DRIPSTONE_BLOCK, DROPPER, - DROWNED_SPAWN_EGG("1.13", "MONSTER_EGG", ""), + DROWNED_SPAWN_EGG(0, 13), EGG, ELDER_GUARDIAN_SPAWN_EGG(4, "MONSTER_EGG"), ELYTRA, @@ -426,10 +483,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), END_STONE("ENDER_STONE"), END_STONE_BRICKS("END_BRICKS"), END_STONE_BRICK_SLAB(6, "STEP"), @@ -437,6 +494,10 @@ public enum XMaterial { END_STONE_BRICK_WALL, EVOKER_SPAWN_EGG(34, "MONSTER_EGG"), EXPERIENCE_BOTTLE("EXP_BOTTLE"), + EXPOSED_COPPER, + EXPOSED_CUT_COPPER, + EXPOSED_CUT_COPPER_SLAB, + EXPOSED_CUT_COPPER_STAIRS, FARMLAND("SOIL"), FEATHER, FERMENTED_SPIDER_EYE, @@ -445,32 +506,35 @@ public enum XMaterial { * For some reasons filled map items are really special. * Their data value starts from 0 and every time a player * creates a new map that maps data value increases. + * https://github.com/CryptoMorin/XSeries/issues/91 */ FILLED_MAP("MAP"), FIRE, 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), FLINT, FLINT_AND_STEEL, + FLOWERING_AZALEA, + FLOWERING_AZALEA_LEAVES, 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), FURNACE("BURNING_FURNACE"), FURNACE_MINECART("POWERED_MINECART"), GHAST_SPAWN_EGG(56, "MONSTER_EGG"), GHAST_TEAR, - GILDED_BLACKSTONE("1.16"), + GILDED_BLACKSTONE(16), GLASS, GLASS_BOTTLE, GLASS_PANE("THIN_GLASS"), @@ -478,6 +542,12 @@ public enum XMaterial { GLOBE_BANNER_PATTERN, GLOWSTONE, GLOWSTONE_DUST, + GLOW_BERRIES, + GLOW_INK_SAC, + GLOW_ITEM_FRAME, + GLOW_LICHEN, + GLOW_SQUID_SPAWN_EGG, + GOAT_SPAWN_EGG, GOLDEN_APPLE, GOLDEN_AXE("GOLD_AXE"), GOLDEN_BOOTS("GOLD_BOOTS"), @@ -500,60 +570,65 @@ public enum XMaterial { GRANITE_WALL, 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_CANDLE, + GRAY_CANDLE_CAKE, 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), 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_TERRACOTTA(7, "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_CANDLE, + GREEN_CANDLE_CAKE, 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), 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_TERRACOTTA(13, "STAINED_CLAY"), GREEN_WALL_BANNER(2, "WALL_BANNER"), GREEN_WOOL(13, "WOOL"), - GRINDSTONE("1.14", "ANVIL", ""), + GRINDSTONE(0, 14), GUARDIAN_SPAWN_EGG(68, "MONSTER_EGG"), GUNPOWDER("SULPHUR"), + HANGING_ROOTS, 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), + HONEY_BOTTLE(0, 15), 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"), ICE, - INFESTED_CHISELED_STONE_BRICKS(5, "MONSTER_EGGS", "SMOOTH_BRICK"), + INFESTED_CHISELED_STONE_BRICKS(5, "MONSTER_EGGS"), INFESTED_COBBLESTONE(1, "MONSTER_EGGS"), - INFESTED_CRACKED_STONE_BRICKS(4, "MONSTER_EGGS", "SMOOTH_BRICK"), + INFESTED_CRACKED_STONE_BRICKS(4, "MONSTER_EGGS"), + INFESTED_DEEPSLATE, INFESTED_MOSSY_STONE_BRICKS(3, "MONSTER_EGGS"), INFESTED_STONE("MONSTER_EGGS"), - INFESTED_STONE_BRICKS(2, "MONSTER_EGGS", "SMOOTH_BRICK"), + INFESTED_STONE_BRICKS(2, "MONSTER_EGGS"), /** * We will only add "INK_SAC" for {@link #BLACK_DYE} since it's * the only material (linked with this material) that is added @@ -579,11 +654,11 @@ public enum XMaterial { IRON_TRAPDOOR, ITEM_FRAME, JACK_O_LANTERN, - JIGSAW("1.14", "COMMAND_BLOCK", "STRUCTURE_BLOCK", ""), + JIGSAW(0, 14), 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"), @@ -592,46 +667,54 @@ public enum XMaterial { JUNGLE_PRESSURE_PLATE("WOOD_PLATE"), JUNGLE_SAPLING(3, "SAPLING"), JUNGLE_SIGN("SIGN_POST", "SIGN"), - JUNGLE_SLAB(3, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"), + JUNGLE_SLAB(3, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), JUNGLE_STAIRS("JUNGLE_WOOD_STAIRS"), JUNGLE_TRAPDOOR("TRAP_DOOR"), 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), LAPIS_BLOCK, LAPIS_LAZULI(4, "INK_SACK"), LAPIS_ORE, + LARGE_AMETHYST_BUD, LARGE_FERN(3, "DOUBLE_PLANT"), LAVA("STATIONARY_LAVA"), LAVA_BUCKET, + LAVA_CAULDRON, LEAD("LEASH"), LEATHER, 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), LEVER, - LIGHT_BLUE_BANNER(12, "BANNER", "STANDING_BANNER"), + LIGHT, + LIGHTNING_ROD, + LIGHT_BLUE_BANNER(12, "STANDING_BANNER", "BANNER"), LIGHT_BLUE_BED(3, "BED_BLOCK", "BED"), + LIGHT_BLUE_CANDLE, + LIGHT_BLUE_CANDLE_CAKE, 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), 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_CANDLE, + LIGHT_GRAY_CANDLE_CAKE, LIGHT_GRAY_CARPET(8, "CARPET"), LIGHT_GRAY_CONCRETE(8, "CONCRETE"), LIGHT_GRAY_CONCRETE_POWDER(8, "CONCRETE_POWDER"), @@ -640,48 +723,52 @@ 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, "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"), - LIGHT_GRAY_TERRACOTTA(8, "HARD_CLAY", "STAINED_CLAY"), + LIGHT_GRAY_TERRACOTTA(8, "STAINED_CLAY"), LIGHT_GRAY_WALL_BANNER(7, "WALL_BANNER"), 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), LILY_PAD("WATER_LILY"), - LIME_BANNER(10, "BANNER", "STANDING_BANNER"), + LIME_BANNER(10, "STANDING_BANNER", "BANNER"), LIME_BED(5, "BED_BLOCK", "BED"), + LIME_CANDLE, + LIME_CANDLE_CAKE, 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), LIME_SHULKER_BOX, LIME_STAINED_GLASS(5, "STAINED_GLASS"), LIME_STAINED_GLASS_PANE(5, "STAINED_GLASS_PANE"), - LIME_TERRACOTTA(5, "HARD_CLAY", "STAINED_CLAY"), + LIME_TERRACOTTA(5, "STAINED_CLAY"), LIME_WALL_BANNER(10, "WALL_BANNER"), 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_CANDLE, + MAGENTA_CANDLE_CAKE, 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), 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_TERRACOTTA(2, "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"), /** @@ -692,6 +779,7 @@ public enum XMaterial { * until I can come up with something to fix it. */ MAP("EMPTY_MAP"), + MEDIUM_AMETHYST_BUD, MELON("MELON_BLOCK"), MELON_SEEDS, MELON_SLICE("MELON"), @@ -708,7 +796,9 @@ public enum XMaterial { MOSSY_STONE_BRICK_SLAB(5, "STEP"), MOSSY_STONE_BRICK_STAIRS("SMOOTH_STAIRS"), MOSSY_STONE_BRICK_WALL, - MOVING_PISTON("PISTON_BASE", "PISTON_MOVING_PIECE"), + MOSS_BLOCK, + MOSS_CARPET, + MOVING_PISTON("PISTON_MOVING_PIECE"), MULE_SPAWN_EGG(32, "MONSTER_EGG"), MUSHROOM_STEM("BROWN_MUSHROOM"), MUSHROOM_STEW("MUSHROOM_SOUP"), @@ -720,7 +810,7 @@ public enum XMaterial { MUSIC_DISC_FAR("RECORD_6"), MUSIC_DISC_MALL("RECORD_7"), MUSIC_DISC_MELLOHI("RECORD_8"), - MUSIC_DISC_PIGSTEP("1.16"), + MUSIC_DISC_PIGSTEP(16), MUSIC_DISC_STAL("RECORD_9"), MUSIC_DISC_STRAD("RECORD_10"), MUSIC_DISC_WAIT("RECORD_11"), @@ -728,19 +818,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"), @@ -748,10 +838,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 @@ -763,7 +853,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"), @@ -772,7 +862,7 @@ public enum XMaterial { OAK_PRESSURE_PLATE("WOOD_PLATE"), OAK_SAPLING("SAPLING"), OAK_SIGN("SIGN_POST", "SIGN"), - OAK_SLAB("WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"), + OAK_SLAB("WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), OAK_STAIRS("WOOD_STAIRS"), OAK_TRAPDOOR("TRAP_DOOR"), OAK_WALL_SIGN("WALL_SIGN"), @@ -780,45 +870,54 @@ public enum XMaterial { 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_CANDLE, + ORANGE_CANDLE_CAKE, 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), ORANGE_SHULKER_BOX, ORANGE_STAINED_GLASS(1, "STAINED_GLASS"), ORANGE_STAINED_GLASS_PANE(1, "STAINED_GLASS_PANE"), - ORANGE_TERRACOTTA(1, "HARD_CLAY", "STAINED_CLAY"), + ORANGE_TERRACOTTA(1, "STAINED_CLAY"), ORANGE_TULIP(5, "RED_ROSE"), ORANGE_WALL_BANNER(14, "WALL_BANNER"), ORANGE_WOOL(1, "WOOL"), OXEYE_DAISY(8, "RED_ROSE"), + OXIDIZED_COPPER, + OXIDIZED_CUT_COPPER, + OXIDIZED_CUT_COPPER_SLAB, + OXIDIZED_CUT_COPPER_STAIRS, 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", ""), - PIGLIN_BANNER_PATTERN("1.16"), + PHANTOM_MEMBRANE(13), + PHANTOM_SPAWN_EGG(0, 13), + 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_CANDLE, + PINK_CANDLE_CAKE, 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), PINK_SHULKER_BOX, PINK_STAINED_GLASS(6, "STAINED_GLASS"), PINK_STAINED_GLASS_PANE(6, "THIN_GLASS", "STAINED_GLASS_PANE"), - PINK_TERRACOTTA(6, "HARD_CLAY", "STAINED_CLAY"), + PINK_TERRACOTTA(6, "STAINED_CLAY"), PINK_TULIP(7, "RED_ROSE"), PINK_WALL_BANNER(9, "WALL_BANNER"), PINK_WOOL(6, "WOOL"), @@ -827,22 +926,27 @@ public enum XMaterial { PLAYER_HEAD(3, "SKULL", "SKULL_ITEM"), PLAYER_WALL_HEAD(3, "SKULL", "SKULL_ITEM"), PODZOL(2, "DIRT"), + POINTED_DRIPSTONE, POISONOUS_POTATO, POLAR_BEAR_SPAWN_EGG(102, "MONSTER_EGG"), 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_DEEPSLATE, + POLISHED_DEEPSLATE_SLAB, + POLISHED_DEEPSLATE_STAIRS, + POLISHED_DEEPSLATE_WALL, POLISHED_DIORITE(4, "STONE"), POLISHED_DIORITE_SLAB, POLISHED_DIORITE_STAIRS, @@ -857,6 +961,7 @@ public enum XMaterial { POTION, POTTED_ACACIA_SAPLING(4, "SAPLING", "FLOWER_POT"), POTTED_ALLIUM(2, "RED_ROSE", "FLOWER_POT"), + POTTED_AZALEA_BUSH, POTTED_AZURE_BLUET(3, "RED_ROSE", "FLOWER_POT"), POTTED_BAMBOO, POTTED_BIRCH_SAPLING(2, "SAPLING", "FLOWER_POT"), @@ -864,12 +969,13 @@ public enum XMaterial { POTTED_BROWN_MUSHROOM("FLOWER_POT"), POTTED_CACTUS("FLOWER_POT"), POTTED_CORNFLOWER, - POTTED_CRIMSON_FUNGUS("1.16"), - POTTED_CRIMSON_ROOTS("1.16"), + 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"), POTTED_FERN(2, "LONG_GRASS", "FLOWER_POT"), + POTTED_FLOWERING_AZALEA_BUSH, POTTED_JUNGLE_SAPLING(3, "SAPLING", "FLOWER_POT"), POTTED_LILY_OF_THE_VALLEY, POTTED_OAK_SAPLING("SAPLING", "FLOWER_POT"), @@ -880,38 +986,43 @@ 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("1.16"), - POTTED_WARPED_ROOTS("1.16"), + POTTED_WARPED_FUNGUS(16), + POTTED_WARPED_ROOTS(16), POTTED_WHITE_TULIP(6, "RED_ROSE", "FLOWER_POT"), POTTED_WITHER_ROSE, + POWDER_SNOW, + POWDER_SNOW_BUCKET, + POWDER_SNOW_CAULDRON, 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), + PUFFERFISH_SPAWN_EGG(0, 13), 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_CANDLE, + PURPLE_CANDLE_CAKE, 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), PURPLE_SHULKER_BOX, PURPLE_STAINED_GLASS(10, "STAINED_GLASS"), PURPLE_STAINED_GLASS_PANE(10, "THIN_GLASS", "STAINED_GLASS_PANE"), - PURPLE_TERRACOTTA(10, "HARD_CLAY", "STAINED_CLAY"), + PURPLE_TERRACOTTA(10, "STAINED_CLAY"), PURPLE_WALL_BANNER(5, "WALL_BANNER"), PURPLE_WOOL(10, "WOOL"), PURPUR_BLOCK, @@ -920,7 +1031,7 @@ public enum XMaterial { PURPUR_STAIRS, QUARTZ, QUARTZ_BLOCK, - QUARTZ_BRICKS("1.16"), + QUARTZ_BRICKS(16), QUARTZ_PILLAR(2, "QUARTZ_BLOCK"), QUARTZ_SLAB(7, "STEP"), QUARTZ_STAIRS, @@ -930,7 +1041,13 @@ public enum XMaterial { RABBIT_SPAWN_EGG(101, "MONSTER_EGG"), RABBIT_STEW, RAIL("RAILS"), - RAVAGER_SPAWN_EGG("1.14"), + RAVAGER_SPAWN_EGG(14), + RAW_COPPER, + RAW_COPPER_BLOCK, + RAW_GOLD, + RAW_GOLD_BLOCK, + RAW_IRON, + RAW_IRON_BLOCK, REDSTONE, REDSTONE_BLOCK, /** @@ -949,16 +1066,18 @@ 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 */ - RED_BED(0, "BED_BLOCK", "BED"), + RED_BED(14, "BED_BLOCK", "BED"), + RED_CANDLE, + RED_CANDLE_CAKE, RED_CARPET(14, "CARPET"), RED_CONCRETE(14, "CONCRETE"), RED_CONCRETE_POWDER(14, "CONCRETE_POWDER"), RED_DYE(1, "INK_SACK", "ROSE_RED"), - RED_GLAZED_TERRACOTTA(14, "1.12", "HARD_CLAY", "STAINED_CLAY", "RED_TERRACOTTA"), + RED_GLAZED_TERRACOTTA(14, 12), RED_MUSHROOM, RED_MUSHROOM_BLOCK("RED_MUSHROOM", "HUGE_MUSHROOM_2"), RED_NETHER_BRICKS("RED_NETHER_BRICK"), @@ -967,39 +1086,41 @@ 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, RED_STAINED_GLASS(14, "STAINED_GLASS"), RED_STAINED_GLASS_PANE(14, "THIN_GLASS", "STAINED_GLASS_PANE"), - RED_TERRACOTTA(14, "HARD_CLAY", "STAINED_CLAY"), + RED_TERRACOTTA(14, "STAINED_CLAY"), RED_TULIP(4, "RED_ROSE"), RED_WALL_BANNER(1, "WALL_BANNER"), RED_WOOL(14, "WOOL"), REPEATER("DIODE_BLOCK_ON", "DIODE_BLOCK_OFF", "DIODE"), REPEATING_COMMAND_BLOCK("COMMAND", "COMMAND_REPEATING"), - RESPAWN_ANCHOR("1.16"), + RESPAWN_ANCHOR(16), + ROOTED_DIRT, 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), + SALMON_SPAWN_EGG(0, 13), 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), + SCULK_SENSOR, + SCUTE(13), + SEAGRASS(0, 13), 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"), @@ -1012,9 +1133,12 @@ public enum XMaterial { SLIME_BALL, SLIME_BLOCK, SLIME_SPAWN_EGG(55, "MONSTER_EGG"), + SMALL_AMETHYST_BUD, + SMALL_DRIPLEAF, SMITHING_TABLE, - SMOKER("1.14", "FURNACE", ""), - SMOOTH_QUARTZ("1.13", "QUARTZ", ""), + SMOKER(0, 14), + SMOOTH_BASALT, + SMOOTH_QUARTZ(0, 13), SMOOTH_QUARTZ_SLAB(7, "STEP"), SMOOTH_QUARTZ_STAIRS, SMOOTH_RED_SANDSTONE(2, "RED_SANDSTONE"), @@ -1028,22 +1152,23 @@ 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), SPIDER_EYE, SPIDER_SPAWN_EGG(52, "MONSTER_EGG"), SPLASH_POTION, SPONGE, + SPORE_BLOSSOM, 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", "LEAVES_2"), @@ -1052,19 +1177,20 @@ public enum XMaterial { SPRUCE_PRESSURE_PLATE("WOOD_PLATE"), SPRUCE_SAPLING(1, "SAPLING"), SPRUCE_SIGN("SIGN_POST", "SIGN"), - SPRUCE_SLAB(1, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"), + SPRUCE_SLAB(1, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), SPRUCE_STAIRS("SPRUCE_WOOD_STAIRS"), SPRUCE_TRAPDOOR("TRAP_DOOR"), SPRUCE_WALL_SIGN("WALL_SIGN"), SPRUCE_WOOD(1, "LOG"), + SPYGLASS, 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, @@ -1072,18 +1198,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("1.16"), + 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"), @@ -1092,50 +1218,51 @@ 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 - * Use XBlock when comparing block types. */ 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), + SWEET_BERRIES(14), + SWEET_BERRY_BUSH(0, 14), TALL_GRASS(2, "DOUBLE_PLANT"), - TALL_SEAGRASS(2, "1.13", "TALL_GRASS", ""), - TARGET("1.16"), - TERRACOTTA("HARD_CLAY"), - TIPPED_ARROW("1.9", "ARROW", ""), + TALL_SEAGRASS(2, 13), + TARGET(16), + TERRACOTTA("STAINED_CLAY"), + TINTED_GLASS, + TIPPED_ARROW(0, 9), 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), 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"), + TUFF, + TURTLE_EGG(0, 13), + TURTLE_HELMET(0, 13), + TURTLE_SPAWN_EGG(0, 13), + 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"), @@ -1147,59 +1274,80 @@ 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", "SIGN_POST"), - WARPED_SLAB("1.16"), - WARPED_STAIRS("1.16"), - WARPED_STEM("1.16"), - WARPED_TRAPDOOR("1.16"), - WARPED_WALL_SIGN("1.16", "WALL_SIGN"), - WARPED_WART_BLOCK("1.16"), + WANDERING_TRADER_SPAWN_EGG(0, 14), + 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. * After 1.13+ this uses * https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/Levelled.html water flowing system. - * Use XBlock for this instead. */ WATER("STATIONARY_WATER"), WATER_BUCKET, - WEEPING_VINES("1.16"), - WEEPING_VINES_PLANT("1.16"), + WATER_CAULDRON, + WAXED_COPPER_BLOCK, + WAXED_CUT_COPPER, + WAXED_CUT_COPPER_SLAB, + WAXED_CUT_COPPER_STAIRS, + WAXED_EXPOSED_COPPER, + WAXED_EXPOSED_CUT_COPPER, + WAXED_EXPOSED_CUT_COPPER_SLAB, + WAXED_EXPOSED_CUT_COPPER_STAIRS, + WAXED_OXIDIZED_COPPER, + WAXED_OXIDIZED_CUT_COPPER, + WAXED_OXIDIZED_CUT_COPPER_SLAB, + WAXED_OXIDIZED_CUT_COPPER_STAIRS, + WAXED_WEATHERED_COPPER, + WAXED_WEATHERED_CUT_COPPER, + WAXED_WEATHERED_CUT_COPPER_SLAB, + WAXED_WEATHERED_CUT_COPPER_STAIRS, + WEATHERED_COPPER, + WEATHERED_CUT_COPPER, + WEATHERED_CUT_COPPER_SLAB, + WEATHERED_CUT_COPPER_STAIRS, + WEEPING_VINES(16), + WEEPING_VINES_PLANT(16), WET_SPONGE(1, "SPONGE"), /** * Wheat is a known material in pre-1.13 - * Use XBlock when comparing block types. */ WHEAT("CROPS"), WHEAT_SEEDS("SEEDS"), - WHITE_BANNER(15, "BANNER", "STANDING_BANNER"), + WHITE_BANNER(15, "STANDING_BANNER", "BANNER"), WHITE_BED("BED_BLOCK", "BED"), + WHITE_CANDLE, + WHITE_CANDLE_CAKE, 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, "STAINED_CLAY"), WHITE_SHULKER_BOX, WHITE_STAINED_GLASS("STAINED_GLASS"), WHITE_STAINED_GLASS_PANE("THIN_GLASS", "STAINED_GLASS_PANE"), - WHITE_TERRACOTTA("HARD_CLAY", "STAINED_CLAY", "TERRACOTTA"), + WHITE_TERRACOTTA("STAINED_CLAY", "TERRACOTTA"), WHITE_TULIP(6, "RED_ROSE"), 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), WITHER_SKELETON_SKULL(1, "SKULL", "SKULL_ITEM"), WITHER_SKELETON_SPAWN_EGG(5, "MONSTER_EGG"), WITHER_SKELETON_WALL_SKULL(1, "SKULL", "SKULL_ITEM"), @@ -1211,20 +1359,22 @@ 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_CANDLE, + YELLOW_CANDLE_CAKE, 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, "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_TERRACOTTA(4, "STAINED_CLAY"), YELLOW_WALL_BANNER(11, "WALL_BANNER"), YELLOW_WOOL(4, "WOOL"), - ZOGLIN_SPAWN_EGG("1.16"), + ZOGLIN_SPAWN_EGG(16), ZOMBIE_HEAD(2, "SKULL", "SKULL_ITEM"), ZOMBIE_HORSE_SPAWN_EGG(29, "MONSTER_EGG"), ZOMBIE_SPAWN_EGG(54, "MONSTER_EGG"), @@ -1234,13 +1384,12 @@ public enum XMaterial { /** - * 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 set is mutable for performance, but do not change the elements. * * @since 2.0.0 */ - public static final EnumSet VALUES = EnumSet.allOf(XMaterial.class); + public static final XMaterial[] VALUES = values(); /** * We don't want to use {@link Enums#getIfPresent(Class, String)} to avoid a few checks. @@ -1249,55 +1398,6 @@ public enum XMaterial { */ private static final Map NAMES = new HashMap<>(); - /** - * A set 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. - * - * @since 1.0.0 - */ - private static final Set DAMAGEABLE = new HashSet<>(Arrays.asList( - "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) - *

- * A map of duplicated material names in 1.13 and 1.12 that will conflict with the legacy names. - * Values are the new material names. - *
- * Duplicates are normally only checked by keys, not values. - * - * @since 3.0.0 - */ - private static final EnumMap DUPLICATED = new EnumMap(XMaterial.class) {{ - 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. - // Some of 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); - put(CAULDRON, CAULDRON); - put(BREWING_STAND, BREWING_STAND); - }}; - /** * Guava (Google Core Libraries for Java)'s cache for performance and timed caches. * For strings that match a certain XMaterial. Mostly cached for configs. @@ -1305,41 +1405,19 @@ public enum XMaterial { * @since 1.0.0 */ private static final Cache NAME_CACHE = CacheBuilder.newBuilder() - .expireAfterAccess(15, TimeUnit.MINUTES) - .build(); - /* - * A set of all the legacy names without duplicates. - *

- * It'll help to free up a lot of memory if it's not used. - * Add it back if you need it. - * - * @see #containsLegacy(String) - * @since 2.2.0 - * - private static final ImmutableSet LEGACY_VALUES = VALUES.stream().map(XMaterial::getLegacy) - .flatMap(Arrays::stream) - .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 XMaterials that are already parsed once. - * - * @since 3.0.0 - */ - private static final Cache> PARSED_CACHE = CacheBuilder.newBuilder() - .expireAfterAccess(10, TimeUnit.MINUTES) + .expireAfterAccess(1, TimeUnit.HOURS) .build(); + /** * This is used for {@link #isOneOf(Collection)} * * @since 3.4.0 */ private static final LoadingCache CACHED_REGEX = CacheBuilder.newBuilder() - .expireAfterAccess(1, TimeUnit.HOURS) + .expireAfterAccess(3, TimeUnit.HOURS) .build(new CacheLoader() { @Override - public Pattern load(@NotNull String str) { + public Pattern load( String str) { try { return Pattern.compile(str); } catch (PatternSyntaxException ex) { @@ -1349,47 +1427,117 @@ public enum XMaterial { } }); /** - * The current version of the server in the a form of a major version. + * The maximum data value in the pre-flattening update which belongs to {@link #VILLAGER_SPAWN_EGG}
+ * https://minecraftitemids.com/types/spawn-egg * - * @since 1.0.0 + * @see #matchXMaterialWithData(String) + * @since 8.0.0 */ - private static final int VERSION = Integer.parseInt(getMajorVersion(Bukkit.getVersion()).substring(2)); + private static final byte MAX_DATA_VALUE = 120; /** - * Cached result if the server version is after the v1.13 flattening update. - * Please don't mistake this with flat-chested people. It happened. + * Used to tell the system that the passed object's (name or material) data value + * is not provided or is invalid. + * + * @since 8.0.0 + */ + private static final byte UNKNOWN_DATA_VALUE = -1; + /** + * The maximum material ID before the pre-flattening update which belongs to {@link #MUSIC_DISC_WAIT} + * + * @since 8.1.0 + */ + private static final short MAX_ID = 2267; + /** + * XMaterial Paradox (Duplication Check) + *

+ * A set of duplicated material names in 1.13 and 1.12 that will conflict with the legacy names. + * Values are the new material names. This map also contains illegal elements. Check the static initializer for more info. + *

+ * Duplications are not useful at all in versions above the flattening update {@link Data#ISFLAT} + * This set is only used for matching materials, for parsing refer to {@link #isDuplicated()} * * @since 3.0.0 */ - private static final boolean ISFLAT = supports(13); + private static final Set DUPLICATED; static { for (XMaterial material : VALUES) NAMES.put(material.name(), material); } + static { + if (Data.ISFLAT) { + // It's not needed at all if it's the newer version. We can save some memory. + DUPLICATED = null; + } else { + // MELON_SLICE, CARROTS, POTATOES, BEETROOTS, GRASS_BLOCK, BRICKS, NETHER_BRICKS, BROWN_MUSHROOM + // Using the constructor to add elements will decide to allocate more size which we don't need. + DUPLICATED = new HashSet<>(4); + DUPLICATED.add(GRASS.name()); + DUPLICATED.add(MELON.name()); + DUPLICATED.add(BRICK.name()); + DUPLICATED.add(NETHER_BRICK.name()); + } + } + /** * The data value of this material https://minecraft.gamepedia.com/Java_Edition_data_values/Pre-flattening + * It's never a negative number. * * @see #getData() */ private final byte data; + /** + * The version that this material was added in, otherwise 0 if the version is not recorded. + * + * @see #getMaterialVersion() + * @since 7.0.0 + */ + private final byte version; /** * A list of material names that was being used for older verions. * * @see #getLegacy() */ + private final String[] legacy; + /** + * The cached Bukkit parsed material. + * + * @see #parseMaterial() + * @since 9.0.0 + */ + + private final Material material; - XMaterial(int data, String... legacy) { + XMaterial(int data, int version, String... legacy) { this.data = (byte) data; + this.version = (byte) version; this.legacy = legacy; + + Material mat = null; + if ((!Data.ISFLAT && this.isDuplicated()) || (mat = Material.getMaterial(this.name())) == null) { + for (int i = legacy.length - 1; i >= 0; i--) { + mat = Material.getMaterial(legacy[i]); + if (mat != null) break; + } + } + this.material = mat; + } + + 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); } /** @@ -1406,11 +1554,11 @@ public enum XMaterial { * @since 1.0.0 */ public static boolean isNewVersion() { - return ISFLAT; + return Data.ISFLAT; } /** - * This is just an extra method that method that can be used for many cases. + * This is just an extra method that can be used for many cases. * It can be used in {@link org.bukkit.event.player.PlayerInteractEvent} * or when accessing {@link org.bukkit.entity.Player#getMainHand()}, * or other compatibility related methods. @@ -1428,26 +1576,28 @@ public enum XMaterial { } /** - * Gets the {@link XMaterial} with this name without throwing an exception. + * Gets the XMaterial with this name similar to {@link #valueOf(String)} + * without throwing an exception. * * @param name the name of the material. + * * @return an optional that can be empty. * @since 5.1.0 */ - @NotNull - private static Optional getIfPresent(@NotNull String name) { + + private static Optional getIfPresent( String name) { return Optional.ofNullable(NAMES.get(name)); } /** * The current version of the server. * - * @return the current server version or 0.0 if unknown. + * @return the current server version minor number. * @see #isNewVersion() * @since 2.0.0 */ - public static double getVersion() { - return VERSION; + public static int getVersion() { + return Data.VERSION; } /** @@ -1457,15 +1607,15 @@ public enum XMaterial { * @see #matchDefinedXMaterial(String, byte) * @since 1.0.0 */ - @Nullable - private static XMaterial requestOldXMaterial(@NotNull String name, byte data) { + + private static XMaterial requestOldXMaterial( String name, byte data) { String holder = name + data; XMaterial cache = NAME_CACHE.getIfPresent(holder); if (cache != null) return cache; for (XMaterial material : VALUES) { // Not using material.name().equals(name) check is intended. - if ((data == -1 || data == material.data) && material.anyMatchLegacy(name)) { + if ((data == UNKNOWN_DATA_VALUE || data == material.data) && material.anyMatchLegacy(name)) { NAME_CACHE.put(holder, material); return material; } @@ -1475,39 +1625,18 @@ public enum XMaterial { } /** - * 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(@NotNull 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. + * Parses the given material name as an XMaterial with a given data + * value in the string if attached. Check {@link #matchXMaterialWithData(String)} for more info. * * @see #matchXMaterialWithData(String) + * @see #matchDefinedXMaterial(String, byte) * @since 2.0.0 */ - @NotNull - public static Optional matchXMaterial(@NotNull String name) { + + public static Optional matchXMaterial( String name) { Validate.notEmpty(name, "Cannot match a material with null or empty material name"); Optional oldMatch = matchXMaterialWithData(name); - if (oldMatch.isPresent()) return oldMatch; - return matchDefinedXMaterial(format(name), (byte) -1); + return oldMatch.isPresent() ? oldMatch : matchDefinedXMaterial(format(name), UNKNOWN_DATA_VALUE); } /** @@ -1522,20 +1651,22 @@ public enum XMaterial { * * * @param name the material string that consists of the material name, data and separator character. + * * @return the parsed XMaterial. * @see #matchXMaterial(String) * @since 3.0.0 */ - @NotNull - private static Optional matchXMaterialWithData(String name) { + + private static Optional matchXMaterialWithData( String name) { int index = name.indexOf(':'); if (index != -1) { String mat = format(name.substring(0, index)); - try { + // We don't use Byte.parseByte because we have our own range check. byte data = (byte) Integer.parseInt(StringUtils.deleteWhitespace(name.substring(index + 1))); - return matchDefinedXMaterial(mat, data); + return data >= 0 && data < MAX_DATA_VALUE ? matchDefinedXMaterial(mat, data) : matchDefinedXMaterial(mat, UNKNOWN_DATA_VALUE); } catch (NumberFormatException ignored) { + return matchDefinedXMaterial(mat, UNKNOWN_DATA_VALUE); } } @@ -1550,79 +1681,72 @@ public enum XMaterial { * @see #matchXMaterial(ItemStack) * @since 2.0.0 */ - @NotNull - public static XMaterial matchXMaterial(@NotNull Material material) { + + public static XMaterial matchXMaterial( Material material) { Objects.requireNonNull(material, "Cannot match null material"); - return matchDefinedXMaterial(material.name(), (byte) -1) + return matchDefinedXMaterial(material.name(), UNKNOWN_DATA_VALUE) .orElseThrow(() -> new IllegalArgumentException("Unsupported material with no data value: " + material.name())); } /** - * Parses the given item as an XMaterial using its material and data value (durability). + * Parses the given item as an XMaterial using its material and data value (durability) + * if not a damageable item {@link ItemStack#getDurability()}. * * @param item the ItemStack to match. + * * @return an XMaterial if matched any. * @throws IllegalArgumentException may be thrown as an unexpected exception. - * @see #matchDefinedXMaterial(String, byte) + * @see #matchXMaterial(Material) * @since 2.0.0 */ - @NotNull + @SuppressWarnings("deprecation") - public static XMaterial matchXMaterial(@NotNull ItemStack item) { + public static XMaterial matchXMaterial( ItemStack item) { Objects.requireNonNull(item, "Cannot match null ItemStack"); String material = item.getType().name(); - byte data = (byte) (ISFLAT || isDamageable(material) ? 0 : item.getDurability()); + byte data = (byte) (Data.ISFLAT || item.getType().getMaxDurability() > 0 ? 0 : item.getDurability()); + + // Check FILLED_MAP enum for more info. + //if (!Data.ISFLAT && item.hasItemMeta() && item.getItemMeta() instanceof org.bukkit.inventory.meta.MapMeta) return FILLED_MAP; return matchDefinedXMaterial(material, data) - .orElseThrow(() -> new IllegalArgumentException("Unsupported material: " + material + " (" + data + ')')); + .orElseThrow(() -> new IllegalArgumentException("Unsupported material from item: " + material + " (" + data + ')')); } /** - * Parses the given material name and data value as an XMaterial. + * The main method that parses the given material name and data value as an XMaterial. * All the values passed to this method will not be null or empty and are formatted correctly. * * @param name the formatted name of the material. - * @param data the data value of the material. + * @param data the data value of the material. Is always 0 or {@link #UNKNOWN_DATA_VALUE} when {@link Data#ISFLAT} + * * @return an XMaterial (with the same data value if specified) * @see #matchXMaterial(Material) * @see #matchXMaterial(int, byte) * @see #matchXMaterial(ItemStack) * @since 3.0.0 */ - @SuppressWarnings("OptionalAssignedToNull") - @NotNull - private static Optional matchDefinedXMaterial(@NotNull String name, byte data) { - boolean duplicated = isDuplicated(name); + + protected static Optional matchDefinedXMaterial( String name, byte data) { + // if (!Boolean.valueOf(Boolean.getBoolean(Boolean.TRUE.toString())).equals(Boolean.FALSE.booleanValue())) return null; + Boolean duplicated = null; + boolean isAMap = name.equalsIgnoreCase("MAP"); // 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; - 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. - xMaterial = getIfPresent(name); + if (Data.ISFLAT || (!isAMap && data <= 0 && !(duplicated = isDuplicated(name)))) { + Optional xMaterial = getIfPresent(name); if (xMaterial.isPresent()) return xMaterial; } + // Usually flat versions wouldn't pass this point, but some special materials do. - // XMaterial Paradox (Duplication Check) - // I've concluded that this is just an infinite loop that keeps - // going around the Singular Form and the Plural Form materials. A waste of brain cells and a waste of time. - // This solution works just fine anyway. - XMaterial xMat = requestOldXMaterial(name, data); - if (xMat == null) { + XMaterial oldXMaterial = requestOldXMaterial(name, data); + if (oldXMaterial == null) { // Special case. Refer to FILLED_MAP for more info. - if (data > 0 && name.endsWith("MAP")) return Optional.of(FILLED_MAP); - return Optional.empty(); + return (data >= 0 && isAMap) ? Optional.of(FILLED_MAP) : Optional.empty(); } - if (!ISFLAT && duplicated && xMat.name().charAt(xMat.name().length() - 1) == 'S') { - // 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 xMaterial == null ? getIfPresent(name) : xMaterial; - } - return Optional.ofNullable(xMat); + if (!Data.ISFLAT && oldXMaterial.isPlural() && (duplicated == null ? isDuplicated(name) : duplicated)) return getIfPresent(name); + return Optional.of(oldXMaterial); } /** @@ -1633,17 +1757,13 @@ public enum XMaterial { *

{@code MELON, CARROT, POTATO, BEETROOT -> true} * * @param name the name of the material to check. + * * @return true if there's a duplicated material for this material, otherwise false. - * @see #isDuplicated() * @since 2.0.0 */ - private static boolean isDuplicated(@NotNull String name) { + private static boolean isDuplicated( 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()) { - XMaterial material = duplicated.getKey(); - if (material.name().equals(name) || material.anyMatchLegacy(name)) return true; - } - return false; + return DUPLICATED.contains(name); } /** @@ -1652,17 +1772,21 @@ public enum XMaterial { * * @param id the ID (Magic value) of the material. * @param data the data value of the material. + * * @return a parsed XMaterial with the same ID and data value. * @see #matchXMaterial(ItemStack) * @since 2.0.0 + * @deprecated this method loops through all the available materials and matches their ID using {@link #getId()} + * which takes a really long time. Plugins should no longer support IDs. If you want, you can make a {@link Map} cache yourself. + * This method obviously doesn't work for 1.13+ and will not be supported. This is only here for debugging purposes. */ - @NotNull + + @Deprecated public static Optional matchXMaterial(int id, byte data) { - if (id < 0 || data < 0) return Optional.empty(); - - // Looping through Material.values() will take longer. - for (XMaterial materials : VALUES) + if (id < 0 || id > MAX_ID || data < 0) return Optional.empty(); + for (XMaterial materials : VALUES) { if (materials.data == data && materials.getId() == id) return Optional.of(materials); + } return Optional.empty(); } @@ -1673,20 +1797,22 @@ public enum XMaterial { * 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. + * + * @return an enum name. * @since 2.0.0 */ - @NotNull - protected static String format(@NotNull String name) { + + protected static String format( String name) { int len = name.length(); char[] chs = new char[len]; int count = 0; boolean appendUnderline = false; - for (int i = 0; i < len; ++i) { + for (int i = 0; i < len; i++) { char ch = name.charAt(i); - if (!appendUnderline && count != 0 && (ch == '-' || ch == ' ' || ch == '_') && chs[count] != '_') appendUnderline = true; + if (!appendUnderline && count != 0 && (ch == '-' || ch == ' ' || ch == '_') && chs[count] != '_') + appendUnderline = true; else { boolean number = false; // Old materials have numbers in them. @@ -1709,55 +1835,28 @@ public enum XMaterial { * Checks if the specified version is the same version or higher than the current server version. * * @param version the major version to be checked. "1." is ignored. E.g. 1.12 = 12 | 1.9 = 9 + * * @return true of the version is equal or higher than the current version. * @since 2.0.0 */ public static boolean supports(int version) { - return VERSION >= version; - } - - /** - * Converts the enum names to a more friendly and readable string. - * - * @return a formatted string. - * @see #toWord(String) - * @since 2.1.0 - */ - @NotNull - public static String toWord(@NotNull Material material) { - Objects.requireNonNull(material, "Cannot translate a null material to a word"); - return toWord(material.name()); - } - - /** - * Parses an enum name to a normal word. - * Normal names have underlines removed and each word capitalized. - *

- * Examples: - *

-     *     EMERALD                 -> Emerald
-     *     EMERALD_BLOCK           -> Emerald Block
-     *     ENCHANTED_GOLDEN_APPLE  -> Enchanted Golden Apple
-     * 
- * - * @param name the name of the enum. - * @return a cleaned more readable enum name. - * @since 2.1.0 - */ - @NotNull - private static String toWord(@NotNull String name) { - return WordUtils.capitalize(name.replace('_', ' ').toLowerCase(Locale.ENGLISH)); + return Data.VERSION >= version; } /** * Gets the exact major version (..., 1.9, 1.10, ..., 1.14) + * In most cases, you shouldn't be using this method. * * @param version Supports {@link Bukkit#getVersion()}, {@link Bukkit#getBukkitVersion()} and normal formats such as "1.14" + * * @return the exact major version. + * @see #supports(int) + * @see #getVersion() + * @see #getMaterialVersion() * @since 2.0.0 */ - @NotNull - public static String getMajorVersion(@NotNull String version) { + + public static String getMajorVersion( String version) { Validate.notEmpty(version, "Cannot get major Minecraft version from null or empty string"); // getVersion() @@ -1777,21 +1876,29 @@ public enum XMaterial { return version; } + public String[] getLegacy() { + return this.legacy; + } + /** - * Checks if the material can be damaged by using it. - * Names going through this method are not formatted. + * XMaterial Paradox (Duplication Check) + * I've concluded that this is just an infinite loop that keeps + * going around the Singular Form and the Plural Form materials. A waste of brain cells and a waste of time. + * This solution works just fine anyway. + *

+ * A solution for XMaterial Paradox. + * Manually parses the duplicated materials to find the exact material based on the server version. + * If the name ends with "S" -> Plural Form Material. + * Plural methods are only plural if they're also {@link #DUPLICATED} + *

+ * The only special exceptions are {@link #BRICKS} and {@link #NETHER_BRICKS} * - * @param name the name of the material. - * @return true of the material can be damaged. - * @see #isDamageable() - * @since 1.0.0 + * @return true if this material is a plural form material, otherwise false. + * @since 8.0.0 */ - public static boolean isDamageable(@NotNull String name) { - Objects.requireNonNull(name, "Material name cannot be null"); - for (String damageable : DAMAGEABLE) { - if (name.contains(damageable)) return true; - } - return false; + private boolean isPlural() { + // this.name().charAt(this.name().length() - 1) == 'S' + return this == CARROTS || this == POTATOES; } /** @@ -1818,23 +1925,21 @@ public enum XMaterial { * {@code "REGEX:^.{1,3}$" -> Material names that have 3 letters only: BED, MAP, AIR} * *

- * The reason that there are tags for {@code CONTAINS} and {@code REGEX} - * is for the performance. - * Please avoid using the {@code REGEX} tag if you can use the {@code CONTAINS} tag. + * The reason that there are tags for {@code CONTAINS} and {@code REGEX} is for the performance. + * Although RegEx patterns are cached in this method, + * please avoid using the {@code REGEX} tag if you can use the {@code CONTAINS} tag instead. * It'll have a huge impact on performance. * Please avoid using {@code (capturing groups)} there's no use for them in this case. * If you want to use groups, use {@code (?: non-capturing groups)}. It's faster. *

- * You can make a cache for pre-compiled RegEx patterns from your config. - * It's better, but not much faster since these patterns are not that complex. - *

* Want to learn RegEx? You can mess around in RegExr website. * * @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 boolean isOneOf(@Nullable Collection materials) { + public boolean isOneOf( Collection materials) { if (materials == null || materials.isEmpty()) return false; String name = this.name(); @@ -1859,21 +1964,6 @@ public enum XMaterial { 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. @@ -1881,87 +1971,75 @@ public enum XMaterial { * Use {@link #parseItem()} instead when creating new ItemStacks. * * @param item the item to change its type. + * * @see #parseItem() * @since 3.0.0 */ - @NotNull + @SuppressWarnings("deprecation") - public ItemStack setType(@NotNull ItemStack item) { + public ItemStack setType( ItemStack item) { Objects.requireNonNull(item, "Cannot set material for null ItemStack"); Material material = this.parseMaterial(); - Validate.isTrue(material != null, "Unsupported material: " + this.name()); + Objects.requireNonNull(material, () -> "Unsupported material: " + this.name()); item.setType(material); - if (!ISFLAT && !this.isDamageable()) item.setDurability(this.data); + if (!Data.ISFLAT && material.getMaxDurability() <= 0) item.setDurability(this.data); return item; } /** - * Checks if the given string matches any of this material's legacy material names. + * Checks if the given material name matches any of this xmaterial's legacy material names. * All the values passed to this method will not be null or empty and are formatted correctly. * - * @param name the name to check - * @return true if it's one of the legacy names. + * @param name the material name to check. + * + * @return true if it's one of the legacy names, otherwise false. * @since 2.0.0 */ - private boolean anyMatchLegacy(@NotNull String name) { - for (String legacy : this.legacy) { - if (legacy.isEmpty()) break; // Left-side suggestion list - if (name.equals(legacy)) return true; + private boolean anyMatchLegacy( String name) { + for (int i = this.legacy.length - 1; i >= 0; i--) { + if (name.equals(this.legacy[i])) return true; } return false; } /** - * User-friendly readable name for this material - * In most cases you should be using {@link #name()} instead. + * Parses an enum name to a user-friendly name. + * These names will have underlines removed and with each word capitalized. + *

+ * Examples: + *

+     *     {@literal EMERALD                 -> Emerald}
+     *     {@literal EMERALD_BLOCK           -> Emerald Block}
+     *     {@literal ENCHANTED_GOLDEN_APPLE  -> Enchanted Golden Apple}
+     * 
* - * @return string of this object. - * @see #toWord(String) + * @return a more user-friendly enum name. * @since 3.0.0 */ @Override + public String toString() { - return toWord(this.name()); + return WordUtils.capitalize(this.name().replace('_', ' ').toLowerCase(Locale.ENGLISH)); } /** * Gets the ID (Magic value) of the material. + * https://www.minecraftinfo.com/idlist.htm * - * @return the ID of the material or -1 if it's a new block or the material is not supported. + * @return the ID of the material or -1 if it's not a legacy material or the server doesn't support the material. * @see #matchXMaterial(int, byte) * @since 2.2.0 */ @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(); + if (material == null) return -1; + if (Data.ISFLAT && !material.isLegacy()) return -1; return material.getId(); } - /** - * Checks if the material has any duplicates. - * - * @return true if there is a duplicated name for this material, otherwise false. - * @see #isDuplicated(String) - * @since 2.0.0 - */ - public boolean isDuplicated() { - return DUPLICATED.containsKey(this); - } - - /** - * Checks if the material can be damaged by using it. - * Names going through this method are not formatted. - * - * @return true if the item can be damaged (have its durability changed), otherwise false. - * @see #isDamageable(String) - * @since 1.0.0 - */ - public boolean isDamageable() { - return isDamageable(this.name()); - } - /** * The data value of this material pre-flattening. *

@@ -1976,179 +2054,131 @@ public enum XMaterial { return data; } - /** - * Get a list of materials names that was previously used by older versions. - * If the material was added in a new version {@link #isNewVersion()}, - * then the first element will indicate which version the material was added in. - * - * @return a list of legacy material names and the first element as the version the material was added in if new. - * @since 1.0.0 - */ - @NotNull - public String[] getLegacy() { - return legacy; - } - /** * Parses an item from this XMaterial. * Uses data values on older versions. * * @return an ItemStack with the same material (and data value if in older versions.) - * @see #parseItem(boolean) - * @see #setType(ItemStack) - * @since 1.0.0 - */ - @Nullable - public ItemStack parseItem() { - return parseItem(false); - } - - /** - * Parses an item from this XMaterial. - * Uses data values on older versions. - * - * @param suggest if true {@link #parseMaterial(boolean)} true will be used. - * @return an ItemStack with the same material (and data value if in older versions.) * @see #setType(ItemStack) * @since 2.0.0 */ - @Nullable + @SuppressWarnings("deprecation") - public ItemStack parseItem(boolean suggest) { - Material material = this.parseMaterial(suggest); + public ItemStack parseItem() { + Material material = this.parseMaterial(); if (material == null) return null; - return ISFLAT ? new ItemStack(material) : new ItemStack(material, 1, this.data); + return Data.ISFLAT ? new ItemStack(material) : new ItemStack(material, 1, this.data); } /** * Parses the material of this XMaterial. * * @return the material related to this XMaterial based on the server version. - * @see #parseMaterial(boolean) * @since 1.0.0 */ - @Nullable + public Material parseMaterial() { - return parseMaterial(false); - } - - /** - * Parses the material of this XMaterial and accepts suggestions. - * - * @param suggest use a suggested material (from older materials) if the material is added in a later version of Minecraft. - * @return the material related to this XMaterial based on the server version. - * @since 2.0.0 - */ - @SuppressWarnings("OptionalAssignedToNull") - @Nullable - public Material parseMaterial(boolean suggest) { - Optional cache = PARSED_CACHE.getIfPresent(this); - if (cache != null) return cache.orElse(null); - Material mat; - - if (!ISFLAT && this.isDuplicated()) mat = requestOldMaterial(suggest); - else { - mat = Material.getMaterial(this.name()); - if (mat == null) mat = requestOldMaterial(suggest); - } - - Optional opt = Optional.ofNullable(mat); - PARSED_CACHE.put(this, opt); - return mat; - } - - /** - * Parses a material for older versions of Minecraft. - * Accepts suggestions if specified. - * - * @param suggest if true suggested materials will be considered for old versions. - * @return a parsed material suitable for the current Minecraft version. - * @see #parseMaterial(boolean) - * @since 2.0.0 - */ - @Nullable - private Material requestOldMaterial(boolean suggest) { - for (int i = this.legacy.length - 1; i >= 0; i--) { - String legacy = this.legacy[i]; - - // Check if we've reached the end and the last string is our - // material version. - if (i == 0 && legacy.charAt(1) == '.') return null; - - // According to the suggestion list format, all the other names continuing - // from here are considered as a "suggestion" - // The empty string is an indicator for suggestion list on the left side. - if (legacy.isEmpty()) { - if (suggest) continue; - break; - } - - Material material = Material.getMaterial(legacy); - if (material != null) return material; - } - return null; + return this.material; } /** * Checks if an item has the same material (and data value on older versions). * * @param item item to check. + * * @return true if the material is the same as the item's material (and data value if on older versions), otherwise false. * @since 1.0.0 */ @SuppressWarnings("deprecation") - public boolean isSimilar(@NotNull ItemStack item) { + public boolean isSimilar( ItemStack item) { Objects.requireNonNull(item, "Cannot compare with null ItemStack"); if (item.getType() != this.parseMaterial()) return false; - return ISFLAT || this.isDamageable() || item.getDurability() == this.data; - } - - /** - * Gets the suggested material names that can be used - * if the material is not supported in the current version. - * - * @return a list of suggested material names. - * @see #parseMaterial(boolean) - * @since 2.0.0 - */ - @NotNull - public List getSuggestions() { - if (this.legacy.length == 0 || this.legacy[0].charAt(1) != '.') return new ArrayList<>(); - List suggestions = new ArrayList<>(); - for (String legacy : this.legacy) { - if (legacy.isEmpty()) break; - suggestions.add(legacy); - } - return suggestions; + return Data.ISFLAT || item.getDurability() == this.data || item.getType().getMaxDurability() <= 0; } /** * Checks if this material is supported in the current version. * Suggested materials will be ignored. *

- * Note that you should use {@link #parseMaterial()} and check if it's null - * if you're going to parse and use the material later. + * Note that you should use {@link #parseMaterial()} or {@link #parseItem()} and check if it's null + * if you're going to parse and use the material/item later. * * @return true if the material exists in {@link Material} list. * @since 2.0.0 */ public boolean isSupported() { - int version = this.getMaterialVersion(); - if (version != 0) return supports(version); - - Material material = Material.getMaterial(this.name()); - if (material != null) return true; - return requestOldMaterial(false) != null; + return this.material != null; } /** - * Checks if the material is newly added after the 1.13 Aquatic Update. + * The version this material was added in. This will return the minor number in the version scheme. + * For example, if it was added in 1.16, it'll return 16 * - * @return true if the material was newly added, otherwise false. - * @see #getMaterialVersion() - * @since 2.0.0 + * @return the version number of 0 if the version was not recorded. + * @since 7.0.0 */ - public boolean isFromNewSystem() { - return this.legacy.length != 0 && Integer.parseInt(this.legacy[0].substring(2)) > 13; + public byte getMaterialVersion() { + return version; + } + + /** + * This method is needed due to Java enum initialization limitations. + * It's really inefficient yes, but it's only used for initialization. + *

+ * Yes there are many other ways like comparing the hardcoded ordinal or using a boolean in the enum constructor, + * but it's not really a big deal. + *

+ * This method should not be called if the version is after the flattening update {@link Data#ISFLAT} + * and is only used for parsing materials, not matching, for matching check {@link #DUPLICATED} + */ + private boolean isDuplicated() { + switch (this.name()) { + case "MELON": + case "CARROT": + case "POTATO": + case "GRASS": + case "BRICK": + case "NETHER_BRICK": + + // 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. + case "DARK_OAK_DOOR": + case "ACACIA_DOOR": + case "BIRCH_DOOR": + case "JUNGLE_DOOR": + case "SPRUCE_DOOR": + case "MAP": + case "CAULDRON": + case "BREWING_STAND": + case "FLOWER_POT": + return true; + default: + return false; + } + } + + /** + * Used for datas that need to be accessed during enum initilization. + * + * @since 9.0.0 + */ + private static final class Data { + /** + * The current version of the server in the a form of a major version. + * If the static initialization for this fails, you know something's wrong with the server software. + * + * @since 1.0.0 + */ + 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. + * + * @since 3.0.0 + */ + private static final boolean ISFLAT = supports(13); } } \ No newline at end of file