diff --git a/common/buildcraft/core/ItemWrench.java b/common/buildcraft/core/ItemWrench.java index d74cc438..e2e9ef37 100644 --- a/common/buildcraft/core/ItemWrench.java +++ b/common/buildcraft/core/ItemWrench.java @@ -2,6 +2,7 @@ package buildcraft.core; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; import buildcraft.api.tools.IToolWrench; public class ItemWrench extends ItemBuildCraft implements IToolWrench { @@ -19,4 +20,10 @@ public class ItemWrench extends ItemBuildCraft implements IToolWrench { @Override public void wrenchUsed(EntityPlayer player, int x, int y, int z) { } + + @Override + public boolean shouldPassSneakingClickToBlock(World par2World, int par4, int par5, int par6) + { + return true; + } } diff --git a/common/buildcraft/core/inventory/TransactorSimple.java b/common/buildcraft/core/inventory/TransactorSimple.java index 01bbcc7a..d4dbab17 100644 --- a/common/buildcraft/core/inventory/TransactorSimple.java +++ b/common/buildcraft/core/inventory/TransactorSimple.java @@ -68,35 +68,34 @@ public class TransactorSimple extends Transactor { } protected int addToSlot(int slot, ItemStack stack, int injected, boolean doAdd) { - int remaining = stack.stackSize - injected; + int available = stack.stackSize - injected; + int max = Math.min(stack.getMaxStackSize(), inventory.getInventoryStackLimit()); ItemStack stackInSlot = inventory.getStackInSlot(slot); if (stackInSlot == null) { + int wanted = Math.min(available, max); if (doAdd) { stackInSlot = stack.copy(); - stackInSlot.stackSize = remaining; + stackInSlot.stackSize = wanted; inventory.setInventorySlotContents(slot, stackInSlot); } - return remaining; + return wanted; } if (!stackInSlot.isItemEqual(stack) || !ItemStack.areItemStackTagsEqual(stackInSlot, stack)) return 0; - int space = stackInSlot.getMaxStackSize() - stackInSlot.stackSize; - if (space <= 0) + int wanted = max - stackInSlot.stackSize; + if (wanted <= 0) return 0; - if (space >= remaining) { - if (doAdd) { - stackInSlot.stackSize += remaining; - } - return remaining; - } else { - if (doAdd) { - stackInSlot.stackSize = stackInSlot.getMaxStackSize(); - } - return space; + if (wanted > available) + wanted = available; + + if (doAdd) { + stackInSlot.stackSize += wanted; + inventory.setInventorySlotContents(slot, stackInSlot); } + return wanted; } } diff --git a/common/buildcraft/core/utils/InventoryUtil.java b/common/buildcraft/core/utils/InventoryUtil.java index e955cdf5..ca935a17 100644 --- a/common/buildcraft/core/utils/InventoryUtil.java +++ b/common/buildcraft/core/utils/InventoryUtil.java @@ -62,6 +62,7 @@ public class InventoryUtil { int itemsToMove = stack.getMaxStackSize() - stack.stackSize; stack.stackSize += itemsToMove; stackToMove.stackSize -= itemsToMove; + _inventory.setInventorySlotContents(i, stackToMove); } } return stackToMove; diff --git a/common/buildcraft/energy/BlockEngine.java b/common/buildcraft/energy/BlockEngine.java index 67760330..98c763a1 100644 --- a/common/buildcraft/energy/BlockEngine.java +++ b/common/buildcraft/energy/BlockEngine.java @@ -58,6 +58,15 @@ public class BlockEngine extends BlockContainer { return new TileEngine(); } + @Override + public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) { + TileEntity tile = world.getBlockTileEntity(x, y, z); + if (tile instanceof TileEngine) { + return ForgeDirection.getOrientation(((TileEngine) tile).orientation).getOpposite() == side; + } + return false; + } + @Override public void breakBlock(World world, int x, int y, int z, int par5, int par6) { TileEngine engine = ((TileEngine) world.getBlockTileEntity(x, y, z)); diff --git a/common/buildcraft/energy/TileEngine.java b/common/buildcraft/energy/TileEngine.java index 285596fa..d1a565ca 100644 --- a/common/buildcraft/energy/TileEngine.java +++ b/common/buildcraft/energy/TileEngine.java @@ -71,7 +71,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven createEngineIfNeeded(); } - engine.orientation = ForgeDirection.values()[orientation]; + engine.orientation = ForgeDirection.VALID_DIRECTIONS[orientation]; provider.configure(0, engine.minEnergyReceived(), engine.maxEnergyReceived(), 1, engine.maxEnergy); checkRedstonePower(); } @@ -170,7 +170,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven engine = newEngine(kind); - engine.orientation = ForgeDirection.values()[orientation]; + engine.orientation = ForgeDirection.VALID_DIRECTIONS[orientation]; worldObj.notifyBlockChange(xCoord, yCoord, zCoord, BuildCraftEnergy.engineBlock.blockID); } }