Merge branch 'master' of github.com:SirSengir/BuildCraft

This commit is contained in:
SirSengir 2013-01-09 22:47:23 +01:00
commit d333eafeeb
5 changed files with 33 additions and 17 deletions

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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;

View file

@ -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));

View file

@ -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);
}
}