use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class PacketConnectedBlocksReady method fromBytes.
@Override
public void fromBytes(ByteBuf buf) {
minx = buf.readInt();
miny = buf.readInt();
minz = buf.readInt();
int size = buf.readInt();
blockInfoMap = new HashMap<Coordinate, BlockInfo>();
for (int i = 0; i < size; i++) {
Coordinate coordinate = new Coordinate(buf.readShort() + minx, buf.readShort() + miny, buf.readShort() + minz);
BlockInfo blockInfo = new BlockInfo(coordinate, buf.readInt(), buf.readInt());
blockInfoMap.put(coordinate, blockInfo);
}
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class ScreenControllerTileEntity method clearText.
private Object[] clearText(String tag) {
for (Coordinate screen : connectedScreens) {
TileEntity te = worldObj.getTileEntity(screen.getX(), screen.getY(), screen.getZ());
if (te instanceof ScreenTileEntity) {
ScreenTileEntity screenTileEntity = (ScreenTileEntity) te;
List<ComputerScreenModule> computerScreenModules = screenTileEntity.getComputerModules(tag);
if (computerScreenModules != null) {
for (ComputerScreenModule screenModule : computerScreenModules) {
screenModule.clearText();
}
}
}
}
return null;
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class ScreenControllerTileEntity method getScreens.
@Callback(doc = "Get a table with coordinates (every coordinate is a table indexed with 'x', 'y', and 'z') for all connected screens", getter = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getScreens(Context context, Arguments args) throws Exception {
List<Map<String, Integer>> result = new ArrayList<Map<String, Integer>>();
for (Coordinate screen : connectedScreens) {
Map<String, Integer> coordinate = new HashMap<String, Integer>();
coordinate.put("x", screen.getX());
coordinate.put("y", screen.getY());
coordinate.put("z", screen.getZ());
result.add(coordinate);
}
return new Object[] { result };
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class ScreenControllerTileEntity method addText.
private Object[] addText(String tag, String text, int color) {
for (Coordinate screen : connectedScreens) {
TileEntity te = worldObj.getTileEntity(screen.getX(), screen.getY(), screen.getZ());
if (te instanceof ScreenTileEntity) {
ScreenTileEntity screenTileEntity = (ScreenTileEntity) te;
List<ComputerScreenModule> computerScreenModules = screenTileEntity.getComputerModules(tag);
if (computerScreenModules != null) {
for (ComputerScreenModule screenModule : computerScreenModules) {
screenModule.addText(text, color);
}
}
}
}
return null;
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class FluidBarScreenModule method setupFromNBT.
@Override
public void setupFromNBT(NBTTagCompound tagCompound, int dim, int x, int y, int z) {
if (tagCompound != null) {
helper.setShowdiff(tagCompound.getBoolean("showdiff"));
coordinate = Coordinate.INVALID;
if (tagCompound.hasKey("monitorx")) {
this.dim = tagCompound.getInteger("dim");
if (dim == this.dim) {
Coordinate c = new Coordinate(tagCompound.getInteger("monitorx"), tagCompound.getInteger("monitory"), tagCompound.getInteger("monitorz"));
int dx = Math.abs(c.getX() - x);
int dy = Math.abs(c.getY() - y);
int dz = Math.abs(c.getZ() - z);
if (dx <= 64 && dy <= 64 && dz <= 64) {
coordinate = c;
}
}
}
}
}
Aggregations