use of pneumaticCraft.common.network.PacketCoordTrackUpdate in project PneumaticCraft by MineMaarten.
the class CoordTrackUpgradeHandler method onPlayerInteract.
@SubscribeEvent
public boolean onPlayerInteract(PlayerInteractEvent event) {
if (event.action == Action.RIGHT_CLICK_BLOCK && isListeningToCoordTrackerSetting) {
isListeningToCoordTrackerSetting = false;
ForgeDirection dir = ForgeDirection.getOrientation(event.face);
reset();
ItemStack stack = event.entityPlayer.getCurrentArmor(3);
if (stack != null) {
NBTTagCompound tag = NBTUtil.getCompoundTag(stack, "CoordTracker");
tag.setInteger("dimID", event.entity.worldObj.provider.dimensionId);
tag.setInteger("x", event.x + dir.offsetX);
tag.setInteger("y", event.y + dir.offsetY);
tag.setInteger("z", event.z + dir.offsetZ);
}
NetworkHandler.sendToServer(new PacketCoordTrackUpdate(event.entity.worldObj, event.x + dir.offsetX, event.y + dir.offsetY, event.z + dir.offsetZ));
}
return false;
}
Aggregations