Solar Evaporation Plant fixes

This commit is contained in:
Aidan C. Brady 2015-02-24 14:11:26 -05:00
parent 457d465165
commit 62791baec7
17 changed files with 200 additions and 95 deletions

View file

@ -81,7 +81,6 @@ public class MekanismConfig
public static double pressurizedReactionBaseUsage;
public static double fluidicPlenisherUsage;
public static double laserUsage;
public static double salinationPlantWaterUsage;
public static double gasCentrifugeUsage;
public static double heavyWaterElectrolysisUsage;
}

View file

@ -42,12 +42,12 @@ public class GuiSolarEvaporationController extends GuiMekanism
if(xAxis >= 7 && xAxis <= 23 && yAxis >= 14 && yAxis <= 72)
{
drawCreativeTabHoveringText(tileEntity.waterTank.getFluid() != null ? LangUtils.localizeFluidStack(tileEntity.waterTank.getFluid()) + ": " + tileEntity.waterTank.getFluidAmount() : MekanismUtils.localize("gui.empty"), xAxis, yAxis);
drawCreativeTabHoveringText(tileEntity.inputTank.getFluid() != null ? LangUtils.localizeFluidStack(tileEntity.inputTank.getFluid()) + ": " + tileEntity.inputTank.getFluidAmount() : MekanismUtils.localize("gui.empty"), xAxis, yAxis);
}
if(xAxis >= 153 && xAxis <= 169 && yAxis >= 14 && yAxis <= 72)
{
drawCreativeTabHoveringText(tileEntity.brineTank.getFluid() != null ? LangUtils.localizeFluidStack(tileEntity.brineTank.getFluid()) + ": " + tileEntity.brineTank.getFluidAmount() : MekanismUtils.localize("gui.empty"), xAxis, yAxis);
drawCreativeTabHoveringText(tileEntity.outputTank.getFluid() != null ? LangUtils.localizeFluidStack(tileEntity.outputTank.getFluid()) + ": " + tileEntity.outputTank.getFluidAmount() : MekanismUtils.localize("gui.empty"), xAxis, yAxis);
}
if(xAxis >= 49 && xAxis <= 127 && yAxis >= 64 && yAxis <= 72)
@ -64,8 +64,7 @@ public class GuiSolarEvaporationController extends GuiMekanism
{
return "Structured";
}
else if(!tileEntity.structured)
{
else {
if(tileEntity.controllerConflict)
{
return "Conflict";
@ -74,8 +73,6 @@ public class GuiSolarEvaporationController extends GuiMekanism
return "Incomplete";
}
}
return null;
}
private String getTemp()
@ -104,7 +101,7 @@ public class GuiSolarEvaporationController extends GuiMekanism
{
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiSalinationController.png"));
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiSolarEvaporationController.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
@ -115,14 +112,14 @@ public class GuiSolarEvaporationController extends GuiMekanism
int displayInt;
if(tileEntity.getScaledWaterLevel(58) > 0)
if(tileEntity.getScaledInputLevel(58) > 0)
{
displayGauge(7, 14, tileEntity.getScaledWaterLevel(58), tileEntity.waterTank.getFluid(), null);
displayGauge(7, 14, tileEntity.getScaledInputLevel(58), tileEntity.inputTank.getFluid(), null);
}
if(tileEntity.getScaledBrineLevel(58) > 0)
if(tileEntity.getScaledOutputLevel(58) > 0)
{
displayGauge(153, 14, tileEntity.getScaledBrineLevel(58), tileEntity.brineTank.getFluid(), null);
displayGauge(153, 14, tileEntity.getScaledOutputLevel(58), tileEntity.outputTank.getFluid(), null);
}
displayInt = tileEntity.getScaledTempLevel(78);
@ -174,7 +171,7 @@ public class GuiSolarEvaporationController extends GuiMekanism
}
}
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiSalinationController.png"));
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiSolarEvaporationController.png"));
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos, 176, 0, 16, 59);
}
}

View file

@ -70,8 +70,8 @@ public class NEIMekanismConfig implements IConfigureNEI
API.registerRecipeHandler(new PrecisionSawmillRecipeHandler());
API.registerUsageHandler(new PrecisionSawmillRecipeHandler());
API.registerRecipeHandler(new SalinationControllerRecipeHandler());
API.registerUsageHandler(new SalinationControllerRecipeHandler());
API.registerRecipeHandler(new SolarEvaporationRecipeHandler());
API.registerUsageHandler(new SolarEvaporationRecipeHandler());
API.registerRecipeHandler(new ChemicalDissolutionChamberRecipeHandler());
API.registerUsageHandler(new ChemicalDissolutionChamberRecipeHandler());
@ -97,7 +97,7 @@ public class NEIMekanismConfig implements IConfigureNEI
API.setGuiOffset(GuiRotaryCondensentrator.class, RotaryCondensentratorRecipeHandler.xOffset, RotaryCondensentratorRecipeHandler.yOffset);
API.setGuiOffset(GuiElectrolyticSeparator.class, ElectrolyticSeparatorRecipeHandler.xOffset, ElectrolyticSeparatorRecipeHandler.yOffset);
API.setGuiOffset(GuiPrecisionSawmill.class, 16, 6);
API.setGuiOffset(GuiSolarEvaporationController.class, SalinationControllerRecipeHandler.xOffset, SalinationControllerRecipeHandler.yOffset);
API.setGuiOffset(GuiSolarEvaporationController.class, SolarEvaporationRecipeHandler.xOffset, SolarEvaporationRecipeHandler.yOffset);
API.setGuiOffset(GuiChemicalDissolutionChamber.class, ChemicalDissolutionChamberRecipeHandler.xOffset, ChemicalDissolutionChamberRecipeHandler.yOffset);
API.setGuiOffset(GuiChemicalWasher.class, ChemicalWasherRecipeHandler.xOffset, ChemicalWasherRecipeHandler.yOffset);
API.setGuiOffset(GuiChemicalCrystallizer.class, ChemicalCrystallizerRecipeHandler.xOffset, ChemicalCrystallizerRecipeHandler.yOffset);

View file

@ -27,7 +27,7 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
import static codechicken.lib.gui.GuiDraw.changeTexture;
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
public class SalinationControllerRecipeHandler extends BaseRecipeHandler
public class SolarEvaporationRecipeHandler extends BaseRecipeHandler
{
private int ticksPassed;
@ -47,19 +47,19 @@ public class SalinationControllerRecipeHandler extends BaseRecipeHandler
@Override
public String getRecipeName()
{
return MekanismUtils.localize("tile.BasicBlock.SalinationController.name");
return MekanismUtils.localize("tile.BasicBlock.SolarEvaporationController.name");
}
@Override
public String getOverlayIdentifier()
{
return "salinationcontroller";
return "solarevaporation";
}
@Override
public String getGuiTexture()
{
return "mekanism:gui/nei/GuiSalinationController.png";
return "mekanism:gui/nei/GuiSolarEvaporationController.png";
}
@Override
@ -70,7 +70,7 @@ public class SalinationControllerRecipeHandler extends BaseRecipeHandler
public String getRecipeId()
{
return "mekanism.salinationcontroller";
return "mekanism.solarevaporation";
}
public Set<Entry<FluidStack, FluidStack>> getRecipes()

View file

@ -34,7 +34,7 @@ public class RenderSalinationController extends TileEntitySpecialRenderer
public void renderAModelAt(TileEntitySolarEvaporationController tileEntity, double x, double y, double z, float partialTick)
{
if(tileEntity.structured && tileEntity.waterTank.getFluid() != null)
if(tileEntity.structured && tileEntity.inputTank.getFluid() != null)
{
SalinationRenderData data = new SalinationRenderData();
@ -43,7 +43,7 @@ public class RenderSalinationController extends TileEntitySpecialRenderer
bindTexture(MekanismRenderer.getBlocksTexture());
if(data.height >= 1 && tileEntity.waterTank.getCapacity() > 0)
if(data.height >= 1 && tileEntity.inputTank.getCapacity() > 0)
{
Coord4D renderLoc = tileEntity.getRenderLocation();
@ -51,10 +51,10 @@ public class RenderSalinationController extends TileEntitySpecialRenderer
GL11.glTranslated(getX(renderLoc.xCoord), getY(renderLoc.yCoord), getZ(renderLoc.zCoord));
MekanismRenderer.glowOn(tileEntity.waterTank.getFluid().getFluid().getLuminosity());
MekanismRenderer.glowOn(tileEntity.inputTank.getFluid().getFluid().getLuminosity());
DisplayInteger[] displayList = getListAndRender(data, tileEntity.waterTank.getFluid().getFluid());
displayList[(int)(((float)tileEntity.waterTank.getFluidAmount()/tileEntity.waterTank.getCapacity())*((float)getStages(data.height)-1))].render();
DisplayInteger[] displayList = getListAndRender(data, tileEntity.inputTank.getFluid().getFluid());
displayList[(int)(((float)tileEntity.inputTank.getFluidAmount()/tileEntity.inputTank.getCapacity())*((float)getStages(data.height)-1))].render();
MekanismRenderer.glowOff();

View file

@ -269,7 +269,6 @@ public class CommonProxy
usage.pressurizedReactionBaseUsage = Mekanism.configuration.get("usage", "PressurizedReactionBaseUsage", 5D).getDouble(5D);
usage.fluidicPlenisherUsage = Mekanism.configuration.get("usage", "FluidicPlenisherUsage", 100D).getDouble(100D);
usage.laserUsage = Mekanism.configuration.get("usage", "LaserUsage", 5000D).getDouble(5000D);
usage.salinationPlantWaterUsage = Mekanism.configuration.get("usage", "SalinationPlantSpeed", 40.0, "Millibuckets of water turned into brine by the plant per tick", 1.0, 9000.0).getDouble();
usage.gasCentrifugeUsage = Mekanism.configuration.get("usage", "GasCentrifugeUsage", 100D).getDouble(100D);
usage.heavyWaterElectrolysisUsage = Mekanism.configuration.get("usage", "HeavyWaterElectrolysisUsage", 800D).getDouble(800D);

View file

@ -725,6 +725,10 @@ public class Mekanism
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("brine", 10), 2 * general.FROM_H2, new GasStack(GasRegistry.getGas("sodium"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1));
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("heavywater", 2), usage.heavyWaterElectrolysisUsage, new GasStack(GasRegistry.getGas("deuterium"), 2), new GasStack(GasRegistry.getGas("oxygen"), 1));
//Solar Evaporation Plant Recipes
RecipeHandler.addSolarEvaporationRecipe(FluidRegistry.getFluidStack("water", 40), FluidRegistry.getFluidStack("brine", 1));
RecipeHandler.addSolarEvaporationRecipe(FluidRegistry.getFluidStack("brine", 10), FluidRegistry.getFluidStack("lithium", 1));
//T4 Processing Recipes
for(Gas gas : GasRegistry.getRegisteredGasses())
{

View file

@ -72,7 +72,6 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
dataStream.writeDouble(usage.chemicalCrystallizerUsage);
dataStream.writeDouble(usage.seismicVibratorUsage);
dataStream.writeDouble(usage.fluidicPlenisherUsage);
dataStream.writeDouble(usage.salinationPlantWaterUsage);
dataStream.writeDouble(usage.gasCentrifugeUsage);
dataStream.writeDouble(usage.heavyWaterElectrolysisUsage);
@ -133,7 +132,6 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
usage.chemicalCrystallizerUsage = dataStream.readDouble();
usage.seismicVibratorUsage = dataStream.readDouble();
usage.fluidicPlenisherUsage = dataStream.readDouble();
usage.salinationPlantWaterUsage = dataStream.readDouble();
usage.gasCentrifugeUsage = dataStream.readDouble();
usage.heavyWaterElectrolysisUsage = dataStream.readDouble();

View file

@ -37,8 +37,8 @@ import mekanism.common.recipe.machines.PurificationRecipe;
import mekanism.common.recipe.machines.SawmillRecipe;
import mekanism.common.recipe.machines.SeparatorRecipe;
import mekanism.common.recipe.machines.SmeltingRecipe;
import mekanism.common.recipe.machines.SolarEvaporationRecipe;
import mekanism.common.recipe.machines.WasherRecipe;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
@ -235,6 +235,11 @@ public final class RecipeHandler
{
addRecipe(Recipe.GAS_CENTRIFUGE, new GasCentrifugeRecipe(inputGas, outputGas));
}
public static void addSolarEvaporationRecipe(FluidStack inputFluid, FluidStack outputFluid)
{
addRecipe(Recipe.SOLAR_EVAPORATION_PLANT, new SolarEvaporationRecipe(inputFluid, outputFluid));
}
/**
* Gets the Metallurgic Infuser Recipe for the InfusionInput in the parameters.
@ -424,6 +429,19 @@ public final class RecipeHandler
return null;
}
public static SolarEvaporationRecipe getSolarEvaporationRecipe(FluidInput input)
{
if(input.isValid())
{
HashMap<FluidInput, SolarEvaporationRecipe> recipes = Recipe.SOLAR_EVAPORATION_PLANT.get();
SolarEvaporationRecipe recipe = recipes.get(input);
return recipe == null ? null : recipe.copy();
}
return null;
}
public static PressurizedRecipe getPRCRecipe(PressurizedInput input)
{
@ -519,7 +537,8 @@ public final class RecipeHandler
CHEMICAL_CRYSTALLIZER(new HashMap<GasInput, CrystallizerRecipe>()),
PRESSURIZED_REACTION_CHAMBER(new HashMap<PressurizedInput, PressurizedRecipe>()),
AMBIENT_ACCUMULATOR(new HashMap<IntegerInput, AmbientGasRecipe>()),
GAS_CENTRIFUGE(new HashMap<GasInput, GasCentrifugeRecipe>());
GAS_CENTRIFUGE(new HashMap<GasInput, GasCentrifugeRecipe>()),
SOLAR_EVAPORATION_PLANT(new HashMap<FluidInput, SolarEvaporationRecipe>());
private HashMap recipes;

View file

@ -35,5 +35,4 @@ public class GasCentrifugeRecipe extends MachineRecipe<GasInput, GasOutput, GasC
getOutput().applyOutputs(outputTank, true, 1);
}
}
}

View file

@ -0,0 +1,38 @@
package mekanism.common.recipe.machines;
import mekanism.common.recipe.inputs.FluidInput;
import mekanism.common.recipe.outputs.FluidOutput;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
public class SolarEvaporationRecipe extends MachineRecipe<FluidInput, FluidOutput, SolarEvaporationRecipe>
{
public SolarEvaporationRecipe(FluidStack input, FluidStack output)
{
super(new FluidInput(input), new FluidOutput(output));
}
public SolarEvaporationRecipe(FluidInput input, FluidOutput output)
{
super(input, output);
}
@Override
public SolarEvaporationRecipe copy()
{
return new SolarEvaporationRecipe(getInput(), getOutput());
}
public boolean canOperate(FluidTank inputTank, FluidTank outputTank)
{
return getInput().useFluid(inputTank, false, 1) && getOutput().applyOutputs(outputTank, false);
}
public void operate(FluidTank inputTank, FluidTank outputTank)
{
if(getInput().useFluid(inputTank, true, 1))
{
getOutput().applyOutputs(outputTank, true);
}
}
}

View file

@ -0,0 +1,32 @@
package mekanism.common.recipe.outputs;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
public class FluidOutput extends MachineOutput<FluidOutput>
{
public FluidStack output;
public FluidOutput(FluidStack stack)
{
output = stack;
}
@Override
public FluidOutput copy()
{
return new FluidOutput(output.copy());
}
public boolean applyOutputs(FluidTank fluidTank, boolean doEmit)
{
if(fluidTank.fill(output, false) > 0)
{
fluidTank.fill(output, doEmit);
return true;
}
return false;
}
}

View file

@ -14,6 +14,10 @@ import mekanism.common.Mekanism;
import mekanism.common.base.IActiveState;
import mekanism.common.content.tank.TankUpdateProtocol;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.inputs.FluidInput;
import mekanism.common.recipe.machines.SolarEvaporationRecipe;
import mekanism.common.util.MekanismUtils;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
@ -21,6 +25,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
@ -30,20 +35,20 @@ import cpw.mods.fml.relauncher.SideOnly;
public class TileEntitySolarEvaporationController extends TileEntitySolarEvaporationBlock implements IActiveState
{
public static final int MAX_BRINE = 10000;
public static final int MAX_OUTPUT = 10000;
public static final int MAX_SOLARS = 4;
public static final int WARMUP = 10000;
public FluidTank waterTank = new FluidTank(0);
public FluidTank brineTank = new FluidTank(MAX_BRINE);
public FluidTank inputTank = new FluidTank(0);
public FluidTank outputTank = new FluidTank(MAX_OUTPUT);
public Set<TileEntitySolarEvaporationBlock> tankParts = new HashSet<TileEntitySolarEvaporationBlock>();
public ISalinationSolar[] solars = new ISalinationSolar[4];
public boolean temperatureSet = false;
public double partialWater = 0;
public double partialBrine = 0;
public double partialInput = 0;
public double partialOutput = 0;
public float biomeTemp = 0;
public float temperature = 0;
@ -88,38 +93,45 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
if(canOperate())
{
int brineNeeded = brineTank.getCapacity()-brineTank.getFluidAmount();
int waterStored = waterTank.getFluidAmount();
SolarEvaporationRecipe recipe = getRecipe();
partialWater += Math.min(waterTank.getFluidAmount(), getTemperature()*usage.salinationPlantWaterUsage);
int outputNeeded = outputTank.getCapacity()-outputTank.getFluidAmount();
int inputStored = inputTank.getFluidAmount();
if(partialWater >= 1)
partialInput += Math.min(inputTank.getFluidAmount(), getTemperature()*recipe.recipeInput.ingredient.amount);
if(partialInput >= 1)
{
int waterInt = (int)Math.floor(partialWater);
waterTank.drain(waterInt, true);
partialWater %= 1;
partialBrine += ((double)waterInt)/usage.salinationPlantWaterUsage;
int inputInt = (int)Math.floor(partialInput);
inputTank.drain(inputInt, true);
partialInput %= 1;
partialOutput += ((double)inputInt)/recipe.recipeInput.ingredient.amount;
}
if(partialBrine >= 1)
if(partialOutput >= 1)
{
int brineInt = (int)Math.floor(partialBrine);
brineTank.fill(FluidRegistry.getFluidStack("brine", brineInt), true);
partialBrine %= 1;
int outputInt = (int)Math.floor(partialOutput);
outputTank.fill(new FluidStack(recipe.recipeOutput.output.getFluid(), outputInt), true);
partialOutput %= 1;
}
}
if(structured)
{
if(Math.abs((float)waterTank.getFluidAmount()/waterTank.getCapacity()-prevScale) > 0.01)
if(Math.abs((float)inputTank.getFluidAmount()/inputTank.getCapacity()-prevScale) > 0.01)
{
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this)));
prevScale = (float)waterTank.getFluidAmount()/waterTank.getCapacity();
prevScale = (float)inputTank.getFluidAmount()/inputTank.getCapacity();
}
}
}
}
public SolarEvaporationRecipe getRecipe()
{
return RecipeHandler.getSolarEvaporationRecipe(new FluidInput(inputTank.getFluid()));
}
@Override
public void onChunkUnload()
{
@ -136,6 +148,16 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
refresh();
}
public boolean hasRecipe(Fluid fluid)
{
if(fluid == null)
{
return false;
}
return Recipe.SOLAR_EVAPORATION_PLANT.containsRecipe(fluid);
}
protected void refresh()
{
if(!worldObj.isRemote)
@ -154,11 +176,11 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
if(structured)
{
waterTank.setCapacity(getMaxWater());
inputTank.setCapacity(getMaxWater());
if(waterTank.getFluid() != null)
if(inputTank.getFluid() != null)
{
waterTank.getFluid().amount = Math.min(waterTank.getFluid().amount, getMaxWater());
inputTank.getFluid().amount = Math.min(inputTank.getFluid().amount, getMaxWater());
}
temperature = Math.min(getMaxTemperature(), getTemperature());
@ -172,12 +194,12 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
public boolean canOperate()
{
if(!structured || height < 3 || height > 18 || waterTank.getFluid() == null || getTempMultiplier() == 0)
if(!structured || height < 3 || height > 18 || inputTank.getFluid() == null || getTempMultiplier() == 0)
{
return false;
}
if(!waterTank.getFluid().containsFluid(FluidRegistry.getFluidStack("water", 1)) || brineTank.getCapacity()-brineTank.getFluidAmount() == 0)
if(getRecipe() == null)
{
return false;
}
@ -189,17 +211,17 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
{
if(inventory[2] != null)
{
if(brineTank.getFluid() != null && brineTank.getFluid().amount >= FluidContainerRegistry.BUCKET_VOLUME)
if(outputTank.getFluid() != null && outputTank.getFluid().amount >= FluidContainerRegistry.BUCKET_VOLUME)
{
if(FluidContainerRegistry.isEmptyContainer(inventory[2]))
{
ItemStack tempStack = FluidContainerRegistry.fillFluidContainer(brineTank.getFluid(), inventory[2]);
ItemStack tempStack = FluidContainerRegistry.fillFluidContainer(outputTank.getFluid(), inventory[2]);
if(tempStack != null)
{
if(inventory[3] == null)
{
brineTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
outputTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
inventory[3] = tempStack;
inventory[2].stackSize--;
@ -213,7 +235,7 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
}
else if(tempStack.isItemEqual(inventory[3]) && tempStack.getMaxStackSize() > inventory[3].stackSize)
{
brineTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
outputTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
inventory[3].stackSize++;
inventory[2].stackSize--;
@ -236,9 +258,9 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
{
FluidStack itemFluid = FluidContainerRegistry.getFluidForFilledItem(inventory[0]);
if((waterTank.getFluid() == null && itemFluid.amount <= getMaxWater()) || waterTank.getFluid().amount+itemFluid.amount <= getMaxWater())
if((inputTank.getFluid() == null && itemFluid.amount <= getMaxWater()) || inputTank.getFluid().amount+itemFluid.amount <= getMaxWater())
{
if(itemFluid.getFluid() != FluidRegistry.WATER || (waterTank.getFluid() != null && !waterTank.getFluid().isFluidEqual(itemFluid)))
if(itemFluid.getFluid() != FluidRegistry.WATER || (inputTank.getFluid() != null && !inputTank.getFluid().isFluidEqual(itemFluid)))
{
return;
}
@ -277,7 +299,7 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
if(filled)
{
waterTank.fill(itemFluid, true);
inputTank.fill(itemFluid, true);
}
}
}
@ -597,14 +619,14 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
}
}
public int getScaledWaterLevel(int i)
public int getScaledInputLevel(int i)
{
return getMaxWater() > 0 ? (waterTank.getFluid() != null ? waterTank.getFluid().amount*i / getMaxWater() : 0) : 0;
return getMaxWater() > 0 ? (inputTank.getFluid() != null ? inputTank.getFluid().amount*i / getMaxWater() : 0) : 0;
}
public int getScaledBrineLevel(int i)
public int getScaledOutputLevel(int i)
{
return brineTank.getFluid() != null ? brineTank.getFluid().amount*i / MAX_BRINE : 0;
return outputTank.getFluid() != null ? outputTank.getFluid().amount*i / MAX_OUTPUT : 0;
}
public int getScaledTempLevel(int i)
@ -636,18 +658,18 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
if(dataStream.readBoolean())
{
waterTank.setFluid(new FluidStack(dataStream.readInt(), dataStream.readInt()));
inputTank.setFluid(new FluidStack(dataStream.readInt(), dataStream.readInt()));
}
else {
waterTank.setFluid(null);
inputTank.setFluid(null);
}
if(dataStream.readBoolean())
{
brineTank.setFluid(new FluidStack(dataStream.readInt(), dataStream.readInt()));
outputTank.setFluid(new FluidStack(dataStream.readInt(), dataStream.readInt()));
}
else {
brineTank.setFluid(null);
outputTank.setFluid(null);
}
boolean prev = structured;
@ -662,7 +684,7 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
if(structured != prev)
{
waterTank.setCapacity(getMaxWater());
inputTank.setCapacity(getMaxWater());
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
@ -674,21 +696,21 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
{
super.getNetworkedData(data);
if(waterTank.getFluid() != null)
if(inputTank.getFluid() != null)
{
data.add(true);
data.add(waterTank.getFluid().fluidID);
data.add(waterTank.getFluid().amount);
data.add(inputTank.getFluid().fluidID);
data.add(inputTank.getFluid().amount);
}
else {
data.add(false);
}
if(brineTank.getFluid() != null)
if(outputTank.getFluid() != null)
{
data.add(true);
data.add(brineTank.getFluid().fluidID);
data.add(brineTank.getFluid().amount);
data.add(outputTank.getFluid().fluidID);
data.add(outputTank.getFluid().amount);
}
else {
data.add(false);
@ -710,13 +732,13 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
{
super.readFromNBT(nbtTags);
waterTank.readFromNBT(nbtTags.getCompoundTag("waterTank"));
brineTank.readFromNBT(nbtTags.getCompoundTag("brineTank"));
inputTank.readFromNBT(nbtTags.getCompoundTag("waterTank"));
outputTank.readFromNBT(nbtTags.getCompoundTag("brineTank"));
temperature = nbtTags.getFloat("temperature");
partialWater = nbtTags.getDouble("partialWater");
partialBrine = nbtTags.getDouble("partialBrine");
partialInput = nbtTags.getDouble("partialWater");
partialOutput = nbtTags.getDouble("partialBrine");
}
@Override
@ -724,13 +746,13 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
{
super.writeToNBT(nbtTags);
nbtTags.setTag("waterTank", waterTank.writeToNBT(new NBTTagCompound()));
nbtTags.setTag("brineTank", brineTank.writeToNBT(new NBTTagCompound()));
nbtTags.setTag("waterTank", inputTank.writeToNBT(new NBTTagCompound()));
nbtTags.setTag("brineTank", outputTank.writeToNBT(new NBTTagCompound()));
nbtTags.setFloat("temperature", temperature);
nbtTags.setDouble("partialWater", partialWater);
nbtTags.setDouble("partialBrine", partialBrine);
nbtTags.setDouble("partialWater", partialInput);
nbtTags.setDouble("partialBrine", partialOutput);
}
@Override

View file

@ -2,10 +2,8 @@ package mekanism.common.tile;
import mekanism.api.Coord4D;
import mekanism.common.util.PipeUtils;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
@ -40,15 +38,15 @@ public class TileEntitySolarEvaporationValve extends TileEntitySolarEvaporationB
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
return master == null ? 0 : master.waterTank.fill(resource, doFill);
return master == null ? 0 : master.inputTank.fill(resource, doFill);
}
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
{
if(master != null && resource.getFluid() == FluidRegistry.getFluid("brine"))
if(master != null && (resource == null || resource.isFluidEqual(master.outputTank.getFluid())))
{
return master.brineTank.drain(resource.amount, doDrain);
return master.outputTank.drain(resource.amount, doDrain);
}
return null;
@ -59,7 +57,7 @@ public class TileEntitySolarEvaporationValve extends TileEntitySolarEvaporationB
{
if(master != null)
{
return master.brineTank.drain(maxDrain, doDrain);
return master.outputTank.drain(maxDrain, doDrain);
}
return null;
@ -68,13 +66,13 @@ public class TileEntitySolarEvaporationValve extends TileEntitySolarEvaporationB
@Override
public boolean canFill(ForgeDirection from, Fluid fluid)
{
return master != null && fluid == FluidRegistry.getFluid("water");
return master != null && master.hasRecipe(fluid);
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid)
{
return master != null && fluid == FluidRegistry.getFluid("brine");
return master != null && master.outputTank.getFluidAmount() > 0;
}
@Override
@ -85,6 +83,6 @@ public class TileEntitySolarEvaporationValve extends TileEntitySolarEvaporationB
return PipeUtils.EMPTY;
}
return new FluidTankInfo[] {new FluidTankInfo(master.waterTank), new FluidTankInfo(master.brineTank)};
return new FluidTankInfo[] {new FluidTankInfo(master.inputTank), new FluidTankInfo(master.outputTank)};
}
}

View file

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB