--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java @@ -251,6 +251,7 @@ private boolean func_145883_k() { + if (net.minecraftforge.items.VanillaInventoryCodeHooks.insertHook(this)) { return true; } IInventory iinventory = this.func_145895_l(); if (iinventory == null) @@ -357,6 +358,8 @@ public static boolean func_145891_a(IHopper p_145891_0_) { + Boolean ret = net.minecraftforge.items.VanillaInventoryCodeHooks.extractHook(p_145891_0_); + if (ret != null) return ret; IInventory iinventory = func_145884_b(p_145891_0_); if (iinventory != null) @@ -506,17 +509,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) @@ -662,4 +679,10 @@ this.field_145900_a[i] = null; } } + + + protected net.minecraftforge.items.IItemHandler createUnSidedHandler() + { + return new net.minecraftforge.items.VanillaHopperItemHandler(this); + } }