use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class LiquidMonitorBlockTileEntity method findAdjacentBlocks.
public List<Coordinate> findAdjacentBlocks() {
int x = xCoord;
int y = yCoord;
int z = zCoord;
List<Coordinate> adjacentBlocks = new ArrayList<Coordinate>();
for (int dy = -1; dy <= 1; dy++) {
int yy = y + dy;
if (yy >= 0 && yy < worldObj.getHeight()) {
for (int dz = -1; dz <= 1; dz++) {
int zz = z + dz;
for (int dx = -1; dx <= 1; dx++) {
int xx = x + dx;
if (dx != 0 || dy != 0 || dz != 0) {
TileEntity tileEntity = worldObj.getTileEntity(xx, yy, zz);
if (tileEntity instanceof IFluidHandler) {
adjacentBlocks.add(new Coordinate(xx, yy, zz));
}
}
}
}
}
}
return adjacentBlocks;
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class PacketContentsMonitor method fromBytes.
@Override
public void fromBytes(ByteBuf buf) {
x = buf.readInt();
y = buf.readInt();
z = buf.readInt();
monitor = new Coordinate(buf.readInt(), buf.readInt(), buf.readInt());
alarmLevel = buf.readByte();
alarmMode = RFMonitorMode.getModeFromIndex(buf.readByte());
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class GuiLiquidMonitor method populateList.
private void populateList() {
List<Coordinate> newAdjacentBlocks = fromServer_clientAdjacentBlocks;
if (newAdjacentBlocks == null) {
return;
}
if (newAdjacentBlocks.equals(adjacentBlocks)) {
refreshList();
return;
}
adjacentBlocks = new ArrayList<Coordinate>(newAdjacentBlocks);
list.removeChildren();
int index = 0, sel = -1;
for (Coordinate coordinate : adjacentBlocks) {
Block block = mc.theWorld.getBlock(coordinate.getX(), coordinate.getY(), coordinate.getZ());
int meta = mc.theWorld.getBlockMetadata(coordinate.getX(), coordinate.getY(), coordinate.getZ());
int color = StyleConfig.colorTextInListNormal;
String displayName = BlockInfo.getReadableName(block, coordinate, meta, mc.theWorld);
if (coordinate.getX() == tileEntity.getMonitorX() && coordinate.getY() == tileEntity.getMonitorY() && coordinate.getZ() == tileEntity.getMonitorZ()) {
sel = index;
color = TEXT_COLOR_SELECTED;
}
Panel panel = new Panel(mc, this).setLayout(new HorizontalLayout());
panel.addChild(new BlockRender(mc, this).setRenderItem(block));
panel.addChild(new Label(mc, this).setText(displayName).setColor(color).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredWidth(90));
panel.addChild(new Label(mc, this).setDynamic(true).setText(coordinate.toString()).setColor(color));
list.addChild(panel);
index++;
}
list.setSelected(sel);
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class CounterPlusScreenModule method setupFromNBT.
@Override
public void setupFromNBT(NBTTagCompound tagCompound, int dim, int x, int y, int z) {
if (tagCompound != null) {
coordinate = Coordinate.INVALID;
if (tagCompound.hasKey("monitorx")) {
this.dim = tagCompound.getInteger("dim");
coordinate = new Coordinate(tagCompound.getInteger("monitorx"), tagCompound.getInteger("monitory"), tagCompound.getInteger("monitorz"));
}
}
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class StorageScannerTileEntity method startScan.
public void startScan(boolean start) {
if (!worldObj.isRemote) {
if (!start) {
scanning.setValue(false);
notifyBlockUpdate();
return;
}
int r = radius.getValue();
// Only on server
int y1 = yCoord - r;
if (y1 < 0) {
y1 = 0;
}
c1.setCoordinate(new Coordinate(xCoord - r, y1, zCoord - r));
int y2 = yCoord + r;
if (y2 >= worldObj.getHeight()) {
y2 = worldObj.getHeight() - 1;
}
c2.setCoordinate(new Coordinate(xCoord + r, y2, zCoord + r));
scanning.setValue(true);
cur.setCoordinate(c1.getCoordinate());
inventories.clear();
notifyBlockUpdate();
}
}
Aggregations