2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2017-07-27 05:40:49 +02:00
|
|
|
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
|
2021-02-21 20:45:33 +01:00
|
|
|
index a50eb746b8774a089c39652d534920acf708b137..83fb73ccde7809c6f712af35400d607fcd791882 100644
|
2017-07-27 05:40:49 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
2021-02-21 20:45:33 +01:00
|
|
|
@@ -341,5 +341,11 @@ public final class CraftItemFactory implements ItemFactory {
|
|
|
|
final net.minecraft.server.NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag();
|
|
|
|
return net.kyori.adventure.text.event.HoverEvent.showItem(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowItem.of(item.getType().getKey(), item.getAmount(), io.papermc.paper.adventure.PaperAdventure.asBinaryTagHolder(tag))));
|
2017-07-27 05:40:49 +02:00
|
|
|
}
|
2021-02-21 20:45:33 +01:00
|
|
|
+
|
2017-07-27 05:40:49 +02:00
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
|
|
|
+ public ItemStack ensureServerConversions(ItemStack item) {
|
|
|
|
+ return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item));
|
|
|
|
+ }
|
2021-02-21 20:45:33 +01:00
|
|
|
// Paper end
|
2017-07-27 05:40:49 +02:00
|
|
|
}
|