/** Setup all the blocks in the structure */ public void setupStructure() { for (int x = xCoord - 1; x < xCoord + 2; x++) for (int y = yCoord; y < yCoord + 3; y++) for (int z = zCoord - 1; z < zCoord + 2; z++) { TileEntity tile = worldObj.getTileEntity(x, y, z); // Check if block is bottom center block boolean master = (x == xCoord && y == yCoord && z == zCoord); if (tile != null && (tile instanceof TileMultiBlock)) { ((TileMultiBlock) tile).setMasterCoords(xCoord, yCoord, zCoord); ((TileMultiBlock) tile).setHasMaster(true); ((TileMultiBlock) tile).setIsMaster(master); } } }
/** Reset all the parts of the structure */ public void resetStructure() { for (int x = xCoord - 1; x < xCoord + 2; x++) for (int y = yCoord; y < yCoord + 3; y++) for (int z = zCoord - 1; z < zCoord + 2; z++) { TileEntity tile = worldObj.getTileEntity(x, y, z); if (tile != null && (tile instanceof TileMultiBlock)) ((TileMultiBlock) tile).reset(); } }