use of mcjty.lib.varia.GlobalCoordinate in project RFTools by McJty.
the class BlockProtectorTileEntity method selectBlock.
@Override
public void selectBlock(EntityPlayer player, int x, int y, int z) {
// This is always called server side.
if (Math.abs(x - xCoord) > BlockProtectorConfiguration.maxProtectDistance || Math.abs(y - yCoord) > BlockProtectorConfiguration.maxProtectDistance || Math.abs(z - zCoord) > BlockProtectorConfiguration.maxProtectDistance) {
Logging.message(player, EnumChatFormatting.RED + "Block out of range of the block protector!");
return;
}
GlobalCoordinate gc = new GlobalCoordinate(new Coordinate(x, y, z), worldObj.provider.dimensionId);
toggleCoordinate(gc);
}
use of mcjty.lib.varia.GlobalCoordinate in project RFTools by McJty.
the class BlockProtectors method removeDestination.
public void removeDestination(Coordinate coordinate, int dimension) {
GlobalCoordinate key = new GlobalCoordinate(coordinate, dimension);
Integer id = protectorIdByCoordinate.get(key);
if (id != null) {
protectorById.remove(id);
protectorIdByCoordinate.remove(key);
}
}
use of mcjty.lib.varia.GlobalCoordinate in project RFTools by McJty.
the class BlockProtectors method writeToNBT.
@Override
public void writeToNBT(NBTTagCompound tagCompound) {
NBTTagList lst = new NBTTagList();
for (GlobalCoordinate destination : protectorIdByCoordinate.keySet()) {
NBTTagCompound tc = new NBTTagCompound();
Coordinate c = destination.getCoordinate();
tc.setInteger("x", c.getX());
tc.setInteger("y", c.getY());
tc.setInteger("z", c.getZ());
tc.setInteger("dim", destination.getDimension());
Integer id = protectorIdByCoordinate.get(new GlobalCoordinate(c, destination.getDimension()));
tc.setInteger("id", id);
lst.appendTag(tc);
}
tagCompound.setTag("blocks", lst);
tagCompound.setInteger("lastId", lastId);
}
Aggregations