From d80abc45fc5b8c90c7faeacb31c25e52cd2e8b47 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sat, 11 Aug 2018 17:43:31 +1000 Subject: [PATCH] SPIGOT-4253: Add way to prioritise item conversion By: md_5 --- paper-api/src/main/java/org/bukkit/UnsafeValues.java | 2 ++ paper-api/src/main/java/org/bukkit/inventory/ItemStack.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/UnsafeValues.java b/paper-api/src/main/java/org/bukkit/UnsafeValues.java index f1188b052a..33cad9015b 100644 --- a/paper-api/src/main/java/org/bukkit/UnsafeValues.java +++ b/paper-api/src/main/java/org/bukkit/UnsafeValues.java @@ -23,6 +23,8 @@ public interface UnsafeValues { Material fromLegacy(MaterialData material); + Material fromLegacy(MaterialData material, boolean itemPriority); + BlockData fromLegacy(Material material, byte data); int getDataVersion(); diff --git a/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java b/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java index 3c91cbe635..89ab47252f 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java @@ -451,7 +451,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { type = Material.getMaterial(Material.LEGACY_PREFIX + (String) args.get("type")); byte dataVal = (type.getMaxDurability() == 0) ? (byte) damage : 0; // Actually durable items get a 0 passed into conversion - type = Bukkit.getUnsafe().fromLegacy(new MaterialData(type, dataVal)); + type = Bukkit.getUnsafe().fromLegacy(new MaterialData(type, dataVal), true); // We've converted now so the data val isn't a thing and can be reset if (dataVal != 0) {