From 547ce9cb7c63d89462f5d3b44495c457ec72dccb Mon Sep 17 00:00:00 2001 From: SizableShrimp Date: Thu, 20 Apr 2023 03:14:17 -0500 Subject: [PATCH] Fix forge grindstone hooks allowing stacks of non-stackable items (#9458) --- .../world/inventory/GrindstoneMenu.java.patch | 11 +++++++++++ .../world/item/BundleItem.java.patch | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 patches/minecraft/net/minecraft/world/item/BundleItem.java.patch diff --git a/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch index 4affd3b1d6..7cd6c43726 100644 --- a/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch @@ -67,3 +67,14 @@ if (!ItemStack.m_41728_(itemstack, itemstack1)) { this.f_39559_.m_6836_(0, ItemStack.f_41583_); this.m_38946_(); +@@ -164,6 +_,10 @@ + itemstack2 = flag3 ? itemstack : itemstack1; + } + ++ // Forge: Skip the repair if the result would give an item stack with a count not normally obtainable ++ if (j > itemstack2.m_41741_()) ++ this.f_39559_.m_6836_(0, ItemStack.f_41583_); ++ else + this.f_39559_.m_6836_(0, this.m_39579_(itemstack2, i, j)); + } + diff --git a/patches/minecraft/net/minecraft/world/item/BundleItem.java.patch b/patches/minecraft/net/minecraft/world/item/BundleItem.java.patch new file mode 100644 index 0000000000..52a544044e --- /dev/null +++ b/patches/minecraft/net/minecraft/world/item/BundleItem.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/world/item/BundleItem.java ++++ b/net/minecraft/world/item/BundleItem.java +@@ -41,7 +_,7 @@ + } + + public boolean m_142207_(ItemStack p_150733_, Slot p_150734_, ClickAction p_150735_, Player p_150736_) { +- if (p_150735_ != ClickAction.SECONDARY) { ++ if (p_150733_.m_41613_() != 1 || p_150735_ != ClickAction.SECONDARY) { + return false; + } else { + ItemStack itemstack = p_150734_.m_7993_(); +@@ -63,6 +_,7 @@ + } + + public boolean m_142305_(ItemStack p_150742_, ItemStack p_150743_, Slot p_150744_, ClickAction p_150745_, Player p_150746_, SlotAccess p_150747_) { ++ if (p_150742_.m_41613_() != 1) return false; + if (p_150745_ == ClickAction.SECONDARY && p_150744_.m_150651_(p_150746_)) { + if (p_150743_.m_41619_()) { + m_150780_(p_150742_).ifPresent((p_186347_) -> {