aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus')
-rw-r--r--src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java2
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotElectric.java43
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_2by2.java31
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_4by4.java43
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_2by2.java36
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_4by4.java36
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_2by2.java22
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_4by4.java35
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_2by2.java19
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_4by4.java20
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java219
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java22
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java73
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java243
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java77
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java18
17 files changed, 763 insertions, 180 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
index 9236aa53e5..788d011733 100644
--- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
+++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
@@ -55,7 +55,7 @@ public class COMPAT_HANDLER {
to
868
---
- 886
+ 890
to
950
*/
diff --git a/src/Java/gtPlusPlus/core/slots/SlotElectric.java b/src/Java/gtPlusPlus/core/slots/SlotElectric.java
new file mode 100644
index 0000000000..6b11cf5264
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/slots/SlotElectric.java
@@ -0,0 +1,43 @@
+package gtPlusPlus.core.slots;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import ic2.api.info.Info;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class SlotElectric extends Slot {
+
+ public SlotElectric(final IInventory inventory, final int x, final int y, final int z) {
+ super(inventory, x, y, z);
+ }
+
+ public SlotElectric(IGregTechTileEntity mTileEntity, int i, int j, int k) {
+ this(mTileEntity.getIInventory(mTileEntity.getXCoord(), mTileEntity.getYCoord(), mTileEntity.getZCoord()), i, j, k);
+ }
+
+ @Override
+ public boolean isItemValid(final ItemStack itemstack) {
+ if ((accepts(itemstack)) || (itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof IElectricItem)) {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean accepts(final ItemStack stack) {
+ if (stack == null) {
+ return false;
+ }
+ return (Info.itemEnergy.getEnergyValue(stack) > 0.0D)
+ || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), 4, true, true, true) > 0.0D);
+ }
+
+ @Override
+ public int getSlotStackLimit() {
+ return 1;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
index 2032555a7f..e4da291b17 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
@@ -253,6 +253,10 @@ public enum GregtechItemList implements GregtechItemContainer {
Machine_Advanced_EV_Mixer, Machine_Advanced_IV_Mixer, Machine_Advanced_LuV_Mixer,
Machine_Advanced_ZPM_Mixer, Machine_Advanced_UV_Mixer,
+ //Custom hatches
+ Hatch_Input_Battery_MV, Hatch_Input_Battery_EV,
+ Hatch_Output_Battery_MV, Hatch_Output_Battery_EV,
+
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_2by2.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_2by2.java
new file mode 100644
index 0000000000..60106825a0
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_2by2.java
@@ -0,0 +1,31 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches;
+
+import gregtech.api.gui.GT_ContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Slot;
+
+public class CONTAINER_2by2 extends GT_ContainerMetaTile_Machine {
+
+ public CONTAINER_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new Slot(mTileEntity, 0, 71, 26));
+ addSlotToContainer(new Slot(mTileEntity, 1, 89, 26));
+ addSlotToContainer(new Slot(mTileEntity, 2, 71, 44));
+ addSlotToContainer(new Slot(mTileEntity, 3, 89, 44));
+ }
+
+ @Override
+ public int getSlotCount() {
+ return 4;
+ }
+
+ @Override
+ public int getShiftClickSlotCount() {
+ return 4;
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_4by4.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_4by4.java
new file mode 100644
index 0000000000..0c011f164b
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_4by4.java
@@ -0,0 +1,43 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches;
+
+import gregtech.api.gui.GT_ContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Slot;
+
+public class CONTAINER_4by4 extends GT_ContainerMetaTile_Machine {
+
+ public CONTAINER_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new Slot(mTileEntity, 0, 53, 8));
+ addSlotToContainer(new Slot(mTileEntity, 1, 71, 8));
+ addSlotToContainer(new Slot(mTileEntity, 2, 89, 8));
+ addSlotToContainer(new Slot(mTileEntity, 3, 107, 8));
+ addSlotToContainer(new Slot(mTileEntity, 4, 53, 26));
+ addSlotToContainer(new Slot(mTileEntity, 5, 71, 26));
+ addSlotToContainer(new Slot(mTileEntity, 6, 89, 26));
+ addSlotToContainer(new Slot(mTileEntity, 7, 107, 26));
+ addSlotToContainer(new Slot(mTileEntity, 8, 53, 44));
+ addSlotToContainer(new Slot(mTileEntity, 9, 71, 44));
+ addSlotToContainer(new Slot(mTileEntity, 10, 89, 44));
+ addSlotToContainer(new Slot(mTileEntity, 11, 107, 44));
+ addSlotToContainer(new Slot(mTileEntity, 12, 53, 62));
+ addSlotToContainer(new Slot(mTileEntity, 13, 71, 62));
+ addSlotToContainer(new Slot(mTileEntity, 14, 89, 62));
+ addSlotToContainer(new Slot(mTileEntity, 15, 107, 62));
+ }
+
+ @Override
+ public int getSlotCount() {
+ return 16;
+ }
+
+ @Override
+ public int getShiftClickSlotCount() {
+ return 16;
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_2by2.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_2by2.java
new file mode 100644
index 0000000000..b78d8454c3
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_2by2.java
@@ -0,0 +1,36 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
+
+public class GUI_2by2 extends GT_GUIContainerMetaTile_Machine {
+
+ private final String mName;
+
+ public GUI_2by2(CONTAINER_2by2 containerType, InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(containerType, RES_PATH_GUI + "2by2.png");
+ mName = aName;
+ }
+
+ public GUI_2by2(CONTAINER_2by2 containerType, InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) {
+ super(containerType, RES_PATH_GUI + aBackground + "2by2.png");
+ mName = aName;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString(mName, 8, 4, 4210752);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_4by4.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_4by4.java
new file mode 100644
index 0000000000..4cd599110c
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_4by4.java
@@ -0,0 +1,36 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
+
+public class GUI_4by4 extends GT_GUIContainerMetaTile_Machine {
+
+ private final String mName;
+
+ public GUI_4by4(CONTAINER_4by4 containerType, InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(containerType, RES_PATH_GUI + "4by4.png");
+ mName = aName;
+ }
+
+ public GUI_4by4(CONTAINER_4by4 containerType, InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) {
+ super(containerType, RES_PATH_GUI + aBackground + "4by4.png");
+ mName = aName;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString(mName, 8, 4, 4210752);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_2by2.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_2by2.java
new file mode 100644
index 0000000000..d2ca190658
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_2by2.java
@@ -0,0 +1,22 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches.charge;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.core.slots.SlotElectric;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_2by2;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class CONTAINER_Electric_2by2 extends CONTAINER_2by2{
+
+ public CONTAINER_Electric_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new SlotElectric(mTileEntity, 0, 71, 26));
+ addSlotToContainer(new SlotElectric(mTileEntity, 1, 89, 26));
+ addSlotToContainer(new SlotElectric(mTileEntity, 2, 71, 44));
+ addSlotToContainer(new SlotElectric(mTileEntity, 3, 89, 44));
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_4by4.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_4by4.java
new file mode 100644
index 0000000000..bb70df0558
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_4by4.java
@@ -0,0 +1,35 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches.charge;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.core.slots.SlotElectric;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_4by4;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class CONTAINER_Electric_4by4 extends CONTAINER_4by4{
+
+ public CONTAINER_Electric_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new SlotElectric(mTileEntity, 0, 53, 8));
+ addSlotToContainer(new SlotElectric(mTileEntity, 1, 71, 8));
+ addSlotToContainer(new SlotElectric(mTileEntity, 2, 89, 8));
+ addSlotToContainer(new SlotElectric(mTileEntity, 3, 107, 8));
+ addSlotToContainer(new SlotElectric(mTileEntity, 4, 53, 26));
+ addSlotToContainer(new SlotElectric(mTileEntity, 5, 71, 26));
+ addSlotToContainer(new SlotElectric(mTileEntity, 6, 89, 26));
+ addSlotToContainer(new SlotElectric(mTileEntity, 7, 107, 26));
+ addSlotToContainer(new SlotElectric(mTileEntity, 8, 53, 44));
+ addSlotToContainer(new SlotElectric(mTileEntity, 9, 71, 44));
+ addSlotToContainer(new SlotElectric(mTileEntity, 10, 89, 44));
+ addSlotToContainer(new SlotElectric(mTileEntity, 11, 107, 44));
+ addSlotToContainer(new SlotElectric(mTileEntity, 12, 53, 62));
+ addSlotToContainer(new SlotElectric(mTileEntity, 13, 71, 62));
+ addSlotToContainer(new SlotElectric(mTileEntity, 14, 89, 62));
+ addSlotToContainer(new SlotElectric(mTileEntity, 15, 107, 62));
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_2by2.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_2by2.java
new file mode 100644
index 0000000000..2e365277ea
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_2by2.java
@@ -0,0 +1,19 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches.charge;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_2by2;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class GUI_Electric_2by2 extends GUI_2by2{
+
+ public GUI_Electric_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(new CONTAINER_Electric_2by2(aInventoryPlayer, aTileEntity), aInventoryPlayer, aTileEntity, aName);
+ }
+
+ public GUI_Electric_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) {
+ super(new CONTAINER_Electric_2by2(aInventoryPlayer, aTileEntity), aInventoryPlayer, aTileEntity, RES_PATH_GUI + aBackground + "2by2.png");
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_4by4.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_4by4.java
new file mode 100644
index 0000000000..a09ab7d7aa
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_4by4.java
@@ -0,0 +1,20 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches.charge;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_4by4;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class GUI_Electric_4by4 extends GUI_4by4{
+
+ public GUI_Electric_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(new CONTAINER_Electric_4by4(aInventoryPlayer, aTileEntity), aInventoryPlayer, aTileEntity, aName);
+ }
+
+ public GUI_Electric_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) {
+ super(new CONTAINER_Electric_4by4(aInventoryPlayer, aTileEntity), aInventoryPlayer, aTileEntity, RES_PATH_GUI + aBackground + "4by4.png");
+
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java
index ee58e0f20f..6de1594b69 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java
@@ -43,7 +43,9 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
public short mOverheat;
public final int mWireHeatingTicks;
- public GregtechMetaPipeEntityBase_Cable(final int aID, final String aName, final String aNameRegional, final float aThickNess, final GT_Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock) {
+ public GregtechMetaPipeEntityBase_Cable(final int aID, final String aName, final String aNameRegional,
+ final float aThickNess, final GT_Materials aMaterial, final long aCableLossPerMeter, final long aAmperage,
+ final long aVoltage, final boolean aInsulated, final boolean aCanShock) {
super(aID, aName, aNameRegional, 0);
this.mThickNess = aThickNess;
this.mMaterial = aMaterial;
@@ -55,7 +57,9 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
this.mWireHeatingTicks = this.getGT5Var();
}
- public GregtechMetaPipeEntityBase_Cable(final String aName, final float aThickNess, final GT_Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock) {
+ public GregtechMetaPipeEntityBase_Cable(final String aName, final float aThickNess, final GT_Materials aMaterial,
+ final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated,
+ final boolean aCanShock) {
super(aName, 0);
this.mThickNess = aThickNess;
this.mMaterial = aMaterial;
@@ -67,23 +71,23 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
this.mWireHeatingTicks = this.getGT5Var();
}
- private int getGT5Var(){
+ private int getGT5Var() {
final Class<? extends GT_Proxy> clazz = GT_Mod.gregtechproxy.getClass();
final String lookingForValue = "mWireHeatingTicks";
int temp = 4;
Field field;
- if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){
+ if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
try {
field = clazz.getClass().getField(lookingForValue);
final Class<?> clazzType = field.getType();
- if (clazzType.toString().equals("int")){
+ if (clazzType.toString().equals("int")) {
temp = (field.getInt(clazz));
- }
- else {
+ } else {
temp = 4;
}
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
- //Utils.LOG_INFO("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS.");
+ // Utils.LOG_INFO("FATAL ERROR - REFLECTION FAILED FOR GT CABLES
+ // - PLEASE REPORT THIS.");
Utils.LOG_WARNING("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS.");
Utils.LOG_ERROR("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS.");
temp = 4;
@@ -99,37 +103,64 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
@Override
public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
- return new GregtechMetaPipeEntityBase_Cable(this.mName, this.mThickNess, this.mMaterial, this.mCableLossPerMeter, this.mAmperage, this.mVoltage, this.mInsulated, this.mCanShock);
+ return new GregtechMetaPipeEntityBase_Cable(this.mName, this.mThickNess, this.mMaterial,
+ this.mCableLossPerMeter, this.mAmperage, this.mVoltage, this.mInsulated, this.mCanShock);
}
@Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aConnections, final byte aColorIndex, final boolean aConnected, final boolean aRedstone) {
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide,
+ final byte aConnections, final byte aColorIndex, final boolean aConnected, final boolean aRedstone) {
if (!this.mInsulated) {
- return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa)};
+ return new ITexture[] { new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
+ this.mMaterial.mRGBa) };
}
if (aConnected) {
final float tThickNess = this.getThickNess();
if (tThickNess < 0.37F) {
- return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
+ return new ITexture[] {
+ new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
+ this.mMaterial.mRGBa),
+ new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
if (tThickNess < 0.49F) {
- return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
+ return new ITexture[] {
+ new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
+ this.mMaterial.mRGBa),
+ new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
if (tThickNess < 0.74F) {
- return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
+ return new ITexture[] {
+ new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
+ this.mMaterial.mRGBa),
+ new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
if (tThickNess < 0.99F) {
- return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
+ return new ITexture[] {
+ new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
+ this.mMaterial.mRGBa),
+ new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
- return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
+ return new ITexture[] {
+ new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
+ this.mMaterial.mRGBa),
+ new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
- return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
+ return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.INSULATION_FULL,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
@Override
- public void onEntityCollidedWithBlock(final World aWorld, final int aX, final int aY, final int aZ, final Entity aEntity) {
- if (this.mCanShock && ((((BaseMetaPipeEntity) this.getBaseMetaTileEntity()).mConnections & -128) == 0) && (aEntity instanceof EntityLivingBase)) {
- GT_Utility.applyElectricityDamage((EntityLivingBase) aEntity, this.mTransferredVoltageLast20, this.mTransferredAmperageLast20);
+ public void onEntityCollidedWithBlock(final World aWorld, final int aX, final int aY, final int aZ,
+ final Entity aEntity) {
+ if (this.mCanShock && ((((BaseMetaPipeEntity) this.getBaseMetaTileEntity()).mConnections & -128) == 0)
+ && (aEntity instanceof EntityLivingBase)) {
+ GT_Utility.applyElectricityDamage((EntityLivingBase) aEntity, this.mTransferredVoltageLast20,
+ this.mTransferredAmperageLast20);
}
}
@@ -138,7 +169,8 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
if (!this.mCanShock) {
return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
}
- return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D);
+ return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D,
+ aZ + 0.875D);
}
@Override
@@ -173,19 +205,26 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
@Override
public long injectEnergyUnits(final byte aSide, final long aVoltage, final long aAmperage) {
- if (!this.getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, this.getBaseMetaTileEntity().getCoverIDAtSide(aSide), this.getBaseMetaTileEntity().getCoverDataAtSide(aSide), this.getBaseMetaTileEntity())) {
+ if (!this.getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide,
+ this.getBaseMetaTileEntity().getCoverIDAtSide(aSide),
+ this.getBaseMetaTileEntity().getCoverDataAtSide(aSide), this.getBaseMetaTileEntity())) {
return 0;
}
- return this.transferElectricity(aSide, aVoltage, aAmperage, new ArrayList<>(Arrays.asList((TileEntity) this.getBaseMetaTileEntity())));
+ return this.transferElectricity(aSide, aVoltage, aAmperage,
+ new ArrayList<>(Arrays.asList((TileEntity) this.getBaseMetaTileEntity())));
}
@Override
- public long transferElectricity(final byte aSide, long aVoltage, final long aAmperage, final ArrayList<TileEntity> aAlreadyPassedTileEntityList) {
+ public long transferElectricity(final byte aSide, long aVoltage, final long aAmperage,
+ final ArrayList<TileEntity> aAlreadyPassedTileEntityList) {
long rUsedAmperes = 0;
aVoltage -= this.mCableLossPerMeter;
if (aVoltage > 0) {
for (byte i = 0; (i < 6) && (aAmperage > rUsedAmperes); i++) {
- if ((i != aSide) && ((this.mConnections & (1 << i)) != 0) && this.getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i, this.getBaseMetaTileEntity().getCoverIDAtSide(i), this.getBaseMetaTileEntity().getCoverDataAtSide(i), this.getBaseMetaTileEntity())) {
+ if ((i != aSide) && ((this.mConnections & (1 << i)) != 0)
+ && this.getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i,
+ this.getBaseMetaTileEntity().getCoverIDAtSide(i),
+ this.getBaseMetaTileEntity().getCoverDataAtSide(i), this.getBaseMetaTileEntity())) {
final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(i);
if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) {
aAlreadyPassedTileEntityList.add(tTileEntity);
@@ -196,22 +235,45 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
continue;
}
}
- if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable) && ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i)).letsEnergyIn(GT_Utility.getOppositeSide(i), ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity) tTileEntity))) {
+ if ((tTileEntity instanceof IGregTechTileEntity)
+ && (((IGregTechTileEntity) tTileEntity)
+ .getMetaTileEntity() instanceof IMetaTileEntityCable)
+ && ((IGregTechTileEntity) tTileEntity)
+ .getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i))
+ .letsEnergyIn(GT_Utility.getOppositeSide(i),
+ ((IGregTechTileEntity) tTileEntity)
+ .getCoverIDAtSide(GT_Utility.getOppositeSide(i)),
+ ((IGregTechTileEntity) tTileEntity)
+ .getCoverDataAtSide(GT_Utility.getOppositeSide(i)),
+ ((IGregTechTileEntity) tTileEntity))) {
if (((IGregTechTileEntity) tTileEntity).getTimer() > 50) {
- rUsedAmperes += ((IMetaTileEntityCable) ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()).transferElectricity(GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes, aAlreadyPassedTileEntityList);
+ rUsedAmperes += ((IMetaTileEntityCable) ((IGregTechTileEntity) tTileEntity)
+ .getMetaTileEntity()).transferElectricity(GT_Utility.getOppositeSide(i),
+ aVoltage, aAmperage - rUsedAmperes, aAlreadyPassedTileEntityList);
}
} else {
- rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits(GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes);
+ rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits(
+ GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes);
}
- // } else if (tTileEntity instanceof IEnergySink) {
- // ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite();
- // if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)getBaseMetaTileEntity(), tDirection)) {
- // if (((IEnergySink)tTileEntity).demandedEnergyUnits() > 0 && ((IEnergySink)tTileEntity).injectEnergyUnits(tDirection, aVoltage) < aVoltage) rUsedAmperes++;
- // }
+ // } else if (tTileEntity instanceof IEnergySink) {
+ // ForgeDirection tDirection =
+ // ForgeDirection.getOrientation(i).getOpposite();
+ // if
+ // (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)getBaseMetaTileEntity(),
+ // tDirection)) {
+ // if
+ // (((IEnergySink)tTileEntity).demandedEnergyUnits()
+ // > 0 &&
+ // ((IEnergySink)tTileEntity).injectEnergyUnits(tDirection,
+ // aVoltage) < aVoltage) rUsedAmperes++;
+ // }
} else if (tTileEntity instanceof IEnergySink) {
final ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite();
- if (((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) this.getBaseMetaTileEntity(), tDirection)) {
- if ((((IEnergySink) tTileEntity).getDemandedEnergy() > 0) && (((IEnergySink) tTileEntity).injectEnergy(tDirection, aVoltage, aVoltage) < aVoltage)) {
+ if (((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) this.getBaseMetaTileEntity(),
+ tDirection)) {
+ if ((((IEnergySink) tTileEntity).getDemandedEnergy() > 0)
+ && (((IEnergySink) tTileEntity).injectEnergy(tDirection, aVoltage,
+ aVoltage) < aVoltage)) {
rUsedAmperes++;
}
}
@@ -223,15 +285,18 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
rUsedAmperes++;
} else if (((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, true) > 0) {
if (this.mRestRF == 0) {
- final int RFtrans = ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, false);
+ final int RFtrans = ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut,
+ false);
rUsedAmperes++;
this.mRestRF = rfOut - RFtrans;
} else {
- final int RFtrans = ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, (int) this.mRestRF, false);
+ final int RFtrans = ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection,
+ (int) this.mRestRF, false);
this.mRestRF = this.mRestRF - RFtrans;
}
}
- if (GregTech_API.mRFExplosions && (((IEnergyReceiver) tTileEntity).getMaxEnergyStored(tDirection) < (rfOut * 600))) {
+ if (GregTech_API.mRFExplosions && (((IEnergyReceiver) tTileEntity)
+ .getMaxEnergyStored(tDirection) < (rfOut * 600))) {
if (rfOut > ((32 * GregTech_API.mEUtoRF) / 100)) {
this.doExplosion(rfOut);
}
@@ -242,24 +307,21 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
}
}
-
this.mTransferredAmperage += rUsedAmperes;
this.mTransferredVoltageLast20 = Math.max(this.mTransferredVoltageLast20, aVoltage);
this.mTransferredAmperageLast20 = Math.max(this.mTransferredAmperageLast20, this.mTransferredAmperage);
-
- if ((aVoltage > this.mVoltage) || (this.mTransferredAmperage > this.mAmperage)){
- //GT 5.09
+ if ((aVoltage > this.mVoltage) || (this.mTransferredAmperage > this.mAmperage)) {
+ // GT 5.09
if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
- if(this.mOverheat>(this.mWireHeatingTicks * 100)){
+ if (this.mOverheat > (this.mWireHeatingTicks * 100)) {
this.getBaseMetaTileEntity().setToFire();
- }
- else{
- this.mOverheat +=100;
+ } else {
+ this.mOverheat += 100;
}
return aAmperage;
}
- //GT 5.08
+ // GT 5.08
else {
this.getBaseMetaTileEntity().setToFire();
return aAmperage;
@@ -273,7 +335,7 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
if (aBaseMetaTileEntity.isServerSide()) {
this.mTransferredAmperage = 0;
- if(this.mOverheat>0) {
+ if (this.mOverheat > 0) {
this.mOverheat--;
}
@@ -283,7 +345,15 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
this.mConnections = 0;
for (byte i = 0, j = 0; i < 6; i++) {
j = GT_Utility.getOppositeSide(i);
- if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity) || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyIn(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity) || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyOut(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity)) {
+ if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i,
+ aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i),
+ aBaseMetaTileEntity)
+ || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyIn(i,
+ aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i),
+ aBaseMetaTileEntity)
+ || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyOut(i,
+ aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i),
+ aBaseMetaTileEntity)) {
final TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i);
if (tTileEntity instanceof IColoredTileEntity) {
if (aBaseMetaTileEntity.getColorization() >= 0) {
@@ -293,29 +363,47 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
}
}
}
- if ((tTileEntity instanceof IEnergyConnected) && (((IEnergyConnected) tTileEntity).inputEnergyFrom(j) || ((IEnergyConnected) tTileEntity).outputsEnergyTo(j))) {
+ if ((tTileEntity instanceof IEnergyConnected)
+ && (((IEnergyConnected) tTileEntity).inputEnergyFrom(j)
+ || ((IEnergyConnected) tTileEntity).outputsEnergyTo(j))) {
this.mConnections |= (1 << i);
continue;
}
- if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable)) {
- if (((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).letsEnergyIn(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).letsEnergyOut(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity))) {
+ if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity)
+ .getMetaTileEntity() instanceof IMetaTileEntityCable)) {
+ if (((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j,
+ ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j),
+ ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j),
+ ((IGregTechTileEntity) tTileEntity))
+ || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).letsEnergyIn(j,
+ ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j),
+ ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j),
+ ((IGregTechTileEntity) tTileEntity))
+ || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).letsEnergyOut(j,
+ ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j),
+ ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j),
+ ((IGregTechTileEntity) tTileEntity))) {
this.mConnections |= (1 << i);
continue;
}
}
- if ((tTileEntity instanceof IEnergySink) && ((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) {
+ if ((tTileEntity instanceof IEnergySink) && ((IEnergySink) tTileEntity).acceptsEnergyFrom(
+ (TileEntity) aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) {
this.mConnections |= (1 << i);
continue;
}
- if (GregTech_API.mOutputRF && (tTileEntity instanceof IEnergyReceiver) && ((IEnergyReceiver) tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(j))) {
+ if (GregTech_API.mOutputRF && (tTileEntity instanceof IEnergyReceiver)
+ && ((IEnergyReceiver) tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(j))) {
this.mConnections |= (1 << i);
continue;
}
/*
- if (tTileEntity instanceof IEnergyEmitter && ((IEnergyEmitter)tTileEntity).emitsEnergyTo((TileEntity)aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) {
- mConnections |= (1<<i);
- continue;
- }*/
+ * if (tTileEntity instanceof IEnergyEmitter &&
+ * ((IEnergyEmitter)tTileEntity).emitsEnergyTo((
+ * TileEntity)aBaseMetaTileEntity,
+ * ForgeDirection.getOrientation(j))) { mConnections |=
+ * (1<<i); continue; }
+ */
}
}
}
@@ -323,22 +411,25 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
}
@Override
- public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
+ final ItemStack aStack) {
return false;
}
@Override
- public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
+ final ItemStack aStack) {
return false;
}
@Override
public String[] getDescription() {
- return new String[]{
- "Max Voltage: " + EnumChatFormatting.GREEN + this.mVoltage + " (" + VN[GT_Utility.getTier(this.mVoltage)] + ")" + EnumChatFormatting.GRAY,
+ return new String[] {
+ "Max Voltage: " + EnumChatFormatting.GREEN + this.mVoltage + " ("
+ + VN[GT_Utility.getTier(this.mVoltage)] + ")" + EnumChatFormatting.GRAY,
"Max Amperage: " + EnumChatFormatting.YELLOW + this.mAmperage + EnumChatFormatting.GRAY,
- "Loss/Meter/Ampere: " + EnumChatFormatting.RED + this.mCableLossPerMeter + EnumChatFormatting.GRAY + " EU-Volt"
- };
+ "Loss/Meter/Ampere: " + EnumChatFormatting.RED + this.mCableLossPerMeter + EnumChatFormatting.GRAY
+ + " EU-Volt" };
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java
index 2997a3d7af..645cee84e3 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java
@@ -22,9 +22,10 @@ public abstract class GregtechMetaTileEntity extends MetaTileEntity {
*/
public final ITexture[][][] mTextures;
- public GregtechMetaTileEntity(final int aID, final String aName, final String aNameRegional, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture... aTextures) {
+ public GregtechMetaTileEntity(final int aID, final String aName, final String aNameRegional, final int aTier,
+ final int aInvSlotCount, final String aDescription, final ITexture... aTextures) {
super(aID, aName, aNameRegional, aInvSlotCount);
- this.mTier = (byte)Math.max(0, Math.min(aTier, 9));
+ this.mTier = (byte) Math.max(0, Math.min(aTier, 9));
this.mDescription = aDescription;
// must always be the last call!
@@ -35,9 +36,10 @@ public abstract class GregtechMetaTileEntity extends MetaTileEntity {
}
}
- public GregtechMetaTileEntity(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) {
+ public GregtechMetaTileEntity(final String aName, final int aTier, final int aInvSlotCount,
+ final String aDescription, final ITexture[][][] aTextures) {
super(aName, aInvSlotCount);
- this.mTier = (byte)aTier;
+ this.mTier = (byte) aTier;
this.mDescription = aDescription;
this.mTextures = aTextures;
@@ -45,7 +47,7 @@ public abstract class GregtechMetaTileEntity extends MetaTileEntity {
@Override
public byte getTileEntityBaseType() {
- return (byte)(Math.min(3, this.mTier<=0?0:1+((this.mTier-1) / 4)));
+ return (byte) (Math.min(3, this.mTier <= 0 ? 0 : 1 + ((this.mTier - 1) / 4)));
}
@Override
@@ -60,13 +62,15 @@ public abstract class GregtechMetaTileEntity extends MetaTileEntity {
@Override
public String[] getDescription() {
- return new String[] {this.mDescription, CORE.GT_Tooltip};
+ return new String[] { this.mDescription, CORE.GT_Tooltip };
}
/**
- * Used Client Side to get a Texture Set for this Block.
- * Called after setting the Tier and the Description so that those two are accessible.
- * @param aTextures is the optional Array you can give to the Constructor.
+ * Used Client Side to get a Texture Set for this Block. Called after
+ * setting the Tier and the Description so that those two are accessible.
+ *
+ * @param aTextures
+ * is the optional Array you can give to the Constructor.
*/
public abstract ITexture[][][] getTextureSet(ITexture[] aTextures);
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java
index cffedac712..83affb9740 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java
@@ -1,6 +1,5 @@
package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base;
-
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -13,9 +12,9 @@ import net.minecraft.nbt.NBTTagCompound;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Transformer;
public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer {
-
+
private boolean mHalfMode = false;
-
+
public GregtechMetaTransformerHiAmp(int aID, String aName, String aNameRegional, int aTier, String aDescription) {
super(aID, aName, aNameRegional, aTier, aDescription);
}
@@ -26,43 +25,56 @@ public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer
@Override
public long maxEUStore() {
- return ((512L + gregtech.api.enums.GT_Values.V[(this.mTier + 1)] * 2L)*8);
+ return ((512L + gregtech.api.enums.GT_Values.V[(this.mTier + 1)] * 2L) * 8);
}
@Override
public long maxAmperesOut() {
- if (this.mHalfMode){
- return ((getBaseMetaTileEntity().isAllowedToWork()) ? 8L : 2L);
+ if (this.mHalfMode) {
+ return ((getBaseMetaTileEntity().isAllowedToWork()) ? 8L : 2L);
}
- return ((getBaseMetaTileEntity().isAllowedToWork()) ? 16L : 4L);
+ return ((getBaseMetaTileEntity().isAllowedToWork()) ? 16L : 4L);
}
@Override
public long maxAmperesIn() {
- if (this.mHalfMode){
- return ((getBaseMetaTileEntity().isAllowedToWork()) ? 2L : 8L);
+ if (this.mHalfMode) {
+ return ((getBaseMetaTileEntity().isAllowedToWork()) ? 2L : 8L);
}
return ((getBaseMetaTileEntity().isAllowedToWork()) ? 4L : 16L);
}
+
@Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- ITexture[][][] rTextures = new ITexture[12][17][];
- for (byte i = -1; i < 16; i++) {
- rTextures[0][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]};
- rTextures[1][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]};
- rTextures[2][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]};
- rTextures[3][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier+1]};
- rTextures[4][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier+1]};
- rTextures[5][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier+1]};
- rTextures[6][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]};
- rTextures[7][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]};
- rTextures[8][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]};
- rTextures[9][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier+1]};
- rTextures[10][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier+1]};
- rTextures[11][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier+1]};
- }
- return rTextures;
- }
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ ITexture[][][] rTextures = new ITexture[12][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ rTextures[1][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ rTextures[2][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ rTextures[3][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier + 1] };
+ rTextures[4][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier + 1] };
+ rTextures[5][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier + 1] };
+ rTextures[6][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] };
+ rTextures[7][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] };
+ rTextures[8][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] };
+ rTextures[9][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier + 1] };
+ rTextures[10][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier + 1] };
+ rTextures[11][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier + 1] };
+ }
+ return rTextures;
+ }
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
@@ -71,7 +83,7 @@ public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer
@Override
public String[] getDescription() {
- return new String[] {this.mDescription, "Accepts 4A and outputs 16A", CORE.GT_Tooltip};
+ return new String[] { this.mDescription, "Accepts 4A and outputs 16A", CORE.GT_Tooltip };
}
@Override
@@ -89,10 +101,9 @@ public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer
@Override
public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
this.mHalfMode = Utils.invertBoolean(mHalfMode);
- if (this.mHalfMode){
+ if (this.mHalfMode) {
PlayerUtils.messagePlayer(aPlayer, "Transformer is now running at 2A:8A in/out Ratio.");
- }
- else {
+ } else {
PlayerUtils.messagePlayer(aPlayer, "Transformer is now running at 4A:16A in/out Ratio.");
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index 576b3c1d04..df86584a69 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -1,37 +1,33 @@
package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base;
-import static gregtech.api.enums.GT_Values.V;
-
import java.util.ArrayList;
+import java.util.Iterator;
-import gregtech.GT_Mod;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.*;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.*;
-import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.*;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
-import gregtech.common.items.GT_MetaGenerated_Tool_01;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
-import net.minecraft.entity.player.EntityPlayer;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.fluids.FluidStack;
-public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_MultiBlockBase {
+public abstract class GregtechMeta_MultiBlockBase
+ extends
+ GT_MetaTileEntity_MultiBlockBase {
public static boolean disableMaintenance;
+ public ArrayList<GT_MetaTileEntity_Hatch_InputBattery> mChargeHatches = new ArrayList<GT_MetaTileEntity_Hatch_InputBattery>();
+ public ArrayList<GT_MetaTileEntity_Hatch_OutputBattery> mDischargeHatches = new ArrayList<GT_MetaTileEntity_Hatch_OutputBattery>();
- public GregtechMeta_MultiBlockBase(final int aID, final String aName, final String aNameRegional) {
+ public GregtechMeta_MultiBlockBase(final int aID, final String aName,
+ final String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -39,34 +35,47 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
super(aName);
}
- public static boolean isValidMetaTileEntity(final MetaTileEntity aMetaTileEntity) {
- return (aMetaTileEntity.getBaseMetaTileEntity() != null) && (aMetaTileEntity.getBaseMetaTileEntity().getMetaTileEntity() == aMetaTileEntity) && !aMetaTileEntity.getBaseMetaTileEntity().isDead();
+ public static boolean isValidMetaTileEntity(
+ final MetaTileEntity aMetaTileEntity) {
+ return (aMetaTileEntity.getBaseMetaTileEntity() != null)
+ && (aMetaTileEntity.getBaseMetaTileEntity()
+ .getMetaTileEntity() == aMetaTileEntity)
+ && !aMetaTileEntity.getBaseMetaTileEntity().isDead();
}
@Override
- public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
- return new CONTAINER_MultiMachine(aPlayerInventory, aBaseMetaTileEntity);
+ public Object getServerGUI(final int aID,
+ final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_MultiMachine(aPlayerInventory,
+ aBaseMetaTileEntity);
}
@Override
- public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
- return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png");
+ public Object getClientGUI(final int aID,
+ final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity,
+ this.getLocalName(), "MultiblockDisplay.png");
}
@Override
public String[] getInfoData() {
- return new String[]{"Progress:", (this.mProgresstime / 20) + "secs", (this.mMaxProgresstime / 20) + "secs", "Efficiency:", (this.mEfficiency / 100.0F) + "%", "Problems:", "" + (this.getIdealStatus() - this.getRepairStatus())};
+ return new String[]{"Progress:", (this.mProgresstime / 20) + "secs",
+ (this.mMaxProgresstime / 20) + "secs", "Efficiency:",
+ (this.mEfficiency / 100.0F) + "%", "Problems:",
+ "" + (this.getIdealStatus() - this.getRepairStatus())};
}
@Override
public boolean isGivingInformation() {
return true;
}
-
+
public int getAmountOfOutputs() {
return 1;
}
-
+
@Override
public boolean isCorrectMachinePart(ItemStack paramItemStack) {
return true;
@@ -76,73 +85,169 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
public int getDamageToComponent(ItemStack paramItemStack) {
return 0;
}
-
- public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {}
- public void startProcess() {}
+ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
+ }
- public int getValidOutputSlots(final IGregTechTileEntity machineCalling, final GT_Recipe sRecipes, final ItemStack[] sInputs){
- Utils.LOG_WARNING("Finding valid output slots for "+machineCalling.getInventoryName());
+ public void startProcess() {
+ }
+
+ public int getValidOutputSlots(final IGregTechTileEntity machineCalling,
+ final GT_Recipe sRecipes, final ItemStack[] sInputs) {
+ Utils.LOG_WARNING("Finding valid output slots for "
+ + machineCalling.getInventoryName());
final ArrayList<ItemStack> tInputList = this.getStoredInputs();
- final GT_Recipe tRecipe = sRecipes;
- final int outputItemCount = tRecipe.mOutputs.length;
- int tValidOutputHatches = 0;
-
- for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) {
- if (!isValidMetaTileEntity(tHatch)) continue;
-
- int tEmptySlots = 0;
- boolean foundRoom = false;
- final IInventory tHatchInv = tHatch.getBaseMetaTileEntity();
- for(int i = 0; i < tHatchInv.getSizeInventory() && !foundRoom; ++i)
- {
- if(tHatchInv.getStackInSlot(i) != null) continue;
-
- tEmptySlots++;
- if(tEmptySlots < outputItemCount) continue;
-
- tValidOutputHatches++;
- foundRoom = true;
- }
- }
-
- return tValidOutputHatches;
- }
-
- public GT_Recipe reduceRecipeTimeByPercentage(GT_Recipe tRecipe, float percentage){
+ final GT_Recipe tRecipe = sRecipes;
+ final int outputItemCount = tRecipe.mOutputs.length;
+ int tValidOutputHatches = 0;
+
+ for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) {
+ if (!isValidMetaTileEntity(tHatch))
+ continue;
+
+ int tEmptySlots = 0;
+ boolean foundRoom = false;
+ final IInventory tHatchInv = tHatch.getBaseMetaTileEntity();
+ for (int i = 0; i < tHatchInv.getSizeInventory()
+ && !foundRoom; ++i) {
+ if (tHatchInv.getStackInSlot(i) != null)
+ continue;
+
+ tEmptySlots++;
+ if (tEmptySlots < outputItemCount)
+ continue;
+
+ tValidOutputHatches++;
+ foundRoom = true;
+ }
+ }
+
+ return tValidOutputHatches;
+ }
+
+ public GT_Recipe reduceRecipeTimeByPercentage(GT_Recipe tRecipe,
+ float percentage) {
int cloneTime = 0;
GT_Recipe baseRecipe;
GT_Recipe cloneRecipe = null;
-
+
baseRecipe = tRecipe.copy();
- if (cloneRecipe != baseRecipe || cloneRecipe == null){
+ if (cloneRecipe != baseRecipe || cloneRecipe == null) {
cloneRecipe = baseRecipe.copy();
Utils.LOG_WARNING("Setting Recipe");
- }
- if (cloneTime != baseRecipe.mDuration || cloneTime == 0){
+ }
+ if (cloneTime != baseRecipe.mDuration || cloneTime == 0) {
cloneTime = baseRecipe.mDuration;
Utils.LOG_WARNING("Setting Time");
}
-
- if (cloneRecipe.mDuration > 0){
+
+ if (cloneRecipe.mDuration > 0) {
int originalTime = cloneRecipe.mDuration;
- int tempTime = MathUtils.findPercentageOfInt(cloneRecipe.mDuration, (100-percentage));
+ int tempTime = MathUtils.findPercentageOfInt(cloneRecipe.mDuration,
+ (100 - percentage));
cloneRecipe.mDuration = tempTime;
- if (cloneRecipe.mDuration < originalTime){
- Utils.LOG_INFO("Generated recipe with a smaller time. | "+originalTime+" | "+cloneRecipe.mDuration+" |");
+ if (cloneRecipe.mDuration < originalTime) {
+ Utils.LOG_INFO("Generated recipe with a smaller time. | "
+ + originalTime + " | " + cloneRecipe.mDuration + " |");
return cloneRecipe;
- }
- else {
- Utils.LOG_INFO("Did not generate recipe with a smaller time. | "+originalTime+" | "+cloneRecipe.mDuration+" |");
+ } else {
+ Utils.LOG_INFO("Did not generate recipe with a smaller time. | "
+ + originalTime + " | " + cloneRecipe.mDuration + " |");
return tRecipe;
}
}
Utils.LOG_INFO("Error generating recipe, returning null.");
return null;
-
-
-
+
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity,
+ long aTick) {
+ this.mChargeHatches.clear();
+ this.mDischargeHatches.clear();
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public void explodeMultiblock() {
+ MetaTileEntity tTileEntity;
+ for (Iterator<GT_MetaTileEntity_Hatch_InputBattery> localIterator = this.mChargeHatches
+ .iterator(); localIterator.hasNext(); tTileEntity
+ .getBaseMetaTileEntity()
+ .doExplosion(gregtech.api.enums.GT_Values.V[8]))
+ tTileEntity = (MetaTileEntity) localIterator.next();
+ tTileEntity = null;
+ for (Iterator<GT_MetaTileEntity_Hatch_OutputBattery> localIterator = this.mDischargeHatches
+ .iterator(); localIterator.hasNext(); tTileEntity
+ .getBaseMetaTileEntity()
+ .doExplosion(gregtech.api.enums.GT_Values.V[8]))
+ tTileEntity = (MetaTileEntity) localIterator.next();
+ super.explodeMultiblock();
}
+ public void updateSlots() {
+ for (GT_MetaTileEntity_Hatch_InputBattery tHatch : this.mChargeHatches)
+ if (isValidMetaTileEntity(tHatch))
+ tHatch.updateSlots();
+ for (GT_MetaTileEntity_Hatch_OutputBattery tHatch : this.mDischargeHatches)
+ if (isValidMetaTileEntity(tHatch))
+ tHatch.updateSlots();
+ super.updateSlots();
+ }
+
+ public boolean addToMachineList(IGregTechTileEntity aTileEntity,
+ int aBaseCasingIndex) {
+ if (aTileEntity == null)
+ return false;
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null)
+ return false;
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity)
+ .updateTexture(aBaseCasingIndex);
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery)
+ return this.mChargeHatches.add(
+ (GT_MetaTileEntity_Hatch_InputBattery) aMetaTileEntity);
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery)
+ return this.mDischargeHatches.add(
+ (GT_MetaTileEntity_Hatch_OutputBattery) aMetaTileEntity);
+ return super.addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+
+ public boolean addChargeableToMachineList(IGregTechTileEntity aTileEntity,
+ int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ }
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null)
+ return false;
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity)
+ .updateTexture(aBaseCasingIndex);
+ return this.mChargeHatches.add(
+ (GT_MetaTileEntity_Hatch_InputBattery) aMetaTileEntity);
+ }
+ return false;
+ }
+
+ public boolean addDischargeableInputToMachineList(
+ IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ }
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null)
+ return false;
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity)
+ .updateTexture(aBaseCasingIndex);
+ return this.mDischargeHatches.add(
+ (GT_MetaTileEntity_Hatch_OutputBattery) aMetaTileEntity);
+ }
+ return false;
+ }
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java
index 5f95a28321..c6a4cc03c1 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java
@@ -1,5 +1,7 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi;
+import java.util.concurrent.TimeUnit;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.TAE;
import gregtech.api.enums.Textures;
@@ -8,7 +10,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Config;
import gtPlusPlus.core.block.ModBlocks;
@@ -16,16 +17,21 @@ import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
-public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTileEntity_MultiBlockBase {
+public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMeta_MultiBlockBase {
private static boolean controller;
protected int mAverageEuUsage = 0;
+ protected long mTotalEnergyAdded = 0;
+ protected long mTotalEnergyConsumed = 0;
+ protected long mTotalEnergyLost = 0;
+ protected long mTotalRunTime = 0;
public GregtechMetaTileEntity_PowerSubStationController(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -52,8 +58,8 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
"Hatches can be placed nearly anywhere",
"Minimum 1x Energy Input Hatch",
"Minimum 1x Energy Dynamo Hatch",
- "1x Input Bus",
- "1x Output Bus",
+ "1x Charge Bus",
+ "1x Discharge Bus",
"1x Maintenance hatch",
"--------------------------------------------------------------------------",
CORE.GT_Tooltip};
@@ -317,13 +323,19 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
long mActualStoredEU = 0;
-
+ //mTotalEnergyAdded
@Override
public void saveNBTData(NBTTagCompound aNBT) {
aNBT.setLong("mPowerStorageBuffer", this.mPowerStorageBuffer);
aNBT.setInteger("mPowerStorageMultiplier", this.mPowerStorageMultiplier);
aNBT.setLong("mActualStoredEU", this.mActualStoredEU);
aNBT.setInteger("mAverageEuUsage", this.mAverageEuUsage);
+
+ //Usage Stats
+ aNBT.setLong("mTotalEnergyAdded", this.mTotalEnergyAdded);
+ aNBT.setLong("mTotalEnergyLost", this.mTotalEnergyLost);
+ aNBT.setLong("mTotalEnergyConsumed", this.mTotalEnergyConsumed);
+ aNBT.setLong("mTotalRunTime", this.mTotalRunTime);
super.saveNBTData(aNBT);
}
@@ -333,6 +345,13 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
this.mPowerStorageMultiplier = aNBT.getInteger("mPowerStorageMultiplier");
this.mActualStoredEU = aNBT.getLong("mActualStoredEU");
this.mAverageEuUsage = aNBT.getInteger("mAverageEuUsage");
+
+ //Usage Stats
+ this.mTotalEnergyAdded = aNBT.getLong("mTotalEnergyAdded");
+ this.mTotalEnergyLost = aNBT.getLong("mTotalEnergyLost");
+ this.mTotalEnergyConsumed = aNBT.getLong("mTotalEnergyConsumed");
+ this.mTotalRunTime = aNBT.getLong("mTotalRunTime");
+
super.loadNBTData(aNBT);
}
@@ -345,13 +364,19 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
this.mActualStoredEU = this.getEUVar();
+ if (aBaseMetaTileEntity.isServerSide()){
+ this.mTotalRunTime++;
+ }
//Handle Progress Time
if (this.mActualStoredEU >= 0 && this.getBaseMetaTileEntity().isAllowedToWork()){
this.mProgresstime = 20;
this.mMaxProgresstime = 40;
//Use 10% of average EU determined by adding in/output voltage of all hatches and averaging.
- this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(MathUtils.roundToClosestInt(mAverageEuUsage/100), false);
+ int mDecrease = MathUtils.roundToClosestInt(mAverageEuUsage);
+ this.mTotalEnergyLost+=mDecrease;
+ this.setEUVar(this.getEUVar()-mDecrease);
+ //this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mDecrease, false);
}
else {
this.mProgresstime = 0;
@@ -371,6 +396,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
long voltage = energy.maxEUInput();
if (stored > 0){
energy.setEUVar((stored-voltage));
+ this.mTotalEnergyAdded+=voltage;
this.getBaseMetaTileEntity().increaseStoredEnergyUnits(voltage, false);
}
}
@@ -425,6 +451,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
for (GT_MetaTileEntity_Hatch_Dynamo tHatch : this.mDynamoHatches) {
if ((isValidMetaTileEntity(tHatch)) && (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(tHatch.getOutputTier()*2, false))) {
this.setEUVar(this.getEUVar()-(tHatch.getOutputTier()*2));
+ this.mTotalEnergyConsumed+=(tHatch.getOutputTier()*2);
//this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(tHatch.getOutputTier()*2, false);
//Utils.LOG_INFO("Hatch "+hatchCount+" has "+tHatch.getEUVar()+"eu stored. Avg used is "+(this.mAverageEuUsage));
}
@@ -448,4 +475,42 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
return 0;
}
+ //mAverageEuUsage
+
+ @Override
+ public String[] getInfoData() {
+
+ long seconds = (this.mTotalRunTime/20);
+
+ int weeks = (int) (TimeUnit.SECONDS.toDays(seconds) / 7);
+ int days = (int) (TimeUnit.SECONDS.toDays(seconds) - 7 * weeks);
+ long hours = TimeUnit.SECONDS.toHours(seconds) - TimeUnit.DAYS.toHours(days) - TimeUnit.DAYS.toHours(7*weeks);
+ long minutes = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
+ long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60);
+
+
+
+ return new String[]{
+ "Ergon Energy - District Sub-Station",
+ "EU Required: "+this.mAverageEuUsage+"EU/t",
+ "Stats for Nerds",
+ "Total Input: "+this.mTotalEnergyAdded+"EU",
+ "Total Output: "+this.mTotalEnergyConsumed+"EU",
+ "Total Wasted: "+this.mTotalEnergyLost+"EU",
+
+ "Total Time Since Build: ",
+ ""+weeks+" Weeks.",
+ ""+days+" Days.",
+ ""+hours+" Hours.",
+ ""+minutes+" Minutes.",
+ ""+second+" Seconds.",
+ "Total Time in ticks: "+this.mTotalRunTime};
+
+ };
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java
index 82cbf685ad..5725ebe368 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java
@@ -1,8 +1,15 @@
package gtPlusPlus.xmod.gregtech.registration.gregtech;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.OreDictNames;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.util.GT_ModHandler;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntity_PowerSubStationController;
public class GregtechPowerSubStation {
@@ -21,6 +28,17 @@ public class GregtechPowerSubStation {
// Steam Condensors
GregtechItemList.PowerSubStation.set(new GregtechMetaTileEntity_PowerSubStationController(812,
"substation.01.input.single", "Power Station Control Node").getStackForm(1L));
+ int tID = 886;
+ GregtechItemList.Hatch_Input_Battery_MV.set(new GT_MetaTileEntity_Hatch_InputBattery(tID++, "hatch.input_battery.tier.00", "Charging Bus (MV)", 0).getStackForm(1L));
+ GregtechItemList.Hatch_Input_Battery_EV.set(new GT_MetaTileEntity_Hatch_InputBattery(tID++, "hatch.input_battery.tier.01", "Charging Bus (EV)", 1).getStackForm(1L));
+ GregtechItemList.Hatch_Output_Battery_MV.set(new GT_MetaTileEntity_Hatch_OutputBattery(tID++, "hatch.output_battery.tier.00", "Discharging Bus (MV)", 0).getStackForm(1L));
+ GregtechItemList.Hatch_Output_Battery_EV.set(new GT_MetaTileEntity_Hatch_OutputBattery(tID++, "hatch.output_battery.tier.01", "Discharging Bus (EV)", 1).getStackForm(1L));
+
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Input_Battery_MV.get(1L, new Object[0]), CI.bitsd, new Object[]{"C", "M", 'M', ItemList.Hull_MV, 'C', ItemList.Battery_Buffer_2by2_MV});
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Input_Battery_EV.get(1L, new Object[0]), CI.bitsd, new Object[]{"C", "M", 'M', ItemList.Hull_EV, 'C', ItemList.Battery_Buffer_4by4_EV});
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Output_Battery_MV.get(1L, new Object[0]), CI.bitsd, new Object[]{"M", "C", 'M', ItemList.Hull_MV, 'C', ItemList.Battery_Buffer_2by2_MV});
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Output_Battery_EV.get(1L, new Object[0]), CI.bitsd, new Object[]{"M", "C", 'M', ItemList.Hull_EV, 'C', ItemList.Battery_Buffer_4by4_EV});
+
}
}