Spacing cleanup

This commit is contained in:
Aidan Brady 2014-07-31 22:27:46 -04:00
parent dde9b53447
commit 22db67c895
6 changed files with 44 additions and 17 deletions

View file

@ -92,6 +92,7 @@ public class FusionReactor implements IFusionReactor
lastCaseTemperature = caseTemperature; lastCaseTemperature = caseTemperature;
return; return;
} }
//Only thermal transfer happens unless we're hot enough to burn. //Only thermal transfer happens unless we're hot enough to burn.
if(plasmaTemperature >= burnTemperature) if(plasmaTemperature >= burnTemperature)
{ {
@ -100,6 +101,7 @@ public class FusionReactor implements IFusionReactor
{ {
vaporiseHohlraum(); vaporiseHohlraum();
} }
//Only inject fuel if we're burning //Only inject fuel if we're burning
if(burning) if(burning)
{ {
@ -124,10 +126,12 @@ public class FusionReactor implements IFusionReactor
{ {
getFuelTank().receive(new GasStack(GasRegistry.getGas("fusionFuelDT"), 10), true); getFuelTank().receive(new GasStack(GasRegistry.getGas("fusionFuelDT"), 10), true);
controller.inventory[0].stackSize -= 1; controller.inventory[0].stackSize -= 1;
if(controller.inventory[0].stackSize == 0) if(controller.inventory[0].stackSize == 0)
{ {
controller.inventory[0] = null; controller.inventory[0] = null;
} }
burning = true; burning = true;
} }
@ -136,7 +140,9 @@ public class FusionReactor implements IFusionReactor
int amountNeeded = getFuelTank().getNeeded(); int amountNeeded = getFuelTank().getNeeded();
int amountAvailable = 2*min(getDeuteriumTank().getStored(), getTritiumTank().getStored()); int amountAvailable = 2*min(getDeuteriumTank().getStored(), getTritiumTank().getStored());
int amountToInject = min(amountNeeded, min(amountAvailable, injectionRate)); int amountToInject = min(amountNeeded, min(amountAvailable, injectionRate));
amountToInject -= amountToInject % 2; amountToInject -= amountToInject % 2;
getDeuteriumTank().draw(amountToInject / 2, true); getDeuteriumTank().draw(amountToInject / 2, true);
getTritiumTank().draw(amountToInject / 2, true); getTritiumTank().draw(amountToInject / 2, true);
getFuelTank().receive(new GasStack(GasRegistry.getGas("fusionFuel"), amountToInject), true); getFuelTank().receive(new GasStack(GasRegistry.getGas("fusionFuel"), amountToInject), true);
@ -145,8 +151,10 @@ public class FusionReactor implements IFusionReactor
public int burnFuel() public int burnFuel()
{ {
int fuelBurned = (int)min(getFuelTank().getStored(), max(0, lastPlasmaTemperature - burnTemperature)*burnRatio); int fuelBurned = (int)min(getFuelTank().getStored(), max(0, lastPlasmaTemperature - burnTemperature)*burnRatio);
getFuelTank().draw(fuelBurned, true); getFuelTank().draw(fuelBurned, true);
plasmaTemperature += energyPerFuel * fuelBurned / plasmaHeatCapacity; plasmaTemperature += energyPerFuel * fuelBurned / plasmaHeatCapacity;
return fuelBurned; return fuelBurned;
} }
@ -155,13 +163,17 @@ public class FusionReactor implements IFusionReactor
int neutronsRemaining = fuelBurned; int neutronsRemaining = fuelBurned;
List<INeutronCapture> list = new ArrayList<INeutronCapture>(neutronCaptors); List<INeutronCapture> list = new ArrayList<INeutronCapture>(neutronCaptors);
Collections.shuffle(list); Collections.shuffle(list);
for(INeutronCapture captor: neutronCaptors) for(INeutronCapture captor: neutronCaptors)
{ {
if(neutronsRemaining <= 0) if(neutronsRemaining <= 0)
{
break; break;
}
neutronsRemaining = captor.absorbNeutrons(neutronsRemaining); neutronsRemaining = captor.absorbNeutrons(neutronsRemaining);
} }
controller.radiateNeutrons(neutronsRemaining); controller.radiateNeutrons(neutronsRemaining);
} }
@ -179,18 +191,21 @@ public class FusionReactor implements IFusionReactor
int waterToVaporize = (int)(steamTransferEfficiency * caseWaterHeat / enthalpyOfVaporization); int waterToVaporize = (int)(steamTransferEfficiency * caseWaterHeat / enthalpyOfVaporization);
//Mekanism.logger.info("Wanting to vaporise " + waterToVaporize + "mB of water"); //Mekanism.logger.info("Wanting to vaporise " + waterToVaporize + "mB of water");
waterToVaporize = min(waterToVaporize, min(getWaterTank().getFluidAmount(), getSteamTank().getCapacity() - getSteamTank().getFluidAmount())); waterToVaporize = min(waterToVaporize, min(getWaterTank().getFluidAmount(), getSteamTank().getCapacity() - getSteamTank().getFluidAmount()));
if(waterToVaporize > 0) if(waterToVaporize > 0)
{ {
//Mekanism.logger.info("Vaporising " + waterToVaporize + "mB of water"); //Mekanism.logger.info("Vaporising " + waterToVaporize + "mB of water");
getWaterTank().drain(waterToVaporize, true); getWaterTank().drain(waterToVaporize, true);
getSteamTank().fill(new FluidStack(FluidRegistry.getFluid("steam"), waterToVaporize), true); getSteamTank().fill(new FluidStack(FluidRegistry.getFluid("steam"), waterToVaporize), true);
} }
caseWaterHeat = waterToVaporize * enthalpyOfVaporization / steamTransferEfficiency; caseWaterHeat = waterToVaporize * enthalpyOfVaporization / steamTransferEfficiency;
caseTemperature -= caseWaterHeat / caseHeatCapacity; caseTemperature -= caseWaterHeat / caseHeatCapacity;
} }
//Transfer from casing to environment //Transfer from casing to environment
double caseAirHeat = caseAirConductivity * lastCaseTemperature; double caseAirHeat = caseAirConductivity * lastCaseTemperature;
caseTemperature -= caseAirHeat / caseHeatCapacity; caseTemperature -= caseAirHeat / caseHeatCapacity;
setBufferedEnergy(getBufferedEnergy() + caseAirHeat * thermocoupleEfficiency); setBufferedEnergy(getBufferedEnergy() + caseAirHeat * thermocoupleEfficiency);
} }
@ -273,6 +288,7 @@ public class FusionReactor implements IFusionReactor
{ {
block.setReactor(null); block.setReactor(null);
} }
//Don't remove from controller //Don't remove from controller
controller.setReactor(this); controller.setReactor(this);
reactorBlocks.clear(); reactorBlocks.clear();
@ -299,6 +315,7 @@ public class FusionReactor implements IFusionReactor
Mekanism.logger.trace("Reactor failed: Frame not complete."); Mekanism.logger.trace("Reactor failed: Frame not complete.");
return; return;
} }
Mekanism.logger.trace("Frame valid"); Mekanism.logger.trace("Frame valid");
if(!addSides(centreOfReactor)) if(!addSides(centreOfReactor))
{ {
@ -306,6 +323,7 @@ public class FusionReactor implements IFusionReactor
Mekanism.logger.trace("Reactor failed: Sides not complete."); Mekanism.logger.trace("Reactor failed: Sides not complete.");
return; return;
} }
Mekanism.logger.trace("Side Blocks Valid"); Mekanism.logger.trace("Side Blocks Valid");
if(!centreIsClear(centreOfReactor)) if(!centreIsClear(centreOfReactor))
{ {
@ -313,6 +331,7 @@ public class FusionReactor implements IFusionReactor
Mekanism.logger.trace("Blocks in chamber."); Mekanism.logger.trace("Blocks in chamber.");
return; return;
} }
Mekanism.logger.trace("Centre is clear"); Mekanism.logger.trace("Centre is clear");
formed = true; formed = true;
} }

View file

@ -316,12 +316,6 @@ public class BlockReactor extends BlockContainer
{ {
return new ItemStack(typeBlock, 1, meta); return new ItemStack(typeBlock, 1, meta);
} }
@Override
public String toString()
{
return Integer.toString(meta);
}
} }
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock) public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)

View file

@ -33,6 +33,7 @@ public abstract class TileEntityReactorBlock extends TileEntityElectricBlock imp
{ {
changed = true; changed = true;
} }
fusionReactor = reactor; fusionReactor = reactor;
} }

View file

@ -68,6 +68,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen
{ {
setReactor(new FusionReactor(this)); setReactor(new FusionReactor(this));
} }
getReactor().formMultiblock(); getReactor().formMultiblock();
} }
@ -77,6 +78,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen
{ {
return 0; return 0;
} }
return getReactor().getPlasmaTemp(); return getReactor().getPlasmaTemp();
} }
@ -86,6 +88,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen
{ {
return 0; return 0;
} }
return getReactor().getCaseTemp(); return getReactor().getCaseTemp();
} }
@ -97,6 +100,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen
if(isFormed()) if(isFormed())
{ {
getReactor().simulate(); getReactor().simulate();
if(!worldObj.isRemote && (getReactor().isBurning() != clientBurning || Math.abs(getReactor().getPlasmaTemp() - clientTemp) > 1000000)) if(!worldObj.isRemote && (getReactor().isBurning() != clientBurning || Math.abs(getReactor().getPlasmaTemp() - clientTemp) > 1000000))
{ {
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D)); Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
@ -126,8 +130,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen
tag.setInteger("injectionRate", getReactor().getInjectionRate()); tag.setInteger("injectionRate", getReactor().getInjectionRate());
tag.setBoolean("burning", getReactor().isBurning()); tag.setBoolean("burning", getReactor().isBurning());
} }
else else {
{
tag.setDouble("plasmaTemp", 0); tag.setDouble("plasmaTemp", 0);
tag.setDouble("caseTemp", 0); tag.setDouble("caseTemp", 0);
tag.setInteger("injectionRate", 0); tag.setInteger("injectionRate", 0);
@ -171,6 +174,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen
super.getNetworkedData(data); super.getNetworkedData(data);
data.add(getReactor() != null && getReactor().isFormed()); data.add(getReactor() != null && getReactor().isFormed());
if(getReactor() != null) if(getReactor() != null)
{ {
data.add(getReactor().getPlasmaTemp()); data.add(getReactor().getPlasmaTemp());
@ -201,6 +205,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen
break; break;
case 1: case 1:
if(getReactor() != null) getReactor().setInjectionRate(dataStream.readInt()); if(getReactor() != null) getReactor().setInjectionRate(dataStream.readInt());
break;
} }
return; return;
@ -209,6 +214,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen
super.handlePacketData(dataStream); super.handlePacketData(dataStream);
boolean formed = dataStream.readBoolean(); boolean formed = dataStream.readBoolean();
if(formed) if(formed)
{ {
if(getReactor() == null) if(getReactor() == null)
@ -216,6 +222,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen
setReactor(new FusionReactor(this)); setReactor(new FusionReactor(this));
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
} }
((FusionReactor)getReactor()).formed = true; ((FusionReactor)getReactor()).formed = true;
getReactor().setPlasmaTemp(dataStream.readDouble()); getReactor().setPlasmaTemp(dataStream.readDouble());
getReactor().setCaseTemp(dataStream.readDouble()); getReactor().setCaseTemp(dataStream.readDouble());
@ -280,6 +287,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen
{ {
box = AxisAlignedBB.getBoundingBox(xCoord-1, yCoord-3, zCoord-1, xCoord+2, yCoord, zCoord+2); box = AxisAlignedBB.getBoundingBox(xCoord-1, yCoord-3, zCoord-1, xCoord+2, yCoord, zCoord+2);
} }
return box; return box;
} }
} }

View file

@ -24,6 +24,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
public TileEntityReactorPort() public TileEntityReactorPort()
{ {
super("name", 1); super("name", 1);
inventory = new ItemStack[0]; inventory = new ItemStack[0];
} }
@ -48,6 +49,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
{ {
return getReactor().getWaterTank().fill(resource, doFill); return getReactor().getWaterTank().fill(resource, doFill);
} }
return 0; return 0;
} }
@ -58,6 +60,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
{ {
getReactor().getSteamTank().drain(resource.amount, doDrain); getReactor().getSteamTank().drain(resource.amount, doDrain);
} }
return null; return null;
} }
@ -68,6 +71,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
{ {
return getReactor().getSteamTank().drain(maxDrain, doDrain); return getReactor().getSteamTank().drain(maxDrain, doDrain);
} }
return null; return null;
} }
@ -90,6 +94,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
{ {
return new FluidTankInfo[0]; return new FluidTankInfo[0];
} }
return new FluidTankInfo[] {getReactor().getWaterTank().getInfo(), getReactor().getSteamTank().getInfo()}; return new FluidTankInfo[] {getReactor().getWaterTank().getInfo(), getReactor().getSteamTank().getInfo()};
} }
@ -111,6 +116,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
return getReactor().getFuelTank().receive(stack, true); return getReactor().getFuelTank().receive(stack, true);
} }
} }
return 0; return 0;
} }
@ -159,8 +165,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
{ {
return 0; return 0;
} }
else else {
{
return getReactor().getBufferedEnergy(); return getReactor().getBufferedEnergy();
} }
} }
@ -181,8 +186,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
{ {
return 0; return 0;
} }
else else {
{
return getReactor().getBufferSize(); return getReactor().getBufferSize();
} }
} }
@ -192,6 +196,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
{ {
EnumSet set = EnumSet.allOf(ForgeDirection.class); EnumSet set = EnumSet.allOf(ForgeDirection.class);
set.remove(ForgeDirection.UNKNOWN); set.remove(ForgeDirection.UNKNOWN);
return set; return set;
} }

View file

@ -667,11 +667,11 @@ tile.Generator.BioGenerator.name=Bio-Generator
tile.Generator.AdvancedSolarGenerator.name=Advanced Solar Generator tile.Generator.AdvancedSolarGenerator.name=Advanced Solar Generator
tile.Generator.WindTurbine.name=Wind Turbine tile.Generator.WindTurbine.name=Wind Turbine
tile.Reactor.ReactorController=Reactor Controller tile.Reactor.ReactorController.name=Reactor Controller
tile.Reactor.ReactorFrame=Reactor Frame tile.Reactor.ReactorFrame.name=Reactor Frame
tile.Reactor.ReactorLaserFocusMatrix=Laser Focus Matrix tile.Reactor.ReactorLaserFocusMatrix.name=Laser Focus Matrix
tile.Reactor.ReactorNeutronCapturePlate=Neutron Capture Plate tile.Reactor.ReactorNeutronCapturePlate.name=Neutron Capture Plate
tile.Reactor.ReactorInOutPort=Reactor Port tile.Reactor.ReactorInOutPort.name=Reactor Port
tile.ReactorGlass.ReactorGlass.name=Reactor Glass tile.ReactorGlass.ReactorGlass.name=Reactor Glass