summaryrefslogtreecommitdiff
path: root/ihl/processing
diff options
context:
space:
mode:
authorFoghrye4 <foghrye4@gmail.com>2017-04-14 07:58:16 +0300
committerFoghrye4 <foghrye4@gmail.com>2017-04-14 07:58:16 +0300
commitaa42aedecd2d2842351088085e8fd9d69ec79565 (patch)
tree94c888b3d362868f427980dd37765f9bb166dba9 /ihl/processing
parentfb29b09822057ae7b1b913993dc1fa3a67345eec (diff)
Colourful lights
Diffstat (limited to 'ihl/processing')
-rw-r--r--ihl/processing/chemistry/BasicElectricMotorContainer.java74
-rw-r--r--ihl/processing/chemistry/ChemicalReactorContainer.java114
-rw-r--r--ihl/processing/chemistry/CryogenicDistillerContainer.java60
-rw-r--r--ihl/processing/chemistry/CryogenicDistillerGui.java2
-rw-r--r--ihl/processing/chemistry/FluidizedBedReactorContainer.java68
-rw-r--r--ihl/processing/chemistry/FluidizedBedReactorGui.java88
-rw-r--r--ihl/processing/chemistry/LabElectrolyzerContainer.java162
-rw-r--r--ihl/processing/chemistry/LabElectrolyzerGui.java119
-rw-r--r--ihl/processing/chemistry/PaperMachineContainer.java70
-rw-r--r--ihl/processing/invslots/InvSlotUpgradeIHL.java61
-rw-r--r--ihl/processing/metallurgy/BasicElectricMotorTileEntity.java27
11 files changed, 346 insertions, 499 deletions
diff --git a/ihl/processing/chemistry/BasicElectricMotorContainer.java b/ihl/processing/chemistry/BasicElectricMotorContainer.java
new file mode 100644
index 0000000..a32e006
--- /dev/null
+++ b/ihl/processing/chemistry/BasicElectricMotorContainer.java
@@ -0,0 +1,74 @@
+package ihl.processing.chemistry;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import ihl.processing.metallurgy.BasicElectricMotorTileEntity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+
+public class BasicElectricMotorContainer<T extends BasicElectricMotorTileEntity> extends ContainerBase<T> {
+
+ protected BasicElectricMotorTileEntity tileEntity;
+ public short lastProgress = -1;
+ public short lastEnergy = -1;
+ private final static int height = 166;
+
+ public BasicElectricMotorContainer(EntityPlayer entityPlayer, T 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.dischargeSlot, 0, 8, 33));
+ for (col = 0; col < 4; ++col) {
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.upgradeSlot, col, 152, 8 + col * 18));
+ }
+ }
+
+ @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, 0, this.tileEntity.progress);
+ }
+
+ if ((short) this.tileEntity.energy != this.lastEnergy) {
+ icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
+ }
+ }
+
+ this.lastProgress = this.tileEntity.progress;
+ this.lastEnergy = (short) this.tileEntity.energy;
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value) {
+ super.updateProgressBar(index, value);
+ switch (index) {
+ case 0:
+ this.tileEntity.progress = (short) value;
+ break;
+ case 1:
+ break;
+ case 2:
+ this.tileEntity.energy = value;
+ break;
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/ihl/processing/chemistry/ChemicalReactorContainer.java b/ihl/processing/chemistry/ChemicalReactorContainer.java
index a20cc01..a1cc0b4 100644
--- a/ihl/processing/chemistry/ChemicalReactorContainer.java
+++ b/ihl/processing/chemistry/ChemicalReactorContainer.java
@@ -10,100 +10,34 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraftforge.fluids.FluidStack;
-public class ChemicalReactorContainer extends ContainerBase<ChemicalReactorTileEntity> {
+public class ChemicalReactorContainer extends BasicElectricMotorContainer<ChemicalReactorTileEntity> {
- protected ChemicalReactorTileEntity tileEntity;
- public int lastFluidAmount = -1;
+ protected ChemicalReactorTileEntity tileEntity;
+ public int lastFluidAmount = -1;
public int lastNumberOfFluids = -1;
- public short lastProgress = -1;
- public short lastTemperature = -1;
- public short lastEnergy = -1;
- private final static int height=166;
- public List<FluidStack> fluidTankFluidList;
-
- public ChemicalReactorContainer(EntityPlayer entityPlayer, ChemicalReactorTileEntity tileEntity1){
- super(tileEntity1);
- this.tileEntity = tileEntity1;
- fluidTankFluidList=tileEntity.getFluidTank().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.fillInputSlot, 0, 60, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 60, 15));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 60, 33));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 122-18, 15));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 122, 15));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 122-18, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 1, 122, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.dischargeSlot, 0, 8, 33));
- }
+ public List<FluidStack> fluidTankFluidList;
- @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.getTankAmount() != this.lastFluidAmount || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList");
- }
-
- if (this.tileEntity.progress != this.lastProgress)
- {
- icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
- }
-
- if (this.tileEntity.temperature != this.lastTemperature)
- {
- icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.temperature);
- }
-
-
- if ((short) this.tileEntity.energy != this.lastEnergy)
- {
- icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
- }
- }
+ public ChemicalReactorContainer(EntityPlayer entityPlayer, ChemicalReactorTileEntity tileEntity1) {
+ super(entityPlayer, tileEntity1);
+ this.tileEntity = tileEntity1;
+ fluidTankFluidList = tileEntity.getFluidTank().getFluidList();
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 60, 51));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 60, 15));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 60, 33));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 122 - 18, 15));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 122, 15));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 122 - 18, 51));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 1, 122, 51));
+ }
- this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
- this.lastFluidAmount = this.tileEntity.getTankAmount();
- this.lastProgress = this.tileEntity.progress;
- this.lastTemperature = this.tileEntity.temperature;
- this.lastEnergy = (short) this.tileEntity.energy;
- }
-
- @Override
- public void updateProgressBar(int index, int value)
- {
- super.updateProgressBar(index, value);
- switch (index)
- {
- case 0:
- this.tileEntity.progress=(short) value;
- break;
- case 1:
- this.tileEntity.temperature=(short) value;
- break;
- case 2:
- this.tileEntity.energy=value;
- break;
- }
- }
-
@Override
- public boolean canInteractWith(EntityPlayer var1) {
- return tileEntity.isUseableByPlayer(var1);
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (this.tileEntity.getTankAmount() != this.lastFluidAmount
+ || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ }
+ this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
+ this.lastFluidAmount = this.tileEntity.getTankAmount();
}
}
diff --git a/ihl/processing/chemistry/CryogenicDistillerContainer.java b/ihl/processing/chemistry/CryogenicDistillerContainer.java
index be35e2a..d04ec4e 100644
--- a/ihl/processing/chemistry/CryogenicDistillerContainer.java
+++ b/ihl/processing/chemistry/CryogenicDistillerContainer.java
@@ -10,36 +10,18 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraftforge.fluids.FluidStack;
-public class CryogenicDistillerContainer extends ContainerBase<CryogenicDistillerTileEntity> {
+public class CryogenicDistillerContainer extends BasicElectricMotorContainer<CryogenicDistillerTileEntity> {
public CryogenicDistillerTileEntity tileEntity;
- public int lastProgress = -1;
- private short lastEnergy = -1;
private int lastNumberOfFluids = -1;
private int lastFluidAmount = -1;
- private final static int height=166;
public List<FluidStack> fluidTankFluidList;
public CryogenicDistillerContainer(EntityPlayer entityPlayer,
CryogenicDistillerTileEntity lathePart1TileEntity) {
- super(lathePart1TileEntity);
+ super(entityPlayer, lathePart1TileEntity);
tileEntity=lathePart1TileEntity;
fluidTankFluidList=tileEntity.fluidTankProducts.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(lathePart1TileEntity.dischargeSlot,0, 8, 32));
this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.fillInputSlotInput,0, 58, 51));
this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.fillInputSlotProducts,0, 103, 51));
this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.fluidItemsSlot,0, 58, 15));
@@ -50,41 +32,11 @@ public class CryogenicDistillerContainer extends ContainerBase<CryogenicDistille
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, 0, this.tileEntity.progress);
- }
- if (this.tileEntity.getEnergy() != this.lastEnergy)
- {
- icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.getEnergy());
- }
- if (this.tileEntity.fluidTankProducts.getFluidAmount() != this.lastFluidAmount || this.tileEntity.fluidTankProducts.getNumberOfFluids() != this.lastNumberOfFluids)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList");
- }
- }
- this.lastProgress = this.tileEntity.progress;
+ if (this.tileEntity.fluidTankProducts.getFluidAmount() != this.lastFluidAmount || this.tileEntity.fluidTankProducts.getNumberOfFluids() != this.lastNumberOfFluids)
+ {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ }
this.lastNumberOfFluids = this.tileEntity.fluidTankProducts.getNumberOfFluids();
this.lastFluidAmount = this.tileEntity.fluidTankProducts.getFluidAmount();
- this.lastEnergy = (short) this.tileEntity.getEnergy();
- }
-
- @Override
- public void updateProgressBar(int index, int value)
- {
- super.updateProgressBar(index, value);
- switch (index)
- {
- case 0:
- this.tileEntity.progress=(short) value;
- break;
- case 1:
- this.tileEntity.setEnergy(value);
- break;
- }
}
-
}
diff --git a/ihl/processing/chemistry/CryogenicDistillerGui.java b/ihl/processing/chemistry/CryogenicDistillerGui.java
index 2bfd969..a8f9f0f 100644
--- a/ihl/processing/chemistry/CryogenicDistillerGui.java
+++ b/ihl/processing/chemistry/CryogenicDistillerGui.java
@@ -24,7 +24,7 @@ public class CryogenicDistillerGui extends GuiContainer {
super.initGui();
int x = (width - xSize) / 2;
int y = (height - ySize) / 2;
- this.buttonList.add(new GuiButton(0, x + 7, y + 49, 49, 20, "Empty"));
+ this.buttonList.add(new GuiButton(0, x + 7, y + 50, 49, 20, "Empty"));
}
@Override
diff --git a/ihl/processing/chemistry/FluidizedBedReactorContainer.java b/ihl/processing/chemistry/FluidizedBedReactorContainer.java
index f1bdb3e..f8ea002 100644
--- a/ihl/processing/chemistry/FluidizedBedReactorContainer.java
+++ b/ihl/processing/chemistry/FluidizedBedReactorContainer.java
@@ -10,88 +10,34 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraftforge.fluids.FluidStack;
-public class FluidizedBedReactorContainer extends ContainerBase<FluidizedBedReactorTileEntity> {
+public class FluidizedBedReactorContainer extends BasicElectricMotorContainer<FluidizedBedReactorTileEntity> {
protected FluidizedBedReactorTileEntity tileEntity;
public int lastFluidsHash = -1;
- public short lastProgress = -1;
- public short lastTemperature = -1;
- public short lastEnergy = -1;
private final static int height=166;
public List<FluidStack> fluidTankFluidList;
public FluidizedBedReactorContainer(EntityPlayer entityPlayer, FluidizedBedReactorTileEntity tileEntity1){
- super(tileEntity1);
+ super(entityPlayer, tileEntity1);
this.tileEntity = tileEntity1;
fluidTankFluidList = this.tileEntity.getFluidTank().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.fillInputSlot, 0, 102, 51));
this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 102, 15));
this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 102, 33));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 8, 23));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 8, 41));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 43, 33));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.dischargeSlot, 0, 151, 33));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 41, 23));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 41, 41));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 76, 33));
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
- for (int i = 0; i < this.crafters.size(); ++i)
+ if (fluidTankFluidList.hashCode() != this.lastFluidsHash)
{
- ICrafting icrafting = (ICrafting)this.crafters.get(i);
- if (fluidTankFluidList.hashCode() != this.lastFluidsHash)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList");
- }
- if (this.tileEntity.progress != this.lastProgress)
- {
- icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
- }
-
- if (this.tileEntity.temperature != this.lastTemperature)
- {
- icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.temperature);
- }
- if ((short) this.tileEntity.energy != this.lastEnergy)
- {
- icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
- }
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
}
this.lastFluidsHash = fluidTankFluidList.hashCode();
- this.lastProgress = this.tileEntity.progress;
- this.lastTemperature = this.tileEntity.temperature;
- this.lastEnergy = (short) this.tileEntity.energy;
- }
-
- @Override
- public void updateProgressBar(int index, int value)
- {
- super.updateProgressBar(index, value);
- switch (index)
- {
- case 0:
- this.tileEntity.progress=(short) value;
- break;
- case 1:
- this.tileEntity.temperature=(short) value;
- break;
- case 2:
- this.tileEntity.energy=value;
- break;
- }
}
@Override
diff --git a/ihl/processing/chemistry/FluidizedBedReactorGui.java b/ihl/processing/chemistry/FluidizedBedReactorGui.java
index 3b52c38..d79a09d 100644
--- a/ihl/processing/chemistry/FluidizedBedReactorGui.java
+++ b/ihl/processing/chemistry/FluidizedBedReactorGui.java
@@ -10,52 +10,50 @@ import ihl.utils.IHLRenderUtils;
@SideOnly(Side.CLIENT)
public class FluidizedBedReactorGui extends GuiContainer {
- private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIFluidizedBedReactor.png");
+ private static final ResourceLocation background = new ResourceLocation("ihl",
+ "textures/gui/GUIFluidizedBedReactor.png");
private FluidizedBedReactorContainer container;
- private int mixerFrame=0;
+ private int mixerFrame = 0;
- public FluidizedBedReactorGui (FluidizedBedReactorContainer 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) {
- 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(background);
- int i1;
- if (this.container.tileEntity.getEnergy() > 0D)
- {
- i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
- this.drawTexturedModalRect(155, 17 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
- }
- if (this.container.tileEntity.progress > 0)
- {
- i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(17),17);
- this.drawTexturedModalRect(25, 34, 198, 0,i1,13);
- if(mixerFrame++>3)
- {
- mixerFrame=0;
- }
- this.drawTexturedModalRect(126, 31, 244, 126+26*mixerFrame,12,26);
- }
- if (this.container.tileEntity.getTankAmount() > 0)
- {
- IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 126, 28, 138, 59, zLevel, par1, par2, xOffset, yOffset);
- }
- }
+ public FluidizedBedReactorGui(FluidizedBedReactorContainer 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);
- }
+ @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(background);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D) {
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12), 12);
+ this.drawTexturedModalRect(12, 16 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0) {
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(17), 17);
+ this.drawTexturedModalRect(58, 34, 198, 0, i1, 13);
+ if (mixerFrame++ > 3) {
+ mixerFrame = 0;
+ }
+ this.drawTexturedModalRect(126, 31, 244, 126 + 26 * mixerFrame, 12, 26);
+ }
+ if (this.container.tileEntity.getTankAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 126, 28, 138, 59,
+ zLevel, par1, par2, xOffset, yOffset);
+ }
+ }
+
+ @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);
+ }
} \ No newline at end of file
diff --git a/ihl/processing/chemistry/LabElectrolyzerContainer.java b/ihl/processing/chemistry/LabElectrolyzerContainer.java
index b1fec2f..1be5e01 100644
--- a/ihl/processing/chemistry/LabElectrolyzerContainer.java
+++ b/ihl/processing/chemistry/LabElectrolyzerContainer.java
@@ -2,130 +2,70 @@ 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 LabElectrolyzerContainer extends ContainerBase<LabElectrolyzerTileEntity> {
+public class LabElectrolyzerContainer extends BasicElectricMotorContainer<LabElectrolyzerTileEntity> {
- protected LabElectrolyzerTileEntity tileEntity;
- public short lastProgress = -1;
- public short lastTemperature = -1;
- public short lastEnergy = -1;
- private final static int height=166;
- public int lastFluidAmount = -1;
+ protected LabElectrolyzerTileEntity tileEntity;
+ public short lastProgress = -1;
+ public short lastTemperature = -1;
+ public short lastEnergy = -1;
+ public int lastFluidAmount = -1;
public int lastNumberOfFluids = -1;
- public int lastFluidAmount2 = -1;
+ public int lastFluidAmount2 = -1;
public int lastNumberOfFluids2 = -1;
- public int lastFluidAmount3 = -1;
+ public int lastFluidAmount3 = -1;
public int lastNumberOfFluids3 = -1;
- public List<FluidStack> fluidTankFluidList;
- public List<FluidStack> fluidTankFluidList2;
- public List<FluidStack> fluidTankFluidList3;
-
- public LabElectrolyzerContainer(EntityPlayer entityPlayer, LabElectrolyzerTileEntity tileEntity1){
- super(tileEntity1);
- this.tileEntity = tileEntity1;
- fluidTankFluidList = this.tileEntity.getFluidTank().getFluidList();
- fluidTankFluidList2 = this.tileEntity.fluidTankAnodeOutput.getFluidList();
- fluidTankFluidList3 = this.tileEntity.fluidTankCathodeOutput.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.fillInputSlot, 0, 42, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlotAnodeOutput, 0, 106, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlotCathodeOutput, 0, 8, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 42, 15));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 8, 15));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 1, 42, 33));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 2, 106, 15));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 1, 87, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.dischargeSlot, 0, 152, 15));
- }
+ public List<FluidStack> fluidTankFluidList;
+ public List<FluidStack> fluidTankFluidList2;
+ public List<FluidStack> fluidTankFluidList3;
- @Override
- public void detectAndSendChanges()
- {
- super.detectAndSendChanges();
- for (int i = 0; i < this.crafters.size(); ++i)
- {
- ICrafting icrafting = (ICrafting)this.crafters.get(i);
+ public LabElectrolyzerContainer(EntityPlayer entityPlayer, LabElectrolyzerTileEntity tileEntity1) {
+ super(entityPlayer, tileEntity1);
+ this.tileEntity = tileEntity1;
+ fluidTankFluidList = this.tileEntity.getFluidTank().getFluidList();
+ fluidTankFluidList2 = this.tileEntity.fluidTankAnodeOutput.getFluidList();
+ fluidTankFluidList3 = this.tileEntity.fluidTankCathodeOutput.getFluidList();
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 63, 47));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlotAnodeOutput, 0, 109, 47));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlotCathodeOutput, 0, 29, 47));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 63, 11));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 29, 11));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 1, 63, 29));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 2, 109, 11));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 1, 63, 65));
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (this.tileEntity.getTankAmount() != this.lastFluidAmount
+ || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ }
- if (this.tileEntity.getTankAmount() != this.lastFluidAmount || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList");
- }
-
- if (this.tileEntity.fluidTankAnodeOutput.getFluidAmount() != this.lastFluidAmount2 || this.tileEntity.fluidTankAnodeOutput.getNumberOfFluids() != this.lastNumberOfFluids2)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList2");
- }
-
- if (this.tileEntity.fluidTankCathodeOutput.getFluidAmount() != this.lastFluidAmount3 || this.tileEntity.fluidTankCathodeOutput.getNumberOfFluids() != this.lastNumberOfFluids3)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList3");
- }
-
- if (this.tileEntity.progress != this.lastProgress)
- {
- icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
- }
-
- if (this.tileEntity.temperature != this.lastTemperature)
- {
- icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.temperature);
- }
-
-
- if ((short) this.tileEntity.energy != this.lastEnergy)
- {
- icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
- }
- }
+ if (this.tileEntity.fluidTankAnodeOutput.getFluidAmount() != this.lastFluidAmount2
+ || this.tileEntity.fluidTankAnodeOutput.getNumberOfFluids() != this.lastNumberOfFluids2) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList2");
+ }
- this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
- this.lastFluidAmount = this.tileEntity.getTankAmount();
- this.lastProgress = this.tileEntity.progress;
- this.lastTemperature = this.tileEntity.temperature;
- this.lastEnergy = (short) this.tileEntity.energy;
- this.lastNumberOfFluids2 = this.tileEntity.fluidTankAnodeOutput.getNumberOfFluids();
- this.lastFluidAmount2 = this.tileEntity.fluidTankAnodeOutput.getFluidAmount();
- this.lastNumberOfFluids3 = this.tileEntity.fluidTankCathodeOutput.getNumberOfFluids();
- this.lastFluidAmount3 = this.tileEntity.fluidTankCathodeOutput.getFluidAmount();
+ if (this.tileEntity.fluidTankCathodeOutput.getFluidAmount() != this.lastFluidAmount3
+ || this.tileEntity.fluidTankCathodeOutput.getNumberOfFluids() != this.lastNumberOfFluids3) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList3");
+ }
+
+ this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
+ this.lastFluidAmount = this.tileEntity.getTankAmount();
+ this.lastNumberOfFluids2 = this.tileEntity.fluidTankAnodeOutput.getNumberOfFluids();
+ this.lastFluidAmount2 = this.tileEntity.fluidTankAnodeOutput.getFluidAmount();
+ this.lastNumberOfFluids3 = this.tileEntity.fluidTankCathodeOutput.getNumberOfFluids();
+ this.lastFluidAmount3 = this.tileEntity.fluidTankCathodeOutput.getFluidAmount();
+
+ }
- }
-
- @Override
- public void updateProgressBar(int index, int value)
- {
- super.updateProgressBar(index, value);
- switch (index)
- {
- case 0:
- this.tileEntity.progress=(short) value;
- break;
- case 1:
- this.tileEntity.temperature=(short) value;
- break;
- case 2:
- this.tileEntity.energy=value;
- break;
- }
- }
-
@Override
public boolean canInteractWith(EntityPlayer var1) {
return tileEntity.isUseableByPlayer(var1);
diff --git a/ihl/processing/chemistry/LabElectrolyzerGui.java b/ihl/processing/chemistry/LabElectrolyzerGui.java
index aea51f8..8690257 100644
--- a/ihl/processing/chemistry/LabElectrolyzerGui.java
+++ b/ihl/processing/chemistry/LabElectrolyzerGui.java
@@ -10,68 +10,65 @@ import ihl.utils.IHLRenderUtils;
@SideOnly(Side.CLIENT)
public class LabElectrolyzerGui extends GuiContainer {
- private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUILabElectrolyzer.png");
+ private static final ResourceLocation background = new ResourceLocation("ihl",
+ "textures/gui/GUILabElectrolyzer.png");
private LabElectrolyzerContainer container;
- public LabElectrolyzerGui (LabElectrolyzerContainer 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) {
- 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(background);
- int i1;
- if (this.container.tileEntity.getEnergy() > 0D)
- {
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
- this.drawTexturedModalRect(142, 16 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
- }
- if (this.container.tileEntity.progress > 0)
- {
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(27),27);
- this.drawTexturedModalRect(142, 38, getFrameX(i1), getFrameY(i1),24,24);
- }
- if (this.container.tileEntity.getTankAmount() > 0)
- {
- IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 61, 19, 84, 67, zLevel, par1, par2, xOffset, yOffset);
- }
- if (this.container.tileEntity.fluidTankCathodeOutput.getFluidAmount() > 0)
- {
- IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.fluidTankCathodeOutput, 27, 28, 39, 67, zLevel, par1, par2, xOffset, yOffset);
- }
- if (this.container.tileEntity.fluidTankAnodeOutput.getFluidAmount() > 0)
- {
- IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.fluidTankAnodeOutput, 125, 28, 137, 67, zLevel, par1, par2, xOffset, yOffset);
- }
- }
+ public LabElectrolyzerGui(LabElectrolyzerContainer 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);
- }
-
- private int getFrameY(int number)
- {
- return (number % 10) * 24 + 14;
- }
-
- private int getFrameX(int number)
- {
- return (number / 10) * 24 + 176;
- }
+ @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(background);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D) {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12), 12);
+ this.drawTexturedModalRect(12, 16 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0) {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(27), 27);
+ this.drawTexturedModalRect(81, 31, getFrameX(i1), getFrameY(i1), 24, 24);
+ }
+ if (this.container.tileEntity.getTankAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 83, 15, 104, 81, zLevel,
+ par1, par2, xOffset, yOffset);
+ }
+ if (this.container.tileEntity.fluidTankCathodeOutput.getFluidAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.fluidTankCathodeOutput, 48, 24, 59, 81,
+ zLevel, par1, par2, xOffset, yOffset);
+ }
+ if (this.container.tileEntity.fluidTankAnodeOutput.getFluidAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.fluidTankAnodeOutput, 128, 24, 139, 81,
+ zLevel, par1, par2, xOffset, yOffset);
+ }
+ }
+
+ @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);
+ }
+
+ private int getFrameY(int number) {
+ return (number % 10) * 24 + 14;
+ }
+
+ private int getFrameX(int number) {
+ return (number / 10) * 24 + 176;
+ }
} \ No newline at end of file
diff --git a/ihl/processing/chemistry/PaperMachineContainer.java b/ihl/processing/chemistry/PaperMachineContainer.java
index ea07afc..0969649 100644
--- a/ihl/processing/chemistry/PaperMachineContainer.java
+++ b/ihl/processing/chemistry/PaperMachineContainer.java
@@ -10,7 +10,7 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraftforge.fluids.FluidStack;
-public class PaperMachineContainer extends ContainerBase<PaperMachineTileEntity> {
+public class PaperMachineContainer extends BasicElectricMotorContainer<PaperMachineTileEntity> {
protected PaperMachineTileEntity tileEntity;
public int lastFluidAmount = -1;
@@ -18,89 +18,27 @@ public class PaperMachineContainer extends ContainerBase<PaperMachineTileEntity>
public short lastProgress = -1;
public short lastTemperature = -1;
public short lastEnergy = -1;
- private final static int height=166;
public List<FluidStack> fluidTankFluidList;
public PaperMachineContainer(EntityPlayer entityPlayer, PaperMachineTileEntity tileEntity1){
- super(tileEntity1);
+ super(entityPlayer, tileEntity1);
this.tileEntity = tileEntity1;
fluidTankFluidList=this.tileEntity.getFluidTank().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.fillInputSlot, 0, 78, 51));
this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 78, 15));
this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 78, 33));
this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 122, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.dischargeSlot, 0, 8, 32));
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
- for (int i = 0; i < this.crafters.size(); ++i)
+ if (this.tileEntity.getTankAmount() != this.lastFluidAmount || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids)
{
- ICrafting icrafting = (ICrafting)this.crafters.get(i);
-
- if (this.tileEntity.getTankAmount() != this.lastFluidAmount || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList");
- }
-
- if (this.tileEntity.progress != this.lastProgress)
- {
- icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
- }
-
- if (this.tileEntity.temperature != this.lastTemperature)
- {
- icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.temperature);
- }
-
-
- if ((short) this.tileEntity.energy != this.lastEnergy)
- {
- icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
- }
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
}
-
this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
this.lastFluidAmount = this.tileEntity.getTankAmount();
- this.lastProgress = this.tileEntity.progress;
- this.lastTemperature = this.tileEntity.temperature;
- this.lastEnergy = (short) this.tileEntity.energy;
}
-
- @Override
- public void updateProgressBar(int index, int value)
- {
- super.updateProgressBar(index, value);
- switch (index)
- {
- case 0:
- this.tileEntity.progress=(short) value;
- break;
- case 1:
- this.tileEntity.temperature=(short) value;
- break;
- case 2:
- this.tileEntity.energy=value;
- break;
- }
- }
-
- @Override
- public boolean canInteractWith(EntityPlayer var1) {
- return tileEntity.isUseableByPlayer(var1);
- }
}
diff --git a/ihl/processing/invslots/InvSlotUpgradeIHL.java b/ihl/processing/invslots/InvSlotUpgradeIHL.java
new file mode 100644
index 0000000..5c1fff9
--- /dev/null
+++ b/ihl/processing/invslots/InvSlotUpgradeIHL.java
@@ -0,0 +1,61 @@
+package ihl.processing.invslots;
+
+import ic2.core.Ic2Items;
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlot;
+import ihl.utils.IHLUtils;
+import net.minecraft.item.ItemStack;
+
+public class InvSlotUpgradeIHL extends InvSlot {
+
+ public InvSlotUpgradeIHL(int count) {
+ super(count);
+ }
+
+ public InvSlotUpgradeIHL(TileEntityInventory base, int oldStartIndex, Access access, int count, InvSide side) {
+ super(base, "invSlotUpgrade", oldStartIndex, access, count, side);
+ }
+
+ public double getPowerConsumtionMultiplier() {
+ double base = 1d;
+ for (int i = 0; i < this.size(); i++) {
+ if (IHLUtils.isItemStacksIsEqual(this.get(i), Ic2Items.overclockerUpgrade, false)) {
+ int i1 = this.get(i).stackSize;
+ while (i1-- > 0 && base < 600) {
+ base *= 1.6f;
+ }
+ }
+ }
+ return base;
+ }
+
+ public float getProgressMultiplier() {
+ float base = 1f;
+ for (int i = 0; i < this.size(); i++) {
+ if (IHLUtils.isItemStacksIsEqual(this.get(i), Ic2Items.overclockerUpgrade, false)) {
+ int i1 = this.get(i).stackSize;
+ while (i1-- > 0 && base < 600) {
+ base *= 1.428571429f;
+ }
+ }
+ }
+ return base;
+ }
+
+ public int getAdditionalEnergyStorage() {
+ int base = 0;
+ for (int i = 0; i < this.size(); i++) {
+ if (IHLUtils.isItemStacksIsEqual(this.get(i), Ic2Items.energyStorageUpgrade, false)) {
+ base += this.get(i).stackSize * 10000;
+ }
+ }
+ return base;
+ }
+
+ @Override
+ public boolean accepts(ItemStack stack) {
+ return IHLUtils.isItemStacksIsEqual(stack, Ic2Items.overclockerUpgrade, false) ||
+ IHLUtils.isItemStacksIsEqual(stack, Ic2Items.energyStorageUpgrade, false);
+ }
+
+}
diff --git a/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java b/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java
index 125b6be..14a9e71 100644
--- a/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java
+++ b/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java
@@ -14,6 +14,7 @@ import ic2.core.block.invslot.InvSlot.Access;
import ihl.IHLMod;
import ihl.flexible_cable.FlexibleCableHolderBaseTileEntity;
import ihl.flexible_cable.NodeEntity;
+import ihl.processing.invslots.InvSlotUpgradeIHL;
import ihl.utils.IHLInvSlotDischarge;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
@@ -26,8 +27,9 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
implements IHasGui, INetworkClientTileEntityEventListener, IEnergySink {
public final IHLInvSlotDischarge dischargeSlot;
+ public final InvSlotUpgradeIHL upgradeSlot;
public short progress;
- protected short operationLength = 600;
+ protected short operationLength = 6000;
protected double energyConsume = 1d;
public double energy;
public int maxStorage = 128;
@@ -37,6 +39,7 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
super();
energyConsume = IHLMod.config.machineryEnergyConsume/100d;
dischargeSlot = new IHLInvSlotDischarge(this, 1, Access.IO, 4, InvSlot.InvSide.BOTTOM);
+ upgradeSlot = new InvSlotUpgradeIHL(this, 1, Access.IO, 4, InvSlot.InvSide.BOTTOM);
}
@Override
@@ -127,11 +130,11 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
@Override
public double getDemandedEnergy() {
- if(this.maxStorage - this.energy <= 1d)
+ if(this.getMaxStorage() - this.energy <= 1d)
{
return 0d;
}
- return this.maxStorage - this.energy;
+ return this.getMaxStorage() - this.energy;
}
@Override
@@ -141,7 +144,7 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
@Override
public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) {
- if (this.energy < this.maxStorage) {
+ if (this.energy < this.getMaxStorage()) {
this.energy += amount;
return 0.0D;
} else {
@@ -184,16 +187,16 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
double amount = this.dischargeSlot.discharge(this.getDemandedEnergy(), false);
this.energy += amount;
}
- if (this.gridID != -1 && this.getGrid().energy > 0D && this.energy < this.maxStorage) {
+ if (this.gridID != -1 && this.getGrid().energy > 0D && this.energy < this.getMaxStorage()) {
this.energy += energyConsume * 10D;
this.getGrid().drawEnergy(energyConsume * 10D, this);
}
if (this.canOperate() && this.energy >= this.energyConsume) {
- this.energy -= this.energyConsume;
+ this.energy -= this.energyConsume * this.upgradeSlot.getPowerConsumtionMultiplier();
if (this.progress == 0) {
IC2.network.get().initiateTileEntityEvent(this, 0, true);
}
- ++this.progress;
+ this.progress+=(short)(10*this.upgradeSlot.getProgressMultiplier());
if (this.progress >= this.operationLength) {
this.operate();
this.progress = 0;
@@ -210,6 +213,10 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
}
+ private double getMaxStorage() {
+ return maxStorage+this.upgradeSlot.getAdditionalEnergyStorage();
+ }
+
public abstract List<?>[] getInput();
public abstract boolean canOperate();
@@ -224,9 +231,9 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
public int getGUIEnergy(int i) {
if (this.energy < Float.MAX_VALUE) {
- return Math.round((float) this.energy / this.maxStorage * i);
+ return Math.round((float) (this.energy / this.getMaxStorage() * i));
} else {
- return Math.round((float) (this.energy / this.maxStorage) * i);
+ return Math.round((float) (this.energy / this.getMaxStorage()) * i);
}
}
@@ -250,7 +257,7 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
@Override
public double getEnergyAmountThisNodeWant() {
- return this.energy - this.maxStorage;
+ return this.energy - this.getMaxStorage();
}
public double drawEnergyToGrid(double amount) {