From 3feeb45b70c4ceef84605d997b9a30693c9d2b07 Mon Sep 17 00:00:00 2001 From: LobbyTech <45703035+LobbyTech-MC@users.noreply.github.com> Date: Tue, 12 Nov 2024 22:25:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D1.21=E9=83=A8=E5=88=86?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E7=89=A9=E5=93=81=E6=97=A0=E6=B3=95=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 采用CustomItemStack修复1.21菜单物品无法显示,修复在其他附属某些条件下SlimefunItemStack类型无法转换CraftItemStack问题。 --- .../general/Inventory/ChestMenu.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/ChestMenu.java b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/ChestMenu.java index a913ed7c74..38c2b1a31f 100644 --- a/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/ChestMenu.java +++ b/src/main/java/me/mrCookieSlime/CSCoreLibPlugin/general/Inventory/ChestMenu.java @@ -2,6 +2,7 @@ import city.norain.slimefun4.holder.SlimefunInventoryHolder; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack; +import io.github.bakedlibs.dough.items.CustomItemStack; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -131,15 +132,9 @@ public ChestMenu addItem(int slot, ItemStack item) { // do shallow copy due to Paper ItemStack system change // See also: https://github.com/PaperMC/Paper/pull/10852 ItemStack actual = item; - if (item instanceof SlimefunItemStack) { - ItemStack clone = new ItemStack(item.getType(), item.getAmount()); - - if (item.hasItemMeta()) { - clone.setItemMeta(item.getItemMeta()); - } - - actual = clone; - } + if (item != null) { + actual = new CustomItemStack(item); + } setSize((int) (Math.max(getSize(), Math.ceil((slot + 1) / 9d) * 9)));