mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 20:22:28 +00:00
Fix hopper extract behavior being broken on edge cases due to IItemHandler capability. Closes #3062
This commit is contained in:
1 parent
f58d1cae1a
commit
3e6099055e
2 files changed
+9
-8
No files matched your search
@@ -8,15 +8,16 @@
|
||||
IInventory iinventory = this.func_145895_l();
|
||||
|
||||
if (iinventory == null)
|
||||
@@ -357,6 +358,7 @@
|
||||
@@ -357,6 +358,8 @@
|
||||
|
||||
public static boolean func_145891_a(IHopper p_145891_0_)
|
||||
{
|
||||
+ if (net.minecraftforge.items.VanillaInventoryCodeHooks.extractHook(p_145891_0_)) { return true; }
|
||||
+ 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 +508,31 @@
|
||||
@@ -506,17 +509,31 @@
|
||||
|
||||
if (itemstack == null)
|
||||
{
|
||||
@@ -49,7 +50,7 @@
|
||||
}
|
||||
|
||||
if (flag)
|
||||
@@ -662,4 +678,10 @@
|
||||
@@ -662,4 +679,10 @@
|
||||
this.field_145900_a[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,13 +32,13 @@ import net.minecraft.world.World;
|
||||
|
||||
public class VanillaInventoryCodeHooks
|
||||
{
|
||||
|
||||
public static boolean extractHook(IHopper dest)
|
||||
//Return: Null if we did nothing {no IItemHandler}, True if we moved an item, False if we moved no items
|
||||
public static Boolean extractHook(IHopper dest)
|
||||
{
|
||||
TileEntity tileEntity = dest.getWorld().getTileEntity(new BlockPos(dest.getXPos(), dest.getYPos() + 1, dest.getZPos()));
|
||||
|
||||
if (tileEntity == null || !tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
|
||||
return false;
|
||||
return null;
|
||||
|
||||
IItemHandler handler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
|
||||
|
||||
@@ -67,7 +67,7 @@ public class VanillaInventoryCodeHooks
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean dropperInsertHook(World world, BlockPos pos, TileEntityDispenser dropper, int slot, ItemStack stack)
|
||||
|
||||
Reference in new issue
Block a user