From 7305ba719930ea3fbf8aa987aeec48b33cdbd82e Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Tue, 21 Mar 2017 17:34:07 +0300 Subject: Oregen --- .../chemistry/PrecipitatorCondenserTileEntity.java | 379 --------------------- 1 file changed, 379 deletions(-) delete mode 100644 ihl/processing/chemistry/PrecipitatorCondenserTileEntity.java (limited to 'ihl/processing/chemistry/PrecipitatorCondenserTileEntity.java') diff --git a/ihl/processing/chemistry/PrecipitatorCondenserTileEntity.java b/ihl/processing/chemistry/PrecipitatorCondenserTileEntity.java deleted file mode 100644 index 6f3b43f..0000000 --- a/ihl/processing/chemistry/PrecipitatorCondenserTileEntity.java +++ /dev/null @@ -1,379 +0,0 @@ -package ihl.processing.chemistry; - -import java.util.Arrays; -import java.util.Map; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; -import ic2.core.IC2; -import ic2.core.block.TileEntityInventory; -import ihl.recipes.UniversalRecipeInput; -import ihl.recipes.UniversalRecipeManager; -import ihl.recipes.UniversalRecipeOutput; -import ihl.utils.IHLFluidTank; -import ihl.utils.IHLUtils; -import ihl.worldgen.ores.IHLFluid; - -public class PrecipitatorCondenserTileEntity extends TileEntityInventory implements IFluidHandler -{ - private final static UniversalRecipeManager recipeManager = new UniversalRecipeManager("precipitatorcondenser"); - private static float kF = 24000F; - private static float fluidC = 4F; - private static float H = 2256F; - private final IHLFluidTank gasBuffer = new IHLFluidTank(10000); - private final IHLFluidTank fluidTank = new IHLFluidTank(100); - private ForgeDirection gasInputDirection = ForgeDirection.WEST; - private int amountOfGasCondensed=0; - - public PrecipitatorCondenserTileEntity() - { - super(); - } - - @Override - public void readFromNBT(NBTTagCompound nbttagcompound) - { - super.readFromNBT(nbttagcompound); - this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank")); - this.gasBuffer.readFromNBT(nbttagcompound.getCompoundTag("gasBuffer")); - this.amountOfGasCondensed=nbttagcompound.getInteger("amountOfGasCondensed"); - } - - public static void addRecipe(String fluidNameIn, String fluidNameOut, int conversionRateToGas) - { - recipeManager.addRecipe(new UniversalRecipeInput((new FluidStack[] {IHLUtils.getFluidStackWithSize(fluidNameIn, conversionRateToGas)}), null), new UniversalRecipeOutput((new FluidStack[] {IHLUtils.getFluidStackWithSize(fluidNameOut, 1)}),null,2)); - } - - @Override - public void writeToNBT(NBTTagCompound nbttagcompound) - { - super.writeToNBT(nbttagcompound); - NBTTagCompound fluidTankTag = new NBTTagCompound(); - this.fluidTank.writeToNBT(fluidTankTag); - nbttagcompound.setTag("fluidTank", fluidTankTag); - - NBTTagCompound gasBufferTag = new NBTTagCompound(); - this.gasBuffer.writeToNBT(gasBufferTag); - nbttagcompound.setTag("gasBuffer", gasBufferTag); - - nbttagcompound.setInteger("amountOfGasCondensed",this.amountOfGasCondensed); - } - - @Override - public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { - return this.getFacing()!=(short)side && side!=0 && side!=1; - } - - @Override - public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { - return IHLUtils.getThisModItemStack("goldPrecipitatorCondenser"); - } - - public boolean enableUpdateEntity() - { - return IC2.platform.isSimulating(); - } - - @Override - public void updateEntityServer() - { - super.updateEntityServer(); - FluidStack fluidStack = this.fluidTank.getFluid(); - FluidStack gasStack = this.gasBuffer.getFluid(); - if(fluidStack!=null && gasStack!=null && fluidStack.amount>0 && gasStack.amount>0) - { - int t1 = this.fluidTank.getTemperature(); - float densityOfCoolant = IHLFluid.getRealDensity(fluidStack.getFluid()); - float densityOfGas = IHLFluid.getRealDensity(gasStack.getFluid()); - int boilingPointOfGas = IHLFluid.getBoilingPoint(gasStack.getFluid()); - amountOfGasCondensed += this.getAmountOfCondensedGas(fluidStack.amount, this.gasBuffer.getFluidAmount(), boilingPointOfGas, t1, densityOfGas, densityOfCoolant); - } - if(amountOfGasCondensed>10000) - { - UniversalRecipeOutput rOutput = null; - UniversalRecipeInput rInput = null; - FluidStack fs = null; - for(int i=0;ithis.gasBuffer.getCapacity()*2) - { - FluidStack passingGas = this.gasBuffer.drainLightest(this.gasBuffer.getCapacity()/2, true); - this.fillGaseousOutputApparatus(gasInputDirection, passingGas, true); - } - if(this.fluidTank.getFluid()!=null) - { - FluidStack coolant = this.fluidTank.drain(5, true); - this.fillHeatTransferAgentOutputApparatus(ForgeDirection.UP, coolant, true); - } - } - - private int getAmountOfCondensedGas(int amountOfCoolant, int amountOfGas, int boilingPointOfGas, int temperatureOfCoolant, float densityOfGas, float densityOfCoolant) - { - if(amountOfCoolant<=0 || amountOfGas<=0 || boilingPointOfGas-202*dt2) - { - deltaT = (float) ((dt1-dt2)/Math.log((double)dt2/(double)dt1)); - } - else - { - deltaT = (dt1+dt2)*0.5F; - } - float Q1 = kF*deltaT; - if(Q1>=maxQ) - { - break; - } - else - { - int next_L = (int)(Q1/H/densityOfGas); - if(Math.abs(next_L-L)<4) - { - L=next_L; - break; - } - L=next_L; - } - } - if(t1_1>t1) - { - this.fluidTank.setTemperature(t1_1); - } - else - { - this.fluidTank.setTemperature(t1+1); - } - return L; - } - - @Override - public String getInventoryName() - { - return "precipitatorCondenser"; - } - - public void onGuiClosed(EntityPlayer entityPlayer) {} - - public int mX() - { - switch(this.getFacing()) - { - case 4: - return -1; - case 5: - return 1; - default: - return 0; - } - } - - public int mZ() - { - switch(this.getFacing()) - { - case 2: - return -1; - case 3: - return 1; - default: - return 0; - } - } - - public int mLZ() - { - switch(this.getFacing()) - { - case 4: - return -1; - case 5: - return 1; - default: - return 0; - } - } - - public int mLX() - { - switch(this.getFacing()) - { - case 2: - return 1; - case 3: - return -1; - default: - return 0; - } - } - - @Override - public boolean canDrain(ForgeDirection arg0, Fluid arg1) { - return false; - } - - @Override - public boolean canFill(ForgeDirection direction, Fluid fluid) { - return direction==ForgeDirection.UP || (gasCanPass(direction) && fluid.isGaseous()); - } - - @Override - public int fill(ForgeDirection direction, FluidStack fluidStack, boolean doFill) - { - if(fluidStack!=null && fluidStack.getFluid()!=null && fluidStack.amount>0) - { - if(gasCanPass(direction) && fluidStack!=null && fluidStack.getFluid()!=null && fluidStack.amount>0) - { - this.gasInputDirection=direction; - if(fluidStack.getFluid().isGaseous() && fluidStack.getFluid().getDensity() getRecipes() - { - return recipeManager.getRecipes(); - } - - @Override - public boolean shouldRenderInPass(int pass) - { - return pass==0; - } -} \ No newline at end of file -- cgit v1.2.3