From 7305ba719930ea3fbf8aa987aeec48b33cdbd82e Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Tue, 21 Mar 2017 17:34:07 +0300 Subject: Oregen --- ihl/processing/chemistry/AbsorberCoolerModel.java | 78 ---- .../chemistry/ApparatusProcessableInvSlot.java | 54 +-- .../chemistry/ChemicalReactorTileEntity.java | 6 +- .../chemistry/CryogenicDistillerTileEntity.java | 3 +- .../chemistry/ElectrolysisBathTileEntity.java | 6 +- ihl/processing/chemistry/EvaporatorTileEntity.java | 4 +- .../chemistry/FluidizedBedReactorContainer.java | 8 +- .../chemistry/FluidizedBedReactorTileEntity.java | 10 +- .../chemistry/FractionatorBottomTileEntity.java | 2 +- ihl/processing/chemistry/GoldChimneyKneeModel.java | 45 -- .../chemistry/GoldChimneyKneeRender.java | 50 --- .../chemistry/GoldChimneyKneeTileEntity.java | 293 ------------- .../chemistry/LabElectrolyzerTileEntity.java | 2 +- ihl/processing/chemistry/LeadOvenContainer.java | 139 +++--- ihl/processing/chemistry/LeadOvenGui.java | 67 +-- ihl/processing/chemistry/LeadOvenTileEntity.java | 486 +++++++++------------ ihl/processing/chemistry/LoomTileEntity.java | 8 +- .../chemistry/PaperMachineTileEntity.java | 2 +- .../chemistry/PrecipitatorCondenserModel.java | 110 ----- .../chemistry/PrecipitatorCondenserRender.java | 50 --- .../chemistry/PrecipitatorCondenserTileEntity.java | 379 ---------------- 21 files changed, 380 insertions(+), 1422 deletions(-) delete mode 100644 ihl/processing/chemistry/AbsorberCoolerModel.java delete mode 100644 ihl/processing/chemistry/GoldChimneyKneeModel.java delete mode 100644 ihl/processing/chemistry/GoldChimneyKneeRender.java delete mode 100644 ihl/processing/chemistry/GoldChimneyKneeTileEntity.java delete mode 100644 ihl/processing/chemistry/PrecipitatorCondenserModel.java delete mode 100644 ihl/processing/chemistry/PrecipitatorCondenserRender.java delete mode 100644 ihl/processing/chemistry/PrecipitatorCondenserTileEntity.java (limited to 'ihl/processing/chemistry') diff --git a/ihl/processing/chemistry/AbsorberCoolerModel.java b/ihl/processing/chemistry/AbsorberCoolerModel.java deleted file mode 100644 index 7dac4c9..0000000 --- a/ihl/processing/chemistry/AbsorberCoolerModel.java +++ /dev/null @@ -1,78 +0,0 @@ -package ihl.processing.chemistry; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; - -public class AbsorberCoolerModel extends ModelBase -{ - //fields - ModelRenderer Base; - - public AbsorberCoolerModel() - { - textureWidth = 64; - textureHeight = 32; - setTextureOffset("Base.Shape1", 26, 0); - setTextureOffset("Base.Shape2", 0, 17); - setTextureOffset("Base.Shape4", 30, 16); - setTextureOffset("Base.Shape3", 0, 15); - setTextureOffset("Base.Shape5", 2, 12); - setTextureOffset("Base.Shape6", 0, 2); - setTextureOffset("Base.Shape7", 24, 4); - setTextureOffset("Base.Shape8", 50, 0); - setTextureOffset("Base.Shape9", 0, 0); - setTextureOffset("Base.Shape10", 0, 0); - setTextureOffset("Base.Shape11", 0, 0); - setTextureOffset("Base.Shape12", 0, 0); - setTextureOffset("Base.Shape13", 0, 0); - setTextureOffset("Base.Shape14", 0, 0); - setTextureOffset("Base.Shape15", 0, 0); - setTextureOffset("Base.Shape16", 0, 0); - setTextureOffset("Base.Shape17", 0, 0); - setTextureOffset("Base.Shape18", 0, 0); - setTextureOffset("Base.Shape19", 0, 0); - setTextureOffset("Base.Shape20", 0, 0); - setTextureOffset("Base.Shape21", 0, 0); - setTextureOffset("Base.Shape22", 0, 0); - setTextureOffset("Base.Shape23", 0, 24); - setTextureOffset("Base.Shape24", 7, 12); - setTextureOffset("Base.Shape25", 21, 8); - setTextureOffset("Base.Shape26", 12, 24); - setTextureOffset("Base.Shape27", 0, 0); - setTextureOffset("Base.Shape28", 0, 18); - setTextureOffset("Base.Shape29", 21, 0); - - Base = new ModelRenderer(this, "Base"); - Base.setRotationPoint(0F, 23F, 0F); - Base.mirror = true; - Base.addBox("Shape1", 6F, -14F, -7F, 1, 14, 14); - Base.addBox("Shape2", -7F, -1F, -8F, 14, 1, 1); - Base.addBox("Shape4", 6F, -14F, -8F, 1, 13, 1); - Base.addBox("Shape3", -7F, -1F, 7F, 14, 1, 1); - Base.addBox("Shape5", -7F, -15F, -8F, 6, 1, 16); - Base.addBox("Shape6", -7F, -14F, 7F, 1, 13, 1); - Base.addBox("Shape7", -7F, -14F, -7F, 1, 14, 14); - Base.addBox("Shape8", -7F, -14F, -8F, 1, 13, 1); - Base.addBox("Shape9", 1F, 0F, -8F, 7, 1, 16); - Base.addBox("Shape10", 6F, -14F, 7F, 1, 13, 1); - Base.addBox("Shape11", 3.5F, -13F, -7F, 1, 1, 14); - Base.addBox("Shape12", 1.5F, -13F, -7F, 1, 1, 14); - Base.addBox("Shape13", -2.5F, -13F, -7F, 1, 1, 14); - Base.addBox("Shape14", -4.5F, -13F, -7F, 1, 1, 14); - Base.addBox("Shape15", -0.5F, -13F, -7F, 1, 1, 14); - Base.addBox("Shape16", -6F, -12.5F, -1.5F, 12, 1, 1); - Base.addBox("Shape17", -6F, -12.5F, -3.5F, 12, 1, 1); - Base.addBox("Shape18", -6F, -12.5F, -5.5F, 12, 1, 1); - Base.addBox("Shape19", -6F, -12.5F, 0.5F, 12, 1, 1); - Base.addBox("Shape20", -6F, -12.5F, 2.5F, 12, 1, 1); - Base.addBox("Shape21", -6F, -12.5F, 4.5F, 12, 1, 1); - Base.addBox("Shape22", -6F, 9F, 7F, 12, 2, 1); - Base.addBox("Shape23", -6F, -14F, -8F, 12, 2, 1); - Base.addBox("Shape24", 1F, -15F, -8F, 6, 1, 16); - Base.addBox("Shape25", -1F, -15F, 1F, 2, 1, 7); - Base.addBox("Shape26", -1F, -15F, -8F, 2, 1, 7); - Base.addBox("Shape27", -8F, 0F, -8F, 7, 1, 16); - Base.addBox("Shape28", -1F, 0F, 1F, 2, 1, 7); - Base.addBox("Shape29", -1F, 0F, -8F, 2, 1, 7); - } -} diff --git a/ihl/processing/chemistry/ApparatusProcessableInvSlot.java b/ihl/processing/chemistry/ApparatusProcessableInvSlot.java index 3698160..84a931b 100644 --- a/ihl/processing/chemistry/ApparatusProcessableInvSlot.java +++ b/ihl/processing/chemistry/ApparatusProcessableInvSlot.java @@ -1,5 +1,6 @@ package ihl.processing.chemistry; +import ic2.api.recipe.IRecipeInput; import ic2.core.block.TileEntityInventory; import ic2.core.block.invslot.InvSlot; import java.util.ArrayList; @@ -10,57 +11,48 @@ import net.minecraft.item.ItemStack; public class ApparatusProcessableInvSlot extends InvSlot { - public ApparatusProcessableInvSlot(TileEntityInventory base1, String name1, - int oldStartIndex1, Access access1, int count, int stackSizeLimit1) { + public ApparatusProcessableInvSlot(TileEntityInventory base1, String name1, int oldStartIndex1, Access access1, + int count, int stackSizeLimit1) { super(base1, name1, oldStartIndex1, access1, count); this.setStackSizeLimit(stackSizeLimit1); } - - public List getItemStackList() - { + + public List getItemStackList() { List list = new ArrayList(); - for(int i=0; i { protected FluidizedBedReactorTileEntity tileEntity; - public int lastFluidAmount = -1; - public int lastNumberOfFluids = -1; + public int lastFluidsHash = -1; public short lastProgress = -1; public short lastTemperature = -1; public short lastEnergy = -1; @@ -53,7 +52,7 @@ public class FluidizedBedReactorContainer extends ContainerBase1000) { - this.input.consume(0,1); + this.input.consume(recipeInput.getItemInputs().get(0)); } } - if(recipeInput.getItemInputs().size()>1)this.input.consume(1, recipeInput.getItemInputs().get(1).getAmount()); + if(recipeInput.getItemInputs().size()>1)this.input.consume(recipeInput.getItemInputs().get(1)); if(output1.getFluidOutputs().size()>0)this.fluidTank.fill(output1.getFluidOutputs().get(0).copy(), true); if(output1.getFluidOutputs().size()>1)this.fluidTank.fill(output1.getFluidOutputs().get(1).copy(), true); if(!output1.getItemOutputs().isEmpty() && output1.getItemOutputs().get(0)!=null)this.outputSlot.add(output1.getItemOutputs()); diff --git a/ihl/processing/chemistry/FractionatorBottomTileEntity.java b/ihl/processing/chemistry/FractionatorBottomTileEntity.java index 20132e9..2f3b43f 100644 --- a/ihl/processing/chemistry/FractionatorBottomTileEntity.java +++ b/ihl/processing/chemistry/FractionatorBottomTileEntity.java @@ -113,7 +113,7 @@ public class FractionatorBottomTileEntity extends TileEntityInventory FluidStack fsCurrentInput = this.fluidTank.getFluid(); if(fsCurrentInput!=null && fsCurrentInput.amount>100 && systemHeat>0) { - UniversalRecipeOutput rOutput = FractionatorBottomTileEntity.recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null, false, false); + UniversalRecipeOutput rOutput = FractionatorBottomTileEntity.recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null); UniversalRecipeInput rInput = FractionatorBottomTileEntity.recipeManager.getRecipeInput(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null); if(rOutput!=null) { diff --git a/ihl/processing/chemistry/GoldChimneyKneeModel.java b/ihl/processing/chemistry/GoldChimneyKneeModel.java deleted file mode 100644 index f98fe15..0000000 --- a/ihl/processing/chemistry/GoldChimneyKneeModel.java +++ /dev/null @@ -1,45 +0,0 @@ -package ihl.processing.chemistry; - -import ihl.model.IHLModelRenderer; -import net.minecraft.client.model.ModelBase; -import net.minecraftforge.common.util.ForgeDirection; - -public class GoldChimneyKneeModel extends ModelBase -{ - //fields - IHLModelRenderer Base; - - public GoldChimneyKneeModel() - { - textureWidth = 64; - textureHeight = 32; - setTextureOffset("Base.Shape1", 26, 0); - setTextureOffset("Base.Shape2", 0, 17); - setTextureOffset("Base.Shape4", 30, 16); - setTextureOffset("Base.Shape3", 0, 15); - setTextureOffset("Base.Shape5", 11, 12); - setTextureOffset("Base.Shape6", 9, 2); - setTextureOffset("Base.Shape7", 24, 7); - setTextureOffset("Base.Shape8", 50, 0); - setTextureOffset("Base.Shape9", 0, 0); - setTextureOffset("Base.Shape10", 6, 0); - setTextureOffset("Base.Shape11", 18, 0); - setTextureOffset("Base.Pipe", 0, 0); - - Base = new IHLModelRenderer(this, "Base"); - Base.setRotationPoint(0F, 23F, -6F); - Base.mirror = true; - Base.addBox("Shape1", 5F, -14F, 0F, 1, 15, 12, false); - Base.addBox("Shape2", -6F, -1F, 0F, 11, 2, 1, false); - Base.addBox("Shape4", 5F, -14F, -2F, 1, 13, 2, false); - Base.addBox("Shape3", -6F, -2F, -2F, 11, 1, 3, false); - Base.addBox("Shape5", -6F, -14F, -2F, 11, 1, 14, false); - Base.addBox("Shape6", -5F, -13F, 11F, 4, 14, 1, false); - Base.addBox("Shape7", -6F, -13F, 1F, 1, 14, 11, false); - Base.addBox("Shape8", -6F, -13F, -2F, 1, 11, 3, false); - Base.addBox("Shape9", 1F, -13F, 11F, 4, 14, 1, false); - Base.addBox("Shape10", -1F, -13F, 11F, 2, 4, 1, false); - Base.addBox("Shape11", -1F, -7F, 11F, 2, 8, 1, false); - Base.addTube("Pipe", -2F, -10F, 2F, 4, 4, 12, 0.5F, 1F,ForgeDirection.NORTH); - } -} diff --git a/ihl/processing/chemistry/GoldChimneyKneeRender.java b/ihl/processing/chemistry/GoldChimneyKneeRender.java deleted file mode 100644 index d862963..0000000 --- a/ihl/processing/chemistry/GoldChimneyKneeRender.java +++ /dev/null @@ -1,50 +0,0 @@ -package ihl.processing.chemistry; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import ihl.IHLModInfo; - -public class GoldChimneyKneeRender extends TileEntitySpecialRenderer{ -private GoldChimneyKneeModel model = new GoldChimneyKneeModel(); -private ResourceLocation tex = new ResourceLocation(IHLModInfo.MODID+":textures/blocks/porcelainBox.png"); - -public GoldChimneyKneeRender(){} - -public void renderAModelAt(GoldChimneyKneeTileEntity tile, double d, double d1, double d2, float f) { - int rotation = 0; - if(tile.getWorldObj() != null) - { - switch (tile.getFacing()) - { - case 2: - rotation = 0; - break; - case 5: - rotation = 1; - break; - case 3: - rotation = 2; - break; - case 4: - rotation = 3; - break; - default: - rotation = 0; - } - } - bindTexture(tex); //texture - GL11.glPushMatrix(); - GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F); - GL11.glScalef(1.0F, -1F, -1F); - GL11.glRotatef(rotation*90, 0.0F, 1.0F, 0.0F); - model.Base.render(1.0F/16.0F); - GL11.glPopMatrix(); //end -} - - @Override - public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8) - { - this.renderAModelAt((GoldChimneyKneeTileEntity)par1TileEntity, par2, par4, par6, par8); - } -} \ No newline at end of file diff --git a/ihl/processing/chemistry/GoldChimneyKneeTileEntity.java b/ihl/processing/chemistry/GoldChimneyKneeTileEntity.java deleted file mode 100644 index 34b3de2..0000000 --- a/ihl/processing/chemistry/GoldChimneyKneeTileEntity.java +++ /dev/null @@ -1,293 +0,0 @@ -package ihl.processing.chemistry; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import ic2.api.network.INetworkDataProvider; -import ic2.api.tile.IWrenchable; -import ic2.core.IC2; -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; -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; - -public class GoldChimneyKneeTileEntity extends TileEntity implements IWrenchable, INetworkDataProvider, IFluidHandler { - private short facing=2; - private short lastFacing=2; - private final IHLFluidTank gasBuffer = new IHLFluidTank(10000); - private final IHLFluidTank fluidTank = new IHLFluidTank(10000); - private static UniversalRecipeManager recipeManager = new UniversalRecipeManager("chimneyknee"); - - - public GoldChimneyKneeTileEntity() - { - super(); - } - - @Override - public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { - return this.facing!=side; - } - - @Override - public short getFacing() - { - return facing; - } - - @Override - public List getNetworkedFields() - { - List fields = new ArrayList(); - fields.add("facing"); - return fields; - } - - @Override - public void updateEntity() - { - super.updateEntity(); - if(IC2.platform.isSimulating()) - { - if(this.facing!=this.lastFacing) - { - IC2.network.get().updateTileEntityField(this, "facing"); - this.lastFacing=this.facing; - } - if(this.fluidTank.getFluid()!=null && this.gasBuffer.getFluid()!=null) - { - if(this.getOutput()!=null) - { - List output = GoldChimneyKneeTileEntity.recipeManager.getOutputFor(getInput(), true, true).getFluidOutputs(); - if(output.size()>0) - { - this.fillOutputApparatus(getConnectDirection(),output.get(0), true); - } - } - } - if(this.fluidTank.getFluid()!=null) - { - if(this.fillOutputApparatus(getConnectDirection(),this.fluidTank.drain(this.fluidTank.getCapacity(), false), false)>0) - { - this.fillOutputApparatus(getConnectDirection(),this.fluidTank.drain(this.fluidTank.getCapacity(), true), true); - } - } - if(this.gasBuffer.getFluid()!=null) - { - if(this.fillOutputApparatus(getConnectDirection(),this.gasBuffer.drain(this.gasBuffer.getCapacity(), false), false)>0) - { - this.fillOutputApparatus(getConnectDirection(),this.gasBuffer.drain(this.gasBuffer.getCapacity(), true), true); - } - } - - } - } - - private int fillOutputApparatus(ForgeDirection direction,FluidStack fluidStack, boolean doFill) - { - TileEntity te = worldObj.getTileEntity(xCoord+mX(),yCoord, zCoord+mZ()); - if(te instanceof IFluidHandler) - { - return ((IFluidHandler)te).fill(direction, fluidStack, doFill); - } - else - { - return 0; - } - } - - @Override - public void setFacing(short facing1) - { - facing=(short) Math.max(2,facing1); - if(IC2.platform.isSimulating()) - { - IC2.network.get().updateTileEntityField(this, "facing"); - } - } - - @Override - public boolean wrenchCanRemove(EntityPlayer entityPlayer) - { - return true; - } - - @Override - public float getWrenchDropRate() - { - return 1F; - } - - @Override - public ItemStack getWrenchDrop(EntityPlayer entityPlayer) - { - return IHLUtils.getThisModItemStack("goldChimneyKnee"); - } - - @Override - public void writeToNBT(NBTTagCompound nbttagcompound) - { - super.writeToNBT(nbttagcompound); - nbttagcompound.setShort("facing",facing); - NBTTagCompound fluidTankTag = new NBTTagCompound(); - this.fluidTank.writeToNBT(fluidTankTag); - nbttagcompound.setTag("fluidTank", fluidTankTag); - - NBTTagCompound gasBufferTag = new NBTTagCompound(); - this.gasBuffer.writeToNBT(gasBufferTag); - nbttagcompound.setTag("gasBuffer", gasBufferTag); - - } - - @Override - public void readFromNBT(NBTTagCompound nbttagcompound) - { - super.readFromNBT(nbttagcompound); - facing=nbttagcompound.getShort("facing"); - this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank")); - this.gasBuffer.readFromNBT(nbttagcompound.getCompoundTag("gasBuffer")); - } - - protected int mX() - { - switch(this.getFacing()) - { - case 4: - return 1; - case 5: - return -1; - default: - return 0; - } - } - - protected int mZ() - { - switch(this.getFacing()) - { - case 2: - return 1; - case 3: - return -1; - default: - return 0; - } - } - - public TileEntity getConnectedTileEntity() - { - return worldObj.getTileEntity(xCoord+mX(), yCoord, zCoord+mZ()); - } - - public ForgeDirection getConnectDirection() - { - switch(this.getFacing()) - { - case 2: - return ForgeDirection.NORTH; - case 3: - return ForgeDirection.SOUTH; - case 4: - return ForgeDirection.WEST; - case 5: - return ForgeDirection.EAST; - default: - return ForgeDirection.NORTH; - } - } - - @Override - public boolean canDrain(ForgeDirection arg0, Fluid arg1) - { - return false; - } - - @Override - public boolean canFill(ForgeDirection direction, Fluid fluid) - { - return fluid.isGaseous() && (direction==ForgeDirection.DOWN || direction==getConnectDirection()); - } - - @Override - public int fill(ForgeDirection direction, FluidStack fluidStack, boolean doFill) - { - if(direction==getConnectDirection() && fluidStack!=null && fluidStack.getFluid()!=null) - { - if(fluidStack.getFluid().isGaseous() && fluidStack.getFluid().getDensity() getRecipes() - { - return recipeManager.getRecipes(); - } -} diff --git a/ihl/processing/chemistry/LabElectrolyzerTileEntity.java b/ihl/processing/chemistry/LabElectrolyzerTileEntity.java index f8c00ad..11647d6 100644 --- a/ihl/processing/chemistry/LabElectrolyzerTileEntity.java +++ b/ihl/processing/chemistry/LabElectrolyzerTileEntity.java @@ -174,7 +174,7 @@ public class LabElectrolyzerTileEntity extends BasicElectricMotorTileEntity impl } public UniversalRecipeOutput getOutput() { - return LabElectrolyzerTileEntity.recipeManager.getOutputFor(this.getInput(), false, false); + return LabElectrolyzerTileEntity.recipeManager.getOutputFor(this.getInput()); } @SuppressWarnings({ "unchecked", "rawtypes" }) diff --git a/ihl/processing/chemistry/LeadOvenContainer.java b/ihl/processing/chemistry/LeadOvenContainer.java index c273623..2f0ff8a 100644 --- a/ihl/processing/chemistry/LeadOvenContainer.java +++ b/ihl/processing/chemistry/LeadOvenContainer.java @@ -1,78 +1,93 @@ package ihl.processing.chemistry; +import java.util.List; + import ic2.core.ContainerBase; +import ic2.core.IC2; import ic2.core.slot.SlotInvSlot; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; +import net.minecraftforge.fluids.FluidStack; public class LeadOvenContainer extends ContainerBase { - protected LeadOvenTileEntity tileEntity; - public int lastFluidAmount = -1; - public int lastFuel = -1; - public short lastProgress = -1; - private final static int height=166; - - public LeadOvenContainer(EntityPlayer entityPlayer, LeadOvenTileEntity tileEntity1){ - super(tileEntity1); - this.tileEntity = tileEntity1; - int col; - for (col = 0; col < 3; ++col) - { - for (int col1 = 0; col1 < 9; ++col1) - { - this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18)); - } - } - for (col = 0; col < 9; ++col) - { - this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24)); - } - this.addSlotToContainer(new SlotInvSlot(tileEntity1.fuelSlot, 0, 56, 53)); - this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputSlot, 0, 47, 17)); - this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputSlot, 1, 65, 17)); - this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 112, 35)); - } + protected LeadOvenTileEntity tileEntity; + public int lastInputFluidAmount = -1; + public int lastOutputFluidAmount = -1; + public int lastFuel = -1; + public short lastProgress = -1; + private final static int height = 166; + public List inputTankFluidList; + public List outputTankFluidList; + + public LeadOvenContainer(EntityPlayer entityPlayer, LeadOvenTileEntity tileEntity1) { + super(tileEntity1); + this.tileEntity = tileEntity1; + inputTankFluidList = this.tileEntity.inputTank.getFluidList(); + outputTankFluidList = this.tileEntity.outputTank.getFluidList(); + int col; + for (col = 0; col < 3; ++col) { + for (int col1 = 0; col1 < 9; ++col1) { + this.addSlotToContainer( + new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18)); + } + } + for (col = 0; col < 9; ++col) { + this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24)); + } + this.addSlotToContainer(new SlotInvSlot(tileEntity1.fuelSlot, 0, 56, 53)); + this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputSlot, 0, 47, 17)); + this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputSlot, 1, 65, 17)); + this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 112, 35)); + this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 9, 53)); + this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 9, 17)); + this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 9, 35)); + this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot2, 0, 150, 53)); + this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot2, 0, 150, 17)); + this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 1, 150, 35)); + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + for (int i = 0; i < this.crafters.size(); ++i) { + ICrafting icrafting = (ICrafting) this.crafters.get(i); + if (this.tileEntity.inputTank.getFluidAmount() != this.lastInputFluidAmount) { + IC2.network.get().sendContainerField(this, "inputTankFluidList"); + } + if (this.tileEntity.outputTank.getFluidAmount() != this.lastOutputFluidAmount) { + IC2.network.get().sendContainerField(this, "outputTankFluidList"); + } + + if (this.tileEntity.fuel != this.lastFuel) { + icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.fuel); + } - @Override - public void detectAndSendChanges() - { - super.detectAndSendChanges(); - for (int i = 0; i < this.crafters.size(); ++i) - { - ICrafting icrafting = (ICrafting)this.crafters.get(i); + if (this.tileEntity.progress != this.lastProgress) { + icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.progress); + } + } + this.lastFuel = this.tileEntity.fuel; + this.lastProgress = this.tileEntity.progress; + this.lastInputFluidAmount = this.tileEntity.inputTank.getFluidAmount(); + this.lastOutputFluidAmount = this.tileEntity.outputTank.getFluidAmount(); + } - if (this.tileEntity.fuel != this.lastFuel) - { - icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.fuel); - } - - if (this.tileEntity.progress != this.lastProgress) - { - icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.progress); - } - } - this.lastFuel = this.tileEntity.fuel; - this.lastProgress = this.tileEntity.progress; - } - - @Override - public void updateProgressBar(int index, int value) - { - super.updateProgressBar(index, value); + @Override + public void updateProgressBar(int index, int value) { + super.updateProgressBar(index, value); + + switch (index) { + case 0: + this.tileEntity.fuel = value; + break; + case 1: + this.tileEntity.progress = (short) value; + break; + } + } - switch (index) - { - case 0: - this.tileEntity.fuel=value; - break; - case 1: - this.tileEntity.progress=(short) value; - break; - } - } - @Override public boolean canInteractWith(EntityPlayer var1) { return tileEntity.isUseableByPlayer(var1); diff --git a/ihl/processing/chemistry/LeadOvenGui.java b/ihl/processing/chemistry/LeadOvenGui.java index 2d8e785..0c35a21 100644 --- a/ihl/processing/chemistry/LeadOvenGui.java +++ b/ihl/processing/chemistry/LeadOvenGui.java @@ -3,6 +3,7 @@ package ihl.processing.chemistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ihl.utils.IHLRenderUtils; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @@ -12,35 +13,43 @@ public class LeadOvenGui extends GuiContainer { private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUILeadOven.png"); private LeadOvenContainer container; - public LeadOvenGui (LeadOvenContainer container1) { - //the container is instanciated and passed to the superclass for handling - super(container1); - this.container=container1; - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.renderEngine.bindTexture(background); - } + public LeadOvenGui(LeadOvenContainer container1) { + // the container is instanciated and passed to the superclass for + // handling + super(container1); + this.container = container1; + } - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, - int par3) { - //draw your Gui here, only thing you need to change is the path - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.renderEngine.bindTexture(background); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - int i1; - if (this.container.tileEntity.fuel > 0) - { - i1 = this.container.tileEntity.gaugeFuelScaled(12); - this.drawTexturedModalRect(x + 56, y + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2); - } - i1 = this.container.tileEntity.gaugeProgressScaled(24); - this.drawTexturedModalRect(x + 79, y + 34, 176, 14, i1 + 1, 16); + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(background); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + if (this.container.tileEntity.inputTank.getFluidAmount() > 0) { + IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.inputTank, 30, 19, 42, 66, zLevel, + par1, par2, x, y); + } + if (this.container.tileEntity.outputTank.getFluidAmount() > 0) { + IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.outputTank, 133, 19, 145, 66, zLevel, + par1, par2, x, y); + } + } - } + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + // draw your Gui here, only thing you need to change is the path + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(background); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + int i1; + if (this.container.tileEntity.fuel > 0) { + i1 = this.container.tileEntity.gaugeFuelScaled(12); + this.drawTexturedModalRect(x + 56, y + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2); + } + i1 = this.container.tileEntity.gaugeProgressScaled(24); + this.drawTexturedModalRect(x + 79, y + 34, 176, 14, i1 + 1, 16); + } } \ No newline at end of file diff --git a/ihl/processing/chemistry/LeadOvenTileEntity.java b/ihl/processing/chemistry/LeadOvenTileEntity.java index 340d848..c2067d8 100644 --- a/ihl/processing/chemistry/LeadOvenTileEntity.java +++ b/ihl/processing/chemistry/LeadOvenTileEntity.java @@ -11,327 +11,277 @@ import net.minecraft.client.gui.GuiScreen; 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.api.recipe.IRecipeInput; import ic2.core.ContainerBase; import ic2.core.IC2; import ic2.core.IHasGui; -import ic2.core.block.TileEntityLiquidTankInventory; +import ic2.core.block.TileEntityInventory; +import ic2.core.block.invslot.InvSlot; import ic2.core.block.invslot.InvSlotConsumableFuel; +import ic2.core.block.invslot.InvSlotConsumableLiquid; +import ic2.core.block.invslot.InvSlotOutput; import ic2.core.block.invslot.InvSlot.Access; import ihl.processing.invslots.IHLInvSlotOutput; +import ihl.processing.invslots.InvSlotConsumableLiquidIHL; import ihl.recipes.RecipeOutputItemStack; import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeManager; import ihl.recipes.UniversalRecipeOutput; +import ihl.utils.IHLFluidTank; import ihl.utils.IHLUtils; -public class LeadOvenTileEntity extends TileEntityLiquidTankInventory implements IHasGui -{ - public final InvSlotConsumableFuel fuelSlot; - public final ApparatusProcessableInvSlot inputSlot; - public final IHLInvSlotOutput outputSlot; - public short progress = 0; - public final short maxProgress = 160; - public int fuel = 0; - public int maxFuel = 0; +public class LeadOvenTileEntity extends TileEntityInventory implements IHasGui, IFluidHandler { + public final InvSlotConsumableFuel fuelSlot; + public final ApparatusProcessableInvSlot inputSlot; + public final IHLInvSlotOutput outputSlot; + public final IHLFluidTank inputTank = new IHLFluidTank(1000); + public final IHLFluidTank outputTank = new IHLFluidTank(1000); + public final InvSlotConsumableLiquidIHL drainInputSlot; + public final InvSlotConsumableLiquidIHL fillInputSlot; + public final InvSlotOutput emptyFluidItemsSlot; + public final InvSlotConsumableLiquidIHL drainInputSlot2; + public final InvSlotConsumableLiquidIHL fillInputSlot2; + public short progress = 0; + public final short maxProgress = 160; + public int fuel = 0; + public int maxFuel = 0; protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("chemicaloven"); - private ItemStack burnedFuel; - - public LeadOvenTileEntity() - { - super(1000); - this.fuelSlot = new InvSlotConsumableFuel(this, "fuel", 1, 1, true); - this.inputSlot = new ApparatusProcessableInvSlot(this, "input", 2, Access.IO, 2, 64); - this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 1); - } - - public static void addRecipe(UniversalRecipeInput input,UniversalRecipeOutput output) - { - recipeManager.addRecipe(input, output); - } - - @Override - public void readFromNBT(NBTTagCompound nbttagcompound) - { - super.readFromNBT(nbttagcompound); - - try - { - this.fuel = nbttagcompound.getInteger("fuel"); - } - catch (Throwable var4) - { - this.fuel = nbttagcompound.getShort("fuel"); - } - - try - { - this.maxFuel = nbttagcompound.getInteger("maxFuel"); - } - catch (Throwable var3) - { - this.maxFuel = nbttagcompound.getShort("maxFuel"); - } - this.progress = nbttagcompound.getShort("progress"); - } - - @Override - public void writeToNBT(NBTTagCompound nbttagcompound) - { - super.writeToNBT(nbttagcompound); - nbttagcompound.setInteger("fuel", this.fuel); - nbttagcompound.setInteger("maxFuel", this.maxFuel); - nbttagcompound.setShort("progress", this.progress); - NBTTagCompound gasBufferTag = new NBTTagCompound(); - nbttagcompound.setTag("gasBuffer", gasBufferTag); - } - + + public LeadOvenTileEntity() { + super(); + this.fuelSlot = new InvSlotConsumableFuel(this, "fuel", 1, 1, true); + this.inputSlot = new ApparatusProcessableInvSlot(this, "input", 2, Access.IO, 2, 64); + this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 1); + this.drainInputSlot = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1, + InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain); + this.fillInputSlot = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1, + InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill); + this.drainInputSlot2 = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1, + InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain); + this.fillInputSlot2 = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1, + InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill); + this.emptyFluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 2, 2); + } + + public static void addRecipe(UniversalRecipeInput input, UniversalRecipeOutput output) { + recipeManager.addRecipe(input, output); + } + @Override - public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) - { - return this.getFacing()!=(short)side && side!=0 && side!=1; + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + this.fuel = nbttagcompound.getInteger("fuel"); + this.maxFuel = nbttagcompound.getInteger("maxFuel"); + this.progress = nbttagcompound.getShort("progress"); + this.inputTank.readFromNBT(nbttagcompound.getCompoundTag("inputTank")); + this.outputTank.readFromNBT(nbttagcompound.getCompoundTag("outputTank")); } - + @Override - public ItemStack getWrenchDrop(EntityPlayer entityPlayer) - { - return IHLUtils.getThisModItemStack("leadOven"); + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + nbttagcompound.setInteger("fuel", this.fuel); + nbttagcompound.setInteger("maxFuel", this.maxFuel); + nbttagcompound.setShort("progress", this.progress); + NBTTagCompound inputTankTag = new NBTTagCompound(); + this.inputTank.writeToNBT(inputTankTag); + nbttagcompound.setTag("inputTank", inputTankTag); + NBTTagCompound outputTankTag = new NBTTagCompound(); + this.outputTank.writeToNBT(outputTankTag); + nbttagcompound.setTag("outputTank", outputTankTag); } - - public int gaugeProgressScaled(int i) - { - return this.progress * i / maxProgress; - } - - public int gaugeFuelScaled(int i) - { - if (this.maxFuel == 0) - { - this.maxFuel = this.fuel; - - if (this.maxFuel == 0) - { - this.maxFuel = 160; - } - } - - return this.fuel * i / this.maxFuel; - } - - public boolean enableUpdateEntity() - { - return IC2.platform.isSimulating(); - } - - @Override - public void updateEntityServer() - { - super.updateEntityServer(); - if(this.getFluidTank().getFluid()!=null) - { - FluidStack fs; - if(this.maxProgress>0 && this.getOutput()!=null && this.getOutput().getFluidOutputs()!=null && this.getOutput().getFluidOutputs().size()>0) - { - fs = this.getFluidTank().drain(this.getOutput().getFluidOutputs().get(0).amount/this.maxProgress, true); - } - else - { - fs = this.getFluidTank().drain(1000, true); - } - TileEntity te = worldObj.getTileEntity(xCoord, yCoord+1, zCoord); - if(te!=null) - { - ForgeDirection direction = ForgeDirection.DOWN; - if(te instanceof IFluidHandler) - { - ((IFluidHandler)te).fill(direction, fs, true); - } - } - } - if (this.fuel <= 0 && this.canOperate()) - { - if(this.fuelSlot.get()!=null) - { - if(burnedFuel!=null && IHLUtils.isItemsHaveSameOreDictionaryEntry(this.fuelSlot.get(), burnedFuel)) - { - burnedFuel.stackSize++; - } - else if(burnedFuel==null) - { - burnedFuel=this.fuelSlot.get().copy(); - burnedFuel.stackSize=1; - } - } - this.fuel = this.maxFuel = this.fuelSlot.consumeFuel(); - } - - if (this.isBurning() && this.canOperate()) - { - ++this.progress; - - if (this.progress >= maxProgress) - { - this.progress = 0; - this.operate(); - } - } - else - { - this.progress = 0; - } - - if (this.fuel > 0) - { - --this.fuel; - } - - if (this.getActive() != this.isBurning()) - { - this.setActive(this.isBurning()); - } - } - - public boolean isBurning() - { - return this.fuel > 0; - } - - public boolean canOperate() - { - return this.getOutput()!=null; - } - - /** - * Returns the name of the inventory - */ - @Override - public String getInventoryName() - { - return "goldOven"; - } - - @Override - public ContainerBase getGuiContainer(EntityPlayer entityPlayer) - { - return new LeadOvenContainer(entityPlayer, this); - } - + @Override - @SideOnly(Side.CLIENT) - public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin) - { - return new LeadOvenGui(new LeadOvenContainer(entityPlayer, this)); - } - - @Override - public void onGuiClosed(EntityPlayer entityPlayer) {} - - public int mX() - { - switch(this.getFacing()) - { - case 4: - return -1; - case 5: - return 1; - default: - return 0; + 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("leadOven"); + } + + public int gaugeProgressScaled(int i) { + return this.progress * i / maxProgress; + } + + public int gaugeFuelScaled(int i) { + if (this.maxFuel == 0) { + this.maxFuel = this.fuel; + + if (this.maxFuel == 0) { + this.maxFuel = 160; + } } + + return this.fuel * i / this.maxFuel; } - - public int mZ() - { - switch(this.getFacing()) - { - case 2: - return -1; - case 3: - return 1; - default: - return 0; + + public boolean enableUpdateEntity() { + return IC2.platform.isSimulating(); + } + + @Override + public void updateEntityServer() { + super.updateEntityServer(); + IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, inputTank); + IHLUtils.handleFluidSlotsBehaviour(fillInputSlot2, drainInputSlot2, emptyFluidItemsSlot, outputTank); + if (this.fuel <= 0 && this.canOperate()) { + this.fuel = this.maxFuel = this.fuelSlot.consumeFuel(); + } + + if (this.isBurning() && this.canOperate()) { + ++this.progress; + + if (this.progress >= maxProgress) { + this.progress = 0; + this.operate(); + } + } else { + this.progress = 0; } + + if (this.fuel > 0) { + --this.fuel; + } + + if (this.getActive() != this.isBurning()) { + this.setActive(this.isBurning()); + } + } + + public boolean isBurning() { + return this.fuel > 0; + } + + public boolean canOperate() { + return this.getOutput() != null; + } + + /** + * Returns the name of the inventory + */ + @Override + public String getInventoryName() { + return "goldOven"; + } + + @Override + public ContainerBase getGuiContainer(EntityPlayer entityPlayer) { + return new LeadOvenContainer(entityPlayer, this); + } + + @Override + @SideOnly(Side.CLIENT) + public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin) { + return new LeadOvenGui(new LeadOvenContainer(entityPlayer, this)); + } + + @Override + public void onGuiClosed(EntityPlayer entityPlayer) { + } + + public UniversalRecipeOutput getOutput() { + return LeadOvenTileEntity.recipeManager.getOutputFor(this.getInput()); } - - public UniversalRecipeOutput getOutput() - { - return LeadOvenTileEntity.recipeManager.getOutputFor(this.getInput(), false, false); - } @SuppressWarnings("rawtypes") - public List[] getInput() - { - if(this.inputSlot.get(1)!=null) - { - return new List[] {null, Arrays.asList(new ItemStack[] {this.inputSlot.get(0),this.inputSlot.get(1)})}; + public List[] getInput() { + if (this.inputSlot.get(1) != null) { + return new List[] { this.inputTank.getFluidList(), + Arrays.asList(new ItemStack[] { this.inputSlot.get(0), this.inputSlot.get(1) }) }; } - return new List[] {null, Arrays.asList(new ItemStack[] {this.inputSlot.get()})}; + return new List[] { this.inputTank.getFluidList(), Arrays.asList(new ItemStack[] { this.inputSlot.get() }) }; } - - public void operate() - { - List rinput = LeadOvenTileEntity.recipeManager.getRecipeInput(getInput()).getItemInputs(); - UniversalRecipeOutput routput = LeadOvenTileEntity.recipeManager.getOutputFor(getInput(), false, false); + + public void operate() { + UniversalRecipeInput rinput = LeadOvenTileEntity.recipeManager.getRecipeInput(getInput()); + List rinputItems = rinput.getItemInputs(); + UniversalRecipeOutput routput = LeadOvenTileEntity.recipeManager.getOutputFor(getInput()); List output2 = routput.getFluidOutputs(); - if(!output2.isEmpty()) - { - this.getFluidTank().fill(output2.get(0), true); + if (!output2.isEmpty()) { + this.outputTank.fill(output2.get(0), true); } + this.inputTank.drain(rinput.getFluidInputs(), true); List itemOutputs = routput.getItemOutputs(); - if(itemOutputs!=null && !itemOutputs.isEmpty()) - { + if (itemOutputs != null && !itemOutputs.isEmpty()) { this.outputSlot.add(itemOutputs); } - for(int i=0; i=rinput.get(i).getAmount()) - { - this.burnedFuel.stackSize-=rinput.get(i).getAmount(); - if(this.burnedFuel.stackSize<=0) - { - this.burnedFuel=null; - } - } - else - { - this.inputSlot.consume(i, rinput.get(i).getAmount()); - } - if(this.inputSlot.get(i)!=null && this.inputSlot.get(i).stackSize<=0) - { - this.inputSlot.put(i, null); - } + for (int i = 0; i < rinputItems.size(); i++) { + this.inputSlot.consume(rinputItems.get(i)); } - + } + @Override + public FluidStack drain(ForgeDirection from, int amount, boolean doDrain) { + switch (from) { + case UP: + return this.outputTank.drainLightest(amount, doDrain); + case NORTH: + return this.outputTank.drainLightest(amount, doDrain); + case SOUTH: + return this.outputTank.drainLightest(amount, doDrain); + case WEST: + return this.outputTank.drainLightest(amount, doDrain); + case EAST: + return this.outputTank.drainLightest(amount, doDrain); + case DOWN: + return this.outputTank.drain(amount, doDrain); + default: + return this.outputTank.drain(amount, doDrain); + } + } + + // 1.7.10 API @Override public boolean canDrain(ForgeDirection arg0, Fluid arg1) { - return false; + return true; } @Override - public boolean canFill(ForgeDirection arg0, Fluid arg1) { - return false; + public boolean canFill(ForgeDirection direction, Fluid arg1) { + return direction.equals(ForgeDirection.getOrientation(this.getFacing()).getOpposite()); } - public static void addRecipe(UniversalRecipeInput input, FluidStack fluidStackWithSize) - { - recipeManager.addRecipe(input, new UniversalRecipeOutput((new FluidStack[]{fluidStackWithSize}),null,20)); + public static void addRecipe(UniversalRecipeInput input, FluidStack fluidStackWithSize) { + recipeManager.addRecipe(input, new UniversalRecipeOutput((new FluidStack[] { fluidStackWithSize }), null, 20)); } public static Map getRecipes() { return recipeManager.getRecipes(); } - public static void addRecipe(ItemStack input, FluidStack fluidStackOutput, ItemStack output) { - recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack[] {input})),new UniversalRecipeOutput((new FluidStack[] {fluidStackOutput}),(new ItemStack[] {output}),20)); + public static void addRecipe(IRecipeInput recipeInputOreDict, FluidStack fluidStackOutput, ItemStack output) { + recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] { recipeInputOreDict })), + new UniversalRecipeOutput((new FluidStack[] { fluidStackOutput }), (new ItemStack[] { output }), 20)); + } + + public static void addRecipe(IRecipeInput input, ItemStack output) { + recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] { input })), + new UniversalRecipeOutput(null, (new ItemStack[] { output }), 20)); + } + + @Override + public FluidStack drain(ForgeDirection arg0, FluidStack fluidStack, boolean doDrain) { + if (outputTank.getFluid() != null && outputTank.getFluid().containsFluid(fluidStack)) { + return this.outputTank.drain(fluidStack, doDrain); + } + return null; } - public static void addRecipe(ItemStack input, ItemStack output) { - recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack[] {input})),new UniversalRecipeOutput(null,(new ItemStack[] {output}),20)); + @Override + public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) { + return this.inputTank.fill(arg1, arg2); + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection arg0) { + return new FluidTankInfo[] { this.inputTank.getInfo() }; } } \ No newline at end of file diff --git a/ihl/processing/chemistry/LoomTileEntity.java b/ihl/processing/chemistry/LoomTileEntity.java index e81680d..4ff9bc4 100644 --- a/ihl/processing/chemistry/LoomTileEntity.java +++ b/ihl/processing/chemistry/LoomTileEntity.java @@ -105,7 +105,7 @@ public class LoomTileEntity extends TileEntityInventory implements IHasGui, INet public void operate() { List input1 = LoomTileEntity.recipeManager.getRecipeInput(getInput()).getItemInputs(); - List output1 = LoomTileEntity.recipeManager.getOutputFor(getInput(), false, false).getItemOutputs(); + List output1 = LoomTileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs(); this.output.add(output1); if(input1.get(0) instanceof RecipeInputWire) { @@ -118,7 +118,7 @@ public class LoomTileEntity extends TileEntityInventory implements IHasGui, INet } else { - this.input.consume(0, input1.get(0).getAmount()); + this.input.consume(input1.get(0)); } } @@ -130,8 +130,8 @@ public class LoomTileEntity extends TileEntityInventory implements IHasGui, INet public boolean canOperate() { - if(LoomTileEntity.recipeManager.getOutputFor(getInput(), false, false)==null) return false; - List output1 = LoomTileEntity.recipeManager.getOutputFor(getInput(), false, false).getItemOutputs(); + if(LoomTileEntity.recipeManager.getOutputFor(getInput())==null) return false; + List output1 = LoomTileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs(); return this.output.canAdd(output1); } diff --git a/ihl/processing/chemistry/PaperMachineTileEntity.java b/ihl/processing/chemistry/PaperMachineTileEntity.java index 4784d38..eb28314 100644 --- a/ihl/processing/chemistry/PaperMachineTileEntity.java +++ b/ihl/processing/chemistry/PaperMachineTileEntity.java @@ -171,7 +171,7 @@ public class PaperMachineTileEntity extends BasicElectricMotorTileEntity impleme public UniversalRecipeOutput getOutput() { - return PaperMachineTileEntity.recipeManager.getOutputFor(this.getInput(), false, false); + return PaperMachineTileEntity.recipeManager.getOutputFor(this.getInput()); } @Override diff --git a/ihl/processing/chemistry/PrecipitatorCondenserModel.java b/ihl/processing/chemistry/PrecipitatorCondenserModel.java deleted file mode 100644 index dd6f15a..0000000 --- a/ihl/processing/chemistry/PrecipitatorCondenserModel.java +++ /dev/null @@ -1,110 +0,0 @@ -package ihl.processing.chemistry; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; - -public class PrecipitatorCondenserModel extends ModelBase -{ - //fields - ModelRenderer Base; - - public PrecipitatorCondenserModel() - { - textureWidth = 64; - textureHeight = 32; - setTextureOffset("Base.Shape1", 22, 0); - setTextureOffset("Base.Shape2", 22, 17); - setTextureOffset("Base.Shape4", 30, 16); - setTextureOffset("Base.Shape3", 30, 15); - setTextureOffset("Base.Shape6", 30, 2); - setTextureOffset("Base.Shape7", 20, 0); - setTextureOffset("Base.Shape8", 50, 0); - setTextureOffset("Base.Shape9", 0, 0); - setTextureOffset("Base.Shape10", 24, 0); - setTextureOffset("Base.Shape11", 0, 0); - setTextureOffset("Base.Shape12", 0, 0); - setTextureOffset("Base.Shape13", 0, 0); - setTextureOffset("Base.Shape14", 0, 0); - setTextureOffset("Base.Shape15", 0, 0); - setTextureOffset("Base.Shape16", 0, 0); - setTextureOffset("Base.Shape17", 0, 0); - setTextureOffset("Base.Shape18", 0, 0); - setTextureOffset("Base.Shape19", 0, 0); - setTextureOffset("Base.Shape20", 0, 0); - setTextureOffset("Base.Shape21", 0, 0); - setTextureOffset("Base.Shape25", 0, 1); - setTextureOffset("Base.Shape26", 12, 24); - setTextureOffset("Base.Shape27", 0, 0); - setTextureOffset("Base.Shape28", 0, 18); - setTextureOffset("Base.Shape29", 21, 0); - setTextureOffset("Base.Shape30", 0, 0); - setTextureOffset("Base.Shape31", 0, 0); - setTextureOffset("Base.Shape32", 0, 0); - setTextureOffset("Base.Shape33", 0, 0); - setTextureOffset("Base.Shape34", 0, 0); - setTextureOffset("Base.Shape35", 0, 0); - setTextureOffset("Base.Shape36", 0, 0); - setTextureOffset("Base.Shape37", 0, 0); - setTextureOffset("Base.Shape38", 0, 0); - setTextureOffset("Base.Shape39", 0, 0); - setTextureOffset("Base.Shape40", 0, 0); - setTextureOffset("Base.Shape5", 0, 0); - setTextureOffset("Base.Shape23", 31, 0); - setTextureOffset("Base.Shape24", 10, 0); - setTextureOffset("Base.Shape41", 27, 26); - setTextureOffset("Base.Shape42", 0, 0); - setTextureOffset("Base.Shape43", 0, 0); - setTextureOffset("Base.Shape44", 0, 0); - setTextureOffset("Base.Shape45", 0, 0); - setTextureOffset("Base.Shape46", 0, 0); - - Base = new ModelRenderer(this, "Base"); - Base.setRotationPoint(0F, 23F, 0F); - Base.mirror = true; - Base.addBox("Shape1", 6F, -15F, -7F, 1, 12, 14); - Base.addBox("Shape2", -7F, -3F, -8F, 14, 3, 1); - Base.addBox("Shape4", 6F, -15F, -8F, 1, 12, 1); - Base.addBox("Shape3", -7F, -3F, 7F, 14, 3, 1); - Base.addBox("Shape6", -7F, -15F, 7F, 1, 12, 1); - Base.addBox("Shape7", -7F, -15F, -7F, 1, 15, 14); - Base.addBox("Shape8", -7F, -15F, -8F, 1, 12, 1); - Base.addBox("Shape9", 1F, 0F, -8F, 6, 1, 16); - Base.addBox("Shape10", 6F, -15F, 7F, 1, 12, 1); - Base.addBox("Shape11", -4F, -13F, 3F, 1, 12, 3); - Base.addBox("Shape12", 4F, -2F, -1F, 2, 1, 3); - Base.addBox("Shape13", 3F, -13F, -1F, 1, 12, 3); - Base.addBox("Shape14", -3F, -13F, 5F, 9, 12, 1); - Base.addBox("Shape15", -6F, -2F, -2F, 12, 1, 1); - Base.addBox("Shape16", -4F, -13F, -5F, 1, 12, 3); - Base.addBox("Shape17", -6F, -2F, 6F, 12, 1, 1); - Base.addBox("Shape18", -6F, -2F, -7F, 12, 1, 2); - Base.addBox("Shape19", -6F, -2F, -5F, 2, 1, 3); - Base.addBox("Shape20", -6F, -2F, 2F, 12, 1, 1); - Base.addBox("Shape21", -6F, -2F, 3F, 2, 1, 3); - Base.addBox("Shape25", -6F, -15F, 7F, 12, 3, 1); - Base.addBox("Shape26", -6F, -15F, -8F, 12, 3, 1); - Base.addBox("Shape27", -8F, 0F, -8F, 7, 1, 16); - Base.addBox("Shape28", -1F, 0F, 1F, 2, 1, 7); - Base.addBox("Shape29", -1F, 0F, -8F, 2, 1, 7); - Base.addBox("Shape30", -3F, -13F, 3F, 9, 12, 1); - Base.addBox("Shape31", -6F, -13F, 1F, 9, 12, 1); - Base.addBox("Shape32", -6F, -13F, -1F, 9, 12, 1); - Base.addBox("Shape33", -3F, -13F, -3F, 9, 12, 1); - Base.addBox("Shape34", -3F, -13F, -5F, 9, 12, 1); - Base.addBox("Shape35", -6F, -13F, -7F, 12, 1, 2); - Base.addBox("Shape36", -6F, -13F, -2F, 12, 1, 1); - Base.addBox("Shape37", -6F, -13F, 2F, 12, 1, 1); - Base.addBox("Shape38", -6F, -13F, 6F, 12, 1, 1); - Base.addBox("Shape39", -6F, -13F, -5F, 2, 1, 3); - Base.addBox("Shape40", -6F, -13F, 3F, 2, 1, 3); - Base.addBox("Shape5", 4F, -13F, -1F, 2, 1, 3); - Base.addBox("Shape23", 6F, -2F, -7F, 1, 2, 14); - Base.addBox("Shape24", 6F, -3F, 3F, 1, 1, 4); - Base.addBox("Shape41", 6F, -3F, -7F, 1, 1, 5); - Base.addBox("Shape42", 7F, -4F, -2F, 4, 1, 5); - Base.addBox("Shape43", 8F, 0F, -2F, 1, 1, 5); - Base.addBox("Shape44", 10F, -3F, -2F, 1, 4, 5); - Base.addBox("Shape45", 7F, -4F, 3F, 4, 5, 1); - Base.addBox("Shape46", 7F, -4F, -3F, 4, 5, 1); - } -} diff --git a/ihl/processing/chemistry/PrecipitatorCondenserRender.java b/ihl/processing/chemistry/PrecipitatorCondenserRender.java deleted file mode 100644 index ae68bbf..0000000 --- a/ihl/processing/chemistry/PrecipitatorCondenserRender.java +++ /dev/null @@ -1,50 +0,0 @@ -package ihl.processing.chemistry; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import ihl.IHLModInfo; - -public class PrecipitatorCondenserRender extends TileEntitySpecialRenderer{ -private PrecipitatorCondenserModel model = new PrecipitatorCondenserModel(); -private ResourceLocation tex = new ResourceLocation(IHLModInfo.MODID+":textures/blocks/porcelainBox.png"); - -public PrecipitatorCondenserRender(){} - -public void renderAModelAt(PrecipitatorCondenserTileEntity tile, double d, double d1, double d2, float f) { - int rotation = 0; - if(tile.getWorldObj() != null) - { - switch (tile.getFacing()) - { - case 2: - rotation = 0; - break; - case 5: - rotation = 1; - break; - case 3: - rotation = 2; - break; - case 4: - rotation = 3; - break; - default: - rotation = 0; - } - } - bindTexture(tex); //texture - GL11.glPushMatrix(); - GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F); - GL11.glScalef(1.0F, -1F, -1F); - GL11.glRotatef(rotation*90, 0.0F, 1.0F, 0.0F); - model.Base.render(1.0F/16.0F); - GL11.glPopMatrix(); //end -} - - @Override - public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8) - { - this.renderAModelAt((PrecipitatorCondenserTileEntity)par1TileEntity, par2, par4, par6, par8); - } -} \ No newline at end of file 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