Changed reactor cell interaction, right click to open GUI, sneak right click to add item, sneak right click with empty hand to take item

This commit is contained in:
Robert S 2014-06-13 11:10:04 -04:00
parent aa0b050e70
commit 0d7dd572c0

View file

@ -110,15 +110,9 @@ public class TileReactorCell extends TileInventory implements IMultiBlockStructu
{ {
TileReactorCell tile = getMultiBlock().get(); TileReactorCell tile = getMultiBlock().get();
if (!player.isSneaking()) if (player.isSneaking())
{ {
if (tile.getStackInSlot(0) != null) if (player.inventory.getCurrentItem() != null)
{
InventoryUtility.dropItemStack(world(), new Vector3(player), tile.getStackInSlot(0), 0);
tile.setInventorySlotContents(0, null);
return true;
}
else if (player.inventory.getCurrentItem() != null)
{ {
if (player.inventory.getCurrentItem().getItem() instanceof IReactorComponent) if (player.inventory.getCurrentItem().getItem() instanceof IReactorComponent)
{ {
@ -129,6 +123,12 @@ public class TileReactorCell extends TileInventory implements IMultiBlockStructu
return true; return true;
} }
} }
else if (tile.getStackInSlot(0) != null)
{
InventoryUtility.dropItemStack(world(), new Vector3(player), tile.getStackInSlot(0), 0);
tile.setInventorySlotContents(0, null);
return true;
}
} }
player.openGui(Atomic.INSTANCE, 0, world(), tile.xCoord, tile.yCoord, tile.zCoord); player.openGui(Atomic.INSTANCE, 0, world(), tile.xCoord, tile.yCoord, tile.zCoord);
@ -214,8 +214,7 @@ public class TileReactorCell extends TileInventory implements IMultiBlockStructu
{ {
if (worldObj.rand.nextFloat() > 0.65) if (worldObj.rand.nextFloat() > 0.65)
{ {
List<EntityLiving> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class, List<EntityLiving> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(xCoord - RADIUS * 2, yCoord - RADIUS * 2, zCoord - RADIUS * 2, xCoord + RADIUS * 2, yCoord + RADIUS * 2, zCoord + RADIUS * 2));
AxisAlignedBB.getBoundingBox(xCoord - RADIUS * 2, yCoord - RADIUS * 2, zCoord - RADIUS * 2, xCoord + RADIUS * 2, yCoord + RADIUS * 2, zCoord + RADIUS * 2));
for (EntityLiving entity : entities) for (EntityLiving entity : entities)
{ {
@ -514,7 +513,8 @@ public class TileReactorCell extends TileInventory implements IMultiBlockStructu
return 1; return 1;
} }
/** Returns true if automation can insert the given item in the given slot from the given side. Args: Slot, item, side */ /** Returns true if automation can insert the given item in the given slot from the given side.
* Args: Slot, item, side */
@Override @Override
public boolean canInsertItem(int slot, ItemStack items, int side) public boolean canInsertItem(int slot, ItemStack items, int side)
{ {
@ -583,8 +583,7 @@ public class TileReactorCell extends TileInventory implements IMultiBlockStructu
@Override @Override
public FluidTankInfo[] getTankInfo(ForgeDirection from) public FluidTankInfo[] getTankInfo(ForgeDirection from)
{ {
return new FluidTankInfo[] return new FluidTankInfo[] { tank.getInfo() };
{ tank.getInfo() };
} }
@Override @Override