diff options
| author | Foghrye4 <foghrye4@gmail.com> | 2017-03-21 17:34:07 +0300 |
|---|---|---|
| committer | Foghrye4 <foghrye4@gmail.com> | 2017-03-21 17:34:07 +0300 |
| commit | 7305ba719930ea3fbf8aa987aeec48b33cdbd82e (patch) | |
| tree | 2307517925d965cd9228c8649013b07639987846 /ihl/processing | |
| parent | 5cb4c6e24033cf337812390d99a6817d24d21eab (diff) | |
Oregen
Diffstat (limited to 'ihl/processing')
42 files changed, 525 insertions, 1841 deletions
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<ItemStack> getItemStackList()
- {
+
+ public List<ItemStack> getItemStackList() {
List<ItemStack> list = new ArrayList<ItemStack>();
- for(int i=0; i<this.size(); i++)
- {
- if(get(i)!=null)
- {
+ for (int i = 0; i < this.size(); i++) {
+ if (get(i) != null) {
list.add(get(i));
}
}
return list;
}
-
+
public ItemStack getItemStack(Item item) {
- for(int i=0; i<this.size(); i++)
- {
- if(get(i)!=null && get(i).getItem()==item)
- {
+ for (int i = 0; i < this.size(); i++) {
+ if (get(i) != null && get(i).getItem() == item) {
return get(i);
}
}
return null;
}
- public void replaceItemStack(ItemStack stack1)
- {
- for(int i=0; i<this.size(); i++)
- {
- if(this.get(i)!=null && this.get(i).getItem()==stack1.getItem())
- {
- this.put(i,stack1);
+ public void replaceItemStack(ItemStack stack1) {
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) != null && this.get(i).getItem() == stack1.getItem()) {
+ this.put(i, stack1);
}
}
}
- public void consume(int i, int stackSize1)
- {
- if(this.get(i)==null)return;
- if(this.get(i).stackSize==stackSize1)
- {
- this.put(i, null);
- }
- else
- {
- this.get(i).stackSize-=stackSize1;
+ public void consume(IRecipeInput iRecipeInput) {
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) != null && iRecipeInput.matches(this.get(i))) {
+ this.get(i).stackSize -= iRecipeInput.getAmount();
+ if (this.get(i).stackSize <= 0) {
+ this.put(i, null);
+ return;
+ }
+ }
}
}
diff --git a/ihl/processing/chemistry/ChemicalReactorTileEntity.java b/ihl/processing/chemistry/ChemicalReactorTileEntity.java index ea3427c..2dfe31e 100644 --- a/ihl/processing/chemistry/ChemicalReactorTileEntity.java +++ b/ihl/processing/chemistry/ChemicalReactorTileEntity.java @@ -190,7 +190,7 @@ public class ChemicalReactorTileEntity extends BasicElectricMotorTileEntity impl @SuppressWarnings("unchecked")
public UniversalRecipeOutput getOutput()
{
- return ChemicalReactorTileEntity.recipeManager.getOutputFor(this.getInput()[0],this.getInput()[1], false, false);
+ return ChemicalReactorTileEntity.recipeManager.getOutputFor(this.getInput()[0],this.getInput()[1]);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@@ -203,7 +203,7 @@ public class ChemicalReactorTileEntity extends BasicElectricMotorTileEntity impl {
if(i!=i1)
{
- if(ChemicalReactorTileEntity.recipeManager.getOutputFor(Arrays.asList(new FluidStack[]{fluidTank.getFluid(i),fluidTank.getFluid(i1)}), this.input.getItemStackList(), false, false)!=null)
+ if(ChemicalReactorTileEntity.recipeManager.getOutputFor(Arrays.asList(new FluidStack[]{fluidTank.getFluid(i),fluidTank.getFluid(i1)}), this.input.getItemStackList())!=null)
{
return new List[] {Arrays.asList(new FluidStack[]{fluidTank.getFluid(i),fluidTank.getFluid(i1)}), this.input.getItemStackList()};
}
@@ -221,7 +221,7 @@ public class ChemicalReactorTileEntity extends BasicElectricMotorTileEntity impl UniversalRecipeOutput output1 = getOutput();
for(int i=0; i<recipeInput.getItemInputs().size();i++)
{
- this.input.consume(i,recipeInput.getItemInputs().get(i).getAmount());
+ this.input.consume(recipeInput.getItemInputs().get(i));
}
if(output1.specialConditions)
{
diff --git a/ihl/processing/chemistry/CryogenicDistillerTileEntity.java b/ihl/processing/chemistry/CryogenicDistillerTileEntity.java index 1ed4e36..9bd11a3 100644 --- a/ihl/processing/chemistry/CryogenicDistillerTileEntity.java +++ b/ihl/processing/chemistry/CryogenicDistillerTileEntity.java @@ -3,7 +3,6 @@ package ihl.processing.chemistry; import java.util.Arrays;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import ic2.core.ContainerBase;
import ic2.core.block.invslot.InvSlot;
@@ -103,7 +102,7 @@ public class CryogenicDistillerTileEntity extends BasicElectricMotorTileEntity i }
public UniversalRecipeOutput getOutput() {
- return CryogenicDistillerTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return CryogenicDistillerTileEntity.recipeManager.getOutputFor(this.getInput());
}
@Override
diff --git a/ihl/processing/chemistry/ElectrolysisBathTileEntity.java b/ihl/processing/chemistry/ElectrolysisBathTileEntity.java index 5a7a215..f8fae63 100644 --- a/ihl/processing/chemistry/ElectrolysisBathTileEntity.java +++ b/ihl/processing/chemistry/ElectrolysisBathTileEntity.java @@ -194,7 +194,7 @@ public class ElectrolysisBathTileEntity extends FlexibleCableHolderBaseTileEntit public UniversalRecipeOutput getOutput()
{
- return ElectrolysisBathTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return ElectrolysisBathTileEntity.recipeManager.getOutputFor(this.getInput());
}
@SuppressWarnings("rawtypes")
@@ -203,7 +203,7 @@ public class ElectrolysisBathTileEntity extends FlexibleCableHolderBaseTileEntit for(int i=0;i<fluidTank.getNumberOfFluids();i++)
{
List[] rInput = new List[] {Arrays.asList(new FluidStack[]{fluidTank.getFluid(i)}), this.input.getItemStackList()};
- if(ElectrolysisBathTileEntity.recipeManager.getOutputFor(rInput, false, false)!=null)
+ if(ElectrolysisBathTileEntity.recipeManager.getOutputFor(rInput)!=null)
{
return rInput;
}
@@ -217,7 +217,7 @@ public class ElectrolysisBathTileEntity extends FlexibleCableHolderBaseTileEntit UniversalRecipeOutput output1 = getOutput();
for(int i=0; i<recipeInput.getItemInputs().size();i++)
{
- this.input.consume(i,recipeInput.getItemInputs().get(i).getAmount());
+ this.input.consume(recipeInput.getItemInputs().get(i));
}
this.fluidTank.fill(output1.getFluidOutputs(), true);
}
diff --git a/ihl/processing/chemistry/EvaporatorTileEntity.java b/ihl/processing/chemistry/EvaporatorTileEntity.java index 8160d63..dbdf2e1 100644 --- a/ihl/processing/chemistry/EvaporatorTileEntity.java +++ b/ihl/processing/chemistry/EvaporatorTileEntity.java @@ -196,7 +196,7 @@ public class EvaporatorTileEntity extends TileEntityLiquidTankInventory implemen }
else
{
- UniversalRecipeOutput output = recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null, false, false);
+ UniversalRecipeOutput output = recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null);
return output == null ? false : (this.outputSlot.canAdd(output.getItemOutputs()) ? true : false);
}
}
@@ -280,7 +280,7 @@ public class EvaporatorTileEntity extends TileEntityLiquidTankInventory implemen }
else
{
- UniversalRecipeOutput output = recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null, false, false);
+ UniversalRecipeOutput output = recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null);
return output == null ? null : (this.outputSlot.canAdd(output.getItemOutputs()) ? output : null);
}
}
diff --git a/ihl/processing/chemistry/FluidizedBedReactorContainer.java b/ihl/processing/chemistry/FluidizedBedReactorContainer.java index b2c7738..f1bdb3e 100644 --- a/ihl/processing/chemistry/FluidizedBedReactorContainer.java +++ b/ihl/processing/chemistry/FluidizedBedReactorContainer.java @@ -13,8 +13,7 @@ import net.minecraftforge.fluids.FluidStack; public class FluidizedBedReactorContainer extends ContainerBase<FluidizedBedReactorTileEntity> {
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 ContainerBase<FluidizedBedReac for (int i = 0; i < this.crafters.size(); ++i)
{
ICrafting icrafting = (ICrafting)this.crafters.get(i);
- if (this.tileEntity.getTankAmount() != this.lastFluidAmount || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids)
+ if (fluidTankFluidList.hashCode() != this.lastFluidsHash)
{
IC2.network.get().sendContainerField(this, "fluidTankFluidList");
}
@@ -71,8 +70,7 @@ public class FluidizedBedReactorContainer extends ContainerBase<FluidizedBedReac icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
}
}
- this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
- this.lastFluidAmount = this.tileEntity.getTankAmount();
+ this.lastFluidsHash = fluidTankFluidList.hashCode();
this.lastProgress = this.tileEntity.progress;
this.lastTemperature = this.tileEntity.temperature;
this.lastEnergy = (short) this.tileEntity.energy;
diff --git a/ihl/processing/chemistry/FluidizedBedReactorTileEntity.java b/ihl/processing/chemistry/FluidizedBedReactorTileEntity.java index 0e279b5..2d8c288 100644 --- a/ihl/processing/chemistry/FluidizedBedReactorTileEntity.java +++ b/ihl/processing/chemistry/FluidizedBedReactorTileEntity.java @@ -178,7 +178,7 @@ public class FluidizedBedReactorTileEntity extends BasicElectricMotorTileEntity public UniversalRecipeOutput getOutput()
{
- return FluidizedBedReactorTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return FluidizedBedReactorTileEntity.recipeManager.getOutputFor(this.getInput());
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@@ -192,7 +192,7 @@ public class FluidizedBedReactorTileEntity extends BasicElectricMotorTileEntity if(i!=i1)
{
List[] rInput = new List[] {Arrays.asList(new FluidStack[]{fluidTank.getFluid(i),fluidTank.getFluid(i1)}), this.input.getItemStackList()};
- if(FluidizedBedReactorTileEntity.recipeManager.getOutputFor(rInput, false, false)!=null)
+ if(FluidizedBedReactorTileEntity.recipeManager.getOutputFor(rInput)!=null)
{
return rInput;
}
@@ -208,7 +208,7 @@ public class FluidizedBedReactorTileEntity extends BasicElectricMotorTileEntity UniversalRecipeInput recipeInput = FluidizedBedReactorTileEntity.recipeManager.getRecipeInput(getInput());
UniversalRecipeOutput output1 = getOutput();
this.fluidTank.drain(recipeInput.getFluidInputs(), true);
- this.input.consume(0, recipeInput.getItemInputs().get(0).getAmount());
+ this.input.consume(recipeInput.getItemInputs().get(0));
if(recipeInput.getItemInputs().get(0).getAmount()==0)
{
ItemStack stack = this.input.get();
@@ -219,10 +219,10 @@ public class FluidizedBedReactorTileEntity extends BasicElectricMotorTileEntity stack.stackTagCompound.setInteger("catalyst_uses",stack.stackTagCompound.getInteger("catalyst_uses")+1);
if(stack.stackTagCompound.getInteger("catalyst_uses")>1000)
{
- 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<String> getNetworkedFields()
- {
- List<String> fields = new ArrayList<String>();
- 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<FluidStack> 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()<IHLFluid.maxGaseousStateVapoursDensity)
- {
- return gasBuffer.fill(fluidStack, doFill);
- }
- else
- {
- return 0;
- }
- }
- else if(direction==ForgeDirection.DOWN)
- {
- if(fluidStack.getFluid().isGaseous() && fluidStack.getFluid().getDensity()<IHLFluid.maxGaseousStateVapoursDensity)
- {
- return fluidTank.fill(fluidStack, doFill);
- }
- else
- {
- return 0;
- }
- }
- else
- {
- return 0;
- }
- }
-
- @Override
- public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2)
- {
- return null;
- }
-
- @Override
- public FluidStack drain(ForgeDirection arg0, int arg1, boolean arg2)
- {
- return null;
- }
-
- @Override
- public FluidTankInfo[] getTankInfo(ForgeDirection arg0)
- {
- return new FluidTankInfo[]{this.fluidTank.getInfo(), this.gasBuffer.getInfo()};
- }
-
- public static void addRecipe(UniversalRecipeInput input, FluidStack fluidStackWithSize)
- {
- recipeManager.addRecipe(input, new UniversalRecipeOutput((new FluidStack[] {fluidStackWithSize}),null,20));
- }
-
- public UniversalRecipeOutput getOutput()
- {
- return GoldChimneyKneeTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
- }
-
- @SuppressWarnings("rawtypes")
- public List[] getInput()
- {
- return new List[] {Arrays.asList(new FluidStack[] {this.gasBuffer.getFluid(),this.fluidTank.getFluid()}),null};
- }
-
- public static Map<UniversalRecipeInput, UniversalRecipeOutput> 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<LeadOvenTileEntity> {
- 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<FluidStack> inputTankFluidList;
+ public List<FluidStack> 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<LeadOvenTileEntity> 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<LeadOvenTileEntity> 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<IRecipeInput> rinput = LeadOvenTileEntity.recipeManager.getRecipeInput(getInput()).getItemInputs();
- UniversalRecipeOutput routput = LeadOvenTileEntity.recipeManager.getOutputFor(getInput(), false, false);
+
+ public void operate() {
+ UniversalRecipeInput rinput = LeadOvenTileEntity.recipeManager.getRecipeInput(getInput());
+ List<IRecipeInput> rinputItems = rinput.getItemInputs();
+ UniversalRecipeOutput routput = LeadOvenTileEntity.recipeManager.getOutputFor(getInput());
List<FluidStack> 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<RecipeOutputItemStack> itemOutputs = routput.getItemOutputs();
- if(itemOutputs!=null && !itemOutputs.isEmpty())
- {
+ if (itemOutputs != null && !itemOutputs.isEmpty()) {
this.outputSlot.add(itemOutputs);
}
- for(int i=0; i<rinput.size();i++)
- {
- if(this.burnedFuel!=null && IHLUtils.isItemsHaveSameOreDictionaryEntry(this.fuelSlot.get(), burnedFuel) && this.burnedFuel.stackSize>=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<UniversalRecipeInput, UniversalRecipeOutput> 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<IRecipeInput> 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;i<this.gasBuffer.getNumberOfFluids();i++)
- {
- FluidStack fs1 = this.gasBuffer.getFluid(i);
- //System.out.println("#"+i+":"+fs1.getLocalizedName()+" amount "+fs1.amount);
- UniversalRecipeOutput rOutput1 = PrecipitatorCondenserTileEntity.recipeManager.getOutputFor(Arrays.asList(new FluidStack[]{fs1}),null, false, false);
- if(rOutput1==null)
- {
- this.gasBuffer.getFluidList().remove(i);
- //System.out.println("output is null");
- }
- else
- {
- //System.out.println("output is not null");
- rOutput=rOutput1;
- rInput = PrecipitatorCondenserTileEntity.recipeManager.getRecipeInput(Arrays.asList(new FluidStack[]{fs1}),null);
- fs=fs1;
- }
- }
- if(rOutput!=null)
- {
- this.gasBuffer.drain(fs, true);
- FluidStack outputFluid = rOutput.getFluidOutputs().get(0).copy();
- outputFluid.amount=amountOfGasCondensed/rInput.getFluidInputs().get(0).getAmount();
- this.fillCondensateOutputApparatus(ForgeDirection.UP, outputFluid, true);
- }
- amountOfGasCondensed=0;
- }
- if(this.gasBuffer.getFluidAmount()*3>this.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-20<temperatureOfCoolant)
- {
- return 0;
- }
- int L = amountOfGas;
- int t2 = boilingPointOfGas;
- int t1 = temperatureOfCoolant;
- int dt1=t2-t1;
- float maxQ=H*L*densityOfGas;
- int t1_1 = t1;
- for(int i=0;i<10;i++)
- {
- float Q2=H*L*densityOfGas;
- t1_1 = t1+(int)(Q2/fluidC/amountOfCoolant/densityOfCoolant);
- int dt2=t2-t1_1;
- float deltaT;
- if(dt1>2*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()<IHLFluid.maxGaseousStateVapoursDensity)
- {
- return gasBuffer.fill(fluidStack, doFill);
- }
- else
- {
- return this.fillCondensateOutputApparatus(ForgeDirection.UP, fluidStack, doFill);
- }
- }
- else if(direction==ForgeDirection.UP)
- {
- return fluidTank.fill(fluidStack, doFill);
- }
- }
- return 0;
- }
-
- private int fillCondensateOutputApparatus(ForgeDirection direction,FluidStack fluidStack, boolean doFill)
- {
- TileEntity te = worldObj.getTileEntity(xCoord+mLX(),yCoord-1, zCoord+mLZ());
- if(te instanceof IFluidHandler)
- {
- return ((IFluidHandler)te).fill(direction, fluidStack, doFill);
- }
- else
- {
- return 0;
- }
- }
-
- private int fillHeatTransferAgentOutputApparatus(ForgeDirection direction,FluidStack fluidStack, boolean doFill)
- {
- TileEntity te = worldObj.getTileEntity(xCoord,yCoord-1,zCoord);
- if(te instanceof IFluidHandler)
- {
- return ((IFluidHandler)te).fill(direction, fluidStack, doFill);
- }
- else
- {
- return 0;
- }
- }
-
-
- private int fillGaseousOutputApparatus(ForgeDirection direction,FluidStack fluidStack, boolean doFill)
- {
- TileEntity te = worldObj.getTileEntity(xCoord-direction.offsetX,yCoord, zCoord-direction.offsetZ);
- if(te instanceof IFluidHandler)
- {
- int amountFilled = ((IFluidHandler)te).fill(direction, fluidStack, doFill);
- return amountFilled;
- }
- else
- {
- return 0;
- }
- }
-
- public boolean gasCanPass(ForgeDirection direction)
- {
- switch(this.getFacing())
- {
- case 4:
- return direction == ForgeDirection.WEST || direction == ForgeDirection.EAST;
- case 5:
- return direction == ForgeDirection.WEST || direction == ForgeDirection.EAST;
- case 2:
- return direction == ForgeDirection.NORTH || direction == ForgeDirection.SOUTH;
- case 3:
- return direction == ForgeDirection.NORTH || direction == ForgeDirection.SOUTH;
- default:
- return direction == ForgeDirection.NORTH || direction == ForgeDirection.SOUTH;
- }
- }
-
- @Override
- public void setFacing(short facing1)
- {
- super.setFacing((short) Math.max(facing1, 2));
- }
-
- @Override
- public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
- return null;
- }
-
- @Override
- public FluidStack drain(ForgeDirection arg0, int arg1, boolean arg2) {
- return null;
- }
-
- @Override
- public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
- return new FluidTankInfo[]{this.fluidTank.getInfo(), this.gasBuffer.getInfo()};
- }
-
- public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes()
- {
- return recipeManager.getRecipes();
- }
-
- @Override
- public boolean shouldRenderInPass(int pass)
- {
- return pass==0;
- }
-}
\ No newline at end of file diff --git a/ihl/processing/invslots/IHLInvSlotOutput.java b/ihl/processing/invslots/IHLInvSlotOutput.java index 7e10ab3..d683221 100644 --- a/ihl/processing/invslots/IHLInvSlotOutput.java +++ b/ihl/processing/invslots/IHLInvSlotOutput.java @@ -16,114 +16,88 @@ import ic2.core.block.invslot.InvSlotOutput; import ihl.recipes.RecipeOutputItemStack;
import ihl.utils.IHLUtils;
-public class IHLInvSlotOutput extends InvSlotOutput{
+public class IHLInvSlotOutput extends InvSlotOutput {
+
+ private final Map<Long, Float> substanceAmount = new HashMap<Long, Float>();
- private final Map<Long,Float> substanceAmount = new HashMap<Long,Float>();
public IHLInvSlotOutput(TileEntityInventory base1, String name1, int oldStartIndex1, int count) {
super(base1, name1, oldStartIndex1, count);
}
@SuppressWarnings("rawtypes")
@Override
- public boolean canAdd(List itemOutputs)
- {
- if(itemOutputs==null || itemOutputs.isEmpty())
- {
+ public boolean canAdd(List itemOutputs) {
+ if (itemOutputs == null || itemOutputs.isEmpty()) {
return true;
}
Iterator ioi = itemOutputs.iterator();
- if(this.size()>=itemOutputs.size())
- {
+ if (this.size() >= itemOutputs.size()) {
Object rois;
- if(ioi.hasNext())
- {
+ if (ioi.hasNext()) {
rois = ioi.next();
- }
- else
- {
+ } else {
return true;
}
- for(int i=0;i<this.size();i++)
- {
- if(this.get(i)==null || (this.objectMatchesSlot(rois, i) && this.get(i).stackSize+this.getAmoutOfObject(rois)<this.getStackSizeLimit()))
- {
- if(ioi.hasNext())
- {
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) == null || (this.objectMatchesSlot(rois, i)
+ && this.get(i).stackSize + this.getAmoutOfObject(rois) < this.getStackSizeLimit()
+ && this.get(i).stackSize + this.getAmoutOfObject(rois) <= this.get(i).getMaxStackSize())) {
+ if (ioi.hasNext()) {
rois = ioi.next();
- }
- else
- {
+ } else {
return true;
}
- }
- else
- {
- if(i==this.size()-1)
- {
+ } else {
+ if (i == this.size() - 1) {
return false;
}
}
}
-
+
}
return false;
}
private float getAmoutOfObject(Object obj) {
- if(obj instanceof ItemStack)
- {
+ if (obj instanceof ItemStack) {
return ((ItemStack) obj).stackSize;
- }
- else if(obj instanceof RecipeOutputItemStack)
- {
- return ((RecipeOutputItemStack)obj).quantity;
+ } else if (obj instanceof RecipeOutputItemStack) {
+ return ((RecipeOutputItemStack) obj).quantity;
}
return Short.MAX_VALUE;
}
- public boolean objectMatchesSlot(Object obj, int slot)
- {
- if(this.get(slot)==null)
- {
+ public boolean objectMatchesSlot(Object obj, int slot) {
+ if (this.get(slot) == null) {
return true;
- }
- else
- {
- if(obj instanceof ItemStack)
- {
+ } else {
+ if (obj instanceof ItemStack) {
return IHLUtils.isItemStacksIsEqual(this.get(slot), (ItemStack) obj, true);
- }
- else if(obj instanceof RecipeOutputItemStack)
- {
- return ((RecipeOutputItemStack)obj).matches(this.get(slot));
+ } else if (obj instanceof RecipeOutputItemStack) {
+ return ((RecipeOutputItemStack) obj).matches(this.get(slot));
}
}
return false;
}
- public void add(RecipeOutputItemStack rois)
- {
- for(int i=0;i<this.size();i++)
- {
- if(this.get(i)==null || (this.objectMatchesSlot(rois, i) && this.get(i).stackSize+this.getAmoutOfObject(rois)<this.getStackSizeLimit()))
- {
+ public void add(RecipeOutputItemStack rois) {
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) == null || (this.objectMatchesSlot(rois, i)
+ && this.get(i).stackSize + this.getAmoutOfObject(rois) < this.getStackSizeLimit())) {
this.add(i, rois);
break;
}
}
}
- private void add(int i, RecipeOutputItemStack rois)
- {
- long key = (Item.getIdFromItem(rois.itemStack.getItem())<<32)+rois.itemStack.getItemDamage();
- float amount=0f;
- if(this.substanceAmount.containsKey(key))
- {
+ private void add(int i, RecipeOutputItemStack rois) {
+ long key = (Item.getIdFromItem(rois.itemStack.getItem()) << 32) + rois.itemStack.getItemDamage();
+ float amount = 0f;
+ if (this.substanceAmount.containsKey(key)) {
amount = this.substanceAmount.get(key);
}
- amount+=rois.quantity;
- while(amount>=1)
- {
+ amount += rois.quantity;
+ while (amount >= 1) {
amount--;
this.add(rois.itemStack.copy());
}
@@ -132,80 +106,62 @@ public class IHLInvSlotOutput extends InvSlotOutput{ @Override
@SuppressWarnings("rawtypes")
- public int add(List itemOutputs)
- {
- if(itemOutputs==null || itemOutputs.isEmpty())
- {
+ public int add(List itemOutputs) {
+ if (itemOutputs == null || itemOutputs.isEmpty()) {
return 0;
}
Iterator ioi = itemOutputs.iterator();
- if(this.size()>=itemOutputs.size() && ioi.hasNext())
- {
+ if (this.size() >= itemOutputs.size() && ioi.hasNext()) {
Object rois = ioi.next();
- for(int i=0;i<this.size();i++)
- {
- if(this.get(i)==null || (this.objectMatchesSlot(rois, i) && this.get(i).stackSize+this.getAmoutOfObject(rois)<this.getStackSizeLimit()))
- {
- if(rois instanceof ItemStack)
- {
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) == null || (this.objectMatchesSlot(rois, i)
+ && this.get(i).stackSize + this.getAmoutOfObject(rois) < this.getStackSizeLimit())) {
+ if (rois instanceof ItemStack) {
this.add(((ItemStack) rois).copy());
- }
- else if(rois instanceof RecipeOutputItemStack)
- {
+ } else if (rois instanceof RecipeOutputItemStack) {
this.add(i, (RecipeOutputItemStack) rois);
}
- if(ioi.hasNext())
- {
+ if (ioi.hasNext()) {
rois = ioi.next();
- }
- else
- {
+ } else {
return itemOutputs.size();
}
- }
- else
- {
- if(i==this.size()-1)
- {
+ } else {
+ if (i == this.size() - 1) {
return 0;
}
}
}
-
+
}
return 0;
}
-
+
@Override
- public void readFromNbt(NBTTagCompound nbtTagCompound)
- {
+ public void readFromNbt(NBTTagCompound nbtTagCompound) {
super.readFromNbt(nbtTagCompound);
NBTTagList amountTagList = nbtTagCompound.getTagList("substanceAmountMap", 10);
- for(int i=0;i<amountTagList.tagCount();i++)
- {
- if(amountTagList.getCompoundTagAt(i).hasKey("substanceKey"))
- {
- long substanceKey = amountTagList.getCompoundTagAt(i).getLong("substanceKey");
- float substanceAmount = amountTagList.getCompoundTagAt(i).getFloat("substanceAmount");
- this.substanceAmount.put(substanceKey, substanceAmount);
- }
- }
- }
-
+ for (int i = 0; i < amountTagList.tagCount(); i++) {
+ if (amountTagList.getCompoundTagAt(i).hasKey("substanceKey")) {
+ long substanceKey = amountTagList.getCompoundTagAt(i).getLong("substanceKey");
+ float substanceAmount = amountTagList.getCompoundTagAt(i).getFloat("substanceAmount");
+ this.substanceAmount.put(substanceKey, substanceAmount);
+ }
+ }
+ }
+
@Override
- public void writeToNbt(NBTTagCompound nbtTagCompound)
- {
+ public void writeToNbt(NBTTagCompound nbtTagCompound) {
super.writeToNbt(nbtTagCompound);
- NBTTagList sAmountsList = new NBTTagList();
- Iterator<Entry<Long, Float>> entrySetIterator = this.substanceAmount.entrySet().iterator();
- while(entrySetIterator.hasNext())
- {
- Entry<Long, Float> entry = entrySetIterator.next();
- NBTTagCompound tag = new NBTTagCompound();
- tag.setLong("substanceKey", entry.getKey());
- tag.setFloat("substanceAmount", entry.getValue());
- sAmountsList.appendTag(tag);
- }
- nbtTagCompound.setTag("substanceAmountMap", sAmountsList);
- }
+ NBTTagList sAmountsList = new NBTTagList();
+ Iterator<Entry<Long, Float>> entrySetIterator = this.substanceAmount.entrySet().iterator();
+ while (entrySetIterator.hasNext()) {
+ Entry<Long, Float> entry = entrySetIterator.next();
+ NBTTagCompound tag = new NBTTagCompound();
+ tag.setLong("substanceKey", entry.getKey());
+ tag.setFloat("substanceAmount", entry.getValue());
+ sAmountsList.appendTag(tag);
+ }
+ nbtTagCompound.setTag("substanceAmountMap", sAmountsList);
+ }
}
diff --git a/ihl/processing/invslots/SlotRedstoneConverterCableInvSlot.java b/ihl/processing/invslots/SlotRedstoneConverterCableInvSlot.java deleted file mode 100644 index 461c3cc..0000000 --- a/ihl/processing/invslots/SlotRedstoneConverterCableInvSlot.java +++ /dev/null @@ -1,23 +0,0 @@ -package ihl.processing.invslots;
-
-import net.minecraft.entity.player.EntityPlayer;
-import ic2.core.block.invslot.InvSlot;
-import ic2.core.slot.SlotInvSlot;
-
-public class SlotRedstoneConverterCableInvSlot extends SlotInvSlot {
-
- public InvSlot invSlot;
-
- public SlotRedstoneConverterCableInvSlot(InvSlot invSlot1, int index1,
- int xDisplayPosition1, int yDisplayPosition1) {
- super(invSlot1, index1, xDisplayPosition1, yDisplayPosition1);
- this.invSlot=invSlot1;
- }
-
- @Override
- public boolean canTakeStack(EntityPlayer player)
- {
- return false;
- }
-
-}
diff --git a/ihl/processing/metallurgy/AchesonFurnaceGui.java b/ihl/processing/metallurgy/AchesonFurnaceGui.java index 70e9d05..7665635 100644 --- a/ihl/processing/metallurgy/AchesonFurnaceGui.java +++ b/ihl/processing/metallurgy/AchesonFurnaceGui.java @@ -6,11 +6,10 @@ import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11;
public class AchesonFurnaceGui extends GuiContainer {
- protected static final ResourceLocation achesonFurnaceBackground = new ResourceLocation("ihl", "textures/gui/GUIAchesonFurnance.png");
+ protected static final ResourceLocation achesonFurnaceBackground = new ResourceLocation("ihl", "textures/gui/GUIAchesonFurnace.png");
private MachineBaseContainer container;
public AchesonFurnaceGui(MachineBaseContainer machineBaseContainer) {
- //the container is instanciated and passed to the superclass for handling
super(machineBaseContainer);
this.container=machineBaseContainer;
}
@@ -27,8 +26,8 @@ public class AchesonFurnaceGui extends GuiContainer { }
if (this.container.tileEntity.progress > 0)
{
- i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(50),50);
- this.drawTexturedModalRect(64, 63, 197, 0, i1 + 1, 13);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(17),17);
+ this.drawTexturedModalRect(70,34, 197, 0, i1 + 1, 13);
}
fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("ihl.gui.achesonFurnance"), 40, 12, 16768125);
}
diff --git a/ihl/processing/metallurgy/AchesonFurnanceContainer.java b/ihl/processing/metallurgy/AchesonFurnanceContainer.java index 140ec97..2580c6c 100644 --- a/ihl/processing/metallurgy/AchesonFurnanceContainer.java +++ b/ihl/processing/metallurgy/AchesonFurnanceContainer.java @@ -8,10 +8,9 @@ public class AchesonFurnanceContainer extends MachineBaseContainer { public AchesonFurnanceContainer(EntityPlayer entityPlayer,
AchesonFurnanceTileEntity tileEntity1) {
super(entityPlayer, tileEntity1);
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputElectrode, 0, 63, 40));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputElectrode, 1, 99, 40));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 81, 40));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 81, 22));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 40, 22));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 40, 40));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 98, 32));
}
}
diff --git a/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java b/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java index 5709cb9..1692e62 100644 --- a/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java +++ b/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java @@ -4,11 +4,9 @@ import java.util.List; import java.util.Map;
import ic2.api.recipe.IRecipeInput;
-import ic2.api.recipe.RecipeInputOreDict;
import ic2.core.ContainerBase;
-import ic2.core.block.invslot.InvSlot.Access;
import ihl.IHLMod;
-import ihl.processing.chemistry.ApparatusProcessableInvSlot;
+import ihl.processing.invslots.IHLInvSlotOutput;
import ihl.recipes.RecipeOutputItemStack;
import ihl.recipes.UniversalRecipeInput;
import ihl.recipes.UniversalRecipeManager;
@@ -22,15 +20,12 @@ import cpw.mods.fml.relauncher.SideOnly; public class AchesonFurnanceTileEntity extends MachineBaseTileEntity {
- public final ApparatusProcessableInvSlot inputElectrode;
- protected static UniversalRecipeManager recipeManager = new UniversalRecipeManager("achesonfurnace");
- private final RecipeInputOreDict[] validElectrodeTypes = new RecipeInputOreDict[] {
- new RecipeInputOreDict("stickCoal"), new RecipeInputOreDict("stickGraphite"),
- new RecipeInputOreDict("plateCoal"), new RecipeInputOreDict("plateGraphite") };
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("achesonfurnace");
+ public final IHLInvSlotOutput outputSlot;
public AchesonFurnanceTileEntity() {
super(2);
- inputElectrode = new ApparatusProcessableInvSlot(this, "inputElectrode", 1, Access.IO, 2, 1);
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 1);
}
public static void addRecipe(IRecipeInput input1, IRecipeInput input2, String output1) {
@@ -71,36 +66,23 @@ public class AchesonFurnanceTileEntity extends MachineBaseTileEntity { @Override
public void operate() {
- List<RecipeOutputItemStack> output = AchesonFurnanceTileEntity.recipeManager
- .getOutputFor(getInput(), true, true).getItemOutputs();
- for (int i = 0; i < this.inputElectrode.size(); i++) {
- ItemStack electrodeIS = this.inputElectrode.get(i);
- if (this.validElectrodeTypes[0].matches(electrodeIS)) {
- this.inputElectrode.put(i, IHLUtils.getThisModItemStack("stickGraphite"));
- } else if (this.validElectrodeTypes[2].matches(electrodeIS)) {
- this.inputElectrode.put(i, IHLUtils.getThisModItemStack("plateGraphite"));
- }
- }
- for (int i = 0; i < this.input.size(); i++) {
- if (output.size() > i) {
- ItemStack stack = output.get(i).itemStack.copy();
- stack.stackSize = Math.round(output.get(i).quantity);
- this.input.put(i, stack);
- }
- if (this.input.get(i) != null && this.input.get(i).stackSize <= 0) {
- this.input.put(i, null);
- }
- }
ItemStack crucible = input.getItemStack(IHLMod.crucible);
if (crucible != null) {
((Crucible) crucible.getItem()).processContent(crucible, this);
+ return;
+ }
+ List<RecipeOutputItemStack> output = recipeManager
+ .getOutputFor(getInput()).getItemOutputs();
+ List<IRecipeInput> rinput = recipeManager.getRecipeInput(getInput()).getItemInputs();
+ for (int i = 0; i < rinput.size(); i++) {
+ this.input.consume(rinput.get(i));
}
+ this.outputSlot.add(output);
}
@Override
public boolean canOperate() {
- return this.isValidElectrode(this.inputElectrode.get(0)) && this.isValidElectrode(this.inputElectrode.get(1))
- && this.getOutput() != null;
+ return this.getOutput() != null;
}
@Override
@@ -114,17 +96,6 @@ public class AchesonFurnanceTileEntity extends MachineBaseTileEntity { @Override
public UniversalRecipeOutput getOutput() {
- return AchesonFurnanceTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
- }
-
- private boolean isValidElectrode(ItemStack stack) {
- if (stack != null) {
- for (int i = 0; i < this.validElectrodeTypes.length; i++) {
- if (validElectrodeTypes[i].matches(stack)) {
- return true;
- }
- }
- }
- return false;
+ return AchesonFurnanceTileEntity.recipeManager.getOutputFor(this.getInput());
}
}
diff --git a/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java b/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java index a2fa219..7f82532 100644 --- a/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java +++ b/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java @@ -11,6 +11,7 @@ import ic2.core.IC2; import ic2.core.IHasGui;
import ic2.core.block.invslot.InvSlot;
import ic2.core.block.invslot.InvSlot.Access;
+import ihl.IHLMod;
import ihl.flexible_cable.FlexibleCableHolderBaseTileEntity;
import ihl.flexible_cable.NodeEntity;
import ihl.utils.IHLInvSlotDischarge;
@@ -34,6 +35,7 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa public BasicElectricMotorTileEntity() {
super();
+ energyConsume = IHLMod.config.machineryEnergyConsume/100d;
dischargeSlot = new IHLInvSlotDischarge(this, 1, Access.IO, 4, InvSlot.InvSide.BOTTOM);
}
diff --git a/ihl/processing/metallurgy/BigMachineFrameTileEntity.java b/ihl/processing/metallurgy/BigMachineFrameTileEntity.java deleted file mode 100644 index 0922355..0000000 --- a/ihl/processing/metallurgy/BigMachineFrameTileEntity.java +++ /dev/null @@ -1,109 +0,0 @@ -package ihl.processing.metallurgy;
-
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraft.tileentity.TileEntity;
-import ihl.interfaces.IWorkspaceElement;
-import ihl.utils.IHLUtils;
-
-public class BigMachineFrameTileEntity extends TileEntity implements IWorkspaceElement {
-
- @Override
- public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
- {
- return false;
- }
-
- @Override
- public short getFacing()
- {
- return 0;
- }
-
- @Override
- public void setFacing(short facing) {}
-
- @Override
- public boolean wrenchCanRemove(EntityPlayer entityPlayer)
- {
- return true;
- }
-
- @Override
- public float getWrenchDropRate()
- {
- return 1.0f;
- }
-
- @Override
- public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
- {
- return IHLUtils.getThisModItemStack("frameSteel");
- }
-
- @Override
- public boolean canBeUsed()
- {
- int ix,iy,iz;
- int x = xCoord;
- int y = yCoord;
- int z = zCoord;
- int x0 = xCoord;
- int y0 = yCoord;
- int z0 = zCoord;
- for(ix=x;ix>x-3;ix--)
- {
- for(iy=y;iy>y-3;iy--)
- {
- for(iz=z;iz>z-3;iz--)
- {
- TileEntity te = worldObj.getTileEntity(ix, iy, iz);
- if(te instanceof BigMachineFrameTileEntity)
- {
- x0=ix+1;
- y0=iy+1;
- z0=iz+1;
- }
- }
- }
- }
- for(ix=x0-1;ix<x0+1;ix++)
- {
- for(iy=y0-1;iy<y0+1;iy++)
- {
- for(iz=z0-1;iz<z0+1;iz++)
- {
- if(ix!=x0 && iy!=y0 && iz!=z0)
- {
- TileEntity te = worldObj.getTileEntity(ix, iy, iz);
- if(!(te instanceof BigMachineFrameTileEntity))
- {
- return false;
- }
- }
- else
- {
- Block block = worldObj.getBlock(ix, iy, iz);
- if(block!=Blocks.air && !block.isAir(worldObj, ix, iy, iz))
- {
- return false;
- }
- }
- }
- }
- }
- return true;
- }
-
- @Override
- public void use() {}
-
- @Override
- public boolean getIsInvalid()
- {
- return this.isInvalid();
- }
-
-}
diff --git a/ihl/processing/metallurgy/Crucible.java b/ihl/processing/metallurgy/Crucible.java index 3f14f48..77f10a4 100644 --- a/ihl/processing/metallurgy/Crucible.java +++ b/ihl/processing/metallurgy/Crucible.java @@ -148,7 +148,7 @@ public class Crucible extends Item implements IHandHeldInventory, IFluidContaine ItemStack content = inventory.getStackInSlot(0);
if(content!=null)
{
- UniversalRecipeOutput routput = recipeManager.getOutputFor(null, Arrays.asList(new ItemStack [] {content}),false, false);
+ UniversalRecipeOutput routput = recipeManager.getOutputFor(null, Arrays.asList(new ItemStack [] {content}));
if(routput!=null && !routput.getFluidOutputs().isEmpty())
{
FluidStack fluidStack = routput.getFluidOutputs().get(0).copy();
diff --git a/ihl/processing/metallurgy/DetonationSprayingMachineTileEntity.java b/ihl/processing/metallurgy/DetonationSprayingMachineTileEntity.java index f9d2cb6..ce594ed 100644 --- a/ihl/processing/metallurgy/DetonationSprayingMachineTileEntity.java +++ b/ihl/processing/metallurgy/DetonationSprayingMachineTileEntity.java @@ -1,7 +1,5 @@ package ihl.processing.metallurgy;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
import cpw.mods.fml.relauncher.Side;
@@ -102,7 +100,7 @@ public class DetonationSprayingMachineTileEntity extends TileEntityInventory imp public UniversalRecipeOutput getOutput()
{
- return DetonationSprayingMachineTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return DetonationSprayingMachineTileEntity.recipeManager.getOutputFor(this.getInput());
}
public List<?>[] getInput()
@@ -126,7 +124,8 @@ public class DetonationSprayingMachineTileEntity extends TileEntityInventory imp //file tags - "GT.ToolStats"->"MaxDamage" & "Damage"
if(this.canOperate())
{
- List<RecipeOutputItemStack> output1 = DetonationSprayingMachineTileEntity.recipeManager.getOutputFor(getInput(), false, false).getItemOutputs();
+ List<IRecipeInput> input1 = DetonationSprayingMachineTileEntity.recipeManager.getRecipeInput(getInput()).getItemInputs();
+ List<RecipeOutputItemStack> output1 = DetonationSprayingMachineTileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs();
ItemStack resultStack = output1.get(0).itemStack.copy();
resultStack.stackSize=this.input.get(0).stackSize;
if(resultStack.stackTagCompound==null)
@@ -162,9 +161,10 @@ public class DetonationSprayingMachineTileEntity extends TileEntityInventory imp }
}
}
+ for(IRecipeInput stack:input1){
+ this.input.consume(stack);
+ }
this.input.put(0,resultStack);
- this.input.consume(1,1);
- this.input.consume(2,1);
ExplosionIC2 explosion = new ExplosionIC2(worldObj, null, this.xCoord+0.5D, this.yCoord+0.5D, this.zCoord+0.5D, 0.5F, 0.3F, ExplosionIC2.Type.Normal, null, 0);
explosion.doExplosion();
IC2.network.get().initiateTileEntityEvent(this, 0, true);
diff --git a/ihl/processing/metallurgy/ElectricEngineInvSlot.java b/ihl/processing/metallurgy/ElectricEngineInvSlot.java deleted file mode 100644 index c89c50f..0000000 --- a/ihl/processing/metallurgy/ElectricEngineInvSlot.java +++ /dev/null @@ -1,54 +0,0 @@ -package ihl.processing.metallurgy;
-
-import ic2.core.Ic2Items;
-import ic2.core.block.TileEntityInventory;
-import ic2.core.block.invslot.InvSlot;
-import net.minecraft.item.ItemStack;
-
-public class ElectricEngineInvSlot extends InvSlot {
-
- public ElectricEngineInvSlot(TileEntityInventory base1, String name1,
- int oldStartIndex1, Access access1, int count, int stackSizeLimit1) {
- super(base1, name1, oldStartIndex1, access1, count);
- this.setStackSizeLimit(stackSizeLimit1);
- }
-
- public float getEfficiency()
- {
- if(this.isEmpty())
- {
- return 0F;
- }
- else if(this.get().getItem() instanceof ElectricEngineItem)
- {
- return ((ElectricEngineItem)this.get().getItem()).type.efficiency;
- }
- else if(this.get().getItem() == Ic2Items.elemotor.getItem() && this.get().getItemDamage() == Ic2Items.elemotor.getItemDamage())
- {
- return 0.2f;
- }
- else
- {
- return 0f;
- }
- }
-
- @Override
- public boolean accepts(ItemStack stack)
- {
- if(stack!=null && stack.getItem() == Ic2Items.elemotor.getItem() && stack.getItemDamage() == Ic2Items.elemotor.getItemDamage())
- {
- return true;
- }
- else
- {
- return stack==null?true:stack.getItem() instanceof ElectricEngineItem;
- }
- }
-
- public boolean correctContent()
- {
- return this.get()==null?false:this.get().stackSize==1 && ((this.get().getItem() instanceof ElectricEngineItem) || (this.get().getItem() == Ic2Items.elemotor.getItem() && this.get().getItemDamage() == Ic2Items.elemotor.getItemDamage()));
- }
-
-}
diff --git a/ihl/processing/metallurgy/ExtruderTileEntity.java b/ihl/processing/metallurgy/ExtruderTileEntity.java index a654bfc..53447b4 100644 --- a/ihl/processing/metallurgy/ExtruderTileEntity.java +++ b/ihl/processing/metallurgy/ExtruderTileEntity.java @@ -89,13 +89,13 @@ public class ExtruderTileEntity extends BasicElectricMotorTileEntity{ {
UniversalRecipeInput ri = ExtruderTileEntity.recipeManager.getRecipeInput(getInput());
this.fluidTank.fill(getOutput().getFluidOutputs().get(0), true);
- this.input.consume(0,ri.getItemInputs().get(0).getAmount());
- this.input2.consume(0,ri.getItemInputs().get(1).getAmount());
+ this.input.consume(ri.getItemInputs().get(0));
+ this.input2.consume(ri.getItemInputs().get(1));
}
public UniversalRecipeOutput getOutput()
{
- return ExtruderTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return ExtruderTileEntity.recipeManager.getOutputFor(this.getInput());
}
@SuppressWarnings({ "unchecked", "rawtypes" })
diff --git a/ihl/processing/metallurgy/GasWeldingStationTileEntity.java b/ihl/processing/metallurgy/GasWeldingStationTileEntity.java index ff15f5a..54f4177 100644 --- a/ihl/processing/metallurgy/GasWeldingStationTileEntity.java +++ b/ihl/processing/metallurgy/GasWeldingStationTileEntity.java @@ -148,7 +148,7 @@ public class GasWeldingStationTileEntity extends TileEntityInventory implements public boolean canProduceGas()
{
- UniversalRecipeOutput rOutput = GasWeldingStationTileEntity.acetyleneRecipeManager.getOutputFor(Arrays.asList(new FluidStack[]{this.flammableGasTank.getFluid()}), Arrays.asList(new ItemStack[]{this.input.get()}), false, false);
+ UniversalRecipeOutput rOutput = GasWeldingStationTileEntity.acetyleneRecipeManager.getOutputFor(Arrays.asList(new FluidStack[]{this.flammableGasTank.getFluid()}), Arrays.asList(new ItemStack[]{this.input.get()}));
return rOutput!=null;
}
@@ -157,7 +157,7 @@ public class GasWeldingStationTileEntity extends TileEntityInventory implements if(canProduceGas())
{
UniversalRecipeInput rInput = GasWeldingStationTileEntity.acetyleneRecipeManager.getRecipeInput(Arrays.asList(new FluidStack[]{this.flammableGasTank.getFluid()}), Arrays.asList(new ItemStack[]{this.input.get()}));
- UniversalRecipeOutput rOutput = GasWeldingStationTileEntity.acetyleneRecipeManager.getOutputFor(Arrays.asList(new FluidStack[]{this.flammableGasTank.getFluid()}), Arrays.asList(new ItemStack[]{this.input.get()}), false, false);
+ UniversalRecipeOutput rOutput = GasWeldingStationTileEntity.acetyleneRecipeManager.getOutputFor(Arrays.asList(new FluidStack[]{this.flammableGasTank.getFluid()}), Arrays.asList(new ItemStack[]{this.input.get()}));
FluidStack output1 = rOutput.getFluidOutputs().get(0).copy();
FluidStack output2 = rOutput.getFluidOutputs().get(1).copy();
this.flammableGasTank.drain(rInput.getFluidInputs().get(0), true);
diff --git a/ihl/processing/metallurgy/ImpregnatingMachineTileEntity.java b/ihl/processing/metallurgy/ImpregnatingMachineTileEntity.java index 2ea5d2e..1a15f06 100644 --- a/ihl/processing/metallurgy/ImpregnatingMachineTileEntity.java +++ b/ihl/processing/metallurgy/ImpregnatingMachineTileEntity.java @@ -216,7 +216,7 @@ public class ImpregnatingMachineTileEntity extends TileEntityInventory implement public UniversalRecipeOutput getOutput()
{
- return ImpregnatingMachineTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return ImpregnatingMachineTileEntity.recipeManager.getOutputFor(this.getInput());
}
@SuppressWarnings("rawtypes")
@@ -229,7 +229,7 @@ public class ImpregnatingMachineTileEntity extends TileEntityInventory implement if(i!=i1)
{
List[] rInput = new List[]{Arrays.asList(new FluidStack[]{fluidTank.getFluid(i),fluidTank.getFluid(i1)}), this.input.getItemStackList()};
- if(ImpregnatingMachineTileEntity.recipeManager.getOutputFor(rInput, false, false)!=null)
+ if(ImpregnatingMachineTileEntity.recipeManager.getOutputFor(rInput)!=null)
{
return rInput;
}
@@ -245,7 +245,7 @@ public class ImpregnatingMachineTileEntity extends TileEntityInventory implement UniversalRecipeOutput output1 = getOutput();
for(int i=0; i<recipeInput.getItemInputs().size();i++)
{
- this.input.consume(i,recipeInput.getItemInputs().get(i).getAmount());
+ this.input.consume(recipeInput.getItemInputs().get(i));
}
this.fluidTank.drain(recipeInput.getFluidInputs(), true);
this.fluidTank.fill(output1.getFluidOutputs(), true);
diff --git a/ihl/processing/metallurgy/InjectionMoldTileEntity.java b/ihl/processing/metallurgy/InjectionMoldTileEntity.java index e87acd8..33689ba 100644 --- a/ihl/processing/metallurgy/InjectionMoldTileEntity.java +++ b/ihl/processing/metallurgy/InjectionMoldTileEntity.java @@ -82,24 +82,17 @@ public class InjectionMoldTileEntity extends TileEntity implements IFluidHandler ArrayList<ItemStack> resultList = OreDictionary.getOres(this.resultSuffix+formattedFluidName);
if(resultList.isEmpty() || fluidAmountPerItem<=0)
{
-// IHLMod.log.info("Injection mold: resultList.isEmpty() || fluidAmountPerItem<=0");
resultList=new ArrayList<ItemStack>();
List<FluidStack> fi = Arrays.asList(new FluidStack[] {this.fluidTank.getFluid()});
List<ItemStack> ii = Arrays.asList(new ItemStack[] {IHLUtils.getThisModItemStackWithDamage("injectionMold", this.resultSuffix.hashCode() & Integer.MAX_VALUE)});
- UniversalRecipeOutput ro = recipeManager.getOutputFor(fi, ii, false, false);
+ UniversalRecipeOutput ro = recipeManager.getOutputFor(fi, ii);
if(ro!=null)
{
- // IHLMod.log.info("Injection mold: ro not null");
ItemStack stack = ro.getItemOutputs().get(0).itemStack.copy();
stack.stackSize=Math.round(ro.getItemOutputs().get(0).quantity);
resultList.add(stack);
UniversalRecipeInput ri = recipeManager.getRecipeInput(fi, ii);
fluidAmountPerItem = ri.getFluidInputs().get(0).getAmount();
- // IHLMod.log.info("fluidAmountPerItem="+fluidAmountPerItem);
- }
- else
- {
- // IHLMod.log.info("Injection mold: ro is null. Input stack: "+ii.get(0).toString());
}
}
int fluidAmountPerItem2 = Details.getMeltingFluidAmount("nugget");
diff --git a/ihl/processing/metallurgy/MuffleFurnaceGui.java b/ihl/processing/metallurgy/MuffleFurnaceGui.java index ffd664d..bf0df24 100644 --- a/ihl/processing/metallurgy/MuffleFurnaceGui.java +++ b/ihl/processing/metallurgy/MuffleFurnaceGui.java @@ -6,7 +6,7 @@ import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11;
public class MuffleFurnaceGui extends GuiContainer {
- protected static final ResourceLocation muffleFurnaceBackground = new ResourceLocation("ihl", "textures/gui/GUIMuffleFurnace.png");
+ protected static final ResourceLocation muffleFurnaceBackground = new ResourceLocation("ihl", "textures/gui/GUIAchesonFurnace.png");
private MachineBaseContainer container;
public MuffleFurnaceGui(MachineBaseContainer machineBaseContainer) {
@@ -17,22 +17,18 @@ public class MuffleFurnaceGui extends GuiContainer { @Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
- int xOffset = (this.width - xSize) / 2;
- int yOffset = (this.height - ySize) / 2;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(muffleFurnaceBackground);
int i1;
if (this.container.tileEntity.getEnergy() > 0D)
{
i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
- this.drawTexturedModalRect(8, 14 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ this.drawTexturedModalRect(8, 6 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
}
if (this.container.tileEntity.progress > 0)
{
- i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(50),50);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- this.drawTexturedModalRect(44, 57, 197, 0, i1 + 1, 13);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(17),17);
+ this.drawTexturedModalRect(70,34, 197, 0, i1 + 1, 13);
}
fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("ihl.gui.muffleFurnace"), 40, 12, 16768125);
diff --git a/ihl/processing/metallurgy/MuffleFurnanceContainer.java b/ihl/processing/metallurgy/MuffleFurnanceContainer.java index a36ac3c..1ae7203 100644 --- a/ihl/processing/metallurgy/MuffleFurnanceContainer.java +++ b/ihl/processing/metallurgy/MuffleFurnanceContainer.java @@ -6,10 +6,11 @@ import net.minecraft.entity.player.EntityPlayer; public class MuffleFurnanceContainer extends MachineBaseContainer {
public MuffleFurnanceContainer(EntityPlayer entityPlayer,
- MachineBaseTileEntity tileEntity1) {
+ MuffleFurnanceTileEntity tileEntity1) {
super(entityPlayer, tileEntity1);
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 51, 34));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 69, 34));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 40, 22));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 40, 40));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 98, 32));
}
}
diff --git a/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java b/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java index 55db3db..3994bd7 100644 --- a/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java +++ b/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java @@ -3,8 +3,11 @@ package ihl.processing.metallurgy; import java.util.List;
import java.util.Map;
+import ic2.api.recipe.IRecipeInput;
+import ic2.api.recipe.RecipeInputOreDict;
import ic2.core.ContainerBase;
import ihl.IHLMod;
+import ihl.processing.invslots.IHLInvSlotOutput;
import ihl.recipes.RecipeOutputItemStack;
import ihl.recipes.UniversalRecipeInput;
import ihl.recipes.UniversalRecipeManager;
@@ -19,10 +22,11 @@ import cpw.mods.fml.relauncher.SideOnly; public class MuffleFurnanceTileEntity extends MachineBaseTileEntity {
protected static UniversalRecipeManager recipeManager = new UniversalRecipeManager("mufflefurnace");
+ public final IHLInvSlotOutput outputSlot;
public MuffleFurnanceTileEntity() {
super(2);
- this.input.setStackSizeLimit(32);
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 1);
}
@Override
@@ -81,27 +85,17 @@ public class MuffleFurnanceTileEntity extends MachineBaseTileEntity { mold.stackTagCompound.setBoolean("isContainStearin", false);
return;
}
- if (this.getOutput() != null) {
- UniversalRecipeOutput routput = recipeManager
- .getOutputFor(null, this.input.getItemStackList(), true, true);
- List<RecipeOutputItemStack> output = routput.getItemOutputs();
- for (int i = 0; i < this.input.size(); i++) {
- if (i < output.size() && output.get(i) != null) {
- ItemStack outStack = output.get(i).itemStack.copy();
- outStack.stackSize = Math.round(output.get(i).quantity);
- if (this.input.get(i) != null) {
- outStack.stackTagCompound = this.input.get(i).stackTagCompound;
- }
- this.input.put(i, outStack);
- }
- if (this.input.get(i) != null && this.input.get(i).stackSize <= 0)
- this.input.put(i, null);
- }
+ List<RecipeOutputItemStack> output = recipeManager
+ .getOutputFor(getInput()).getItemOutputs();
+ List<IRecipeInput> rinput = recipeManager.getRecipeInput(getInput()).getItemInputs();
+ for (int i = 0; i < rinput.size(); i++) {
+ this.input.consume(rinput.get(i));
}
+ this.outputSlot.add(output);
}
- public static void addRecipe(ItemStack input1, ItemStack output) {
- recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack[] { input1 })),
+ public static void addRecipe(IRecipeInput recipeInputOreDict, ItemStack output) {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] { recipeInputOreDict })),
new UniversalRecipeOutput(null, (new ItemStack[] { output }), 20));
}
@@ -111,7 +105,7 @@ public class MuffleFurnanceTileEntity extends MachineBaseTileEntity { @Override
public UniversalRecipeOutput getOutput() {
- return MuffleFurnanceTileEntity.recipeManager.getOutputFor(null, this.input.getItemStackList(), false, false);
+ return MuffleFurnanceTileEntity.recipeManager.getOutputFor(null, this.input.getItemStackList());
}
public static void addRecipe(UniversalRecipeInput universalRecipeInput,
@@ -119,8 +113,8 @@ public class MuffleFurnanceTileEntity extends MachineBaseTileEntity { recipeManager.addRecipe(universalRecipeInput, universalRecipeOutput);
}
- public static void addRecipe(ItemStack input1, ItemStack output, float f) {
- recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack[] { input1 })), new UniversalRecipeOutput(
+ public static void addRecipe(IRecipeInput recipeInputOreDict, ItemStack output, float f) {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] { recipeInputOreDict })), new UniversalRecipeOutput(
null, (new RecipeOutputItemStack[] { new RecipeOutputItemStack(output, f) }), 20));
}
}
diff --git a/ihl/processing/metallurgy/RollingMachinePart1TileEntity.java b/ihl/processing/metallurgy/RollingMachinePart1TileEntity.java index a3d6ae6..dc2d293 100644 --- a/ihl/processing/metallurgy/RollingMachinePart1TileEntity.java +++ b/ihl/processing/metallurgy/RollingMachinePart1TileEntity.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.List;
import java.util.Map;
+import ic2.api.recipe.IRecipeInput;
import ic2.core.ContainerBase;
import ic2.core.IC2;
import ic2.core.block.invslot.InvSlot.Access;
@@ -38,7 +39,7 @@ public class RollingMachinePart1TileEntity extends BasicElectricMotorTileEntity{ public UniversalRecipeOutput getOutput()
{
- return RollingMachinePart1TileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return RollingMachinePart1TileEntity.recipeManager.getOutputFor(this.getInput());
}
@Override
@@ -101,9 +102,10 @@ public class RollingMachinePart1TileEntity extends BasicElectricMotorTileEntity{ @Override
public void operate()
{
- List<RecipeOutputItemStack> output = RollingMachinePart1TileEntity.recipeManager.getOutputFor(getInput(), false, false).getItemOutputs();
+ List<IRecipeInput> rinput = recipeManager.getRecipeInput(getInput()).getItemInputs();
+ List<RecipeOutputItemStack> output = RollingMachinePart1TileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs();
this.output.add(output);
- this.input.consume(0, 1);
+ this.input.consume(rinput.get(0));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
diff --git a/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java b/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java index e052ad7..bb51ced 100644 --- a/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java +++ b/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java @@ -175,8 +175,7 @@ public class VulcanizationExtrudingMoldTileEntity extends TileEntity private ItemStack processWire(ItemStack wire, boolean doProcess) {
UniversalRecipeOutput rOutput = VulcanizationExtrudingMoldTileEntity.recipeManager.getOutputFor(
- Arrays.asList(new FluidStack[] { this.fluidTank.getFluid() }), Arrays.asList(new ItemStack[] { wire }),
- false, false);
+ Arrays.asList(new FluidStack[] { this.fluidTank.getFluid() }), Arrays.asList(new ItemStack[] { wire }));
if (rOutput == null || this.energy < this.energyConsume) {
return wire;
}
diff --git a/ihl/processing/metallurgy/WireMillTileEntity.java b/ihl/processing/metallurgy/WireMillTileEntity.java index 4216960..f69ea9a 100644 --- a/ihl/processing/metallurgy/WireMillTileEntity.java +++ b/ihl/processing/metallurgy/WireMillTileEntity.java @@ -124,7 +124,7 @@ public class WireMillTileEntity extends BasicElectricMotorTileEntity implements }
else
{
- dice.consume(0, 1);
+ dice.consume(rInputDice);
}
}
if(this.drainInputSlot.get()!=null && !rInput.getItemInputs().isEmpty() && rInput.getItemInputs().get(0).matches(this.drainInputSlot.get()))
@@ -157,7 +157,7 @@ public class WireMillTileEntity extends BasicElectricMotorTileEntity implements public UniversalRecipeOutput getOutput()
{
- return WireMillTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return WireMillTileEntity.recipeManager.getOutputFor(this.getInput());
}
public static void addRecipe(FluidStack moltenMetal, IRecipeInput inputDice,ItemStack output1)
diff --git a/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java b/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java index 5c786c5..4dd1f1c 100644 --- a/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java +++ b/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java @@ -40,7 +40,7 @@ public class WoodenRollingMachinePart1TileEntity extends BasicElectricMotorTileE public UniversalRecipeOutput getOutput()
{
- return WoodenRollingMachinePart1TileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return WoodenRollingMachinePart1TileEntity.recipeManager.getOutputFor(this.getInput());
}
@Override
@@ -104,11 +104,11 @@ public class WoodenRollingMachinePart1TileEntity extends BasicElectricMotorTileE public void operate()
{
List<IRecipeInput> rInput = WoodenRollingMachinePart1TileEntity.recipeManager.getRecipeInput(getInput()).getItemInputs();
- List<RecipeOutputItemStack> rOutput = WoodenRollingMachinePart1TileEntity.recipeManager.getOutputFor(getInput(), false, false).getItemOutputs();
+ List<RecipeOutputItemStack> rOutput = WoodenRollingMachinePart1TileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs();
this.output.add(rOutput);
for(int i=0;i<rInput.size();i++)
{
- this.input.consume(i, rInput.get(i).getAmount());
+ this.input.consume(rInput.get(i));
}
}
|
