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-03-16 08:19:45 +01:00
|
|
|
index 6d320bbe0c75cc0df504faacf0f7d24804b90d5f..6e748e57c4818e11ac6d4c693bc4f6e1e889f4f8 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 {
|
2021-03-16 08:19:45 +01:00
|
|
|
final net.minecraft.nbt.NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag();
|
2021-02-21 20:45:33 +01:00
|
|
|
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
|
|
|
}
|