From 6856a2be6978554eae86bcba52be2fdd6b200140 Mon Sep 17 00:00:00 2001 From: MC_XiaoHei Date: Sat, 16 Nov 2024 08:15:15 +0800 Subject: [PATCH] fix Stackable ShulkerBoxes (#356) * fix Stackable ShulkerBoxes (#356) * use import in ShulkerBoxUtils --- .../server/0040-Stackable-ShulkerBoxes.patch | 49 ++++++++++++++++--- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/patches/server/0040-Stackable-ShulkerBoxes.patch b/patches/server/0040-Stackable-ShulkerBoxes.patch index 8d215165..75e7f0a8 100644 --- a/patches/server/0040-Stackable-ShulkerBoxes.patch +++ b/patches/server/0040-Stackable-ShulkerBoxes.patch @@ -5,8 +5,34 @@ Subject: [PATCH] Stackable ShulkerBoxes This patch is Powered by fabric-carpet(https://github.com/gnembon/fabric-carpet) and plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition) +diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java +index 8cca2ac616a2c80268c96b9f95e33f834a0fc8fd..bcca3fa530fd52238bc9444244b1f26a567f6fc4 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java +@@ -23,7 +23,7 @@ public class ClientboundContainerSetContentPacket implements Packet 1 && stack.getItem() instanceof BlockItem bi && -+ bi.getBlock() instanceof ShulkerBoxBlock && org.leavesmc.leaves.util.ShulkerBoxUtils.shulkerBoxNoItem(stack)) { -+ return org.leavesmc.leaves.LeavesConfig.shulkerBoxStackSize; ++ bi.getBlock() instanceof ShulkerBoxBlock && shulkerBoxNoItem(stack)) { ++ return LeavesConfig.shulkerBoxStackSize; + } + return stack.getMaxStackSize(); + } + ++ public static ItemStack correctItemStackMaxStackSize(ItemStack itemStack) { ++ int trulyMaxStackSize = getItemStackMaxCount(itemStack); ++ if (itemStack.getMaxStackSize() != trulyMaxStackSize) { ++ org.bukkit.inventory.ItemStack bkStack = CraftItemStack.asBukkitCopy(itemStack); ++ bkStack.editMeta(meta -> meta.setMaxStackSize(trulyMaxStackSize)); ++ itemStack = CraftItemStack.asNMSCopy(bkStack); ++ } ++ return itemStack; ++ } ++ + public static boolean isStackable(ItemStack itemStack) { + return getItemStackMaxCount(itemStack) > 1 && (!itemStack.isDamageableItem() || !itemStack.isDamaged()); + }