-1
is returned.
- *
- * @param item the itemstack
- * @param quantity the quantity which would be purchased
- * @return the buy price or minus 1 if not set
- */
- public static double getBuyPrice(ItemStack item, int quantity) {
- Item shopItem = Main.getINSTANCE().getITEMTABLE().get(Item.getItemStringForItemStack(item));
- return (shopItem != null && shopItem.hasBuyPrice()) ? shopItem.calculateBuyPrice(quantity) : -1;
- }
-
- /**
- * Gets the sell price for an item with specified quantity. -1
is returned.
- *
- * @param item the itemstack
- * @param quantity the quantity which would be sold
- * @return the sell price or minus 1 if not set
- */
- public static double getSellPrice(ItemStack item, int quantity) {
- Item shopItem = Main.getINSTANCE().getITEMTABLE().get(Item.getItemStringForItemStack(item));
- return (shopItem != null && shopItem.hasSellPrice()) ? shopItem.calculateSellPrice(quantity) : -1;
- }
-
- /**
- * Indicates to GUIShop that the item has been purchased with the specified quantity. -1
+ * is returned.
+ *
+ * @param item the itemstack
+ * @param quantity the quantity which would be purchased
+ * @return the buy price or minus 1 if not set
+ */
+ public static double getBuyPrice(ItemStack item, int quantity) {
+ Item shopItem = Main.getINSTANCE().getITEMTABLE().get(Item.getItemStringForItemStack(item));
+ return (shopItem != null && shopItem.hasBuyPrice()) ? shopItem.calculateBuyPrice(quantity) : -1;
+ }
+
+ /**
+ * Gets the sell price for an item with specified quantity. -1
+ * is returned.
+ *
+ * @param item the itemstack
+ * @param quantity the quantity which would be sold
+ * @return the sell price or minus 1 if not set
+ */
+ public static double getSellPrice(ItemStack item, int quantity) {
+ Item shopItem = Main.getINSTANCE().getITEMTABLE().get(Item.getItemStringForItemStack(item));
+ return (shopItem != null && shopItem.hasSellPrice()) ? shopItem.calculateSellPrice(quantity) : -1;
+ }
+
+ /**
+ * Indicates to GUIShop that the item has been purchased with the specified
+ * quantity. false
- *
- * @return true if the item has a potion, false otherwise
- */
- public boolean hasPotion() {
- return potion != null;
- }
-
- /**
- * If the specified material is a potion, either a normal potion,
- * splash potion, or lingering potion.
- *
- * @param material the material
- * @return true if a potion, false otherwise
- */
- private static boolean isPotionMaterial(String material) {
- return (POTION_MATERIALS[0].equalsIgnoreCase(material) || POTION_MATERIALS[1].equalsIgnoreCase(material)
- || POTION_MATERIALS[2].equalsIgnoreCase(material));
- }
-
- /**
- * Whether this item's material is a potion, splash potion, or
- * lingering potion
- *
- * @return true if the material is some kind of potion, false otherwise
- */
- public boolean isAnyPotion() {
- return isPotionMaterial(material);
- }
-
- /**
- * Sets and parses the potion type of the item. true
,
- * calculate the buy price taking based on the given quantity. true
,
- * calculate the sell price taking based on the given quantity. Config.getCannotBuy()
is returned.
- * If free, Config.getFreeLore
is returned.
- * Otherwise, the buy price is calculated based on the quantity, and the
- * lore displaying the calculated buy price is returned. Takes into
- * account dynamic pricing, if enabled.
- *
- * @param quantity the quantity of the item
- * @return the buy price lore
- */
- public String getBuyLore(int quantity) {
- if (hasBuyPrice()) {
-
- double buyPriceAsDouble = getBuyPriceAsDouble();
- if (buyPriceAsDouble != 0) {
-
- return Config.getBuyLore().replace("{amount}",
- Config.getCurrency() + Main.economyFormat(calculateBuyPrice(quantity)) + Config.getCurrencySuffix());
- }
- return Config.getFreeLore();
- }
- return Config.getCannotBuy();
- }
-
- /**
- * Gets the lore display for this item's sell price. Config.getCannotSell()
is returned.
- * Otherwise, the sell price is calculated based on the quantity, and the
- * lore displaying the calculated sell price is returned. Takes into
- * account dynamic pricing, if enabled.
- *
- * @param quantity the quantity of the item
- * @return the sell price lore
- */
- public String getSellLore(int quantity) {
- if (hasSellPrice()) {
- return Config.getSellLore().replace("{amount}",
- Config.getCurrency() + Main.economyFormat(calculateSellPrice(quantity)) + Config.getCurrencySuffix());
- }
- return Config.getCannotSell();
- }
-
- /**
- * If the item is a mob spawner, getMaterial().toUpperCase
- * + ":" + getMobType().toLowerCase()
is returned.
- * Otherwise, getMaterial().toUpperCase
is simply returned.
- *
- * @return the item string representation
- */
- public String getItemString() {
- if (isMobSpawner()) {
- return material.toUpperCase() + ":spawner:" + getMobType().toLowerCase();
- }
- return material.toUpperCase();
- }
-
- /**
- * Checks if the item is a mob spawner, accounting for
- * differences in server versions.
- *
- * @param item the itemstack
- * @return whether the item is a mob spawner
- */
- public static boolean isSpawnerItem(ItemStack item) {
- return item.getType().name().equals(SPAWNER_MATERIAL);
- }
-
- /**
- * Equivalent of {@link Item#getItemString()} for an ItemStack,
- * i.e., any minecraft item, not just a shop item. item.getType().toString().toUpperCase
- * + ":" + mobType.toString().toLowerCase()
is returned where
- * mobtype is the mob type of the mob spawner.
- * Otherwise, getType().toString().toUpperCase
is simply returned.
- *
- * @param item the itemstack
- * @return the item string representation of the itemstack
- */
- public static String getItemStringForItemStack(ItemStack item) {
- if (isSpawnerItem(item)) {
-
- String mobType;
- NBTTagCompound cmp = ItemNBTUtil.getTag(item);
- if (cmp.hasKey("GUIShopSpawner")) {
- mobType = cmp.getString("GUIShopSpawner");
-
- } else if (cmp.hasKey("BlockEntityTag")) {
- NBTTagCompound subCmp = (NBTTagCompound) cmp.get("BlockEntityTag");
- mobType = subCmp.getString("EntityId").toUpperCase();
-
- } else {
- // default to pig
- mobType = "PIG";
- }
-
- return item.getType().toString().toUpperCase() + ":spawner:" + mobType.toString().toLowerCase();
-
- }
- return item.getType().toString().toUpperCase();
- }
-
- /**
- * Parses the material of this Item. null
should be returned. null
if invalid
- */
- public EntityType parseMobSpawnerType() {
- @SuppressWarnings("deprecation")
- EntityType type = EntityType.fromName(getMobType());
- if (type != null) {
- return type;
- }
-
- Main.debugLog("Failed to find entity type using EntityType#fromName");
- try {
- return EntityType.valueOf(getMobType());
- } catch (IllegalArgumentException ignored) {}
-
- Main.debugLog("Failed to find entity type using EntityType#valueOf");
- return null;
- }
-
- /**
- * Renames a GuiItem
- *
- * @param gItem the gui item
- * @param name the new name
- * @return an updated gui item
- */
- public static GuiItem renameGuiItem(GuiItem gItem, String name) {
- ItemStack item = gItem.getItem().clone();
- ItemMeta itemMeta = item.getItemMeta();
- itemMeta.setDisplayName(name);
- item.setItemMeta(itemMeta);
- return new GuiItem(item);
- }
+ /**
+ * The name of this {@link Item} when presented on the GUI.
+ */
+ @Getter
+ @Setter
+ private String shopName, buyName;
+
+ @Getter
+ @Setter
+ private int slot;
+
+ @Getter
+ @Setter
+ private int configSlot;
+
+ /**
+ * The Material of this {@link Item}.
+ */
+ @Getter
+ @Setter
+ private String material;
+
+ /**
+ * The price to buy this {@link Item}.
+ */
+ @Getter
+ @Setter
+ private Object buyPrice;
+
+ /**
+ * The mob ID of this item if it's a spawner {@link Item}.
+ */
+ @Getter
+ @Setter
+ private String mobType;
+
+ /**
+ * The amount of money given when selling this {@link Item}.
+ */
+ @Getter
+ @Setter
+ private Object sellPrice;
+
+ /**
+ * Whether this item, specifically, uses dynamic pricing
+ */
+ @Getter
+ @Setter
+ private boolean useDynamicPricing;
+
+ /**
+ * The slot of this {@link Item} when presented on the GUI.
+ */
+ @Getter
+ @Setter
+ private ItemType itemType;
+
+ @Getter
+ @Setter
+ private Listfalse
+ *
+ * @return true if the item has a potion, false otherwise
+ */
+ public boolean hasPotion() {
+ return potion != null;
+ }
+
+ /**
+ * If the specified material is a potion, either a normal potion, splash
+ * potion, or lingering potion.
+ *
+ * @param material the material
+ * @return true if a potion, false otherwise
+ */
+ private static boolean isPotionMaterial(String material) {
+ return (POTION_MATERIALS[0].equalsIgnoreCase(material) || POTION_MATERIALS[1].equalsIgnoreCase(material)
+ || POTION_MATERIALS[2].equalsIgnoreCase(material));
+ }
+
+ /**
+ * Whether this item's material is a potion, splash potion, or lingering
+ * potion
+ *
+ * @return true if the material is some kind of potion, false otherwise
+ */
+ public boolean isAnyPotion() {
+ return isPotionMaterial(material);
+ }
+
+ /**
+ * Sets and parses the potion type of the item. true
, calculate the buy
+ * price taking based on the given quantity. true
, calculate the sell
+ * price taking based on the given quantity. Config.getCannotBuy()
is returned.
+ * If free, Config.getFreeLore
is returned. Otherwise, the buy
+ * price is calculated based on the quantity, and the lore displaying the
+ * calculated buy price is returned. Takes into account dynamic pricing, if
+ * enabled.
+ *
+ * @param quantity the quantity of the item
+ * @return the buy price lore
+ */
+ public String getBuyLore(int quantity) {
+ if (hasBuyPrice()) {
+
+ double buyPriceAsDouble = getBuyPriceAsDouble();
+ if (buyPriceAsDouble != 0) {
+
+ return Config.getBuyLore().replace("{amount}",
+ Config.getCurrency() + Main.economyFormat(calculateBuyPrice(quantity)) + Config.getCurrencySuffix());
+ }
+ return Config.getFreeLore();
+ }
+ return Config.getCannotBuy();
+ }
+
+ /**
+ * Gets the lore display for this item's sell price. Config.getCannotSell()
is
+ * returned. Otherwise, the sell price is calculated based on the quantity,
+ * and the lore displaying the calculated sell price is returned. Takes into
+ * account dynamic pricing, if enabled.
+ *
+ * @param quantity the quantity of the item
+ * @return the sell price lore
+ */
+ public String getSellLore(int quantity) {
+ if (hasSellPrice()) {
+ return Config.getSellLore().replace("{amount}",
+ Config.getCurrency() + Main.economyFormat(calculateSellPrice(quantity)) + Config.getCurrencySuffix());
+ }
+ return Config.getCannotSell();
+ }
+
+ /**
+ * If the item is a mob spawner, getMaterial().toUpperCase
+ * + ":" + getMobType().toLowerCase()
is returned. Otherwise,
+ * getMaterial().toUpperCase
is simply returned.
+ *
+ * @return the item string representation
+ */
+ public String getItemString() {
+ if (isMobSpawner()) {
+ return material.toUpperCase() + ":spawner:" + getMobType().toLowerCase();
+ }
+ return material.toUpperCase();
+ }
+
+ /**
+ * Checks if the item is a mob spawner, accounting for differences in server
+ * versions.
+ *
+ * @param item the itemstack
+ * @return whether the item is a mob spawner
+ */
+ public static boolean isSpawnerItem(ItemStack item) {
+ return item.getType().name().equals(SPAWNER_MATERIAL);
+ }
+
+ /**
+ * Equivalent of {@link Item#getItemString()} for an ItemStack, i.e.,
+ * any minecraft item, not just a shop item. item.getType().toString().toUpperCase
+ * + ":" + mobType.toString().toLowerCase()
is returned where
+ * mobtype is the mob type of the mob spawner. Otherwise,
+ * getType().toString().toUpperCase
is simply returned.
+ *
+ * @param item the itemstack
+ * @return the item string representation of the itemstack
+ */
+ public static String getItemStringForItemStack(ItemStack item) {
+ if (isSpawnerItem(item)) {
+
+ String mobType;
+ NBTTagCompound cmp = ItemNBTUtil.getTag(item);
+ if (cmp.hasKey("GUIShopSpawner")) {
+ mobType = cmp.getString("GUIShopSpawner");
+
+ } else if (cmp.hasKey("BlockEntityTag")) {
+ NBTTagCompound subCmp = (NBTTagCompound) cmp.get("BlockEntityTag");
+ mobType = subCmp.getString("EntityId").toUpperCase();
+
+ } else {
+ // default to pig
+ mobType = "PIG";
+ }
+
+ return item.getType().toString().toUpperCase() + ":spawner:" + mobType.toLowerCase();
+
+ }
+ return item.getType().toString().toUpperCase();
+ }
+
+ /**
+ * Parses the material of this Item. null
should be returned.
+ * null
if invalid
+ */
+ public EntityType parseMobSpawnerType() {
+ @SuppressWarnings("deprecation")
+ EntityType type = EntityType.fromName(getMobType());
+ if (type != null) {
+ return type;
+ }
+
+ Main.debugLog("Failed to find entity type using EntityType#fromName");
+ try {
+ return EntityType.valueOf(getMobType());
+ } catch (IllegalArgumentException ignored) {
+ }
+
+ Main.debugLog("Failed to find entity type using EntityType#valueOf");
+ return null;
+ }
+
+ /**
+ * Renames a GuiItem
+ *
+ * @param gItem the gui item
+ * @param name the new name
+ * @return an updated gui item
+ */
+ public static GuiItem renameGuiItem(GuiItem gItem, String name) {
+ ItemStack item = gItem.getItem().clone();
+ ItemMeta itemMeta = item.getItemMeta();
+ itemMeta.setDisplayName(name);
+ item.setItemMeta(itemMeta);
+ return new GuiItem(item);
+ }
}
diff --git a/src/com/pablo67340/guishop/definition/ItemType.java b/src/com/pablo67340/guishop/definition/ItemType.java
index 3805085..03f473c 100644
--- a/src/com/pablo67340/guishop/definition/ItemType.java
+++ b/src/com/pablo67340/guishop/definition/ItemType.java
@@ -1,5 +1,5 @@
package com.pablo67340.guishop.definition;
public enum ItemType {
- ITEM, COMMAND, DUMMY, SHOP, BLANK
+ ITEM, COMMAND, DUMMY, SHOP, BLANK
}
diff --git a/src/com/pablo67340/guishop/definition/ShopDef.java b/src/com/pablo67340/guishop/definition/ShopDef.java
index b01d022..9bb5460 100644
--- a/src/com/pablo67340/guishop/definition/ShopDef.java
+++ b/src/com/pablo67340/guishop/definition/ShopDef.java
@@ -11,7 +11,7 @@ public class ShopDef {
@Getter
public Listnull
if not defined
- *
- */
- private Object getBuyPrice(ItemStack item) {
- NBTTagCompound comp = ItemNBTUtil.getTag(item);
-
- if (comp.hasKey("buyPrice")) {
- Double vl = comp.getDouble("buyPrice");
- return vl;
- }
- return null;
- }
-
- /**
- * Gets the sellPrice of an item using NBT,
- * or null
if not defined
- *
- */
- private Object getSellPrice(ItemStack item) {
- NBTTagCompound comp = ItemNBTUtil.getTag(item);
-
- if (comp.hasKey("sellPrice")) {
- Double vl = comp.getDouble("sellPrice");
- return vl;
- }
- return null;
- }
+ */
+ Main.debugLog("Creator Status:" + Main.getCREATOR().contains(player.getName()));
+ if (!Main.getCREATOR().contains(player.getName())) {
+ Item item = getItems().get((currentPane.getPage() * 45) + e.getSlot());
+
+ if (item == null) {
+ return;
+
+ } else if (!item.hasBuyPrice()) {
+
+ if (Config.isAlternateSellEnabled() && item.hasSellPrice() && (e.getClick() == ClickType.RIGHT || e.getClick() == ClickType.SHIFT_RIGHT)) {
+ new AltSell(item).open(player);
+ } else {
+ player.sendMessage(Config.getPrefix() + " " + Config.getCannotBuy());
+ }
+ return;
+ }
+
+ if (item.getItemType() == ItemType.SHOP) {
+ if (Config.isAlternateSellEnabled() && item.hasSellPrice() && (e.getClick() == ClickType.RIGHT || e.getClick() == ClickType.SHIFT_RIGHT)) {
+ new AltSell(item).open(player);
+ } else {
+ new Quantity(item, this, player).loadInventory().open();
+ }
+ } else if (item.getItemType() == ItemType.COMMAND) {
+
+ double priceToPay;
+
+ Runnable dynamicPricingUpdate = null;
+
+ // sell price must be defined and nonzero for dynamic pricing to work
+ if (Config.isDynamicPricing() && item.isUseDynamicPricing() && item.hasSellPrice()) {
+
+ String itemString = item.getItemString();
+ dynamicPricingUpdate = () -> Main.getDYNAMICPRICING().buyItem(itemString, 1);
+
+ priceToPay = Main.getDYNAMICPRICING().calculateBuyPrice(itemString, 1, item.getBuyPriceAsDouble(), item.getSellPriceAsDouble());
+ } else {
+ priceToPay = item.getBuyPriceAsDouble();
+ }
+
+ if (Main.getECONOMY().withdrawPlayer(player, priceToPay).transactionSuccess()) {
+ item.getCommands().forEach(str -> {
+ Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(),
+ Main.placeholderIfy(str, player, item));
+ });
+ if (dynamicPricingUpdate != null) {
+ dynamicPricingUpdate.run();
+ }
+ } else {
+ player.sendMessage(Config.getPrefix() + Config.getNotEnoughPre() + priceToPay
+ + Config.getNotEnoughPost());
+ }
+ }
+ } else {
+ // When players remove an item from the shop
+ if (e.getClickedInventory().getType() != InventoryType.PLAYER) {
+
+ // If an item was removed from the shop, this is null
+ if (e.getCurrentItem() != null) {
+ Main.debugLog("Cursor: " + e.getCursor());
+ if (e.getInventory().getItem(e.getSlot()) != null) {
+ deleteShopItem(e.getSlot());
+ }
+
+ // When an item is dropped into the slot, it's not null. This is a new item.
+ } else {
+
+ // Run the scheduler after this event is complete. This will ensure the
+ // possible new item is in the slot in time.
+ BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
+ scheduler.scheduleSyncDelayedTask(Main.getINSTANCE(), () -> {
+ ItemStack item = e.getInventory().getItem(e.getSlot());
+ if (item != null) {
+ Main.debugLog("new Item: " + item.getType());
+ editShopItem(item, e.getSlot());
+ }
+ }, 5L);
+ }
+ } else {
+ // When the player moves an item from their inventory to the shop via shift
+ // click
+ if (e.getClick() == ClickType.SHIFT_LEFT || e.getClick() == ClickType.SHIFT_RIGHT) {
+
+ // Since shift clicking moves items to the first available slot, we can assume
+ // the item
+ // will end up in this slot.
+ int slot = e.getInventory().firstEmpty();
+
+ // Run the scheduler after this event is complete. This will ensure the
+ // possible new item is in the slot in time.
+ BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
+ scheduler.scheduleSyncDelayedTask(Main.getINSTANCE(), () -> {
+ ItemStack item = e.getInventory().getItem(slot);
+ if (item != null) {
+ Main.debugLog("new Item: " + item.getType());
+ editShopItem(item, slot);
+ }
+ }, 5L);
+ }
+ }
+ }
+ }
+
+ private void deleteShopItem(Integer slot) {
+ Main.debugLog("Deleting Item: " + slot);
+ Main.getINSTANCE().setCreatorRefresh(true);
+ Item dedItem = new Item();
+ dedItem.setMaterial("DED");
+ dedItem.setSlot(slot);
+ editedItems.put(slot, dedItem);
+ }
+
+ /**
+ * The inventory closeEvent handling for the Menu.
+ */
+ private void onClose(InventoryCloseEvent e) {
+ Player player = (Player) e.getPlayer();
+ if (!Main.CREATOR.contains(player.getName())) {
+ if (Config.isEscapeOnly() && !hasClicked) {
+ BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
+ scheduler.scheduleSyncDelayedTask(Main.getINSTANCE(), () -> menuInstance.open(player), 1L);
+
+ } else {
+ hasClicked = false;
+ }
+ } else {
+ saveItems(player);
+ }
+
+ }
+
+ public void editShopItem(ItemStack itemStack, int slot) {
+ Item item = new Item();
+ Integer mult = (44 * currentPane.getPage());
+ Integer configSlot = slot + mult;
+ Main.getINSTANCE().setCreatorRefresh(true);
+ if (itemStack != null) {
+ NBTTagCompound comp = ItemNBTUtil.getTag(itemStack);
+ ItemMeta im = itemStack.getItemMeta();
+ item.setItemType(ItemType.SHOP);
+ item.setMaterial(itemStack.getType().toString());
+ item.setSlot(configSlot);
+ if (comp.hasKey("buyPrice")) {
+
+ Object buyPrice = getBuyPrice(itemStack);
+ Main.debugLog("had buyPrice comp: " + buyPrice);
+ item.setBuyPrice(buyPrice);
+ }
+ if (comp.hasKey("sellPrice")) {
+
+ Object sellPrice = getSellPrice(itemStack);
+ item.setSellPrice(sellPrice);
+ }
+
+ if (im.hasDisplayName()) {
+ item.setShopName(im.getDisplayName());
+ }
+
+ if (comp.hasKey("buyName")) {
+ item.setBuyName(comp.getString("buyName"));
+ }
+
+ if (comp.hasKey("enchantments")) {
+ item.setEnchantments(comp.getString("enchantments").split(" "));
+ }
+
+ if (comp.hasKey("itemType")) {
+ item.setItemType(ItemType.valueOf(comp.getString("itemType")));
+ }
+
+ if (comp.hasKey("commands")) {
+ item.setItemType(ItemType.COMMAND);
+ item.setCommands(Arrays.asList(comp.getString("commands").split("::")));
+ }
+
+ if (comp.hasKey("mobType")) {
+ item.setMobType(comp.getString("mobType"));
+ }
+
+ if (im.hasLore()) {
+ Listnull
if not
+ * defined
+ *
+ */
+ private Object getBuyPrice(ItemStack item) {
+ NBTTagCompound comp = ItemNBTUtil.getTag(item);
+
+ if (comp.hasKey("buyPrice")) {
+ Double vl = comp.getDouble("buyPrice");
+ return vl;
+ }
+ return null;
+ }
+
+ /**
+ * Gets the sellPrice of an item using NBT, or null
if not
+ * defined
+ *
+ */
+ private Object getSellPrice(ItemStack item) {
+ NBTTagCompound comp = ItemNBTUtil.getTag(item);
+
+ if (comp.hasKey("sellPrice")) {
+ Double vl = comp.getDouble("sellPrice");
+ return vl;
+ }
+ return null;
+ }
}
diff --git a/src/com/pablo67340/guishop/util/Config.java b/src/com/pablo67340/guishop/util/Config.java
index 6466ea4..3905e4f 100644
--- a/src/com/pablo67340/guishop/util/Config.java
+++ b/src/com/pablo67340/guishop/util/Config.java
@@ -11,53 +11,53 @@
public final class Config {
- /**
- * True/False if GUIShop should use signs only.
- */
- @Getter
- @Setter
- private static boolean signsOnly, escapeOnly, alternateSellEnabled, soundEnabled, enableCreator,
- dynamicPricing, debugMode;
-
- /**
- * The commands mode, determines whether to intercept commands, register them, or neither
- *
- */
- @Getter
- @Setter
- private static CommandsMode commandsMode;
-
- @Getter
- private static List
- * Set an item's buy price
- */
- @SuppressWarnings("deprecation")
- public static void setPrice(Object price, Player player) {
- ItemStack item;
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- List
- * Set an item's sell price
- */
- @SuppressWarnings("deprecation")
- public static void setSell(Object price, Player player) {
- ItemStack item;
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- List
- *
- * Set an item's shop-name
- *
- * TODO: Add support for spaces in name
- */
- @SuppressWarnings("deprecation")
- public static void setShopName(String name, Player player) {
- ItemStack item;
- name = ChatColor.translateAlternateColorCodes('&', name);
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- ItemMeta im = item.getItemMeta();
-
- im.setDisplayName(name);
-
- item.setItemMeta(im);
-
- if (XMaterial.isNewVersion()) {
- player.getInventory().setItemInMainHand(item);
- } else {
- player.setItemInHand(item);
- }
-
- player.sendMessage(Config.getPrefix() + " Name set: " + name);
- }
-
- /**
- * @param name The Item Name
- * @param player The player who clicked the item.
- *
- *
- * Set an item's buy-name
- *
- * TODO: Add support for spaces in name
- */
- @SuppressWarnings("deprecation")
- public static void setBuyName(String name, Player player) {
- ItemStack item;
- name = ChatColor.translateAlternateColorCodes('&', name);
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- NBTTagCompound comp = ItemNBTUtil.getTag(item);
- comp.setString("buyName", name);
- item = ItemNBTUtil.setNBTTag(comp, item);
-
- if (XMaterial.isNewVersion()) {
- player.getInventory().setItemInMainHand(item);
- } else {
- player.setItemInHand(item);
- }
-
- player.sendMessage(Config.getPrefix() + " Buy-Name set: " + name);
- }
-
- /**
- * @param name The Item Name
- * @param player The player who clicked the item.
- *
- *
- * Set an item's buy-name
- *
- * TODO: Add support for spaces in name
- */
- @SuppressWarnings("deprecation")
- public static void setEnchantments(String enchantments, Player player) {
- ItemStack item;
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- NBTTagCompound comp = ItemNBTUtil.getTag(item);
- comp.setString("enchantments", enchantments);
- item = ItemNBTUtil.setNBTTag(comp, item);
-
- if (XMaterial.isNewVersion()) {
- player.getInventory().setItemInMainHand(item);
- } else {
- player.setItemInHand(item);
- }
-
- player.sendMessage(Config.getPrefix() + " Enchantments set: " + enchantments.trim());
- }
-
- /**
- * @param sell Sell value
- *
- * Set an item's sell price
- */
- @SuppressWarnings("deprecation")
- public static void addToShopLore(String line, Player player) {
- ItemStack item;
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- List
- * Set an item's sell price
- */
- @SuppressWarnings("deprecation")
- public static void editShopLore(Integer index, String line, Player player) {
- ItemStack item;
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- List
- * Set an item's sell price
- */
- @SuppressWarnings("deprecation")
- public static void deleteShopLore(int index, Player player) {
- ItemStack item;
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- List
- * Set an item's sell price
- */
- @SuppressWarnings("deprecation")
- public static void addToBuyLore(String line, Player player) {
- ItemStack item;
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- line = ChatColor.translateAlternateColorCodes('&', line);
- String addedLine = line;
-
- NBTTagCompound comp = ItemNBTUtil.getTag(item);
- if (comp.hasKey("loreLines")) {
- line = comp.getString("loreLines") + "::" + line;
- }
- String[] lines = line.split("::");
- comp.setString("loreLines", line);
- ItemStack fnl = ItemNBTUtil.setNBTTag(comp, item);
-
- if (XMaterial.isNewVersion()) {
- player.getInventory().setItemInMainHand(fnl);
- } else {
- player.setItemInHand(fnl);
- }
-
- player.sendMessage(Config.getPrefix() + " Added line to lore: " + addedLine);
- player.sendMessage(Config.getPrefix() + " Current Lore:");
- for (String str : lines) {
- player.sendMessage(Config.getPrefix() + " - " + str);
- }
- }
-
- /**
- * @param sell Sell value
- *
- * Set an item's sell price
- */
- @SuppressWarnings("deprecation")
- public static void editBuyLore(Integer slot, String line, Player player) {
- ItemStack item;
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- line = ChatColor.translateAlternateColorCodes('&', line);
-
- NBTTagCompound comp = ItemNBTUtil.getTag(item);
- String[] lines = null;
- if (comp.hasKey("loreLines")) {
- lines = comp.getString("loreLines").split("::");
- }
-
- List
- * Set an item's sell price
- */
- @SuppressWarnings("deprecation")
- public static void deleteBuyLore(int slot, Player player) {
- ItemStack item;
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- NBTTagCompound comp = ItemNBTUtil.getTag(item);
- String[] lines = null;
- if (comp.hasKey("loreLines")) {
- lines = comp.getString("loreLines").split("::");
- }
-
- List
- * Set an item's sell price
- */
- @SuppressWarnings("deprecation")
- public static void setType(String type, Player player) {
- ItemStack item;
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- NBTTagCompound comp = ItemNBTUtil.getTag(item);
-
- comp.setString("itemType", type);
-
- item = ItemNBTUtil.setNBTTag(comp, item);
-
- if (XMaterial.isNewVersion()) {
- player.getInventory().setItemInMainHand(item);
- } else {
- player.setItemInHand(item);
- }
-
- player.sendMessage(Config.getPrefix() + " Set Item Type: " + type);
- }
-
- /**
- * @param sell Sell value
- *
- * Set an item's sell price
- */
- @SuppressWarnings("deprecation")
- public static void addCommand(String line, Player player) {
- ItemStack item;
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- line = ChatColor.translateAlternateColorCodes('&', line);
- String addedLine = line;
-
- NBTTagCompound comp = ItemNBTUtil.getTag(item);
- if (comp.hasKey("loreLines")) {
- line = comp.getString("commands") + "::" + line;
- }
- String[] lines = line.split("::");
- comp.setString("commands", line);
- ItemStack fnl = ItemNBTUtil.setNBTTag(comp, item);
-
- if (XMaterial.isNewVersion()) {
- player.getInventory().setItemInMainHand(fnl);
- } else {
- player.setItemInHand(fnl);
- }
-
- player.sendMessage(Config.getPrefix() + " Added Command to item: " + addedLine);
- player.sendMessage(Config.getPrefix() + " Current Commands:");
- for (String str : lines) {
- player.sendMessage(Config.getPrefix() + " - " + str);
- }
- }
-
- /**
- * @param sell Sell value
- *
- * Set an item's sell price
- */
- @SuppressWarnings("deprecation")
- public static void editCommand(Integer slot, String line, Player player) {
- ItemStack item;
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- line = ChatColor.translateAlternateColorCodes('&', line);
-
- NBTTagCompound comp = ItemNBTUtil.getTag(item);
- String[] lines = null;
- if (comp.hasKey("commands")) {
- lines = comp.getString("commands").split("::");
- }
-
- List
- * Set an item's sell price
- */
- @SuppressWarnings("deprecation")
- public static void deleteCommand(int slot, Player player) {
- ItemStack item;
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- NBTTagCompound comp = ItemNBTUtil.getTag(item);
- String[] lines = null;
- if (comp.hasKey("commands")) {
- lines = comp.getString("commands").split("::");
- }
-
- List
- * Set an item's sell price
- */
- @SuppressWarnings("deprecation")
- public static void setMobType(String type, Player player) {
- ItemStack item;
- if (XMaterial.isNewVersion()) {
- item = player.getInventory().getItemInMainHand();
- } else {
- item = player.getItemInHand();
- }
-
- NBTTagCompound comp = ItemNBTUtil.getTag(item);
-
- comp.setString("mobType", type);
-
- item = ItemNBTUtil.setNBTTag(comp, item);
-
- if (XMaterial.isNewVersion()) {
- player.getInventory().setItemInMainHand(item);
- } else {
- player.setItemInHand(item);
- }
-
- player.sendMessage(Config.getPrefix() + " Set Item Mob Type: " + type);
- }
+ /**
+ * @param price Price
+ * @param player - The player who is setting an item price
+ *
+ * Set an item's buy price
+ */
+ @SuppressWarnings("deprecation")
+ public static void setPrice(Object price, Player player) {
+ ItemStack item;
+ if (XMaterial.isNewVersion()) {
+ item = player.getInventory().getItemInMainHand();
+ } else {
+ item = player.getItemInHand();
+ }
+
+ List
+ * 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
* Materials: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
- * Materials (1.8): https://helpch.at/docs/1.8/org/bukkit/Material.html
+ * Materials (1.12): https://helpch.at/docs/1.12.2/index.html?org/bukkit/Material.html
* Material IDs: https://minecraft-ids.grahamedgecombe.com/
* Material Source Code: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/Material.java
* XMaterial v1: https://www.spigotmc.org/threads/329630/
- */
-
-/**
- * XMaterial - Data Values/Pre-flattening
+ * 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 3.1.0
+ * @version 7.0.0.1
* @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_ITEM"),
ACACIA_FENCE,
ACACIA_FENCE_GATE,
ACACIA_LEAVES("LEAVES_2"),
@@ -76,21 +76,23 @@ public enum XMaterial {
ACACIA_PLANKS(4, "WOOD"),
ACACIA_PRESSURE_PLATE("WOOD_PLATE"),
ACACIA_SAPLING(4, "SAPLING"),
- ACACIA_SIGN("SIGN"),
- ACACIA_SLAB(4, "WOOD_STEP", "WOODEN_SLAB", "WOODEN_SLAB"),
+ ACACIA_SIGN("SIGN_POST", "SIGN"),
+ ACACIA_SLAB(4, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"),
ACACIA_STAIRS,
ACACIA_TRAPDOOR("TRAP_DOOR"),
- ACACIA_WALL_SIGN("SIGN_POST", "WALL_SIGN"),
+ ACACIA_WALL_SIGN("WALL_SIGN"),
ACACIA_WOOD("LOG_2"),
ACTIVATOR_RAIL,
/**
* https://minecraft.gamepedia.com/Air
+ * {@link Material#isAir()}
*
* @see #VOID_AIR
* @see #CAVE_AIR
*/
AIR,
ALLIUM(2, "RED_ROSE"),
+ ANCIENT_DEBRIS(16),
ANDESITE(5, "STONE"),
ANDESITE_SLAB,
ANDESITE_STAIRS,
@@ -103,25 +105,30 @@ public enum XMaterial {
ATTACHED_PUMPKIN_STEM(7, "PUMPKIN_STEM"),
AZURE_BLUET(3, "RED_ROSE"),
BAKED_POTATO,
- BAMBOO("1.14", "SUGAR_CANE"),
- BAMBOO_SAPLING("1.14"),
- BARREL("1.14", "CHEST"),
+ BAMBOO(0, 14, "SUGAR_CANE", ""),
+ BAMBOO_SAPLING(14),
+ BARREL(0, 14, "CHEST", ""),
BARRIER,
+ BASALT(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),
BIRCH_BOAT("BOAT_BIRCH"),
BIRCH_BUTTON("WOOD_BUTTON"),
- BIRCH_DOOR("BIRCH_DOOR_ITEM"),
+ BIRCH_DOOR("BIRCH_DOOR", "BIRCH_DOOR_ITEM"),
BIRCH_FENCE,
BIRCH_FENCE_GATE,
BIRCH_LEAVES(2, "LEAVES"),
@@ -129,69 +136,73 @@ public enum XMaterial {
BIRCH_PLANKS(2, "WOOD"),
BIRCH_PRESSURE_PLATE("WOOD_PLATE"),
BIRCH_SAPLING(2, "SAPLING"),
- BIRCH_SIGN("SIGN"),
- BIRCH_SLAB(2, "WOOD_STEP", "WOODEN_SLAB", "WOODEN_SLAB"),
+ BIRCH_SIGN("SIGN_POST", "SIGN"),
+ BIRCH_SLAB(2, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"),
BIRCH_STAIRS("BIRCH_WOOD_STAIRS"),
BIRCH_TRAPDOOR("TRAP_DOOR"),
- BIRCH_WALL_SIGN("SIGN_POST", "WALL_SIGN"),
+ BIRCH_WALL_SIGN("WALL_SIGN"),
BIRCH_WOOD(2, "LOG"),
- BLACK_BANNER("BANNER", "STANDING_BANNER"),
- BLACK_BED(15, "BED", "BED_BLOCK"),
+ BLACKSTONE(16),
+ BLACKSTONE_SLAB(16),
+ BLACKSTONE_STAIRS(16),
+ BLACKSTONE_WALL(16),
+ BLACK_BANNER("STANDING_BANNER", "BANNER"),
+ BLACK_BED(15, "BED_BLOCK", "BED"),
BLACK_CARPET(15, "CARPET"),
BLACK_CONCRETE(15, "CONCRETE"),
BLACK_CONCRETE_POWDER(15, "CONCRETE_POWDER"),
- BLACK_DYE("1.14", "INK_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, "HARD_CLAY", "STAINED_CLAY", "BLACK_TERRACOTTA"),
BLACK_SHULKER_BOX,
BLACK_STAINED_GLASS(15, "STAINED_GLASS"),
BLACK_STAINED_GLASS_PANE(15, "STAINED_GLASS_PANE"),
BLACK_TERRACOTTA(15, "HARD_CLAY", "STAINED_CLAY"),
BLACK_WALL_BANNER("WALL_BANNER"),
BLACK_WOOL(15, "WOOL"),
- BLAST_FURNACE("1.14", "FURNACE"),
+ BLAST_FURNACE(0, 14, "FURNACE", ""),
BLAZE_POWDER,
BLAZE_ROD,
BLAZE_SPAWN_EGG(61, "MONSTER_EGG"),
- BLUE_BANNER(11, "BANNER", "STANDING_BANNER"),
- BLUE_BED(4, "BED", "BED_BLOCK"),
+ BLUE_BANNER(4, "STANDING_BANNER", "BANNER"),
+ BLUE_BED(11, "BED_BLOCK", "BED"),
BLUE_CARPET(11, "CARPET"),
BLUE_CONCRETE(11, "CONCRETE"),
BLUE_CONCRETE_POWDER(11, "CONCRETE_POWDER"),
- BLUE_DYE(4, "INK_SAC", "LAPIS_LAZULI"),
- BLUE_GLAZED_TERRACOTTA(11, "1.12", "HARD_CLAY", "STAINED_CLAY", "BLUE_TERRACOTTA"),
- BLUE_ICE("1.13", "PACKED_ICE"),
+ BLUE_DYE(4, "INK_SACK", "LAPIS_LAZULI"),
+ BLUE_GLAZED_TERRACOTTA(11, 12, "HARD_CLAY", "STAINED_CLAY", "BLUE_TERRACOTTA"),
+ BLUE_ICE(0, 13, "PACKED_ICE", ""),
BLUE_ORCHID(1, "RED_ROSE"),
BLUE_SHULKER_BOX,
BLUE_STAINED_GLASS(11, "STAINED_GLASS"),
BLUE_STAINED_GLASS_PANE(11, "THIN_GLASS", "STAINED_GLASS_PANE"),
- BLUE_TERRACOTTA(11, "STAINED_CLAY"),
- BLUE_WALL_BANNER(11, "WALL_BANNER"),
+ BLUE_TERRACOTTA(11, "HARD_CLAY", "STAINED_CLAY"),
+ BLUE_WALL_BANNER(4, "WALL_BANNER"),
BLUE_WOOL(11, "WOOL"),
BONE,
BONE_BLOCK,
- BONE_MEAL(15, "INK_SAC"),
+ BONE_MEAL(15, "INK_SACK"),
BOOK,
BOOKSHELF,
BOW,
BOWL,
- BRAIN_CORAL("1.13"),
- BRAIN_CORAL_BLOCK("1.13"),
- BRAIN_CORAL_FAN("1.13"),
+ BRAIN_CORAL(13),
+ BRAIN_CORAL_BLOCK(13),
+ BRAIN_CORAL_FAN(13),
BRAIN_CORAL_WALL_FAN,
BREAD,
- BREWING_STAND("BREWING_STAND_ITEM"),
+ BREWING_STAND("BREWING_STAND", "BREWING_STAND_ITEM"),
BRICK("CLAY_BRICK"),
BRICKS("BRICK"),
BRICK_SLAB(4, "STEP"),
BRICK_STAIRS,
BRICK_WALL,
- BROWN_BANNER(3, "BANNER", "STANDING_BANNER"),
- BROWN_BED(12, "BED", "BED_BLOCK"),
+ BROWN_BANNER(3, "STANDING_BANNER", "BANNER"),
+ BROWN_BED(12, "BED_BLOCK", "BED"),
BROWN_CARPET(12, "CARPET"),
BROWN_CONCRETE(12, "CONCRETE"),
BROWN_CONCRETE_POWDER(12, "CONCRETE_POWDER"),
- BROWN_DYE(3, "INK_SAC", "COCOA", "DYE"),
- BROWN_GLAZED_TERRACOTTA(12, "1.12", "HARD_CLAY", "STAINED_CLAY", "BROWN_TERRACOTTA"),
+ BROWN_DYE(3, "INK_SACK", "DYE", "COCOA_BEANS"),
+ BROWN_GLAZED_TERRACOTTA(12, 12, "HARD_CLAY", "STAINED_CLAY", "BROWN_TERRACOTTA"),
BROWN_MUSHROOM,
BROWN_MUSHROOM_BLOCK("BROWN_MUSHROOM", "HUGE_MUSHROOM_1"),
BROWN_SHULKER_BOX,
@@ -200,22 +211,22 @@ public enum XMaterial {
BROWN_TERRACOTTA(12, "STAINED_CLAY"),
BROWN_WALL_BANNER(3, "WALL_BANNER"),
BROWN_WOOL(12, "WOOL"),
- BUBBLE_COLUMN("1.13"),
- BUBBLE_CORAL("1.13"),
- BUBBLE_CORAL_BLOCK("1.13"),
- BUBBLE_CORAL_FAN("1.13"),
+ BUBBLE_COLUMN(13),
+ BUBBLE_CORAL(13),
+ BUBBLE_CORAL_BLOCK(13),
+ BUBBLE_CORAL_FAN(13),
BUBBLE_CORAL_WALL_FAN,
BUCKET,
CACTUS,
CAKE("CAKE_BLOCK"),
- CAMPFIRE("1.14"),
+ CAMPFIRE(14),
CARROT("CARROT_ITEM"),
CARROTS("CARROT"),
CARROT_ON_A_STICK("CARROT_STICK"),
- CARTOGRAPHY_TABLE("1.14", "CRAFTING_TABLE"),
- CARVED_PUMPKIN(1, "1.13", "PUMPKIN"),
+ CARTOGRAPHY_TABLE(0, 14, "CRAFTING_TABLE", ""),
+ CARVED_PUMPKIN(1, 13, "PUMPKIN", ""),
CAT_SPAWN_EGG,
- CAULDRON("CAULDRON_ITEM"),
+ CAULDRON("CAULDRON", "CAULDRON_ITEM"),
/**
* 1.13 tag is not added because it's the same thing as {@link #AIR}
*
@@ -223,6 +234,7 @@ public enum XMaterial {
*/
CAVE_AIR("AIR"),
CAVE_SPIDER_SPAWN_EGG(59, "MONSTER_EGG"),
+ CHAIN(16),
CHAINMAIL_BOOTS,
CHAINMAIL_CHESTPLATE,
CHAINMAIL_HELMET,
@@ -234,13 +246,15 @@ public enum XMaterial {
CHICKEN("RAW_CHICKEN"),
CHICKEN_SPAWN_EGG(93, "MONSTER_EGG"),
CHIPPED_ANVIL(1, "ANVIL"),
+ CHISELED_NETHER_BRICKS(1, "NETHER_BRICKS"),
+ 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,
- CHORUS_FRUIT,
- CHORUS_PLANT,
+ CHORUS_FLOWER(0, 9),
+ CHORUS_FRUIT(0, 9),
+ CHORUS_PLANT(0, 9),
CLAY,
CLAY_BALL,
CLOCK("WATCH"),
@@ -253,17 +267,24 @@ public enum XMaterial {
COBBLESTONE_STAIRS,
COBBLESTONE_WALL("COBBLE_WALL"),
COBWEB("WEB"),
- COCOA("1.15"),
- COCOA_BEANS(3, "INK_SAC", "COCOA"),
+ COCOA(15),
+ COCOA_BEANS(3, "INK_SACK"),
COD("RAW_FISH"),
- COD_BUCKET("1.13", "BUCKET", "WATER_BUCKET"),
- COD_SPAWN_EGG("1.13", "MONSTER_EGG"),
+ COD_BUCKET(0, 13, "BUCKET", "WATER_BUCKET", ""),
+ COD_SPAWN_EGG(0, 13, "MONSTER_EGG", ""),
COMMAND_BLOCK("COMMAND"),
COMMAND_BLOCK_MINECART("COMMAND_MINECART"),
- COMPARATOR("REDSTONE_COMPARATOR", "REDSTONE_COMPARATOR_ON", "REDSTONE_COMPARATOR"),
+ /**
+ * Unlike redstone torch and redstone lamp... neither REDTONE_COMPARATOR_OFF nor REDSTONE_COMPARATOR_ON
+ * are items. REDSTONE_COMPARATOR is.
+ *
+ * @see #REDSTONE_TORCH
+ * @see #REDSTONE_LAMP
+ */
+ COMPARATOR("REDSTONE_COMPARATOR_OFF", "REDSTONE_COMPARATOR_ON", "REDSTONE_COMPARATOR"),
COMPASS,
- COMPOSTER("1.14", "CAULDRON"),
- CONDUIT("1.13", "BEACON"),
+ COMPOSTER(0, 14, "CAULDRON", ""),
+ CONDUIT(0, 13, "BEACON"),
COOKED_BEEF,
COOKED_CHICKEN,
COOKED_COD("COOKED_FISH"),
@@ -272,26 +293,45 @@ public enum XMaterial {
COOKED_RABBIT,
COOKED_SALMON(1, "COOKED_FISH"),
COOKIE,
- CORNFLOWER(4, "1.14", "BLUE_DYE"),
+ CORNFLOWER(4, 14, "BLUE_DYE", ""),
COW_SPAWN_EGG(92, "MONSTER_EGG"),
+ CRACKED_NETHER_BRICKS(2, "NETHER_BRICKS"),
+ CRACKED_POLISHED_BLACKSTONE_BRICKS(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(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,
- CUT_RED_SANDSTONE("1.13"),
+ CRYING_OBSIDIAN(16),
+ CUT_RED_SANDSTONE(13),
CUT_RED_SANDSTONE_SLAB("STONE_SLAB2"),
- CUT_SANDSTONE("1.13"),
+ CUT_SANDSTONE(13),
CUT_SANDSTONE_SLAB("STEP"),
- CYAN_BANNER(6, "BANNER", "STANDING_BANNER"),
- CYAN_BED(9, "BED", "BED_BLOCK"),
+ CYAN_BANNER(6, "STANDING_BANNER", "BANNER"),
+ CYAN_BED(9, "BED_BLOCK", "BED"),
CYAN_CARPET(9, "CARPET"),
CYAN_CONCRETE(9, "CONCRETE"),
CYAN_CONCRETE_POWDER(9, "CONCRETE_POWDER"),
- CYAN_DYE(6, "INK_SAC"),
- CYAN_GLAZED_TERRACOTTA(9, "1.12", "HARD_CLAY", "STAINED_CLAY", "CYAN_TERRACOTTA"),
+ CYAN_DYE(6, "INK_SACK"),
+ CYAN_GLAZED_TERRACOTTA(9, 12, "HARD_CLAY", "STAINED_CLAY", "CYAN_TERRACOTTA"),
CYAN_SHULKER_BOX,
CYAN_STAINED_GLASS(9, "STAINED_GLASS"),
CYAN_STAINED_GLASS_PANE(9, "STAINED_GLASS_PANE"),
@@ -302,46 +342,46 @@ public enum XMaterial {
DANDELION("YELLOW_FLOWER"),
DARK_OAK_BOAT("BOAT_DARK_OAK"),
DARK_OAK_BUTTON("WOOD_BUTTON"),
- DARK_OAK_DOOR("DARK_OAK_DOOR_ITEM"),
+ DARK_OAK_DOOR("DARK_OAK_DOOR", "DARK_OAK_DOOR_ITEM"),
DARK_OAK_FENCE,
DARK_OAK_FENCE_GATE,
- DARK_OAK_LEAVES(1, "LEAVES", "LEAVES_2"),
+ DARK_OAK_LEAVES(4, "LEAVES", "LEAVES_2"),
DARK_OAK_LOG(1, "LOG", "LOG_2"),
DARK_OAK_PLANKS(5, "WOOD"),
DARK_OAK_PRESSURE_PLATE("WOOD_PLATE"),
DARK_OAK_SAPLING(5, "SAPLING"),
- DARK_OAK_SIGN("SIGN"),
- DARK_OAK_SLAB("WOOD_STEP", "WOODEN_SLAB", "WOODEN_SLAB"),
+ DARK_OAK_SIGN("SIGN_POST", "SIGN"),
+ DARK_OAK_SLAB(5, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"),
DARK_OAK_STAIRS,
DARK_OAK_TRAPDOOR("TRAP_DOOR"),
- DARK_OAK_WALL_SIGN("SIGN_POST", "WALL_SIGN"),
+ DARK_OAK_WALL_SIGN("WALL_SIGN"),
DARK_OAK_WOOD(1, "LOG", "LOG_2"),
DARK_PRISMARINE(1, "PRISMARINE"),
- DARK_PRISMARINE_SLAB("1.13"),
- DARK_PRISMARINE_STAIRS("1.13"),
+ DARK_PRISMARINE_SLAB(13),
+ DARK_PRISMARINE_STAIRS(13),
DAYLIGHT_DETECTOR("DAYLIGHT_DETECTOR_INVERTED"),
- DEAD_BRAIN_CORAL("1.13"),
- DEAD_BRAIN_CORAL_BLOCK("1.13"),
- DEAD_BRAIN_CORAL_FAN("1.13"),
- DEAD_BRAIN_CORAL_WALL_FAN("1.13"),
- DEAD_BUBBLE_CORAL("1.13"),
- DEAD_BUBBLE_CORAL_BLOCK("1.13"),
- DEAD_BUBBLE_CORAL_FAN("1.13"),
- DEAD_BUBBLE_CORAL_WALL_FAN("1.13"),
+ DEAD_BRAIN_CORAL(13),
+ DEAD_BRAIN_CORAL_BLOCK(13),
+ DEAD_BRAIN_CORAL_FAN(13),
+ DEAD_BRAIN_CORAL_WALL_FAN(13),
+ DEAD_BUBBLE_CORAL(13),
+ DEAD_BUBBLE_CORAL_BLOCK(13),
+ DEAD_BUBBLE_CORAL_FAN(13),
+ DEAD_BUBBLE_CORAL_WALL_FAN(13),
DEAD_BUSH,
- DEAD_FIRE_CORAL("1.13"),
- DEAD_FIRE_CORAL_BLOCK("1.13"),
- DEAD_FIRE_CORAL_FAN("1.13"),
- DEAD_FIRE_CORAL_WALL_FAN("1.13"),
- DEAD_HORN_CORAL("1.13"),
- DEAD_HORN_CORAL_BLOCK("1.13"),
- DEAD_HORN_CORAL_FAN("1.13"),
- DEAD_HORN_CORAL_WALL_FAN("1.13"),
- DEAD_TUBE_CORAL("1.13"),
- DEAD_TUBE_CORAL_BLOCK("1.13"),
- DEAD_TUBE_CORAL_FAN("1.13"),
- DEAD_TUBE_CORAL_WALL_FAN("1.13"),
- DEBUG_STICK("1.13", "STICK"),
+ DEAD_FIRE_CORAL(13),
+ DEAD_FIRE_CORAL_BLOCK(13),
+ DEAD_FIRE_CORAL_FAN(13),
+ DEAD_FIRE_CORAL_WALL_FAN(13),
+ DEAD_HORN_CORAL(13),
+ DEAD_HORN_CORAL_BLOCK(13),
+ DEAD_HORN_CORAL_FAN(13),
+ DEAD_HORN_CORAL_WALL_FAN(13),
+ DEAD_TUBE_CORAL(13),
+ DEAD_TUBE_CORAL_BLOCK(13),
+ DEAD_TUBE_CORAL_FAN(13),
+ DEAD_TUBE_CORAL_WALL_FAN(13),
+ DEBUG_STICK(0, 13, "STICK", ""),
DETECTOR_RAIL,
DIAMOND,
DIAMOND_AXE,
@@ -362,16 +402,16 @@ public enum XMaterial {
DIORITE_WALL,
DIRT,
DISPENSER,
- DOLPHIN_SPAWN_EGG("1.13", "MONSTER_EGG"),
+ DOLPHIN_SPAWN_EGG(0, 13, "MONSTER_EGG", ""),
DONKEY_SPAWN_EGG(32, "MONSTER_EGG"),
DRAGON_BREATH("DRAGONS_BREATH"),
DRAGON_EGG,
- DRAGON_HEAD(5, "SKULL", "SKULL_ITEM"),
+ DRAGON_HEAD(5, 9, "SKULL", "SKULL_ITEM"),
DRAGON_WALL_HEAD(5, "SKULL", "SKULL_ITEM"),
- DRIED_KELP("1.13"),
- DRIED_KELP_BLOCK("1.13"),
+ DRIED_KELP(13),
+ DRIED_KELP_BLOCK(13),
DROPPER,
- DROWNED_SPAWN_EGG("1.13", "MONSTER_EGG"),
+ DROWNED_SPAWN_EGG(0, 13, "MONSTER_EGG", ""),
EGG,
ELDER_GUARDIAN_SPAWN_EGG(4, "MONSTER_EGG"),
ELYTRA,
@@ -387,13 +427,13 @@ public enum XMaterial {
ENDER_EYE("EYE_OF_ENDER"),
ENDER_PEARL,
END_CRYSTAL,
- END_GATEWAY,
+ END_GATEWAY(0, 9),
END_PORTAL("ENDER_PORTAL"),
END_PORTAL_FRAME("ENDER_PORTAL_FRAME"),
- END_ROD,
+ END_ROD(0, 9, "BLAZE_ROD", ""),
END_STONE("ENDER_STONE"),
END_STONE_BRICKS("END_BRICKS"),
- END_STONE_BRICK_SLAB(4, "STEP"),
+ END_STONE_BRICK_SLAB(6, "STEP"),
END_STONE_BRICK_STAIRS("SMOOTH_STAIRS"),
END_STONE_BRICK_WALL,
EVOKER_SPAWN_EGG(34, "MONSTER_EGG"),
@@ -402,27 +442,36 @@ public enum XMaterial {
FEATHER,
FERMENTED_SPIDER_EYE,
FERN(2, "LONG_GRASS"),
+ /**
+ * 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.
+ */
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, "CRAFTING_TABLE", ""),
FLINT,
FLINT_AND_STEEL,
FLOWER_BANNER_PATTERN,
- FLOWER_POT("FLOWER_POT_ITEM"), // TODO Fix exceptional material
- FOX_SPAWN_EGG("1.14"),
- FROSTED_ICE,
+ FLOWER_POT("FLOWER_POT", "FLOWER_POT_ITEM"),
+ FOX_SPAWN_EGG(14),
+ /**
+ * This special material cannot be obtained as an item.
+ */
+ FROSTED_ICE(0, 9, "PACKED_ICE", ""),
FURNACE("BURNING_FURNACE"),
FURNACE_MINECART("POWERED_MINECART"),
GHAST_SPAWN_EGG(56, "MONSTER_EGG"),
GHAST_TEAR,
+ GILDED_BLACKSTONE(16),
GLASS,
GLASS_BOTTLE,
GLASS_PANE("THIN_GLASS"),
@@ -450,51 +499,52 @@ public enum XMaterial {
GRANITE_SLAB,
GRANITE_STAIRS,
GRANITE_WALL,
- GRASS,
+ GRASS(1, "LONG_GRASS"),
GRASS_BLOCK("GRASS"),
GRASS_PATH,
GRAVEL,
- GRAY_BANNER(8, "BANNER", "STANDING_BANNER"),
- GRAY_BED(7, "BED", "BED_BLOCK"),
+ GRAY_BANNER(8, "STANDING_BANNER", "BANNER"),
+ GRAY_BED(7, "BED_BLOCK", "BED"),
GRAY_CARPET(7, "CARPET"),
GRAY_CONCRETE(7, "CONCRETE"),
GRAY_CONCRETE_POWDER(7, "CONCRETE_POWDER"),
- GRAY_DYE(8, "INK_SAC"),
- GRAY_GLAZED_TERRACOTTA(7, "1.12", "HARD_CLAY", "STAINED_CLAY", "GRAY_TERRACOTTA"),
+ GRAY_DYE(8, "INK_SACK"),
+ GRAY_GLAZED_TERRACOTTA(7, 12, "HARD_CLAY", "STAINED_CLAY", "GRAY_TERRACOTTA"),
GRAY_SHULKER_BOX,
- GRAY_STAINED_GLASS(8, "STAINED_GLASS"),
+ GRAY_STAINED_GLASS(7, "STAINED_GLASS"),
GRAY_STAINED_GLASS_PANE(7, "THIN_GLASS", "STAINED_GLASS_PANE"),
GRAY_TERRACOTTA(7, "HARD_CLAY", "STAINED_CLAY"),
GRAY_WALL_BANNER(8, "WALL_BANNER"),
- GRAY_WOOL(8, "WOOL"),
- GREEN_BANNER(2, "BANNER", "STANDING_BANNER"),
- GREEN_BED(13, "BED", "BED_BLOCK"),
+ GRAY_WOOL(7, "WOOL"),
+ GREEN_BANNER(2, "STANDING_BANNER", "BANNER"),
+ GREEN_BED(13, "BED_BLOCK", "BED"),
GREEN_CARPET(13, "CARPET"),
GREEN_CONCRETE(13, "CONCRETE"),
GREEN_CONCRETE_POWDER(13, "CONCRETE_POWDER"),
- GREEN_DYE(2, "INK_SAC", "CACTUS_GREEN"),
- GREEN_GLAZED_TERRACOTTA(13, "1.12", "HARD_CLAY", "STAINED_CLAY", "GREEN_TERRACOTTA"),
+ GREEN_DYE(2, "INK_SACK", "CACTUS_GREEN"),
+ GREEN_GLAZED_TERRACOTTA(13, 12, "HARD_CLAY", "STAINED_CLAY", "GREEN_TERRACOTTA"),
GREEN_SHULKER_BOX,
GREEN_STAINED_GLASS(13, "STAINED_GLASS"),
GREEN_STAINED_GLASS_PANE(13, "THIN_GLASS", "STAINED_GLASS_PANE"),
GREEN_TERRACOTTA(13, "HARD_CLAY", "STAINED_CLAY"),
GREEN_WALL_BANNER(2, "WALL_BANNER"),
GREEN_WOOL(13, "WOOL"),
- GRINDSTONE("1.14", "ANVIL"),
+ GRINDSTONE(0, 14, "ANVIL", ""),
GUARDIAN_SPAWN_EGG(68, "MONSTER_EGG"),
GUNPOWDER("SULPHUR"),
HAY_BLOCK,
- HEART_OF_THE_SEA("1.13"),
+ HEART_OF_THE_SEA(13),
HEAVY_WEIGHTED_PRESSURE_PLATE("IRON_PLATE"),
- HONEYCOMB("1.15"),
- HONEYCOMB_BLOCK("1.15"),
- HONEY_BLOCK("1.15", "SLIME_BLOCK"),
- HONEY_BOTTLE("1.15", "GLASS_BOTTLE"),
+ HOGLIN_SPAWN_EGG(0, 16, "MONSTER_EGG"),
+ HONEYCOMB(15),
+ HONEYCOMB_BLOCK(15),
+ HONEY_BLOCK(0, 15, "SLIME_BLOCK", ""),
+ HONEY_BOTTLE(0, 15, "GLASS_BOTTLE", ""),
HOPPER,
HOPPER_MINECART,
- HORN_CORAL("1.13"),
- HORN_CORAL_BLOCK("1.13"),
- HORN_CORAL_FAN("1.13"),
+ HORN_CORAL(13),
+ HORN_CORAL_BLOCK(13),
+ HORN_CORAL_FAN(13),
HORN_CORAL_WALL_FAN,
HORSE_SPAWN_EGG(100, "MONSTER_EGG"),
HUSK_SPAWN_EGG(23, "MONSTER_EGG"),
@@ -505,6 +555,11 @@ public enum XMaterial {
INFESTED_MOSSY_STONE_BRICKS(3, "MONSTER_EGGS"),
INFESTED_STONE("MONSTER_EGGS"),
INFESTED_STONE_BRICKS(2, "MONSTER_EGGS", "SMOOTH_BRICK"),
+ /**
+ * We will only add "INK_SAC" for {@link #BLACK_DYE} since it's
+ * the only material (linked with this material) that is added
+ * after 1.13, which means it can use both INK_SACK and INK_SAC.
+ */
INK_SAC("INK_SACK"),
IRON_AXE,
IRON_BARS("IRON_FENCE"),
@@ -525,11 +580,11 @@ public enum XMaterial {
IRON_TRAPDOOR,
ITEM_FRAME,
JACK_O_LANTERN,
- JIGSAW("1.14", "COMMAND_BLOCK", "STRUCTURE_BLOCK"),
+ JIGSAW(0, 14, "COMMAND_BLOCK", "STRUCTURE_BLOCK", ""),
JUKEBOX,
JUNGLE_BOAT("BOAT_JUNGLE"),
JUNGLE_BUTTON("WOOD_BUTTON"),
- JUNGLE_DOOR("JUNGLE_DOOR_ITEM"),
+ JUNGLE_DOOR("JUNGLE_DOOR", "JUNGLE_DOOR_ITEM"),
JUNGLE_FENCE,
JUNGLE_FENCE_GATE,
JUNGLE_LEAVES(3, "LEAVES"),
@@ -537,19 +592,19 @@ public enum XMaterial {
JUNGLE_PLANKS(3, "WOOD"),
JUNGLE_PRESSURE_PLATE("WOOD_PLATE"),
JUNGLE_SAPLING(3, "SAPLING"),
- JUNGLE_SIGN("SIGN"),
- JUNGLE_SLAB(3, "WOOD_STEP", "WOODEN_SLAB", "WOODEN_SLAB"),
+ JUNGLE_SIGN("SIGN_POST", "SIGN"),
+ JUNGLE_SLAB(3, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"),
JUNGLE_STAIRS("JUNGLE_WOOD_STAIRS"),
JUNGLE_TRAPDOOR("TRAP_DOOR"),
- JUNGLE_WALL_SIGN("SIGN_POST", "WALL_SIGN"),
+ JUNGLE_WALL_SIGN("WALL_SIGN"),
JUNGLE_WOOD(3, "LOG"),
- KELP("1.13"),
- KELP_PLANT("1.13"),
- KNOWLEDGE_BOOK("1.12", "BOOK"),
+ KELP(13),
+ KELP_PLANT(13),
+ KNOWLEDGE_BOOK(0, 12, "BOOK"),
LADDER,
- LANTERN("1.14", "SEA_LANTERN"),
+ LANTERN(0, 14, "SEA_LANTERN", ""),
LAPIS_BLOCK,
- LAPIS_LAZULI(4, "INK_SAC"),
+ LAPIS_LAZULI(4, "INK_SACK"),
LAPIS_ORE,
LARGE_FERN(3, "DOUBLE_PLANT"),
LAVA("STATIONARY_LAVA"),
@@ -559,30 +614,34 @@ public enum XMaterial {
LEATHER_BOOTS,
LEATHER_CHESTPLATE,
LEATHER_HELMET,
- LEATHER_HORSE_ARMOR("1.14", "IRON_HORSE_ARMOR"),
+ LEATHER_HORSE_ARMOR(0, 14, "IRON_HORSE_ARMOR", ""),
LEATHER_LEGGINGS,
- LECTERN("1.14", "BOOKSHELF"),
+ LECTERN(0, 14, "BOOKSHELF", ""),
LEVER,
- LIGHT_BLUE_BANNER(3, "BANNER", "STANDING_BANNER"),
- LIGHT_BLUE_BED(3, "BED", "BED_BLOCK"),
+ LIGHT_BLUE_BANNER(12, "STANDING_BANNER", "BANNER"),
+ LIGHT_BLUE_BED(3, "BED_BLOCK", "BED"),
LIGHT_BLUE_CARPET(3, "CARPET"),
LIGHT_BLUE_CONCRETE(3, "CONCRETE"),
LIGHT_BLUE_CONCRETE_POWDER(3, "CONCRETE_POWDER"),
- LIGHT_BLUE_DYE(12, "INK_SAC"),
- LIGHT_BLUE_GLAZED_TERRACOTTA(3, "1.12", "HARD_CLAY", "STAINED_CLAY", "LIGHT_BLUE_TERRACOTTA"),
+ LIGHT_BLUE_DYE(12, "INK_SACK"),
+ LIGHT_BLUE_GLAZED_TERRACOTTA(3, 12, "HARD_CLAY", "STAINED_CLAY", "LIGHT_BLUE_TERRACOTTA"),
LIGHT_BLUE_SHULKER_BOX,
LIGHT_BLUE_STAINED_GLASS(3, "STAINED_GLASS"),
LIGHT_BLUE_STAINED_GLASS_PANE(3, "THIN_GLASS", "STAINED_GLASS_PANE"),
LIGHT_BLUE_TERRACOTTA(3, "STAINED_CLAY"),
- LIGHT_BLUE_WALL_BANNER(12, "WALL_BANNER", "BANNER", "STANDING_BANNER"),
+ LIGHT_BLUE_WALL_BANNER(12, "WALL_BANNER", "STANDING_BANNER", "BANNER"),
LIGHT_BLUE_WOOL(3, "WOOL"),
- LIGHT_GRAY_BANNER(7, "BANNER", "STANDING_BANNER"),
- LIGHT_GRAY_BED(7, "BED", "BED_BLOCK"),
+ LIGHT_GRAY_BANNER(7, "STANDING_BANNER", "BANNER"),
+ LIGHT_GRAY_BED(8, "BED_BLOCK", "BED"),
LIGHT_GRAY_CARPET(8, "CARPET"),
LIGHT_GRAY_CONCRETE(8, "CONCRETE"),
LIGHT_GRAY_CONCRETE_POWDER(8, "CONCRETE_POWDER"),
- LIGHT_GRAY_DYE(7, "INK_SAC"),
- LIGHT_GRAY_GLAZED_TERRACOTTA(8, "1.12", "HARD_CLAY", "STAINED_CLAY", "LIGHT_GRAY_TERRACOTTA", "SILVER_GLAZED_TERRACOTTA/1.13"),
+ LIGHT_GRAY_DYE(7, "INK_SACK"),
+ /**
+ * Renamed to SILVER_GLAZED_TERRACOTTA in 1.12
+ * Renamed to LIGHT_GRAY_GLAZED_TERRACOTTA in 1.14
+ */
+ LIGHT_GRAY_GLAZED_TERRACOTTA(0, 12, "HARD_CLAY", "STAINED_CLAY", "LIGHT_GRAY_TERRACOTTA", "SILVER_GLAZED_TERRACOTTA"),
LIGHT_GRAY_SHULKER_BOX("SILVER_SHULKER_BOX"),
LIGHT_GRAY_STAINED_GLASS(8, "STAINED_GLASS"),
LIGHT_GRAY_STAINED_GLASS_PANE(8, "THIN_GLASS", "STAINED_GLASS_PANE"),
@@ -591,15 +650,15 @@ public enum XMaterial {
LIGHT_GRAY_WOOL(8, "WOOL"),
LIGHT_WEIGHTED_PRESSURE_PLATE("GOLD_PLATE"),
LILAC(1, "DOUBLE_PLANT"),
- LILY_OF_THE_VALLEY(15, "1.14", "WHITE_DYE"),
+ LILY_OF_THE_VALLEY(15, 14, "WHITE_DYE", ""),
LILY_PAD("WATER_LILY"),
- LIME_BANNER(10, "BANNER", "STANDING_BANNER"),
- LIME_BED(5, "BED", "BED_BLOCK"),
+ LIME_BANNER(10, "STANDING_BANNER", "BANNER"),
+ LIME_BED(5, "BED_BLOCK", "BED"),
LIME_CARPET(5, "CARPET"),
LIME_CONCRETE(5, "CONCRETE"),
LIME_CONCRETE_POWDER(5, "CONCRETE_POWDER"),
- LIME_DYE(10, "INK_SAC"),
- LIME_GLAZED_TERRACOTTA(5, "1.12", "HARD_CLAY", "STAINED_CLAY", "LIME_TERRACOTTA"),
+ LIME_DYE(10, "INK_SACK"),
+ LIME_GLAZED_TERRACOTTA(5, 12, "HARD_CLAY", "STAINED_CLAY", "LIME_TERRACOTTA"),
LIME_SHULKER_BOX,
LIME_STAINED_GLASS(5, "STAINED_GLASS"),
LIME_STAINED_GLASS_PANE(5, "STAINED_GLASS_PANE"),
@@ -608,23 +667,31 @@ public enum XMaterial {
LIME_WOOL(5, "WOOL"),
LINGERING_POTION,
LLAMA_SPAWN_EGG(103, "MONSTER_EGG"),
- LOOM("1.14"),
- MAGENTA_BANNER(13, "BANNER", "STANDING_BANNER"),
- MAGENTA_BED(2, "BED", "BED_BLOCK"),
+ LODESTONE(16),
+ LOOM(14),
+ MAGENTA_BANNER(13, "STANDING_BANNER", "BANNER"),
+ MAGENTA_BED(2, "BED_BLOCK", "BED"),
MAGENTA_CARPET(2, "CARPET"),
MAGENTA_CONCRETE(2, "CONCRETE"),
MAGENTA_CONCRETE_POWDER(2, "CONCRETE_POWDER"),
- MAGENTA_DYE(13, "INK_SAC"),
- MAGENTA_GLAZED_TERRACOTTA(2, "1.12", "HARD_CLAY", "STAINED_CLAY", "MAGENTA_TERRACOTTA"),
+ MAGENTA_DYE(13, "INK_SACK"),
+ MAGENTA_GLAZED_TERRACOTTA(2, 12, "HARD_CLAY", "STAINED_CLAY", "MAGENTA_TERRACOTTA"),
MAGENTA_SHULKER_BOX,
MAGENTA_STAINED_GLASS(2, "STAINED_GLASS"),
MAGENTA_STAINED_GLASS_PANE(2, "THIN_GLASS", "STAINED_GLASS_PANE"),
MAGENTA_TERRACOTTA(2, "HARD_CLAY", "STAINED_CLAY"),
MAGENTA_WALL_BANNER(13, "WALL_BANNER"),
MAGENTA_WOOL(2, "WOOL"),
- MAGMA_BLOCK("MAGMA"),
+ MAGMA_BLOCK(0, 10, "MAGMA"),
MAGMA_CREAM,
MAGMA_CUBE_SPAWN_EGG(62, "MONSTER_EGG"),
+ /**
+ * Adding this to the duplicated list will give you a filled map
+ * for 1.13+ versions and removing it from duplicated list will
+ * still give you a filled map in -1.12 versions.
+ * Since higher versions are our priority I'll keep 1.13+ support
+ * until I can come up with something to fix it.
+ */
MAP("EMPTY_MAP"),
MELON("MELON_BLOCK"),
MELON_SEEDS,
@@ -639,7 +706,7 @@ public enum XMaterial {
MOSSY_COBBLESTONE_STAIRS,
MOSSY_COBBLESTONE_WALL(1, "COBBLE_WALL", "COBBLESTONE_WALL"),
MOSSY_STONE_BRICKS(1, "SMOOTH_BRICK"),
- MOSSY_STONE_BRICK_SLAB(4, "STEP"),
+ MOSSY_STONE_BRICK_SLAB(5, "STEP"),
MOSSY_STONE_BRICK_STAIRS("SMOOTH_STAIRS"),
MOSSY_STONE_BRICK_WALL,
MOVING_PISTON("PISTON_BASE", "PISTON_MOVING_PIECE"),
@@ -654,6 +721,7 @@ public enum XMaterial {
MUSIC_DISC_FAR("RECORD_6"),
MUSIC_DISC_MALL("RECORD_7"),
MUSIC_DISC_MELLOHI("RECORD_8"),
+ MUSIC_DISC_PIGSTEP(16),
MUSIC_DISC_STAL("RECORD_9"),
MUSIC_DISC_STRAD("RECORD_10"),
MUSIC_DISC_WAIT("RECORD_11"),
@@ -661,23 +729,42 @@ public enum XMaterial {
MUTTON,
MYCELIUM("MYCEL"),
NAME_TAG,
- NAUTILUS_SHELL("1.13"),
+ 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"),
NETHER_BRICK_FENCE("NETHER_FENCE"),
- NETHER_BRICK_SLAB(4, "STEP"),
+ NETHER_BRICK_SLAB(6, "STEP"),
NETHER_BRICK_STAIRS,
NETHER_BRICK_WALL,
+ NETHER_GOLD_ORE(16),
NETHER_PORTAL("PORTAL"),
NETHER_QUARTZ_ORE("QUARTZ_ORE"),
+ NETHER_SPROUTS(16),
NETHER_STAR,
- NETHER_WART("NETHER_STALK"),
- NETHER_WART_BLOCK("NETHER_WARTS"),
+ /**
+ * Just like mentioned in https://minecraft.gamepedia.com/Nether_Wart
+ * Nether wart is also known as nether stalk in the code.
+ * NETHER_STALK is the planted state of nether warts.
+ */
+ NETHER_WART("NETHER_WARTS", "NETHER_STALK"),
+ NETHER_WART_BLOCK,
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"),
@@ -685,22 +772,22 @@ public enum XMaterial {
OAK_PLANKS("WOOD"),
OAK_PRESSURE_PLATE("WOOD_PLATE"),
OAK_SAPLING("SAPLING"),
- OAK_SIGN("SIGN"),
- OAK_SLAB("WOOD_STEP", "WOODEN_SLAB", "WOODEN_SLAB"),
+ OAK_SIGN("SIGN_POST", "SIGN"),
+ OAK_SLAB("WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"),
OAK_STAIRS("WOOD_STAIRS"),
OAK_TRAPDOOR("TRAP_DOOR"),
- OAK_WALL_SIGN("SIGN_POST", "WALL_SIGN"),
+ OAK_WALL_SIGN("WALL_SIGN"),
OAK_WOOD("LOG"),
OBSERVER,
OBSIDIAN,
OCELOT_SPAWN_EGG(98, "MONSTER_EGG"),
- ORANGE_BANNER(14, "BANNER", "STANDING_BANNER"),
- ORANGE_BED(1, "BED", "BED_BLOCK"),
+ ORANGE_BANNER(14, "STANDING_BANNER", "BANNER"),
+ ORANGE_BED(1, "BED_BLOCK", "BED"),
ORANGE_CARPET(1, "CARPET"),
ORANGE_CONCRETE(1, "CONCRETE"),
ORANGE_CONCRETE_POWDER(1, "CONCRETE_POWDER"),
- ORANGE_DYE(14, "INK_SAC"),
- ORANGE_GLAZED_TERRACOTTA(1, "1.12", "HARD_CLAY", "STAINED_CLAY", "ORANGE_TERRACOTTA"),
+ ORANGE_DYE(14, "INK_SACK"),
+ ORANGE_GLAZED_TERRACOTTA(1, 12, "HARD_CLAY", "STAINED_CLAY", "ORANGE_TERRACOTTA"),
ORANGE_SHULKER_BOX,
ORANGE_STAINED_GLASS(1, "STAINED_GLASS"),
ORANGE_STAINED_GLASS_PANE(1, "STAINED_GLASS_PANE"),
@@ -711,28 +798,31 @@ public enum XMaterial {
OXEYE_DAISY(8, "RED_ROSE"),
PACKED_ICE,
PAINTING,
- PANDA_SPAWN_EGG("1.14"),
+ PANDA_SPAWN_EGG(14),
PAPER,
PARROT_SPAWN_EGG(105, "MONSTER_EGG"),
PEONY(5, "DOUBLE_PLANT"),
PETRIFIED_OAK_SLAB("WOOD_STEP"),
- PHANTOM_MEMBRANE("1.13"),
- PHANTOM_SPAWN_EGG("1.13", "MONSTER_EGG"),
+ PHANTOM_MEMBRANE(13),
+ PHANTOM_SPAWN_EGG(0, 13, "MONSTER_EGG", ""),
+ PIGLIN_BANNER_PATTERN(16),
+ PIGLIN_BRUTE_SPAWN_EGG(16),
+ PIGLIN_SPAWN_EGG(57, "MONSTER_EGG"),
PIG_SPAWN_EGG(90, "MONSTER_EGG"),
- PILLAGER_SPAWN_EGG("1.14"),
- PINK_BANNER(9, "BANNER", "STANDING_BANNER"),
- PINK_BED(6, "BED", "BED_BLOCK"),
+ PILLAGER_SPAWN_EGG(14),
+ PINK_BANNER(9, "STANDING_BANNER", "BANNER"),
+ PINK_BED(6, "BED_BLOCK", "BED"),
PINK_CARPET(6, "CARPET"),
PINK_CONCRETE(6, "CONCRETE"),
PINK_CONCRETE_POWDER(6, "CONCRETE_POWDER"),
- PINK_DYE(9, "INK_SAC"),
- PINK_GLAZED_TERRACOTTA(6, "1.12", "HARD_CLAY", "STAINED_CLAY", "PINK_TERRACOTTA"),
+ PINK_DYE(9, "INK_SACK"),
+ PINK_GLAZED_TERRACOTTA(6, 12, "HARD_CLAY", "STAINED_CLAY", "PINK_TERRACOTTA"),
PINK_SHULKER_BOX,
PINK_STAINED_GLASS(6, "STAINED_GLASS"),
PINK_STAINED_GLASS_PANE(6, "THIN_GLASS", "STAINED_GLASS_PANE"),
PINK_TERRACOTTA(6, "HARD_CLAY", "STAINED_CLAY"),
PINK_TULIP(7, "RED_ROSE"),
- PINK_WALL_BANNER(14, "WALL_BANNER"),
+ PINK_WALL_BANNER(9, "WALL_BANNER"),
PINK_WOOL(6, "WOOL"),
PISTON("PISTON_BASE"),
PISTON_HEAD("PISTON_EXTENSION"),
@@ -744,6 +834,17 @@ public enum XMaterial {
POLISHED_ANDESITE(6, "STONE"),
POLISHED_ANDESITE_SLAB,
POLISHED_ANDESITE_STAIRS,
+ POLISHED_BASALT(16),
+ POLISHED_BLACKSTONE(16),
+ POLISHED_BLACKSTONE_BRICKS(16),
+ POLISHED_BLACKSTONE_BRICK_SLAB(16),
+ POLISHED_BLACKSTONE_BRICK_STAIRS(16),
+ POLISHED_BLACKSTONE_BRICK_WALL(16),
+ POLISHED_BLACKSTONE_BUTTON(16),
+ POLISHED_BLACKSTONE_PRESSURE_PLATE(16),
+ POLISHED_BLACKSTONE_SLAB(16),
+ POLISHED_BLACKSTONE_STAIRS(16),
+ POLISHED_BLACKSTONE_WALL(16),
POLISHED_DIORITE(4, "STONE"),
POLISHED_DIORITE_SLAB,
POLISHED_DIORITE_STAIRS,
@@ -765,6 +866,8 @@ public enum XMaterial {
POTTED_BROWN_MUSHROOM("FLOWER_POT"),
POTTED_CACTUS("FLOWER_POT"),
POTTED_CORNFLOWER,
+ POTTED_CRIMSON_FUNGUS(16),
+ POTTED_CRIMSON_ROOTS(16),
POTTED_DANDELION("YELLOW_FLOWER", "FLOWER_POT"),
POTTED_DARK_OAK_SAPLING(5, "SAPLING", "FLOWER_POT"),
POTTED_DEAD_BUSH("FLOWER_POT"),
@@ -779,32 +882,34 @@ public enum XMaterial {
POTTED_RED_MUSHROOM("FLOWER_POT"),
POTTED_RED_TULIP(4, "RED_ROSE", "FLOWER_POT"),
POTTED_SPRUCE_SAPLING(1, "SAPLING", "FLOWER_POT"),
+ POTTED_WARPED_FUNGUS(16),
+ POTTED_WARPED_ROOTS(16),
POTTED_WHITE_TULIP(6, "RED_ROSE", "FLOWER_POT"),
POTTED_WITHER_ROSE,
POWERED_RAIL,
PRISMARINE,
PRISMARINE_BRICKS(2, "PRISMARINE"),
PRISMARINE_BRICK_SLAB(4, "STEP"),
- PRISMARINE_BRICK_STAIRS("1.13"),
+ PRISMARINE_BRICK_STAIRS(13),
PRISMARINE_CRYSTALS,
PRISMARINE_SHARD,
- PRISMARINE_SLAB("1.13"),
- PRISMARINE_STAIRS("1.13"),
+ PRISMARINE_SLAB(13),
+ PRISMARINE_STAIRS(13),
PRISMARINE_WALL,
PUFFERFISH(3, "RAW_FISH"),
- PUFFERFISH_BUCKET("1.13", "BUCKET", "WATER_BUCKET"),
- PUFFERFISH_SPAWN_EGG("1.13", "MONSTER_EGG"),
+ PUFFERFISH_BUCKET(0, 13, "BUCKET", "WATER_BUCKET", ""),
+ PUFFERFISH_SPAWN_EGG(0, 13, "MONSTER_EGG", ""),
PUMPKIN,
PUMPKIN_PIE,
PUMPKIN_SEEDS,
PUMPKIN_STEM,
- PURPLE_BANNER(5, "BANNER", "STANDING_BANNER"),
- PURPLE_BED(10, "BED", "BED_BLOCK"),
+ PURPLE_BANNER(5, "STANDING_BANNER", "BANNER"),
+ PURPLE_BED(10, "BED_BLOCK", "BED"),
PURPLE_CARPET(10, "CARPET"),
PURPLE_CONCRETE(10, "CONCRETE"),
PURPLE_CONCRETE_POWDER(10, "CONCRETE_POWDER"),
- PURPLE_DYE(5, "INK_SAC"),
- PURPLE_GLAZED_TERRACOTTA(10, "1.12", "HARD_CLAY", "STAINED_CLAY", "PURPLE_TERRACOTTA"),
+ PURPLE_DYE(5, "INK_SACK"),
+ PURPLE_GLAZED_TERRACOTTA(10, 12, "HARD_CLAY", "STAINED_CLAY", "PURPLE_TERRACOTTA"),
PURPLE_SHULKER_BOX,
PURPLE_STAINED_GLASS(10, "STAINED_GLASS"),
PURPLE_STAINED_GLASS_PANE(10, "THIN_GLASS", "STAINED_GLASS_PANE"),
@@ -817,6 +922,7 @@ public enum XMaterial {
PURPUR_STAIRS,
QUARTZ,
QUARTZ_BLOCK,
+ QUARTZ_BRICKS(16),
QUARTZ_PILLAR(2, "QUARTZ_BLOCK"),
QUARTZ_SLAB(7, "STEP"),
QUARTZ_STAIRS,
@@ -826,21 +932,35 @@ public enum XMaterial {
RABBIT_SPAWN_EGG(101, "MONSTER_EGG"),
RABBIT_STEW,
RAIL("RAILS"),
- RAVAGER_SPAWN_EGG("1.14"),
+ RAVAGER_SPAWN_EGG(14),
REDSTONE,
REDSTONE_BLOCK,
- REDSTONE_LAMP("REDSTONE_LAMP", "REDSTONE_LAMP"),
+ /**
+ * Unlike redstone torch, REDSTONE_LAMP_ON isn't an item.
+ * The name is just here on the list for matching.
+ *
+ * @see #REDSTONE_TORCH
+ */
+ REDSTONE_LAMP("REDSTONE_LAMP_ON", "REDSTONE_LAMP_OFF"),
REDSTONE_ORE("GLOWING_REDSTONE_ORE"),
- REDSTONE_TORCH("REDSTONE_TORCH", "REDSTONE_TORCH_ON"),
- REDSTONE_WALL_TORCH(1, "REDSTONE_TORCH_ON", "REDSTONE_TORCH"),
+ /**
+ * REDSTONE_TORCH_OFF isn't an item, but a block.
+ * But REDSTONE_TORCH_ON is the item.
+ * The name is just here on the list for matching.
+ */
+ REDSTONE_TORCH("REDSTONE_TORCH_OFF", "REDSTONE_TORCH_ON"),
+ REDSTONE_WALL_TORCH,
REDSTONE_WIRE,
- RED_BANNER(1, "BANNER", "STANDING_BANNER"),
- RED_BED(14, "BED", "BED_BLOCK"),
+ RED_BANNER(1, "STANDING_BANNER", "BANNER"),
+ /**
+ * Data value 14 or 0
+ */
+ RED_BED(0, "BED_BLOCK", "BED"),
RED_CARPET(14, "CARPET"),
RED_CONCRETE(14, "CONCRETE"),
RED_CONCRETE_POWDER(14, "CONCRETE_POWDER"),
- RED_DYE(1, "ROSE_RED"),
- RED_GLAZED_TERRACOTTA(14, "1.12", "HARD_CLAY", "STAINED_CLAY", "RED_TERRACOTTA"),
+ RED_DYE(1, "INK_SACK", "ROSE_RED"),
+ RED_GLAZED_TERRACOTTA(14, 12, "HARD_CLAY", "STAINED_CLAY", "RED_TERRACOTTA"),
RED_MUSHROOM,
RED_MUSHROOM_BLOCK("RED_MUSHROOM", "HUGE_MUSHROOM_2"),
RED_NETHER_BRICKS("RED_NETHER_BRICK"),
@@ -849,7 +969,7 @@ public enum XMaterial {
RED_NETHER_BRICK_WALL,
RED_SAND(1, "SAND"),
RED_SANDSTONE,
- RED_SANDSTONE_SLAB("STONE_SLAB2", "DOUBLE_STONE_SLAB2"),
+ RED_SANDSTONE_SLAB("DOUBLE_STONE_SLAB2", "STONE_SLAB2"),
RED_SANDSTONE_STAIRS,
RED_SANDSTONE_WALL,
RED_SHULKER_BOX,
@@ -859,27 +979,29 @@ public enum XMaterial {
RED_TULIP(4, "RED_ROSE"),
RED_WALL_BANNER(1, "WALL_BANNER"),
RED_WOOL(14, "WOOL"),
- REPEATER("DIODE", "DIODE_BLOCK_ON", "DIODE_BLOCK_ON"),
+ REPEATER("DIODE_BLOCK_ON", "DIODE_BLOCK_OFF", "DIODE"),
REPEATING_COMMAND_BLOCK("COMMAND", "COMMAND_REPEATING"),
+ RESPAWN_ANCHOR(16),
ROSE_BUSH(4, "DOUBLE_PLANT"),
ROTTEN_FLESH,
SADDLE,
SALMON(1, "RAW_FISH"),
- SALMON_BUCKET("1.13", "BUCKET", "WATER_BUCKET"),
- SALMON_SPAWN_EGG("1.13", "MONSTER_EGG"),
+ SALMON_BUCKET(0, 13, "BUCKET", "WATER_BUCKET", ""),
+ SALMON_SPAWN_EGG(0, 13, "MONSTER_EGG", ""),
SAND,
SANDSTONE,
- SANDSTONE_SLAB(1, "STEP", "STONE_SLAB", "STONE_SLAB"),
+ SANDSTONE_SLAB(1, "DOUBLE_STEP", "STEP", "STONE_SLAB"),
SANDSTONE_STAIRS,
SANDSTONE_WALL,
- SCAFFOLDING("1.14", "SLIME_BLOCK"),
- SCUTE("1.13"),
- SEAGRASS("1.13", "GRASS"),
+ SCAFFOLDING(0, 14, "SLIME_BLOCK", ""),
+ SCUTE(13),
+ SEAGRASS(0, 13, "GRASS", ""),
SEA_LANTERN,
- SEA_PICKLE("1.13"),
+ SEA_PICKLE(13),
SHEARS,
SHEEP_SPAWN_EGG(91, "MONSTER_EGG"),
SHIELD,
+ SHROOMLIGHT(16),
SHULKER_BOX("PURPLE_SHULKER_BOX"),
SHULKER_SHELL,
SHULKER_SPAWN_EGG(69, "MONSTER_EGG"),
@@ -893,8 +1015,8 @@ public enum XMaterial {
SLIME_BLOCK,
SLIME_SPAWN_EGG(55, "MONSTER_EGG"),
SMITHING_TABLE,
- SMOKER("1.14", "FURNACE"),
- SMOOTH_QUARTZ("1.13"),
+ SMOKER(0, 14, "FURNACE", ""),
+ SMOOTH_QUARTZ(0, 13, "QUARTZ", ""),
SMOOTH_QUARTZ_SLAB(7, "STEP"),
SMOOTH_QUARTZ_STAIRS,
SMOOTH_RED_SANDSTONE(2, "RED_SANDSTONE"),
@@ -908,37 +1030,43 @@ public enum XMaterial {
SNOW,
SNOWBALL("SNOW_BALL"),
SNOW_BLOCK,
+ SOUL_CAMPFIRE(16),
+ SOUL_FIRE(16),
+ SOUL_LANTERN(16),
SOUL_SAND,
+ SOUL_SOIL(16),
+ SOUL_TORCH(16),
+ SOUL_WALL_TORCH(16),
SPAWNER("MOB_SPAWNER"),
- SPECTRAL_ARROW("1.9", "ARROW"),
+ SPECTRAL_ARROW(0, 9, "ARROW", ""),
SPIDER_EYE,
SPIDER_SPAWN_EGG(52, "MONSTER_EGG"),
SPLASH_POTION,
SPONGE,
SPRUCE_BOAT("BOAT_SPRUCE"),
SPRUCE_BUTTON("WOOD_BUTTON"),
- SPRUCE_DOOR("SPRUCE_DOOR_ITEM"),
+ SPRUCE_DOOR("SPRUCE_DOOR", "SPRUCE_DOOR_ITEM"),
SPRUCE_FENCE,
SPRUCE_FENCE_GATE,
- SPRUCE_LEAVES(1, "LEAVES"),
+ SPRUCE_LEAVES(1, "LEAVES", "LEAVES_2"),
SPRUCE_LOG(1, "LOG"),
SPRUCE_PLANKS(1, "WOOD"),
SPRUCE_PRESSURE_PLATE("WOOD_PLATE"),
SPRUCE_SAPLING(1, "SAPLING"),
- SPRUCE_SIGN("SIGN"),
- SPRUCE_SLAB(1, "WOOD_STEP", "WOODEN_SLAB", "WOODEN_SLAB"),
+ SPRUCE_SIGN("SIGN_POST", "SIGN"),
+ SPRUCE_SLAB(1, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"),
SPRUCE_STAIRS("SPRUCE_WOOD_STAIRS"),
SPRUCE_TRAPDOOR("TRAP_DOOR"),
- SPRUCE_WALL_SIGN("SIGN_POST", "WALL_SIGN"),
+ SPRUCE_WALL_SIGN("WALL_SIGN"),
SPRUCE_WOOD(1, "LOG"),
SQUID_SPAWN_EGG(94, "MONSTER_EGG"),
STICK,
STICKY_PISTON("PISTON_BASE", "PISTON_STICKY_BASE"),
STONE,
- STONECUTTER("1.14"),
+ STONECUTTER(14),
STONE_AXE,
STONE_BRICKS("SMOOTH_BRICK"),
- STONE_BRICK_SLAB(4, "STEP", "STONE_SLAB", "STONE_SLAB"),
+ STONE_BRICK_SLAB(4, "DOUBLE_STEP", "STEP", "STONE_SLAB"),
STONE_BRICK_STAIRS("SMOOTH_STAIRS"),
STONE_BRICK_WALL,
STONE_BUTTON,
@@ -946,15 +1074,18 @@ public enum XMaterial {
STONE_PICKAXE,
STONE_PRESSURE_PLATE("STONE_PLATE"),
STONE_SHOVEL("STONE_SPADE"),
- STONE_SLAB("STEP", "STONE_SLAB"),
+ STONE_SLAB("DOUBLE_STEP", "STEP"),
STONE_STAIRS,
STONE_SWORD,
STRAY_SPAWN_EGG(6, "MONSTER_EGG"),
+ STRIDER_SPAWN_EGG(16),
STRING,
STRIPPED_ACACIA_LOG("LOG_2"),
STRIPPED_ACACIA_WOOD("LOG_2"),
STRIPPED_BIRCH_LOG(2, "LOG"),
STRIPPED_BIRCH_WOOD(2, "LOG"),
+ STRIPPED_CRIMSON_HYPHAE(16),
+ STRIPPED_CRIMSON_STEM(16),
STRIPPED_DARK_OAK_LOG("LOG"),
STRIPPED_DARK_OAK_WOOD("LOG"),
STRIPPED_JUNGLE_LOG(3, "LOG"),
@@ -963,41 +1094,50 @@ public enum XMaterial {
STRIPPED_OAK_WOOD("LOG"),
STRIPPED_SPRUCE_LOG(1, "LOG"),
STRIPPED_SPRUCE_WOOD(1, "LOG"),
+ STRIPPED_WARPED_HYPHAE(16),
+ STRIPPED_WARPED_STEM(16),
STRUCTURE_BLOCK,
/**
* Originally developers used barrier blocks for its purpose.
- * 1.10 will be parsed as 1.9 version.
+ * 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, "MUSHROOM_STEW", ""),
+ SWEET_BERRIES(14),
+ SWEET_BERRY_BUSH(0, 14, "GRASS", ""),
TALL_GRASS(2, "DOUBLE_PLANT"),
- TALL_SEAGRASS(2, "1.13", "TALL_GRASS"),
+ TALL_SEAGRASS(2, 13, "TALL_GRASS", ""),
+ TARGET(16),
TERRACOTTA("HARD_CLAY"),
- TIPPED_ARROW("1.9", "ARROW"),
+ TIPPED_ARROW(0, 9, "ARROW", ""),
TNT,
TNT_MINECART("EXPLOSIVE_MINECART"),
TORCH,
TOTEM_OF_UNDYING("TOTEM"),
- TRADER_LLAMA_SPAWN_EGG(103, "1.14", "MONSTER_EGG"),
+ TRADER_LLAMA_SPAWN_EGG(103, 14, "MONSTER_EGG", ""),
TRAPPED_CHEST,
- TRIDENT("1.13"),
+ TRIDENT(13),
TRIPWIRE,
TRIPWIRE_HOOK,
TROPICAL_FISH(2, "RAW_FISH"),
- TROPICAL_FISH_BUCKET("1.13", "BUCKET", "WATER_BUCKET"),
- TROPICAL_FISH_SPAWN_EGG("1.13", "MONSTER_EGG"),
- TUBE_CORAL("1.13"),
- TUBE_CORAL_BLOCK("1.13"),
- TUBE_CORAL_FAN("1.13"),
+ TROPICAL_FISH_BUCKET(0, 13, "BUCKET", "WATER_BUCKET"),
+ TROPICAL_FISH_SPAWN_EGG(0, 13, "MONSTER_EGG"),
+ TUBE_CORAL(13),
+ TUBE_CORAL_BLOCK(13),
+ TUBE_CORAL_FAN(13),
TUBE_CORAL_WALL_FAN,
- TURTLE_EGG("1.13", "EGG"),
- TURTLE_HELMET("1.13", "IRON_HELMET"),
- TURTLE_SPAWN_EGG("1.13", "CHICKEN_SPAWN_EGG"),
+ TURTLE_EGG(0, 13, "EGG", ""),
+ TURTLE_HELMET(0, 13, "IRON_HELMET", ""),
+ TURTLE_SPAWN_EGG(0, 13, "CHICKEN_SPAWN_EGG", ""),
+ TWISTING_VINES(16),
+ TWISTING_VINES_PLANT(16),
VEX_SPAWN_EGG(35, "MONSTER_EGG"),
VILLAGER_SPAWN_EGG(120, "MONSTER_EGG"),
VINDICATOR_SPAWN_EGG(36, "MONSTER_EGG"),
@@ -1009,28 +1149,59 @@ public enum XMaterial {
*/
VOID_AIR("AIR"),
WALL_TORCH("TORCH"),
- WANDERING_TRADER_SPAWN_EGG("1.14", "VILLAGER_SPAWN_EGG"),
+ WANDERING_TRADER_SPAWN_EGG(0, 14, "VILLAGER_SPAWN_EGG", ""),
+ WARPED_BUTTON(16),
+ WARPED_DOOR(16),
+ WARPED_FENCE(16),
+ WARPED_FENCE_GATE(16),
+ WARPED_FUNGUS(16),
+ WARPED_FUNGUS_ON_A_STICK(16),
+ WARPED_HYPHAE(16),
+ WARPED_NYLIUM(16),
+ WARPED_PLANKS(16),
+ WARPED_PRESSURE_PLATE(16),
+ WARPED_ROOTS(16),
+ WARPED_SIGN(0, 16, "SIGN_POST"),
+ WARPED_SLAB(16),
+ WARPED_STAIRS(16),
+ WARPED_STEM(16),
+ WARPED_TRAPDOOR(16),
+ WARPED_WALL_SIGN(0, 16, "WALL_SIGN"),
+ WARPED_WART_BLOCK(16),
+ /**
+ * This is used for blocks only.
+ * In 1.13- WATER will turn into STATIONARY_WATER after it finished spreading.
+ * 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(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_BED("BED", "BED_BLOCK"),
+ WHITE_BANNER(15, "STANDING_BANNER", "BANNER"),
+ WHITE_BED("BED_BLOCK", "BED"),
WHITE_CARPET("CARPET"),
WHITE_CONCRETE("CONCRETE"),
WHITE_CONCRETE_POWDER("CONCRETE_POWDER"),
- WHITE_DYE(15, "1.14", "INK_SAC", "BONE_MEAL"),
- WHITE_GLAZED_TERRACOTTA("1.12", "HARD_CLAY", "STAINED_CLAY", "WHITE_TERRACOTTA"),
+ WHITE_DYE(15, 14, "INK_SACK", "BONE_MEAL"),
+ WHITE_GLAZED_TERRACOTTA(0, 12, "HARD_CLAY", "STAINED_CLAY"),
WHITE_SHULKER_BOX,
WHITE_STAINED_GLASS("STAINED_GLASS"),
WHITE_STAINED_GLASS_PANE("THIN_GLASS", "STAINED_GLASS_PANE"),
- WHITE_TERRACOTTA("HARD_CLAY", "TERRACOTTA"),
+ WHITE_TERRACOTTA("HARD_CLAY", "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, "BLACK_DYE", ""),
WITHER_SKELETON_SKULL(1, "SKULL", "SKULL_ITEM"),
WITHER_SKELETON_SPAWN_EGG(5, "MONSTER_EGG"),
WITHER_SKELETON_WALL_SKULL(1, "SKULL", "SKULL_ITEM"),
@@ -1042,49 +1213,62 @@ public enum XMaterial {
WOODEN_SWORD("WOOD_SWORD"),
WRITABLE_BOOK("BOOK_AND_QUILL"),
WRITTEN_BOOK,
- YELLOW_BANNER(11, "BANNER", "STANDING_BANNER"),
- YELLOW_BED(4, "BED", "BED_BLOCK"),
+ YELLOW_BANNER(11, "STANDING_BANNER", "BANNER"),
+ YELLOW_BED(4, "BED_BLOCK", "BED"),
YELLOW_CARPET(4, "CARPET"),
YELLOW_CONCRETE(4, "CONCRETE"),
YELLOW_CONCRETE_POWDER(4, "CONCRETE_POWDER"),
- YELLOW_DYE(11, "INK_SAC", "DANDELION_YELLOW"),
- YELLOW_GLAZED_TERRACOTTA(4, "1.12", "HARD_CLAY", "STAINED_CLAY", "YELLOW_TERRACOTTA"),
+ YELLOW_DYE(11, "INK_SACK", "DANDELION_YELLOW"),
+ YELLOW_GLAZED_TERRACOTTA(4, 12, "HARD_CLAY", "STAINED_CLAY", "YELLOW_TERRACOTTA"),
YELLOW_SHULKER_BOX,
YELLOW_STAINED_GLASS(4, "STAINED_GLASS"),
YELLOW_STAINED_GLASS_PANE(4, "THIN_GLASS", "STAINED_GLASS_PANE"),
YELLOW_TERRACOTTA(4, "HARD_CLAY", "STAINED_CLAY"),
YELLOW_WALL_BANNER(11, "WALL_BANNER"),
YELLOW_WOOL(4, "WOOL"),
+ ZOGLIN_SPAWN_EGG(16),
ZOMBIE_HEAD(2, "SKULL", "SKULL_ITEM"),
ZOMBIE_HORSE_SPAWN_EGG(29, "MONSTER_EGG"),
- ZOMBIE_PIGMAN_SPAWN_EGG(57, "MONSTER_EGG"),
ZOMBIE_SPAWN_EGG(54, "MONSTER_EGG"),
ZOMBIE_VILLAGER_SPAWN_EGG(27, "MONSTER_EGG"),
- ZOMBIE_WALL_HEAD(2, "SKULL", "SKULL_ITEM");
+ ZOMBIE_WALL_HEAD(2, "SKULL", "SKULL_ITEM"),
+ ZOMBIFIED_PIGLIN_SPAWN_EGG(57, "MONSTER_EGG", "ZOMBIE_PIGMAN_SPAWN_EGG");
/**
- * An immutable cached set of {@link XMaterial#values()} to avoid allocating memory for
+ * Cached array of {@link XMaterial#values()} to avoid allocating memory for
* calling the method every time.
+ * This list is unmodifiable.
*
* @since 2.0.0
*/
- public static final EnumSet
* Most of the names are not complete as this list is intended to be
- * checked with {@link String#contains} for memory usage.
+ * checked with {@link String#contains} for memory usage and maintainability.
+ *
+ * New items will probably not be added to the list since they're new and it
+ * doesn't matter what their data value is.
*
* @since 1.0.0
*/
- private static final ImmutableSet
@@ -1095,32 +1279,7 @@ public enum XMaterial {
*
* @since 3.0.0
*/
- private static final ImmutableMap
- * REMOVE THIS IF YOU DON'T NEED IT.
- * It'll help to free up a lot of memory.
- *
- * @see #containsLegacy(String)
- * @since 2.2.0
- */
- private static final ImmutableSet
+ * 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
*
*
- * 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.
- * @see #containsLegacy(String)
- * @since 1.0.0
- */
- public static boolean contains(@Nonnull String name) {
- Validate.notEmpty(name, "Cannot check for null or empty material name");
- name = format(name);
-
- for (XMaterial materials : VALUES)
- if (materials.name().equals(name)) return true;
- return false;
- }
-
- /**
- * Checks if the given material matches any of the available legacy names.
- * Changed names between the {@code 1.9} and {@code 1.12} versions are not supported (there are only a few anyway).
- *
- * @param name the material name.
- * @return true if it's a legacy name.
- * @see #contains(String)
- * @see #anyMatchLegacy(String)
- * @since 2.0.0
- */
- public static boolean containsLegacy(@Nonnull String name) {
- Validate.notEmpty(name, "Cannot check legacy names for null or empty material name");
- return LEGACY_VALUES.contains(format(name));
+ return null;
}
/**
* Parses the given material name as an XMaterial with unspecified data value.
*
- * @see #matchXMaterial(String, byte)
+ * @see #matchXMaterialWithData(String)
* @since 2.0.0
*/
@Nonnull
public static Optional
- * Examples
- *
* Examples
*
- * Use {@link #parseItem()} instead when creating new ItemStacks.
- *
- * @param item the item to change its type.
- * @see #parseItem()
- * @since 3.0.0
- */
- @Nonnull
- @SuppressWarnings("deprecation")
- public ItemStack setType(@Nonnull ItemStack item) {
- Objects.requireNonNull(item, "Cannot set material for null ItemStack");
-
- item.setType(this.parseMaterial());
- if (!ISFLAT && !this.isDamageable()) item.setDurability(this.data);
- return item;
- }
-
/**
* Checks if the list of given material names matches the given base material.
* Mostly used for configs.
@@ -1710,14 +1809,14 @@ public ItemStack setType(@Nonnull ItemStack item) {
*
* {@code REGEX} Examples
*
* The reason that there are tags for {@code CONTAINS} and {@code REGEX}
@@ -1734,54 +1833,73 @@ public ItemStack setType(@Nonnull ItemStack item) {
*
* @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.0.0
+ * @since 3.1.1
*/
- public boolean isOneOf(@Nullable List
+ * Use {@link #parseItem()} instead when creating new ItemStacks.
+ *
+ * @param item the item to change its type.
+ * @see #parseItem()
+ * @since 3.0.0
+ */
+ @Nonnull
+ @SuppressWarnings("deprecation")
+ public ItemStack setType(@Nonnull ItemStack item) {
+ Objects.requireNonNull(item, "Cannot set material for null ItemStack");
+ Material material = this.parseMaterial();
+ Objects.requireNonNull(material, "Unsupported material: " + this.name());
+
+ item.setType(material);
+ if (!ISFLAT && !this.isDamageable()) item.setDurability(this.data);
+ return item;
+ }
+
/**
* Checks if the given string matches any of this material's legacy material names.
+ * All the values passed to this method will not be null or empty and are formatted correctly.
*
* @param name the name to check
* @return true if it's one of the legacy names.
- * @see #containsLegacy(String)
* @since 2.0.0
*/
public boolean anyMatchLegacy(@Nonnull String name) {
- Validate.notEmpty(name, "Cannot check for legacy name for null or empty material name");
- // If it's a new material, everything after this is a suggestion.
- // At least until now except one or two materials.
- if (this.isNew()) return false;
-
- name = format(name);
- for (String legacy : this.legacy)
- if (parseLegacyMaterialName(legacy).equals(name)) return true;
+ for (String legacy : this.legacy) {
+ if (legacy.isEmpty()) break; // Left-side suggestion list
+ if (name.equals(legacy)) return true;
+ }
return false;
}
/**
- * Friendly readable string for this material
+ * User-friendly readable name for this material
* In most cases you should be using {@link #name()} instead.
*
* @return string of this object.
@@ -1789,6 +1907,7 @@ public boolean anyMatchLegacy(@Nonnull String name) {
* @since 3.0.0
*/
@Override
+ @Nonnull
public String toString() {
return toWord(this.name());
}
@@ -1802,7 +1921,7 @@ public String toString() {
*/
@SuppressWarnings("deprecation")
public int getId() {
- if (this.isNew()) return -1;
+ if (this.data != 0 || (this.version >= 13)) return -1;
Material material = this.parseMaterial();
return material == null ? -1 : material.getId();
}
@@ -1811,7 +1930,6 @@ public int getId() {
* Checks if the material has any duplicates.
*
* @return true if there is a duplicated name for this material, otherwise false.
- * @see #getXMaterialIfDuplicated()
* @see #isDuplicated(String)
* @since 2.0.0
*/
@@ -1819,19 +1937,6 @@ public boolean isDuplicated() {
return DUPLICATED.containsKey(this);
}
- /**
- * Checks if the item is duplicated for a different purpose in new versions.
- *
- * @return true if the item's name is duplicated, otherwise false.
- * @see #isDuplicated()
- * @see #getNewXMaterialIfDuplicated(String)
- * @since 2.0.0
- */
- @Nullable
- public XMaterial getXMaterialIfDuplicated() {
- return DUPLICATED.get(this);
- }
-
/**
* Checks if the material can be damaged by using it.
* Names going through this method are not formatted.
@@ -1853,6 +1958,7 @@ public boolean isDamageable() {
* @return data of this material, or 0 if none.
* @since 1.0.0
*/
+ @SuppressWarnings("deprecation")
public byte getData() {
return data;
}
@@ -1860,7 +1966,7 @@ public byte getData() {
/**
* 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 {@link MinecraftVersion}.
+ * 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
@@ -1888,7 +1994,7 @@ public ItemStack parseItem() {
* Parses an item from this XMaterial.
* Uses data values on older versions.
*
- * @param suggest if true {@link #parseMaterial(boolean true)} will be used.
+ * @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
@@ -1918,13 +2024,14 @@ public Material parseMaterial() {
*
* @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.
- * @see #matchXMaterial(String, byte)
* @since 2.0.0
*/
+ @SuppressWarnings("OptionalAssignedToNull")
@Nullable
public Material parseMaterial(boolean suggest) {
- Material mat = PARSED_CACHE.getIfPresent(this);
- if (mat != null) return mat;
+ Optional
+ * 1.13 and above as priority.
+ *
- * Supports 1.8-1.15
- * 1.13 and above as priority.
+ *
- * {@link #isVersionOrHigher(MinecraftVersion V1_13)}
+ * {@link #supports(int) 13}}
*
*
* @return true if 1.13 or higher.
* @see #getVersion()
- * @see #isVersionOrHigher(MinecraftVersion)
+ * @see #supports(int)
* @since 1.0.0
*/
public static boolean isNewVersion() {
@@ -1216,24 +1440,35 @@ public static boolean isNewVersion() {
* An invocation of this method yields exactly the same result as the expression:
*
- * {@link #getVersion()} == {@link MinecraftVersion#V1_8}
+ * !{@link #supports(int)} 9
*
*
* @since 2.0.0
*/
public static boolean isOneEight() {
- return VERSION == MinecraftVersion.V1_8;
+ return !supports(9);
+ }
+
+ /**
+ * Gets the {@link XMaterial} with this name without throwing an exception.
+ *
+ * @param name the name of the material.
+ * @return an optional that can be empty.
+ * @since 5.1.0
+ */
+ @Nonnull
+ private static Optional
- * INK_SAC:1 -> RED_DYE
- * WOOL, 14 -> RED_WOOL
- *
- *
- * @see #matchDefinedXMaterial(String, byte)
- * @see #matchXMaterial(ItemStack)
- * @since 2.0.0
- */
- @Nonnull
- public static Optional
- * INK_SAC:1 -> RED_DYE
- * WOOL, 14 -> RED_WOOL
+ * {@code INK_SACK:1 -> RED_DYE}
+ * {@code WOOL: 14 -> RED_WOOL}
*
*
* @param name the material string that consists of the material name, data and separator character.
@@ -1350,14 +1526,17 @@ public static Optional
* {@code CONTAINS} Examples:
*
- * "CONTAINS:CHEST" -> CHEST, ENDERCHEST, TRAPPED_CHEST -> true
- * "cOnTaINS:dYe" -> GREEN_DYE, YELLOW_DYE, BLUE_DYE, INK_SACK -> true
+ * {@code "CONTAINS:CHEST" -> CHEST, ENDERCHEST, TRAPPED_CHEST -> true}
+ * {@code "cOnTaINS:dYe" -> GREEN_DYE, YELLOW_DYE, BLUE_DYE, INK_SACK -> true}
*
*
- * "REGEX:^.+_.+_.+$" -> Every Material with 3 underlines or more: SHULKER_SPAWN_EGG, SILVERFISH_SPAWN_EGG, SKELETON_HORSE_SPAWN_EGG
- * "REGEX:^.{1,3}$" -> Material names that have 3 letters only: BED, MAP, AIR
+ * {@code "REGEX:^.+_.+_.+$" -> Every Material with 3 underlines or more: SHULKER_SPAWN_EGG, SILVERFISH_SPAWN_EGG, SKELETON_HORSE_SPAWN_EGG}
+ * {@code "REGEX:^.{1,3}$" -> Material names that have 3 letters only: BED, MAP, AIR}
*
*