And yet more Salination Plant work!

This commit is contained in:
Aidan C. Brady 2014-01-14 22:00:23 -05:00
parent ae5fe1cfbf
commit fe2deb9b9b
2 changed files with 28 additions and 27 deletions

View file

@ -60,21 +60,21 @@ public class GuiSalinationController extends GuiMekanism
private String getTemp() private String getTemp()
{ {
float temp = (float)Math.round((tileEntity.getTemperature()*200)*100)/100F; float temp = (float)Math.round((tileEntity.getTemperature()*200)*10)/10F;
return temp + " F"; return temp + " F";
} }
private String getMaxTemp() private String getMaxTemp()
{ {
float temp = (float)Math.round((tileEntity.getMaxTemperature()*200)*100)/100F; float temp = (float)Math.round((tileEntity.getMaxTemperature()*200)*10)/10F;
return temp + " F"; return temp + " F";
} }
private String getTempMult() private String getTempMult()
{ {
float temp = (float)Math.round((tileEntity.getTempMultiplier())*100)/100F; float temp = (float)Math.round((tileEntity.getTempMultiplier())*10)/10F;
return temp + "x"; return temp + "x";
} }

View file

@ -29,7 +29,7 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
public static final int MAX_BRINE = 1000; public static final int MAX_BRINE = 1000;
public static final int MAX_SOLARS = 4; public static final int MAX_SOLARS = 4;
public static final int WARMUP = 300; public static final int WARMUP = 6000;
public FluidTank waterTank = new FluidTank(MAX_WATER); public FluidTank waterTank = new FluidTank(MAX_WATER);
public FluidTank brineTank = new FluidTank(MAX_BRINE); public FluidTank brineTank = new FluidTank(MAX_BRINE);
@ -42,6 +42,7 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
public double partialWater = 0; public double partialWater = 0;
public double partialBrine = 0; public double partialBrine = 0;
public float biomeTemp = 0;
public float temperature = 0; public float temperature = 0;
public int height = 0; public int height = 0;
@ -137,15 +138,14 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
PacketHandler.sendPacket(Transmission.CLIENTS_RANGE, new PacketTileEntity().setParams(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this), 50D); PacketHandler.sendPacket(Transmission.CLIENTS_RANGE, new PacketTileEntity().setParams(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this), 50D);
} }
if(!structured) if(structured)
{ {
temperature = Math.min(getMaxTemperature(), getTemperature());
}
else {
if(waterTank.getFluid() != null) if(waterTank.getFluid() != null)
{ {
waterTank.getFluid().amount = Math.min(waterTank.getFluid().amount, getMaxWater()); waterTank.getFluid().amount = Math.min(waterTank.getFluid().amount, getMaxWater());
} }
temperature = Math.min(getMaxTemperature(), getTemperature());
} }
} }
} }
@ -189,7 +189,7 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
{ {
if(!structured) if(!structured)
{ {
return 1; return 0;
} }
return 1 + (height-3)*0.5F; return 1 + (height-3)*0.5F;
@ -197,11 +197,22 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
public float getTempMultiplier() public float getTempMultiplier()
{ {
return worldObj.getBiomeGenForCoordsBody(xCoord, zCoord).getFloatTemperature()*((float)getActiveSolars()/MAX_SOLARS); if(!temperatureSet)
{
biomeTemp = worldObj.getBiomeGenForCoordsBody(xCoord, zCoord).getFloatTemperature();
temperatureSet = true;
}
return biomeTemp*((float)getActiveSolars()/MAX_SOLARS);
} }
public int getActiveSolars() public int getActiveSolars()
{ {
if(worldObj.isRemote)
{
return clientSolarAmount;
}
int ret = 0; int ret = 0;
for(TileEntityAdvancedSolarGenerator solar : solars) for(TileEntityAdvancedSolarGenerator solar : solars)
@ -302,7 +313,10 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
if(!addTankPart(pointerTile)) if(!addTankPart(pointerTile))
{ {
if(pointerTile != this && pointerTile instanceof TileEntitySalinationController) if(pointerTile != this && pointerTile instanceof TileEntitySalinationController)
return false; {
controllerConflict = true;
return false;
}
} }
} }
} }
@ -528,6 +542,7 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
clientSolarAmount = dataStream.readInt(); clientSolarAmount = dataStream.readInt();
height = dataStream.readInt(); height = dataStream.readInt();
temperature = dataStream.readFloat(); temperature = dataStream.readFloat();
biomeTemp = dataStream.readFloat();
if(structured != prev) if(structured != prev)
{ {
@ -564,28 +579,14 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
data.add(structured); data.add(structured);
data.add(controllerConflict); data.add(controllerConflict);
data.add(getSolarAmount()); data.add(getActiveSolars());
data.add(height); data.add(height);
data.add(temperature); data.add(temperature);
data.add(biomeTemp);
return data; return data;
} }
private int getSolarAmount()
{
int ret = 0;
for(TileEntityAdvancedSolarGenerator solar : solars)
{
if(solar != null)
{
ret++;
}
}
return ret;
}
@Override @Override
public void readFromNBT(NBTTagCompound nbtTags) public void readFromNBT(NBTTagCompound nbtTags)
{ {