aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api
diff options
context:
space:
mode:
authorbotn365 <42187820+botn365@users.noreply.github.com>2019-12-30 03:55:42 +0100
committerGitHub <noreply@github.com>2019-12-30 03:55:42 +0100
commitfa1a1f4a6cd8dee8011a8f04fa6afbcc71d8db89 (patch)
treeb9f75736d90eb228de26ad8dcf9956bd1e6bd7e8 /src/Java/gtPlusPlus/xmod/gregtech/api
parenta731e939c6b9a70ac9fd444dbf06243f63f29c06 (diff)
parentd2ab710218628d51cd2ede566d50492238d797cf (diff)
downloadGT5-Unofficial-fa1a1f4a6cd8dee8011a8f04fa6afbcc71d8db89.tar.gz
GT5-Unofficial-fa1a1f4a6cd8dee8011a8f04fa6afbcc71d8db89.tar.bz2
GT5-Unofficial-fa1a1f4a6cd8dee8011a8f04fa6afbcc71d8db89.zip
Merge pull request #5 from alkcorp/master
sync fork
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java27
-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
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java33
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java103
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java532
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java212
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java8
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java13
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java800
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockRequirements.java114
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java35
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java3
27 files changed, 2117 insertions, 1032 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
index 933ec227ba..7c395392a3 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
@@ -39,6 +39,9 @@ public enum GregtechItemList implements GregtechItemContainer {
Emitter_ULV,
Sensor_ULV,
+ //Recipe Circuit
+ Circuit_BioRecipeSelector,
+
//Circuits
Old_Circuit_Primitive, Old_Circuit_Basic, Old_Circuit_Good,
Old_Circuit_Advanced, Old_Circuit_Data, Old_Circuit_Elite,
@@ -102,6 +105,7 @@ public enum GregtechItemList implements GregtechItemContainer {
Carbyne_Sheet_Finished,
//End Game Laser Engraver Lens
+ Laser_Lens_WoodsGlass,
Laser_Lens_Special,
//Bombs
@@ -109,6 +113,9 @@ public enum GregtechItemList implements GregtechItemContainer {
Bomb_Cast_Set, Bomb_Cast_Broken,
Bomb_Cast_Mold,
+ // Pellet Mold
+ Pellet_Mold,
+
//Charged Items for Tree Farms
Farm_Processor_EV,
Farm_Processor_IV,
@@ -224,7 +231,12 @@ public enum GregtechItemList implements GregtechItemContainer {
//Fish Pond
Industrial_FishingPond,
Casing_FishPond,
-
+
+ //Algae
+ AlgaeFarm_Controller,
+
+ //Chemical Plant
+ ChemicalPlant_Controller,
//GT4 autoCrafter
GT4_Multi_Crafter,
@@ -318,6 +330,9 @@ public enum GregtechItemList implements GregtechItemContainer {
Casing_Vacuum_Furnace,
Controller_Vacuum_Furnace,
+ // Large Rocket Engine
+ Casing_RocketEngine,
+ Controller_RocketEngine,
//----------------------------------------------------------------------------
@@ -336,6 +351,9 @@ public enum GregtechItemList implements GregtechItemContainer {
//XL Turbine Rotor Hatch
Hatch_Turbine_Rotor,
+ //Standard Turbine Rotor Hatch
+ Hatch_Input_TurbineHousing,
+
//Control Core
Hatch_Control_Core,
@@ -471,6 +489,10 @@ public enum GregtechItemList implements GregtechItemContainer {
Machine_ZPM_Component_Maker,
Machine_UV_Component_Maker,
+ // Fluid Reactor
+ FluidReactor_LV, FluidReactor_HV,
+ FluidReactor_IV, FluidReactor_ZPM,
+
//Breakers
BreakerBox_ULV, BreakerBox_LV, BreakerBox_MV,
BreakerBox_HV, BreakerBox_EV, BreakerBox_IV,
@@ -594,7 +616,7 @@ public enum GregtechItemList implements GregtechItemContainer {
FakeMachineCasingPlate_MV, FakeMachineCasingPlate_HV,
FakeMachineCasingPlate_EV, FakeMachineCasingPlate_IV,
FakeMachineCasingPlate_LuV, FakeMachineCasingPlate_ZPM,
- FakeMachineCasingPlate_UV, FakeMachineCasingPlate_MAX,
+ FakeMachineCasingPlate_UV, FakeMachineCasingPlate_MAX,
//----------------------------------------------------------------------------
@@ -607,7 +629,6 @@ public enum GregtechItemList implements GregtechItemContainer {
private ItemStack mStack;
private boolean mHasNotBeenSet = true;
- public static Fluid sOilExtraHeavy, sOilHeavy, sOilMedium, sOilLight, sNaturalGas;
@Override
public GregtechItemList set(final Item aItem) {
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.getToolWithStats(GT_MetaGenerated_Tool_01.CROWBAR, 1, (aCrowbar ? BAD : GOOD), Materials.Tungsten, null));
+ mToolStacks.put(aHammer+"HARDHAMMER", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.HARDHAMMER, 1, (aHammer ? BAD : GOOD), Materials.Tungsten, null));
+ mToolStacks.put(aMallet+"SOFTHAMMER", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SOFTHAMMER, 1, (aMallet ? BAD : GOOD), Materials.Tungsten, null));
+ mToolStacks.put(aScrewdriver+"SCREWDRIVER", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SCREWDRIVER, 1, (aScrewdriver ? BAD : GOOD), Materials.Tungsten, null));
+ mToolStacks.put(aSoldering+"SOLDERING_IRON_LV", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, 1, (aSoldering ? BAD : GOOD), Materials.Tungsten, null));
+
+ // Map Stacks of valid items
+ aWrench = true;
+ aScrewdriver = true;
+ aMallet = true;
+ aHammer = true;
+ aSoldering = true;
+ aCrowbar = true;
+ 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.getToolWithStats(GT_MetaGenerated_Tool_01.CROWBAR, 1, (aCrowbar ? BAD : GOOD), Materials.Tungsten, null));
+ mToolStacks.put(aHammer+"HARDHAMMER", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.HARDHAMMER, 1, (aHammer ? BAD : GOOD), Materials.Tungsten, null));
+ mToolStacks.put(aMallet+"SOFTHAMMER", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SOFTHAMMER, 1, (aMallet ? BAD : GOOD), Materials.Tungsten, null));
+ mToolStacks.put(aScrewdriver+"SCREWDRIVER", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SCREWDRIVER, 1, (aScrewdriver ? BAD : GOOD), Materials.Tungsten, null));
+ mToolStacks.put(aSoldering+"SOLDERING_IRON_LV", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, 1, (aSoldering ? BAD : GOOD), Materials.Tungsten, null));
+
+ ItemStack aGlassPane1 = ItemUtils.getItemStackOfAmountFromOreDict("paneGlassRed", 1);
+ ItemStack aGlassPane2 = ItemUtils.getItemStackOfAmountFromOreDict("paneGlassLime", 1);
+ mToolStacks.put("falseGLASS", aGlassPane1);
+ mToolStacks.put("trueGLASS", aGlassPane2);
+
+ // Reset vars to real state
+ aWrench = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 1) != 0;
+ aScrewdriver = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 2) != 0;
+ aMallet = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 4) != 0;
+ aHammer = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 8) != 0;
+ aSoldering = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 16) != 0;
+ aCrowbar = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 32) != 0;
+
+ }
+
+ ItemStack aWrenchStack;
+ ItemStack aCrowbarStack;
+ ItemStack aHammerStack;
+ ItemStack aMalletStack;
+ ItemStack aScrewdriverStack;
+ ItemStack aSolderingStack;
+ if (!mToolStacks.isEmpty() && mDrawItemStack != null) {
+
+ aWrenchStack = mToolStacks.get(aWrench + "WRENCH");
+ aCrowbarStack = mToolStacks.get(aCrowbar + "CROWBAR");
+ aHammerStack = mToolStacks.get(aHammer + "HARDHAMMER");
+ aMalletStack = mToolStacks.get(aMallet + "SOFTHAMMER");
+ aScrewdriverStack = mToolStacks.get(aScrewdriver + "SCREWDRIVER");
+ aSolderingStack = mToolStacks.get(aSoldering + "SOLDERING_IRON_LV");
+
+ try {
+
+ ItemStack[] aToolStacks2 = new ItemStack[] {
+ aWrenchStack, aCrowbarStack,
+ aHammerStack, aMalletStack,
+ aScrewdriverStack, aSolderingStack };
+
+ int aIndex = 0;
+ //Draw Repair status tools
+ for (aIndex = 0; aIndex < 6; aIndex++) {
+ int x = 156;
+ int y = 112 - (18 * 3) + (aIndex * 18);
+ mDrawItemStack.invoke(this,
+ new Object[] {
+ aToolStacks2[aIndex] != null ? aToolStacks2[aIndex]
+ : ItemUtils.getErrorStack(1, "Bad Times"),
+ x, y, "" + (aIndex == 2 ? "H" : aIndex == 3 ? "M" : "") // Stacksize Overlay
+ });
+ //this.fontRendererObj.drawString("", 10, 64, 16448255);
+ }
+
+ //Draw Running status
+ boolean running = ((CONTAINER_MultiMachine) this.mContainer).mActive != 0;
+ ItemStack aGlassPane = mToolStacks.get(running+"GLASS");
+
+ if (aGlassPane == null) {
+ aGlassPane = ItemUtils.getItemStackOfAmountFromOreDict("paneGlass" + (running ? "Lime" : "Red"), 1);
+ mToolStacks.put(running+"GLASS", aGlassPane);
}
+
+ mDrawItemStack.invoke(this,
+ new Object[] {
+ aGlassPane != null ? aGlassPane
+ : ItemUtils.getErrorStack(1, "Bad Times"),
+ 156,
+ 112 - (18 * 5),
+ running ? "On" : "Off"}); // Stacksize Overlay
+
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ e.printStackTrace();
}
}
+
+
+
+
}
+
@Override
protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) {
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine_Default.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine_Default.java
new file mode 100644
index 0000000000..0cfab4e71e
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine_Default.java
@@ -0,0 +1,68 @@
+package gtPlusPlus.xmod.gregtech.api.gui;
+
+import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_LanguageManager;
+import gtPlusPlus.core.lib.CORE;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class GUI_MultiMachine_Default extends GT_GUIContainerMetaTile_Machine
+{
+ String mName;
+
+ public GUI_MultiMachine_Default(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 = "";
+ this.mName = aName;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(final int par1, final int par2) {
+ this.fontRendererObj.drawString(this.mName, 10, 8, 16448255);
+ if (this.mContainer != null) {
+ if ((((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode & 0x1) != 0x0) {
+ this.fontRendererObj.drawString(this.trans("132", "Pipe is loose."), 10, 16, 16448255);
+ }
+ if ((((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode & 0x2) != 0x0) {
+ this.fontRendererObj.drawString(this.trans("133", "Screws are missing."), 10, 24, 16448255);
+ }
+ if ((((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode & 0x4) != 0x0) {
+ this.fontRendererObj.drawString(this.trans("134", "Something is stuck."), 10, 32, 16448255);
+ }
+ if ((((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode & 0x8) != 0x0) {
+ this.fontRendererObj.drawString(this.trans("135", "Platings are dented."), 10, 40, 16448255);
+ }
+ if ((((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode & 0x10) != 0x0) {
+ this.fontRendererObj.drawString(this.trans("136", "Circuitry burned out."), 10, 48, 16448255);
+ }
+ if ((((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode & 0x20) != 0x0) {
+ this.fontRendererObj.drawString(this.trans("137", "That doesn't belong there."), 10, 56, 16448255);
+ }
+ if ((((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode & 0x40) != 0x0) {
+ this.fontRendererObj.drawString(this.trans("138", "Incomplete Structure."), 10, 64, 16448255);
+ }
+ if (((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode == 0) {
+ if (((CONTAINER_MultiMachine)this.mContainer).mActive == 0) {
+ this.fontRendererObj.drawString(this.trans("139", "Hit with Soft Hammer"), 10, 16, 16448255);
+ this.fontRendererObj.drawString(this.trans("140", "to (re-)start the Machine"), 10, 24, 16448255);
+ this.fontRendererObj.drawString(this.trans("141", "if it doesn't start."), 10, 32, 16448255);
+ }
+ else {
+ this.fontRendererObj.drawString(this.trans("142", "Running perfectly."), 10, 16, 16448255);
+ }
+ }
+ }
+ }
+
+ public String trans(final String aKey, final String aEnglish) {
+ return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false);
+ }
+
+ @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/fluidreactor/Container_FluidReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java
new file mode 100644
index 0000000000..cdca065e60
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java
@@ -0,0 +1,184 @@
+package gtPlusPlus.xmod.gregtech.api.gui.fluidreactor;
+
+import java.util.Iterator;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.gui.GT_Container_BasicMachine;
+import gregtech.api.gui.GT_Slot_Render;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.slots.SlotChemicalPlantInput;
+import gtPlusPlus.core.slots.SlotNoInput;
+import gtPlusPlus.core.slots.SlotNoInputLogging;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntity_ChemicalReactor;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.item.ItemStack;
+
+public class Container_FluidReactor extends GT_Container_BasicMachine {
+
+ public boolean mFluidTransfer_1 = false;
+ public boolean mFluidTransfer_2 = false;
+ public boolean oFluidTransfer_1 = false;
+ public boolean oFluidTransfer_2 = false;
+
+ public Container_FluidReactor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+
+ // Gui Buttons
+ this.addSlotToContainer(new SlotNoInput(this.mTileEntity, 0, 8, 63)); // Fluid 1
+ this.addSlotToContainer(new SlotNoInput(this.mTileEntity, 1, 44, 63));
+ this.addSlotToContainer(new SlotNoInput(this.mTileEntity, 2, 26, 63)); // Fluid 2
+
+ int tStartIndex = 3;
+ // Input Slots
+ this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 8, 7));
+ this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 26, 7));
+ this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 44, 7));
+ this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 62, 7));
+
+ // Output Slots
+ this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 107, 16));
+ this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 125, 16));
+ this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 107, 34));
+ this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 125, 34));
+
+ // Cell Collector Slot
+ this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 116, 63));
+
+
+ // Inputs Fluids
+ this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 8, 42));
+ this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 26, 42));
+ this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 44, 42));
+ this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 62, 42));
+
+ // Output Fluids
+ this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 143, 16));
+ this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 143, 34));
+
+
+
+
+ }
+
+ public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) {
+ if (aSlotIndex == 0 || aSlotIndex == 2) {
+ if (this.mTileEntity != null && this.mTileEntity.isServerSide()) {
+ try {
+ final IMetaTileEntity aMetaTileEntity = this.mTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return null;
+ }
+ if (aMetaTileEntity instanceof GregtechMetaTileEntity_ChemicalReactor) {
+ //Set Tile
+ if (aSlotIndex == 0) {
+ ((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_1 = !((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_1;
+ }
+ else if (aSlotIndex == 2) {
+ ((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_2 = !((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_2;
+ }
+ return null;
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ }
+ //Logger.INFO("Clicked slot "+aSlotIndex);
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (this.mTileEntity != null && this.mTileEntity.isServerSide()) {
+ try {
+ Iterator var2 = this.crafters.iterator();
+ final IMetaTileEntity aMetaTileEntity = this.mTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ Logger.INFO("bad");
+ return;
+ }
+ if (aMetaTileEntity instanceof GregtechMetaTileEntity_ChemicalReactor) {
+ //Read from Tile
+ this.mFluidTransfer_1 = ((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_1;
+ this.mFluidTransfer_2 = ((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_2;
+ int mTimer;
+ mTimer = (int) ReflectionUtils.getField(this.getClass(), "mTimer").get(this);
+ while (true) {
+ ICrafting var1;
+ do {
+ if (!var2.hasNext()) {
+ this.oFluidTransfer_1 = this.mFluidTransfer_1;
+ this.oFluidTransfer_2 = this.mFluidTransfer_2;
+ return;
+ }
+ var1 = (ICrafting) var2.next();
+ if (mTimer % 500 == 10 || this.oFluidTransfer_1 != this.mFluidTransfer_1) {
+ var1.sendProgressBarUpdate(this, -50, this.mFluidTransfer_1 ? 1 : 0);
+ }
+ if (mTimer % 500 == 10 || this.oFluidTransfer_2 != this.mFluidTransfer_2) {
+ var1.sendProgressBarUpdate(this, -51, this.mFluidTransfer_2 ? 1 : 0);
+ }
+ } while (mTimer % 500 != 10);
+ }
+ }
+ else {
+ Logger.INFO("bad cast");
+ }
+ }
+ catch (IllegalArgumentException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ public void addCraftingToCrafters(ICrafting par1ICrafting) {
+ super.addCraftingToCrafters(par1ICrafting);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ if (par1 > 0) {
+ super.updateProgressBar(par1, par2);
+ }
+ else {
+ switch (par1) {
+ case -50 :
+ this.mFluidTransfer_1 = par2 != 0;
+ break;
+ case -51 :
+ this.mFluidTransfer_2 = par2 != 0;
+ break;
+ default :
+ break;
+ }
+ }
+ }
+
+ public int getSlotStartIndex() {
+ return 3;
+ }
+
+ public int getShiftClickStartIndex() {
+ return 3;
+ }
+
+ public int getSlotCount() {
+ return this.getShiftClickSlotCount() + 5 + 2;
+ }
+
+ public int getShiftClickSlotCount() {
+ return 4;
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java
new file mode 100644
index 0000000000..1be79b40cc
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java
@@ -0,0 +1,122 @@
+package gtPlusPlus.xmod.gregtech.api.gui.fluidreactor;
+
+import gregtech.api.gui.GT_Container_BasicMachine;
+import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.core.lib.CORE;
+
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class GUI_FluidReactor extends GT_GUIContainerMetaTile_Machine {
+ public final String mName;
+ public final String mNEI;
+ public final byte mProgressBarDirection;
+ public final byte mProgressBarAmount;
+
+ public GUI_FluidReactor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName,
+ String aTextureFile, String aNEI) {
+ this(aInventoryPlayer, aTileEntity, aName, aTextureFile, aNEI, (byte) 0, (byte) 1);
+ }
+
+ public GUI_FluidReactor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName,
+ String aTextureFile, String aNEI, byte aProgressBarDirection, byte aProgressBarAmount) {
+ super(new Container_FluidReactor(aInventoryPlayer, aTileEntity), CORE.MODID+":textures/gui/FluidReactor.png");
+ this.mProgressBarDirection = aProgressBarDirection;
+ this.mProgressBarAmount = (byte) Math.max(1, aProgressBarAmount);
+ this.mName = aName;
+ this.mNEI = aNEI;
+ }
+
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ this.fontRendererObj.drawString(this.mName, 82, 5, 4210752);
+ this.drawTooltip(par1, par2);
+ }
+
+ private void drawTooltip(int x2, int y2) {
+ int xStart = (this.width - this.xSize) / 2;
+ int yStart = (this.height - this.ySize) / 2;
+ int x = x2 - xStart;
+ int y = y2 - yStart + 5;
+ List<String> list = new ArrayList();
+ if (y >= 67 && y <= 84) {
+ if (x >= 7 && x <= 24) {
+ list.add("Fluid 1 Auto-Output");
+ }
+ if (x >= 25 && x <= 42) {
+ list.add("Fluid 2 Auto-Output");
+ }
+ if (x >= 43 && x <= 61) {
+ list.add("Item Auto-Output");
+ }
+ }
+
+ if (!list.isEmpty()) {
+ this.drawHoveringText(list, x, y, this.fontRendererObj);
+ }
+
+ }
+
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (this.width - this.xSize) / 2;
+ int y = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
+ if (this.mContainer != null) {
+ if (((Container_FluidReactor) this.mContainer).mFluidTransfer_1) {
+ this.drawTexturedModalRect(x + 7, y + 62, 176, 18, 18, 18);
+ }
+ if (((Container_FluidReactor) this.mContainer).mFluidTransfer_2) {
+ this.drawTexturedModalRect(x + 25, y + 62, 194, 18, 18, 18);
+ }
+ if (((GT_Container_BasicMachine) this.mContainer).mItemTransfer) {
+ this.drawTexturedModalRect(x + 43, y + 62, 176, 36, 18, 18);
+ }
+
+ if (((GT_Container_BasicMachine) this.mContainer).mStuttering) {
+ this.drawTexturedModalRect(x + 79, y + 44, 176, 54, 18, 18);
+ }
+
+ if (this.mContainer.mMaxProgressTime > 0) {
+ int tSize = this.mProgressBarDirection < 2 ? 20 : 18;
+ int tProgress = Math
+ .max(1, Math
+ .min(tSize * this.mProgressBarAmount,
+ (this.mContainer.mProgressTime > 0 ? 1 : 0) + this.mContainer.mProgressTime
+ * tSize * this.mProgressBarAmount / this.mContainer.mMaxProgressTime))
+ % (tSize + 1);
+ switch (this.mProgressBarDirection) {
+ case 0 :
+ this.drawTexturedModalRect(x + 82, y + 24, 176, 0, tProgress, 18);
+ break;
+ case 1 :
+ this.drawTexturedModalRect(x + 82 + 20 - tProgress, y + 24, 196 - tProgress, 0, tProgress, 18);
+ break;
+ case 2 :
+ this.drawTexturedModalRect(x + 82, y + 24, 176, 0, 20, tProgress);
+ break;
+ case 3 :
+ this.drawTexturedModalRect(x + 82, y + 24 + 18 - tProgress, 176, 18 - tProgress, 20, tProgress);
+ break;
+ case 4 :
+ tProgress = 20 - tProgress;
+ this.drawTexturedModalRect(x + 82, y + 24, 176, 0, tProgress, 18);
+ break;
+ case 5 :
+ tProgress = 20 - tProgress;
+ this.drawTexturedModalRect(x + 82 + 20 - tProgress, y + 24, 196 - tProgress, 0, tProgress, 18);
+ break;
+ case 6 :
+ tProgress = 18 - tProgress;
+ this.drawTexturedModalRect(x + 82, y + 24, 176, 0, 20, tProgress);
+ break;
+ case 7 :
+ tProgress = 18 - tProgress;
+ this.drawTexturedModalRect(x + 82, y + 24 + 18 - tProgress, 176, 18 - tProgress, 20, tProgress);
+ }
+ }
+ }
+
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java
index d4d2fcacd7..e6203823b6 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java
@@ -36,11 +36,11 @@ public class CONTAINER_1by1_Turbine extends GT_Container_1by1 {
}
@Override
public boolean isItemValid(final ItemStack itemstack) {
- /*if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) {
+ if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) {
if (itemstack.getItemDamage() >= 170 && itemstack.getItemDamage() <= 176) {
return true;
}
- }*/
+ }
return false;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
index e4a15d34ea..83f052a983 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
@@ -204,6 +204,7 @@ public interface IGregtech_RecipeAdder {
public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, ItemStack output, int time, int eu);
public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, ItemStack output, Object object, int time, int eu);
public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, ItemStack output, ItemStack object, int time);
+ public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, int aCircuit, FluidStack inputFluid, FluidStack outputFluid, ItemStack output, ItemStack output2, int time, int eu);
public boolean addMultiblockChemicalRecipe(ItemStack[] itemStacks, FluidStack[] fluidStacks, FluidStack[] fluidStacks2, ItemStack[] outputs, int time, int eu);
@@ -215,8 +216,16 @@ public interface IGregtech_RecipeAdder {
public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aDust, ItemStack aOutput);
- public void addFluidExtractionRecipe(ItemStack input, Object input2, FluidStack output, int aTime, int aEu, int aSpecial);
-
+ public boolean addFluidExtractionRecipe(ItemStack input, FluidStack output, int aTime, int aEu);
+
+ public boolean addFluidExtractionRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidOut, int aTime, int aEu);
+
+ public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn);
+
+ public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, FluidStack rFluidOut);
+
+ public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, FluidStack rFluidOut, int aTime, int aEu);
+
/**
* Adds a Fusion reactor Recipe
*
@@ -254,7 +263,25 @@ public interface IGregtech_RecipeAdder {
public boolean addFusionReactorRecipe(ItemStack aInputStackA, ItemStack aInputStackB, FluidStack plasma, int aOutputChance, int aFusionDurationInTicks, int aEu, int aSpecial);
- boolean addVacuumFurnaceRecipe(ItemStack aInput1, ItemStack aInput2,
+ public boolean addVacuumFurnaceRecipe(ItemStack aInput1, ItemStack aInput2,
FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1,
ItemStack aOutput2, int aDuration, int aEUt, int aLevel);
+
+
+ public boolean addUvLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu);
+ public boolean addIrLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu);
+
+ public boolean addFluidReactorRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier);
+
+ public boolean addBlastRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aHeat);
+
+ public boolean addPyrolyseRecipe(ItemStack aInput, FluidStack aFluidInput, int intCircuit, ItemStack aOutput, FluidStack aFluidOutput, int aDuration, int aEUt);
+
+ public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt);
+
+ public boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden);
+
+ public boolean addPulverisationRecipe(final ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, final ItemStack aOutput3);
+
+
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java
index e637365c1e..6967c8eb33 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java
@@ -1,7 +1,9 @@
package gtPlusPlus.xmod.gregtech.api.metatileentity;
+import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Random;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
@@ -9,18 +11,39 @@ import gregtech.api.enums.GT_Values;
import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
-import gregtech.common.GT_Pollution;
import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
+import gtPlusPlus.xmod.gregtech.common.StaticFields59;
import ic2.api.Direction;
+import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class BaseCustomTileEntity extends BaseMetaTileEntity {
protected NBTTagCompound mRecipeStuff2;
+ private static final Field ENTITY_ITEM_HEALTH_FIELD_2;
+
+ static {
+ Field f = null;
+ try {
+ f = EntityItem.class.getDeclaredField("field_70291_e");
+ f.setAccessible(true);
+ } catch (Exception var4) {
+ try {
+ f = EntityItem.class.getDeclaredField("health");
+ f.setAccessible(true);
+ } catch (Exception var3) {
+ var4.printStackTrace();
+ var3.printStackTrace();
+ }
+ }
+
+ ENTITY_ITEM_HEALTH_FIELD_2 = f;
+ }
public BaseCustomTileEntity() {
super();
@@ -73,7 +96,14 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity {
this.mReleaseEnergy = false;
this.mMetaTileEntity.onExplosion();
int i;
- if (GT_Mod.gregtechproxy.mExplosionItemDrop) {
+
+ boolean aExplosionDropItem = false;
+ Object aProxyField = StaticFields59.getFieldFromGregtechProxy(false, "mExplosionItemDrop");
+ if (boolean.class.isInstance(aProxyField) || Boolean.class.isInstance(aProxyField)) {
+ aExplosionDropItem = (boolean) aProxyField;
+ }
+
+ if (aExplosionDropItem) {
for (i = 0; i < this.getSizeInventory(); ++i) {
ItemStack tItem = this.getStackInSlot(i);
if (tItem != null && tItem.stackSize > 0 && this.isValidSlot(i)) {
@@ -94,19 +124,70 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity {
}
}
+
+
+ public void dropItems(ItemStack tItem) {
+ if (tItem != null) {
+ Random tRandom = new Random();
+ EntityItem tItemEntity = new EntityItem(this.worldObj,
+ (double) ((float) this.xCoord + tRandom.nextFloat() * 0.8F + 0.1F),
+ (double) ((float) this.yCoord + tRandom.nextFloat() * 0.8F + 0.1F),
+ (double) ((float) this.zCoord + tRandom.nextFloat() * 0.8F + 0.1F),
+ new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage()));
+ if (tItem.hasTagCompound()) {
+ tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy());
+ }
+
+ tItemEntity.motionX = tRandom.nextGaussian() * 0.0500000007450581D;
+ tItemEntity.motionY = tRandom.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D;
+ tItemEntity.motionZ = tRandom.nextGaussian() * 0.0500000007450581D;
+ tItemEntity.hurtResistantTime = 999999;
+ tItemEntity.lifespan = 60000;
+
+ try {
+ if (ENTITY_ITEM_HEALTH_FIELD_2 != null) {
+ ENTITY_ITEM_HEALTH_FIELD_2.setInt(tItemEntity, 99999999);
+ }
+ } catch (Exception var5) {
+ ;
+ }
+
+ this.worldObj.spawnEntityInWorld(tItemEntity);
+ tItem.stackSize = 0;
+ }
+ }
public ArrayList<ItemStack> getDrops() {
- ItemStack rStack = new ItemStack(Meta_GT_Proxy.sBlockMachines, 1, this.getMetaTileID());
- NBTTagCompound aSuperNBT = super.getDrops().get(0).getTagCompound();
- NBTTagCompound tNBT = aSuperNBT;
- if (this.hasValidMetaTileEntity()) {
- this.mMetaTileEntity.setItemNBT(tNBT);
+ ArrayList<ItemStack> aDrops = new ArrayList<ItemStack>();
+ ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, this.getMetaTileID());
+ // Currently not using my custom block.
+ // ItemStack rStack = new ItemStack(Meta_GT_Proxy.sBlockMachines, 1,
+ // this.getMetaTileID());
+ boolean fail = true;
+
+ ArrayList<ItemStack> aSuperDrops = super.getDrops();
+ if (aSuperDrops != null && !aSuperDrops.isEmpty()) {
+ ItemStack aSuperStack = super.getDrops().get(0);
+ if (aSuperStack != null && aSuperStack.hasTagCompound()) {
+ NBTTagCompound aSuperNBT = aSuperStack.getTagCompound();
+ if (aSuperNBT != null && !aSuperNBT.hasNoTags()) {
+ NBTTagCompound tNBT = (NBTTagCompound) aSuperNBT.copy();
+ if (tNBT != null && !tNBT.hasNoTags()) {
+ if (this.hasValidMetaTileEntity()) {
+ this.mMetaTileEntity.setItemNBT(tNBT);
+ rStack.setTagCompound(tNBT);
+ fail = false;
+ aDrops.add(rStack);
+ }
+ }
+ }
+
+ }
}
- if (!tNBT.hasNoTags()) {
- rStack.setTagCompound(tNBT);
+ if (fail) {
+ aDrops.add(rStack);
}
-
- return new ArrayList<ItemStack>(Arrays.asList(new ItemStack[] { rStack }));
+ return aDrops;
}
public boolean isTeleporterCompatible(Direction aSide) {
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java
index 1ce7fc49d3..e1b329c07f 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java
@@ -247,9 +247,9 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank
public int getFuelValue(FluidStack aLiquid) {
if (aLiquid != null && this.getRecipes() != null) {
Collection<GT_Recipe> tRecipeList = this.getRecipes().mRecipeList;
- Logger.WARNING("Fuels: "+tRecipeList.size());
if (tRecipeList != null) {
- Iterator var4 = tRecipeList.iterator();
+ Logger.WARNING("Fuels: "+tRecipeList.size());
+ Iterator<GT_Recipe> var4 = tRecipeList.iterator();
while (var4.hasNext()) {
GT_Recipe tFuel = (GT_Recipe) var4.next();
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java
index 19ba932a02..2eb1d36791 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java
@@ -11,11 +11,11 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.random.XSTR;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java
deleted file mode 100644
index 68ec0ba0c9..0000000000
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java
+++ /dev/null
@@ -1,532 +0,0 @@
-package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import gregtech.GT_Mod;
-import gregtech.api.enums.Dyes;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.OrePrefixes;
-import gregtech.api.enums.Textures.BlockIcons;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
-import gregtech.api.interfaces.tileentity.IEnergyConnected;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.BaseMetaPipeEntity;
-import gregtech.api.metatileentity.MetaPipeEntity;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Utility;
-import gregtech.common.GT_Client;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.xmod.gregtech.api.interfaces.IHeatEntity;
-import gtPlusPlus.xmod.gregtech.api.interfaces.IMetaTileEntityHeatPipe;
-import gtPlusPlus.xmod.gregtech.common.StaticFields59;
-import ic2.api.energy.tile.IEnergySink;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
-
-public class GT_MetaPipeEntity_Heat extends MetaPipeEntity implements IMetaTileEntityHeatPipe, IHeatEntity {
-
- public final Materials mMaterial;
- public final long mHeatLossPerMeter, mAmperage, mMaxTemp;
- public final boolean mInsulated, mCanShock;
- public long mTransferredAmperage = 0, mTransferredAmperageLast20 = 0, mTransferredVoltageLast20 = 0;
- public short mOverheat;
-
- private boolean mCheckConnections;
- public byte mDisableInput;
-
- public GT_MetaPipeEntity_Heat(int aID, String aName, String aNameRegional, Materials aMaterial, long aMaxTemp) {
- super(aID, aName, aNameRegional, 0);
- mMaterial = aMaterial;
- mAmperage = 1;
- mMaxTemp = aMaxTemp;
- mInsulated = false;
- mCanShock = true;
- mHeatLossPerMeter = aMaxTemp/1000;
- }
-
- public GT_MetaPipeEntity_Heat(String aName, Materials aMaterial, long aMaxTemp) {
- super(aName, 0);
- mMaterial = aMaterial;
- mAmperage = 1;
- mMaxTemp = aMaxTemp;
- mInsulated = false;
- mCanShock = true;
- mHeatLossPerMeter = aMaxTemp/1000;
- }
-
-
- @Override
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaPipeEntity_Heat(mName, mMaterial, mMaxTemp);
- }
-
- @Override
- public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) {
- if (mCanShock && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase)
- GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, mTransferredVoltageLast20);
- }
-
- @Override
- public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
- if (!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);
- }
-
- @Override
- public boolean isSimpleMachine() {
- return true;
- }
-
- @Override
- public boolean isFacingValid(byte aFacing) {
- return false;
- }
-
- @Override
- public boolean isValidSlot(int aIndex) {
- return true;
- }
-
- @Override
- public final boolean renderInside(byte aSide) {
- return false;
- }
-
- @Override
- public int getProgresstime() {
- return (int) mTransferredAmperage * 64;
- }
-
- @Override
- public int maxProgresstime() {
- return (int) mAmperage * 64;
- }
-
- @Override
- public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) {
- if (!getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity()))
- return 0;
- return transferHeat(aSide, aVoltage, aAmperage, new ArrayList<TileEntity>(Arrays.asList((TileEntity) getBaseMetaTileEntity())));
- }
-
- @Override
- public long transferHeat(byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList) {
- if (!this.isConnectedAtSide(aSide) && aSide != 6) {
- return 0L;
- } else {
- long rUsedAmperes = 0L;
- aVoltage -= this.mHeatLossPerMeter;
- if (aVoltage > 0L) {
- for (byte i = 0; i < 6 && aAmperage > rUsedAmperes; ++i) {
- if (i != aSide && this.isConnectedAtSide(i)
- && this.getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i,
- this.getBaseMetaTileEntity().getCoverIDAtSide(i),
- this.getBaseMetaTileEntity().getCoverDataAtSide(i), this.getBaseMetaTileEntity())) {
- TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(i);
- if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) {
- aAlreadyPassedTileEntityList.add(tTileEntity);
- if (tTileEntity instanceof IEnergyConnected) {
- if (this.getBaseMetaTileEntity().getColorization() >= 0) {
- byte tColor = ((IEnergyConnected) tTileEntity).getColorization();
- if (tColor >= 0 && tColor != this.getBaseMetaTileEntity().getColorization()) {
- continue;
- }
- }
-
- if (tTileEntity instanceof IGregTechTileEntity
- && ((IGregTechTileEntity) tTileEntity)
- .getMetaTileEntity() instanceof IMetaTileEntityHeatPipe
- && ((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() > 50L) {
- rUsedAmperes += ((IMetaTileEntityHeatPipe) ((IGregTechTileEntity) tTileEntity)
- .getMetaTileEntity()).transferHeat(GT_Utility.getOppositeSide(i),
- aVoltage, aAmperage - rUsedAmperes,
- aAlreadyPassedTileEntityList);
- }
- } else {
- rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits(
- GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes);
- }
- } else {
- ForgeDirection tDirection;
-
- if (tTileEntity instanceof IEnergySink) {
- tDirection = ForgeDirection.getOrientation(i).getOpposite();
- if (((IEnergySink) tTileEntity)
- .acceptsEnergyFrom((TileEntity) this.getBaseMetaTileEntity(), tDirection)
- && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0.0D
- && ((IEnergySink) tTileEntity).injectEnergy(tDirection, (double) aVoltage,
- (double) aVoltage) < (double) aVoltage) {
- ++rUsedAmperes;
- }
- }
- }
- }
- }
- }
- }
-
- this.mTransferredAmperage += rUsedAmperes;
- this.mTransferredVoltageLast20 = Math.max(this.mTransferredVoltageLast20, aVoltage);
- this.mTransferredAmperageLast20 = Math.max(this.mTransferredAmperageLast20, this.mTransferredAmperage);
- if (aVoltage <= this.mMaxTemp && this.mTransferredAmperage <= this.mAmperage) {
- return rUsedAmperes;
- } else {
- if (this.mOverheat > GT_Mod.gregtechproxy.mWireHeatingTicks * 100) {
- //this.getBaseMetaTileEntity().setToFire();
- } else {
- this.mOverheat = (short) (this.mOverheat + 100);
- }
-
- return aAmperage;
- }
- }
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if (aBaseMetaTileEntity.isServerSide()) {
- this.mTransferredAmperage = 0L;
- if (this.mOverheat > 0) {
- --this.mOverheat;
- }
-
- if (aTick % 20L == 0L) {
- this.mTransferredVoltageLast20 = 0L;
- this.mTransferredAmperageLast20 = 0L;
-
- for (byte tSide = 0; tSide < 6; ++tSide) {
- IGregTechTileEntity tBaseMetaTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(tSide);
- byte uSide = GT_Utility.getOppositeSide(tSide);
- if ((this.mCheckConnections || this.isConnectedAtSide(tSide)
- || aBaseMetaTileEntity.getCoverBehaviorAtSide(tSide).alwaysLookConnected(tSide,
- aBaseMetaTileEntity.getCoverIDAtSide(tSide),
- aBaseMetaTileEntity.getCoverDataAtSide(tSide), aBaseMetaTileEntity)
- || tBaseMetaTileEntity != null && tBaseMetaTileEntity.getCoverBehaviorAtSide(uSide)
- .alwaysLookConnected(uSide, tBaseMetaTileEntity.getCoverIDAtSide(uSide),
- tBaseMetaTileEntity.getCoverDataAtSide(uSide), tBaseMetaTileEntity))
- && this.connect(tSide) == 0) {
- this.disconnect(tSide);
- }
- }
-
- if (isGT6Pipes()) {
- this.mCheckConnections = false;
- }
- }
- } else if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) {
- aBaseMetaTileEntity.issueTextureUpdate();
- }
-
- }
-
- @Override
- public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return false;
- }
-
- @Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return false;
- }
-
- @Override
- public String[] getDescription() {
- return new String[]{
- "Max Voltage: " + EnumChatFormatting.GOLD + mMaxTemp + "C" + EnumChatFormatting.GRAY,
- "Loss: " + EnumChatFormatting.RED + mHeatLossPerMeter + EnumChatFormatting.GRAY + " HU per meter",
- CORE.GT_Tooltip
- };
- }
-
- @Override
- public float getThickNess() {
- return 1;
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- aNBT.setInteger("HeatBuffer", this.HeatBuffer);
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- this.HeatBuffer = aNBT.getInteger("HeatBuffer");
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- protected int transmitHeat;
- protected int maxHeatEmitpeerTick;
- protected int HeatBuffer;
-
-
-
-
- public byte getTileEntityBaseType() {
- return 4;
- }
-
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections,
- byte aColorIndex, boolean aConnected, boolean aRedstone) {
- float tThickNess = this.getThickNess();
- if (this.mDisableInput == 0) {
- return new ITexture[]{(ITexture) (aConnected
- ? getBaseTexture(tThickNess, 1, this.mMaterial, aColorIndex)
- : new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
- Dyes.getModulation(aColorIndex, this.mMaterial.mRGBa)))};
- } else {
- byte tMask = 0;
- byte[][] sRestrictionArray = new byte[][]{{2, 3, 5, 4}, {2, 3, 4, 5}, {1, 0, 4, 5}, {1, 0, 4, 5},
- {1, 0, 2, 3}, {1, 0, 2, 3}};
- if (aSide >= 0 && aSide < 6) {
- for (byte i = 0; i < 4; ++i) {
- if (this.isInputDisabledAtSide(sRestrictionArray[aSide][i])) {
- tMask = (byte) (tMask | 1 << i);
- }
- }
- }
-
- return new ITexture[]{
- (ITexture) (aConnected
- ? getBaseTexture(tThickNess, 1, this.mMaterial, aColorIndex)
- : new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
- Dyes.getModulation(aColorIndex, this.mMaterial.mRGBa))),
- getRestrictorTexture(tMask)};
- }
- }
-
- protected static final ITexture getBaseTexture(float aThickNess, int aPipeAmount, Materials aMaterial,
- byte aColorIndex) {
- if (aPipeAmount >= 9) {
- return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
- } else if (aPipeAmount >= 4) {
- return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
- } else if (aThickNess < 0.124F) {
- return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
- } else if (aThickNess < 0.374F) {
- return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
- } else if (aThickNess < 0.499F) {
- return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
- } else if (aThickNess < 0.749F) {
- return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
- } else {
- return aThickNess < 0.874F
- ? new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa))
- : new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
- }
- }
-
- protected static final ITexture getRestrictorTexture(byte aMask) {
- switch (aMask) {
- case 1 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UP);
- case 2 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DOWN);
- case 3 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UD);
- case 4 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_LEFT);
- case 5 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UL);
- case 6 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DL);
- case 7 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NR);
- case 8 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_RIGHT);
- case 9 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UR);
- case 10 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DR);
- case 11 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NL);
- case 12 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_LR);
- case 13 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_ND);
- case 14 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NU);
- case 15 :
- return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR);
- default :
- return null;
- }
- }
-
-
- public final boolean isGT6Pipes() {
- return StaticFields59.mGT6StylePipes;
- }
-
- public void updateHeatEntity() {
- int amount = this.getMaxHeatEmittedPerTick() - this.HeatBuffer;
- if (amount > 0) {
- this.addtoHeatBuffer(this.fillHeatBuffer(amount));
- }
- }
-
- public boolean facingMatchesDirection(ForgeDirection direction) {
- return true;
- }
-
- public int maxrequestHeatTick(ForgeDirection directionFrom) {
- return this.getMaxHeatEmittedPerTick();
- }
-
- public int requestHeat(ForgeDirection directionFrom, int requestheat) {
- if (this.facingMatchesDirection(directionFrom)) {
- int heatbuffertemp = this.getHeatBuffer();
- if (this.getHeatBuffer() >= requestheat) {
- this.setHeatBuffer(this.getHeatBuffer() - requestheat);
- this.transmitHeat = requestheat;
- return requestheat;
- } else {
- this.transmitHeat = heatbuffertemp;
- this.setHeatBuffer(0);
- return heatbuffertemp;
- }
- } else {
- return 0;
- }
- }
-
-
- public int getHeatBuffer() {
- return this.HeatBuffer;
- }
-
- public void setHeatBuffer(int HeatBuffer) {
- this.HeatBuffer = HeatBuffer;
- }
-
- public void addtoHeatBuffer(int heat) {
- this.setHeatBuffer(this.getHeatBuffer() + heat);
- }
-
-
- public int fillHeatBuffer(int maxAmount) {
- return maxAmount >= this.getMaxHeatEmittedPerTick() ? this.getMaxHeatEmittedPerTick() : maxAmount;
- }
-
- public int getMaxHeatEmittedPerTick() {
- return (int) (this.mMaxTemp/1000);
- }
-
-
- public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
- float aZ) {
- if (isGT6Pipes()) {
- byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ);
- byte tMask = (byte) (1 << tSide);
- if (aPlayer.isSneaking()) {
- if (this.isInputDisabledAtSide(tSide)) {
- this.mDisableInput = (byte) (this.mDisableInput & ~tMask);
- GT_Utility.sendChatToPlayer(aPlayer, this.trans("212", "Input enabled"));
- if (!this.isConnectedAtSide(tSide)) {
- this.connect(tSide);
- }
- } else {
- this.mDisableInput |= tMask;
- GT_Utility.sendChatToPlayer(aPlayer, this.trans("213", "Input disabled"));
- }
- } else if (!this.isConnectedAtSide(tSide)) {
- if (this.connect(tSide) > 0) {
- GT_Utility.sendChatToPlayer(aPlayer, this.trans("214", "Connected"));
- }
- } else {
- this.disconnect(tSide);
- GT_Utility.sendChatToPlayer(aPlayer, this.trans("215", "Disconnected"));
- }
-
- return true;
- } else {
- return false;
- }
- }
-
- public boolean isInputDisabledAtSide(int aSide) {
- return (this.mDisableInput & 1 << aSide) != 0;
- }
-
-
-
-
- @Override
- public int maxHeatInPerTick(ForgeDirection var1) {
- return (int) (this.mMaxTemp/500);
- }
-
- @Override
- public int addHeat(ForgeDirection var1, int var2) {
-
-
-
- /*ForgeDirection dir = ForgeDirection.getOrientation(this.getFacing());
- TileEntity te = this.getBaseMetaTileEntity().getWorld().getTileEntity(this.xCoord + dir.offsetX, this.yCoord + dir.offsetY,
- this.zCoord + dir.offsetZ);
- if (te instanceof IHeatSource) {
- int heatbandwith = ((IHeatSource) te).maxrequestHeatTick(dir.getOpposite());
- double freeEUstorage = (double) this.maxEUStorage - this.EUstorage;
- if (freeEUstorage >= this.productionpeerheat * (double) heatbandwith) {
- this.receivedheat = ((IHeatSource) te).requestHeat(dir.getOpposite(), heatbandwith);
- if (this.receivedheat != 0) {
- this.production = (double) this.receivedheat * this.productionpeerheat;
- this.EUstorage += this.production;
- return true;
- }
- }
- }
-
- this.production = 0.0D;
- this.receivedheat = 0;*/
-
-
- return 0;
- }
-
- @Override
- public int getTransmitHeat() {
- return this.transmitHeat;
- }
-
-
-
-
-
-} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java
index 9b730c84a3..5fef0f1088 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java
@@ -34,14 +34,17 @@ public class GT_MetaTileEntity_Hatch_DynamoBuffer extends GT_MetaTileEntity_Hatc
return new ITexture[]{aBaseTexture, TexturesGtBlock.OVERLAYS_ENERGY_OUT_MULTI_BUFFER[this.mTier]};
}
+ @Override
public long getMinimumStoredEU() {
return 0L;
}
+ @Override
public long maxEUStore() {
return 512L + GT_Values.V[this.mTier + 1] * 2048L;
}
+ @Override
public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
return (MetaTileEntity) new GT_MetaTileEntity_Hatch_DynamoBuffer(this.mName, this.mTier, this.mDescription, this.mTextures);
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java
new file mode 100644
index 0000000000..752321506d
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java
@@ -0,0 +1,212 @@
+package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
+
+import gregtech.api.interfaces.ITexture;
+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.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_1by1_Turbine;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_1by1_Turbine;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.Chunk;
+
+public class GT_MetaTileEntity_Hatch_TurbineProvider extends GT_MetaTileEntity_Hatch_InputBus {
+
+ public GT_MetaTileEntity_Hatch_TurbineProvider(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier);
+ }
+
+ public GT_MetaTileEntity_Hatch_TurbineProvider(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ public GT_MetaTileEntity_Hatch_TurbineProvider(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription[0], aTextures);
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Hatch_TurbineProvider(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity, "Turbine Housing");
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ "An automation port for Large Turbines", "Will attempt once per 1200 ticks to fill the turbine slot of it's parent turbine", "You may adjust this with a screwdriver", "Hold shift to adjust in finer amounts", "Hold control to adjust direction", "Left Click with Screwdriver to reset", "This module assumes the entire turbine is in the same Chunk"};
+ }
+
+
+ private GT_MetaTileEntity_LargeTurbine mParent = null;
+
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
+ super.onPostTick(aBaseMetaTileEntity, aTimer);
+ if (aTimer % mRefreshTime == 0 && this.getBaseMetaTileEntity().isServerSide()) {
+ tryRefillTurbine();
+ }
+ }
+
+ private final void tryFindParentTurbine() {
+ Logger.INFO("This turbine housing has no parent, searching world.");
+ IGregTechTileEntity T = this.getBaseMetaTileEntity();
+ World W = T.getWorld();
+ Chunk C = W.getChunkFromBlockCoords(T.getXCoord(), T.getZCoord());
+ for (Object o : C.chunkTileEntityMap.values()) {
+ if (o instanceof IGregTechTileEntity) {
+ IGregTechTileEntity G = (IGregTechTileEntity) o;
+ final IMetaTileEntity aMetaTileEntity = G.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ continue;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine) {
+ GT_MetaTileEntity_LargeTurbine aTurb = (GT_MetaTileEntity_LargeTurbine) aMetaTileEntity;
+ for (GT_MetaTileEntity_Hatch_InputBus ee : aTurb.mInputBusses) {
+ if (ee.equals(this)) {
+ mParent = aTurb;
+ Logger.INFO("Found a Parent to attach to this housing.");
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private final void tryRefillTurbine() {
+ if (mParent == null) {
+ tryFindParentTurbine();
+ }
+ if (mParent != null && mParent.mInventory[1] == null) {
+ for (ItemStack aStack : this.mInventory) {
+ if (isItemStackTurbine(aStack)) {
+ setGUIItemStack(aStack);
+ }
+ }
+ }
+ }
+
+ protected boolean setGUIItemStack(ItemStack aNewGuiSlotContents) {
+ boolean result = false;
+ if (mParent.mInventory[1] == null) {
+ mParent.mInventory[1] = aNewGuiSlotContents != null ? aNewGuiSlotContents.copy() : null;
+ mParent.depleteInput(aNewGuiSlotContents);
+ mParent.updateSlots();
+ this.updateSlots();
+ result = true;
+ }
+ return result;
+ }
+
+ public boolean isItemStackTurbine(ItemStack aStack) {
+ if (aStack.getItem() instanceof GT_MetaGenerated_Tool) {
+ if (aStack.getItemDamage() >= 170 && aStack.getItemDamage() <= 176) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isItemStackScrewdriver(ItemStack aStack) {
+ if (aStack.getItem() instanceof GT_MetaGenerated_Tool) {
+ if (aStack.getItemDamage() == 22 || aStack.getItemDamage() == 150) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return isItemStackTurbine(aStack);
+ }
+
+ private int mRefreshTime = 1200;
+ private boolean mDescending = true;
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setInteger("mRefreshTime", mRefreshTime);
+ aNBT.setBoolean("mDescending", mDescending);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mRefreshTime = aNBT.getInteger("mRefreshTime");
+ mDescending = aNBT.getBoolean("mDescending");
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (aPlayer != null) {
+ if (KeyboardUtils.isCtrlKeyDown()) {
+ mDescending = Utils.invertBoolean(mDescending);
+ PlayerUtils.messagePlayer(aPlayer, "Direction: "+(mDescending ? "DOWN" : "UP"));
+ }
+ else {
+ int aAmount = 0;
+ if (KeyboardUtils.isShiftKeyDown()) {
+ aAmount = 10;
+ }
+ else {
+ aAmount = 100;
+ }
+ if (mDescending) {
+ mRefreshTime -= aAmount;
+ if (mRefreshTime < 0) {
+ mRefreshTime = 1200;
+ }
+ }
+ else {
+ mRefreshTime += aAmount;
+ if (mRefreshTime > 1200) {
+ mRefreshTime = 0;
+ }
+ }
+ PlayerUtils.messagePlayer(aPlayer, "Set check time to be every "+mRefreshTime+" ticks.");
+ }
+ }
+ }
+
+ @Override
+ public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ boolean aDidScrewdriver = false;
+ if (aPlayer != null) {
+ if (aPlayer.getHeldItem() != null) {
+ if (isItemStackScrewdriver(aPlayer.getHeldItem())) {
+ aDidScrewdriver = true;
+ mRefreshTime = 1200;
+ PlayerUtils.messagePlayer(aPlayer, "Reset check time to "+mRefreshTime+" ticks.");
+ }
+ }
+ }
+ if (!aDidScrewdriver) {
+ super.onLeftclick(aBaseMetaTileEntity, aPlayer);
+ }
+ }
+
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java
index e0844bb071..4c60d9a932 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java
@@ -9,7 +9,6 @@ import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
@@ -17,7 +16,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_InputBus {
- public GT_Recipe_Map mRecipeMap = null;
public GT_MetaTileEntity_SuperBus_Input(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier);
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java
index 3afa3312b1..cca5a39de3 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java
@@ -58,7 +58,7 @@ public class GT_MetaTileEntity_SuperBus_Output extends GT_MetaTileEntity_Hatch_O
if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) {
this.fillStacksIntoFirstSlots();
}
-
+ super.onPostTick(aBaseMetaTileEntity, aTimer);
}
public void updateSlots() {
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java
index 8a29dc5db2..be23123193 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java
@@ -18,13 +18,7 @@ public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid {
public static final boolean mGt6Pipe;
static {
- Boolean aGt6 = (Boolean) StaticFields59.getFieldFromGregtechProxy("gt6Pipe");
- if (aGt6 != null) {
- mGt6Pipe = aGt6;
- }
- else {
- mGt6Pipe = false;
- }
+ mGt6Pipe = StaticFields59.mGT6StylePipes;
}
public final GT_Materials mMaterial;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java
index 839fb3a14a..c9b98a6a64 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java
@@ -102,7 +102,7 @@ public class GT_MetaTileEntity_Hatch_CustomFluidBase extends GT_MetaTileEntity_H
String[] s2 = new String[]{
"Fluid Input for Multiblocks",
"Capacity: " + getCapacity()+"L",
- "Accepted Fluid: " + mTempMod + mLockedStack.getLocalizedName()
+ "Accepted Fluid: " + mTempMod + mLockedStack != null ? mLockedStack.getLocalizedName() : "Empty"
};
return s2;
}
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 d17c820699..4dd5bf25d6 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
@@ -5,6 +5,7 @@ import static gregtech.api.enums.GT_Values.VN;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import cofh.api.energy.IEnergyReceiver;
import net.minecraft.entity.Entity;
@@ -219,6 +220,18 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
return this.transferElectricity(aSide, aVoltage, aAmperage,
new ArrayList<>(Arrays.asList((TileEntity) this.getBaseMetaTileEntity())));
}
+
+
+ /**
+ * Adds support for the newer function added by https://github.com/Blood-Asp/GT5-Unofficial/commit/73ee102b63efd92c0f164a7ed7a79ebcd2619617#diff-3051838621d8ae87aa5ccd1345e1f07d
+ */
+ public long transferElectricity(byte arg0, long arg1, long arg2, HashSet<TileEntity> arg3) {
+ ArrayList<TileEntity> aTiles = new ArrayList<TileEntity>();
+ for (TileEntity y : arg3) {
+ aTiles.add(y);
+ }
+ return transferElectricity(arg0, arg1, arg2, aTiles);
+ }
@Override
public long transferElectricity(final byte aSide, long aVoltage, final long aAmperage,
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 0e1ef0e47e..4a6cad20c3 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
@@ -4,9 +4,9 @@ import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -41,18 +41,28 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.GTplusplus.INIT_PHASE;
+import gtPlusPlus.api.helpers.GregtechPlusPlus_API.Multiblock_API;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.data.ConcurrentHashSet;
+import gtPlusPlus.api.objects.data.ConcurrentSet;
+import gtPlusPlus.api.objects.data.FlexiblePair;
+import gtPlusPlus.api.objects.data.Triplet;
import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.api.objects.minecraft.multi.SpecialMultiBehaviour;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.preloader.asm.AsmConfig;
import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine_NoPlayerInventory;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine_Default;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_Multi_Basic_Slotted;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery;
@@ -66,16 +76,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
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 final boolean DEBUG_DISABLE_CORES_TEMPORARILY = true;
-
static {
Method a08 = findRecipe08 = ReflectionUtils.getMethod(GT_Recipe_Map.class, "findRecipe", IHasWorldObjectAndCoords.class, GT_Recipe.class, boolean.class, long.class, FluidStack[].class, ItemStack.class, ItemStack[].class);
@@ -83,8 +90,19 @@ GT_MetaTileEntity_MultiBlockBase {
Logger.MACHINE_INFO("Found .08 findRecipe method? "+(a08 != null));
Logger.MACHINE_INFO("Found .09 findRecipe method? "+(a09 != null));
- //gregtech.api.util.GT_Recipe.GT_Recipe_Map.findRecipe(IHasWorldObjectAndCoords, GT_Recipe, boolean, long, FluidStack[], ItemStack, ItemStack...)
+ if (CORE.DEBUG) {
+ aLogger = ReflectionUtils.getMethod(Logger.class, "INFO", String.class);
+ }
+ else {
+ aLogger = ReflectionUtils.getMethod(Logger.class, "MACHINE_INFO", String.class);
+ }
+ try {
+ calculatePollutionReduction = GT_MetaTileEntity_Hatch_Muffler.class.getDeclaredMethod("calculatePollutionReduction", int.class);
+ } catch (NoSuchMethodException | SecurityException e) {}
+
+ mCustomBehviours = new HashMap<String, SpecialMultiBehaviour>();
+
}
//Find Recipe Methods
@@ -98,9 +116,14 @@ GT_MetaTileEntity_MultiBlockBase {
//Control Core Hatch
public ArrayList<GT_MetaTileEntity_Hatch_ControlCore> mControlCoreBus = new ArrayList<GT_MetaTileEntity_Hatch_ControlCore>();
+ public ArrayList<GT_MetaTileEntity_Hatch_AirIntake> mAirIntakes = new ArrayList<GT_MetaTileEntity_Hatch_AirIntake>();
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>();
+ // Custom Behaviour Map
+ private static final HashMap<String, SpecialMultiBehaviour> mCustomBehviours;
+
+
public GregtechMeta_MultiBlockBase(final int aID, final String aName,
final String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -120,13 +143,23 @@ GT_MetaTileEntity_MultiBlockBase {
public abstract boolean hasSlotInGUI();
+ public long getTotalRuntimeInTicks() {
+ return this.mTotalRunTime;
+ }
+
@Override
public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
if (hasSlotInGUI()) {
return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity);
}
- else {
- return new CONTAINER_MultiMachine(aPlayerInventory, aBaseMetaTileEntity);
+ else {
+ String aCustomGUI = getCustomGUIResourceName();
+ if (aCustomGUI == null) {
+ return new CONTAINER_MultiMachine_NoPlayerInventory(aPlayerInventory, aBaseMetaTileEntity);
+ }
+ else {
+ return new CONTAINER_MultiMachine(aPlayerInventory, aBaseMetaTileEntity);
+ }
}
}
@@ -139,7 +172,7 @@ GT_MetaTileEntity_MultiBlockBase {
@Override
public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
String aCustomGUI = getCustomGUIResourceName();
- aCustomGUI = aCustomGUI != null ? aCustomGUI : "MultiblockDisplay";
+ aCustomGUI = aCustomGUI != null ? aCustomGUI : hasSlotInGUI() ? "MultiblockDisplay" : "MultiblockDisplay_Generic";
aCustomGUI = aCustomGUI + ".png";
if (hasSlotInGUI()) {
if (!requiresVanillaGtGUI()) {
@@ -150,7 +183,12 @@ GT_MetaTileEntity_MultiBlockBase {
}
}
else {
- return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), aCustomGUI);
+ if (getCustomGUIResourceName() == null && !hasSlotInGUI()) {
+ return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), aCustomGUI);
+ }
+ else {
+ return new GUI_MultiMachine_Default(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), aCustomGUI);
+ }
}
}
@@ -189,31 +227,17 @@ GT_MetaTileEntity_MultiBlockBase {
long minutes = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60);
- int mPollutionReduction=0;
- for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- mPollutionReduction=Math.max(calculatePollutionReductionForHatch(tHatch, 100),mPollutionReduction);
- }
- }
-
- long storedEnergy=0;
- long maxEnergy=0;
- for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU();
- maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity();
- }
- }
-
+ int mPollutionReduction = getPollutionReductionForAllMufflers();
+ long storedEnergy = getStoredEnergyInAllEnergyHatches();
+ long maxEnergy = getMaxEnergyStorageOfAllEnergyHatches();
int tTier = this.getControlCoreTier();
-
mInfo.add(getMachineTooltip());
//Lets borrow the GTNH handling
- mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.Progress")+": "+
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.progress")+": "+
EnumChatFormatting.GREEN + Integer.toString(mProgresstime/20) + EnumChatFormatting.RESET +" s / "+
EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime/20) + EnumChatFormatting.RESET +" s");
@@ -260,6 +284,36 @@ GT_MetaTileEntity_MultiBlockBase {
}
+ public int getPollutionReductionForAllMufflers() {
+ int mPollutionReduction=0;
+ for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ mPollutionReduction=Math.max(calculatePollutionReductionForHatch(tHatch, 100),mPollutionReduction);
+ }
+ }
+ return mPollutionReduction;
+ }
+
+ public long getStoredEnergyInAllEnergyHatches() {
+ long storedEnergy=0;
+ for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU();
+ }
+ }
+ return storedEnergy;
+ }
+
+ public long getMaxEnergyStorageOfAllEnergyHatches() {
+ long maxEnergy=0;
+ for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity();
+ }
+ }
+ return maxEnergy;
+ }
+
@Override
public boolean isGivingInformation() {
return true;
@@ -294,7 +348,7 @@ GT_MetaTileEntity_MultiBlockBase {
}*/
String aRequiresMuffler = "1x Muffler Hatch";
- String aRequiresCoreModule = "1x Core Module";
+ //String aRequiresCoreModule = "1x Core Module";
String aRequiresMaint = "1x Maintanence Hatch";
String[] x = getTooltip();
@@ -330,7 +384,7 @@ GT_MetaTileEntity_MultiBlockBase {
AutoMap<String> aOrderedMap = new AutoMap<String>();
if (showHatches) {
aOrderedMap.put(aRequiresMaint);
- aOrderedMap.put(aRequiresCoreModule);
+ //aOrderedMap.put(aRequiresCoreModule);
if (showPollution) {
aOrderedMap.put(aRequiresMuffler);
}
@@ -361,8 +415,11 @@ GT_MetaTileEntity_MultiBlockBase {
String[] aToolTip = new String[(a2 + a3)];
aToolTip = ArrayUtils.addAll(aToolTip, x);
aToolTip = ArrayUtils.addAll(aToolTip, z);
- aCachedToolTip = aToolTip;
- return aToolTip;
+
+ if (aCachedToolTip == null || aCachedToolTip.length <= 0) {
+ aCachedToolTip = aToolTip;
+ }
+ return aCachedToolTip;
}
public abstract String[] getTooltip();
@@ -414,67 +471,316 @@ GT_MetaTileEntity_MultiBlockBase {
public String getSound() { return ""; }
+
public boolean canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes) {
- if (aRecipe.mOutputs.length > 16) {
- // Gendustry custom comb with a billion centrifuge outputs? Do it anyway.
- return true;
- }
+ return canBufferOutputs(aRecipe, aParallelRecipes, true);
+ }
+
+ public boolean canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes, boolean aAllow16SlotWithoutCheck) {
- // Count slots available in output buses
- ArrayList<ItemStack> tBusStacks = new ArrayList<>();
+ Logger.INFO("Determining if we have space to buffer outputs. Parallel: "+aParallelRecipes);
- int tEmptySlots = 0;
- for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) {
- if (!isValidMetaTileEntity(tBus)) {
- continue;
+ // Null recipe or a recipe with lots of outputs?
+ // E.G. Gendustry custom comb with a billion centrifuge outputs?
+ // Do it anyway, provided the multi allows it. Default behaviour is aAllow16SlotWithoutCheck = true.
+ if (aRecipe == null || aRecipe.mOutputs.length > 16) {
+ if (aRecipe == null) {
+ return false;
}
- final IInventory tBusInv = tBus.getBaseMetaTileEntity();
- for (int i = 0; i < tBusInv.getSizeInventory(); i++) {
- if (tBus.getStackInSlot(i) == null) {
- tEmptySlots++;
+ else if (aRecipe.mOutputs.length > 16) {
+ if (aAllow16SlotWithoutCheck) {
+ return true;
}
else {
- tBusStacks.add(tBus.getStackInSlot(i));
+ // Do nothing, we want to check this recipe properly.
}
- }
- }
+ }
+ }
- int slotsNeeded = aRecipe.mOutputs.length;
- for (final ItemStack tRecipeOutput: aRecipe.mOutputs) {
- if (tRecipeOutput == null) continue;
- int amount = tRecipeOutput.stackSize * aParallelRecipes;
- for (final ItemStack tBusStack : tBusStacks) {
- if (GT_Utility.areStacksEqual(tBusStack, tRecipeOutput)) {
- if (tBusStack.stackSize + amount <= tBusStack.getMaxStackSize()) {
- slotsNeeded--;
- break;
+ // Do we even need to check for item outputs?
+ boolean aDoesOutputItems = aRecipe.mOutputs.length > 0;
+ // Do we even need to check for fluid outputs?
+ boolean aDoesOutputFluids = aRecipe.mFluidOutputs.length > 0;
+
+
+
+ /* ========================================
+ * Item Management
+ * ========================================
+ */
+
+ if (aDoesOutputItems) {
+ Logger.INFO("We have items to output.");
+
+ // How many slots are free across all the output buses?
+ int aInputBusSlotsFree = 0;
+
+ /*
+ * Create Variables for Item Output
+ */
+
+ AutoMap<FlexiblePair<ItemStack, Integer>> aItemMap = new AutoMap<FlexiblePair<ItemStack, Integer>>();
+ AutoMap<ItemStack> aOutputs = new AutoMap<ItemStack>(aRecipe.mOutputs);
+
+ for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) {
+ if (!isValidMetaTileEntity(tBus)) {
+ continue;
+ }
+ final IInventory tBusInv = tBus.getBaseMetaTileEntity();
+ for (int i = 0; i < tBusInv.getSizeInventory(); i++) {
+ if (tBus.getStackInSlot(i) == null) {
+ aInputBusSlotsFree++;
+ }
+ else {
+ ItemStack aT = tBus.getStackInSlot(i);
+ int aSize = aT.stackSize;
+ aT = aT.copy();
+ aT.stackSize = 0;
+ aItemMap.put(new FlexiblePair<ItemStack, Integer>(aT, aSize));
}
+ }
+ }
+
+ // Count the slots we need, later we can check if any are able to merge with existing stacks
+ int aRecipeSlotsRequired = 0;
+
+ // A map to hold the items we will be 'inputting' into the output buses. These itemstacks are actually the recipe outputs.
+ ConcurrentSet<FlexiblePair<ItemStack, Integer>> aInputMap = new ConcurrentHashSet<FlexiblePair<ItemStack, Integer>>();
+
+ // Iterate over the outputs, calculating require stack spacing they will require.
+ for (int i=0;i<aOutputs.size();i++) {
+ ItemStack aY = aOutputs.get(i);
+ if (aY == null) {
+ continue;
}
+ else {
+ int aStackSize = aY.stackSize * aParallelRecipes;
+ if (aStackSize > 64) {
+ int aSlotsNeedsForThisStack = (int) Math.ceil((double) ((float) aStackSize / 64f));
+ // Should round up and add as many stacks as required nicely.
+ aRecipeSlotsRequired += aSlotsNeedsForThisStack;
+ for (int o=0;o<aRecipeSlotsRequired;o++) {
+ int aStackToRemove = (aStackSize -= 64) > 64 ? 64 : aStackSize;
+ aY = aY.copy();
+ aY.stackSize = 0;
+ aInputMap.add(new FlexiblePair<ItemStack, Integer>(aY, aStackToRemove));
+ }
+ }
+ else {
+ // Only requires one slot
+ aRecipeSlotsRequired++;
+ aY = aY.copy();
+ aY.stackSize = 0;
+ aInputMap.add(new FlexiblePair<ItemStack, Integer>(aY, aStackSize));
+ }
+ }
+ }
+
+ // We have items to add to the output buses. See if any are not full stacks and see if we can make them full.
+ if (aInputMap.size() > 0) {
+ // Iterate over the current stored items in the Output busses, if any match and are not full, we can try account for merging.
+ busItems: for (FlexiblePair<ItemStack, Integer> y : aItemMap) {
+ // Iterate over the 'inputs', we can safely remove these as we go.
+ outputItems: for (FlexiblePair<ItemStack, Integer> u : aInputMap) {
+ // Create local vars for readability.
+ ItemStack aOutputBusStack = y.getKey();
+ ItemStack aOutputStack = u.getKey();
+ // Stacks match, including NBT.
+ if (GT_Utility.areStacksEqual(aOutputBusStack, aOutputStack, false)) {
+ // Stack Matches, but it's full, continue.
+ if (aOutputBusStack.stackSize >= 64) {
+ // This stack is full, no point checking it.
+ continue busItems;
+ }
+ else {
+ // We can merge these two stacks without any hassle.
+ if ((aOutputBusStack.stackSize + aOutputStack.stackSize) <= 64) {
+ // Update the stack size in the bus storage map.
+ y.setValue(aOutputBusStack.stackSize + aOutputStack.stackSize);
+ // Remove the 'input' stack from the recipe outputs, so we don't try count it again.
+ aInputMap.remove(u);
+ continue outputItems;
+ }
+ // Stack merging is too much, so we fill this stack, leave the remainder.
+ else {
+ int aRemainder = (aOutputBusStack.stackSize + aOutputStack.stackSize) - 64;
+ // Update the stack size in the bus storage map.
+ y.setValue(64);
+ // Create a new object to iterate over later, with the remainder data;
+ FlexiblePair<ItemStack, Integer> t = new FlexiblePair<ItemStack, Integer>(u.getKey(), aRemainder);
+ // Remove the 'input' stack from the recipe outputs, so we don't try count it again.
+ aInputMap.remove(u);
+ // Add the remainder stack.
+ aInputMap.add(t);
+ continue outputItems;
+ }
+ }
+ }
+ else {
+ continue outputItems;
+ }
+ }
+ }
}
+
+ // We have stacks that did not merge, do we have space for them?
+ if (aInputMap.size() > 0) {
+ if (aInputMap.size() > aInputBusSlotsFree) {
+ // We do not have enough free slots in total to accommodate the remaining managed stacks.
+ Logger.INFO("Failed to find enough space for all item outputs. Free: "+aInputBusSlotsFree+", Required: "+aInputMap.size());
+ return false;
+ }
+ }
+
+ /*
+ * End Item Management
+ */
+
}
- // Enough open slots?
- if (tEmptySlots < slotsNeeded) return false;
- // For each output fluid, make sure an output hatch can accept it.
- for (FluidStack tRecipeFluid: aRecipe.mFluidOutputs) {
- if (tRecipeFluid == null) continue;
- boolean tCanBufferFluid = false;
- int tRecipeAmount = tRecipeFluid.amount;
- for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) {
- FluidStack tHatchFluid = tHatch.getFluid();
- if (tHatchFluid == null) {
- if(tHatch.getCapacity() > tRecipeAmount) {
- tCanBufferFluid = true;
- break;
- }
+
+
+
+
+ /* ========================================
+ * Fluid Management
+ * ========================================
+ */
+
+
+
+ if (aDoesOutputFluids) {
+ Logger.INFO("We have Fluids to output.");
+ // How many slots are free across all the output buses?
+ int aFluidHatches = 0;
+ int aEmptyFluidHatches = 0;
+ int aFullFluidHatches = 0;
+ // Create Map for Fluid Output
+ ConcurrentHashSet<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>> aOutputHatches = new ConcurrentHashSet<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>>();
+ for (final GT_MetaTileEntity_Hatch_Output tBus : this.mOutputHatches) {
+ if (!isValidMetaTileEntity(tBus)) {
+ continue;
}
- else if (tHatchFluid.isFluidEqual(tRecipeFluid) && tHatch.getCapacity() - tHatchFluid.amount > tRecipeAmount) {
- tCanBufferFluid = true;
- break;
+ aFluidHatches++;
+ // Map the Hatch with the space left for easy checking later.
+ if (tBus.getFluid() == null) {
+ aOutputHatches.add(new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(tBus, null, tBus.getCapacity()));
+ }
+ else {
+ int aSpaceLeft = tBus.getCapacity() - tBus.getFluidAmount();
+ aOutputHatches.add(new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(tBus, tBus.getFluid(), aSpaceLeft));
+ }
+ }
+ // Create a map of all the fluids we would like to output, we can iterate over this and see how many we can merge into existing hatch stacks.
+ ConcurrentHashSet<FluidStack> aOutputFluids = new ConcurrentHashSet<FluidStack>();
+ // Ugly ass boxing
+ aOutputFluids.addAll(new AutoMap<FluidStack>(aRecipe.mFluidOutputs));
+ // Iterate the Hatches, updating their 'stored' data.
+ aHatchIterator: for (Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aHatchData : aOutputHatches) {
+ // The Hatch Itself
+ GT_MetaTileEntity_Hatch_Output aHatch = aHatchData.getValue_1();
+ // Fluid in the Hatch
+ FluidStack aHatchStack = aHatchData.getValue_2();
+ // Space left in Hatch
+ int aSpaceLeftInHatch = aHatch.getCapacity() - aHatch.getFluidAmount();
+ // Hatch is full,
+ if (aSpaceLeftInHatch <= 0) {
+ aFullFluidHatches++;
+ aOutputHatches.remove(aHatchData);
+ continue aHatchIterator;
+ }
+ // Hatch has space
+ else {
+ // Check if any fluids match
+ aFluidMatch: for (FluidStack aOutputStack : aOutputFluids) {
+ if (GT_Utility.areFluidsEqual(aHatchStack, aOutputStack)) {
+ int aFluidToPutIntoHatch = aOutputStack.amount;
+ // Not Enough space to insert all of the fluid.
+ // We fill this hatch and add a smaller Fluidstack back to the iterator.
+ if (aSpaceLeftInHatch < aFluidToPutIntoHatch) {
+ // Copy existing Hatch Stack
+ FluidStack aNewHatchStack = aHatchStack.copy();
+ aNewHatchStack.amount = 0;
+ // Copy existing Hatch Stack again
+ FluidStack aNewOutputStack = aHatchStack.copy();
+ aNewOutputStack.amount = 0;
+ // How much fluid do we have left after we fill the hatch?
+ int aFluidLeftAfterInsert = aFluidToPutIntoHatch - aSpaceLeftInHatch;
+ // Set new stacks to appropriate values
+ aNewHatchStack.amount = aHatch.getCapacity();
+ aNewOutputStack.amount = aFluidLeftAfterInsert;
+ // Remove fluid from output list, merge success
+ aOutputFluids.remove(aOutputStack);
+ // Remove hatch from hatch list, data is now invalid.
+ aOutputHatches.remove(aHatchData);
+ // Add remaining Fluid to Output list
+ aOutputFluids.add(aNewOutputStack);
+ // Re-add hatch to hatch list, with new data.
+ Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount);
+ aOutputHatches.add(aNewHatchData);
+ continue aHatchIterator;
+ }
+ // We can fill this hatch perfectly (rare case), may as well add it directly to the full list.
+ else if (aSpaceLeftInHatch == aFluidToPutIntoHatch) {
+ // Copy Old Stack
+ FluidStack aNewHatchStack = aHatchStack.copy();
+ // Add in amount from output stack
+ aNewHatchStack.amount += aOutputStack.amount;
+ // Remove fluid from output list, merge success
+ aOutputFluids.remove(aOutputStack);
+ // Remove hatch from hatch list, data is now invalid.
+ aOutputHatches.remove(aHatchData);
+ // Re-add hatch to hatch list, with new data.
+ Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount);
+ aOutputHatches.add(aNewHatchData);
+ continue aHatchIterator;
+ }
+ // We have more space than we need to merge, so we remove the stack from the output list and update the hatch list.
+ else {
+ // Copy Old Stack
+ FluidStack aNewHatchStack = aHatchStack.copy();
+ // Add in amount from output stack
+ aNewHatchStack.amount += aOutputStack.amount;
+ // Remove fluid from output list, merge success
+ aOutputFluids.remove(aOutputStack);
+ // Remove hatch from hatch list, data is now invalid.
+ aOutputHatches.remove(aHatchData);
+ // Re-add hatch to hatch list, with new data.
+ Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount);
+ aOutputHatches.add(aNewHatchData);
+ // Check next fluid
+ continue aFluidMatch;
+ }
+
+ }
+ else {
+ continue aFluidMatch;
+ }
+ }
}
}
- if (!tCanBufferFluid) return false;
+
+ for (Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aFreeHatchCheck : aOutputHatches) {
+ // Free Hatch
+ if (aFreeHatchCheck.getValue_2() == null || aFreeHatchCheck.getValue_3() == 0 || aFreeHatchCheck.getValue_1().getFluid() == null) {
+ aEmptyFluidHatches++;
+ }
+ }
+
+ // We have Fluid Stacks we did not merge. Do we have space?
+ if (aOutputFluids.size() > 0) {
+ // Not enough space to add fluids.
+ if (aOutputFluids.size() < aEmptyFluidHatches) {
+ Logger.INFO("Failed to find enough space for all fluid outputs.");
+ return false;
+ }
+ }
+
+ /*
+ * End Fluid Management
+ */
}
+
return true;
}
@@ -484,21 +790,26 @@ GT_MetaTileEntity_MultiBlockBase {
public static Method aLogger = null;
public void log(String s) {
-
- boolean isDebugLogging = CORE.DEBUG;
boolean reset = true;
-
- if (aLogger == null || reset) {
- if (isDebugLogging) {
- aLogger = ReflectionUtils.getMethod(Logger.class, "INFO", String.class);
+ if (reset || aLogger == null) {
+ if (!AsmConfig.disableAllLogging) {
+ aLogger = ReflectionUtils.getMethod(
+ Logger.class, "INFO", String.class
+ );
}
else {
- aLogger = ReflectionUtils.getMethod(Logger.class, "MACHINE_INFO", String.class);
+ aLogger = ReflectionUtils.getMethod(
+ Logger.class, "MACHINE_INFO", String.class
+ );
}
}
try {
aLogger.invoke(null, s);
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {}
+ }
+ catch (IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException e) {
+ e.printStackTrace();
+ }
}
@@ -678,12 +989,20 @@ GT_MetaTileEntity_MultiBlockBase {
* log("GOOD RETURN - 1"); return true; }
*/
+ public long getMaxInputEnergy() {
+ long rEnergy = 0;
+ if (mEnergyHatches.size() < 2) // so it only takes 1 amp is only 1 hatch is present so it works like most gt multies
+ return mEnergyHatches.get(0).getBaseMetaTileEntity().getInputVoltage();
+ for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches)
+ if (isValidMetaTileEntity(tHatch)) rEnergy += tHatch.getBaseMetaTileEntity().getInputVoltage() * tHatch.getBaseMetaTileEntity().getInputAmperage();
+ return rEnergy;
+ }
+
public boolean checkRecipeGeneric(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) {
- // Based on the Processing Array. A bit overkill, but very flexible.
-
+ // Based on the Processing Array. A bit overkill, but very flexible.
// Reset outputs and progress stats
this.mEUt = 0;
@@ -693,13 +1012,13 @@ GT_MetaTileEntity_MultiBlockBase {
long tVoltage = getMaxInputVoltage();
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
log("Running checkRecipeGeneric(0)");
-
-
+
GT_Recipe tRecipe = findRecipe(
getBaseMetaTileEntity(), mLastRecipe, false,
- gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
-
+ gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
+
log("Running checkRecipeGeneric(1)");
// Remember last recipe - an optimization for findRecipe()
this.mLastRecipe = tRecipe;
@@ -708,6 +1027,50 @@ GT_MetaTileEntity_MultiBlockBase {
log("BAD RETURN - 1");
return false;
}
+
+
+ /*
+ * Check for Special Behaviours
+ */
+
+ // First populate the map if we need to.
+ if (mCustomBehviours == null || mCustomBehviours.isEmpty()) {
+ mCustomBehviours.putAll(Multiblock_API.getSpecialBehaviourItemMap());
+ }
+
+ // We have a special slot object in the recipe
+ if (tRecipe.mSpecialItems != null) {
+ // The special slot is an item
+ if (tRecipe.mSpecialItems instanceof ItemStack) {
+ // Make an Itemstack instance of this.
+ ItemStack aSpecialStack = (ItemStack) tRecipe.mSpecialItems;
+ // Check if this item is in an input bus.
+ boolean aDidFindMatch = false;
+ for (ItemStack aInputItemsToCheck : aItemInputs) {
+ // If we find a matching stack, continue.
+ if (GT_Utility.areStacksEqual(aSpecialStack, aInputItemsToCheck, false)) {
+ // Iterate all special behaviour items, to see if we need to utilise one.
+ aDidFindMatch = true;
+ break;
+ }
+ }
+ // Try prevent needless iteration loops if we don't have the required inputs at all.
+ if (aDidFindMatch) {
+ // Iterate all special behaviour items, to see if we need to utilise one.
+ for (SpecialMultiBehaviour aBehaviours : mCustomBehviours.values()) {
+ // Found a match, let's adjust this recipe now.
+ if (aBehaviours.isTriggerItem(aSpecialStack)) {
+ // Adjust this recipe to suit special item
+ aMaxParallelRecipes = aBehaviours.getMaxParallelRecipes();
+ aEUPercent = aBehaviours.getEUPercent();
+ aSpeedBonusPercent = aBehaviours.getSpeedBonusPercent();
+ aOutputChanceRoll = aBehaviours.getOutputChanceRoll();
+ break;
+ }
+ }
+ }
+ }
+ }
if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) {
log("BAD RETURN - 2");
@@ -726,7 +1089,7 @@ GT_MetaTileEntity_MultiBlockBase {
log("tVoltage: "+tVoltage);
log("tRecipeEUt: "+tRecipeEUt);
// Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
- for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) {
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
log("Broke at "+parallelRecipes+".");
break;
@@ -743,6 +1106,7 @@ GT_MetaTileEntity_MultiBlockBase {
// -- Try not to fail after this point - inputs have already been consumed! --
+
// Convert speed bonus to duration multiplier
// e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
@@ -835,7 +1199,7 @@ GT_MetaTileEntity_MultiBlockBase {
log("GOOD RETURN - 1");
return true;
-}
+ }
@@ -932,10 +1296,10 @@ GT_MetaTileEntity_MultiBlockBase {
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) {
-
+
long tVoltage = getMaxInputVoltage();
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
-
+ long tEnergy = getMaxInputEnergy();
log("Running checkRecipeGeneric(0)");
GT_Recipe tRecipe = aRecipe != null ? aRecipe : findRecipe(
@@ -943,12 +1307,12 @@ GT_MetaTileEntity_MultiBlockBase {
gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
log("Running checkRecipeGeneric(1)");
-
+
//First we check whether or not we have an input cached for boosting.
//If not, we set it to the current recipe.
//If we do, we compare it against the current recipe, if thy are the same, we try return a boosted recipe, if not, we boost a new recipe.
boolean isRecipeInputTheSame = false;
-
+
//No cached recipe inputs, assume first run.
if (mInputVerificationForBoosting == null) {
mInputVerificationForBoosting = tRecipe.mInputs;
@@ -963,7 +1327,7 @@ GT_MetaTileEntity_MultiBlockBase {
isRecipeInputTheSame = false;
}
}
-
+
//Inputs are the same, let's see if there's a boosted version.
if (isRecipeInputTheSame) {
//Yes, let's just set that as the recipe
@@ -999,14 +1363,14 @@ GT_MetaTileEntity_MultiBlockBase {
mHasBoostedCurrentRecipe = false;
}
}
-
+
//Bad modify, let's just use the original recipe.
if (!mHasBoostedCurrentRecipe || mBoostedRecipe == null) {
tRecipe = aRecipe != null ? aRecipe : findRecipe(
getBaseMetaTileEntity(), mLastRecipe, false,
gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
}
-
+
// Remember last recipe - an optimization for findRecipe()
this.mLastRecipe = tRecipe;
@@ -1032,7 +1396,7 @@ GT_MetaTileEntity_MultiBlockBase {
log("tVoltage: "+tVoltage);
log("tRecipeEUt: "+tRecipeEUt);
// Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
- for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) {
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
log("Broke at "+parallelRecipes+".");
break;
@@ -1188,6 +1552,7 @@ GT_MetaTileEntity_MultiBlockBase {
this.mChargeHatches.clear();
this.mDischargeHatches.clear();
this.mControlCoreBus.clear();
+ this.mAirIntakes.clear();
this.mMultiDynamoHatches.clear();
}
}
@@ -1252,22 +1617,22 @@ GT_MetaTileEntity_MultiBlockBase {
ItemStack guiSlot = this.mInventory[1];
return guiSlot;
}
-
+
protected boolean setGUIItemStack(ItemStack aNewGuiSlotContents) {
boolean result = false;
if (this.mInventory[1] == null) {
this.mInventory[1] = aNewGuiSlotContents != null ? aNewGuiSlotContents.copy() : null;
- aNewGuiSlotContents = null;
+ this.depleteInput(aNewGuiSlotContents);
this.updateSlots();
result = true;
}
return result;
}
-
+
protected boolean clearGUIItemSlot() {
return setGUIItemStack(null);
}
-
+
public ItemStack findItemInInventory(Item aSearchStack) {
return findItemInInventory(aSearchStack, 0);
@@ -1276,7 +1641,7 @@ GT_MetaTileEntity_MultiBlockBase {
public ItemStack findItemInInventory(Item aSearchStack, int aMeta) {
return findItemInInventory(ItemUtils.simpleMetaStack(aSearchStack, aMeta, 1));
}
-
+
public ItemStack findItemInInventory(ItemStack aSearchStack) {
if (aSearchStack != null && this.mInputBusses.size() > 0) {
for (GT_MetaTileEntity_Hatch_InputBus bus : this.mInputBusses) {
@@ -1325,54 +1690,63 @@ GT_MetaTileEntity_MultiBlockBase {
public boolean causeMaintenanceIssue() {
boolean b = false;
switch (this.getBaseMetaTileEntity().getRandomNumber(6)) {
- case 0 : {
- this.mWrench = false;
- b = true;
- break;
- }
- case 1 : {
- this.mScrewdriver = false;
- b = true;
- break;
- }
- case 2 : {
- this.mSoftHammer = false;
- b = true;
- break;
- }
- case 3 : {
- this.mHardHammer = false;
- b = true;
- break;
- }
- case 4 : {
- this.mSolderingTool = false;
- b = true;
- break;
- }
- case 5 : {
- this.mCrowbar = false;
- b = true;
- break;
- }
+ case 0 : {
+ this.mWrench = false;
+ b = true;
+ break;
+ }
+ case 1 : {
+ this.mScrewdriver = false;
+ b = true;
+ break;
+ }
+ case 2 : {
+ this.mSoftHammer = false;
+ b = true;
+ break;
+ }
+ case 3 : {
+ this.mHardHammer = false;
+ b = true;
+ break;
+ }
+ case 4 : {
+ this.mSolderingTool = false;
+ b = true;
+ break;
+ }
+ case 5 : {
+ this.mCrowbar = false;
+ b = true;
+ break;
+ }
}
return b;
}
+ public void fixAllMaintenanceIssue() {
+ this.mCrowbar = true;
+ this.mWrench = true;
+ this.mHardHammer = true;
+ this.mSoftHammer = true;
+ this.mSolderingTool = true;
+ this.mScrewdriver = true;
+ }
+
public <E> boolean addToMachineListInternal(ArrayList<E> aList, final IMetaTileEntity aTileEntity,
final int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
}
-
+
//Check type
/*
* Class <?> aHatchType = ReflectionUtils.getTypeOfGenericObject(aList); if
* (!aHatchType.isInstance(aTileEntity)) { return false; }
*/
-
-
+
+
if (aList.isEmpty()) {
if (aTileEntity instanceof GT_MetaTileEntity_Hatch) {
if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) {
@@ -1387,13 +1761,15 @@ GT_MetaTileEntity_MultiBlockBase {
boolean aExists = false;
for (E m : aList) {
IGregTechTileEntity b = ((IMetaTileEntity) m).getBaseMetaTileEntity();
- BlockPos aPos = new BlockPos(b);
- if (b != null && aPos != null) {
- if (aCurPos.equals(aPos)) {
- if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) {
- log("Found Duplicate "+b.getInventoryName()+" at " + aPos.getLocationString());
+ if (b != null) {
+ BlockPos aPos = new BlockPos(b);
+ if (aPos != null) {
+ if (aCurPos.equals(aPos)) {
+ if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) {
+ log("Found Duplicate "+b.getInventoryName()+" at " + aPos.getLocationString());
+ }
+ return false;
}
- return false;
}
}
}
@@ -1546,6 +1922,20 @@ GT_MetaTileEntity_MultiBlockBase {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
+ public boolean addAirIntakeToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ }
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_AirIntake) {
+ this.mAirIntakes.add((GT_MetaTileEntity_Hatch_AirIntake)aMetaTileEntity);
+ }
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+
public boolean addFluidInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
@@ -1569,6 +1959,10 @@ GT_MetaTileEntity_MultiBlockBase {
return false;
}
+ public boolean clearRecipeMapForAllInputHatches() {
+ return resetRecipeMapForAllInputHatches(null);
+ }
+
public boolean resetRecipeMapForAllInputHatches() {
return resetRecipeMapForAllInputHatches(this.getRecipeMap());
}
@@ -1588,17 +1982,22 @@ GT_MetaTileEntity_MultiBlockBase {
return cleared > 0;
}
public boolean resetRecipeMapForHatch(IGregTechTileEntity aTileEntity, GT_Recipe_Map aMap) {
- if (aTileEntity == null) {
- return false;
- }
- final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();;
- if (aMetaTileEntity == null) {
- return false;
- }
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
- return resetRecipeMapForHatch((GT_MetaTileEntity_Hatch)aMetaTileEntity, aMap);
+ try {
+ if (aTileEntity == null) {
+ return false;
+ }
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
+ return resetRecipeMapForHatch((GT_MetaTileEntity_Hatch)aMetaTileEntity, aMap);
+ }
+ else {
+ return false;
+ }
}
- else {
+ catch (Throwable t) {
return false;
}
}
@@ -1611,12 +2010,23 @@ GT_MetaTileEntity_MultiBlockBase {
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input){
((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = null;
- ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = aMap;
- log("Remapped Input Hatch to "+aMap.mNEIName);
+ ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = aMap;
+ if (aMap != null && aMap.mNEIName != null) {
+ log("Remapped Input Hatch to "+aMap.mNEIName+".");
+ }
+ else {
+ log("Cleared Input Hatch.");
+ }
}
else {
((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = null;
- ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = aMap;
+ ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = aMap;
+ if (aMap != null && aMap.mNEIName != null) {
+ log("Remapped Input Bus to "+aMap.mNEIName+".");
+ }
+ else {
+ log("Cleared Input Bus.");
+ }
}
return true;
}
@@ -1628,8 +2038,9 @@ GT_MetaTileEntity_MultiBlockBase {
@Override
public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
- resetRecipeMapForAllInputHatches();
+ clearRecipeMapForAllInputHatches();
onModeChangeByScrewdriver(aSide, aPlayer, aX, aY, aZ);
+ resetRecipeMapForAllInputHatches();
}
public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
@@ -1745,7 +2156,7 @@ GT_MetaTileEntity_MultiBlockBase {
@SuppressWarnings("rawtypes")
public boolean isThisHatchMultiDynamo(Object aMetaTileEntity){
- Class mDynamoClass;
+ Class<?> mDynamoClass;
mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti");
if (mDynamoClass != null){
if (mDynamoClass.isInstance(aMetaTileEntity)){
@@ -1784,20 +2195,16 @@ GT_MetaTileEntity_MultiBlockBase {
}
}
- private static Method calculatePollutionReduction;
+ private static Method calculatePollutionReduction = null;
public int calculatePollutionReductionForHatch(GT_MetaTileEntity_Hatch_Muffler i , int g) {
- if (calculatePollutionReduction == null) {
+ if (calculatePollutionReduction != null) {
try {
- calculatePollutionReduction = i.getClass().getDeclaredMethod("calculatePollutionReduction", int.class);
- } catch (NoSuchMethodException | SecurityException e) {
- calculatePollutionReduction = null;
+ return (int) calculatePollutionReduction.invoke(i, g);
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+
}
- }
- try {
- return (int) calculatePollutionReduction.invoke(i, g);
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- return 0;
}
+ return 0;
}
@Override
@@ -2104,6 +2511,59 @@ GT_MetaTileEntity_MultiBlockBase {
return false;
}
+ @Override
+ public boolean depleteInput(final FluidStack aLiquid) {
+ if (aLiquid == null) {
+ return false;
+ }
+ for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) {
+ tHatch.mRecipeMap = this.getRecipeMap();
+ if (isValidMetaTileEntity(tHatch)) {
+ FluidStack tLiquid = tHatch.getFluid();
+ if (tLiquid == null || !tLiquid.isFluidEqual(aLiquid) || tLiquid.amount < aLiquid.amount) {
+ continue;
+ }
+ tLiquid = tHatch.drain(aLiquid.amount, false);
+ if (tLiquid != null && tLiquid.amount >= aLiquid.amount) {
+ tLiquid = tHatch.drain(aLiquid.amount, true);
+ return tLiquid != null && tLiquid.amount >= aLiquid.amount;
+ }
+ continue;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void onServerStart() {
+ super.onServerStart();
+ tryTickWaitTimerDown();
+ }
+
+ @Override
+ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
+ super.onFirstTick(aBaseMetaTileEntity);
+ tryTickWaitTimerDown();
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ tryTickWaitTimerDown();
+ }
+
+ @Override
+ public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) {
+ super.onCreated(aStack, aWorld, aPlayer);
+ tryTickWaitTimerDown();
+ }
+
+ private final void tryTickWaitTimerDown() {
+ /*if (mStartUpCheck > 10) {
+ mStartUpCheck = 10;
+ }*/
+ }
+
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockRequirements.java b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockRequirements.java
index afdf36f930..10909081d1 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockRequirements.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockRequirements.java
@@ -2,35 +2,22 @@ package gtPlusPlus.xmod.gregtech.api.objects;
public class MultiblockRequirements {
- public final int mInputBusMinimum;
- public final int mInputHatchMinimum;
+ public int mInputBusMinimum = 0;
+ public int mInputHatchMinimum = 0;
- public final int mOutputBusMinimum;
- public final int mOutputHatchMinimum;
+ public int mOutputBusMinimum = 0;
+ public int mOutputHatchMinimum = 0;
- public final int mMaintMinimum;
+ public int mMaintMinimum = 1;
- public final int mEnergyHatchMinimum;
- public final int mDynamoHatchMinimum;
+ public int mEnergyHatchMinimum = 1;
+ public int mDynamoHatchMinimum = 0;
- public final MultiblockBlueprint mBlueprint;
-
- public static final int mControlCoreMinimum = 1;
+ public final int mMinimumCasingCount;
- /**
- *
- * @param aInputBusses
- * @param aOutputBusses
- * @param aInputHatches
- * @param aOutputHatches
- * @param aEnergyHatches
- * @param aDynamoHatches
- * @param aBlueprint - A data object containing the structural data for this Multiblock
- */
- public MultiblockRequirements(final int aInputBusses, final int aOutputBusses, final int aInputHatches, final int aOutputHatches, final int aEnergyHatches, final int aDynamoHatches, final MultiblockBlueprint aBlueprint) {
- this(aInputBusses, aOutputBusses, aInputHatches, aOutputHatches, aEnergyHatches, aDynamoHatches, 1, aBlueprint);
- }
+ public final MultiblockBlueprint mBlueprint;
+ //public static final int mControlCoreMinimum = 1;
/**
*
* @param aInputBusses
@@ -42,15 +29,80 @@ public class MultiblockRequirements {
* @param aMaintHatches
* @param aBlueprint - A data object containing the structural data for this Multiblock
*/
- public MultiblockRequirements(final int aInputBusses, final int aOutputBusses, final int aInputHatches, final int aOutputHatches, final int aEnergyHatches, final int aDynamoHatches, final int aMaintHatches, final MultiblockBlueprint aBlueprint) {
- mInputBusMinimum = aInputBusses;
- mOutputBusMinimum = aOutputBusses;
- mInputHatchMinimum = aInputHatches;
- mOutputHatchMinimum = aOutputHatches;
- mEnergyHatchMinimum = aEnergyHatches;
- mDynamoHatchMinimum = aDynamoHatches;
- mMaintMinimum = aMaintHatches;
+ public MultiblockRequirements(int aCasingCount, MultiblockBlueprint aBlueprint) {
+ mMinimumCasingCount = aCasingCount;
mBlueprint = aBlueprint;
+ }
+
+ public final int getInputBusMinimum() {
+ return this.mInputBusMinimum;
+ }
+
+ public final MultiblockRequirements setInputBusMinimum(int mInputBusMinimum) {
+ this.mInputBusMinimum = mInputBusMinimum;
+ return this;
+ }
+
+ public final int getInputHatchMinimum() {
+ return this.mInputHatchMinimum;
+ }
+
+ public final MultiblockRequirements setInputHatchMinimum(int mInputHatchMinimum) {
+ this.mInputHatchMinimum = mInputHatchMinimum;
+ return this;
+ }
+
+ public final int getOutputBusMinimum() {
+ return this.mOutputBusMinimum;
+ }
+
+ public final MultiblockRequirements setOutputBusMinimum(int mOutputBusMinimum) {
+ this.mOutputBusMinimum = mOutputBusMinimum;
+ return this;
+ }
+
+ public final int getOutputHatchMinimum() {
+ return this.mOutputHatchMinimum;
+ }
+
+ public final MultiblockRequirements setOutputHatchMinimum(int mOutputHatchMinimum) {
+ this.mOutputHatchMinimum = mOutputHatchMinimum;
+ return this;
+ }
+
+ public final int getMaintMinimum() {
+ return this.mMaintMinimum;
+ }
+
+ public final MultiblockRequirements setMaintMinimum(int mMaintMinimum) {
+ this.mMaintMinimum = mMaintMinimum;
+ return this;
+ }
+
+ public final int getEnergyHatchMinimum() {
+ return this.mEnergyHatchMinimum;
+ }
+
+ public final MultiblockRequirements setEnergyHatchMinimum(int mEnergyHatchMinimum) {
+ this.mEnergyHatchMinimum = mEnergyHatchMinimum;
+ return this;
+ }
+
+ public final int getDynamoHatchMinimum() {
+ return this.mDynamoHatchMinimum;
+ }
+
+ public final MultiblockRequirements setDynamoHatchMinimum(int mDynamoHatchMinimum) {
+ this.mDynamoHatchMinimum = mDynamoHatchMinimum;
+ return this;
+ }
+
+ public final MultiblockBlueprint getBlueprint() {
+ return this.mBlueprint;
+ }
+
+ public final int getMinimumCasingCount() {
+ return this.mMinimumCasingCount;
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java b/src/Java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java
new file mode 100644
index 0000000000..74655fb744
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java
@@ -0,0 +1,35 @@
+package gtPlusPlus.xmod.gregtech.api.util;
+
+import java.util.HashMap;
+
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.event.entity.player.ItemTooltipEvent;
+
+public class SpecialBehaviourTooltipHandler {
+
+ private static final HashMap<ItemStack, String> mTooltipCache = new HashMap<ItemStack, String>();
+
+ public static void addTooltipForItem(ItemStack aStack, String aTooltip) {
+ mTooltipCache.put(aStack, aTooltip);
+ }
+
+ @SubscribeEvent
+ public void onItemTooltip(ItemTooltipEvent event){
+ if (event != null) {
+ if (event.itemStack != null) {
+ for (ItemStack aKey : mTooltipCache.keySet()) {
+ if (GT_Utility.areStacksEqual(aKey, event.itemStack, false)) {
+ String s = mTooltipCache.get(aKey);
+ if (s != null && s.length() > 0) {
+ event.toolTip.add(EnumChatFormatting.RED+s);
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java
index c8a7b5119d..ca78a72e04 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java
@@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.world;
import java.util.Collection;
import java.util.Random;
+import gtPlusPlus.core.lib.CORE;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.util.MathHelper;
@@ -21,7 +22,7 @@ public class GTPP_Worldgen_Boulder extends GTPP_Worldgen_Ore {
int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16);
Block tBlock = aWorld.getBlock(tX, tY - 7, tZ);
if (tBlock != null && tBlock.isOpaqueCube() && aWorld.getBlock(tX, tY - 6, tZ).isAir(aWorld, tX, tY - 6, tZ)) {
- float math_pi = 3.141593F;
+ float math_pi = CORE.PI;
float var6 = aRandom.nextFloat() * math_pi;
float var1b = mSize / 8.0F;
float var3b = MathHelper.sin(var6) * var1b; float var4b = MathHelper.cos(var6) * var1b;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java
index 9d7eb5a020..e66106ad4a 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java
@@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.world;
import java.util.Collection;
import java.util.Random;
+import gtPlusPlus.core.lib.CORE;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
@@ -20,7 +21,7 @@ public class GTPP_Worldgen_Ore_Normal extends GTPP_Worldgen_Ore {
for (int i = 0; i < mAmount; i++) {
int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16);
if (mAllowToGenerateinVoid || aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ)) {
- float math_pi = 3.141593F;float var1b = mSize / 8.0F;
+ float math_pi = CORE.PI;float var1b = mSize / 8.0F;
float var6 = aRandom.nextFloat() * math_pi;
float var3b = MathHelper.sin(var6) * var1b; float var4b = MathHelper.cos(var6) * var1b;
float var8b = -2*var3b;float var9b = -2*var4b;