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