Fixed #179 - Right clicking engineering table with item

This commit is contained in:
Calclavia 2014-01-30 20:32:03 +08:00
parent 62ce220dae
commit a298d8eedb
2 changed files with 9 additions and 10 deletions

View file

@ -111,11 +111,11 @@ public class BlockEngineeringTable extends BlockRIRotatable
@Override @Override
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int hitSide, float hitX, float hitY, float hitZ) public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int hitSide, float hitX, float hitY, float hitZ)
{ {
if(player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemHammer) if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemHammer)
{ {
return false; return false;
} }
TileEntity te = world.getBlockTileEntity(x, y, z); TileEntity te = world.getBlockTileEntity(x, y, z);
if (te instanceof TileEngineeringTable) if (te instanceof TileEngineeringTable)
@ -163,7 +163,7 @@ public class BlockEngineeringTable extends BlockRIRotatable
/** /**
* Take out of engineering table. * Take out of engineering table.
*/ */
if (!world.isRemote && player.inventory.getCurrentItem() == null) if (!world.isRemote)
{ {
tile.setPlayerInventory(player.inventory); tile.setPlayerInventory(player.inventory);
@ -188,6 +188,8 @@ public class BlockEngineeringTable extends BlockRIRotatable
tile.setPlayerInventory(null); tile.setPlayerInventory(null);
} }
return true;
} }
} }

View file

@ -45,14 +45,11 @@ public abstract class RenderItemOverlayTile extends TileEntitySpecialRenderer
EntityPlayer player = Minecraft.getMinecraft().thePlayer; EntityPlayer player = Minecraft.getMinecraft().thePlayer;
boolean isLooking = false; boolean isLooking = false;
if (player.isSneaking()) MovingObjectPosition objectPosition = player.rayTrace(8, 1);
{
MovingObjectPosition objectPosition = player.rayTrace(8, 1);
if (objectPosition != null) if (objectPosition != null)
{ {
isLooking = objectPosition.blockX == tileEntity.xCoord && objectPosition.blockY == tileEntity.yCoord && objectPosition.blockZ == tileEntity.zCoord; isLooking = objectPosition.blockX == tileEntity.xCoord && objectPosition.blockY == tileEntity.yCoord && objectPosition.blockZ == tileEntity.zCoord;
}
} }
for (int i = 0; i < (matrixX * matrixZ); i++) for (int i = 0; i < (matrixX * matrixZ); i++)