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 c6bc4ec5a9)
This commit is contained in:
LexManos committed 2016-12-05 14:07:59 -08:00
1 parent 49ec3d1b93
commit 62cc9f2e63
2 files changed
+42 -3

No files matched your search

@@ -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:
@@ -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_)
{