Paper/Spigot-Server-Patches/0166-Implement-ensureServerConversions-API.patch

27 lines
1.1 KiB
Diff
Raw Normal View History

2019-05-06 04:58:04 +02:00
From 8c1e731358dc64c98eadcd0ad88ebae60fdf9339 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 May 2016 22:43:12 -0400
Subject: [PATCH] Implement ensureServerConversions API
This will take a Bukkit ItemStack and run it through any conversions a server process would perform on it,
to ensure it meets latest minecraft expectations.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
2019-05-06 04:58:04 +02:00
index a4320f8446..af1db68aa7 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
2019-05-06 04:58:04 +02:00
@@ -321,4 +321,10 @@ public final class CraftItemFactory implements ItemFactory {
public Material updateMaterial(ItemMeta meta, Material material) throws IllegalArgumentException {
return ((CraftMetaItem) meta).updateMaterial(material);
}
+ // Paper start
+ @Override
+ public ItemStack ensureServerConversions(ItemStack item) {
+ return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item));
+ }
+ // Paper end
}
--
2.21.0