62 lines
2.2 KiB
Diff
62 lines
2.2 KiB
Diff
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java
|
|
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java
|
|
@@ -237,6 +237,7 @@
|
|
|
|
private boolean func_145883_k()
|
|
{
|
|
+ if (net.minecraftforge.items.VanillaInventoryCodeHooks.insertHook(this)) { return true; }
|
|
IInventory iinventory = this.func_145895_l();
|
|
|
|
if (iinventory == null)
|
|
@@ -343,6 +344,7 @@
|
|
|
|
public static boolean func_145891_a(IHopper p_145891_0_)
|
|
{
|
|
+ if (net.minecraftforge.items.VanillaInventoryCodeHooks.extractHook(p_145891_0_)) { return true; }
|
|
IInventory iinventory = func_145884_b(p_145891_0_);
|
|
|
|
if (iinventory != null)
|
|
@@ -492,17 +494,31 @@
|
|
|
|
if (itemstack == null)
|
|
{
|
|
+ //Forge: BUGFIX: Again, make things respect max stack sizes.
|
|
+ int max = Math.min(p_174916_1_.func_77976_d(), p_174916_0_.func_70297_j_());
|
|
+ if (max >= p_174916_1_.field_77994_a)
|
|
+ {
|
|
p_174916_0_.func_70299_a(p_174916_2_, p_174916_1_);
|
|
p_174916_1_ = null;
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ p_174916_0_.func_70299_a(p_174916_2_, p_174916_1_.func_77979_a(max));
|
|
+ }
|
|
flag = true;
|
|
}
|
|
else if (func_145894_a(itemstack, p_174916_1_))
|
|
{
|
|
- int i = p_174916_1_.func_77976_d() - itemstack.field_77994_a;
|
|
+ //Forge: BUGFIX: Again, make things respect max stack sizes.
|
|
+ int max = Math.min(p_174916_1_.func_77976_d(), p_174916_0_.func_70297_j_());
|
|
+ if (max > itemstack.field_77994_a)
|
|
+ {
|
|
+ int i = max - itemstack.field_77994_a;
|
|
int j = Math.min(p_174916_1_.field_77994_a, i);
|
|
p_174916_1_.field_77994_a -= j;
|
|
itemstack.field_77994_a += j;
|
|
flag = j > 0;
|
|
+ }
|
|
}
|
|
|
|
if (flag)
|
|
@@ -648,4 +664,10 @@
|
|
this.field_145900_a[i] = null;
|
|
}
|
|
}
|
|
+
|
|
+
|
|
+ protected net.minecraftforge.items.IItemHandler createUnSidedHandler()
|
|
+ {
|
|
+ return new net.minecraftforge.items.VanillaHopperItemHandler(this);
|
|
+ }
|
|
}
|