use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class StorageScannerTileEntity method advanceCurrent.
// Advance the 'cur' index to the next block. Return false when done.
// When done 'scanning' will be set to false as well.
private boolean advanceCurrent() {
Coordinate c = cur.getCoordinate();
int cx = c.getX();
int cy = c.getY();
int cz = c.getZ();
cx++;
Coordinate lo = c1.getCoordinate();
Coordinate up = c2.getCoordinate();
if (cx > up.getX()) {
cx = lo.getX();
cy++;
if (cy > up.getY()) {
cy = lo.getY();
cz++;
if (cz > up.getZ()) {
scanning.setValue(false);
notifyBlockUpdate();
return false;
}
}
}
cur.setCoordinate(new Coordinate(cx, cy, cz));
notifyBlockUpdate();
return true;
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class StorageScannerTileEntity method checkInventoryStatus.
private void checkInventoryStatus(int cx, int cy, int cz) {
TileEntity tileEntity = worldObj.getTileEntity(cx, cy, cz);
if (tileEntity instanceof IInventory) {
IInventory inventory = (IInventory) tileEntity;
if (inventory.getSizeInventory() > 0) {
inventories.add(new InvBlockInfo(new Coordinate(cx, cy, cz), inventory.getSizeInventory()));
notifyBlockUpdate();
}
}
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class DialingDeviceTileEntity method execute.
@Override
public boolean execute(EntityPlayerMP playerMP, String command, Map<String, Argument> args) {
boolean rc = super.execute(playerMP, command, args);
if (rc) {
return rc;
}
if (CMD_FAVORITE.equals(command)) {
String player = args.get("player").getString();
Coordinate receiver = args.get("receiver").getCoordinate();
int dimension = args.get("dimension").getInteger();
boolean favorite = args.get("favorite").getBoolean();
changeFavorite(player, receiver, dimension, favorite);
return true;
} else if (CMD_SHOWFAVORITE.equals(command)) {
boolean favorite = args.get("favorite").getBoolean();
setShowOnlyFavorites(favorite);
return true;
}
return false;
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class DialingDeviceTileEntity method searchTransmitters.
public List<TransmitterInfo> searchTransmitters() {
int x = xCoord;
int y = yCoord;
int z = zCoord;
int hrange = TeleportConfiguration.horizontalDialerRange;
int vrange = TeleportConfiguration.verticalDialerRange;
List<TransmitterInfo> transmitters = new ArrayList<TransmitterInfo>();
for (int dy = -vrange; dy <= vrange; dy++) {
int yy = y + dy;
if (yy >= 0 && yy < worldObj.getHeight()) {
for (int dz = -hrange; dz <= hrange; dz++) {
int zz = z + dz;
for (int dx = -hrange; dx <= hrange; dx++) {
int xx = x + dx;
if (dx != 0 || dy != 0 || dz != 0) {
Coordinate c = new Coordinate(xx, yy, zz);
TileEntity tileEntity = worldObj.getTileEntity(xx, yy, zz);
if (tileEntity != null) {
if (tileEntity instanceof MatterTransmitterTileEntity) {
MatterTransmitterTileEntity matterTransmitterTileEntity = (MatterTransmitterTileEntity) tileEntity;
transmitters.add(new TransmitterInfo(c, matterTransmitterTileEntity.getName(), matterTransmitterTileEntity.getTeleportDestination()));
}
}
}
}
}
}
}
return transmitters;
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class DialingDeviceTileEntity method dialOnce.
@Callback(doc = "First parameter is a table describing the transmitter ('x', 'y', and 'z'). The second parameter is a table describing the receiver ('dim', 'x', 'y', and 'z'). This method will dial the transmitter to the receiver (dial once mode)")
@Optional.Method(modid = "OpenComputers")
public Object[] dialOnce(Context context, Arguments args) throws Exception {
Map transmitter = args.checkTable(0);
Map receiver = args.checkTable(1);
if (!transmitter.containsKey("x") || !transmitter.containsKey("y") || !transmitter.containsKey("z")) {
throw new IllegalArgumentException("Transmitter map doesn't contain the right x,y,z coordinate!");
}
if (!receiver.containsKey("x") || !receiver.containsKey("y") || !receiver.containsKey("z")) {
throw new IllegalArgumentException("Receiver map doesn't contain the right x,y,z coordinate!");
}
if (!receiver.containsKey("dim")) {
throw new IllegalArgumentException("Receiver map doesn't contain the right dimension!");
}
Coordinate transC = new Coordinate(((Double) transmitter.get("x")).intValue(), ((Double) transmitter.get("y")).intValue(), ((Double) transmitter.get("z")).intValue());
int transDim = worldObj.provider.dimensionId;
Coordinate recC = new Coordinate(((Double) receiver.get("x")).intValue(), ((Double) receiver.get("y")).intValue(), ((Double) receiver.get("z")).intValue());
int recDim = ((Double) receiver.get("dim")).intValue();
int result = dial(null, transC, transDim, recC, recDim, true);
return new Object[] { result };
}
Aggregations