}
if(!this.isConnected()) {
throw new Exception("Unable to access reactor - port is not connected");
}
MultiblockReactor reactor = this.getReactorController();
ComputerMethod computerMethod = ComputerMethod.values()[method];
int index, newLevel;
boolean newState;
TileEntityReactorControlRod controlRod;
switch(computerMethod) {
case getEnergyStored:
return new Object[] { (int)reactor.getEnergyStored() };
case getNumberOfControlRods:
return new Object[] { (int)reactor.getFuelRodCount() };
case getActive:
return new Object[] { reactor.getActive() };
case getFuelTemperature:
return new Object[] { reactor.getFuelHeat() };
case getCasingTemperature:
return new Object[] { reactor.getReactorHeat() };
case getFuelAmount:
return new Object[] { (int)reactor.getFuelAmount() };
case getWasteAmount:
return new Object[] { (int)reactor.getWasteAmount() };
case getFuelAmountMax:
return new Object[] { reactor.getCapacity() };
case getControlRodName:
if(arguments.length < 1) {
throw new IllegalArgumentException("Insufficient number of arguments, expected 1");
}
controlRod = getControlRodFromArguments(reactor, arguments, 0);
return new Object[] { controlRod.getName() };
case getControlRodLevel:
if(arguments.length < 1) {
throw new IllegalArgumentException("Insufficient number of arguments, expected 1");
}
controlRod = getControlRodFromArguments(reactor, arguments, 0);
return new Object[] { (int)controlRod.getControlRodInsertion() };
case getEnergyProducedLastTick:
return new Object[] { reactor.getEnergyGeneratedLastTick() };
case getHotFluidProducedLastTick:
if(reactor.isPassivelyCooled())
return new Object[] { 0f };
else
return new Object[] { reactor.getEnergyGeneratedLastTick() };
case isActivelyCooled:
return new Object[] { !reactor.isPassivelyCooled() };
case getCoolantAmount:
return new Object[] { reactor.getCoolantContainer().getCoolantAmount() };
case getCoolantAmountMax:
return new Object[] { reactor.getCoolantContainer().getCapacity() };
case getCoolantType: {
Fluid fluidType = reactor.getCoolantContainer().getCoolantType();
if(fluidType == null) {
return null;
}
else {
return new Object[] { fluidType.getName() };
}
}
case getHotFluidAmount:
return new Object[] { reactor.getCoolantContainer().getVaporAmount() };
case getHotFluidAmountMax:
return new Object[] { reactor.getCoolantContainer().getCapacity() };
case getHotFluidType: {
Fluid fluidType = reactor.getCoolantContainer().getVaporType();
if(fluidType == null) {
return null;
}
else {
return new Object[] { fluidType.getName() };
}
}
case getFuelReactivity:
return new Object[] { reactor.getFuelFertility() * 100f };
case getFuelConsumedLastTick:
return new Object[] { reactor.getFuelConsumedLastTick() };
case getMinimumCoordinate:
{
CoordTriplet coord = reactor.getMinimumCoord();
return new Object[] { coord.x, coord.y, coord.z };
}
case getMaximumCoordinate:
{
CoordTriplet coord = reactor.getMaximumCoord();
return new Object[] { coord.x, coord.y, coord.z };
}
case setActive:
if(arguments.length < 1) {
throw new IllegalArgumentException("Insufficient number of arguments, expected 1");
}
if(!(arguments[0] instanceof Boolean)) {
throw new IllegalArgumentException("Invalid argument 0, expected Boolean");
}
newState = (Boolean)arguments[0];
reactor.setActive(newState);
return null;
case setAllControlRodLevels:
if(arguments.length < 1) {
throw new IllegalArgumentException("Insufficient number of arguments, expected 1");
}
if(!(arguments[0] instanceof Double)) {
throw new IllegalArgumentException("Invalid argument 0, expected Number");
}
newLevel = (int)Math.round((Double)arguments[0]);
reactor.setAllControlRodInsertionValues(newLevel);
return null;
case setControlRodLevel:
if(arguments.length < 2) {
throw new IllegalArgumentException("Insufficient number of arguments, expected 2 (control rod index, level)");
}
if(!(arguments[1] instanceof Double)) {
throw new IllegalArgumentException("Invalid argument 0, expected Number");
}
newLevel = (int)Math.round((Double)arguments[1]);
if(newLevel < 0 || newLevel > 100) {
throw new IllegalArgumentException("Invalid argument 1, valid range is 0-100");
}
controlRod = getControlRodFromArguments(reactor, arguments, 0);
controlRod.setControlRodInsertion((short) newLevel);
return null;
// "do" methods - void return, no inputs
case doEjectWaste:
reactor.ejectWaste(false, null);
return null;
case doEjectFuel:
reactor.ejectFuel(false, null);
return null;
default: throw new Exception("Method unimplemented - yell at Beef");
}
}