From 62cc9f2e6386e0160ac1376efc6f68f6bfad0b4e Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 5 Dec 2016 14:07:59 -0800 Subject: [PATCH] Make Container.mergeItemStack respect target slot's max size when slot is non-empty. Closes #3498 Fix Shift clicking in Beacons with stacked items when fuel slot is empty. (cherry picked from commit c6bc4ec5a92b640ebe773bfa48732dfa7eb59a17) --- .../minecraft/inventory/Container.java.patch | 28 +++++++++++++++++-- .../inventory/ContainerBeacon.java.patch | 17 ++++++++++- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/inventory/Container.java.patch b/patches/minecraft/net/minecraft/inventory/Container.java.patch index 06224c3eb7..291eda9324 100644 --- a/patches/minecraft/net/minecraft/inventory/Container.java.patch +++ b/patches/minecraft/net/minecraft/inventory/Container.java.patch @@ -1,6 +1,30 @@ --- ../src-base/minecraft/net/minecraft/inventory/Container.java +++ ../src-work/minecraft/net/minecraft/inventory/Container.java -@@ -650,7 +650,7 @@ +@@ -606,18 +606,19 @@ + if (itemstack != null && func_184997_a(p_75135_1_, itemstack)) + { + int j = itemstack.field_77994_a + p_75135_1_.field_77994_a; ++ int maxSize = Math.min(slot.func_75219_a(), p_75135_1_.func_77976_d()); + +- if (j <= p_75135_1_.func_77976_d()) ++ if (j <= maxSize) + { + p_75135_1_.field_77994_a = 0; + itemstack.field_77994_a = j; + slot.func_75218_e(); + flag = true; + } +- else if (itemstack.field_77994_a < p_75135_1_.func_77976_d()) ++ else if (itemstack.field_77994_a < maxSize) + { +- p_75135_1_.field_77994_a -= p_75135_1_.func_77976_d() - itemstack.field_77994_a; +- itemstack.field_77994_a = p_75135_1_.func_77976_d(); ++ p_75135_1_.field_77994_a -= maxSize - itemstack.field_77994_a; ++ itemstack.field_77994_a = maxSize; + slot.func_75218_e(); + flag = true; + } +@@ -650,7 +651,7 @@ Slot slot1 = (Slot)this.field_75151_b.get(i); ItemStack itemstack1 = slot1.func_75211_c(); @@ -9,7 +33,7 @@ { slot1.func_75215_d(p_75135_1_.func_77946_l()); slot1.func_75218_e(); -@@ -728,7 +728,7 @@ +@@ -728,7 +729,7 @@ p_94525_2_.field_77994_a = 1; break; case 2: diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch index 23a8e90ced..090975cf71 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch @@ -1,6 +1,21 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerBeacon.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java -@@ -146,7 +146,7 @@ +@@ -91,12 +91,9 @@ + + slot.func_75220_a(itemstack1, itemstack); + } +- else if (!this.field_82864_f.func_75216_d() && this.field_82864_f.func_75214_a(itemstack1) && itemstack1.field_77994_a == 1) ++ else if (this.func_75135_a(itemstack1, 0, 1, false)) //Forge Fix Shift Clicking in beacons with stacks larger then 1. + { +- if (!this.func_75135_a(itemstack1, 0, 1, false)) +- { +- return null; +- } ++ return null; + } + else if (p_82846_2_ >= 1 && p_82846_2_ < 28) + { +@@ -146,7 +143,7 @@ public boolean func_75214_a(@Nullable ItemStack p_75214_1_) {