aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/gui')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java231
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java280
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine_NoPlayerInventory.java27
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Cyclotron.java44
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java291
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine_Default.java68
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java184
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java122
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java4
9 files changed, 985 insertions, 266 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java
index 921871cebe..6d0eb6b14c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java
@@ -1,232 +1,37 @@
package gtPlusPlus.xmod.gregtech.api.gui;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.gui.GT_ContainerMetaTile_Machine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.util.GT_LanguageManager;
-import java.util.Iterator;
-import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.inventory.ICrafting;
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ * <p/>
+ * The Container I use for all my Basic Machines
+ */
public class CONTAINER_Cyclotron extends GT_ContainerMetaTile_Machine {
-
- public int mActive = 0;
- public int mMaxProgressTime = 0;
- public int mProgressTime = 0;
- public long mEnergy = 0;
- public int mSteam = 0;
- public int mSteamStorage = 0;
- public int mStorage = 0;
- public int mOutput = 0;
- public int mInput = 0;
- public int mID = 0;
- public int mDisplayErrorCode = 0;
- private int oActive = 0;
- private int oMaxProgressTime = 0;
- private int oProgressTime = 0;
- private long oEnergy = 0;
- private int oSteam = 0;
- private int oSteamStorage = 0;
- private int oStorage = 0;
- private int oOutput = 0;
- private int oInput = 0;
- private int oID = 0;
- private int oDisplayErrorCode = 0;
- private int mTimer = 0;
- public CONTAINER_Cyclotron(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
- super(aInventoryPlayer, aTileEntity);
- this.mTileEntity = aTileEntity;
- if (this.mTileEntity != null && this.mTileEntity.getMetaTileEntity() != null) {
- this.addSlots(aInventoryPlayer);
- if (this.doesBindPlayerInventory()) {
- this.bindPlayerInventory(aInventoryPlayer);
- }
-
- this.detectAndSendChanges();
- } else {
- aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer;
- }
+ public CONTAINER_Cyclotron(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) {
- }
-
- public CONTAINER_Cyclotron(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity,
- boolean doesBindInventory) {
super(aInventoryPlayer, aTileEntity);
- this.mTileEntity = aTileEntity;
- if (this.mTileEntity != null && this.mTileEntity.getMetaTileEntity() != null) {
- this.addSlots(aInventoryPlayer);
- if (this.doesBindPlayerInventory() && doesBindInventory) {
- this.bindPlayerInventory(aInventoryPlayer);
- }
-
- this.detectAndSendChanges();
- } else {
- aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer;
- }
-
}
- public void detectAndSendChanges() {
- super.detectAndSendChanges();
- if (!this.mTileEntity.isClientSide() && this.mTileEntity.getMetaTileEntity() != null) {
- this.mStorage = (int) Math.min(2147483647L, this.mTileEntity.getEUCapacity());
- this.mEnergy = this.mTileEntity.getStoredEU();
- this.mSteamStorage = (int) Math.min(2147483647L, this.mTileEntity.getSteamCapacity());
- this.mSteam = (int) Math.min(2147483647L, this.mTileEntity.getStoredSteam());
- this.mOutput = (int) Math.min(2147483647L, this.mTileEntity.getOutputVoltage());
- this.mInput = (int) Math.min(2147483647L, this.mTileEntity.getInputVoltage());
- this.mDisplayErrorCode = this.mTileEntity.getErrorDisplayID();
- this.mProgressTime = this.mTileEntity.getProgress();
- this.mMaxProgressTime = this.mTileEntity.getMaxProgress();
- this.mActive = this.mTileEntity.isActive() ? 1 : 0;
- ++this.mTimer;
- Iterator var2 = this.crafters.iterator();
-
- while (true) {
- ICrafting var1;
- do {
- if (!var2.hasNext()) {
- this.oID = this.mID;
- this.oSteam = this.mSteam;
- this.oInput = this.mInput;
- this.oActive = this.mActive;
- this.oOutput = this.mOutput;
- this.oEnergy = this.mEnergy;
- this.oStorage = this.mStorage;
- this.oSteamStorage = this.mSteamStorage;
- this.oProgressTime = this.mProgressTime;
- this.oMaxProgressTime = this.mMaxProgressTime;
- this.oDisplayErrorCode = this.mDisplayErrorCode;
- return;
- }
-
- var1 = (ICrafting) var2.next();
- if (this.mTimer % 500 == 10 || this.oEnergy != this.mEnergy) {
-
- int uEnergy = (int) Math.min(2147483647L, this.mTileEntity.getStoredEU());
-
- var1.sendProgressBarUpdate(this, 0, uEnergy & '￿');
- var1.sendProgressBarUpdate(this, 1, uEnergy >>> 16);
- }
-
- if (this.mTimer % 500 == 10 || this.oStorage != this.mStorage) {
- var1.sendProgressBarUpdate(this, 2, this.mStorage & '￿');
- var1.sendProgressBarUpdate(this, 3, this.mStorage >>> 16);
- }
-
- if (this.mTimer % 500 == 10 || this.oOutput != this.mOutput) {
- var1.sendProgressBarUpdate(this, 4, this.mOutput);
- }
-
- if (this.mTimer % 500 == 10 || this.oInput != this.mInput) {
- var1.sendProgressBarUpdate(this, 5, this.mInput);
- }
-
- if (this.mTimer % 500 == 10 || this.oDisplayErrorCode != this.mDisplayErrorCode) {
- var1.sendProgressBarUpdate(this, 6, this.mDisplayErrorCode);
- }
-
- if (this.mTimer % 500 == 10 || this.oProgressTime != this.mProgressTime) {
- var1.sendProgressBarUpdate(this, 11, this.mProgressTime & '￿');
- var1.sendProgressBarUpdate(this, 12, this.mProgressTime >>> 16);
- }
-
- if (this.mTimer % 500 == 10 || this.oMaxProgressTime != this.mMaxProgressTime) {
- var1.sendProgressBarUpdate(this, 13, this.mMaxProgressTime & '￿');
- var1.sendProgressBarUpdate(this, 14, this.mMaxProgressTime >>> 16);
- }
-
- if (this.mTimer % 500 == 10 || this.oID != this.mID) {
- var1.sendProgressBarUpdate(this, 15, this.mID);
- }
-
- if (this.mTimer % 500 == 10 || this.oActive != this.mActive) {
- var1.sendProgressBarUpdate(this, 16, this.mActive);
- }
-
- if (this.mTimer % 500 == 10 || this.oSteam != this.mSteam) {
- var1.sendProgressBarUpdate(this, 17, this.mSteam & '￿');
- var1.sendProgressBarUpdate(this, 18, this.mSteam >>> 16);
- }
- } while (this.mTimer % 500 != 10 && this.oSteamStorage == this.mSteamStorage);
-
- var1.sendProgressBarUpdate(this, 19, this.mSteamStorage & '￿');
- var1.sendProgressBarUpdate(this, 20, this.mSteamStorage >>> 16);
- }
- }
+ public CONTAINER_Cyclotron(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) {
+ super(aInventoryPlayer, aTileEntity, bindInventory);
}
- @SideOnly(Side.CLIENT)
- public void updateProgressBar(int par1, int par2) {
- super.updateProgressBar(par1, par2);
- switch (par1) {
- case 0 :
- this.mEnergy = this.mEnergy & -65536 | par2;
- break;
- case 1 :
- this.mEnergy = this.mEnergy & '￿' | par2 << 16;
- break;
- case 2 :
- this.mStorage = this.mStorage & -65536 | par2;
- break;
- case 3 :
- this.mStorage = this.mStorage & '￿' | par2 << 16;
- break;
- case 4 :
- this.mOutput = par2;
- break;
- case 5 :
- this.mInput = par2;
- break;
- case 6 :
- this.mDisplayErrorCode = par2;
- case 7 :
- case 8 :
- case 9 :
- case 10 :
- default :
- break;
- case 11 :
- this.mProgressTime = this.mProgressTime & -65536 | par2;
- break;
- case 12 :
- this.mProgressTime = this.mProgressTime & '￿' | par2 << 16;
- break;
- case 13 :
- this.mMaxProgressTime = this.mMaxProgressTime & -65536 | par2;
- break;
- case 14 :
- this.mMaxProgressTime = this.mMaxProgressTime & '￿' | par2 << 16;
- break;
- case 15 :
- this.mID = par2;
- break;
- case 16 :
- this.mActive = par2;
- break;
- case 17 :
- this.mSteam = this.mSteam & -65536 | par2;
- break;
- case 18 :
- this.mSteam = this.mSteam & '￿' | par2 << 16;
- break;
- case 19 :
- this.mSteamStorage = this.mSteamStorage & -65536 | par2;
- break;
- case 20 :
- this.mSteamStorage = this.mSteamStorage & '￿' | par2 << 16;
- }
-
+ @Override
+ public void addSlots(final InventoryPlayer aInventoryPlayer) {
+ //this.addSlotToContainer(new Slot(this.mTileEntity, 1, 154, 42));
}
- public boolean canInteractWith(EntityPlayer player) {
- return this.mTileEntity.isUseableByPlayer(player);
+ @Override
+ public int getSlotCount() {
+ return 0;
}
- public String trans(String aKey, String aEnglish) {
- return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false);
+ @Override
+ public int getShiftClickSlotCount() {
+ return 0;
}
-} \ No newline at end of file
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java
index bdf19454ce..88b9661c95 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java
@@ -1,9 +1,22 @@
package gtPlusPlus.xmod.gregtech.api.gui;
-import net.minecraft.entity.player.InventoryPlayer;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.gui.GT_ContainerMetaTile_Machine;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Recipe;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ICrafting;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -11,6 +24,14 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
* The Container I use for all my Basic Machines
*/
public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine {
+
+ public String[] mTileDescription;
+ private String[] oTileDescription;
+
+ private GregtechMeta_MultiBlockBase mMCTEI;
+ private boolean mControllerSet = false;
+
+
public CONTAINER_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) {
super(aInventoryPlayer, aTileEntity);
}
@@ -18,20 +39,245 @@ public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine {
public CONTAINER_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) {
super(aInventoryPlayer, aTileEntity, bindInventory);
}
-}
+
+ public static void setControllerInstance(CONTAINER_MultiMachine aContainer, IGregTechTileEntity aTile) {
+ if (aTile == null) {
+ return;
+ }
+ final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return;
+ }
+ if (aMetaTileEntity instanceof GregtechMeta_MultiBlockBase) {
+ aContainer.mMCTEI = (GregtechMeta_MultiBlockBase) aMetaTileEntity;
+ }
+ }
+
+ public int aTotalTickTime = 0;
+ public int aMaxParallel = 0;
+ public int aPollutionTick = 0;
+ public int aMaxInputVoltage = 0;
+ public int aInputTier = 0;
+ public int aOutputTier = 0;
+ public int aRecipeDuration = 0;
+ public int aRecipeEU = 0;
+ public int aRecipeSpecial = 0;
+ public int aPollutionReduction = 0;
+ public int aStoredEnergy = 0;
+ public int aMaxEnergy = 0;
+ public int aEfficiency = 0;
+
+ private int oTotalTickTime = 0;
+ private int oMaxParallel = 0;
+ private int oPollutionTick = 0;
+ private int oMaxInputVoltage = 0;
+ private int oInputTier = 0;
+ private int oOutputTier = 0;
+ private int oRecipeDuration = 0;
+ private int oRecipeEU = 0;
+ private int oRecipeSpecial = 0;
+ private int oPollutionReduction = 0;
+ private int oStoredEnergy = 0;
+ private int oMaxEnergy = 0;
+ private int oEfficiency = 0;
+
+ private static Field timer;
+ //private static Field crafters;
+
+ @Override
+ public final void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (this.mTileEntity.isClientSide() || this.mTileEntity.getMetaTileEntity() == null) {
+ return;
+ }
+ if (!mControllerSet) {
+ setControllerInstance(this, this.mTileEntity);
+ }
+ mControllerSet = (mMCTEI != null);
+ if (timer == null) {
+ timer = ReflectionUtils.getField(getClass(), "mTimer");
+ }
+ if (crafters == null) {
+ //crafters = ReflectionUtils.getField(getClass(), "crafters");
+ }
+ if (timer != null && crafters != null && mControllerSet) {
+ //Logger.INFO("Trying to update clientside GUI data");
+ try {
+ //Logger.INFO("0");
+ int aTimer = (int) ReflectionUtils.getFieldValue(timer, this);
+
+ //List crafters1List = (List) crafters1;
+ List<ICrafting> crafters2 = new ArrayList<ICrafting>();
+ //Logger.INFO("1");
+ for (Object o : crafters) {
+ if (o instanceof ICrafting) {
+ crafters2.add((ICrafting) o);
+ }
+ }
+ //Logger.INFO("2");
+ if (!crafters2.isEmpty()) {
+ //Logger.INFO("3");
+ handleInitialFieldSetting();
+
+ try {
+ //Logger.INFO("4");
+ for (final ICrafting var3 : crafters2) {
+ handleCraftingEvent(aTimer, var3);
+ }
+ //Logger.INFO("5");
+ handleInternalFieldSetting();
+ //Logger.INFO("6");
+ } catch (Throwable t) {
-/*@Override
- public void addSlots(InventoryPlayer aInventoryPlayer) {
- addSlotToContainer(new Slot(mTileEntity, 1, 152, 5));
- }
-
- @Override
- public int getSlotCount() {
- return 1;
- }
-
- @Override
- public int getShiftClickSlotCount() {
- return 0;
- }
-}*/
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ else {
+ Logger.INFO("Failed.");
+ }
+ }
+
+ public void handleInitialFieldSetting() {
+ this.aTotalTickTime = MathUtils.balance((int) mMCTEI.getTotalRuntimeInTicks(), Integer.MIN_VALUE, Integer.MAX_VALUE);
+ this.aMaxParallel = mMCTEI.getMaxParallelRecipes();
+ this.aPollutionTick = mMCTEI.getPollutionPerTick(null);
+ this.aMaxInputVoltage = MathUtils.balance((int) mMCTEI.getMaxInputVoltage(), Integer.MIN_VALUE, Integer.MAX_VALUE);
+ this.aInputTier = MathUtils.balance((int) mMCTEI.getInputTier(), Integer.MIN_VALUE, Integer.MAX_VALUE);
+ this.aOutputTier = MathUtils.balance((int) mMCTEI.getOutputTier(), Integer.MIN_VALUE, Integer.MAX_VALUE);
+ if (mMCTEI.mLastRecipe != null) {
+ GT_Recipe aRecipe = mMCTEI.mLastRecipe;
+ this.aRecipeDuration = MathUtils.balance(aRecipe.mDuration, Integer.MIN_VALUE, Integer.MAX_VALUE);
+ this.aRecipeEU = MathUtils.balance(aRecipe.mEUt, Integer.MIN_VALUE, Integer.MAX_VALUE);
+ this.aRecipeSpecial = MathUtils.balance(aRecipe.mSpecialValue, Integer.MIN_VALUE, Integer.MAX_VALUE);
+ }
+ this.aPollutionReduction = mMCTEI.getPollutionReductionForAllMufflers();
+
+ this.aStoredEnergy = MathUtils.balance((int) mMCTEI.getStoredEnergyInAllEnergyHatches(), Integer.MIN_VALUE, Integer.MAX_VALUE);
+ this.aMaxEnergy = MathUtils.balance((int) mMCTEI.getMaxEnergyStorageOfAllEnergyHatches(), Integer.MIN_VALUE, Integer.MAX_VALUE);
+ this.aEfficiency = MathUtils.balance(mMCTEI.mEfficiency, Integer.MIN_VALUE, Integer.MAX_VALUE);
+ }
+
+ public void handleCraftingEvent(int aTimer, ICrafting aCrafter) {
+ int aID = 750;
+ if (aTimer % 500 == 10 || this.oTotalTickTime != this.aTotalTickTime) {
+ aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aTotalTickTime);
+ }
+ if (aTimer % 500 == 10 || this.oMaxParallel != this.aMaxParallel) {
+ aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aMaxParallel);
+ }
+ if (aTimer % 500 == 10 || this.oPollutionTick != this.aPollutionTick) {
+ aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aPollutionTick);
+ }
+ if (aTimer % 500 == 10 || this.oMaxInputVoltage != this.aMaxInputVoltage) {
+ aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aMaxInputVoltage);
+ }
+ if (aTimer % 500 == 10 || this.oInputTier != this.aInputTier) {
+ aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aInputTier);
+ }
+ if (aTimer % 500 == 10 || this.oOutputTier != this.aOutputTier) {
+ aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aOutputTier);
+ }
+ if (aTimer % 500 == 10 || this.oRecipeDuration != this.aRecipeDuration) {
+ aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aRecipeDuration);
+ }
+ if (aTimer % 500 == 10 || this.oRecipeEU != this.aRecipeEU) {
+ aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aRecipeEU);
+ }
+ if (aTimer % 500 == 10 || this.oRecipeSpecial != this.aRecipeSpecial) {
+ aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aRecipeSpecial);
+ }
+ if (aTimer % 500 == 10 || this.oPollutionReduction != this.aPollutionReduction) {
+ aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aPollutionReduction);
+ }
+ if (aTimer % 500 == 10 || this.oStoredEnergy != this.aStoredEnergy) {
+ aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aStoredEnergy);
+ }
+ if (aTimer % 500 == 10 || this.oMaxEnergy != this.aMaxEnergy) {
+ aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aMaxEnergy);
+ }
+ if (aTimer % 500 == 10 || this.oEfficiency != this.aEfficiency) {
+ aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aEfficiency);
+ }
+ }
+
+ public void handleInternalFieldSetting() {
+ this.oTotalTickTime = this.aTotalTickTime;
+ this.oMaxParallel = this.aMaxParallel;
+ this.oPollutionTick = this.aPollutionTick;
+ this.oMaxInputVoltage = this.aMaxInputVoltage;
+ this.oInputTier = this.aInputTier;
+ this.oOutputTier = this.aOutputTier;
+ this.oRecipeDuration = this.aRecipeDuration;
+ this.oRecipeEU = this.aRecipeEU;
+ this.oRecipeSpecial = this.aRecipeSpecial;
+ this.oPollutionReduction = this.aPollutionReduction;
+ this.oStoredEnergy = this.aStoredEnergy;
+ this.oMaxEnergy = this.aMaxEnergy;
+ this.oEfficiency = this.aEfficiency;
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public void updateProgressBar(final int par1, final int par2) {
+ super.updateProgressBar(par1, par2);
+ int shiftedSwitch = par1 - 750;
+ switch (shiftedSwitch) {
+ case 0: {
+ this.aTotalTickTime = par2;
+ break;
+ }
+ case 1: {
+ this.aMaxParallel = par2;
+ break;
+ }
+ case 2: {
+ this.aPollutionTick = par2;
+ break;
+ }
+ case 3: {
+ this.aMaxInputVoltage = par2;
+ break;
+ }
+ case 4: {
+ this.aInputTier = par2;
+ break;
+ }
+ case 5: {
+ this.aOutputTier = par2;
+ break;
+ }
+ case 6: {
+ this.aRecipeDuration = par2;
+ break;
+ }
+ case 7: {
+ this.aRecipeEU = par2;
+ break;
+ }
+ case 8: {
+ this.aRecipeSpecial = par2;
+ break;
+ }
+ case 9: {
+ this.aPollutionReduction = par2;
+ break;
+ }
+ case 10: {
+ this.aStoredEnergy = par2;
+ break;
+ }
+ case 11: {
+ this.aMaxEnergy = par2;
+ break;
+ }
+ case 12: {
+ this.aEfficiency = par2;
+ break;
+ }
+ }
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine_NoPlayerInventory.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine_NoPlayerInventory.java
new file mode 100644
index 0000000000..2d63a13d60
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine_NoPlayerInventory.java
@@ -0,0 +1,27 @@
+package gtPlusPlus.xmod.gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+
+public class CONTAINER_MultiMachine_NoPlayerInventory extends CONTAINER_MultiMachine {
+
+ public CONTAINER_MultiMachine_NoPlayerInventory(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ public CONTAINER_MultiMachine_NoPlayerInventory(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) {
+ super(aInventoryPlayer, aTileEntity, bindInventory);
+ }
+
+ public boolean doesBindPlayerInventory() {
+ return false;
+ }
+
+ @Override
+ public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) {
+ return null;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Cyclotron.java
new file mode 100644
index 0000000000..0be44fa616
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Cyclotron.java
@@ -0,0 +1,44 @@
+package gtPlusPlus.xmod.gregtech.api.gui;
+
+import gregtech.api.gui.GT_Container_MultiMachine;
+import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class GUI_Cyclotron extends GT_GUIContainerMetaTile_Machine
+{
+ public final String mNEI;
+ public final String mName;
+
+ public GUI_Cyclotron(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aNEI) {
+ super(new GT_Container_MultiMachine(aInventoryPlayer, aTileEntity, false), "gregtech:textures/gui/multimachines/" + "FusionComputer.png");
+ this.mName = aName;
+ this.mNEI = aNEI;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(final int par1, final int par2) {
+ this.fontRendererObj.drawString(this.mName, 8, -10, 16448255);
+ if (this.mContainer != null) {
+ if ((((GT_Container_MultiMachine)this.mContainer).mDisplayErrorCode & 0x40) != 0x0) {
+ this.fontRendererObj.drawString("Incomplete Structure.", 10, 8, 16448255);
+ }
+ if (((GT_Container_MultiMachine)this.mContainer).mDisplayErrorCode == 0) {
+ if (((GT_Container_MultiMachine)this.mContainer).mActive == 0) {
+ this.fontRendererObj.drawString("Hit with Soft Hammer to (re-)start the Machine if it doesn't start.", -70, 170, 16448255);
+ }
+ else {
+ this.fontRendererObj.drawString("Running perfectly.", 10, 170, 16448255);
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ final int x = (this.width - this.xSize) / 2;
+ final int y = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java
index 425fe6d01f..c78e7789b8 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java
@@ -1,12 +1,26 @@
package gtPlusPlus.xmod.gregtech.api.gui;
-import net.minecraft.entity.player.InventoryPlayer;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Materials;
import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-
+import gregtech.api.util.GT_Utility;
+import gregtech.common.items.GT_MetaGenerated_Tool_01;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -17,52 +31,261 @@ import gtPlusPlus.core.lib.CORE;
*/
public class GUI_MultiMachine extends GT_GUIContainerMetaTile_Machine {
- String mName = "";
+ private final static Materials GOOD;
+ private final static Materials BAD;
+ private final String mName;
+
+ private final static ConcurrentHashMap<String, ItemStack> mToolStacks = new ConcurrentHashMap<String, ItemStack>();
+
+ //net.minecraft.client.gui.inventory.GuiContainer.drawItemStack(ItemStack, int, int, String)
+ private final static Method mDrawItemStack;
+
+ static {
+ GOOD = Materials.Uranium;
+ BAD = Materials.Plutonium;
+
+ //net.minecraft.client.gui.inventory.GuiContainer.drawItemStack(ItemStack, int, int, String)
+ mDrawItemStack = ReflectionUtils.getMethod(GuiContainer.class, "drawItemStack", new Class[] {ItemStack.class, int.class, int.class, String.class});
+ }
public GUI_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aTextureFile) {
- super(new CONTAINER_MultiMachine(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile));
- this.mName = aName;
+ super(new CONTAINER_MultiMachine_NoPlayerInventory(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile));
+ this.mName = aName != null ? aName : "";
}
@Override
- protected void drawGuiContainerForegroundLayer(final int par1, final int par2) {
- this.fontRendererObj.drawString(this.mName, 10, 8, 16448255);
-
+ protected void drawGuiContainerForegroundLayer(final int par1, final int par2) {
if (this.mContainer != null) {
- if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 1) != 0) {
- this.fontRendererObj.drawString("Pipe is loose.", 10, 16, 16448255);
- }
- if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 2) != 0) {
- this.fontRendererObj.drawString("Screws are missing.", 10, 24, 16448255);
- }
- if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 4) != 0) {
- this.fontRendererObj.drawString("Something is stuck.", 10, 32, 16448255);
- }
- if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 8) != 0) {
- this.fontRendererObj.drawString("Platings are dented.", 10, 40, 16448255);
- }
- if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 16) != 0) {
- this.fontRendererObj.drawString("Circuitry burned out.", 10, 48, 16448255);
- }
- if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 32) != 0) {
- this.fontRendererObj.drawString("That doesn't belong there.", 10, 56, 16448255);
+ drawGuiInfoTextLayer(par1, par2);
+ drawGuiRepairStatusLayer(par1, par2);
+ }
+ }
+
+
+ protected void drawGuiInfoTextLayer(final float par1, final int par2) {
+
+ if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 64) != 0) {
+ this.fontRendererObj.drawString(mName, 6, 7, 16448255); // Move down 8px
+ this.fontRendererObj.drawString("Incomplete Structure.", 6, 15, 16448255); // Move down 8px
+ }
+ else {
+ int aTotalTickTime = ((CONTAINER_MultiMachine) this.mContainer).aTotalTickTime;
+ int aMaxParallel = ((CONTAINER_MultiMachine) this.mContainer).aMaxParallel;
+ int aPollutionTick = ((CONTAINER_MultiMachine) this.mContainer).aPollutionTick;
+ int aMaxInputVoltage = ((CONTAINER_MultiMachine) this.mContainer).aMaxInputVoltage;
+ int aInputTier = ((CONTAINER_MultiMachine) this.mContainer).aInputTier;
+ int aOutputTier = ((CONTAINER_MultiMachine) this.mContainer).aOutputTier;
+ int aRecipeDuration = ((CONTAINER_MultiMachine) this.mContainer).aRecipeDuration;
+ int aRecipeEU = ((CONTAINER_MultiMachine) this.mContainer).aRecipeEU;
+ int aRecipeSpecial = ((CONTAINER_MultiMachine) this.mContainer).aRecipeSpecial;
+ int aEfficiency = ((CONTAINER_MultiMachine) this.mContainer).aEfficiency;
+
+ int aPollutionReduction = ((CONTAINER_MultiMachine) this.mContainer).aPollutionReduction;
+
+
+ long aStoredEnergy = ((CONTAINER_MultiMachine) this.mContainer).aStoredEnergy;
+ long aMaxEnergy = ((CONTAINER_MultiMachine) this.mContainer).aMaxEnergy;
+
+ /*
+ * Logic Block
+ */
+
+ long seconds = (aTotalTickTime/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);
+
+ ArrayList<String> mInfo = new ArrayList<String>();
+
+ String EU = StatCollector.translateToLocal("GTPP.info.eu");
+
+ //GTPP.machines.tier
+
+ mInfo.add(mName);
+
+ if (aInputTier > 0) {
+ mInfo.add(StatCollector.translateToLocal("GTPP.machines.input")+" "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+ EnumChatFormatting.GREEN +GT_Values.VOLTAGE_NAMES[aInputTier]);
}
- if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 64) != 0) {
- this.fontRendererObj.drawString("Incomplete Structure.", 10, 64, 16448255);
+ if (aOutputTier > 0) {
+ mInfo.add(StatCollector.translateToLocal("GTPP.machines.output")+" "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+ EnumChatFormatting.GREEN +GT_Values.VOLTAGE_NAMES[aOutputTier]);
+ }
+
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.progress")+": "+
+ EnumChatFormatting.GREEN + Integer.toString(((CONTAINER_MultiMachine) this.mContainer).mProgressTime/20) + EnumChatFormatting.RESET +" s / "+
+ EnumChatFormatting.YELLOW + Integer.toString(((CONTAINER_MultiMachine) this.mContainer).mMaxProgressTime/20) + EnumChatFormatting.RESET +" s");
+
+
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+": "+
+ EnumChatFormatting.GREEN + Long.toString(aStoredEnergy) + EnumChatFormatting.RESET +" "+EU+" / "+
+ EnumChatFormatting.YELLOW + Long.toString(aMaxEnergy) + EnumChatFormatting.RESET +" "+EU+"");
+
+ if (aRecipeEU != 0 && aRecipeDuration > 0) {
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage")+": "+
+ EnumChatFormatting.RED + Integer.toString(-aRecipeEU) + EnumChatFormatting.RESET + " "+EU+"/t");
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.duration")+": "+
+ EnumChatFormatting.RED + Integer.toString(aRecipeDuration) + EnumChatFormatting.RESET + " ticks");
+ if (aRecipeSpecial > 0) {
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.specialvalue")+": "+
+ EnumChatFormatting.RED + Integer.toString(aRecipeEU) + EnumChatFormatting.RESET + "");
+ }
+ }
+
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei")+": "+
+ EnumChatFormatting.YELLOW+Long.toString(aMaxInputVoltage)+EnumChatFormatting.RESET+ " "+EU+"/t"+EnumChatFormatting.RESET);
+
+ mInfo.add(StatCollector.translateToLocal(StatCollector.translateToLocal("GTPP.machines.tier")+": "+
+ EnumChatFormatting.YELLOW+GT_Values.VN[GT_Utility.getTier(aMaxInputVoltage)]+ EnumChatFormatting.RESET));
+
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.efficiency")+": "+ EnumChatFormatting.YELLOW+Float.toString(aEfficiency / 100.0F)+EnumChatFormatting.RESET + " %");
+
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollution")+": "+ EnumChatFormatting.RED + (aPollutionTick*20)+ EnumChatFormatting.RESET+"/sec");
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced")+": "+ EnumChatFormatting.GREEN + aPollutionReduction + EnumChatFormatting.RESET+" %");
+
+ mInfo.add(StatCollector.translateToLocal("GTPP.CC.parallel")+": "+EnumChatFormatting.GREEN+(aMaxParallel)+EnumChatFormatting.RESET);
+
+ mInfo.add("Total Time Since Built: ");
+ mInfo.add("" + EnumChatFormatting.DARK_GREEN + Integer.toString(weeks)+EnumChatFormatting.RESET+" Weeks,");
+ mInfo.add("" + EnumChatFormatting.DARK_GREEN+ Integer.toString(days) +EnumChatFormatting.RESET+ " Days,");
+ mInfo.add("" + EnumChatFormatting.DARK_GREEN+ Long.toString(hours) +EnumChatFormatting.RESET+ " Hours,");
+ mInfo.add("" + EnumChatFormatting.DARK_GREEN+ Long.toString(minutes) +EnumChatFormatting.RESET+ " Minutes,");
+ mInfo.add("" + EnumChatFormatting.DARK_GREEN+ Long.toString(second) +EnumChatFormatting.RESET+ " Seconds");
+
+
+
+ // Machine Name
+ //fontRendererObj.drawString(this.mName, 6, 7, 16448255);
+
+ for (int i=0;i<mInfo.size();i++) {
+ fontRendererObj.drawString(mInfo.get(i), 6, 7+(i*8), 16448255);
}
- if (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode == 0) {
- if (((CONTAINER_MultiMachine) this.mContainer).mActive == 0) {
- this.fontRendererObj.drawString("Hit with Soft Hammer", 10, 16, 16448255);
- this.fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255);
- this.fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255);
- } else {
- this.fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255);
+ }
+
+
+
+
+ }
+
+
+ protected void drawGuiRepairStatusLayer(final float par1, final int par2) {
+
+ boolean aWrench = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 1) != 0;
+ boolean aScrewdriver = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 2) != 0;
+ boolean aMallet = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 4) != 0;
+ boolean aHammer = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 8) != 0;
+ boolean aSoldering = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 16) != 0;
+ boolean aCrowbar = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 32) != 0;
+
+ if (mToolStacks.isEmpty()) {
+ // Map Stacks of Repair items
+ aWrench = false;
+ aScrewdriver = false;
+ aMallet = false;
+ aHammer = false;
+ aSoldering = false;
+ aCrowbar = false;
+ mToolStacks.put(aWrench+"WRENCH", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.WRENCH, 1, (aWrench ? BAD : GOOD), Materials.Tungsten, null));
+ mToolStacks.put(aCrowbar+"CROWBAR", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithSta