made placer take the most top block from the rear inventory

This commit is contained in:
tgame14 2014-03-20 19:22:07 +02:00
parent 70db55836d
commit 140d7a4661

View file

@ -31,26 +31,26 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
{ {
private boolean doWork = false; private boolean doWork = false;
public TilePlacer() public TilePlacer ()
{ {
super(Material.iron); super(Material.iron);
normalRender = false; normalRender = false;
} }
@Override @Override
public void onAdded() public void onAdded ()
{ {
work(); work();
} }
@Override @Override
public void onNeighborChanged() public void onNeighborChanged ()
{ {
work(); work();
} }
@Override @Override
public void updateEntity() public void updateEntity ()
{ {
if (doWork) if (doWork)
{ {
@ -59,7 +59,7 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
} }
} }
public void work() public void work ()
{ {
if (isIndirectlyPowered()) if (isIndirectlyPowered())
{ {
@ -67,7 +67,7 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
} }
} }
public void doWork() public void doWork ()
{ {
ForgeDirection dir = getDirection(); ForgeDirection dir = getDirection();
Vector3 placePos = position().translate(dir); Vector3 placePos = position().translate(dir);
@ -82,7 +82,7 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
if (tile instanceof IInventory) if (tile instanceof IInventory)
{ {
ItemStack candidate = InventoryUtility.takeTopItemFromInventory((IInventory) tile, dir.ordinal()); ItemStack candidate = new ItemStack(InventoryUtility.takeTopItemBlockFromInventory((IInventory) tile, dir.ordinal()));
if (candidate != null) if (candidate != null)
{ {
incrStackSize(0, candidate); incrStackSize(0, candidate);
@ -112,14 +112,14 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
} }
@Override @Override
protected boolean use(EntityPlayer player, int hitSide, Vector3 hit) protected boolean use (EntityPlayer player, int hitSide, Vector3 hit)
{ {
interactCurrentItem(this, 0, player); interactCurrentItem(this, 0, player);
return true; return true;
} }
@Override @Override
public Packet getDescriptionPacket() public Packet getDescriptionPacket ()
{ {
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt); writeToNBT(nbt);
@ -127,7 +127,7 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
} }
@Override @Override
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra) public void onReceivePacket (ByteArrayDataInput data, EntityPlayer player, Object... extra)
{ {
try try
{ {
@ -141,12 +141,12 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
protected TileRender newRenderer() protected TileRender newRenderer ()
{ {
return new TileRender() return new TileRender()
{ {
@Override @Override
public boolean renderDynamic(Vector3 position, boolean isItem, float frame) public boolean renderDynamic (Vector3 position, boolean isItem, float frame)
{ {
if (!isItem) if (!isItem)
{ {