@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityNode)
{
stack.stackTagCompound = new NBTTagCompound();
if (!stack.stackTagCompound.hasKey("startX") && !stack.stackTagCompound.hasKey("startY") && !stack.stackTagCompound.hasKey("startZ"))
{
stack.stackTagCompound.setInteger("startX", x);
stack.stackTagCompound.setInteger("startY", y);
stack.stackTagCompound.setInteger("startZ", z);
player.addChatMessage(new ChatComponentText("Start"));
}
else
{
stack.stackTagCompound.setInteger("endX", x);
stack.stackTagCompound.setInteger("endY", y);
stack.stackTagCompound.setInteger("endZ", z);
player.addChatMessage(new ChatComponentText("End"));
int startX = stack.stackTagCompound.getInteger("startX");
int startY = stack.stackTagCompound.getInteger("startY");
int startZ = stack.stackTagCompound.getInteger("startZ");
int endX = stack.stackTagCompound.getInteger("endX");
int endY = stack.stackTagCompound.getInteger("endY");
int endZ = stack.stackTagCompound.getInteger("endZ");
EntityBeamFX beam = new EntityBeamFX(world, startX + 0.5, startY + 0.5, startZ + 0.5, endX + 0.5, endY + 0.5, endZ + 0.5, 1.0F, 1.0F, 1.0F, 8);
Minecraft.getMinecraft().effectRenderer.addEffect(beam);
}
return true;
}
return false;
}