Merge branch 'master' of github.com:SirSengir/BuildCraft
This commit is contained in:
commit
d333eafeeb
5 changed files with 33 additions and 17 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue