aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java8
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java20
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_2by2.java31
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_4by4.java43
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_2by2.java36
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_4by4.java36
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_2by2.java22
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_4by4.java35
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_2by2.java19
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_4by4.java20
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java861
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java248
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java226
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java219
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java22
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java73
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java298
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java23
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/command/regen/GTPP_WorldRegenerator.java135
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/command/regen/HANDLER_GT_Commands.java129
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java407
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java44
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java98
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java687
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java521
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java236
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java51
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java174
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java254
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java111
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java34
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java283
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java132
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java8
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java30
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java10
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java197
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java18
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCuttingFactory.java25
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialGeneratorArray.java26
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechMiniRaFusion.java61
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java18
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRTG.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java57
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechWirelessChargers.java49
59 files changed, 5374 insertions, 700 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java
index 5dfb9ebd2b..8251387aff 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java
@@ -1,16 +1,11 @@
package gtPlusPlus.xmod.gregtech;
-import java.io.File;
import java.util.ArrayList;
import java.util.List;
-import gregtech.api.GregTech_API;
import gregtech.api.util.GT_Config;
-import gregtech.api.util.MultiblockRecipeMapHandler;
-import gregtech.api.world.GT_Worldgen;
import gtPlusPlus.core.handler.COMPAT_HANDLER;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.recipe.RECIPES_LaserEngraver;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config;
import gtPlusPlus.xmod.gregtech.api.world.GTPP_Worldgen;
@@ -19,7 +14,6 @@ import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems;
import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools;
import gtPlusPlus.xmod.gregtech.loaders.*;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits;
-import net.minecraftforge.common.config.Configuration;
public class HANDLER_GT {
@@ -28,7 +22,6 @@ public class HANDLER_GT {
public static GTPP_Config sCustomWorldgenFile = null;
public static final List<GTPP_Worldgen> sCustomWorldgenList = new ArrayList<GTPP_Worldgen>();
- @SuppressWarnings("unused")
public static void preInit(){
new MetaGeneratedGregtechItems();
@@ -38,7 +31,6 @@ public class HANDLER_GT {
GregtechFluidHandler.run();
}
- @SuppressWarnings("unused")
public static void init(){
//Load General Blocks and set up some Basic Meta Tile Entitie states
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
index 2032555a7f..7a0df6c43c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
@@ -173,7 +173,7 @@ public enum GregtechItemList implements GregtechItemContainer {
Casing_Autocrafter,
- Casing_PlaceHolder13,
+ Casing_CuttingFactoryFrame,
Casing_PlaceHolder14,
Casing_PlaceHolder15,
@@ -253,6 +253,24 @@ public enum GregtechItemList implements GregtechItemContainer {
Machine_Advanced_EV_Mixer, Machine_Advanced_IV_Mixer, Machine_Advanced_LuV_Mixer,
Machine_Advanced_ZPM_Mixer, Machine_Advanced_UV_Mixer,
+ //Custom hatches
+ Hatch_Input_Battery_MV, Hatch_Input_Battery_EV,
+ Hatch_Output_Battery_MV, Hatch_Output_Battery_EV,
+
+ //Wireless Chargers
+ Charger_LV, Charger_MV, Charger_HV,
+ Charger_EV, Charger_IV, Charger_LuV,
+ Charger_ZPM, Charger_UV, Charger_MAX,
+
+ //Generator Array
+ Generator_Array_Controller,
+
+ //Cutting Factory Controller
+ Industrial_CuttingFactoryController,
+
+ //Tiny Fusion
+ Miniature_Fusion,
+
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_2by2.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_2by2.java
new file mode 100644
index 0000000000..60106825a0
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_2by2.java
@@ -0,0 +1,31 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches;
+
+import gregtech.api.gui.GT_ContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Slot;
+
+public class CONTAINER_2by2 extends GT_ContainerMetaTile_Machine {
+
+ public CONTAINER_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new Slot(mTileEntity, 0, 71, 26));
+ addSlotToContainer(new Slot(mTileEntity, 1, 89, 26));
+ addSlotToContainer(new Slot(mTileEntity, 2, 71, 44));
+ addSlotToContainer(new Slot(mTileEntity, 3, 89, 44));
+ }
+
+ @Override
+ public int getSlotCount() {
+ return 4;
+ }
+
+ @Override
+ public int getShiftClickSlotCount() {
+ return 4;
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_4by4.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_4by4.java
new file mode 100644
index 0000000000..0c011f164b
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_4by4.java
@@ -0,0 +1,43 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches;
+
+import gregtech.api.gui.GT_ContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Slot;
+
+public class CONTAINER_4by4 extends GT_ContainerMetaTile_Machine {
+
+ public CONTAINER_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new Slot(mTileEntity, 0, 53, 8));
+ addSlotToContainer(new Slot(mTileEntity, 1, 71, 8));
+ addSlotToContainer(new Slot(mTileEntity, 2, 89, 8));
+ addSlotToContainer(new Slot(mTileEntity, 3, 107, 8));
+ addSlotToContainer(new Slot(mTileEntity, 4, 53, 26));
+ addSlotToContainer(new Slot(mTileEntity, 5, 71, 26));
+ addSlotToContainer(new Slot(mTileEntity, 6, 89, 26));
+ addSlotToContainer(new Slot(mTileEntity, 7, 107, 26));
+ addSlotToContainer(new Slot(mTileEntity, 8, 53, 44));
+ addSlotToContainer(new Slot(mTileEntity, 9, 71, 44));
+ addSlotToContainer(new Slot(mTileEntity, 10, 89, 44));
+ addSlotToContainer(new Slot(mTileEntity, 11, 107, 44));
+ addSlotToContainer(new Slot(mTileEntity, 12, 53, 62));
+ addSlotToContainer(new Slot(mTileEntity, 13, 71, 62));
+ addSlotToContainer(new Slot(mTileEntity, 14, 89, 62));
+ addSlotToContainer(new Slot(mTileEntity, 15, 107, 62));
+ }
+
+ @Override
+ public int getSlotCount() {
+ return 16;
+ }
+
+ @Override
+ public int getShiftClickSlotCount() {
+ return 16;
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_2by2.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_2by2.java
new file mode 100644
index 0000000000..b78d8454c3
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_2by2.java
@@ -0,0 +1,36 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
+
+public class GUI_2by2 extends GT_GUIContainerMetaTile_Machine {
+
+ private final String mName;
+
+ public GUI_2by2(CONTAINER_2by2 containerType, InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(containerType, RES_PATH_GUI + "2by2.png");
+ mName = aName;
+ }
+
+ public GUI_2by2(CONTAINER_2by2 containerType, InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) {
+ super(containerType, RES_PATH_GUI + aBackground + "2by2.png");
+ mName = aName;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString(mName, 8, 4, 4210752);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_4by4.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_4by4.java
new file mode 100644
index 0000000000..4cd599110c
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_4by4.java
@@ -0,0 +1,36 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
+
+public class GUI_4by4 extends GT_GUIContainerMetaTile_Machine {
+
+ private final String mName;
+
+ public GUI_4by4(CONTAINER_4by4 containerType, InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(containerType, RES_PATH_GUI + "4by4.png");
+ mName = aName;
+ }
+
+ public GUI_4by4(CONTAINER_4by4 containerType, InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) {
+ super(containerType, RES_PATH_GUI + aBackground + "4by4.png");
+ mName = aName;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString(mName, 8, 4, 4210752);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_2by2.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_2by2.java
new file mode 100644
index 0000000000..d2ca190658
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_2by2.java
@@ -0,0 +1,22 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches.charge;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.core.slots.SlotElectric;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_2by2;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class CONTAINER_Electric_2by2 extends CONTAINER_2by2{
+
+ public CONTAINER_Electric_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new SlotElectric(mTileEntity, 0, 71, 26));
+ addSlotToContainer(new SlotElectric(mTileEntity, 1, 89, 26));
+ addSlotToContainer(new SlotElectric(mTileEntity, 2, 71, 44));
+ addSlotToContainer(new SlotElectric(mTileEntity, 3, 89, 44));
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_4by4.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_4by4.java
new file mode 100644
index 0000000000..bb70df0558
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_4by4.java
@@ -0,0 +1,35 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches.charge;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.core.slots.SlotElectric;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_4by4;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class CONTAINER_Electric_4by4 extends CONTAINER_4by4{
+
+ public CONTAINER_Electric_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new SlotElectric(mTileEntity, 0, 53, 8));
+ addSlotToContainer(new SlotElectric(mTileEntity, 1, 71, 8));
+ addSlotToContainer(new SlotElectric(mTileEntity, 2, 89, 8));
+ addSlotToContainer(new SlotElectric(mTileEntity, 3, 107, 8));
+ addSlotToContainer(new SlotElectric(mTileEntity, 4, 53, 26));
+ addSlotToContainer(new SlotElectric(mTileEntity, 5, 71, 26));
+ addSlotToContainer(new SlotElectric(mTileEntity, 6, 89, 26));
+ addSlotToContainer(new SlotElectric(mTileEntity, 7, 107, 26));
+ addSlotToContainer(new SlotElectric(mTileEntity, 8, 53, 44));
+ addSlotToContainer(new SlotElectric(mTileEntity, 9, 71, 44));
+ addSlotToContainer(new SlotElectric(mTileEntity, 10, 89, 44));
+ addSlotToContainer(new SlotElectric(mTileEntity, 11, 107, 44));
+ addSlotToContainer(new SlotElectric(mTileEntity, 12, 53, 62));
+ addSlotToContainer(new SlotElectric(mTileEntity, 13, 71, 62));
+ addSlotToContainer(new SlotElectric(mTileEntity, 14, 89, 62));
+ addSlotToContainer(new SlotElectric(mTileEntity, 15, 107, 62));
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_2by2.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_2by2.java
new file mode 100644
index 0000000000..2e365277ea
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_2by2.java
@@ -0,0 +1,19 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches.charge;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_2by2;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class GUI_Electric_2by2 extends GUI_2by2{
+
+ public GUI_Electric_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(new CONTAINER_Electric_2by2(aInventoryPlayer, aTileEntity), aInventoryPlayer, aTileEntity, aName);
+ }
+
+ public GUI_Electric_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) {
+ super(new CONTAINER_Electric_2by2(aInventoryPlayer, aTileEntity), aInventoryPlayer, aTileEntity, RES_PATH_GUI + aBackground + "2by2.png");
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_4by4.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_4by4.java
new file mode 100644
index 0000000000..a09ab7d7aa
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_4by4.java
@@ -0,0 +1,20 @@
+package gtPlusPlus.xmod.gregtech.api.gui.hatches.charge;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_4by4;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class GUI_Electric_4by4 extends GUI_4by4{
+
+ public GUI_Electric_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(new CONTAINER_Electric_4by4(aInventoryPlayer, aTileEntity), aInventoryPlayer, aTileEntity, aName);
+ }
+
+ public GUI_Electric_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) {
+ super(new CONTAINER_Electric_4by4(aInventoryPlayer, aTileEntity), aInventoryPlayer, aTileEntity, RES_PATH_GUI + aBackground + "4by4.png");
+
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java
new file mode 100644
index 0000000000..cea9d8eb2f
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java
@@ -0,0 +1,861 @@
+package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
+
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_Container_BasicMachine;
+import gregtech.api.gui.GT_GUIContainer_BasicMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+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.core.util.Utils;
+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.tileentity.TileEntity;
+import net.minecraftforge.common.DimensionManager;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidHandler;
+
+import java.util.Arrays;
+
+import static gregtech.api.enums.GT_Values.V;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ * <p/>
+ * This is the main construct for my Basic Machines such as the Automatic Extractor
+ * Extend this class to make a simple Machine
+ */
+public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_DeluxeTank {
+ /**
+ * return values for checkRecipe()
+ */
+ protected static final int
+ DID_NOT_FIND_RECIPE = 0,
+ FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1,
+ FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2;
+ public static final int OTHER_SLOT_COUNT = 4;
+ public final ItemStack[] mOutputItems;
+ public final int mInputSlotCount, mAmperage;
+ public boolean mAllowInputFromOutputSide = false, mFluidTransfer = false, mItemTransfer = false, mHasBeenUpdated = false, mStuttering = false, mCharge = false, mDecharge = false;
+ public int mMainFacing = -1, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0;
+ public FluidStack mOutputFluid;
+ public String mGUIName = "", mNEIName = "";
+ /**
+ * Contains the Recipe which has been previously used, or null if there was no previous Recipe, which could have been buffered
+ */
+ protected GT_Recipe mLastRecipe = null;
+ private FluidStack mFluidOut;
+
+ /**
+ * @param aOverlays 0 = SideFacingActive
+ * 1 = SideFacingInactive
+ * 2 = FrontFacingActive
+ * 3 = FrontFacingInactive
+ * 4 = TopFacingActive
+ * 5 = TopFacingInactive
+ * 6 = BottomFacingActive
+ * 7 = BottomFacingInactive
+ * ----- Not all Array Elements have to be initialised, you can also just use 8 Parameters for the Default Pipe Texture Overlays -----
+ * 8 = BottomFacingPipeActive
+ * 9 = BottomFacingPipeInactive
+ * 10 = TopFacingPipeActive
+ * 11 = TopFacingPipeInactive
+ * 12 = SideFacingPipeActive
+ * 13 = SideFacingPipeInactive
+ */
+ public GT_MetaTileEntity_DeluxeMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage, String aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, ITexture... aOverlays) {
+ super(aID, aName, aNameRegional, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aOverlays);
+ mInputSlotCount = Math.max(0, aInputSlotCount);
+ mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
+ mAmperage = aAmperage;
+ mGUIName = aGUIName;
+ mNEIName = aNEIName;
+ }
+
+ public GT_MetaTileEntity_DeluxeMachine(String aName, int aTier, int aAmperage, String aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) {
+ super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures);
+ mInputSlotCount = Math.max(0, aInputSlotCount);
+ mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
+ mAmperage = aAmperage;
+ mGUIName = aGUIName;
+ mNEIName = aNEIName;
+ }
+
+ public boolean setMainFacing(byte aDirection){
+ mMainFacing = aDirection;
+ if(getBaseMetaTileEntity().getFrontFacing() == mMainFacing){
+ getBaseMetaTileEntity().setFrontFacing(GT_Utility.getOppositeSide(aDirection));
+ }
+ onFacingChange();
+ onMachineBlockUpdate();
+ return true;
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ ITexture[][][] rTextures = new ITexture[14][17][];
+ aTextures = Arrays.copyOf(aTextures, 14);
+
+ for (int i = 0; i < aTextures.length; i++)
+ if (aTextures[i] != null) for (byte c = -1; c < 16; c++) {
+ if (rTextures[i][c + 1] == null)
+ rTextures[i][c + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][c + 1], aTextures[i]};
+ }
+
+ for (byte c = -1; c < 16; c++) {
+ if (rTextures[0][c + 1] == null) rTextures[0][c + 1] = getSideFacingActive(c);
+ if (rTextures[1][c + 1] == null) rTextures[1][c + 1] = getSideFacingInactive(c);
+ if (rTextures[2][c + 1] == null) rTextures[2][c + 1] = getFrontFacingActive(c);
+ if (rTextures[3][c + 1] == null) rTextures[3][c + 1] = getFrontFacingInactive(c);
+ if (rTextures[4][c + 1] == null) rTextures[4][c + 1] = getTopFacingActive(c);
+ if (rTextures[5][c + 1] == null) rTextures[5][c + 1] = getTopFacingInactive(c);
+ if (rTextures[6][c + 1] == null) rTextures[6][c + 1] = getBottomFacingActive(c);
+ if (rTextures[7][c + 1] == null) rTextures[7][c + 1] = getBottomFacingInactive(c);
+ if (rTextures[8][c + 1] == null) rTextures[8][c + 1] = getBottomFacingPipeActive(c);
+ if (rTextures[9][c + 1] == null) rTextures[9][c + 1] = getBottomFacingPipeInactive(c);
+ if (rTextures[10][c + 1] == null) rTextures[10][c + 1] = getTopFacingPipeActive(c);
+ if (rTextures[11][c + 1] == null) rTextures[11][c + 1] = getTopFacingPipeInactive(c);
+ if (rTextures[12][c + 1] == null) rTextures[12][c + 1] = getSideFacingPipeActive(c);
+ if (rTextures[13][c + 1] == null) rTextures[13][c + 1] = getSideFacingPipeInactive(c);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return mTextures[mMainFacing < 2 ? aSide == aFacing ? aActive ? 2 : 3 : aSide == 0 ? aActive ? 6 : 7 : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1 : aSide == mMainFacing ? aActive ? 2 : 3 : (showPipeFacing() && aSide == aFacing) ? aSide == 0 ? aActive ? 8 : 9 : aSide == 1 ? aActive ? 10 : 11 : aActive ? 12 : 13 : aSide == 0 ? aActive ? 6 : 7 : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1][aColorIndex + 1];
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isElectric() {
+ return true;
+ }
+
+ @Override
+ public boolean isValidSlot(int aIndex) {
+ return aIndex > 0 && super.isValidSlot(aIndex) && aIndex != OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return mMainFacing > 1 || aFacing > 1;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return aSide != mMainFacing;
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return false;
+ }
+
+ @Override
+ public boolean isTeleporterCompatible() {
+ return false;
+ }
+
+ @Override
+ public boolean isLiquidInput(byte aSide) {
+ return aSide != mMainFacing && (mAllowInputFromOutputSide || aSide != getBaseMetaTileEntity().getFrontFacing());
+ }
+
+ @Override
+ public boolean isLiquidOutput(byte aSide) {
+ return aSide != mMainFacing;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return V[mTier] * 16;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return V[mTier] * 64;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return V[mTier];
+ }
+
+ @Override
+ public long maxSteamStore() {
+ return maxEUStore();
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return (mEUt * 2) / V[mTier] + 1;
+ }
+
+ @Override
+ public int getInputSlot() {
+ return OTHER_SLOT_COUNT;
+ }
+
+ @Override
+ public int getOutputSlot() {
+ return OTHER_SLOT_COUNT + mInputSlotCount;
+ }
+
+ @Override
+ public int getStackDisplaySlot() {
+ return 2;
+ }
+
+ @Override
+ public int rechargerSlotStartIndex() {
+ return 1;
+ }
+
+ @Override
+ public int dechargerSlotStartIndex() {
+ return 1;
+ }
+
+ @Override
+ public int rechargerSlotCount() {
+ return mCharge ? 1 : 0;
+ }
+
+ @Override
+ public int dechargerSlotCount() {
+ return mDecharge ? 1 : 0;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public int getProgresstime() {
+ return mProgresstime;
+ }
+
+ @Override
+ public int maxProgresstime() {
+ return mMaxProgresstime;
+ }
+
+ @Override
+ public int increaseProgress(int aProgress) {
+ mProgresstime += aProgress;
+ return mMaxProgresstime - mProgresstime;
+ }
+
+ @Override
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return getFillableStack() != null || (getRecipeList() != null && getRecipeList().containsInput(aFluid));
+ }
+
+ @Override
+ public boolean isFluidChangingAllowed() {
+ return true;
+ }
+
+ @Override
+ public boolean doesFillContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean canTankBeFilled() {
+ return true;
+ }
+
+ @Override
+ public boolean canTankBeEmptied() {
+ return true;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return true;
+ }
+
+ @Override
+ public boolean displaysStackSize() {
+ return true;
+ }
+
+ @Override
+ public FluidStack getDisplayedFluid() {
+ return displaysOutputFluid() ? getDrainableStack() : null;
+ }
+
+ @Override
+ public FluidStack getDrainableStack() {
+ return mFluidOut;
+ }
+
+ @Override
+ public FluidStack setDrainableStack(FluidStack aFluid) {
+ mFluidOut = aFluid;
+ return mFluidOut;
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) return true;
+ if(!GT_Mod.gregtechproxy.mForceFreeFace) {
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+ for(byte i=0;i < 6; i++){
+ if(aBaseMetaTileEntity.getAirAtSide(i)){
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+ }
+ GT_Utility.sendChatToPlayer(aPlayer,"No free Side!");
+ return true;
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_BasicMachine(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), mGUIName, GT_Utility.isStringValid(mNEIName) ? mNEIName : getRecipeList() != null ? getRecipeList().mUnlocalizedName : "");
+ }
+
+ @Override
+ public void initDefaultModes(NBTTagCompound aNBT) {
+ mMainFacing = -1;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("mFluidTransfer", mFluidTransfer);
+ aNBT.setBoolean("mItemTransfer", mItemTransfer);
+ aNBT.setBoolean("mHasBeenUpdated", mHasBeenUpdated);
+ aNBT.setBoolean("mAllowInputFromOutputSide", mAllowInputFromOutputSide);
+ aNBT.setInteger("mEUt", mEUt);
+ aNBT.setInteger("mMainFacing", mMainFacing);
+ aNBT.setInteger("mProgresstime", mProgresstime);
+ aNBT.setInteger("mMaxProgresstime", mMaxProgresstime);
+ if (mOutputFluid != null) aNBT.setTag("mOutputFluid", mOutputFluid.writeToNBT(new NBTTagCompound()));
+ if (mFluidOut != null) aNBT.setTag("mFluidOut", mFluidOut.writeToNBT(new NBTTagCompound()));
+
+ for (int i = 0; i < mOutputItems.length; i++)
+ if (mOutputItems[i] != null)
+ aNBT.setTag("mOutputItem" + i, mOutputItems[i].writeToNBT(new NBTTagCompound()));
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mFluidTransfer = aNBT.getBoolean("mFluidTransfer");
+ mItemTransfer = aNBT.getBoolean("mItemTransfer");
+ mHasBeenUpdated = aNBT.getBoolean("mHasBeenUpdated");
+ mAllowInputFromOutputSide = aNBT.getBoolean("mAllowInputFromOutputSide");
+ mEUt = aNBT.getInteger("mEUt");
+ mMainFacing = aNBT.getInteger("mMainFacing");
+ mProgresstime = aNBT.getInteger("mProgresstime");
+ mMaxProgresstime = aNBT.getInteger("mMaxProgresstime");
+ mOutputFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mOutputFluid"));
+ mFluidOut = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluidOut"));
+
+ for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i);
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+
+ if (aBaseMetaTileEntity.isServerSide()) {
+
+ //Utils.LOG_WARNING("Ticking Tank.");
+ mCharge = aBaseMetaTileEntity.getStoredEU() / 2 > aBaseMetaTileEntity.getEUCapacity() / 3;
+ mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3;
+
+ doDisplayThings();
+
+ boolean tSucceeded = false;
+
+ if (mMaxProgresstime > 0 && (mProgresstime >= 0 || aBaseMetaTileEntity.isAllowedToWork())) {
+ aBaseMetaTileEntity.setActive(true);
+ if (mProgresstime < 0 || drainEnergyForProcess(mEUt)) {
+ if (++mProgresstime >= mMaxProgresstime) {
+ for (int i = 0; i < mOutputItems.length; i++)
+ for (int j = 0; j < mOutputItems.length; j++)
+ if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i]))
+ break;
+ if (mOutputFluid != null)
+ if (getDrainableStack() == null) setDrainableStack(mOutputFluid.copy());
+ else if (mOutputFluid.isFluidEqual(getDrainableStack()))
+ getDrainableStack().amount += mOutputFluid.amount;
+ for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = null;
+ mOutputFluid = null;
+ mEUt = 0;
+ mProgresstime = 0;
+ mMaxProgresstime = 0;
+ mStuttering = false;
+ tSucceeded = true;
+ endProcess();
+ }
+ if (mProgresstime > 5) mStuttering = false;
+ XSTR aXSTR = new XSTR();
+ if(GT_Mod.gregtechproxy.mAprilFool && aXSTR.nextInt(5000)==0)GT_Utility.sendSoundToPlayers(aBaseMetaTileEntity.getWorld(), GregTech_API.sSoundList.get(5), 10.0F, -1.0F, aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(),aBaseMetaTileEntity.getZCoord());
+ } else {
+ if (!mStuttering) {
+ stutterProcess();
+ if (canHaveInsufficientEnergy()) mProgresstime = -100;
+ mStuttering = true;
+ }
+ }
+ } else {
+ aBaseMetaTileEntity.setActive(false);
+ }
+
+ boolean tRemovedOutputFluid = false;
+ Utils.LOG_WARNING("R0");
+
+ if (doesAutoOutputFluids() && getDrainableStack() != null && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || aTick % 20 == 0)) {
+ IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing());
+ if (tTank != null) {
+ FluidStack tDrained = drain(1000, false);
+ if (tDrained != null) {
+ int tFilledAmount = tTank.fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false);
+ if (tFilledAmount > 0)
+ tTank.fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), drain(tFilledAmount, true), true);
+ }
+ }
+ if (getDrainableStack() == null) tRemovedOutputFluid = true;
+ }
+
+ if (doesAutoOutput() && !isOutputEmpty() && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || mOutputBlocked % 300 == 1 || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0)) {
+ TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing());
+ for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 && aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) {
+ tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ if (tCosts > 0) aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCosts, true);
+ }
+ }
+
+ if (mOutputBlocked != 0) if (isOutputEmpty()) mOutputBlocked = 0;
+ else mOutputBlocked++;
+ Utils.LOG_WARNING("R1");
+ if (allowToCheckRecipe()) {
+ Utils.LOG_WARNING("R2--------------------------------------------------");
+ Utils.LOG_WARNING("R2: (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) && hasEnoughEnergyToCheckRecipe())");
+ Utils.LOG_WARNING("R2--------------------------------------------------");
+ Utils.LOG_WARNING("R2-mMaxProgresstime: "+mMaxProgresstime);
+ Utils.LOG_WARNING("R2-isAllowedToWork(): "+aBaseMetaTileEntity.isAllowedToWork());
+ Utils.LOG_WARNING("R2--------------------------------------------------");
+ Utils.LOG_WARNING("R2-tRemovedOutputFluid: "+tRemovedOutputFluid);
+ Utils.LOG_WARNING("R2-tSucceeded: "+tSucceeded);
+ Utils.LOG_WARNING("R2-hasInventoryBeenModified(): "+aBaseMetaTileEntity.hasInventoryBeenModified());
+ Utils.LOG_WARNING("R2-(aTick % 600 == 0): "+(aTick % 600 == 0));
+ Utils.LOG_WARNING("R2-hasWorkJustBeenEnabled(): "+aBaseMetaTileEntity.hasWorkJustBeenEnabled());
+ Utils.LOG_WARNING("R2--------------------------------------------------");
+ Utils.LOG_WARNING("R2-hasEnoughEnergyToCheckRecipe(): "+hasEnoughEnergyToCheckRecipe());
+ Utils.LOG_WARNING("R2--------------------------------------------------");
+ if (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) && hasEnoughEnergyToCheckRecipe()) {
+ Utils.LOG_WARNING("R3");
+ if (checkRecipe() == 2) {
+ if (mInventory[3] != null && mInventory[3].stackSize <= 0) mInventory[3] = null;
+ Utils.LOG_WARNING("R4");
+ for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++)
+ if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null;
+ for (int i = 0; i < mOutputItems.length; i++) {
+ mOutputItems[i] = GT_Utility.copy(mOutputItems[i]);
+ if (mOutputItems[i] != null && mOutputItems[i].stackSize > 64)
+ mOutputItems[i].stackSize = 64;
+ mOutputItems[i] = GT_OreDictUnificator.get(true, mOutputItems[i]);
+ }
+ if (mFluid != null && mFluid.amount <= 0) mFluid = null;
+ mMaxProgresstime = Math.max(1, mMaxProgresstime);
+ if (GT_Utility.isDebugItem(mInventory[dechargerSlotStartIndex()])) {
+ mEUt = mMaxProgresstime = 1;
+ }
+ startProcess();
+ } else {
+ mMaxProgresstime = 0;
+ for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = null;
+ mOutputFluid = null;
+ }
+ }
+ } else {
+ if (!mStuttering) {
+ stutterProcess();
+ mStuttering = true;
+ }
+ }
+ }
+ }
+
+ protected void doDisplayThings() {
+ if (mMainFacing < 2 && getBaseMetaTileEntity().getFrontFacing() > 1) {
+ mMainFacing = getBaseMetaTileEntity().getFrontFacing();
+ }
+ if (mMainFacing >= 2 && !mHasBeenUpdated) {
+ mHasBeenUpdated = true;
+ //getBaseMetaTileEntity().setFrontFacing(getBaseMetaTileEntity().getBackFacing());
+ }
+
+ if (displaysInputFluid()) {
+ int tDisplayStackSlot = OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length;
+ if (getFillableStack() == null) {
+ if (ItemList.Display_Fluid.isStackEqual(mInventory[tDisplayStackSlot], true, true))
+ mInventory[tDisplayStackSlot] = null;
+ } else {
+ mInventory[tDisplayStackSlot] = GT_Utility.getFluidDisplayStack(getFillableStack(), displaysStackSize());
+ }
+ }
+ }
+
+ protected boolean hasEnoughEnergyToCheckRecipe() {
+ return getBaseMetaTileEntity().isUniversalEnergyStored(getMinimumStoredEU() / 2);
+ }
+
+ protected boolean drainEnergyForProcess(long aEUt) {
+ return getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEUt, false);
+ }
+
+ protected void calculateOverclockedNess(GT_Recipe aRecipe) {
+ calculateOverclockedNess(aRecipe.mEUt, aRecipe.mDuration);
+ }
+
+ protected void calculateOverclockedNess(int aEUt, int aDuration) {
+ if (aEUt <= 16) {
+ mEUt = aEUt * (1 << (mTier - 1)) * (1 << (mTier - 1));
+ mMaxProgresstime = aDuration / (1 << (mTier - 1));
+ } else {
+ mEUt = aEUt;
+ mMaxProgresstime = aDuration;
+ while (mEUt <= V[mTier - 1] * mAmperage) {
+ mEUt *= 4;
+ mMaxProgresstime /= 2;
+ }
+ }
+ }
+
+ protected ItemStack getSpecialSlot() {
+ return mInventory[3];
+ }
+
+ protected ItemStack getOutputAt(int aIndex) {
+ return mInventory[getOutputSlot() + aIndex];
+ }
+
+ protected ItemStack[] getAllOutputs() {
+ ItemStack[] rOutputs = new ItemStack[mOutputItems.length];
+ for (int i = 0; i < mOutputItems.length; i++) rOutputs[i] = getOutputAt(i);
+ return rOutputs;
+ }
+
+ protected boolean canOutput(GT_Recipe aRecipe) {
+ return aRecipe != null && (aRecipe.mNeedsEmptyOutput ? isOutputEmpty() && getDrainableStack() == null : canOutput(aRecipe.getFluidOutput(0)) && canOutput(aRecipe.mOutputs));
+ }
+
+ protected boolean canOutput(ItemStack... aOutputs) {
+ if (aOutputs == null) return true;
+ ItemStack[] tOutputSlots = getAllOutputs();
+ for (int i = 0; i < tOutputSlots.length && i < aOutputs.length; i++)
+ if (tOutputSlots[i] != null && aOutputs[i] != null && (!GT_Utility.areStacksEqual(tOutputSlots[i], aOutputs[i], false) || tOutputSlots[i].stackSize + aOutputs[i].stackSize > tOutputSlots[i].getMaxStackSize())) {
+ mOutputBlocked++;
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean canOutput(FluidStack aOutput) {
+ return getDrainableStack() == null || aOutput == null || (getDrainableStack().isFluidEqual(aOutput) && (getDrainableStack().amount <= 0 || getDrainableStack().amount + aOutput.amount <= getCapacity()));
+ }
+
+ protected ItemStack getInputAt(int aIndex) {
+ return mInventory[getInputSlot() + aIndex];
+ }
+
+ protected ItemStack[] getAllInputs() {
+ ItemStack[] rInputs = new ItemStack[mInputSlotCount];
+ for (int i = 0; i < mInputSlotCount; i++) rInputs[i] = getInputAt(i);
+ return rInputs;
+ }
+
+ protected boolean isOutputEmpty() {
+ boolean rIsEmpty = true;
+ for (ItemStack tOutputSlotContent : getAllOutputs()) if (tOutputSlotContent != null) rIsEmpty = false;
+ return rIsEmpty;
+ }
+
+ protected boolean displaysInputFluid() {
+ return true;
+ }
+
+ protected boolean displaysOutputFluid() {
+ return true;
+ }
+
+ @Override
+ public void onValueUpdate(byte aValue) {
+ mMainFacing = aValue;
+ }
+
+ @Override
+ public byte getUpdateData() {
+ return (byte) mMainFacing;
+ }
+
+ @Override
+ public void doSound(byte aIndex, double aX, double aY, double aZ) {
+ super.doSound(aIndex, aX, aY, aZ);
+ if (aIndex == 8) GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(210), 100, 1.0F, aX, aY, aZ);
+ }
+
+ public boolean doesAutoOutput() {
+ return mItemTransfer;
+ }
+
+ public boolean doesAutoOutputFluids() {
+ return mFluidTransfer;
+ }
+
+ public boolean allowToCheckRecipe() {
+ return true;
+ }
+
+ public boolean showPipeFacing() {
+ return true;
+ }
+
+ /**
+ * Called whenever the Machine successfully started a Process, useful for Sound Effects
+ */
+ public void startProcess() {
+ //
+ }
+
+ /**
+ * Called whenever the Machine successfully finished a Process, useful for Sound Effects
+ */
+ public void endProcess() {
+ //
+ }
+
+ /**
+ * Called whenever the Machine aborted a Process, useful for Sound Effects
+ */
+ public void abortProcess() {
+ //
+ }
+
+ /**
+ * Called whenever the Machine aborted a Process but still works on it, useful for Sound Effects
+ */
+ public void stutterProcess() {
+ if (useStandardStutterSound()) sendSound((byte) 8);
+ }
+
+ /**
+ * If this Machine can have the Insufficient Energy Line Problem
+ */
+ public boolean canHaveInsufficientEnergy() {
+ return true;
+ }
+
+ public boolean useStandardStutterSound() {
+ return true;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ return new String[]{
+ mNEIName,
+ "Progress:", (mProgresstime / 20) + " secs",
+ (mMaxProgresstime / 20) + " secs",
+ "Stored Energy:",
+ getBaseMetaTileEntity().getStoredEU() + "EU",
+ getBaseMetaTileEntity().getEUCapacity() + "EU"};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (aSide == getBaseMetaTileEntity().getFrontFacing() || aSide == mMainFacing) {
+ mAllowInputFromOutputSide = !mAllowInputFromOutputSide;
+ GT_Utility.sendChatToPlayer(aPlayer, mAllowInputFromOutputSide ? trans("095","Input from Output Side allowed") : trans("096","Input from Output Side forbidden"));
+ }
+ }
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) {
+ return (aSide != mMainFacing || GregTech_API.getCoverBehavior(aCoverID.toStack()).isGUIClickable(aSide, GT_Utility.stackToInt(aCoverID.toStack()), 0, getBaseMetaTileEntity()));
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aSide != mMainFacing && aIndex >= getOutputSlot() && aIndex < getOutputSlot() + mOutputItems.length;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if (aSide == mMainFacing || aIndex < getInputSlot() || aIndex >= getInputSlot() + mInputSlotCount || (!mAllowInputFromOutputSide && aSide == aBaseMetaTileEntity.getFrontFacing()))
+ return false;
+ for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++)
+ if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(aStack), mInventory[i])) return i == aIndex;
+ return true;
+ }
+
+ /**
+ * @return the Recipe List which is used for this Machine, this is a useful Default Handler
+ */
+ public GT_Recipe_Map getRecipeList() {
+ return null;
+ }
+
+ /**
+ * Override this to check the Recipes yourself, super calls to this could be useful if you just want to add a special case
+ * <p/>
+ * I thought about Enum too, but Enum doesn't add support for people adding other return Systems.
+ * <p/>
+ * Funny how Eclipse marks the word Enum as not correctly spelled.
+ *
+ * @return see constants above
+ */
+ public int checkRecipe() {
+ return checkRecipe(false);
+ }
+
+ public static boolean isValidForLowGravity(GT_Recipe tRecipe, int dimId){
+ return //TODO check or get a better solution
+ DimensionManager.getProvider(dimId).getClass().getName().contains("Orbit") ||
+ DimensionManager.getProvider(dimId).getClass().getName().endsWith("Space") ||
+ DimensionManager.getProvider(dimId).getClass().getName().endsWith("Asteroids") ||
+ DimensionManager.getProvider(dimId).getClass().getName().endsWith("SS") ||
+ DimensionManager.getProvider(dimId).getClass().getName().contains("SpaceStation");
+ }
+
+
+ /**
+ *
+ * @param skipOC disables OverclockedNess calculation and check - if you do you must implement your own method...
+ * @return
+ */
+ public int checkRecipe(boolean skipOC){
+ GT_Recipe_Map tMap = getRecipeList();
+ if (tMap == null) return DID_NOT_FIND_RECIPE;
+ GT_Recipe tRecipe = tMap.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), getAllInputs());
+ if (tRecipe == null) return DID_NOT_FIND_RECIPE;
+
+ if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 &&
+ !isValidForLowGravity(tRecipe,getBaseMetaTileEntity().getWorld().provider.dimensionId))
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe;
+ if (!canOutput(tRecipe)) {
+ mOutputBlocked++;
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ }
+ if (!tRecipe.isRecipeInputEqual(true, new FluidStack[]{getFillableStack()}, getAllInputs()))
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ for (int i = 0; i < mOutputItems.length; i++)
+ if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(i))
+ mOutputItems[i] = tRecipe.getOutput(i);
+ mOutputFluid = tRecipe.getFluidOutput(0);
+ calculateOverclockedNess(tRecipe);
+ return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
+ }
+
+ public ITexture[] getSideFacingActive(byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ }
+
+ public ITexture[] getSideFacingInactive(byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ }
+
+ public ITexture[] getFrontFacingActive(byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ }
+
+ public ITexture[] getFrontFacingInactive(byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ }
+
+ public ITexture[] getTopFacingActive(byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ }
+
+ public ITexture[] getTopFacingInactive(byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ }
+
+ public ITexture[] getBottomFacingActive(byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ }
+
+ public ITexture[] getBottomFacingInactive(byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ }
+
+ public ITexture[] getBottomFacingPipeActive(byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
+ }
+
+ public ITexture[] getBottomFacingPipeInactive(byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
+ }
+
+ public ITexture[] getTopFacingPipeActive(byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
+ }
+
+ public ITexture[] getTopFacingPipeInactive(byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
+ }
+
+ public ITexture[] getSideFacingPipeActive(byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
+ }
+
+ public ITexture[] getSideFacingPipeInactive(byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java
new file mode 100644
index 0000000000..24a92fd628
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java
@@ -0,0 +1,248 @@
+package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.CONTAINER_Electric_2by2;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.CONTAINER_Electric_4by4;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.GUI_Electric_2by2;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.GUI_Electric_4by4;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+
+public class GT_MetaTileEntity_Hatch_InputBattery
+extends
+GT_MetaTileEntity_Hatch {
+ public GT_Recipe_Map mRecipeMap = null;
+
+ public GT_MetaTileEntity_Hatch_InputBattery(int aID, String aName,
+ String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, getSlots(aTier),
+ new String[]{"Chargeable Item Bus for Multiblocks",
+ "Capacity: " + getSlots(aTier) + " stack"
+ + (getSlots(aTier) >= 2 ? "s" : "")});
+ }
+
+ public GT_MetaTileEntity_Hatch_InputBattery(String aName, int aTier,
+ String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier,
+ aTier < 1 ? 1 : aTier == 1 ? 4 : aTier == 2 ? 4 : 16,
+ aDescription, aTextures);
+ }
+
+ public GT_MetaTileEntity_Hatch_InputBattery(String aName, int aTier,
+ String[] aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier,
+ aTier < 1 ? 1 : aTier == 1 ? 4 : aTier == 2 ? 4 : 16,
+ aDescription, aTextures);
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return aSide == getBaseMetaTileEntity().getFrontFacing();
+ }
+
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return V[mTier];
+ }
+
+ @Override
+ public long maxEUStore() {
+ return 512 + V[mTier + 1] * 16;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 4;
+ }
+
+ @Override
+ public ITexture[] getTexturesActive(ITexture aBaseTexture) {
+ return new ITexture[]{aBaseTexture,
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Charger)};
+ }
+
+ @Override
+ public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
+ return new ITexture[]{aBaseTexture,
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Charger)};
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public boolean isValidSlot(int aIndex) {
+ return true;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Hatch_InputBattery(mName, mTier,
+ mDescriptionArray, mTextures);
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity,
+ EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide())
+ return true;
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory,
+ IGregTechTileEntity aBaseMetaTileEntity) {
+ switch (mTier) {
+ case 2 :
+ return new CONTAINER_Electric_2by2(aPlayerInventory,
+ aBaseMetaTileEntity);
+ case 4 :
+ return new CONTAINER_Electric_4by4(aPlayerInventory,
+ aBaseMetaTileEntity);
+ default :
+ return new CONTAINER_Electric_4by4(aPlayerInventory,
+ aBaseMetaTileEntity);
+ }
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory,
+ IGregTechTileEntity aBaseMetaTileEntity) {
+ switch (mTier) {
+ case 2 :
+ return new GUI_Electric_2by2(aPlayerInventory,
+ aBaseMetaTileEntity, "Charging Bus");
+ case 4 :
+ return new GUI_Electric_4by4(aPlayerInventory,
+ aBaseMetaTileEntity, "Charging Bus");
+ default :
+ return new GUI_Electric_4by4(aPlayerInventory,
+ aBaseMetaTileEntity, "Charging Bus");
+ }
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
+ if (aBaseMetaTileEntity.isServerSide()
+ && aBaseMetaTileEntity.hasInventoryBeenModified()) {
+ fillStacksIntoFirstSlots();
+ }
+ if (aBaseMetaTileEntity.isServerSide()){
+ if (aBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity) {
+ MetaTileEntity mMetaTileEntity = (MetaTileEntity) aBaseMetaTileEntity.getMetaTileEntity();
+ if (mMetaTileEntity.rechargerSlotCount() > 0 && aBaseMetaTileEntity.getStoredEU() > 0) {
+ for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) {
+ if (aBaseMetaTileEntity.getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) {
+ for (int u=0;u<10;u++){
+ aBaseMetaTileEntity.decreaseStoredEnergyUnits(GT_ModHandler.chargeElectricItem(mMetaTileEntity.mInventory[i], (int) Math.min(V[this.mTier] * 15, aBaseMetaTileEntity.getStoredEU()), (int) Math.min(Integer.MAX_VALUE, GT_Values.V[u]), false, false), true);
+ if (mMetaTileEntity.mInventory[i].stackSize <= 0){
+ mMetaTileEntity.mInventory[i] = null;
+ }
+ }
+ }
+ }
+ }
+ else {
+ //Utils.LOG_INFO("reCharger Slot Count = "+mMetaTileEntity.rechargerSlotCount());
+ //Utils.LOG_INFO("getStoredEU = "+aBaseMetaTileEntity.getStoredEU());
+ //Utils.LOG_INFO("getEUVar = "+mMetaTileEntity.getEUVar());
+ }
+ }
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTimer);
+ }
+
+ public void updateSlots() {
+ for (int i = 0; i < mInventory.length; i++)
+ if (mInventory[i] != null && mInventory[i].stackSize <= 0)
+ mInventory[i] = null;
+ fillStacksIntoFirstSlots();
+ }
+
+ protected void fillStacksIntoFirstSlots() {
+ for (int i = 0; i < mInventory.length; i++)
+ for (int j = i + 1; j < mInventory.length; j++)
+ if (mInventory[j] != null
+ && (mInventory[i] == null || GT_Utility.areStacksEqual(
+ mInventory[i], mInventory[j]))) {
+ GT_Utility.moveStackFromSlotAToSlotB(
+ getBaseMetaTileEntity(), getBaseMetaTileEntity(), j,
+ i, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ }
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity,
+ int aIndex, byte aSide, ItemStack aStack) {
+ return aSide == getBaseMetaTileEntity().getFrontFacing()
+ && (mRecipeMap == null || mRecipeMap.containsInput(aStack));
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity,
+ int aIndex, byte aSide, ItemStack aStack) {
+ return aSide == getBaseMetaTileEntity().getFrontFacing()
+ && (mRecipeMap == null || mRecipeMap.containsInput(aStack));
+ }
+
+ public int rechargerSlotStartIndex() {
+ return 0;
+ }
+
+ public int rechargerSlotCount() {
+ switch (mTier) {
+ case 2 :
+ return 4;
+ case 4 :
+ return 16;
+ default :
+ return 16;
+ }
+ }
+
+ public int dechargerSlotStartIndex() {
+ return 0;
+ }
+
+ public int dechargerSlotCount() {
+ return 0;
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java
new file mode 100644
index 0000000000..5dd333e2fa
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java
@@ -0,0 +1,226 @@
+package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.CONTAINER_Electric_2by2;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.CONTAINER_Electric_4by4;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.GUI_Electric_2by2;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.GUI_Electric_4by4;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+
+public class GT_MetaTileEntity_Hatch_OutputBattery
+extends
+GT_MetaTileEntity_Hatch {
+ public GT_MetaTileEntity_Hatch_OutputBattery(int aID, String aName,
+ String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, getSlots(aTier),
+ new String[]{"Dischargeable Item Bus for Multiblocks",
+ "Capacity: " + getSlots(aTier) + " stack"
+ + (getSlots(aTier) >= 2 ? "s" : "")});
+ }
+
+ public GT_MetaTileEntity_Hatch_OutputBattery(String aName, int aTier,
+ String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier,
+ aTier < 1 ? 1 : aTier == 1 ? 4 : aTier == 2 ? 9 : 16,
+ aDescription, aTextures);
+ }
+
+ public GT_MetaTileEntity_Hatch_OutputBattery(String aName, int aTier,
+ String[] aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier,
+ aTier < 1 ? 1 : aTier == 1 ? 4 : aTier == 2 ? 9 : 16,
+ aDescription, aTextures);
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return true;
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return aSide == getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return V[mTier];
+ }
+
+ @Override
+ public long maxEUStore() {
+ return 512 + V[mTier + 1] * 8;
+ }
+
+ @Override
+ public ITexture[] getTexturesActive(ITexture aBaseTexture) {
+ return new ITexture[]{aBaseTexture,
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Discharger)};
+ }
+
+ @Override
+ public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
+ return new ITexture[]{aBaseTexture,
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Discharger)};
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public boolean isValidSlot(int aIndex) {
+ return true;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Hatch_OutputBattery(mName, mTier,
+ mDescriptionArray, mTextures);
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity,
+ EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide())
+ return true;
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory,
+ IGregTechTileEntity aBaseMetaTileEntity) {
+ switch (mTier) {
+ case 2 :
+ return new CONTAINER_Electric_2by2(aPlayerInventory,
+ aBaseMetaTileEntity);
+ case 4 :
+ return new CONTAINER_Electric_4by4(aPlayerInventory,
+ aBaseMetaTileEntity);
+ default :
+ return new CONTAINER_Electric_4by4(aPlayerInventory,
+ aBaseMetaTileEntity);
+ }
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory,
+ IGregTechTileEntity aBaseMetaTileEntity) {
+ switch (mTier) {
+ case 2 :
+ return new GUI_Electric_2by2(aPlayerInventory,
+ aBaseMetaTileEntity, "Discharging Bus");
+ case 4 :
+ return new GUI_Electric_4by4(aPlayerInventory,
+ aBaseMetaTileEntity, "Discharging Bus");
+ default :
+ return new GUI_Electric_4by4(aPlayerInventory,
+ aBaseMetaTileEntity, "Discharging Bus");
+ }
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity,
+ int aIndex, byte aSide, ItemStack aStack) {
+ return aSide == aBaseMetaTileEntity.getFrontFacing();
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity,
+ int aIndex, byte aSide, ItemStack aStack) {
+ return aSide == aBaseMetaTileEntity.getFrontFacing();
+ }
+
+ public void updateSlots() {
+ for (int i = 0; i < mInventory.length; i++)
+ if (mInventory[i] != null && mInventory[i].stackSize <= 0)
+ mInventory[i] = null;
+ fillStacksIntoFirstSlots();
+ }
+
+ protected void fillStacksIntoFirstSlots() {
+ for (int i = 0; i < mInventory.length; i++)
+ for (int j = i + 1; j < mInventory.length; j++)
+ if (mInventory[j] != null
+ && (mInventory[i] == null || GT_Utility.areStacksEqual(
+ mInventory[i], mInventory[j]))) {
+ GT_Utility.moveStackFromSlotAToSlotB(
+ getBaseMetaTileEntity(), getBaseMetaTileEntity(), j,
+ i, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ }
+ }
+
+ public int rechargerSlotStartIndex() {
+ return 0;
+ }
+
+ public int rechargerSlotCount() {
+ return 0;
+ }
+
+ public int dechargerSlotStartIndex() {
+ return 0;
+ }
+
+ public int dechargerSlotCount() {
+ return mTier == 2 ? 4 : 16;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
+ if (aBaseMetaTileEntity.isServerSide()
+ && aBaseMetaTileEntity.hasInventoryBeenModified()) {
+ fillStacksIntoFirstSlots();
+ }
+
+ if (aBaseMetaTileEntity.isServerSide()){
+ if (aBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity) {
+ MetaTileEntity mMetaTileEntity = (MetaTileEntity) aBaseMetaTileEntity.getMetaTileEntity();
+ if (mMetaTileEntity.dechargerSlotCount() > 0 && mMetaTileEntity.getEUVar() < aBaseMetaTileEntity.getEUCapacity()) {
+ Utils.LOG_INFO("3");
+ for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) {
+ if (mMetaTileEntity.mInventory[i] != null && mMetaTileEntity.getEUVar() < aBaseMetaTileEntity.getEUCapacity()) {
+ aBaseMetaTileEntity.increaseStoredEnergyUnits(GT_ModHandler.dischargeElectricItem(mMetaTileEntity.mInventory[i], (int) Math.min(V[mTier] * 15, aBaseMetaTileEntity.getEUCapacity() - aBaseMetaTileEntity.getStoredEU()), (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), true, false, false), true);
+ if (mMetaTileEntity.mInventory[i].stackSize <= 0)
+ mMetaTileEntity.mInventory[i] = null;
+ }
+ }
+ }
+ }
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTimer);
+ }
+
+
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java
index ee58e0f20f..6de1594b69 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java
@@ -43,7 +43,9 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
public short mOverheat;
public final int mWireHeatingTicks;
- public GregtechMetaPipeEntityBase_Cable(final int aID, final String aName, final String aNameRegional, final float aThickNess, final GT_Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock) {
+ public GregtechMetaPipeEntityBase_Cable(final int aID, final String aName, final String aNameRegional,
+ final float aThickNess, final GT_Materials aMaterial, final long aCableLossPerMeter, final long aAmperage,
+ final long aVoltage, final boolean aInsulated, final boolean aCanShock) {
super(aID, aName, aNameRegional, 0);
this.mThickNess = aThickNess;
this.mMaterial = aMaterial;
@@ -55,7 +57,9 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
this.mWireHeatingTicks = this.getGT5Var();
}
- public GregtechMetaPipeEntityBase_Cable(final String aName, final float aThickNess, final GT_Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock) {
+ public GregtechMetaPipeEntityBase_Cable(final String aName, final float aThickNess, final GT_Materials aMaterial,
+ final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated,
+ final boolean aCanShock) {
super(aName, 0);
this.mThickNess = aThickNess;
this.mMaterial = aMaterial;
@@ -67,23 +71,23 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
this.mWireHeatingTicks = this.getGT5Var();
}
- private int getGT5Var(){
+ private int getGT5Var() {
final Class<? extends GT_Proxy> clazz = GT_Mod.gregtechproxy.getClass();
final String lookingForValue = "mWireHeatingTicks";
int temp = 4;
Field field;
- if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){
+ if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
try {
field = clazz.getClass().getField(lookingForValue);
final Class<?> clazzType = field.getType();
- if (clazzType.toString().equals("int")){
+ if (clazzType.toString().equals("int")) {
temp = (field.getInt(clazz));
- }
- else {
+ } else {
temp = 4;
}
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
- //Utils.LOG_INFO("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS.");
+ // Utils.LOG_INFO("FATAL ERROR - REFLECTION FAILED FOR GT CABLES
+ // - PLEASE REPORT THIS.");
Utils.LOG_WARNING("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS.");
Utils.LOG_ERROR("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS.");
temp = 4;
@@ -99,37 +103,64 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
@Override
public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
- return new GregtechMetaPipeEntityBase_Cable(this.mName, this.mThickNess, this.mMaterial, this.mCableLossPerMeter, this.mAmperage, this.mVoltage, this.mInsulated, this.mCanShock);
+ return new GregtechMetaPipeEntityBase_Cable(this.mName, this.mThickNess, this.mMaterial,
+ this.mCableLossPerMeter, this.mAmperage, this.mVoltage, this.mInsulated, this.mCanShock);
}
@Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aConnections, final byte aColorIndex, final boolean aConnected, final boolean aRedstone) {
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide,
+ final byte aConnections, final byte aColorIndex, final boolean aConnected, final boolean aRedstone) {
if (!this.mInsulated) {
- return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa)};
+ return new ITexture[] { new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
+ this.mMaterial.mRGBa) };
}
if (aConnected) {
final float tThickNess = this.getThickNess();
if (tThickNess < 0.37F) {
- return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
+ return new ITexture[] {
+ new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
+ this.mMaterial.mRGBa),
+ new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
if (tThickNess < 0.49F) {
- return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
+ return new ITexture[] {
+ new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
+ this.mMaterial.mRGBa),
+ new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
if (tThickNess < 0.74F) {
- return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
+ return new ITexture[] {
+ new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
+ this.mMaterial.mRGBa),
+ new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
if (tThickNess < 0.99F) {
- return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
+ return new ITexture[] {
+ new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
+ this.mMaterial.mRGBa),
+ new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
- return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
+ return new ITexture[] {
+ new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
+ this.mMaterial.mRGBa),
+ new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
- return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
+ return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.INSULATION_FULL,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
@Override
- public void onEntityCollidedWithBlock(final World aWorld, final int aX, final int aY, final int aZ, final Entity aEntity) {
- if (this.mCanShock && ((((BaseMetaPipeEntity) this.getBaseMetaTileEntity()).mConnections & -128) == 0) && (aEntity instanceof EntityLivingBase)) {
- GT_Utility.applyElectricityDamage((EntityLivingBase) aEntity, this.mTransferredVoltageLast20, this.mTransferredAmperageLast20);
+ public void onEntityCollidedWithBlock(final World aWorld, final int aX, final int aY, final int aZ,
+ final Entity aEntity) {
+ if (this.mCanShock && ((((BaseMetaPipeEntity) this.getBaseMetaTileEntity()).mConnections & -128) == 0)
+ && (aEntity instanceof EntityLivingBase)) {
+ GT_Utility.applyElectricityDamage((EntityLivingBase) aEntity, this.mTransferredVoltageLast20,
+ this.mTransferredAmperageLast20);
}
}
@@ -138,7 +169,8 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
if (!this.mCanShock) {
return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
}
- return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D);
+ return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D,
+ aZ + 0.875D);
}
@Override
@@ -173,19 +205,26 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
@Override
public long injectEnergyUnits(final byte aSide, final long aVoltage, final long aAmperage) {
- if (!this.getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, this.getBaseMetaTileEntity().getCoverIDAtSide(aSide), this.getBaseMetaTileEntity().getCoverDataAtSide(aSide), this.getBaseMetaTileEntity())) {
+ if (!this.getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide,
+ this.getBaseMetaTileEntity().getCoverIDAtSide(aSide),
+ this.getBaseMetaTileEntity().getCoverDataAtSide(aSide), this.getBaseMetaTileEntity())) {
return 0;
}
- return this.transferElectricity(aSide, aVoltage, aAmperage, new ArrayList<>(Arrays.asList((TileEntity) this.getBaseMetaTileEntity())));
+ return this.transferElectricity(aSide, aVoltage, aAmperage,
+ new ArrayList<>(Arrays.asList((TileEntity) this.getBaseMetaTileEntity())));
}
@Override
- public long transferElectricity(final byte aSide, long aVoltage, final long aAmperage, final ArrayList<TileEntity> aAlreadyPassedTileEntityList) {
+ public long transferElectricity(final byte aSide, long aVoltage, final long aAmperage,
+ final ArrayList<TileEntity> aAlreadyPassedTileEntityList) {
long rUsedAmperes = 0;
aVoltage -= this.mCableLossPerMeter;
if (aVoltage > 0) {
for (byte i = 0; (i < 6) && (aAmperage > rUsedAmperes); i++) {
- if ((i != aSide) && ((this.mConnections & (1 << i)) != 0) && this.getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i, this.getBaseMetaTileEntity().getCoverIDAtSide(i), this.getBaseMetaTileEntity().getCoverDataAtSide(i), this.getBaseMetaTileEntity())) {
+ if ((i != aSide) && ((this.mConnections & (1 << i)) != 0)
+ && this.getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i,
+ this.getBaseMetaTileEntity().getCoverIDAtSide(i),
+ this.getBaseMetaTileEntity().getCoverDataAtSide(i), this.getBaseMetaTileEntity())) {
final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(i);
if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) {
aAlreadyPassedTileEntityList.add(tTileEntity);
@@ -196,22 +235,45 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
continue;
}
}
- if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable) && ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i)).letsEnergyIn(GT_Utility.getOppositeSide(i), ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity) tTileEntity))) {
+ if ((tTileEntity instanceof IGregTechTileEntity)
+ && (((IGregTechTileEntity) tTileEntity)
+ .getMetaTileEntity() instanceof IMetaTileEntityCable)
+ && ((IGregTechTileEntity) tTileEntity)
+ .getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i))
+ .letsEnergyIn(GT_Utility.getOppositeSide(i),
+ ((IGregTechTileEntity) tTileEntity)
+ .getCoverIDAtSide(GT_Utility.getOppositeSide(i)),
+ ((IGregTechTileEntity) tTileEntity)
+ .getCoverDataAtSide(GT_Utility.getOppositeSide(i)),
+ ((IGregTechTileEntity) tTileEntity))) {
if (((IGregTechTileEntity) tTileEntity).getTimer() > 50) {
- rUsedAmperes += ((IMetaTileEntityCable) ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()).transferElectricity(GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes, aAlreadyPassedTileEntityList);
+ rUsedAmperes += ((IMetaTileEntityCable) ((IGregTechTileEntity) tTileEntity)
+ .getMetaTileEntity()).transferElectricity(GT_Utility.getOppositeSide(i),
+ aVoltage, aAmperage - rUsedAmperes, aAlreadyPassedTileEntityList);
}
} else {
- rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits(GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes);
+ rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits(
+ GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes);
}
- // } else if (tTileEntity instanceof IEnergySink) {
- // ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite();
- // if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)getBaseMetaTileEntity(), tDirection)) {
- // if (((IEnergySink)tTileEntity).demandedEnergyUnits() > 0 && ((IEnergySink)tTileEntity).injectEnergyUnits(tDirection, aVoltage) < aVoltage) rUsedAmperes++;
- // }
+ // } else if (tTileEntity instanceof IEnergySink) {
+ // ForgeDirection tDirection =
+ // ForgeDirection.getOrientation(i).getOpposite();
+ // if
+ // (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)getBaseMetaTileEntity(),
+ // tDirection)) {
+ // if
+ // (((IEnergySink)tTileEntity).demandedEnergyUnits()
+ // > 0 &&
+ // ((IEnergySink)tTileEntity).injectEnergyUnits(tDirection,
+ // aVoltage) < aVoltage) rUsedAmperes++;
+ // }
} else if (tTileEntity instanceof IEnergySink) {
final ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite();
- if (((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) this.getBaseMetaTileEntity(), tDirection)) {
- if ((((IEnergySink) tTileEntity).getDemandedEnergy() > 0) && (((IEnergySink) tTileEntity).injectEnergy(tDirection, aVoltage, aVoltage) < aVoltage)) {
+ if (((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) this.getBaseMetaTileEntity(),
+ tDirection)) {
+ if ((((IEnergySink) tTileEntity).getDemandedEnergy() > 0)
+ && (((IEnergySink) tTileEntity).injectEnergy(tDirection, aVoltage,
+ aVoltage) < aVoltage)) {
rUsedAmperes++;
}
}
@@ -223,15 +285,18 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
rUsedAmperes++;
} else if (((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, true) > 0) {
if (this.mRestRF == 0) {
- final int RFtrans = ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, false);
+ final int RFtrans = ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut,
+ false);
rUsedAmperes++;
this.mRestRF = rfOut - RFtrans;
} else {
- final int RFtrans = ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, (int) this.mRestRF, false);
+ final int RFtrans = ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection,
+ (int) this.mRestRF, false);
this.mRestRF = this.mRestRF - RFtrans;
}
}
- if (GregTech_API.mRFExplosions && (((IEnergyReceiver) tTileEntity).getMaxEnergyStored(tDirection) < (rfOut * 600))) {
+ if (GregTech_API.mRFExplosions && (((IEnergyReceiver) tTileEntity)
+ .getMaxEnergyStored(tDirection) < (rfOut * 600))) {
if (rfOut > ((32 * GregTech_API.mEUtoRF) / 100)) {
this.doExplosion(rfOut);
}
@@ -242,24 +307,21 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
}
}
-
this.mTransferredAmperage += rUsedAmperes;
this.mTransferredVoltageLast20 = Math.max(this.mTransferredVoltageLast20, aVoltage);
this.mTransferredAmperageLast20 = Math.max(this.mTransferredAmperageLast20, this.mTransferredAmperage);
-
- if ((aVoltage > this.mVoltage) || (this.mTransferredAmperage > this.mAmperage)){
- //GT 5.09
+ if ((aVoltage > this.mVoltage) || (this.mTransferredAmperage > this.mAmperage)) {
+ // GT 5.09
if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
- if(this.mOverheat>(this.mWireHeatingTicks * 100)){
+ if (this.mOverheat > (this.mWireHeatingTicks * 100)) {
this.getBaseMetaTileEntity().setToFire();
- }
- else{
- this.mOverheat +=100;
+ } else {
+ this.mOverheat += 100;
}
return aAmperage;
}
- //GT 5.08
+ // GT 5.08
else {
this.getBaseMetaTileEntity().setToFire();
return aAmperage;
@@ -273,7 +335,7 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
if (aBaseMetaTileEntity.isServerSide()) {
this.mTransferredAmperage = 0;
- if(this.mOverheat>0) {
+ if (this.mOverheat > 0) {
this.mOverheat--;
}
@@ -283,7 +345,15 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
this.mConnections = 0;
for (byte i = 0, j = 0; i < 6; i++) {
j = GT_Utility.getOppositeSide(i);
- if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity) || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyIn(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity) || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyOut(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity)) {
+ if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i,
+ aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i),
+ aBaseMetaTileEntity)
+ || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyIn(i,
+ aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i),
+ aBaseMetaTileEntity)
+ || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyOut(i,
+ aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i),
+ aBaseMetaTileEntity)) {
final TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i);
if (tTileEntity instanceof IColoredTileEntity) {
if (aBaseMetaTileEntity.getColorization() >= 0) {
@@ -293,29 +363,47 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
}
}
}
- if ((tTileEntity instanceof IEnergyConnected) && (((IEnergyConnected) tTileEntity).inputEnergyFrom(j) || ((IEnergyConnected) tTileEntity).outputsEnergyTo(j))) {
+ if ((tTileEntity instanceof IEnergyConnected)
+ && (((IEnergyConnected) tTileEntity).inputEnergyFrom(j)
+ || ((IEnergyConnected) tTileEntity).outputsEnergyTo(j))) {
this.mConnections |= (1 << i);
continue;
}
- if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable)) {
- if (((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).letsEnergyIn(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).letsEnergyOut(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity))) {
+ if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity)
+ .getMetaTileEntity() instanceof IMetaTileEntityCable)) {
+ if (((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j,
+ ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j),
+ ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j),
+ ((IGregTechTileEntity) tTileEntity))
+ || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).letsEnergyIn(j,
+ ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j),
+ ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j),
+ ((IGregTechTileEntity) tTileEntity))
+ || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).letsEnergyOut(j,
+ ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j),
+ ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j),
+ ((IGregTechTileEntity) tTileEntity))) {
this.mConnections |= (1 << i);
continue;
}
}
- if ((tTileEntity instanceof IEnergySink) && ((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) {
+ if ((tTileEntity instanceof IEnergySink) && ((IEnergySink) tTileEntity).acceptsEnergyFrom(
+ (TileEntity) aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) {
this.mConnections |= (1 << i);
continue;
}
- if (GregTech_API.mOutputRF && (tTileEntity instanceof IEnergyReceiver) && ((IEnergyReceiver) tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(j))) {
+ if (GregTech_API.mOutputRF && (tTileEntity instanceof IEnergyReceiver)
+ && ((IEnergyReceiver) tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(j))) {
this.mConnections |= (1 << i);
continue;
}
/*
- if (tTileEntity instanceof IEnergyEmitter && ((IEnergyEmitter)tTileEntity).emitsEnergyTo((TileEntity)aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) {
- mConnections |= (1<<i);
- continue;
- }*/
+ * if (tTileEntity instanceof IEnergyEmitter &&
+ * ((IEnergyEmitter)tTileEntity).emitsEnergyTo((
+ * TileEntity)aBaseMetaTileEntity,
+ * ForgeDirection.getOrientation(j))) { mConnections |=
+ * (1<<i); continue; }
+ */
}
}
}
@@ -323,22 +411,25 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements
}
@Override
- public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
+ final ItemStack aStack) {
return false;
}
@Override
- public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
+ final ItemStack aStack) {
return false;
}
@Override
public String[] getDescription() {
- return new String[]{
- "Max Voltage: " + EnumChatFormatting.GREEN + this.mVoltage + " (" + VN[GT_Utility.getTier(this.mVoltage)] + ")" + EnumChatFormatting.GRAY,
+ return new String[] {
+ "Max Voltage: " + EnumChatFormatting.GREEN + this.mVoltage + " ("
+ + VN[GT_Utility.getTier(this.mVoltage)] + ")" + EnumChatFormatting.GRAY,
"Max Amperage: " + EnumChatFormatting.YELLOW + this.mAmperage + EnumChatFormatting.GRAY,
- "Loss/Meter/Ampere: " + EnumChatFormatting.RED + this.mCableLossPerMeter + EnumChatFormatting.GRAY + " EU-Volt"
- };
+ "Loss/Meter/Ampere: " + EnumChatFormatting.RED + this.mCableLossPerMeter + EnumChatFormatting.GRAY
+ + " EU-Volt" };
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java
index 2997a3d7af..645cee84e3 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java
@@ -22,9 +22,10 @@ public abstract class GregtechMetaTileEntity extends MetaTileEntity {
*/
public final ITexture[][][] mTextures;
- public GregtechMetaTileEntity(final int aID, final String aName, final String aNameRegional, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture... aTextures) {
+ public GregtechMetaTileEntity(final int aID, final String aName, final String aNameRegional, final int aTier,
+ final int aInvSlotCount, final String aDescription, final ITexture... aTextures) {
super(aID, aName, aNameRegional, aInvSlotCount);
- this.mTier = (byte)Math.max(0, Math.min(aTier, 9));
+ this.mTier = (byte) Math.max(0, Math.min(aTier, 9));
this.mDescription = aDescription;
// must always be the last call!
@@ -35,9 +36,10 @@ public abstract class GregtechMetaTileEntity extends MetaTileEntity {
}
}
- public GregtechMetaTileEntity(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) {
+ public GregtechMetaTileEntity(final String aName, final int aTier, final int aInvSlotCount,
+ final String aDescription, final ITexture[][][] aTextures) {
super(aName, aInvSlotCount);
- this.mTier = (byte)aTier;
+ this.mTier = (byte) aTier;
this.mDescription = aDescription;
this.mTextures = aTextures;
@@ -45,7 +47,7 @@ public abstract class GregtechMetaTileEntity extends MetaTileEntity {
@Override
public byte getTileEntityBaseType() {
- return (byte)(Math.min(3, this.mTier<=0?0:1+((this.mTier-1) / 4)));
+ return (byte) (Math.min(3, this.mTier <= 0 ? 0 : 1 + ((this.mTier - 1) / 4)));
}
@Override
@@ -60,13 +62,15 @@ public abstract class GregtechMetaTileEntity extends MetaTileEntity {
@Override
public String[] getDescription() {
- return new String[] {this.mDescription, CORE.GT_Tooltip};
+ return new String[] { this.mDescription, CORE.GT_Tooltip };
}
/**
- * Used Client Side to get a Texture Set for this Block.
- * Called after setting the Tier and the Description so that those two are accessible.
- * @param aTextures is the optional Array you can give to the Constructor.
+ * Used Client Side to get a Texture Set for this Block. Called after
+ * setting the Tier and the Description so that those two are accessible.
+ *
+ * @param aTextures
+ * is the optional Array you can give to the Constructor.
*/
public abstract ITexture[][][] getTextureSet(ITexture[] aTextures);
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java
index cffedac712..83affb9740 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java
@@ -1,6 +1,5 @@
package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base;
-
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -13,9 +12,9 @@ import net.minecraft.nbt.NBTTagCompound;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Transformer;
public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer {
-
+
private boolean mHalfMode = false;
-
+
public GregtechMetaTransformerHiAmp(int aID, String aName, String aNameRegional, int aTier, String aDescription) {
super(aID, aName, aNameRegional, aTier, aDescription);
}
@@ -26,43 +25,56 @@ public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer
@Override
public long maxEUStore() {
- return ((512L + gregtech.api.enums.GT_Values.V[(this.mTier + 1)] * 2L)*8);
+ return ((512L + gregtech.api.enums.GT_Values.V[(this.mTier + 1)] * 2L) * 8);
}
@Override
public long maxAmperesOut() {
- if (this.mHalfMode){
- return ((getBaseMetaTileEntity().isAllowedToWork()) ? 8L : 2L);
+ if (this.mHalfMode) {
+ return ((getBaseMetaTileEntity().isAllowedToWork()) ? 8L : 2L);
}
- return ((getBaseMetaTileEntity().isAllowedToWork()) ? 16L : 4L);
+ return ((getBaseMetaTileEntity().isAllowedToWork()) ? 16L : 4L);
}
@Override
public long maxAmperesIn() {
- if (this.mHalfMode){
- return ((getBaseMetaTileEntity().isAllowedToWork()) ? 2L : 8L);
+ if (this.mHalfMode) {
+ return ((getBaseMetaTileEntity().isAllowedToWork()) ? 2L : 8L);
}
return ((getBaseMetaTileEntity().isAllowedToWork()) ? 4L : 16L);
}
+
@Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- ITexture[][][] rTextures = new ITexture[12][17][];
- for (byte i = -1; i < 16; i++) {
- rTextures[0][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]};
- rTextures[1][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]};
- rTextures[2][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]};
- rTextures[3][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier+1]};
- rTextures[4][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier+1]};
- rTextures[5][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier+1]};
- rTextures[6][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]};
- rTextures[7][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]};
- rTextures[8][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]};
- rTextures[9][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier+1]};
- rTextures[10][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier+1]};
- rTextures[11][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier+1]};
- }
- return rTextures;
- }
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ ITexture[][][] rTextures = new ITexture[12][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ rTextures[1][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ rTextures[2][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ rTextures[3][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier + 1] };
+ rTextures[4][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier + 1] };
+ rTextures[5][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier + 1] };
+ rTextures[6][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] };
+ rTextures[7][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] };
+ rTextures[8][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] };
+ rTextures[9][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier + 1] };
+ rTextures[10][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier + 1] };
+ rTextures[11][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier + 1] };
+ }
+ return rTextures;
+ }
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
@@ -71,7 +83,7 @@ public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer
@Override
public String[] getDescription() {
- return new String[] {this.mDescription, "Accepts 4A and outputs 16A", CORE.GT_Tooltip};
+ return new String[] { this.mDescription, "Accepts 4A and outputs 16A", CORE.GT_Tooltip };
}
@Override
@@ -89,10 +101,9 @@ public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer
@Override
public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
this.mHalfMode = Utils.invertBoolean(mHalfMode);
- if (this.mHalfMode){
+ if (this.mHalfMode) {
PlayerUtils.messagePlayer(aPlayer, "Transformer is now running at 2A:8A in/out Ratio.");
- }
- else {
+ } else {
PlayerUtils.messagePlayer(aPlayer, "Transformer is now running at 4A:16A in/out Ratio.");
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index 72e5a17135..bf7dc58db3 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -1,37 +1,37 @@
package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base;
-import static gregtech.api.enums.GT_Values.V;
-
import java.util.ArrayList;
+import java.util.Iterator;
-import gregtech.GT_Mod;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.*;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.metatileentity.MetaTileEntity;
-import gregtech.api.metatileentity.implementations.*;
-import gregtech.api.objects.GT_ItemStack;
-import gregtech.api.util.*;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
-import gregtech.common.items.GT_MetaGenerated_Tool_01;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.util.GT_Recipe;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
-import net.minecraft.entity.player.EntityPlayer;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.fluids.FluidStack;
-public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_MultiBlockBase {
+public abstract class GregtechMeta_MultiBlockBase
+extends
+GT_MetaTileEntity_MultiBlockBase {
public static boolean disableMaintenance;
+ public ArrayList<GT_MetaTileEntity_Hatch_InputBattery> mChargeHatches = new ArrayList<GT_MetaTileEntity_Hatch_InputBattery>();
+ public ArrayList<GT_MetaTileEntity_Hatch_OutputBattery> mDischargeHatches = new ArrayList<GT_MetaTileEntity_Hatch_OutputBattery>();
- public GregtechMeta_MultiBlockBase(final int aID, final String aName, final String aNameRegional) {
+ public GregtechMeta_MultiBlockBase(final int aID, final String aName,
+ final String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -39,130 +39,266 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
super(aName);
}
- public static boolean isValidMetaTileEntity(final MetaTileEntity aMetaTileEntity) {
- return (aMetaTileEntity.getBaseMetaTileEntity() != null) && (aMetaTileEntity.getBaseMetaTileEntity().getMetaTileEntity() == aMetaTileEntity) && !aMetaTileEntity.getBaseMetaTileEntity().isDead();
+ public static boolean isValidMetaTileEntity(
+ final MetaTileEntity aMetaTileEntity) {
+ return (aMetaTileEntity.getBaseMetaTileEntity() != null)
+ && (aMetaTileEntity.getBaseMetaTileEntity()
+ .getMetaTileEntity() == aMetaTileEntity)
+ && !aMetaTileEntity.getBaseMetaTileEntity().isDead();
}
@Override
- public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
- return new CONTAINER_MultiMachine(aPlayerInventory, aBaseMetaTileEntity);
+ public Object getServerGUI(final int aID,
+ final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_MultiMachine(aPlayerInventory,
+ aBaseMetaTileEntity);
}
@Override
- public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
- return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png");
+ public Object getClientGUI(final int aID,
+ final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity,
+ this.getLocalName(), "MultiblockDisplay.png");
}
@Override
public String[] getInfoData() {
- return new String[]{"Progress:", (this.mProgresstime / 20) + "secs", (this.mMaxProgresstime / 20) + "secs", "Efficiency:", (this.mEfficiency / 100.0F) + "%", "Problems:", "" + (this.getIdealStatus() - this.getRepairStatus())};
+ return new String[]{"Progress:", (this.mProgresstime / 20) + "secs",
+ (this.mMaxProgresstime / 20) + "secs", "Efficiency:",
+ (this.mEfficiency / 100.0F) + "%", "Problems:",
+ "" + (this.getIdealStatus() - this.getRepairStatus())};
}
@Override
public boolean isGivingInformation() {
return true;
}
-
+
public int getAmountOfOutputs() {
return 1;
}
-
+
@Override
- public boolean isCorrectMachinePart(ItemStack paramItemStack) {
+ public boolean isCorrectMachinePart(final ItemStack paramItemStack) {
return true;
}
@Override
- public int getDamageToComponent(ItemStack paramItemStack) {
+ public int getDamageToComponent(final ItemStack paramItemStack) {
return 0;
}
-
- public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {}
-
- public void startProcess() {}
- public int getValidOutputSlots(final IGregTechTileEntity machineCalling, final GT_Recipe sRecipes, final ItemStack[] sInputs){
- //Utils.LOG_INFO("Finding valid output slots for "+machineCalling.getInventoryName());
+ @Override
+ public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) {
+ }
- try{
-
- if (sRecipes == null){
- return 0;
- }
-
- final ArrayList<ItemStack> tInputList = this.getStoredInputs();
- final GT_Recipe tRecipe = sRecipes;
- final int outputItemCount;
- if (tRecipe.mOutputs != null){
- outputItemCount= tRecipe.mOutputs.length;
- }
- else {
- outputItemCount= 0;
- }
- int tValidOutputHatches = 0;
+ public void startProcess() {
+ }
- for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) {
- if (!isValidMetaTileEntity(tHatch)) continue;
+ public int getValidOutputSlots(final IGregTechTileEntity machineCalling,
+ final GT_Recipe sRecipes, final ItemStack[] sInputs) {
+ Utils.LOG_WARNING("Finding valid output slots for "
+ + machineCalling.getInventoryName());
+ final ArrayList<ItemStack> tInputList = this.getStoredInputs();
+ final GT_Recipe tRecipe = sRecipes;
+ final int outputItemCount = tRecipe.mOutputs.length;
+ int tValidOutputHatches = 0;
- int tEmptySlots = 0;
- boolean foundRoom = false;
- final IInventory tHatchInv = tHatch.getBaseMetaTileEntity();
- for(int i = 0; i < tHatchInv.getSizeInventory() && !foundRoom; ++i)
- {
- if(tHatchInv.getStackInSlot(i) != null) continue;
+ for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) {
+ if (!isValidMetaTileEntity(tHatch)) {
+ continue;
+ }
- tEmptySlots++;
- if(tEmptySlots < outputItemCount) continue;
+ int tEmptySlots = 0;
+ boolean foundRoom = false;
+ final IInventory tHatchInv = tHatch.getBaseMetaTileEntity();
+ for (int i = 0; (i < tHatchInv.getSizeInventory())
+ && !foundRoom; ++i) {
+ if (tHatchInv.getStackInSlot(i) != null) {
+ continue;
+ }
- tValidOutputHatches++;
- foundRoom = true;
+ tEmptySlots++;
+ if (tEmptySlots < outputItemCount) {
+ continue;
}
- }
- if (tValidOutputHatches < 0){
- tValidOutputHatches = 0;
- }
- return tValidOutputHatches;
- } catch (Throwable t){
- t.printStackTrace();
- return 0;
+ tValidOutputHatches++;
+ foundRoom = true;
+ }
}
+
+ return tValidOutputHatches;
}
- public GT_Recipe reduceRecipeTimeByPercentage(GT_Recipe tRecipe, float percentage){
+ public GT_Recipe reduceRecipeTimeByPercentage(final GT_Recipe tRecipe,
+ final float percentage) {
int cloneTime = 0;
GT_Recipe baseRecipe;
GT_Recipe cloneRecipe = null;
baseRecipe = tRecipe.copy();
- if (cloneRecipe != baseRecipe || cloneRecipe == null){
+ if ((cloneRecipe != baseRecipe) || (cloneRecipe == null)) {
cloneRecipe = baseRecipe.copy();
Utils.LOG_WARNING("Setting Recipe");
- }
- if (cloneTime != baseRecipe.mDuration || cloneTime == 0){
+ }
+ if ((cloneTime != baseRecipe.mDuration) || (cloneTime == 0)) {
cloneTime = baseRecipe.mDuration;
Utils.LOG_WARNING("Setting Time");
}
- if (cloneRecipe.mDuration > 0){
- int originalTime = cloneRecipe.mDuration;
- int tempTime = MathUtils.findPercentageOfInt(cloneRecipe.mDuration, (100-percentage));
+ if (cloneRecipe.mDuration > 0) {
+ final int originalTime = cloneRecipe.mDuration;
+ final int tempTime = MathUtils.findPercentageOfInt(cloneRecipe.mDuration,
+ (100 - percentage));
cloneRecipe.mDuration = tempTime;
- if (cloneRecipe.mDuration < originalTime){
- Utils.LOG_INFO("Generated recipe with a smaller time. | "+originalTime+" | "+cloneRecipe.mDuration+" |");
+ if (cloneRecipe.mDuration < originalTime) {
+ Utils.LOG_INFO("Generated recipe with a smaller time. | "
+ + originalTime + " | " + cloneRecipe.mDuration + " |");
return cloneRecipe;
- }
- else {
- Utils.LOG_INFO("Did not generate recipe with a smaller time. | "+originalTime+" | "+cloneRecipe.mDuration+" |");
+ } else {
+ Utils.LOG_INFO("Did not generate recipe with a smaller time. | "
+ + originalTime + " | " + cloneRecipe.mDuration + " |");
return tRecipe;
}
}
Utils.LOG_INFO("Error generating recipe, returning null.");
return null;
+ }
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity,
+ final long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ //this.mChargeHatches.clear();
+ //this.mDischargeHatches.clear();
+ }
+ @Override
+ public void explodeMultiblock() {
+ MetaTileEntity tTileEntity;
+ for (final Iterator<GT_MetaTileEntity_Hatch_InputBattery> localIterator = this.mChargeHatches
+ .iterator(); localIterator.hasNext(); tTileEntity
+ .getBaseMetaTileEntity()
+ .doExplosion(gregtech.api.enums.GT_Values.V[8])) {
+ tTileEntity = localIterator.next();
+ }
+ tTileEntity = null;
+ for (final Iterator<GT_MetaTileEntity_Hatch_OutputBattery> localIterator = this.mDischargeHatches
+ .iterator(); localIterator.hasNext(); tTileEntity
+ .getBaseMetaTileEntity()
+ .doExplosion(gregtech.api.enums.GT_Values.V[8])) {
+ tTileEntity = localIterator.next();
+ }
+ super.explodeMultiblock();
}
+ @Override
+ public void updateSlots() {
+ for (final GT_MetaTileEntity_Hatch_InputBattery tHatch : this.mChargeHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ tHatch.updateSlots();
+ }
+ }
+ for (final GT_MetaTileEntity_Hatch_OutputBattery tHatch : this.mDischargeHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ tHatch.updateSlots();
+ }
+ }
+ super.updateSlots();
+ }
+
+ @Override
+ public boolean addToMachineList(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_InputBattery) {
+ return this.mChargeHatches.add(
+ (GT_MetaTileEntity_Hatch_InputBattery) aMetaTileEntity);
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) {
+ return this.mDischargeHatches.add(
+ (GT_MetaTileEntity_Hatch_OutputBattery) aMetaTileEntity);
+ }
+ return super.addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+
+ public boolean addChargeableToMachineList(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_InputBattery) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity)
+ .updateTexture(aBaseCasingIndex);
+ return this.mChargeHatches.add(
+ (GT_MetaTileEntity_Hatch_InputBattery) aMetaTileEntity);
+ }
+ return false;
+ }
+
+ public boolean addDischargeableInputToMachineList(
+ 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_OutputBattery) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity)
+ .updateTexture(aBaseCasingIndex);
+ return this.mDischargeHatches.add(
+ (GT_MetaTileEntity_Hatch_OutputBattery) aMetaTileEntity);
+ }
+ return false;
+ }
+
+
+ public boolean addFluidInputToMachineList(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_Input) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = this.getRecipeMap();
+ return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity);
+ }
+ return false;
+ }
+
+ public boolean addFluidOutputToMachineList(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_Output) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity);
+ }
+ return false;
+ }
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java
index afce39b5d9..51a2c208e6 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java
@@ -32,7 +32,7 @@ extends GregtechMetaCasingBlocksAbstract {
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Cyclotron Outer Casing");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Thermal Containment Casing");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Autocrafter Frame");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Placeholder Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Cutting Factory Frame");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Placeholder Casing ");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Placeholder Casing ");
GregtechItemList.Casing_ThermalCentrifuge.set(new ItemStack(this, 1, 0));
@@ -48,7 +48,7 @@ extends GregtechMetaCasingBlocksAbstract {
GregtechItemList.Casing_Cyclotron_External.set(new ItemStack(this, 1, 10));
GregtechItemList.Casing_ThermalContainment.set(new ItemStack(this, 1, 11));
GregtechItemList.Casing_Autocrafter.set(new ItemStack(this, 1, 12));
- GregtechItemList.Casing_PlaceHolder13.set(new ItemStack(this, 1, 13));
+ GregtechItemList.Casing_CuttingFactoryFrame.set(new ItemStack(this, 1, 13));
GregtechItemList.Casing_PlaceHolder14.set(new ItemStack(this, 1, 14));
GregtechItemList.Casing_PlaceHolder15.set(new ItemStack(this, 1, 15));
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java
index 82b2da069c..af9edb3e0c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java
@@ -50,7 +50,7 @@ public class CasingTextureHandler2 {
return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon();
//Reactor Casing II
case 13:
- return TexturesGtBlock._PlaceHolder.getIcon();
+ return TexturesGtBlock.Casing_Machine_Ultra.getIcon();
case 14:
return TexturesGtBlock._PlaceHolder.getIcon();
case 15:
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
index 4e5eaa53a0..be1ceb2fd7 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
@@ -10,9 +10,9 @@ import net.minecraft.util.ResourceLocation;
public class TexturesGtBlock {
-
+
//public static ITexture[] CASING_BLOCKS_GTPP = new ITexture[256];
-
+
/*
* Handles Custom Textures.
*/
@@ -62,6 +62,12 @@ public class TexturesGtBlock {
public static final CustomIcon _PlaceHolder = Internal_PlaceHolder;
+ //Controllers
+ private static final CustomIcon Internal_Casing_Fusion_Simple_Front = new CustomIcon("TileEntities/MACHINE_CASING_FUSION_FRONT");
+ public static final CustomIcon Casing_Fusion_Simple_Front = Internal_Casing_Fusion_Simple_Front;
+ private static final CustomIcon Internal_Casing_Fusion_Simple_Front_Active = new CustomIcon("TileEntities/MACHINE_CASING_FUSION_FRONT_ACTIVE");
+ public static final CustomIcon Casing_Fusion_Simple_Front_Active = Internal_Casing_Fusion_Simple_Front_Active;
+
//Machine Casings
//Simple
private static final CustomIcon Internal_Casing_Machine_Simple_Top = new CustomIcon("TileEntities/machine_top");
@@ -125,7 +131,7 @@ public class TexturesGtBlock {
public static final CustomIcon Casing_Machine_Redstone_Off = Internal_Casing_Machine_Redstone_Off;
private static final CustomIcon Internal_Casing_Machine_Redstone_On = new CustomIcon("TileEntities/cover_redstone_emitter");
public static final CustomIcon Casing_Machine_Redstone_On = Internal_Casing_Machine_Redstone_On;
-
+
//Centrifuge Casing
private static final CustomIcon Internal_Casing_Centrifuge = new CustomIcon("TileEntities/MACHINE_CASING_CENTRIFUGE");
public static final CustomIcon Casing_Material_Centrifuge = Internal_Casing_Centrifuge;
@@ -158,7 +164,7 @@ public class TexturesGtBlock {
public static final CustomIcon Overlay_Machine_Cyber_A = Internal_Overlay_Machine_Cyber_A;
private static final CustomIcon Internal_Overlay_Machine_Cyber_B = new CustomIcon("chrono/CyberPanel2");
public static final CustomIcon Overlay_Machine_Cyber_B = Internal_Overlay_Machine_Cyber_B;
-
+
//Overlays
//Fan Textures
private static final CustomIcon Internal_Overlay_Machine_Vent = new CustomIcon("TileEntities/machine_top_vent_rotating");
@@ -199,6 +205,15 @@ public class TexturesGtBlock {
public static final CustomIcon Overlay_Crafting_Bronze = Internal_Overlay_Crafting_Bronze;
private static final CustomIcon Internal_Overlay_Crafting_Steel = new CustomIcon("TileEntities/cover_crafting");
public static final CustomIcon Overlay_Crafting_Steel = Internal_Overlay_Crafting_Steel;
+
+ //Hatch Overlays
+ //Charger Texture
+ private static final CustomIcon Internal_Overlay_Hatch_Charger = new CustomIcon("TileEntities/cover_charger");
+ public static final CustomIcon Overlay_Hatch_Charger = Internal_Overlay_Hatch_Charger;
+ //Discharger Texture
+ private static final CustomIcon Internal_Overlay_Hatch_Discharger = new CustomIcon("TileEntities/cover_discharge");
+ public static final CustomIcon Overlay_Hatch_Discharger = Internal_Overlay_Hatch_Discharger;
+
//Dimensional
private static final CustomIcon Internal_Overlay_Machine_Dimensional_Blue = new CustomIcon("TileEntities/adv_machine_dimensional_cover_blue");
public static final CustomIcon Overlay_Machine_Dimensional_Blue = Internal_Overlay_Machine_Dimensional_Blue;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/command/regen/GTPP_WorldRegenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/command/regen/GTPP_WorldRegenerator.java
new file mode 100644
index 0000000000..ebe26c8645
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/command/regen/GTPP_WorldRegenerator.java
@@ -0,0 +1,135 @@
+package gtPlusPlus.xmod.gregtech.common.command.regen;
+
+import java.util.HashSet;
+import java.util.Random;
+
+import cpw.mods.fml.common.IWorldGenerator;
+import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.GregTech_API;
+import gregtech.api.objects.XSTR;
+import gregtech.api.util.GT_Log;
+import gregtech.api.world.GT_Worldgen;
+import gregtech.common.GT_Worldgen_GT_Ore_Layer;
+import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraft.world.chunk.IChunkProvider;
+
+public class GTPP_WorldRegenerator implements IWorldGenerator {
+ private static int mEndAsteroidProbability = 300;
+ private static int mGCAsteroidProbability = 50;
+ private static int mSize = 100;
+ private static int endMinSize = 50;
+ private static int endMaxSize = 200;
+ private static int gcMinSize = 100;
+ private static int gcMaxSize = 400;
+ private static boolean endAsteroids = true;
+ private static boolean gcAsteroids = true;
+
+
+ public GTPP_WorldRegenerator() {
+ GameRegistry.registerWorldGenerator(this, 1073741823);
+ }
+
+ @Override
+ public synchronized void generate(final Random aRandom, final int aX, final int aZ, final World aWorld, final IChunkProvider aChunkGenerator, final IChunkProvider aChunkProvider) {
+ int tempDimensionId = aWorld.provider.dimensionId;
+ if ((tempDimensionId != -1) && (tempDimensionId != 1) && !aChunkGenerator.getClass().getName().contains("galacticraft")) {
+ tempDimensionId = 0;
+ }
+ new WorldGenContainer(aX * 16, aZ * 16, tempDimensionId, aWorld, aChunkGenerator, aChunkProvider, aWorld.getBiomeGenForCoords((aX * 16) + 8, (aZ * 16) + 8).biomeName).run();
+ }
+
+ public static class WorldGenContainer implements Runnable {
+ public int mX;
+ public int mZ;
+ public final int mDimensionType;
+ public final World mWorld;
+ public final IChunkProvider mChunkGenerator;
+ public final IChunkProvider mChunkProvider;
+ public final String mBiome;
+ public static HashSet<ChunkCoordIntPair> mGenerated = new HashSet<>(2000);
+
+ public WorldGenContainer(final int aX, final int aZ, final int aDimensionType, final World aWorld, final IChunkProvider aChunkGenerator, final IChunkProvider aChunkProvider, final String aBiome) {
+ this.mX = aX;
+ this.mZ = aZ;
+ this.mDimensionType = aDimensionType;
+ this.mWorld = aWorld;
+ this.mChunkGenerator = aChunkGenerator;
+ this.mChunkProvider = aChunkProvider;
+ this.mBiome = aBiome;
+ }
+
+ //returns a coordinate of a center chunk of 3x3 square; the argument belongs to this square
+ public int getVeinCenterCoordinate(int c) {
+ c += c < 0 ? 1 : 3;
+ return c - (c % 3) - 2;
+ }
+
+ public boolean surroundingChunksLoaded(final int xCenter, final int zCenter) {
+ return this.mWorld.checkChunksExist(xCenter - 16, 0, zCenter - 16, xCenter + 16, 0, zCenter + 16);
+ }
+
+ public Random getRandom(final int xChunk, final int zChunk) {
+ final long worldSeed = this.mWorld.getSeed();
+ final Random fmlRandom = new Random(worldSeed);
+ final long xSeed = fmlRandom.nextLong() >> (2 + 1L);
+ final long zSeed = fmlRandom.nextLong() >> (2 + 1L);
+ final long chunkSeed = ((xSeed * xChunk) + (zSeed * zChunk)) ^ worldSeed;
+ fmlRandom.setSeed(chunkSeed);
+ return new XSTR(fmlRandom.nextInt());
+ }
+
+ @Override
+ public void run() {
+ int xCenter = this.getVeinCenterCoordinate(this.mX >> 4);
+ int zCenter = this.getVeinCenterCoordinate(this.mZ >> 4);
+ final Random random = this.getRandom(xCenter, zCenter);
+ xCenter <<= 4;
+ zCenter <<= 4;
+ final ChunkCoordIntPair centerChunk = new ChunkCoordIntPair(xCenter, zCenter);
+ if (!mGenerated.contains(centerChunk) && this.surroundingChunksLoaded(xCenter, zCenter)) {
+ mGenerated.add(centerChunk);
+ if ((GT_Worldgen_GT_Ore_Layer.sWeight > 0) && (GT_Worldgen_GT_Ore_Layer.sList.size() > 0)) {
+ boolean temp = true;
+ int tRandomWeight;
+ for (int i = 0; (i < 256) && (temp); i++) {
+ tRandomWeight = random.nextInt(GT_Worldgen_GT_Ore_Layer.sWeight);
+ for (final GT_Worldgen tWorldGen : GT_Worldgen_GT_Ore_Layer.sList) {
+ tRandomWeight -= ((GT_Worldgen_GT_Ore_Layer) tWorldGen).mWeight;
+ if (tRandomWeight <= 0) {
+ try {
+ if (tWorldGen.executeWorldgen(this.mWorld, random, this.mBiome, this.mDimensionType, xCenter, zCenter, this.mChunkGenerator, this.mChunkProvider)) {
+ temp = false;
+ }
+ break;
+ } catch (final Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+ }
+ }
+ }
+ int i = 0;
+ for (int tX = xCenter - 16; i < 3; tX += 16) {
+ int j = 0;
+ for (int tZ = zCenter - 16; j < 3; tZ += 16) {
+ try {
+ for (final GT_Worldgen tWorldGen : GregTech_API.sWorldgenList) {
+ tWorldGen.executeWorldgen(this.mWorld, random, this.mBiome, this.mDimensionType, tX, tZ, this.mChunkGenerator, this.mChunkProvider);
+ }
+ } catch (final Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ j++;
+ }
+ i++;
+ }
+ }
+ final Chunk tChunk = this.mWorld.getChunkFromBlockCoords(this.mX, this.mZ);
+ if (tChunk != null) {
+ tChunk.isModified = true;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/command/regen/HANDLER_GT_Commands.java b/src/Java/gtPlusPlus/xmod/gregtech/common/command/regen/HANDLER_GT_Commands.java
new file mode 100644
index 0000000000..6e3d4fda93
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/command/regen/HANDLER_GT_Commands.java
@@ -0,0 +1,129 @@
+package gtPlusPlus.xmod.gregtech.common.command.regen;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import bloodasp.galacticgreg.GT_Worldgenerator_Space;
+import cpw.mods.fml.common.Loader;
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ConfigCategories;
+import gregtech.api.enums.Materials;
+import gregtech.common.GT_Worldgen_GT_Ore_SmallPieces;
+import gregtech.common.GT_Worldgen_Stone;
+import gregtech.common.GT_Worldgenerator;
+
+public class HANDLER_GT_Commands {
+
+ public static void preInit(){
+
+ }
+
+ public static void init(){
+
+ }
+
+ public static void postInit(){
+ final boolean tPFAA = (GregTech_API.sWorldgenFile.get(ConfigCategories.general, "AutoDetectPFAA", true)) && (Loader.isModLoaded("PFAAGeologica"));
+ new GT_Worldgenerator();
+ if (Loader.isModLoaded("GalacticraftCore") && Loader.isModLoaded("GalacticraftMars")) {
+ new GT_Worldgenerator_Space();
+ }
+
+ new GT_Worldgen_Stone("overworld.stone.blackgranite.tiny", true, GregTech_API.sBlockGranites, 0, 0, 1, 50, 48, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.blackgranite.small", true, GregTech_API.sBlockGranites, 0, 0, 1, 100, 96, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.blackgranite.medium", true, GregTech_API.sBlockGranites, 0, 0, 1, 200, 144, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.blackgranite.large", true, GregTech_API.sBlockGranites, 0, 0, 1, 300, 192, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.blackgranite.huge", true, GregTech_API.sBlockGranites, 0, 0, 1, 400, 240, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.redgranite.tiny", true, GregTech_API.sBlockGranites, 8, 0, 1, 50, 48, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.redgranite.small", true, GregTech_API.sBlockGranites, 8, 0, 1, 100, 96, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.redgranite.medium", true, GregTech_API.sBlockGranites, 8, 0, 1, 200, 144, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.redgranite.large", true, GregTech_API.sBlockGranites, 8, 0, 1, 300, 192, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.redgranite.huge", true, GregTech_API.sBlockGranites, 8, 0, 1, 400, 240, 0, 120, null, false);
+
+ new GT_Worldgen_Stone("nether.stone.blackgranite.tiny", false, GregTech_API.sBlockGranites, 0, -1, 1, 50, 48, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.blackgranite.small", false, GregTech_API.sBlockGranites, 0, -1, 1, 100, 96, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.blackgranite.medium", false, GregTech_API.sBlockGranites, 0, -1, 1, 200, 144, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.blackgranite.large", false, GregTech_API.sBlockGranites, 0, -1, 1, 300, 192, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.blackgranite.huge", false, GregTech_API.sBlockGranites, 0, -1, 1, 400, 240, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.redgranite.tiny", false, GregTech_API.sBlockGranites, 8, -1, 1, 50, 48, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.redgranite.small", false, GregTech_API.sBlockGranites, 8, -1, 1, 100, 96, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.redgranite.medium", false, GregTech_API.sBlockGranites, 8, -1, 1, 200, 144, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.redgranite.large", false, GregTech_API.sBlockGranites, 8, -1, 1, 300, 192, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.redgranite.huge", false, GregTech_API.sBlockGranites, 8, -1, 1, 400, 240, 0, 120, null, false);
+
+ new GT_Worldgen_Stone("overworld.stone.marble.tiny", true, GregTech_API.sBlockStones, 0, 0, 1, 50, 48, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.marble.small", true, GregTech_API.sBlockStones, 0, 0, 1, 100, 96, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.marble.medium", true, GregTech_API.sBlockStones, 0, 0, 1, 200, 144, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.marble.large", true, GregTech_API.sBlockStones, 0, 0, 1, 300, 192, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.marble.huge", true, GregTech_API.sBlockStones, 0, 0, 1, 400, 240, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.basalt.tiny", true, GregTech_API.sBlockStones, 8, 0, 1, 50, 48, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.basalt.small", true, GregTech_API.sBlockStones, 8, 0, 1, 100, 96, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.basalt.medium", true, GregTech_API.sBlockStones, 8, 0, 1, 200, 144, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.basalt.large", true, GregTech_API.sBlockStones, 8, 0, 1, 300, 192, 0, 120, null, false);
+ new GT_Worldgen_Stone("overworld.stone.basalt.huge", true, GregTech_API.sBlockStones, 8, 0, 1, 400, 240, 0, 120, null, false);
+
+ new GT_Worldgen_Stone("nether.stone.marble.tiny", false, GregTech_API.sBlockStones, 0, -1, 1, 50, 48, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.marble.small", false, GregTech_API.sBlockStones, 0, -1, 1, 100, 96, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.marble.medium", false, GregTech_API.sBlockStones, 0, -1, 1, 200, 144, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.marble.large", false, GregTech_API.sBlockStones, 0, -1, 1, 300, 192, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.marble.huge", false, GregTech_API.sBlockStones, 0, -1, 1, 400, 240, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.basalt.tiny", false, GregTech_API.sBlockStones, 8, -1, 1, 50, 48, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.basalt.small", false, GregTech_API.sBlockStones, 8, -1, 1, 100, 96, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.basalt.medium", false, GregTech_API.sBlockStones, 8, -1, 1, 200, 144, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.basalt.large", false, GregTech_API.sBlockStones, 8, -1, 1, 300, 192, 0, 120, null, false);
+ new GT_Worldgen_Stone("nether.stone.basalt.huge", false, GregTech_API.sBlockStones, 8, -1, 1, 400, 240, 0, 120, null, false);
+
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.copper", true, 60, 120, 32, !tPFAA, true, true, true, true, false, Materials.Copper);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.tin", true, 60, 120, 32, !tPFAA, true, true, true, true, true, Materials.Tin);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.bismuth", true, 80, 120, 8, !tPFAA, true, false, true, true, false, Materials.Bismuth);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.coal", true, 60, 100, 24, !tPFAA, false, false, false, false, false, Materials.Coal);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.iron", true, 40, 80, 16, !tPFAA, true, true, true, true, false, Materials.Iron);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.lead", true, 40, 80, 16, !tPFAA, true, true, true, true, true, Materials.Lead);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.zinc", true, 30, 60, 12, !tPFAA, true, true, true, true, false, Materials.Zinc);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.gold", true, 20, 40, 8, !tPFAA, true, true, true, true, true, Materials.Gold);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.silver", true, 20, 40, 8, !tPFAA, true, true, true, true, true, Materials.Silver);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.nickel", true, 20, 40, 8, !tPFAA, true, true, true, true, true, Materials.Nickel);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.lapis", true, 20, 40, 4, !tPFAA, false, false, true, false, true, Materials.Lapis);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.diamond", true, 5, 10, 2, !tPFAA, true, false, true, true, true, Materials.Diamond);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.emerald", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Emerald);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.ruby", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Ruby);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.sapphire", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Sapphire);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.greensapphire", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.GreenSapphire);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.olivine", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Olivine);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.topaz", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Topaz);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.tanzanite", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Tanzanite);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.amethyst", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Amethyst);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.opal", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Opal);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.jasper", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Jasper);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.bluetopaz", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.BlueTopaz);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.amber", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Amber);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.foolsruby", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.FoolsRuby);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.garnetred", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.GarnetRed);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.garnetyellow", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.GarnetYellow);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.redstone", true, 5, 20, 8, !tPFAA, true, false, true, true, true, Materials.Redstone);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.platinum", true, 20, 40, 8, false, false, true, false, true, true, Materials.Platinum);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.iridium", true, 20, 40, 8, false, false, true, false, true, true, Materials.Iridium);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.netherquartz", true, 30, 120, 64, false, true, false, false, false, false, Materials.NetherQuartz);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.saltpeter", true, 10, 60, 8, false, true, false, false, false, false, Materials.Saltpeter);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.sulfur_n", true, 10, 60, 32, false, true, false, false, false, false, Materials.Sulfur);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.sulfur_o", true, 5, 15, 8, !tPFAA, false, false, false, false, false, Materials.Sulfur);
+
+ int i = 0;
+ for (final int j = GregTech_API.sWorldgenFile.get("worldgen", "AmountOfCustomSmallOreSlots", 16); i < j; i++) {
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.custom." + (i < 10 ? "0" : "") + i, false, 0, 0, 0, false, false, false, false, false, false, Materials._NULL);
+ }
+ if (GregTech_API.mImmersiveEngineering && GT_Mod.gregtechproxy.mImmersiveEngineeringRecipes) {
+ Class<?> rC;
+ try {
+ rC = Class.forName("blusunrize.immersiveengineering.api.tool.ExcavatorHandler");
+ final Method method = rC.getMethod("recalculateChances", new Class[]{boolean.class});
+ method.invoke(null, true);
+ }
+ catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ }
+ }
+ }
+
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java
new file mode 100644
index 0000000000..6ff0536c85
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java
@@ -0,0 +1,407 @@
+package gtPlusPlus.xmod.gregtech.common.helpers;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import cpw.mods.fml.common.eventhandler.EventPriority;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.common.items.GT_MetaGenerated_Item_01;
+import gregtech.common.items.GT_MetaGenerated_Item_02;
+import gregtech.common.items.GT_MetaGenerated_Tool_01;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.array.BlockPos;
+import gtPlusPlus.core.util.array.Pair;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.nbt.NBTUtils;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaWirelessCharger;
+import ic2.api.info.Info;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
+
+public class ChargingHelper {
+
+ private static Map<EntityPlayer, Pair<GregtechMetaWirelessCharger, Byte>> mValidPlayers = new HashMap<EntityPlayer, Pair<GregtechMetaWirelessCharger, Byte>>();
+ protected static Map<BlockPos, GregtechMetaWirelessCharger> mChargerMap = new HashMap<BlockPos, GregtechMetaWirelessCharger>();
+ private int mTickTimer = 0;
+ private final int mTickMultiplier = 20;
+
+ //Called whenever the player is updated or ticked.
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
+ public void onPlayerTick(LivingUpdateEvent event) {
+ try {
+ if (event.entity != null && event.entityLiving != null){
+ if (event.entityLiving instanceof EntityPlayer){
+ EntityPlayer mPlayerMan = (EntityPlayer) event.entityLiving;
+
+
+ if (mPlayerMan != null){
+ //Utils.LOG_WARNING("Found Player.");
+
+ if (Utils.isServer()){
+ //Utils.LOG_WARNING("Found Server-Side.");
+
+ mTickTimer++;
+ if (mTickTimer % mTickMultiplier == 0){
+
+ long mVoltage = 0;
+ long mEuStored = 0;
+
+ if (!mChargerMap.isEmpty() && mValidPlayers.containsKey(mPlayerMan)){
+
+ InventoryPlayer mPlayerInventory = mPlayerMan.inventory;
+ ItemStack[] mArmourContents = mPlayerInventory.armorInventory.clone();
+ ItemStack[] mInventoryContents = mPlayerInventory.mainInventory.clone();
+
+ for (GregtechMetaWirelessCharger mEntityTemp : mChargerMap.values()){
+ if (mEntityTemp != null){
+ mVoltage = mEntityTemp.maxEUInput();
+ mEuStored = mEntityTemp.getEUVar();
+ if (mVoltage > 0 && mEuStored >= mVoltage){
+
+ Map<EntityPlayer, UUID> LR = mEntityTemp.getLongRangeMap();
+ Map<UUID, EntityPlayer> LO = mEntityTemp.getLocalMap();
+
+ long mStartingEu = mEntityTemp.getEUVar();
+ long mCurrentEu = mEntityTemp.getEUVar();
+ long mEuUsed = 0;
+ if (mEntityTemp.getMode() == 0){
+
+ /*if (!LR.isEmpty() && LR.containsKey(mPlayerMan)){
+ mCurrentEu = chargeItems(mEntityTemp, mArmourContents, mPlayerMan);
+ mCurrentEu = chargeItems(mEntityTemp, mInventoryContents, mPlayerMan);
+ }*/
+ }
+ else if (mEntityTemp.getMode() == 1){
+ if (!LO.isEmpty() && LO.containsValue(mPlayerMan)){
+ mCurrentEu = chargeItems(mEntityTemp, mArmourContents, mPlayerMan);
+ mCurrentEu = chargeItems(mEntityTemp, mInventoryContents, mPlayerMan);
+ }
+ }
+ else {
+ /*if (!LR.isEmpty() && LR.containsKey(mPlayerMan)){
+ mCurrentEu = chargeItems(mEntityTemp, mArmourContents, mPlayerMan);
+ mCurrentEu = chargeItems(mEntityTemp, mInventoryContents, mPlayerMan);
+ }*/
+ if (!LO.isEmpty() && LO.containsValue(mPlayerMan)){
+ mCurrentEu = chargeItems(mEntityTemp, mArmourContents, mPlayerMan);
+ mCurrentEu = chargeItems(mEntityTemp, mInventoryContents, mPlayerMan);
+ }
+ }
+
+ if ((mEuUsed = (mStartingEu - mCurrentEu)) <= 0 && mEntityTemp != null){
+ long mMaxDistance;
+ if (mEntityTemp.getMode() == 0){
+ mMaxDistance = (4*GT_Values.V[mEntityTemp.getTier()]);
+ }
+ else if (mEntityTemp.getMode() == 1){
+ mMaxDistance = (mEntityTemp.getTier()*10);
+ }
+ else {
+ mMaxDistance = (4*GT_Values.V[mEntityTemp.getTier()]/2);
+ }
+ double mDistance = calculateDistance(mEntityTemp, mPlayerMan);
+ long mVoltageCost = MathUtils.findPercentageOfInt(mMaxDistance, (float) mDistance);
+
+ if (mVoltageCost > 0){
+ if (mVoltageCost > mEntityTemp.maxEUInput()){
+ mEntityTemp.setEUVar((mEntityTemp.getEUVar()-mEntityTemp.maxEUInput()));
+ }
+ else {
+ mEntityTemp.setEUVar((mEntityTemp.getEUVar()-mVoltageCost));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ catch (Throwable t){
+ //Utils.LOG_WARNING("State of Wireless Charger changed in an invalid way, this prevented a crash.");
+
+ if (!mChargerMap.isEmpty()){
+ for (GregtechMetaWirelessCharger r : mChargerMap.values()){
+ if (r == null){
+ mChargerMap.remove(r);
+ }
+ }
+ }
+ //t.printStackTrace();
+ }
+
+
+ }
+
+ public static boolean addEntry(BlockPos mPos, GregtechMetaWirelessCharger mEntity){
+ if (mEntity == null){
+ return false;
+ }
+ if (!mChargerMap.containsKey(mPos)){
+ if (mChargerMap.put(mPos, mEntity) == null){
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ public static boolean removeEntry(BlockPos mPos, GregtechMetaWirelessCharger mEntity){
+ if (mEntity == null){
+ return false;
+ }
+ if (mChargerMap.containsKey(mPos)){
+ if (mChargerMap.remove(mPos, mEntity)){
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ public static boolean addValidPlayer(EntityPlayer mPlayer, GregtechMetaWirelessCharger mEntity){
+ if (mEntity == null){
+ return false;
+ }
+ Utils.LOG_WARNING("trying to map new player");
+ if (mValidPlayers.containsKey(mPlayer)){
+ Utils.LOG_WARNING("Key contains player already?");
+ return false;
+ }
+ else {
+ Utils.LOG_WARNING("key not found, adding");
+ Pair<GregtechMetaWirelessCharger, Byte> mEntry = new Pair<GregtechMetaWirelessCharger, Byte>(mEntity, (byte) mEntity.getMode());
+ if (mValidPlayers.put(mPlayer, mEntry) == null){
+ Utils.LOG_WARNING("Added a Player to the Tick Map.");
+ return true;
+ }
+ else {
+ Utils.LOG_WARNING("Tried to add player but it was already there?");
+ return false;
+ }
+ }
+ }
+
+ public static boolean removeValidPlayer(EntityPlayer mPlayer, GregtechMetaWirelessCharger mEntity){
+ if (mEntity == null){
+ return false;
+ }
+ Utils.LOG_WARNING("trying to remove player from map");
+ if (mValidPlayers.containsKey(mPlayer)){
+ Utils.LOG_WARNING("key found, removing");
+ Pair<GregtechMetaWirelessCharger, Byte> mEntry = new Pair<GregtechMetaWirelessCharger, Byte>(mEntity, (byte) mEntity.getMode());
+ if (mValidPlayers.remove(mPlayer, mEntry)){
+ Utils.LOG_WARNING("Removed a Player to the Tick Map.");
+ return true;
+ }
+ else {
+ Utils.LOG_WARNING("Tried to remove player but it was not there?");
+ return false;
+ }
+ }
+ else {
+ Utils.LOG_WARNING("Key does not contain player?");
+ return false;
+ }
+ }
+
+ public double calculateDistance(GregtechMetaWirelessCharger mEntityTemp, EntityPlayer mPlayerMan){
+ if (mEntityTemp == null || mPlayerMan == null){
+ return 0;
+ }
+ return mEntityTemp.getDistanceBetweenTwoPositions(mEntityTemp.getTileEntityPosition(), mEntityTemp.getPositionOfEntity(mPlayerMan));
+ }
+
+ public long chargeItems(GregtechMetaWirelessCharger mEntity, ItemStack[] mItems, EntityPlayer mPlayer){
+ if (mEntity == null){
+ return -100;
+ }
+ if (mItems == null || mItems.length == 0){
+ return mEntity.getEUVar();
+ }
+ long mInitialValue = mEntity.getEUVar();
+ long mReturnValue = chargeItemsEx(mEntity, mItems, mPlayer);
+ return ((mReturnValue < mInitialValue) ? mReturnValue : mInitialValue);
+ }
+
+ public long chargeItemsEx(GregtechMetaWirelessCharger mEntity, ItemStack[] mItems, EntityPlayer mPlayer){
+
+ //Bad Entity
+ if (mEntity == null){
+ return -100;
+ }
+ //Bad Inventory
+ if (mItems == null || mItems.length == 0){
+ return mEntity.getEUVar();
+ }
+ //Set Variables to Charge
+ int mChargedItems = 0;
+ final int mTier = mEntity.getTier();
+ final long mVoltage = mEntity.maxEUInput();
+ long mEuStored = mEntity.getEUVar();
+ final long mEuStoredOriginal = mEntity.getEUVar();
+ //For Inventory Contents
+
+ int mItemSlot = 0;
+
+ for (ItemStack mTemp : mItems){
+ mItemSlot++;
+ if (mTemp != null){
+ Utils.LOG_WARNING("Slot "+mItemSlot+" contains "+mTemp.getDisplayName());
+ }
+ //Is item Electrical
+ if (isItemValid(mTemp)){
+ Utils.LOG_WARNING("1");
+
+ //Transfer Limit
+ double mItemEuTLimit = ((IElectricItem) mTemp.getItem()).getTransferLimit(mTemp);
+ //Check if Tile has more or equal EU to what can be transferred into the item.
+ if (mEuStored >= mItemEuTLimit){
+ Utils.LOG_WARNING("2");
+
+ double mItemMaxCharge = ((IElectricItem) mTemp.getItem()).getMaxCharge(mTemp);
+ double mitemCurrentCharge = ElectricItem.manager.getCharge(mTemp);
+
+ if (mitemCurrentCharge >= mItemMaxCharge){
+ continue;
+ }
+
+ //Try get charge direct from NBT for GT and IC2 stacks
+ try {
+ Utils.LOG_WARNING("3");
+ if (mTemp.getItem() instanceof GT_MetaGenerated_Tool_01
+ || mTemp.getItem() instanceof GT_MetaGenerated_Item_01
+ || mTemp.getItem() instanceof GT_MetaGenerated_Item_02
+ || Class.forName("gregtech.common.items.GT_MetaGenerated_Item_03").isInstance(mTemp.getItem())
+ || mTemp.getItem().getClass().getName().toLowerCase().equals(("gregtech.common.items.GT_MetaGenerated_Tool_01").toLowerCase())){
+ if (!NBTUtils.hasKey(mTemp, "GT.ItemCharge")){
+ if (!mTemp.getDisplayName().toLowerCase().contains("battery")){
+ if (!GT_ModHandler.isElectricItem(mTemp)){
+ continue;
+ }
+ }
+ else {
+ mitemCurrentCharge = 0;
+ }
+ }
+ else {
+ mitemCurrentCharge = NBTUtils.getLong(mTemp, "GT.ItemCharge");
+ }
+ }
+ else if (mTemp.getItem() instanceof IElectricItem){
+ mitemCurrentCharge = NBTUtils.getLong(mTemp, "charge");
+ }
+ } catch (ClassNotFoundException e) {
+
+ }
+
+ double mVoltageIncrease;
+ if (mItemEuTLimit >= mVoltage){
+ mVoltageIncrease = mVoltage;
+ }
+ else if (mItemEuTLimit < mVoltage){
+ mVoltageIncrease = mItemEuTLimit;
+ }
+ else {
+ mVoltageIncrease = mItemEuTLimit;
+ }
+
+ Utils.LOG_WARNING("4");
+
+ int mMulti;
+ if ((mitemCurrentCharge + (mVoltageIncrease*20)) <= (mItemMaxCharge - (mVoltageIncrease*20))){
+ mMulti = 20;
+ }
+ else if ((mitemCurrentCharge + (mVoltageIncrease*10)) <= (mItemMaxCharge - (mVoltageIncrease*10))){
+ mMulti = 10;
+ }
+ else if ((mitemCurrentCharge + (mVoltageIncrease*5)) <= (mItemMaxCharge - (mVoltageIncrease*5))){
+ mMulti = 5;
+ }
+ else {
+ mMulti = 1;
+ }
+ Utils.LOG_WARNING("5");
+
+
+ int mMultiVoltage = (int) (mMulti*mVoltageIncrease);
+
+ if ((mitemCurrentCharge + mMultiVoltage) <= mItemMaxCharge){
+ Utils.LOG_WARNING("6");
+ if (GT_ModHandler.chargeElectricItem(mTemp, mMultiVoltage, mTier, true, false) == 0){
+ Utils.LOG_WARNING("6.5");
+ for (int i=0; i<mMulti;i++){
+ if (ElectricItem.manager.charge(mTemp, mVoltageIncrease, mTier, false, false) == 0){
+ continue;
+ }
+ }
+ }
+ if (ElectricItem.manager.getCharge(mTemp) > mitemCurrentCharge){
+ Utils.LOG_WARNING("7");
+ mEntity.setEUVar((long) (mEuStored-(mVoltage*mMulti)));
+ mEuStored = mEntity.getEUVar();
+ Utils.LOG_WARNING("Charged "+mTemp.getDisplayName()+" | Slot: "+mItemSlot+" | EU Multiplier: "+mMulti+" | EU/t input: "+mVoltageIncrease+" | EU/t consumed by Tile: "+mVoltage+" | Item Max Charge: "+mItemMaxCharge+" | Item Start Charge: "+mitemCurrentCharge+" | Item New Charge"+ElectricItem.manager.getCharge(mTemp));
+ mChargedItems++;
+ }
+ }
+
+
+ }
+ }
+ else {
+ if (mTemp != null){
+ Utils.LOG_WARNING("Found Non-Valid item. "+mTemp.getDisplayName());
+ }
+ }
+ }
+
+ //Return Values
+ if (mChargedItems < 1){
+ return mEuStoredOriginal;
+ }
+
+ return mEntity.getEUVar();
+ }
+
+ public boolean isItemValid(final ItemStack itemstack) {
+ if (itemstack == null){
+ return false;
+ }
+ if (GT_ModHandler.isElectricItem(itemstack)){
+ return true;
+ }
+ if ((accepts(itemstack)) || (itemstack.getItem() instanceof IElectricItem)) {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean accepts(final ItemStack stack) {
+ if (stack == null) {
+ return false;
+ }
+ return (Info.itemEnergy.getEnergyValue(stack) > 0.0D)
+ || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), 4, true, true, true) > 0.0D);
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java
index f6507aa1c4..a287615315 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java
@@ -17,7 +17,7 @@ import java.util.Collection;
public class GTPP_CapeRenderer
extends RenderPlayer {
- private final ResourceLocation[] mCapes = {new ResourceLocation("miscutils:textures/Orange.png"), new ResourceLocation("miscutils:textures/TesterCape.png"), new ResourceLocation("miscutils:textures/FancyCape.png"), new ResourceLocation("miscutils:textures/DevCape.png")};
+ private final ResourceLocation[] mCapes = {new ResourceLocation("miscutils:textures/OrangeHD.png"), new ResourceLocation("miscutils:textures/TesterCapeHD.png"), new ResourceLocation("miscutils:textures/FancyCapeHD.png"), new ResourceLocation("miscutils:textures/DevCapeHD.png")};
private final Collection<String> mCapeList;
public GTPP_CapeRenderer(Collection<String> aCapeList) {
@@ -25,6 +25,12 @@ public class GTPP_CapeRenderer
setRenderManager(RenderManager.instance);
}
+ private final String[] mOrangeCapes = {"ImmortalPharaoh7", "Walmart_Employee", "ArchonCerulean", "asturrial"}; //Orange.png
+ private final String[] mTestCapes = {"123_456_789", "doomsquirter", "ukdunc"}; //TesterCape.png
+ private final String[] mBlueCapes = {"fobius", "cantankerousrex", "stephen_2015", "Dyonovan", "Bear989Sr", "CrazyJ1984"}; //Fancycape.png
+ private final String[] mDevCapes = {"draknyte1", "redmage17"}; //Capes for Developers
+
+
public void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) {
AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer;
if (GT_Utility.getFullInvisibility(aPlayer)) {
@@ -40,27 +46,31 @@ public class GTPP_CapeRenderer
}
try {
ResourceLocation tResource = null;
- if (aPlayer.getDisplayName().equalsIgnoreCase("draknyte1")) {
- tResource = this.mCapes[3];
- }
- else if (aPlayer.getDisplayName().equalsIgnoreCase("fobius")) {
- tResource = this.mCapes[2];
- }
- else if (aPlayer.getDisplayName().equalsIgnoreCase("doomsquirter")) {
- tResource = this.mCapes[1];
+
+ for (String mName : mOrangeCapes){
+ if (mName.toLowerCase().contains(aPlayer.getDisplayName().toLowerCase())) {
+ tResource = this.mCapes[0];
+ }
}
- else if (aPlayer.getDisplayName().equalsIgnoreCase("ukdunc")) {
- tResource = this.mCapes[1];
+ for (String mName : mTestCapes){
+ if (mName.toLowerCase().contains(aPlayer.getDisplayName().toLowerCase())) {
+ tResource = this.mCapes[1];
+ }
}
- else if (aPlayer.getDisplayName().equalsIgnoreCase("cantankerousrex")) {
- tResource = this.mCapes[2];
+ for (String mName : mBlueCapes){
+ if (mName.toLowerCase().contains(aPlayer.getDisplayName().toLowerCase())) {
+ tResource = this.mCapes[2];
+ }
}
- else if (aPlayer.getDisplayName().equalsIgnoreCase("123_456_789")) {
- tResource = this.mCapes[1];
+ for (String mName : mDevCapes){
+ if (mName.toLowerCase().contains(aPlayer.getDisplayName().toLowerCase())) {
+ tResource = this.mCapes[3];
+ }
}
- else if (this.mCapeList.contains(aPlayer.getDisplayName().toLowerCase())) {
+
+ /*if (this.mCapeList.contains(aPlayer.getDisplayName().toLowerCase())) {
tResource = this.mCapes[0];
- }
+ }*/
if ((tResource != null) && (!aPlayer.getHideCape())) {
bindTexture(tResource);
GL11.glPushMatrix();
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java
index 9fcecf8e2f..69892ea995 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java
@@ -264,7 +264,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
if (damageValue <= 1){
if (this.mOptimalAirFlow > 0){
- damageValue = (this.mOptimalAirFlow/10);
+ damageValue = (this.mOptimalAirFlow/10/2);
}
else {
return false;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java
index 4e6647060e..8ca0a672b2 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java
@@ -15,6 +15,7 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity {
@@ -25,6 +26,7 @@ public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity {
private int mArrayPos = 0;
private int mTickTimer = 0;
private int mSecondTimer = 0;
+ private long mRedstoneLevel = 0;
public GregtechMetaPollutionDetector(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
@@ -36,10 +38,22 @@ public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity {
@Override
public String[] getDescription() {
- return new String[] {this.mDescription, "Right click to check pollution levels.", "Does not use power.", CORE.GT_Tooltip};
+ return new String[] {this.mDescription, "Right click to check pollution levels.",
+ "Configure with screwdriver to set redstone output amount.",
+ "Does not use power.", CORE.GT_Tooltip};
}
@Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return aSide == aFacing
+ ? new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional),
+ new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_Frequency) }
+ : new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional),
+ new GT_RenderedTexture(Textures.BlockIcons.VOID) };
+ }
+
+ @Override
public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
final ITexture[][][] rTextures = new ITexture[10][17][];
for (byte i = -1; i < 16; i++) {
@@ -57,10 +71,10 @@ public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity {
return rTextures;
}
- @Override
+ /*@Override
public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
- }
+ }*/
public ITexture[] getFront(final byte aColor) {
@@ -177,7 +191,7 @@ public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity {
}
else {
PlayerUtils.messagePlayer(playerIn, "This chunk contains "+getCurrentChunkPollution()+" pollution.");
- PlayerUtils.messagePlayer(playerIn, "Average over last ten minutes: "+getAveragePollutionOverLastTen()+" pollution.");
+ PlayerUtils.messagePlayer(playerIn, "Emit Redstone at pollution level: "+this.mRedstoneLevel);
}
}
@@ -205,7 +219,7 @@ public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity {
return new String[] {
this.getLocalName(),
"Current Pollution: "+this.mCurrentPollution,
- "Average/10 minutes:"+getAveragePollutionOverLastTen()};
+ "Emit Redstone at pollution level: "+this.mRedstoneLevel};
}
@Override
@@ -303,12 +317,14 @@ public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity {
public void saveNBTData(final NBTTagCompound aNBT) {
aNBT.setInteger("mCurrentPollution", this.mCurrentPollution);
aNBT.setInteger("mAveragePollution", this.mAveragePollution);
+ aNBT.setLong("mRedstoneLevel", this.mRedstoneLevel);
}
@Override
public void loadNBTData(final NBTTagCompound aNBT) {
this.mCurrentPollution = aNBT.getInteger("mCurrentPollution");
this.mAveragePollution = aNBT.getInteger("mAveragePollution");
+ this.mRedstoneLevel = aNBT.getLong("mRedstoneLevel");
}
@Override
@@ -324,11 +340,26 @@ public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity {
}
}
-
+ public boolean allowCoverOnSide(final byte aSide, final int aCoverID) {
+ return aSide != this.getBaseMetaTileEntity().getFrontFacing();
+ }
@Override
public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
super.onPostTick(aBaseMetaTileEntity, aTick);
+
+ if (this.getCurrentChunkPollution() >= this.mRedstoneLevel){
+ this.markDirty();
+ for (int i=0;i<6;i++){
+ this.getBaseMetaTileEntity().setStrongOutputRedstoneSignal((byte) i, (byte) 16);
+ }
+ }
+ else {
+ for (int i=0;i<6;i++){
+ this.getBaseMetaTileEntity().setStrongOutputRedstoneSignal((byte) i, (byte) 0);
+ }
+ }
+
if (this.getBaseMetaTileEntity().isServerSide()) {
//TickTimer - 20 times a second
if (this.mTickTimer >= 0 || this.mTickTimer <= 19){
@@ -378,4 +409,59 @@ public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity {
return returnValue;
}
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer,
+ float aX, float aY, float aZ) {
+
+ if (aSide == this.getBaseMetaTileEntity().getFrontFacing()) {
+ final float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ);
+ switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + (2 * (byte) (int) (tCoords[1] * 2.0F)))) {
+ case 0:
+ this.mRedstoneLevel -= 5000;
+ break;
+ case 1:
+ this.mRedstoneLevel += 5000;
+ break;
+ case 2:
+ this.mRedstoneLevel -= 50000;
+ break;
+ case 3:
+ this.mRedstoneLevel += 50000;
+ }
+ this.markDirty();
+ GT_Utility.sendChatToPlayer(aPlayer, "Emit Redstone at Pollution Level: " + this.mRedstoneLevel);
+ }
+
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ }
+
+ @Override
+ public boolean allowGeneralRedstoneOutput() {
+ if (this.getCurrentChunkPollution() >= this.mRedstoneLevel){
+ this.markDirty();
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity,
+ EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
+ return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ);
+ }
+
+ @Override
+ public void onMachineBlockUpdate() {
+ super.onMachineBlockUpdate();
+ }
+
+ @Override
+ public boolean hasSidedRedstoneOutputBehavior() {
+ if (this.getCurrentChunkPollution() >= this.mRedstoneLevel){
+ this.markDirty();
+ return true;
+ }
+ return false;
+ }
+
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java
new file mode 100644
index 0000000000..dc28b6b761
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java
@@ -0,0 +1,687 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.Recipe_GT;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_DeluxeMachine;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_CompactFusionReactor
+extends
+GT_MetaTileEntity_DeluxeMachine {
+
+ private boolean mCanProcessRecipe = false;
+ private boolean mCharging = false;
+ private long mChargeConsumed = 0;
+
+ private GT_Recipe mLastRecipe;
+ private long mEUStore;
+ private boolean mRunningOnLoad = false;
+ private boolean mMachine = false;
+ private int mEfficiency, mEfficiencyIncrease, mEfficiencyMax = 0;
+ private int mStartUpCheck = 100, mUpdate = 0;
+ private FluidStack[] mOutputFluids = null;
+
+ public GregtechMetaTileEntity_CompactFusionReactor(int aID, String aName,
+ String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1, "It's like a midget Ra.", 1,
+ 1, "PotionBrewer.png", "");
+ }
+
+ public GregtechMetaTileEntity_CompactFusionReactor(String aName, int aTier,
+ String aDescription, ITexture[][][] aTextures, String aGUIName,
+ String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName,
+ aNEIName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{this.mDescription,
+ "Not Very Fast, but not very big either.",
+ "Each side pair in/out puts to different slots.",
+ "Top & Bottom Sides are Outputs.",
+ "Front & Back are Input Plasma 1.", "Sides are Input Plasma 2.",
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_CompactFusionReactor(this.mName,
+ this.mTier, this.mDescription, this.mTextures, this.mGUIName,
+ this.mNEIName);
+ }
+
+ public int tier() {
+ return this.mTier;
+ }
+
+ public int tierOverclock() {
+ return this.mTier == 6 ? 0 : this.mTier == 7 ? 1 : 2;
+ }
+
+ private GT_RenderedTexture getCasingTexture() {
+ return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced);
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity,
+ final byte aSide, final byte aFacing, final byte aColorIndex,
+ final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing
+ ? 0
+ : aSide == GT_Utility.getOppositeSide(aFacing)
+ ? 1
+ : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex
+ + 1];
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeList() {
+ return Recipe_GT.Gregtech_Recipe_Map.sSlowFusionRecipes;
+ }
+
+ @Override
+ public boolean isOutputFacing(final byte aSide) {
+ return aSide == this.getBaseMetaTileEntity().getBackFacing();
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity,
+ int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack))
+ && (getRecipeList().containsInput(aStack));
+ }
+
+ @Override
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return (aFluid.getFluid().getName().contains("plasma"))
+ || (super.isFluidInputAllowed(aFluid));
+ }
+
+ @Override
+ public int getCapacity() {
+ return 32000;
+ }
+
+ @Override
+ public void abortProcess() {
+ super.abortProcess();
+ }
+
+ long mFusionPoint = 20000000L;
+ @Override
+ public int checkRecipe() {
+ Utils.LOG_WARNING("Recipe Tick 1.");
+ if (!this.mCanProcessRecipe) {
+ Utils.LOG_WARNING("Recipe Tick 1.1 - Cannot Process Recipe.");
+ if (this.mChargeConsumed < mFusionPoint) {
+ Utils.LOG_WARNING("Recipe Tick 1.2 - Cannot Ignite Fusion, Charge too low.");
+ this.mCharging = true;
+ this.mCanProcessRecipe = false;
+ if (this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(
+ (mFusionPoint / 100), false)) {
+ Utils.LOG_WARNING("Recipe Tick 1.3 - Charging Internal storage. "+(mFusionPoint / 100)+"/"+mFusionPoint);
+ mChargeConsumed += (mFusionPoint / 100);
+ }
+ } else {
+ mChargeConsumed = 0;
+ this.mCharging = false;
+ this.mCanProcessRecipe = true;
+
+ }
+ } else {
+ Utils.LOG_WARNING("Recipe Tick 1.1 - Try to Process Recipe.");
+ if (checkRecipeMulti()) {
+ Utils.LOG_WARNING("Recipe Tick 1.2 - Process Recipe was Successful.");
+ return 2;
+ }
+ }
+ Utils.LOG_WARNING("Recipe Tick 2. - Process Recipe failed.");
+ return 0;
+ }
+
+ public ArrayList<FluidStack> getStoredFluids() {
+ ArrayList<FluidStack> mList = new ArrayList<FluidStack>();
+ mList.add(this.mFluid);
+ mList.add(this.mFluid2);
+ return mList;
+ }
+
+ public boolean checkRecipeMulti() {
+ ArrayList<FluidStack> tFluidList = getStoredFluids();
+ int tFluidList_sS = tFluidList.size();
+ for (int i = 0; i < tFluidList_sS - 1; i++) {
+ for (int j = i + 1; j < tFluidList_sS; j++) {
+ if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i),
+ (FluidStack) tFluidList.get(j))) {
+ if (((FluidStack) tFluidList
+ .get(i)).amount >= ((FluidStack) tFluidList
+ .get(j)).amount) {
+ tFluidList.remove(j--);
+ tFluidList_sS = tFluidList.size();
+ } else {
+ tFluidList.remove(i--);
+ tFluidList_sS = tFluidList.size();
+ break;
+ }
+ }
+ }
+ }
+ if (tFluidList.size() > 1) {
+ FluidStack[] tFluids = tFluidList
+ .toArray(new FluidStack[tFluidList.size()]);
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sFusionRecipes
+ .findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe,
+ false, GT_Values.V[8], tFluids, new ItemStack[]{});
+ if ((tRecipe == null && !mRunningOnLoad)
+ || (maxEUStore() < tRecipe.mSpecialValue)) {
+ this.mLastRecipe = null;
+ return false;
+ }
+ if (mRunningOnLoad || tRecipe.isRecipeInputEqual(true, tFluids,
+ new ItemStack[]{})) {
+ this.mLastRecipe = tRecipe;
+ this.mEUt = (this.mLastRecipe.mEUt
+ * overclock(this.mLastRecipe.mSpecialValue));
+ this.mMaxProgresstime = this.mLastRecipe.mDuration
+ / overclock(this.mLastRecipe.mSpecialValue);
+
+ this.mEfficiencyIncrease = 10000;
+
+ this.mOutputFluids = this.mLastRecipe.mFluidOutputs;
+ mRunningOnLoad = false;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public int overclock(int mStartEnergy) {
+ if (tierOverclock() == 1) {
+ return 1;
+ }
+ if (tierOverclock() == 2) {
+ return mStartEnergy < 160000000 ? 2 : 1;
+ }
+ return mStartEnergy < 160000000 ? 4 : mStartEnergy < 320000000 ? 2 : 1;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return false;
+ }
+
+ @Override
+ public boolean doesAutoOutputFluids() {
+ return true;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return true;
+ }
+
+ @Override
+ public boolean doesFillContainers() {
+ return true;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 16L;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return Long.MAX_VALUE;
+ }
+
+ @Override
+ public void doExplosion(long aExplosionPower) {
+ super.doExplosion(aExplosionPower * 2);
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ onRunningTickMulti();
+ if ((aBaseMetaTileEntity.isClientSide())
+ && (aBaseMetaTileEntity.isActive())
+ && (aBaseMetaTileEntity.getFrontFacing() != 1)
+ && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0)
+ && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) {
+ if (MathUtils.randInt(0, 4) == 4) {
+ final Random tRandom = aBaseMetaTileEntity.getWorld().rand;
+ aBaseMetaTileEntity.getWorld().spawnParticle("magicCrit",
+ (aBaseMetaTileEntity.getXCoord() + 0.8F)
+ - (tRandom.nextFloat() * 0.6F),
+ aBaseMetaTileEntity.getYCoord() + 0.3f
+ + (tRandom.nextFloat() * 0.2F),
+ (aBaseMetaTileEntity.getZCoord() + 1.2F)
+ - (tRandom.nextFloat() * 1.6F),
+ 0.0D, 0.0D, 0.0D);
+ aBaseMetaTileEntity.getWorld().spawnParticle("magicCrit",
+ (aBaseMetaTileEntity.getXCoord() + 0.4F)
+ - (tRandom.nextFloat() * 0.3F),
+ aBaseMetaTileEntity.getYCoord() + 0.2f
+ + (tRandom.nextFloat() * 0.1F),
+ (aBaseMetaTileEntity.getZCoord() + 0.8F)
+ - (tRandom.nextFloat() * 0.6F),
+ 0.0D, 0.0D, 0.0D);
+ aBaseMetaTileEntity.getWorld().spawnParticle("magicCrit",
+ (aBaseMetaTileEntity.getXCoord() + 0.6F)
+ - (tRandom.nextFloat() * 0.9F),
+ aBaseMetaTileEntity.getYCoord() + 0.4f
+ + (tRandom.nextFloat() * 0.3F),
+ (aBaseMetaTileEntity.getZCoord() + 1.8F)
+ - (tRandom.nextFloat() * 2.6F),
+ 0.0D, 0.0D, 0.0D);
+ }
+ }
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setBoolean("mCanProcessRecipe", this.mCanProcessRecipe);
+ aNBT.setBoolean("mCharging", this.mCharging);
+ aNBT.setLong("mChargeConsumed", this.mChargeConsumed);
+ aNBT.setInteger("mEfficiency", this.mEfficiency);
+ aNBT.setInteger("mEfficiencyIncrease", this.mEfficiencyIncrease);
+ aNBT.setInteger("mEfficiencyMax", this.mEfficiencyMax);
+ aNBT.setInteger("mStartUpCheck", this.mStartUpCheck);
+ aNBT.setInteger("mUpdate", mUpdate);
+ aNBT.setInteger("mEfficiencyIncrease", mEfficiencyIncrease);
+ aNBT.setBoolean("mRunningOnLoad", this.mRunningOnLoad);
+ aNBT.setBoolean("mMachine", this.mMachine);
+ aNBT.setLong("mEUStore", this.mEUStore);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ if (mMaxProgresstime > 0)
+ mRunningOnLoad = true;
+ this.mCanProcessRecipe = aNBT.getBoolean("mCanProcessRecipe");
+ this.mCharging = aNBT.getBoolean("mCharging");
+ this.mChargeConsumed = aNBT.getLong("mChargeConsumed");
+ this.mEfficiency = aNBT.getInteger("mEfficiency");
+ this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
+ this.mEfficiencyMax = aNBT.getInteger("mEfficiencyMax");
+ this.mStartUpCheck = aNBT.getInteger("mStartUpCheck");
+ this.mUpdate = aNBT.getInteger("mUpdate");
+ this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
+ this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
+ this.mRunningOnLoad = aNBT.getBoolean("mRunningOnLoad");
+ this.mMachine = aNBT.getBoolean("mMachine");
+ this.mEUStore = aNBT.getLong("mEUStore");
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public String[] getInfoData() {
+ String tier = tier() == 6 ? "I" : tier() == 7 ? "II" : "III";
+ float plasmaOut = 0;
+ String fusionName = "";
+ int powerRequired = 0;
+ if (this.mLastRecipe != null) {
+ fusionName = this.mLastRecipe.mFluidOutputs[0].getLocalizedName()+" Fusion.";
+ powerRequired = this.mLastRecipe.mEUt;
+ if (this.mLastRecipe.getFluidOutput(0) != null) {
+ plasmaOut = (float) this.mLastRecipe.getFluidOutput(0).amount
+ / (float) this.mLastRecipe.mDuration;
+ }
+ }
+
+ return new String[]{"Fusion Reactor MK " + tier,
+ "EU Required: " + powerRequired + "EU/t",
+ "Stored EU: " + this.getEUVar() + " / " + maxEUStore(),
+ "Plasma Output: " + plasmaOut + "L/t",
+ "Current Recipe: "+fusionName};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{this.getCasingTexture(), new GT_RenderedTexture(
+ TexturesGtBlock.Overlay_MatterFab)};
+ }
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{this.getCasingTexture(),new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{ new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS) };
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{ new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS) };
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{this.getCasingTexture(), new GT_RenderedTexture(
+ TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{this.getCasingTexture(), new GT_RenderedTexture(
+ TexturesGtBlock.Overlay_MatterFab_Active)};
+ }
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[]{
+ this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
+ }
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{ new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW) };
+ }
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{ new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW) };
+ }
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{this.getCasingTexture(), new GT_RenderedTexture(
+ TexturesGtBlock.Overlay_Machine_Dimensional_Blue)};
+ }
+
+ @Override
+ public void onMachineBlockUpdate() {
+ this.mUpdate = 50;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity,
+ long aTick) {
+ //super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (aBaseMetaTileEntity.isServerSide()) {
+ Utils.LOG_WARNING("1");
+ if (mEfficiency < 0)
+ mEfficiency = 0;
+ if (mRunningOnLoad) {
+ Utils.LOG_WARNING("2");
+ this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
+ checkRecipeMulti();
+ }
+ if (--mUpdate == 0 || --mStartUpCheck == 0) {
+ Utils.LOG_WARNING("3");
+ mMachine = true;
+ }
+ if (mStartUpCheck < 0) {
+ Utils.LOG_WARNING("4");
+ if (mMachine) {
+ Utils.LOG_WARNING("5");
+
+ if (aBaseMetaTileEntity.getStoredEU()
+ + (2048 * tierOverclock()) < maxEUStore()) {
+ aBaseMetaTileEntity.increaseStoredEnergyUnits(
+ 2048 * tierOverclock(), true);
+ }
+ if (this.mEUStore <= 0 && mMaxProgresstime > 0) {
+ Utils.LOG_WARNING("6");
+ stopMachine();
+ this.mLastRecipe = null;
+ }
+ if (mMaxProgresstime > 0) {
+ Utils.LOG_WARNING("7");
+ this.getBaseMetaTileEntity()
+ .decreaseStoredEnergyUnits(mEUt, true);
+ if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) {
+ if (mOutputFluids != null)
+ for (FluidStack tStack : mOutputFluids)
+ if (tStack != null)
+ addOutput(tStack);
+ mEfficiency = Math.max(0,
+ (mEfficiency + mEfficiencyIncrease));
+ mProgresstime = 0;
+ mMaxProgresstime = 0;
+ mEfficiencyIncrease = 0;
+ if (mOutputFluids != null && mOutputFluids.length > 0) {
+
+ }
+ this.mEUStore = (int) aBaseMetaTileEntity
+ .getStoredEU();
+ if (aBaseMetaTileEntity.isAllowedToWork())
+ checkRecipeMulti();
+ }
+ } else {
+ Utils.LOG_WARNING("8");
+ if (aTick % 100 == 0
+ || aBaseMetaTileEntity.hasWorkJustBeenEnabled()
+ || aBaseMetaTileEntity
+ .hasInventoryBeenModified()) {
+ Utils.LOG_WARNING("9");
+ // turnCasingActive(mMaxProgresstime > 0);
+ if (aBaseMetaTileEntity.isAllowedToWork()) {
+ Utils.LOG_WARNING("10");
+ this.mEUStore = (int) aBaseMetaTileEntity
+ .getStoredEU();
+ if (checkRecipeMulti()) {
+ Utils.LOG_WARNING("11");
+ if (this.mEUStore < this.mLastRecipe.mSpecialValue) {
+ Utils.LOG_WARNING("12");
+ mMaxProgresstime = 0;
+ // turnCasingActive(false);
+ }
+ aBaseMetaTileEntity
+ .decreaseStoredEnergyUnits(
+ this.mLastRecipe.mSpecialValue,
+ true);
+ }
+ }
+ if (mMaxProgresstime <= 0)
+ mEfficiency = Math.max(0, mEfficiency - 1000);
+ }
+ }
+ } else {
+ // turnCasingActive(false);
+ Utils.LOG_WARNING("Bad");
+ this.mLastRecipe = null;
+ stopMachine();
+ }
+ }
+ Utils.LOG_WARNING("Good");
+ aBaseMetaTileEntity.setActive(mMaxProgresstime > 0);
+ }
+ }
+
+ public boolean onRunningTickMulti() {
+ if (mEUt < 0) {
+ if (!drainEnergyInput(
+ ((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) {
+ this.mLastRecipe = null;
+ stopMachine();
+ return false;
+ }
+ }
+ if (this.mEUStore <= 0) {
+ this.mLastRecipe = null;
+ stopMachine();
+ return false;
+ }
+ return true;
+ }
+
+ public boolean drainEnergyInput(long aEU) {
+ return false;
+ }
+
+ public boolean addOutput(FluidStack aLiquid) {
+ if (aLiquid == null)
+ return false;
+ FluidStack copiedFluidStack = aLiquid.copy();
+ this.mOutputFluid = copiedFluidStack;
+ return false;
+ }
+
+ public void stopMachine() {
+ mEUt = 0;
+ mEfficiency = 0;
+ mProgresstime = 0;
+ mMaxProgresstime = 0;
+ mEfficiencyIncrease = 0;
+ getBaseMetaTileEntity().disableWorking();
+ }
+
+ @Override
+ public boolean isLiquidInput(byte aSide) {
+ switch(aSide) {
+ case 0 :
+ return true;
+ case 1 :
+ return true;
+ case 2 :
+ return true;
+ case 3 :
+ return false;
+ case 4 :
+ return false;
+ case 5 :
+ return false;
+ default :
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isLiquidOutput(byte aSide) {
+ switch(aSide) {
+ case 0 :
+ return false;
+ case 1 :
+ return false;
+ case 2 :
+ return false;
+ case 3 :
+ return true;
+ case 4 :
+ return true;
+ case 5 :
+ return true;
+ default :
+ return true;
+ }
+ }
+
+ @Override
+ public int fill(FluidStack aFluid, boolean doFill) {
+ // TODO Auto-generated method stub
+ return super.fill(aFluid, doFill);
+ }
+
+ @Override
+ public FluidStack drain(int maxDrain, boolean doDrain) {
+ // TODO Auto-generated method stub
+ return super.drain(maxDrain, doDrain);
+ }
+
+ @Override
+ public int getTankPressure() {
+ // TODO Auto-generated method stub
+ return 500;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection aSide, Fluid aFluid) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN){
+ return false;
+ }
+ else {
+ return super.canFill(aSide, aFluid);
+ }
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection aSide, Fluid aFluid) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN){
+ return super.canDrain(aSide, aFluid);
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public int fill_default(ForgeDirection aSide, FluidStack aFluid,
+ boolean doFill) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN){
+ return 0;
+ }
+ else {
+ return super.fill_default(aSide, aFluid, doFill);
+ }
+ }
+
+ @Override
+ public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN){
+ return super.fill(aSide, aFluid, doFill);
+ }
+ else {
+ return 0;
+ }
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection aSide, FluidStack aFluid,
+ boolean doDrain) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN){
+ return super.drain(aSide, aFluid, doDrain);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection aSide, int maxDrain,
+ boolean doDrain) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN){
+ return super.drain(aSide, maxDrain, doDrain);
+ }
+ else {
+ return null;
+ }
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
new file mode 100644
index 0000000000..7f2accdd00
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
@@ -0,0 +1,521 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.array.BlockPos;
+import gtPlusPlus.core.util.entity.EntityUtils;
+import gtPlusPlus.core.util.player.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
+
+ private boolean mHasBeenMapped = false;
+
+ public GregtechMetaWirelessCharger(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
+ }
+
+ public GregtechMetaWirelessCharger(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) {
+ super(aName, aTier, aSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {this.mDescription,
+ "3 Modes, Long-Range, Local and Mixed.",
+ "Long-Range: Can supply 2A of power to a single player upto "+(GT_Values.V[this.mTier]*4)+"m away.",
+ "Local: Can supply several Amps to each player within "+this.mTier*20+"m.",
+ "Mixed: Provides both 2A of long range and 1A per player locally.",
+ "Mixed mode is more conservative of power and as a result only",
+ "Gets half the distances each singular mode gets.",
+ "Long-Range mode currently disabled.",
+ "Free Double Distance boost to local mode.",
+ CORE.GT_Tooltip};
+ }
+
+ public int getTier(){
+ return this.mTier;
+ }
+
+ public int getMode(){
+ return this.mMode;
+ }
+
+ public Map<UUID, EntityPlayer> getLocalMap(){
+ return this.mLocalChargingMap;
+ }
+
+ public Map<EntityPlayer, UUID> getLongRangeMap(){
+ return this.mWirelessChargingMap;
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
+ }
+
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_2)};
+ }
+
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_2)};
+ }
+
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ mWirelessChargingMap.clear();
+ mLocalChargingMap.clear();
+
+ if (!this.getBaseMetaTileEntity().getWorld().playerEntities.isEmpty()){
+ for (Object mTempPlayer : this.getBaseMetaTileEntity().getWorld().playerEntities){
+ if (mTempPlayer instanceof EntityPlayer || mTempPlayer instanceof EntityPlayerMP){
+ EntityPlayer mTemp = (EntityPlayer) mTempPlayer;
+ ChargingHelper.removeValidPlayer(mTemp, this);
+ }
+ }
+ }
+
+ if (this.mMode >= 2){
+ this.mMode = 0;
+ }
+ else {
+ this.mMode++;
+ }
+ if (this.mMode == 0){
+ PlayerUtils.messagePlayer(aPlayer, "Now in Long-Range Mode. [Disabled]");
+ }
+ else if (this.mMode == 1){
+ PlayerUtils.messagePlayer(aPlayer, "Now in Local Charge Mode.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Now in Mixed Mode.");
+ }
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaWirelessCharger(this.mName, this.mTier, this.mDescription, this.mTextures, this.mInventory.length);
+ }
+
+ @Override public boolean isSimpleMachine() {return false;}
+ @Override public boolean isElectric() {return true;}
+ @Override public boolean isValidSlot(final int aIndex) {return true;}
+ @Override public boolean isFacingValid(final byte aFacing) {return true;}
+ @Override public boolean isEnetInput() {return true;}
+ @Override public boolean isEnetOutput() {return false;}
+ @Override public boolean isInputFacing(final byte aSide) {return aSide!=this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isOutputFacing(final byte aSide) {return aSide==this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isTeleporterCompatible() {return false;}
+ @Override public long getMinimumStoredEU() {return 0;}
+ @Override public long maxEUStore() {return GT_Values.V[this.mTier]*128;}
+
+ @Override
+ public int getCapacity() {
+ return (int) (GT_Values.V[this.mTier]*32);
+ }
+
+ @Override
+ public long maxEUInput() {
+ return GT_Values.V[this.mTier];
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return 0;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ if (this.mMode == 0){
+ return 2;
+ }
+ else if (this.mMode == 1){
+ return this.mLocalChargingMap.size()*8;
+ }
+ else {
+ return ((this.mLocalChargingMap.size()*4)+this.mWirelessChargingMap.size());
+ }
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return 0;
+ }
+ @Override public int rechargerSlotStartIndex() {return 0;}
+ @Override public int dechargerSlotStartIndex() {return 0;}
+ @Override public int rechargerSlotCount() {return 0;}
+ @Override public int dechargerSlotCount() {return 0;}
+ @Override public int getProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyStored();}
+ @Override public int maxProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyCapacity();}
+ @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide())
+ {
+ return true;
+ }
+ return true;
+ }
+
+ public int mMode = 0;
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ return new String[] {
+ this.getLocalName()};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(final int p_94128_1_) {
+ return null;
+ }
+
+ @Override
+ public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) {
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) {
+ return false;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 0;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int p_70301_1_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int p_70304_1_) {
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) {
+ }
+
+ @Override
+ public String getInventoryName() {
+ return null;
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 0;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) {
+ return false;
+ }
+
+ @Override
+ public void openInventory() {
+ }
+
+ @Override
+ public void closeInventory() {
+ }
+
+ @Override
+ public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) {
+ return false;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setInteger("mMode", this.mMode);
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ this.mMode = aNBT.getInteger("mMode");
+ }
+
+ @Override
+ public void onFirstTick(final IGregTechTileEntity aBaseMetaTileEntity) {
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+
+ }
+ }
+
+
+ private Map<EntityPlayer, UUID> mWirelessChargingMap = new HashMap<EntityPlayer, UUID>();
+ private Map<UUID, EntityPlayer> mLocalChargingMap = new HashMap<UUID, EntityPlayer>();
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+
+ if (!mHasBeenMapped && ChargingHelper.addEntry(getTileEntityPosition(), this)){
+ mHasBeenMapped = true;
+ }
+
+ if (aTick % 20 == 0 && mHasBeenMapped){
+ if (!aBaseMetaTileEntity.getWorld().playerEntities.isEmpty()){
+ for (Object mTempPlayer : aBaseMetaTileEntity.getWorld().playerEntities){
+ if (mTempPlayer instanceof EntityPlayer || mTempPlayer instanceof EntityPlayerMP){
+ EntityPlayer mTemp = (EntityPlayer) mTempPlayer;
+
+ if (this.mMode == 1 || this.mMode == 2){
+ int tempRange = (this.mMode == 1 ? this.mTier*20 : this.mTier*10);
+ if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) < tempRange){
+ if (!mLocalChargingMap.containsKey(mTemp.getPersistentID())){
+ mLocalChargingMap.put(mTemp.getPersistentID(), mTemp);
+ ChargingHelper.addValidPlayer(mTemp, this);
+ PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m].");
+ }
+ }
+ else {
+ if (mLocalChargingMap.containsKey(mTemp.getPersistentID())){
+ if (mLocalChargingMap.remove(mTemp.getPersistentID()) != null){
+ PlayerUtils.messagePlayer(mTemp, "You have left charging range. ["+tempRange+"m].");
+ ChargingHelper.removeValidPlayer(mTemp, this);
+ }
+ }
+ }
+ }
+ /*if (this.mMode == 0 || this.mMode == 2){
+ int tempRange = (int) (this.mMode == 0 ? 4*GT_Values.V[this.mTier] : 2*GT_Values.V[this.mTier]);
+ if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) < tempRange){
+ if (!mWirelessChargingMap.containsKey(mTemp)){
+ mWirelessChargingMap.put(mTemp, mTemp.getPersistentID());
+ PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m].");
+ ChargingHelper.addValidPlayer(mTemp, this);
+ }
+ }
+ else {
+ if (mWirelessChargingMap.containsKey(mTemp)){
+ if (mWirelessChargingMap.remove(mTemp) != null){
+ PlayerUtils.messagePlayer(mTemp, "You have left charging range. ["+tempRange+"m].");
+ ChargingHelper.removeValidPlayer(mTemp, this);
+ }
+ }
+ }
+ } */
+
+ }
+ }
+ }
+ }
+
+
+ }
+ }
+
+ public BlockPos getTileEntityPosition(){
+ return new BlockPos(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord());
+ }
+
+ public BlockPos getPositionOfEntity(Entity mEntity){
+ if (mEntity == null){
+ return null;
+ }
+ return EntityUtils.findBlockPosUnderEntity(mEntity);
+ }
+
+ public double getDistanceBetweenTwoPositions(BlockPos objectA, BlockPos objectB){
+ int[] objectArray1 = new int[]{objectA.xPos, objectA.yPos, objectA.zPos};
+ int[] objectArray2 = new int[]{objectB.xPos, objectB.yPos, objectB.zPos};
+ if (objectA == null || objectB == null){
+ return 0f;
+ }
+ final double distance = Math.sqrt(
+ (objectArray2[0]-objectArray1[0])*(objectArray2[0]-objectArray1[0])
+ +(objectArray2[1]-objectArray1[1])*(objectArray2[1]-objectArray1[1])
+ +(objectArray2[2]-objectArray1[2])*(objectArray2[2]-objectArray1[2]));
+ return distance;
+ }
+
+ @Override
+ public void onRemoval() {
+
+ ChargingHelper.removeEntry(getTileEntityPosition(), this);
+
+ mWirelessChargingMap.clear();
+ mLocalChargingMap.clear();
+ if (!this.getBaseMetaTileEntity().getWorld().playerEntities.isEmpty()){
+ for (Object mTempPlayer : this.getBaseMetaTileEntity().getWorld().playerEntities){
+ if (mTempPlayer instanceof EntityPlayer || mTempPlayer instanceof EntityPlayerMP){
+ EntityPlayer mTemp = (EntityPlayer) mTempPlayer;
+ ChargingHelper.removeValidPlayer(mTemp, this);
+ }
+ }
+ }
+
+
+ super.onRemoval();
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity,
+ EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
+
+ int tempRange;
+
+ if (this.mMode == 0 || this.mMode == 2){
+ tempRange = (int) (this.mMode == 0 ? 4*GT_Values.V[this.mTier] : 2*GT_Values.V[this.mTier]);
+ }
+ else {
+ tempRange = this.mMode == 1 ? this.mTier*20 : this.mTier*10;
+ }
+
+ if (this.mMode == 2){
+ PlayerUtils.messagePlayer(aPlayer, "Mixed Mode | Local: "+this.mTier*10+"m | Long: "+tempRange+"m [Disabled]");
+ }
+ else if (this.mMode == 1){
+ PlayerUtils.messagePlayer(aPlayer, "Local Mode: "+this.mTier*20+"m");
+
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Long-range Mode: "+tempRange+"m [Disabled]");
+
+ }
+
+ return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ);
+ }
+
+ @Override
+ public void onServerStart() {
+ mWirelessChargingMap.clear();
+ mLocalChargingMap.clear();
+ if (!mHasBeenMapped && ChargingHelper.addEntry(getTileEntityPosition(), this)){
+ mHasBeenMapped = true;
+ }
+ super.onServerStart();
+ }
+
+ @Override
+ public void onExplosion() {
+ ChargingHelper.removeEntry(getTileEntityPosition(), this);
+ super.onExplosion();
+ }
+
+ @Override
+ public void doExplosion(long aExplosionPower) {
+ ChargingHelper.removeEntry(getTileEntityPosition(), this);
+ super.doExplosion(aExplosionPower);
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java
index 4a299b4599..3dee1df0f0 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java
@@ -150,7 +150,6 @@ extends GT_MetaTileEntity_MultiBlockBase
"1x Maintenance Hatch",
"1x Energy Hatch",
"--------------------------------------",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip
};
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java
index e1a8e2fba8..f7940e3d68 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java
@@ -182,7 +182,6 @@ extends GT_MetaTileEntity_MultiBlockBase
"Place them in the middle block of the Back, Bottom and Sides",
"Use 2 Output Hatches by default, change one to a Bus if filtering Lava",
"Consult user manual for more information",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java
new file mode 100644
index 0000000000..3923f65f29
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java
@@ -0,0 +1,236 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.fluid.FluidUtils;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+public class GregtechMetaTileEntityGeneratorArray extends GT_MetaTileEntity_MultiBlockBase {
+
+ GT_Recipe mLastRecipe;
+
+ public GregtechMetaTileEntityGeneratorArray(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntityGeneratorArray(String aName) {
+ super(aName);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntityGeneratorArray(this.mName);
+ }
+
+ public String[] getDescription() {
+ return new String[]{
+ "Controller Block for the Generator Array",
+ "Runs supplied generators as if placed in the world",
+ "Size(WxHxD): 3x3x3 (Hollow), Controller (Front centered)",
+ "1x Input Hatch/Bus (Any casing)",
+ "1x Output Hatch/Bus (Any casing)",
+ "1x Maintenance Hatch (Any casing)",
+ "1x Energy Hatch (Any casing)",
+ "Robust Tungstensteel Machine Casings for the rest (16 at least!)",
+ "Place up to 16 Single Block GT Generators into the Controller Inventory"};
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[48], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY)};
+ }
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[48]};
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ProcessingArray.png");
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ if (mInventory[1] == null) return null;
+ String tmp = mInventory[1].getUnlocalizedName().replaceAll("gt\\.blockmachines\\.basicgenerator\\.", "");
+ if (tmp.startsWith("steamturbine")) {
+ return Gregtech_Recipe_Map.sSteamTurbineFuels;
+ }
+ else if (tmp.startsWith("diesel")) {
+ return GT_Recipe.GT_Recipe_Map.sDieselFuels;
+ }
+ else if (tmp.startsWith("gasturbine")) {
+ return GT_Recipe.GT_Recipe_Map.sTurbineFuels;
+ }
+ else if (tmp.startsWith("semifluid")) {
+ return GT_Recipe.GT_Recipe_Map.sDenseLiquidFuels;
+ }
+ else if (tmp.startsWith("rtg")) {
+ return Gregtech_Recipe_Map.sRTGFuels;
+ }
+
+
+ tmp = mInventory[1].getUnlocalizedName().replaceAll("gt\\.blockmachines\\.advancedgenerator\\.", "");
+ if (tmp.startsWith("rocket")) {
+ return GT_Recipe.GT_Recipe_Map.sDieselFuels;
+ }
+ else if (tmp.startsWith("geothermalFuel")) {
+ return Gregtech_Recipe_Map.sGeoThermalFuels;
+ }
+
+ return null;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ if (aStack != null && aStack.getUnlocalizedName().startsWith("gt.blockmachines.")) {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing > 1;
+ }
+
+ public String mMachine = "";
+ public boolean checkRecipe(ItemStack aStack) {
+ if (!isCorrectMachinePart(mInventory[1])) {
+ return false;
+ }
+ GT_Recipe.GT_Recipe_Map map = getRecipeMap();
+ if (map == null) return false;
+ ArrayList<ItemStack> tInputList = getStoredInputs();
+ int tTier = 0;
+ if (mInventory[1].getUnlocalizedName().endsWith("1")) {
+ tTier = 1;
+ }else if (mInventory[1].getUnlocalizedName().endsWith("2")) {
+ tTier = 2;
+ }else if (mInventory[1].getUnlocalizedName().endsWith("3")) {
+ tTier = 3;
+ }else if (mInventory[1].getUnlocalizedName().endsWith("4")) {
+ tTier = 4;
+ }else if (mInventory[1].getUnlocalizedName().endsWith("5")) {
+ tTier = 5;
+ }else if (mInventory[1].getUnlocalizedName().endsWith("6")) {
+ tTier = 6;
+ }else if (mInventory[1].getUnlocalizedName().endsWith("7")) {
+ tTier = 7;
+ }else if (mInventory[1].getUnlocalizedName().endsWith("8")) {
+ tTier = 8;
+ }
+
+ int fuelConsumption = 0;
+ int fuelValue = 0;
+ int fuelRemaining = 0;
+ boolean boostEu = false;
+
+ if(!mMachine.equals(mInventory[1].getUnlocalizedName()))mLastRecipe=null;
+ mMachine = mInventory[1].getUnlocalizedName();
+ Utils.LOG_WARNING("mMachine: "+mMachine);
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+ Collection<GT_Recipe> tRecipeList = this.getRecipeMap().mRecipeList;
+ Utils.LOG_WARNING("tRecipeList: "+tRecipeList);
+
+ if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a diesel fuel?
+ Utils.LOG_WARNING("1");
+ for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches
+ Utils.LOG_WARNING("2");
+ for(GT_Recipe aFuel : tRecipeList) { //Loops through diesel fuel recipes
+ Utils.LOG_WARNING("3");
+ /*if (aFuel != null){
+ for (FluidStack x : aFuel.mFluidInputs){
+ if (x != null){
+ Utils.LOG_WARNING("Recipe: "+x.getLocalizedName());
+ }
+ }
+ }*/
+ FluidStack tLiquid;
+ tLiquid = FluidUtils.getFluidStack(aFuel.mFluidInputs[0], aFuel.mFluidInputs[0].amount);
+ Utils.LOG_WARNING("5");
+ fuelConsumption = aFuel.mFluidInputs[0].amount;
+ if(depleteInput(tLiquid)) { //Deplete that amount
+ Utils.LOG_WARNING("6");
+ boostEu = true;
+ Utils.LOG_WARNING("7");
+
+ fuelValue = aFuel.mEUt*aFuel.mDuration;
+ fuelRemaining = hatchFluid1.amount; //Record available fuel
+ this.mEUt = mEfficiency < 2000 ? 0 : 2048; //Output 0 if startup is less than 20%
+ //this.mProgresstime = 1;
+ this.mMaxProgresstime = 20;
+ this.mEfficiencyIncrease = 9500;
+ Utils.LOG_WARNING("9");
+ return true;
+ }
+ }
+ // }
+ //}
+ }
+ }
+ this.mEUt = 0;
+ this.mEfficiency = 0;
+ return false;
+ }
+
+ public static ItemStack[] clean(final ItemStack[] v) {
+ List<ItemStack> list = new ArrayList<ItemStack>(Arrays.asList(v));
+ list.removeAll(Collections.singleton(null));
+ return list.toArray(new ItemStack[list.size()]);
+ }
+
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) {
+ return false;
+ }
+ int tAmount = 0;
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ for (int h = -1; h < 2; h++) {
+ if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) {
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
+ if ((!addMaintenanceToMachineList(tTileEntity, 48)) && (!addInputToMachineList(tTileEntity, 48)) && (!addOutputToMachineList(tTileEntity, 48)) && (!addDynamoToMachineList(tTileEntity, 48))) {
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings4) {
+ return false;
+ }
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 0) {
+ return false;
+ }
+ tAmount++;
+ }
+ }
+ }
+ }
+ }
+ return tAmount >= 16;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java
index 2ea2d429e2..dd2837b021 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java
@@ -85,7 +85,6 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock
"Dark Purple: Dirt/Grass/Podzol/Humus",
"Light Blue: Fence/Fence Gate",
"Blue/Yellow: Controller",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip
};
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java
index 155bb71aaa..bdb514ba84 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java
@@ -10,7 +10,6 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
@@ -18,13 +17,14 @@ import gregtech.api.util.Recipe_GT;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
public class GregtechMetaTileEntity_AlloyBlastSmelter
-extends GT_MetaTileEntity_MultiBlockBase {
+extends GregtechMeta_MultiBlockBase {
private int mHeatingCapacity = 0;
public GregtechMetaTileEntity_AlloyBlastSmelter(final int aID, final String aName, final String aNameRegional) {
@@ -55,8 +55,8 @@ extends GT_MetaTileEntity_MultiBlockBase {
"1x Energy Hatch (one of bottom)",
"1x Maintenance Hatch (one of bottom)",
"1x Muffler Hatch (top middle)",
+ "1x Fluid Input Hatch (optional, top layer)",
"Blast Smelter Casings for the rest",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -82,17 +82,19 @@ extends GT_MetaTileEntity_MultiBlockBase {
public boolean isCorrectMachinePart(final ItemStack aStack) {
return true;
}
-
- public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
- super.startSoundLoop(aIndex, aX, aY, aZ);
- if (aIndex == 1) {
- GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(208)), 10, 1.0F, aX, aY, aZ);
- }
- }
- public void startProcess() {
- sendLoopStart((byte) 1);
- }
+ @Override
+ public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) {
+ super.startSoundLoop(aIndex, aX, aY, aZ);
+ if (aIndex == 1) {
+ GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(Integer.valueOf(208)), 10, 1.0F, aX, aY, aZ);
+ }
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
@Override
public boolean isFacingValid(final byte aFacing) {
@@ -193,11 +195,13 @@ extends GT_MetaTileEntity_MultiBlockBase {
if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != 14) {
return false;
}
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != ModBlocks.blockCasingsMisc) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) != 15) {
- return false;
+ if (!this.addFluidInputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j), 11)) {
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != ModBlocks.blockCasingsMisc) {
+ return false;
+ }
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) != 15) {
+ return false;
+ }
}
}
}
@@ -219,11 +223,11 @@ extends GT_MetaTileEntity_MultiBlockBase {
}
this.mHeatingCapacity += 100 * (GT_Utility.getTier(this.getMaxInputVoltage()) - 2);
- if ( this.mMaintenanceHatches.size() != 1 ||
- this.mMufflerHatches.size() != 1 ||
- this.mInputBusses.size() < 1 ||
- this.mOutputHatches.size() < 1 ||
- this.mEnergyHatches.size() != 1 ) {
+ if ( (this.mMaintenanceHatches.size() != 1) ||
+ (this.mMufflerHatches.size() != 1) ||
+ (this.mInputBusses.size() < 1) ||
+ (this.mOutputHatches.size() < 1) ||
+ (this.mEnergyHatches.size() != 1) ) {
return false;
}
@@ -245,6 +249,7 @@ extends GT_MetaTileEntity_MultiBlockBase {
return 0;
}
+ @Override
public int getAmountOfOutputs() {
return 2;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java
index ac288eb3ab..7a35f63605 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java
@@ -57,7 +57,7 @@ extends GregtechMeta_MultiBlockBase {
public String[] getDescription() {
return new String[]{
"Controller Block for the Industrial Centrifuge",
- "50% faster than using single block machines of the same voltage",
+ "40% faster than using single block machines of the same voltage",
"Size: 3x3x3 (Hollow)",
"Controller (Front Center) [Orange]",
"1x Maintenance Hatch (Rear Center) [Green]",
@@ -68,7 +68,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Output Bus",
"1x [EV] Energy Hatch (Can be higher Tier) [Blue]",
"Centrifuge Casings for the rest (16 at least)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -76,12 +75,7 @@ extends GregtechMeta_MultiBlockBase {
@Override
public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
- try {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[TAE.GTPP_INDEX(0)][aColorIndex + 1], aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(0)]};
- }
- catch (Throwable t){
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[0][aColorIndex + 1], aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.CASING_BLOCKS[0]};
- }
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(0)]};
}
@@ -105,90 +99,123 @@ extends GregtechMeta_MultiBlockBase {
@Override
public boolean checkRecipe(final ItemStack aStack) {
- ArrayList<ItemStack> tInputList = getStoredInputs();
- int tInputList_sS = tInputList.size();
- for (int i = 0; i < tInputList_sS - 1; ++i) {
- for (int j = i + 1; j < tInputList_sS; ++j) {
- if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) {
- if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) {
- tInputList.remove(j--);
- tInputList_sS = tInputList.size();
- } else {
- tInputList.remove(i--);
- tInputList_sS = tInputList.size();
- break;
- }
- }
- }
+ /*if (!isCorrectMachinePart(mInventory[1])) {
+ return false;
+ }*/
+
+ Utils.LOG_WARNING("Centrifuge Debug - 1");
+ final GT_Recipe.GT_Recipe_Map map = this.getRecipeMap();
+ if (map == null) {
+ Utils.LOG_WARNING("Centrifuge Debug - False - No recipe map");
+ return false;
}
- ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]);
-
- ArrayList<FluidStack> tFluidList = getStoredFluids();
- int tFluidList_sS = tFluidList.size();
- for (int i = 0; i < tFluidList_sS - 1; ++i) {
- for (int j = i + 1; j < tFluidList_sS; ++j) {
- if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) {
- if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) {
- tFluidList.remove(j--);
- tFluidList_sS = tFluidList.size();
- } else {
- tFluidList.remove(i--);
- tFluidList_sS = tFluidList.size();
- break;
- }
+ Utils.LOG_WARNING("Centrifuge Debug - 2");
+ final ArrayList<ItemStack> tInputList = this.getStoredInputs();
+ final long tVoltage = this.getMaxInputVoltage();
+ final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ Utils.LOG_WARNING("Centrifuge Debug - Tier variable: "+tTier);
+ final ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]);
+ final ArrayList<FluidStack> tFluidList = this.getStoredFluids();
+ final FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]);
+ if ((tInputList.size() > 0) || (tFluids.length > 0)) {
+ GT_Recipe tRecipe = map.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
+ tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 40F);
+ if (tRecipe != null) {
+ Utils.LOG_WARNING("Recipe was not invalid");
+ this.mLastRecipe = tRecipe;
+ this.mEUt = 0;
+ this.mOutputItems = null;
+ this.mOutputFluids = null;
+ if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) {
+
+ Utils.LOG_WARNING("False: 1");
+ return false;
}
- }
- }
- FluidStack[] tFluids = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]);
- if (tInputList.size() > 0) {
- long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.findRecipe(getBaseMetaTileEntity(), false,
- gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
- tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 50F);
- if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) {
- this.mEfficiency = (10000 - ((getIdealStatus() - getRepairStatus()) * 1000));
+
+ this.mMaxProgresstime = tRecipe.mDuration;
+ this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000));
this.mEfficiencyIncrease = 10000;
- int tHeatCapacityDivTiers = (tRecipe.mSpecialValue) + 2;
+ Utils.LOG_WARNING("Centrifuge Debug - 2 - Max Progress Time: "+this.mMaxProgresstime);
if (tRecipe.mEUt <= 16) {
- this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
- this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
+ Utils.LOG_WARNING("Centrifuge Debug - Using < 16eu/t");
+ this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1)));
+ this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1)));
+ Utils.LOG_WARNING("Centrifuge Debug - 3.1 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt + " Obscure GT Value "+gregtech.api.enums.GT_Values.V[(tTier - 1)]);
} else {
+ Utils.LOG_WARNING("Centrifuge Debug - using > 16eu/t");
this.mEUt = tRecipe.mEUt;
this.mMaxProgresstime = tRecipe.mDuration;
- int i = 2;
+ Utils.LOG_WARNING("Centrifuge Debug - 3.2 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt + " Obscure GT Value "+gregtech.api.enums.GT_Values.V[(tTier - 1)]);
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
this.mEUt *= 4;
- this.mMaxProgresstime /= ((tHeatCapacityDivTiers >= i) ? 4 : 2);
- i += 2;
+ this.mMaxProgresstime /= 2;
+ Utils.LOG_WARNING("Centrifuge Debug - 4 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt);
}
}
- if (tHeatCapacityDivTiers > 0)
- this.mEUt = (int) (this.mEUt * Math.pow(0.95D, tHeatCapacityDivTiers));
+ this.mEUt *= 1;
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
+ Utils.LOG_WARNING("Centrifuge Debug - 5 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt);
+ }
+ ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ tOut[h] = tRecipe.getOutput(h).copy();
+ tOut[h].stackSize = 0;
+ }
+ FluidStack tFOut = null;
+ if (tRecipe.getFluidOutput(0) != null) {
+ tFOut = tRecipe.getFluidOutput(0).copy();
+ }
+ for (int f = 0; f < tOut.length; f++) {
+ if ((tRecipe.mOutputs[f] != null) && (tOut[f] != null)) {
+ for (int g = 0; g < 1; g++) {
+ if (this.getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) {
+ tOut[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+ }
+ if (tFOut != null) {
+ final int tSize = tFOut.amount;
+ tFOut.amount = tSize * 6;
}
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
-
- ItemStack mNewOutputs[] = new ItemStack[tRecipe.mOutputs.length];
-
- for (int i = 0; i < tRecipe.mOutputs.length; i++){
- if (this.getBaseMetaTileEntity().getRandomNumber(7500) < tRecipe.getOutputChance(i)){
- //Utils.LOG_INFO("Adding a bonus output | "+tRecipe.getOutputChance(i));
- mNewOutputs[i] = tRecipe.getOutput(i);
+ this.mMaxProgresstime /= 4;
+ if (this.mMaxProgresstime <= 0){
+ this.mMaxProgresstime++;
+ }
+ Utils.LOG_WARNING("Centrifuge Debug - 6 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt);
+ final List<ItemStack> overStacks = new ArrayList<>();
+ for (int f = 0; f < tOut.length; f++) {
+ if (tOut[f].getMaxStackSize() < tOut[f].stackSize) {
+ while (tOut[f].getMaxStackSize() < tOut[f].stackSize) {
+ final ItemStack tmp = tOut[f].copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize();
+ overStacks.add(tmp);
+ }
}
- else {
- //Utils.LOG_INFO("Adding null output");
- mNewOutputs[i] = null;
+ }
+ if (overStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[overStacks.size()];
+ tmp = overStacks.toArray(tmp);
+ tOut = ArrayUtils.addAll(tOut, tmp);
+ }
+ final List<ItemStack> tSList = new ArrayList<>();
+ for (final ItemStack tS : tOut) {
+ if (tS.stackSize > 0) {
+ tSList.add(tS);
}
}
-
- this.mOutputItems = mNewOutputs;
- this.mOutputFluids = new FluidStack[] { tRecipe.getFluidOutput(0) };
- updateSlots();
+ tOut = tSList.toArray(new ItemStack[tSList.size()]);
+ this.mOutputItems = tOut;
+ this.mOutputFluids = new FluidStack[]{tFOut};
+ this.updateSlots();
+ Utils.LOG_WARNING("Centrifuge: True");
return true;
}
}
+ Utils.LOG_WARNING("Centrifuge: Recipe was invalid.");
return false;
}
@@ -231,7 +258,7 @@ extends GregtechMeta_MultiBlockBase {
final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
//Utils.LOG_WARNING("X:"+tTileEntity.getXCoord()+" Y:"+tTileEntity.getYCoord()+" Z:"+tTileEntity.getZCoord());
- if ((!this.addMaintenanceToMachineList(tTileEntity, TAE.GTPP_INDEX(0))) && (!this.addInputToMachineList(tTileEntity, TAE.GTPP_INDEX(0))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(0))) && (!this.addEnergyInputToMachineList(tTileEntity, TAE.GTPP_INDEX(0)))) {
+ if ((!this.addMaintenanceToMachineList(tTileEntity, 57)) && (!this.addInputToMachineList(tTileEntity, 57)) && (!this.addOutputToMachineList(tTileEntity, 57)) && (!this.addEnergyInputToMachineList(tTileEntity, 57))) {
//Maintenance Hatch
if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) {
@@ -278,8 +305,9 @@ extends GregtechMeta_MultiBlockBase {
return 10000;
}
+ @Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 13;
+ return 0;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java
index 6eb26eb668..acf05cfd0b 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java
@@ -55,7 +55,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Maintenance Hatch (one of bottom)",
"1x Muffler Hatch (top middle)",
"Structural Coke Oven Casings for the rest",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -255,8 +254,9 @@ extends GregtechMeta_MultiBlockBase {
return 10000;
}
+ @Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 8;
+ return 0;
}
/* @Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java
new file mode 100644
index 0000000000..ad1b9cc635
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java
@@ -0,0 +1,254 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi;
+
+import java.util.ArrayList;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_IndustrialCuttingMachine
+extends GregtechMeta_MultiBlockBase {
+ public GregtechMetaTileEntity_IndustrialCuttingMachine(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialCuttingMachine(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialCuttingMachine(this.mName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ "Controller Block for the Industrial Cutting Factory",
+ "60% faster than using single block machines of the same voltage",
+ "Size: 3x3x5 [WxHxL] (Hollow)", "Controller (front centered)",
+ "2x Input Bus (side centered)",
+ "2x Output Bus (side centered)",
+ "1x Energy Hatch (top or bottom centered)",
+ "1x Input Hatch (top or bottom centered)",
+ "1x Maintenance Hatch (back centered)",
+ "Cutting Factory Frames for the rest (32 at least!)",
+ CORE.GT_Tooltip
+ };
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(29)], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)};
+ }
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(29)]};
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "WireFactory.png");
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sCutterRecipes;
+ }
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
+ return aFacing > 1;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ final ArrayList<ItemStack> tInputList = this.getStoredInputs();
+ final ArrayList<FluidStack> tFluidList = this.getStoredFluids();
+ for (final ItemStack tInput : tInputList) {
+ for (final FluidStack tFluid : tFluidList) {
+ final long tVoltage = this.getMaxInputVoltage();
+ final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCutterRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tFluid}, new ItemStack[]{tInput});
+ //tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 60F);
+ if (tRecipe != null) {
+
+ //More than or one input
+ if (tInputList.size() > 0) {
+
+ if (tRecipe.isRecipeInputEqual(true, new FluidStack[]{tFluid}, new ItemStack[]{tInput})) {
+ this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000));
+ this.mEfficiencyIncrease = 10000;
+ if (tRecipe.mEUt <= 16) {
+ this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1)));
+ this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1)));
+ } else {
+ this.mEUt = tRecipe.mEUt;
+ this.mMaxProgresstime = tRecipe.mDuration;
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ ItemStack[] mOutputStacks = new ItemStack[9];
+ for (int i=0;i<9;i++){
+ if (tRecipe.getOutput(i) != null){
+ mOutputStacks[i] = tRecipe.getOutput(i);
+ }
+ }
+ this.mOutputItems = mOutputStacks.clone();
+ //this.updateSlots();
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
+ final byte tSide = this.getBaseMetaTileEntity().getBackFacing();
+ if ((this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 1)) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 2) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 3)))) {
+ int tAirCount = 0;
+ for (byte i = -1; i < 2; i = (byte) (i + 1)) {
+ for (byte j = -1; j < 2; j = (byte) (j + 1)) {
+ for (byte k = -1; k < 2; k = (byte) (k + 1)) {
+ if (this.getBaseMetaTileEntity().getAirOffset(i, j, k)) {
+ tAirCount++;
+ }
+ }
+ }
+ }
+ if (tAirCount != 10) {
+ Utils.LOG_INFO("False 1");
+ return false;
+ }
+ for (byte i = 2; i < 6; i = (byte) (i + 1)) {
+ IGregTechTileEntity tTileEntity;
+ if ((null != (tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(i, 2))) &&
+ (tTileEntity.getFrontFacing() == this.getBaseMetaTileEntity().getFrontFacing()) && (tTileEntity.getMetaTileEntity() != null) &&
+ ((tTileEntity.getMetaTileEntity() instanceof GregtechMetaTileEntity_IndustrialCuttingMachine))) {
+ //Utils.LOG_INFO("False 1");
+ return false;
+ }
+ }
+ final int tX = this.getBaseMetaTileEntity().getXCoord();
+ final int tY = this.getBaseMetaTileEntity().getYCoord();
+ final int tZ = this.getBaseMetaTileEntity().getZCoord();
+ for (byte i = -1; i < 2; i = (byte) (i + 1)) {
+ for (byte j = -1; j < 2; j = (byte) (j + 1)) {
+ if ((i != 0) || (j != 0)) {
+ for (byte k = 0; k < 5; k = (byte) (k + 1)) {
+ if (((i == 0) || (j == 0)) && ((k == 1) || (k == 2) || (k == 3))) {
+ if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) {
+ }
+ else if (!this.addToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))) && (!this.addEnergyInputToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))))) {
+ Utils.LOG_INFO("False 2");
+ return false;
+ }
+ }
+ else if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) {
+ }
+ else {
+ Utils.LOG_INFO("False 3");
+ return false;
+ }
+ }
+ }
+ }
+ }
+ if ((this.mOutputHatches.size() != 0) || (this.mInputHatches.size() < 0)) {
+ Utils.LOG_INFO("Use Busses, Not Hatches for Input/Output.");
+ return false;
+ }
+ if ((this.mInputBusses.size() != 2) || (this.mOutputBusses.size() != 2)) {
+ Utils.LOG_INFO("Incorrect amount of Input & Output busses.");
+ return false;
+ }
+ this.mMaintenanceHatches.clear();
+ final IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 4);
+ if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) {
+ if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) {
+ this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity());
+ ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = this.getCasingTextureIndex();
+ } else {
+ Utils.LOG_INFO("Maintenance hatch must be in the middle block on the back.");
+ return false;
+ }
+ }
+ if ((this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() != 1)) {
+ Utils.LOG_INFO("Incorrect amount of Maintenance or Energy hatches.");
+ return false;
+ }
+ } else {
+ Utils.LOG_INFO("False 5");
+ return false;
+ }
+ Utils.LOG_INFO("True");
+ return true;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(final ItemStack aStack) {
+ return 80;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 2;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings2Misc;
+ }
+
+
+ public byte getCasingMeta() {
+ return 13;
+ }
+
+
+ public byte getCasingTextureIndex() {
+ return (byte) TAE.GTPP_INDEX(29);
+ }
+
+ private boolean addToMachineList(final IGregTechTileEntity tTileEntity) {
+ return ((this.addMaintenanceToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addInputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addOutputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addMufflerToMachineList(tTileEntity, this.getCasingTextureIndex())));
+ }
+
+ private boolean addEnergyInputToMachineList(final IGregTechTileEntity tTileEntity) {
+ return ((this.addEnergyInputToMachineList(tTileEntity, this.getCasingTextureIndex())));
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java
index 280af1d3f8..c07d331dbb 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java
@@ -55,7 +55,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Maintenance Hatch (anywhere)",
"1x Muffler (anywhere)",
"Electrolyzer Casings for the rest (16 at least!)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -244,8 +243,9 @@ extends GregtechMeta_MultiBlockBase {
return 10000;
}
+ @Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 20;
+ return 0;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java
index e61d18b184..48d5ee7452 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java
@@ -61,7 +61,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Maintenance Hatch (Any casing)",
"1x Energy Hatch (Any casing)",
"Maceration Stack Casings for the rest (26 at least!)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -243,8 +242,9 @@ extends GregtechMeta_MultiBlockBase {
return 10000;
}
+ @Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 25;
+ return 0;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java
index a5599522af..05454a37c7 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java
@@ -51,7 +51,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Maintenance Hatch (anywhere)",
"1x Muffler (anywhere)",
"Material Press Machine Casings for the rest (16 at least!)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -185,8 +184,9 @@ extends GregtechMeta_MultiBlockBase {
return 10000;
}
+ @Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 17;
+ return 0;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java
index 5fc1146bd1..d4272430de 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java
@@ -14,7 +14,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Outpu
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import gregtech.common.blocks.GT_Block_Machines;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
@@ -53,9 +52,8 @@ extends GregtechMeta_MultiBlockBase {
"4x Output Bus (Any top or bottom edge casing)",
"1x Maintenance Hatch (Any top or bottom edge casing)",
"1x Energy Hatch (Any top or bottom edge casing)",
- "9x Sieve Grate (Top and Middle 3x3)",
+ "18x Sieve Grate (Top and Middle 3x3)",
"Sieve Casings for the rest (47)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -152,24 +150,25 @@ extends GregtechMeta_MultiBlockBase {
//Make a recipe instance for the rest of the method.
final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sSifterRecipes.findRecipe(this.getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs);
- if (tRecipe != null)
- baseRecipe = tRecipe.copy();
+ if (tRecipe != null) {
+ this.baseRecipe = tRecipe.copy();
+ }
- if (cloneRecipe != tRecipe || cloneRecipe == null){
- cloneRecipe = tRecipe.copy();
+ if ((this.cloneRecipe != tRecipe) || (this.cloneRecipe == null)){
+ this.cloneRecipe = tRecipe.copy();
Utils.LOG_WARNING("Setting Recipe");
- }
- if (mInputStacks != tRecipe.mInputs || mInputStacks == null){
- mInputStacks = tRecipe.mInputs;
+ }
+ if ((this.mInputStacks != tRecipe.mInputs) || (this.mInputStacks == null)){
+ this.mInputStacks = tRecipe.mInputs;
Utils.LOG_WARNING("Setting Recipe Inputs");
}
- if (cloneChances != tRecipe.mChances || cloneChances == null){
- cloneChances = tRecipe.mChances.clone();
+ if ((this.cloneChances != tRecipe.mChances) || (this.cloneChances == null)){
+ this.cloneChances = tRecipe.mChances.clone();
Utils.LOG_WARNING("Setting Chances");
}
- for (int r=0;r<cloneChances.length;r++){
- Utils.LOG_WARNING("Original map Output["+r+"] chance = "+cloneChances[r]);
+ for (int r=0;r<this.cloneChances.length;r++){
+ Utils.LOG_WARNING("Original map Output["+r+"] chance = "+this.cloneChances[r]);
}
Utils.LOG_WARNING("3.1");
@@ -179,24 +178,24 @@ extends GregtechMeta_MultiBlockBase {
Utils.LOG_WARNING("3.2");
- if (cloneRecipe.mChances != null){
- outputChances = cloneRecipe.mChances.clone();
+ if (this.cloneRecipe.mChances != null){
+ outputChances = this.cloneRecipe.mChances.clone();
Utils.LOG_WARNING("3.3");
for (int r=0;r<outputChances.length;r++){
Utils.LOG_WARNING("Output["+r+"] chance = "+outputChances[r]);
if (outputChances[r]<10000){
- int temp = outputChances[r];
- if (outputChances[r] < 8000 && outputChances[r] >= 1){
+ final int temp = outputChances[r];
+ if ((outputChances[r] < 8000) && (outputChances[r] >= 1)){
outputChances[r] = temp+1200;
Utils.LOG_WARNING("Output["+r+"] chance now = "+outputChances[r]);
}
- else if (outputChances[r] < 9000 && outputChances[r] >= 8000){
+ else if ((outputChances[r] < 9000) && (outputChances[r] >= 8000)){
outputChances[r] = temp+400;
Utils.LOG_WARNING("Output["+r+"] chance now = "+outputChances[r]);
}
- else if (outputChances[r] <= 9900 && outputChances[r] >= 9000){
+ else if ((outputChances[r] <= 9900) && (outputChances[r] >= 9000)){
outputChances[r] = temp+100;
Utils.LOG_WARNING("Output["+r+"] chance now = "+outputChances[r]);
}
@@ -206,7 +205,7 @@ extends GregtechMeta_MultiBlockBase {
Utils.LOG_WARNING("3.4");
//Rebuff Drop Rates for % output
- cloneRecipe.mChances = outputChances;
+ this.cloneRecipe.mChances = outputChances;
}
@@ -214,24 +213,24 @@ extends GregtechMeta_MultiBlockBase {
Utils.LOG_WARNING("4");
- final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), cloneRecipe, tInputs);
+ final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), this.cloneRecipe, tInputs);
Utils.LOG_WARNING("Sifter - Valid Output Hatches: "+tValidOutputSlots);
//More than or one input
if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) {
- if ((cloneRecipe != null) && (cloneRecipe.isRecipeInputEqual(true, null, tInputs))) {
- Utils.LOG_WARNING("Valid Recipe found - size "+cloneRecipe.mOutputs.length);
+ if ((this.cloneRecipe != null) && (this.cloneRecipe.isRecipeInputEqual(true, null, tInputs))) {
+ Utils.LOG_WARNING("Valid Recipe found - size "+this.cloneRecipe.mOutputs.length);
this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000));
this.mEfficiencyIncrease = 10000;
- this.mEUt = (-cloneRecipe.mEUt);
- this.mMaxProgresstime = Math.max(1, (cloneRecipe.mDuration/5));
- final ItemStack[] outputs = new ItemStack[cloneRecipe.mOutputs.length];
- for (int i = 0; i < cloneRecipe.mOutputs.length; i++){
- if (this.getBaseMetaTileEntity().getRandomNumber(7500) < cloneRecipe.getOutputChance(i)){
+ this.mEUt = (-this.cloneRecipe.mEUt);
+ this.mMaxProgresstime = Math.max(1, (this.cloneRecipe.mDuration/5));
+ final ItemStack[] outputs = new ItemStack[this.cloneRecipe.mOutputs.length];
+ for (int i = 0; i < this.cloneRecipe.mOutputs.length; i++){
+ if (this.getBaseMetaTileEntity().getRandomNumber(7500) < this.cloneRecipe.getOutputChance(i)){
Utils.LOG_WARNING("Adding a bonus output");
- outputs[i] = cloneRecipe.getOutput(i);
+ outputs[i] = this.cloneRecipe.getOutput(i);
}
else {
Utils.LOG_WARNING("Adding null output");
@@ -256,7 +255,7 @@ extends GregtechMeta_MultiBlockBase {
final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2;
int tAmount = 0;
- controller = false;
+ this.controller = false;
for (int i = -2; i < 3; i++) {
for (int j = -2; j < 3; j++) {
for (int h = 0; h < 3; h++) {
@@ -276,7 +275,7 @@ extends GregtechMeta_MultiBlockBase {
// Sifter Floor/Roof inner 3x3
if (((i != -2) && (i != 2)) && ((j != -2) && (j != 2))) {
- if (h != 0){
+ if (h != 0){
if (!this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(21))) {
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasings2Misc) {
Utils.LOG_MACHINE_INFO("Sifter Casing(s) Missing from one of the "+sHeight+" layers inner 3x3.");
@@ -303,12 +302,12 @@ extends GregtechMeta_MultiBlockBase {
tAmount++;
}
}
- }
+ }
else {
//Dealt with inner 5x5, now deal with the exterior.
//Deal with all 4 sides (Sifter walls)
boolean checkController = false;
- if (((xDir + i) != 0) || ((zDir + j) != 0) && h == 0) {//no controller
+ if (((xDir + i) != 0) || (((zDir + j) != 0) && (h == 0))) {//no controller
checkController = true;
}
else {
@@ -318,7 +317,7 @@ extends GregtechMeta_MultiBlockBase {
if (!this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(21))) {
if (!checkController){
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasings2Misc) {
- if (tTileEntity instanceof GregtechMetaTileEntity_IndustrialSifter || aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == GregTech_API.sBlockMachines){
+ if ((tTileEntity instanceof GregtechMetaTileEntity_IndustrialSifter) || (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == GregTech_API.sBlockMachines)){
if (h != 0){
Utils.LOG_MACHINE_INFO("Found a secondary controller at the wrong Y level.");
return false;
@@ -329,36 +328,36 @@ extends GregtechMeta_MultiBlockBase {
Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName());
return false;
}
- }
-
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 5) {
- if (tTileEntity instanceof GregtechMetaTileEntity_IndustrialSifter || aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == GregTech_API.sBlockMachines){
-
}
- else {
- Utils.LOG_MACHINE_INFO("Sifter Casings Missing from somewhere in the "+sHeight+" layer edge.");
- Utils.LOG_MACHINE_INFO("Incorrect Meta value for block, expected 5.");
- Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j)+".");
- return false;
+
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 5) {
+ if ((tTileEntity instanceof GregtechMetaTileEntity_IndustrialSifter) || (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == GregTech_API.sBlockMachines)){
+
+ }
+ else {
+ Utils.LOG_MACHINE_INFO("Sifter Casings Missing from somewhere in the "+sHeight+" layer edge.");
+ Utils.LOG_MACHINE_INFO("Incorrect Meta value for block, expected 5.");
+ Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j)+".");
+ return false;
+ }
}
}
- }
- tAmount++;
+ tAmount++;
}
else {
- tAmount++;
+ tAmount++;
}
}
}
}
}
if ((this.mInputBusses.size() != 1) || (this.mOutputBusses.size() != 4)
- || (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() != 1)) {
- Utils.LOG_MACHINE_INFO("Returned False 3");
- Utils.LOG_MACHINE_INFO("Input Buses: "+this.mInputBusses.size()+" | expected: 1");
- Utils.LOG_MACHINE_INFO("Output Buses: "+this.mOutputBusses.size()+" | expected: 4");
- Utils.LOG_MACHINE_INFO("Energy Hatches: "+this.mEnergyHatches.size()+" | expected: 1");
- Utils.LOG_MACHINE_INFO("Maint. hatches: "+this.mMaintenanceHatches.size()+" | expected: 1");
+ || (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() < 1)) {
+ Utils.LOG_INFO("Returned False 3");
+ Utils.LOG_INFO("Input Buses: "+this.mInputBusses.size()+" | expected: 1");
+ Utils.LOG_INFO("Output Buses: "+this.mOutputBusses.size()+" | expected: 4");
+ Utils.LOG_INFO("Energy Hatches: "+this.mEnergyHatches.size()+" | expected: 1");
+ Utils.LOG_INFO("Maint. hatches: "+this.mMaintenanceHatches.size()+" | expected: 1");
return false;
}
final int height = this.getBaseMetaTileEntity().getYCoord();
@@ -384,7 +383,7 @@ extends GregtechMeta_MultiBlockBase {
}
public boolean ignoreController(final Block tTileEntity) {
- if (!controller && (tTileEntity == GregTech_API.sBlockMachines)) {
+ if (!this.controller && (tTileEntity == GregTech_API.sBlockMachines)) {
return true;
}
return false;
@@ -397,7 +396,7 @@ extends GregtechMeta_MultiBlockBase {
@Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 12;
+ return 0;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
index 5b8a3a30c9..2ffa242fc2 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
@@ -44,7 +44,7 @@ extends GregtechMeta_MultiBlockBase {
return new String[]{
"Controller Block for the Industrial Thermal Centrifuge",
"60% faster than using single block machines of the same voltage",
- "Size: 3x2x3 [LxHxW]", "Controller (front centered)",
+ "Size: 3x2x3 [WxLxH] (Hollow)", "Controller (front centered)",
"1x Input Bus (Any casing)",
"1x Output Bus (Any casing)",
"1x Maintenance Hatch (Any casing)",
@@ -53,7 +53,7 @@ extends GregtechMeta_MultiBlockBase {
"Thermal processing Casings for the rest (8 at least!)",
"Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip
-
+
};
}
@@ -75,17 +75,6 @@ extends GregtechMeta_MultiBlockBase {
return GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes;
}
- public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
- super.startSoundLoop(aIndex, aX, aY, aZ);
- if (aIndex == 1) {
- GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(207)), 10, 1.0F, aX, aY, aZ);
- }
- }
-
- public void startProcess() {
- sendLoopStart((byte) 1);
- }
-
@Override
public boolean isFacingValid(final byte aFacing) {
return aFacing > 1;
@@ -125,15 +114,15 @@ extends GregtechMeta_MultiBlockBase {
this.mEUt = (-this.mEUt);
}
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
-
+
ItemStack mNewOutputs[] = new ItemStack[16];
+
-
-
+
for (int f=0;f<tRecipe.mOutputs.length;f++){
mNewOutputs[f] = tRecipe.getOutput(f);
}
-
+
this.mOutputItems = mNewOutputs;
this.updateSlots();
return true;
@@ -172,17 +161,6 @@ extends GregtechMeta_MultiBlockBase {
}
}
}
- if ((this.mInputBusses.size() < 1) || (this.mOutputBusses.size() < 1)
- || (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() < 1)
- || (this.mMufflerHatches.size() < 1)) {
- Utils.LOG_MACHINE_INFO("Returned False");
- Utils.LOG_MACHINE_INFO("Input Buses: "+this.mInputBusses.size()+" | expected: >= 1 | "+(this.mInputBusses.size() >= 1));
- Utils.LOG_MACHINE_INFO("Output Buses: "+this.mOutputBusses.size()+" | expected: >= 1 | "+(this.mOutputBusses.size() >= 1));
- Utils.LOG_MACHINE_INFO("Energy Hatches: "+this.mEnergyHatches.size()+" | expected: >= 1 | "+(this.mEnergyHatches.size() >= 1));
- Utils.LOG_MACHINE_INFO("Muffler Hatches: "+this.mMufflerHatches.size()+" | expected: >= 1 | "+(this.mMufflerHatches.size() >= 1));
- Utils.LOG_MACHINE_INFO("Maint. Hatches: "+this.mMaintenanceHatches.size()+" | expected: 1 | "+(this.mMaintenanceHatches.size() != 1));
- return false;
- }
Utils.LOG_WARNING("Trying to assemble structure. Completed? "+(tAmount >= 8));
return (tAmount >= 8);
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java
index 9dcd257944..9b7927c5ad 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java
@@ -1,11 +1,6 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.commons.lang3.ArrayUtils;
-
import gregtech.api.enums.TAE;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
@@ -14,7 +9,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import gregtech.api.util.Recipe_GT;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
@@ -28,14 +22,13 @@ import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
public class GregtechMetaTileEntity_IndustrialWashPlant
extends GregtechMeta_MultiBlockBase {
- private int mFilledCount = 0;
+ public GT_Recipe mLastRecipe;
public GregtechMetaTileEntity_IndustrialWashPlant(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -54,21 +47,19 @@ extends GregtechMeta_MultiBlockBase {
public String[] getDescription() {
return new String[]{
"Controller Block for the Industrial Ore Washing Plant",
- "60% faster than using single block machines of the same voltage",
- "Size: 5x3x7 [WxHxL] (open)",
- "The inner 3x2x5 is air or water",
+ "80% faster than using single block machines of the same voltage",
+ "Size: 7x2x5 [WxHxL] (open)",
+ "X X",
+ "X X",
+ "XXXXX",
"Controller (front centered)",
"1x Input Bus (Any casing)",
"1x Output Bus (Any casing)",
- "1x Input Hatch (Any casing)",
- "1x Output Hatch (Any casing)",
"1x Maintenance Hatch (Any casing)",
- "1x Muffler Hatch (Any casing)",
"1x Energy Hatch (Any casing)",
- "Wash Plant Casing (The rest)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip
- };
+
+ };
}
@Override
@@ -95,98 +86,31 @@ extends GregtechMeta_MultiBlockBase {
}
@Override
- public boolean checkRecipe(final ItemStack aStack) {
-
- if (!checkForWater()){
- Utils.LOG_WARNING("Did not find enough cleaning solution.");
- return false;
- }
- Utils.LOG_INFO("1");
-
- /*ArrayList<ItemStack> tInputList = getStoredInputs();
- ArrayList<FluidStack> tFluidInputs = getStoredFluids();
- for (ItemStack tInput : tInputList) {
- Utils.LOG_INFO("2");
- long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe(getBaseMetaTileEntity(), false,
- gregtech.api.enums.GT_Values.V[tTier],
- new FluidStack[] { (tFluidInputs.isEmpty()) ? null : (FluidStack) tFluidInputs.get(0) },
- new ItemStack[] { tInput });
-
- tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 60);
-
- if (tRecipe != null) {
- Utils.LOG_INFO("3");
- this.mEfficiency = (10000 - ((getIdealStatus() - getRepairStatus()) * 1000));
- this.mEfficiencyIncrease = 10000;
-
- this.mEUt = tRecipe.mEUt;
- if (tRecipe.mEUt <= 16) {
- Utils.LOG_INFO("3.1");
- this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
- this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
- } else {
- Utils.LOG_INFO("3.2");
- this.mEUt = tRecipe.mEUt;
- this.mMaxProgresstime = tRecipe.mDuration;
- while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
- Utils.LOG_INFO("3.3");
- this.mEUt *= 4;
- this.mMaxProgresstime /= 2;
- }
- }
- Utils.LOG_INFO("4");
- if (this.mEUt > 0) {
- Utils.LOG_INFO("4.1");
- this.mEUt = (-this.mEUt);
- }
- this.mMaxProgresstime = (this.mMaxProgresstime * 2 / (1 + 3));
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- if (tRecipe.mOutputs.length > 0){
- //this.mOutputItems = new ItemStack[] { tRecipe.getOutput(0) };
- ItemStack mNewOutputs[] = new ItemStack[tRecipe.mOutputs.length];
- for (int f=0;f<tRecipe.mOutputs.length;f++){
- Utils.LOG_INFO("Step 5 - Adding Output");
- mNewOutputs[f] = tRecipe.mOutputs[f].copy();
- }
- this.mOutputItems = mNewOutputs;
- updateSlots();
- }
- if (tRecipe.mFluidOutputs.length >= 0){
- //this.mOutputFluids = new FluidStack[] { tRecipe.getFluidOutput(0) };
- FluidStack outputFluids[] = new FluidStack[1];
- if (true){
- Utils.LOG_INFO("Adding Sludge");
- outputFluids[0] = FluidUtils.getFluidStack("potion.poison", 10);
- }
- this.mOutputFluids = outputFluids;
- updateSlots();
- }
- updateSlots();
- Utils.LOG_INFO("5");
- return true;
- }
- }
- return false;*/
-
+ public boolean checkRecipe(final ItemStack aStack) { //TODO - Add Check to make sure Fluid output isn't full
ArrayList<ItemStack> tInputList = getStoredInputs();
ArrayList<FluidStack> tFluidInputs = getStoredFluids();
for (ItemStack tInput : tInputList) {
long tVoltage = getMaxInputVoltage();
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe(getBaseMetaTileEntity(), false,
- gregtech.api.enums.GT_Values.V[tTier],
- new FluidStack[] { (tFluidInputs.isEmpty()) ? null : (FluidStack) tFluidInputs.get(0) },
- new ItemStack[] { this.mInventory[1], tInput });
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe(getBaseMetaTileEntity(), this.mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluidInputs.isEmpty() ? null : new FluidStack[]{tFluidInputs.get(0)}, new ItemStack[]{tInput});
+
+ if ((tRecipe == null && !mRunningOnLoad)) {
+ this.mLastRecipe = null;
+ return false;
+ }
+
if (tRecipe != null) {
- if (tRecipe.isRecipeInputEqual(true,
- new FluidStack[] { (tFluidInputs.isEmpty()) ? null : (FluidStack) tFluidInputs.get(0) },
- new ItemStack[] { tInput, this.mInventory[1] })) {
- this.mEfficiency = (10000 - ((getIdealStatus() - getRepairStatus()) * 1000));
+ FluidStack[] mFluidInputList = new FluidStack[tFluidInputs.size()];
+ int tri = 0;
+ for (FluidStack f : tFluidInputs){
+ mFluidInputList[tri] = f;
+ tri++;
+ }
+ if (tRecipe.isRecipeInputEqual(true, mFluidInputList, tInput)) {
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
-
this.mEUt = tRecipe.mEUt;
+
if (tRecipe.mEUt <= 16) {
this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
@@ -201,22 +125,22 @@ extends GregtechMeta_MultiBlockBase {
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
}
- this.mMaxProgresstime = (this.mMaxProgresstime * 2 / (1 + 5));
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- if (tRecipe.mOutputs.length > 0){
- //this.mOutputItems = new ItemStack[] { tRecipe.getOutput(0) };
- ItemStack mNewOutputs[] = new ItemStack[tRecipe.mOutputs.length];
- for (int f=0;f<tRecipe.mOutputs.length;f++){
- Utils.LOG_INFO("Step 5 - Adding Output");
- mNewOutputs[f] = tRecipe.mOutputs[f].copy();
- }
- this.mOutputItems = mNewOutputs;
- updateSlots();
+
+ if (mRunningOnLoad || tRecipe.isRecipeInputEqual(true, mFluidInputList, new ItemStack[]{tInput})) {
+ Utils.LOG_INFO("Recipe Complete.");
+ this.mLastRecipe = tRecipe;
+ this.mEUt = MathUtils.findPercentageOfInt(this.mLastRecipe.mEUt, 80);
+ this.mMaxProgresstime = MathUtils.findPercentageOfInt(this.mLastRecipe.mDuration, 20);
+ this.mEfficiencyIncrease = 10000;
+ this.addOutput(tRecipe.getOutput(0));
+ this.addOutput(tRecipe.getOutput(0));
+ this.addOutput(tRecipe.getOutput(1));
+ this.addOutput(tRecipe.getOutput(1));
+ mRunningOnLoad = false;
+ return true;
}
- if (tRecipe.mFluidOutputs.length > 0)
- this.mOutputFluids = new FluidStack[] { tRecipe.getFluidOutput(0) };
- updateSlots();
- return true;
+
}
}
}
@@ -301,23 +225,6 @@ extends GregtechMeta_MultiBlockBase {
}
}
}
-
- if ((this.mInputBusses.size() < 1) || (this.mOutputBusses.size() < 1)
- || (this.mInputHatches.size() < 1) || (this.mOutputHatches.size() < 1)
- || (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() < 1)
- || (this.mMufflerHatches.size() < 1)) {
- Utils.LOG_MACHINE_INFO("Returned False");
- Utils.LOG_MACHINE_INFO("Input Buses: "+this.mInputBusses.size()+" | expected: >= 1 | "+(this.mInputBusses.size() >= 1));
- Utils.LOG_MACHINE_INFO("Output Buses: "+this.mOutputBusses.size()+" | expected: >= 1 | "+(this.mOutputBusses.size() >= 1));
- Utils.LOG_MACHINE_INFO("Input Hatches: "+this.mInputHatches.size()+" | expected: >= 1 | "+(this.mInputHatches.size() >= 1));
- Utils.LOG_MACHINE_INFO("Output Hatches: "+this.mOutputHatches.size()+" | expected: >= 1 | "+(this.mOutputHatches.size() >= 1));
- Utils.LOG_MACHINE_INFO("Energy Hatches: "+this.mEnergyHatches.size()+" | expected: >= 1 | "+(this.mEnergyHatches.size() >= 1));
- Utils.LOG_MACHINE_INFO("Muffler Hatches: "+this.mMufflerHatches.size()+" | expected: >= 1 | "+(this.mMufflerHatches.size() >= 1));
- Utils.LOG_MACHINE_INFO("Maint. Hatches: "+this.mMaintenanceHatches.size()+" | expected: 1 | "+(this.mMaintenanceHatches.size() != 1));
- return false;
- }
-
-
if ((tAmount >= 8)){
Utils.LOG_WARNING("Made structure.");
}
@@ -422,7 +329,7 @@ extends GregtechMeta_MultiBlockBase {
for (FluidStack stored : this.getStoredFluids()){
if (stored.isFluidEqual(FluidUtils.getFluidStack("water", 1))){
if (stored.amount >= 1000){
- //Utils.LOG_WARNING("Going to try swap an air block for water from inut bus.");
+ //Utils.LOG_INFO("Going to try swap an air block for water from inut bus.");
stored.amount -= 1000;
Block fluidUsed = null;
if (tBlock == Blocks.air || tBlock == Blocks.flowing_water){
@@ -442,12 +349,12 @@ extends GregtechMeta_MultiBlockBase {
}
if (tBlock == Blocks.water){
++tAmount;
- //Utils.LOG_WARNING("Found Water");
+ //Utils.LOG_INFO("Found Water");
}
else if (tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)){
++tAmount;
++tAmount;
- //Utils.LOG_WARNING("Found Distilled Water");
+ //Utils.LOG_INFO("Found Distilled Water");
}
}
else {
@@ -462,115 +369,13 @@ extends GregtechMeta_MultiBlockBase {
}
}
}
- if ((tAmount >= 45)){
+ if ((tAmount == 45)){
Utils.LOG_WARNING("Filled structure.");
}
else {
Utils.LOG_WARNING("Did not fill structure.");
}
- this.mFilledCount = tAmount;
- return (tAmount >= 45);
- }
-
- public boolean removeWater() {
-
- //Get Facing direction
- IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity();
- int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int mCurrentDirectionX;
- int mCurrentDirectionZ;
- int mOffsetX_Lower = 0;
- int mOffsetX_Upper = 0;
- int mOffsetZ_Lower = 0;
- int mOffsetZ_Upper = 0;
-
- if (mDirectionX == 0){
- mCurrentDirectionX = 2;
- mCurrentDirectionZ = 3;
- mOffsetX_Lower = -2;
- mOffsetX_Upper = 2;
- mOffsetZ_Lower = -3;
- mOffsetZ_Upper = 3;
- }
- else {
- mCurrentDirectionX = 3;
- mCurrentDirectionZ = 2;
- mOffsetX_Lower = -3;
- mOffsetX_Upper = 3;
- mOffsetZ_Lower = -2;
- mOffsetZ_Upper = 2;
- }
-
- //if (aBaseMetaTileEntity.fac)
-
- final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * mCurrentDirectionX;
- final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * mCurrentDirectionZ;
-
- int tAmount = 0;
- for (int i = mOffsetX_Lower; i <=mOffsetX_Upper; ++i) {
- for (int j = mOffsetZ_Lower; j <= mOffsetZ_Upper; ++j) {
- for (int h = -1; h < 2; ++h) {
- if ((h != 0) || ((((xDir + i != 0) || (zDir + j != 0))) && (((i != 0) || (j != 0))))) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h,
- zDir + j);
- if (!addToMachineList(tTileEntity)) {
- Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
- byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
- if ((tBlock != getCasingBlock()) && (tMeta != getCasingMeta())) {
- if ((i != mOffsetX_Lower && j != mOffsetZ_Lower
- && i != mOffsetX_Upper && j != mOffsetZ_Upper) && (h == 0 || h == 1)){
- if (tBlock == Blocks.flowing_water || tBlock == Blocks.water || tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)){
- if (MathUtils.randInt(1, 20000) == 1){
- aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord()+xDir + i, aBaseMetaTileEntity.getYCoord()+h, aBaseMetaTileEntity.getZCoord()+zDir + j, Blocks.air);
-
- if (this.mOutputHatches.size() > 0){
- this.addOutput(FluidUtils.getFluidStack("fluid.sludge", 200));
- }
-
- }
- if (tBlock == Blocks.water || tBlock == Blocks.flowing_water){
- ++tAmount;
- }
- else if (tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)){
- ++tAmount;
- ++tAmount;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- if ((tAmount < this.mFilledCount)){
- Utils.LOG_WARNING("Drained structure.");
- }
- else {
- Utils.LOG_WARNING("Did not drain structure.");
- }
- this.mFilledCount = tAmount;
- return (tAmount < this.mFilledCount);
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if (aBaseMetaTileEntity.isActive()){
- removeWater();
- }
- super.onPostTick(aBaseMetaTileEntity, aTick);
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- aNBT.setInteger("mFilledCount", this.mFilledCount);
- super.saveNBTData(aNBT);
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- this.mFilledCount = aNBT.getInteger("mFilledCount");
- super.loadNBTData(aNBT);
+ return (tAmount == 45);
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java
index e4ab6a89e4..50dbed4fb9 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java
@@ -48,7 +48,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Energy Hatch (top or bottom centered)",
"1x Maintenance Hatch (back centered)",
"Wire Factory Casings for the rest (32 at least!)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip
};
}
@@ -208,8 +207,9 @@ extends GregtechMeta_MultiBlockBase {
return 10000;
}
+ @Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 15;
+ return 0;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java
index 612f820766..5fc5b9c3fb 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java
@@ -77,7 +77,6 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
"1x Energy Hatch (Any bottom layer casing)",
"24x IC2 Reinforced Glass for the walls",
"Matter Fabricator Casings for the edges & top (40 at least!)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -387,8 +386,9 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
return 10000;
}
+ @Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 20;
+ return 0;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java
index 17ab4795df..b908e5439c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java
@@ -211,7 +211,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Energy Hatch (anywhere)",
"1x Maintenance Hatch (anywhere)",
"Multitank Exterior Casings for the rest (16 at least!)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip
};
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java
index 9fc0870fb8..a163215459 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java
@@ -1,5 +1,7 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi;
+import java.util.concurrent.TimeUnit;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.TAE;
import gregtech.api.enums.Textures;
@@ -8,7 +10,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Config;
import gtPlusPlus.core.block.ModBlocks;
@@ -16,16 +17,23 @@ import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
-public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTileEntity_MultiBlockBase {
+public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMeta_MultiBlockBase {
private static boolean controller;
protected int mAverageEuUsage = 0;
+ protected long mTotalEnergyAdded = 0;
+ protected long mTotalEnergyConsumed = 0;
+ protected long mTotalEnergyLost = 0;
+ protected long mTotalRunTime = 0;
public GregtechMetaTileEntity_PowerSubStationController(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -52,11 +60,10 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
"Hatches can be placed nearly anywhere",
"Minimum 1x Energy Input Hatch",
"Minimum 1x Energy Dynamo Hatch",
- "1x Input Bus",
- "1x Output Bus",
+ "1x Charge Bus",
+ "1x Discharge Bus",
"1x Maintenance hatch",
"--------------------------------------------------------------------------",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -239,12 +246,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
}
}
}
- if ((this.mInputBusses.size() != 1) || (this.mOutputBusses.size() != 1)
+ if ((this.mChargeHatches.size() < 1) || (this.mDischargeHatches.size() < 1)
|| (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() < 1)
|| (this.mDynamoHatches.size() < 1)) {
Utils.LOG_MACHINE_INFO("Returned False 3");
- Utils.LOG_MACHINE_INFO("Input Buses: "+this.mInputBusses.size()+" | expected: 1 | "+(this.mInputBusses.size() != 1));
- Utils.LOG_MACHINE_INFO("Output Buses: "+this.mOutputBusses.size()+" | expected: 1 | "+(this.mOutputBusses.size() != 1));
+ Utils.LOG_MACHINE_INFO("Charge Buses: "+this.mChargeHatches.size()+" | expected: 1 | "+(this.mChargeHatches.size() != 1));
+ Utils.LOG_MACHINE_INFO("Discharge Buses: "+this.mDischargeHatches.size()+" | expected: 1 | "+(this.mDischargeHatches.size() != 1));
Utils.LOG_MACHINE_INFO("Energy Hatches: "+this.mEnergyHatches.size()+" | expected: >= 1 | "+(this.mEnergyHatches.size() < 1));
Utils.LOG_MACHINE_INFO("Dynamo Hatches: "+this.mDynamoHatches.size()+" | expected: >= 1 | "+(this.mDynamoHatches.size() < 1));
Utils.LOG_MACHINE_INFO("Maint. Hatches: "+this.mMaintenanceHatches.size()+" | expected: 1 | "+(this.mMaintenanceHatches.size() != 1));
@@ -318,13 +325,19 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
long mActualStoredEU = 0;
-
+ //mTotalEnergyAdded
@Override
public void saveNBTData(NBTTagCompound aNBT) {
aNBT.setLong("mPowerStorageBuffer", this.mPowerStorageBuffer);
aNBT.setInteger("mPowerStorageMultiplier", this.mPowerStorageMultiplier);
aNBT.setLong("mActualStoredEU", this.mActualStoredEU);
aNBT.setInteger("mAverageEuUsage", this.mAverageEuUsage);
+
+ //Usage Stats
+ aNBT.setLong("mTotalEnergyAdded", this.mTotalEnergyAdded);
+ aNBT.setLong("mTotalEnergyLost", this.mTotalEnergyLost);
+ aNBT.setLong("mTotalEnergyConsumed", this.mTotalEnergyConsumed);
+ aNBT.setLong("mTotalRunTime", this.mTotalRunTime);
super.saveNBTData(aNBT);
}
@@ -334,6 +347,13 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
this.mPowerStorageMultiplier = aNBT.getInteger("mPowerStorageMultiplier");
this.mActualStoredEU = aNBT.getLong("mActualStoredEU");
this.mAverageEuUsage = aNBT.getInteger("mAverageEuUsage");
+
+ //Usage Stats
+ this.mTotalEnergyAdded = aNBT.getLong("mTotalEnergyAdded");
+ this.mTotalEnergyLost = aNBT.getLong("mTotalEnergyLost");
+ this.mTotalEnergyConsumed = aNBT.getLong("mTotalEnergyConsumed");
+ this.mTotalRunTime = aNBT.getLong("mTotalRunTime");
+
super.loadNBTData(aNBT);
}
@@ -345,14 +365,27 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
this.mActualStoredEU = this.getEUVar();
+
+ if (this.mActualStoredEU < 0){
+ this.mActualStoredEU = 0;
+ }
+ if (this.getEUVar() < 0){
+ this.setEUVar(0);
+ }
+ if (aBaseMetaTileEntity.isServerSide()){
+ this.mTotalRunTime++;
+ }
//Handle Progress Time
if (this.mActualStoredEU >= 0 && this.getBaseMetaTileEntity().isAllowedToWork()){
this.mProgresstime = 20;
this.mMaxProgresstime = 40;
//Use 10% of average EU determined by adding in/output voltage of all hatches and averaging.
- this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(MathUtils.roundToClosestInt(mAverageEuUsage/100), false);
+ int mDecrease = MathUtils.roundToClosestInt(mAverageEuUsage);
+ this.mTotalEnergyLost+=mDecrease;
+ this.setEUVar(this.getEUVar()-mDecrease);
+ //this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mDecrease, false);
}
else {
this.mProgresstime = 0;
@@ -367,11 +400,23 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
if (this.getBaseMetaTileEntity().isAllowedToWork()){
this.getBaseMetaTileEntity().enableWorking();
}
+ for (GT_MetaTileEntity_Hatch_OutputBattery energy : this.mDischargeHatches){
+ long stored = energy.getEUVar();
+ long voltage = energy.maxEUInput();
+ if (stored > 0){
+ energy.setEUVar((stored-voltage));
+ this.mTotalEnergyAdded+=voltage;
+ if (this.getBaseMetaTileEntity().increaseStoredEnergyUnits(voltage, false)){
+ //Utils.LOG_INFO("Draining Discharge Hatch #1");
+ }
+ }
+ }
for (GT_MetaTileEntity_Hatch_Energy energy : this.mEnergyHatches){
long stored = energy.getEUVar();
long voltage = energy.maxEUInput();
if (stored > 0){
energy.setEUVar((stored-voltage));
+ this.mTotalEnergyAdded+=voltage;
this.getBaseMetaTileEntity().increaseStoredEnergyUnits(voltage, false);
}
}
@@ -406,14 +451,28 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
public boolean drainEnergyInput(long aEU) {
if (aEU <= 0L)
return true;
+ long nStoredPower = this.getEUVar();
+ for (GT_MetaTileEntity_Hatch_OutputBattery tHatch : this.mDischargeHatches) {
+ if ((isValidMetaTileEntity(tHatch)) && (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false))){
+ if (this.mActualStoredEU<this.maxEUStore()){
+
+ }
+ Utils.LOG_INFO("Draining Discharge Hatch #2");
+ }
+ }
for (GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) {
if ((isValidMetaTileEntity(tHatch)) && (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false))){
if (this.mActualStoredEU<this.maxEUStore()){
//this.getBaseMetaTileEntity().increaseStoredEnergyUnits(aEU, false);
}
- return true;
}
+ }
+ long nNewStoredPower = this.getEUVar();
+ if (nNewStoredPower < nStoredPower){
+ Utils.LOG_ERROR("Used "+(nStoredPower-nNewStoredPower)+"eu.");
+ return true;
}
+
return false;
}
@@ -423,9 +482,22 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
return true;
long nStoredPower = this.getEUVar();
int hatchCount = 0;
+ //Utils.LOG_INFO("Charge Hatches: "+this.mChargeHatches.size());
+ for (GT_MetaTileEntity_Hatch_InputBattery tHatch : this.mChargeHatches) {
+ //Utils.LOG_INFO("Storing Power in a Charge Hatch");
+ if ((isValidMetaTileEntity(tHatch)) && (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(tHatch.maxEUInput(), false))) {
+ this.setEUVar(this.getEUVar()-(tHatch.maxEUInput()));
+ this.mTotalEnergyConsumed+=(tHatch.maxEUInput());
+ //this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(tHatch.getOutputTier()*2, false);
+ //Utils.LOG_INFO("Hatch "+hatchCount+" has "+tHatch.getEUVar()+"eu stored. Avg used is "+(this.mAverageEuUsage));
+ }
+ hatchCount++;
+ }
for (GT_MetaTileEntity_Hatch_Dynamo tHatch : this.mDynamoHatches) {
+ //Utils.LOG_INFO("Storing Power in a Dynamo Hatch");
if ((isValidMetaTileEntity(tHatch)) && (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(tHatch.getOutputTier()*2, false))) {
this.setEUVar(this.getEUVar()-(tHatch.getOutputTier()*2));
+ this.mTotalEnergyConsumed+=(tHatch.getOutputTier()*2);
//this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(tHatch.getOutputTier()*2, false);
//Utils.LOG_INFO("Hatch "+hatchCount+" has "+tHatch.getEUVar()+"eu stored. Avg used is "+(this.mAverageEuUsage));
}
@@ -449,4 +521,42 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
return 0;
}
+ //mAverageEuUsage
+
+ @Override
+ public String[] getInfoData() {
+
+ long seconds = (this.mTotalRunTime/20);
+
+ int weeks = (int) (TimeUnit.SECONDS.toDays(seconds) / 7);
+ int days = (int) (TimeUnit.SECONDS.toDays(seconds) - 7 * weeks);
+ long hours = TimeUnit.SECONDS.toHours(seconds) - TimeUnit.DAYS.toHours(days) - TimeUnit.DAYS.toHours(7*weeks);
+ long minutes = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
+ long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60);
+
+
+
+ return new String[]{
+ "Ergon Energy - District Sub-Station",
+ "EU Required: "+this.mAverageEuUsage+"EU/t",
+ "Stats for Nerds",
+ "Total Input: "+this.mTotalEnergyAdded+"EU",
+ "Total Output: "+this.mTotalEnergyConsumed+"EU",
+ "Total Wasted: "+this.mTotalEnergyLost+"EU",
+
+ "Total Time Since Build: ",
+ ""+weeks+" Weeks.",
+ ""+days+" Days.",
+ ""+hours+" Hours.",
+ ""+minutes+" Minutes.",
+ ""+second+" Seconds.",
+ "Total Time in ticks: "+this.mTotalRunTime};
+
+ };
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java
index 7d1fcee1e4..1c5930537e 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java
@@ -45,7 +45,6 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc
"1x Maintenance Hatch (One of base platform)",
"1x ZPM or better Muffler (One of base platform)",
"1x Energy Hatch (One of base platform)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip
};
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java
index f43aae74b6..c596bf0a4c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java
@@ -35,6 +35,14 @@ public class RecipeGen_AlloySmelter implements Runnable{
material.getGear(1),
(int) Math.max(material.getMass() * 2L, 1L),
2 * tVoltageMultiplier);
+
+ //Ingot
+ GT_Values.RA.addAlloySmelterRecipe(
+ material.getNugget(9),
+ ItemList.Shape_Mold_Ingot.get(1),
+ material.getIngot(1),
+ (int) Math.max(material.getMass() * 2L, 1L),
+ 2 * tVoltageMultiplier);
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java
index d66649850a..6d1da0881e 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java
@@ -4,13 +4,19 @@ import java.util.ArrayList;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
+import gtPlusPlus.core.item.ModItems;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.material.*;
+import gtPlusPlus.core.material.ALLOY;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.material.MaterialStack;
import gtPlusPlus.core.material.nuclear.FLUORIDES;
import gtPlusPlus.core.material.nuclear.NUCLIDE;
+import gtPlusPlus.core.material.state.MaterialState;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.fluid.FluidUtils;
import gtPlusPlus.core.util.item.ItemUtils;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
public class RecipeGen_BlastSmelter implements Runnable{
@@ -87,10 +93,10 @@ public class RecipeGen_BlastSmelter implements Runnable{
}
if (duration <= 0){
- int second = 20;
+ final int second = 20;
duration = 14*second*mMaterialListSize;
}
-
+
Utils.LOG_WARNING("[BAS] Size: "+mMaterialListSize);
@@ -125,7 +131,7 @@ public class RecipeGen_BlastSmelter implements Runnable{
}
if (GT_Values.RA.addFluidExtractionRecipe(M.getTinyDust(1), null, M.getFluid(16), 100, duration/9, 120)){
Utils.LOG_WARNING("[BAS] Success, Also added a Fluid Extractor recipe.");
- }
+ }
}
}
else {
@@ -189,11 +195,21 @@ public class RecipeGen_BlastSmelter implements Runnable{
//Builds me an ItemStack[] of the materials. - Without a circuit - this gets a good count for the 144L fluid multiplier
components = new ItemStack[9];
inputStackCount=0;
+ FluidStack componentsFluid = null;
for (int irc=0;irc<M.getComposites().size();irc++){
if (M.getComposites().get(irc) != null){
final int r = (int) M.vSmallestRatio[irc];
inputStackCount = inputStackCount+r;
- components[irc] = M.getComposites().get(irc).getDustStack(r);
+ if ((M.getComposites().get(irc).getStackMaterial().getState() != MaterialState.SOLID) && ((M.getComposites().get(irc).getDustStack(r) == null) || (M.getComposites().get(irc).getDustStack(r) == ItemUtils.getSimpleStack(ModItems.AAA_Broken)))){
+ final int xr = M.getComposites().get(irc).getPartsPerOneHundred();
+ if ((xr > 0) && (xr <= 100)){
+ final int mathmatics = (xr <= 10 ? 1000 : ((xr/10)*1000));
+ componentsFluid = FluidUtils.getFluidStack(M.getComposites().get(irc).getStackMaterial().getFluid(mathmatics), mathmatics);
+ }
+ }
+ else {
+ components[irc] = M.getComposites().get(irc).getDustStack(r);
+ }
}
}
@@ -230,7 +246,7 @@ public class RecipeGen_BlastSmelter implements Runnable{
//Adds Recipe
if (M.requiresBlastFurnace()) {
- if (CORE.RA.addBlastSmelterRecipe(components, M.getFluid(fluidAmount), 100, duration, 500)){
+ if (CORE.RA.addBlastSmelterRecipe(components, componentsFluid, M.getFluid(fluidAmount), 100, duration, 500)){
Utils.LOG_WARNING("[BAS] Success.");
}
else {
@@ -238,7 +254,7 @@ public class RecipeGen_BlastSmelter implements Runnable{
}
}
else {
- if (CORE.RA.addBlastSmelterRecipe(components, M.getFluid(fluidAmount), 100, duration, 240)){
+ if (CORE.RA.addBlastSmelterRecipe(components, componentsFluid, M.getFluid(fluidAmount), 100, duration, 240)){
Utils.LOG_WARNING("[BAS] Success.");
}
else {
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java
index a8a4cf963f..46bf36c445 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java
@@ -177,7 +177,7 @@ public class RecipeGen_DustGeneration implements Runnable{
//Add Shapeless recipe for low tier alloys.
if (tVoltageMultiplier <= 30){
if (RecipeUtils.addShapedGregtechRecipe(inputStacks, outputStacks)){
- Utils.LOG_INFO("Dust Shapeless Recipe: "+material.getLocalizedName()+" - Success");
+ Utils.LOG_INFO("Dust Shapeless Recipe: "+material.getLocalizedName()+" - Success");
}
else {
Utils.LOG_INFO("Dust Shapeless Recipe: "+material.getLocalizedName()+" - Failed");
@@ -194,7 +194,7 @@ public class RecipeGen_DustGeneration implements Runnable{
}
- public static boolean addMixerRecipe_Standalone(Material material){
+ public static boolean addMixerRecipe_Standalone(final Material material){
final ItemStack[] inputStacks = material.getMaterialComposites();
final ItemStack outputStacks = material.getDust(material.smallestStackSizeWhenProcessing);
//Is this a composite?
@@ -264,14 +264,14 @@ public class RecipeGen_DustGeneration implements Runnable{
}
else {
Utils.LOG_INFO("inputStackSize == NUll - "+material.getLocalizedName());
- }
+ }
}
else {
Utils.LOG_INFO("InputStacks is out range 1-4 - "+material.getLocalizedName());
- }
+ }
}
else {
- Utils.LOG_INFO("InputStacks == NUll - "+material.getLocalizedName());
+ Utils.LOG_INFO("InputStacks == NUll - "+material.getLocalizedName());
}
return false;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java
new file mode 100644
index 0000000000..cf48516354
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java
@@ -0,0 +1,197 @@
+package gtPlusPlus.xmod.gregtech.loaders;
+
+import static gregtech.api.enums.GT_Values.M;
+
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.apache.commons.lang3.reflect.FieldUtils;
+
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.item.ModItems;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.item.ItemUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import net.minecraft.item.ItemStack;
+
+public class RecipeGen_Recycling implements Runnable{
+
+ final Material toGenerate;
+ static Map mNameMap;
+
+ public RecipeGen_Recycling(final Material M){
+ this.toGenerate = M;
+ mNameMap = this.getNameMap();
+ }
+
+ @Override
+ public void run() {
+ generateRecipes(this.toGenerate);
+ }
+
+ public static void generateRecipes(final Material material){
+
+ Utils.LOG_INFO("Generating Recycling recipes for "+material.getLocalizedName());
+
+ final OrePrefixes[] mValidPrefixesAsString = {
+ OrePrefixes.ingot,
+ OrePrefixes.ingotHot,
+ OrePrefixes.nugget,
+ OrePrefixes.plate,
+ OrePrefixes.plateDense,
+ OrePrefixes.plateDouble,
+ OrePrefixes.plateTriple,
+ OrePrefixes.plateQuadruple,
+ OrePrefixes.plateQuintuple,
+ OrePrefixes.stick,
+ OrePrefixes.stickLong,
+ OrePrefixes.bolt,
+ OrePrefixes.screw,
+ OrePrefixes.ring,
+ OrePrefixes.rotor,
+ OrePrefixes.gearGt,
+ OrePrefixes.gearGtSmall
+ };
+
+ Utils.LOG_INFO("Found "+mValidPrefixesAsString.length+" valid OreDict prefixes.");
+ if (mValidPrefixesAsString.length >= 1){
+ for (final OrePrefixes validPrefix : mValidPrefixesAsString){
+
+ try {
+ final ItemStack tempStack = ItemUtils.getItemStackOfAmountFromOreDict(validPrefix+material.getLocalizedName(), 1);
+
+ if ((tempStack != null) && (tempStack != ItemUtils.getSimpleStack(ModItems.AAA_Broken))){
+ //mValidItems[mSlotIndex++] = tempStack;
+ final ItemStack mDust = getDust(material, validPrefix);
+ if ((mDust != null) && GT_ModHandler.addPulverisationRecipe(tempStack, mDust)){
+ Utils.LOG_INFO("Recycle Recipe: "+material.getLocalizedName()+" - Success - Recycle "+tempStack.getDisplayName()+" and obtain "+mDust.getDisplayName());
+ }
+ else {
+ Utils.LOG_INFO("Recycle Recipe: "+material.getLocalizedName()+" - Failed");
+ if (mDust == null){
+ Utils.LOG_INFO("Invalid Dust output.");
+ }
+ }
+ }
+ } catch (final Throwable t){
+ t.printStackTrace();
+ Utils.LOG_INFO("Returning Null. Throwable Info: "+t.getMessage());
+ Utils.LOG_INFO("Throwable Info: "+t.toString());
+ Utils.LOG_INFO("Throwable Info: "+t.getCause().toString());
+
+ }
+
+ }
+ }
+ }
+
+
+
+ public static ItemStack getDust(final Material aMaterial, final OrePrefixes aPrefix) {
+ return aMaterial == null ? null : getDust(aMaterial, aPrefix.mMaterialAmount);
+ }
+
+ public static ItemStack getDust(final Material aMaterial, final long aMaterialAmount) {
+ if (aMaterialAmount <= 0) {
+ return null;
+ }
+ ItemStack rStack = null;
+ if ((((aMaterialAmount % M) == 0) || (aMaterialAmount >= (M * 16)))) {
+ rStack = get(OrePrefixes.dust, aMaterial, aMaterialAmount / M);
+ }
+ if ((rStack == null) && ((((aMaterialAmount * 4) % M) == 0) || (aMaterialAmount >= (M * 8)))) {
+ rStack = get(OrePrefixes.dustSmall, aMaterial, (aMaterialAmount * 4) / M);
+ }
+ if ((rStack == null) && (((aMaterialAmount * 9) >= M))) {
+ rStack = get(OrePrefixes.dustTiny, aMaterial, (aMaterialAmount * 9) / M);
+ }
+ if (rStack == null){
+ Utils.LOG_INFO("Returning Null. Method: "+ReflectionUtils.getMethodName(0));
+ Utils.LOG_INFO("Called from method: "+ReflectionUtils.getMethodName(1));
+ Utils.LOG_INFO("Called from method: "+ReflectionUtils.getMethodName(2));
+ }
+
+ return rStack;
+ }
+
+ public static ItemStack get(final Object aName, final long aAmount) {
+ return get(aName, null, aAmount, true, true);
+ }
+
+ public static ItemStack get(final Object aName, final ItemStack aReplacement, final long aAmount) {
+ return get(aName, aReplacement, aAmount, true, true);
+ }
+
+ public static ItemStack get(final OrePrefixes aPrefix, final Object aMaterial, final long aAmount) {
+ return get(aPrefix, aMaterial, null, aAmount);
+ }
+
+ public static ItemStack get(final OrePrefixes aPrefix, final Object aMaterial, final ItemStack aReplacement,
+ final long aAmount) {
+ if (OrePrefixes.mPreventableComponents.contains(aPrefix) && aPrefix.mDisabledItems.contains(aMaterial)) {
+ return aReplacement;
+ }
+ return get(aPrefix.get(aMaterial), aReplacement, aAmount, false, true);
+ }
+
+ public static ItemStack get(final Object aName, final ItemStack aReplacement, final long aAmount,
+ final boolean aMentionPossibleTypos, final boolean aNoInvalidAmounts) {
+ if (aNoInvalidAmounts && (aAmount < 1L)) {
+ Utils.LOG_INFO("Returning Null. Method: "+ReflectionUtils.getMethodName(0));
+ Utils.LOG_INFO("Called from method: "+ReflectionUtils.getMethodName(1));
+ Utils.LOG_INFO("Called from method: "+ReflectionUtils.getMethodName(2));
+ return null;
+ }
+ if (!mNameMap.containsKey(aName.toString()) && aMentionPossibleTypos) {
+ Utils.LOG_INFO("Unknown Key for Unification, Typo? " + aName);
+ }
+ return GT_Utility.copyAmount(aAmount, new Object[]{mNameMap.get(aName.toString()),
+ getFirstOre(aName, aAmount), aReplacement});
+ }
+
+
+ public static ItemStack getFirstOre(final Object aName, final long aAmount) {
+ if (GT_Utility.isStringInvalid(aName)) {
+ Utils.LOG_INFO("Returning Null. Method: "+ReflectionUtils.getMethodName(0));
+ Utils.LOG_INFO("Called from method: "+ReflectionUtils.getMethodName(1));
+ Utils.LOG_INFO("Called from method: "+ReflectionUtils.getMethodName(2));
+ return null;
+ }
+ final ItemStack tStack = (ItemStack) mNameMap.get(aName.toString());
+ if (GT_Utility.isStackValid(tStack)) {
+ return GT_Utility.copyAmount(aAmount, new Object[]{tStack});
+ }
+ return GT_Utility.copyAmount(aAmount, getOres(aName).toArray());
+ }
+
+ public static ArrayList<ItemStack> getOres(final Object aOreName) {
+ final String aName = (aOreName == null) ? "" : aOreName.toString();
+ final ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ if (GT_Utility.isStringValid(aName)) {
+ rList.addAll(getOres(aName));
+ }
+ return rList;
+ }
+
+ public Map getNameMap(){
+ Map<String, ItemStack> tempMap;
+ try {
+ tempMap = (Map<String, ItemStack>) FieldUtils.readStaticField(GT_OreDictUnificator.class, "sName2StackMap", true);
+ if (tempMap != null){
+ return tempMap;
+ }
+ }
+ catch (final IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ Utils.LOG_INFO("Invalid map stored in GT_OreDictUnificator.class, unable to find sName2StackMap field.");
+ return null;
+ }
+
+
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java
index 6c25b697a2..79ff583607 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java
@@ -23,8 +23,24 @@ public class RecipeGen_ShapedCrafting implements Runnable{
public static void generateRecipes(final Material material){
Utils.LOG_WARNING("Generating Shaped Crafting recipes for "+material.getLocalizedName()); //TODO
+
+ //Nuggets
+ GT_ModHandler.addShapelessCraftingRecipe(
+ material.getIngot(1),
+ new Object[]{
+ material.getNugget(1),
+ material.getNugget(1),
+ material.getNugget(1),
+ material.getNugget(1),
+ material.getNugget(1),
+ material.getNugget(1),
+ material.getNugget(1),
+ material.getNugget(1),
+ material.getNugget(1)
+ });
+
//Plates
-
+
//Single Plate Shaped/Shapeless
GT_ModHandler.addCraftingRecipe(
material.getPlate(1),
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCuttingFactory.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCuttingFactory.java
new file mode 100644
index 0000000000..11d8b400d0
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCuttingFactory.java
@@ -0,0 +1,25 @@
+package gtPlusPlus.xmod.gregtech.registration.gregtech;
+
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntity_IndustrialCuttingMachine;
+
+public class GregtechIndustrialCuttingFactory {
+
+ public static void run() {
+ if (gtPlusPlus.core.lib.LoadedMods.Gregtech) {
+ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Cutting Factory Multiblock.");
+ if (CORE.configSwitches.enableMultiblock_IndustrialCuttingMachine) {
+ run1();
+ }
+ }
+ }
+
+ private static void run1() {
+ // Industrial Wire Factory Multiblock
+ GregtechItemList.Industrial_CuttingFactoryController.set(new GregtechMetaTileEntity_IndustrialCuttingMachine(992,
+ "industrialcuttingmachine.controller.tier.01", "Cutting Factory Controller").getStackForm(1L));
+
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialGeneratorArray.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialGeneratorArray.java
new file mode 100644
index 0000000000..b0b91af528
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialGeneratorArray.java
@@ -0,0 +1,26 @@
+package gtPlusPlus.xmod.gregtech.registration.gregtech;
+
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntityGeneratorArray;
+
+public class GregtechIndustrialGeneratorArray {
+
+ public static void run() {
+ if (gtPlusPlus.core.lib.LoadedMods.Gregtech) {
+ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Generator Array Multiblock.");
+ //if (CORE.configSwitches.enableMultiblock_IndustrialSifter) { // TODO
+ run1();
+ //}
+ }
+
+ }
+
+ private static void run1() {
+ // Industrial Maceration Stack Multiblock
+ GregtechItemList.Generator_Array_Controller.set(new GregtechMetaTileEntityGeneratorArray(
+ 990,
+ "generatorarray.controller.tier.01",
+ "Large Generator Array").getStackForm(1L));
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechMiniRaFusion.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechMiniRaFusion.java
new file mode 100644
index 0000000000..d48815e563
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechMiniRaFusion.java
@@ -0,0 +1,61 @@
+package gtPlusPlus.xmod.gregtech.registration.gregtech;
+
+import java.util.Collection;
+
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.Recipe_GT;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.fluid.FluidUtils;
+import gtPlusPlus.core.util.item.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntity_BasicWasher;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntity_CompactFusionReactor;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMiniRaFusion {
+
+ public static void run() {
+ //if (CORE.configSwitches.enableMachine_SimpleWasher){
+ generateSlowFusionRecipes();
+ // Register the Simple Fusion Entity.
+ GregtechItemList.Miniature_Fusion
+ .set(new GregtechMetaTileEntity_CompactFusionReactor(993, "simplefusion.tier.00", "Ra, Sun God - Mk I", 6)
+ .getStackForm(1L));
+ //}
+ }
+
+ private static boolean generateSlowFusionRecipes(){
+ int mRecipeCount = 0;
+ GT_Recipe_Map r = GT_Recipe.GT_Recipe_Map.sFusionRecipes;
+ final Collection<GT_Recipe> x = r.mRecipeList;
+ Utils.LOG_INFO("Dumping " + r.mUnlocalizedName + " Recipes for Debug.");
+ for (final GT_Recipe newBo : x) {
+ if (Recipe_GT.Gregtech_Recipe_Map.sSlowFusionRecipes.addRecipe(
+ true,
+ newBo.mInputs,
+ newBo.mOutputs,
+ newBo.mSpecialItems,
+ newBo.mFluidInputs.clone(), //Fluid In
+ newBo.mFluidOutputs.clone(), //Fluid Out
+ newBo.mDuration*4, //Duration
+ newBo.mEUt, //Eu
+ newBo.mSpecialValue //Special
+ ) != null){
+ mRecipeCount++;
+ }
+ }
+
+
+
+ if (Recipe_GT.Gregtech_Recipe_Map.sSlowFusionRecipes.mRecipeList.size() > mRecipeCount){
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java
index 82cbf685ad..ac23c316a2 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java
@@ -1,8 +1,15 @@
package gtPlusPlus.xmod.gregtech.registration.gregtech;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.OreDictNames;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.util.GT_ModHandler;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntity_PowerSubStationController;
public class GregtechPowerSubStation {
@@ -21,6 +28,17 @@ public class GregtechPowerSubStation {
// Steam Condensors
GregtechItemList.PowerSubStation.set(new GregtechMetaTileEntity_PowerSubStationController(812,
"substation.01.input.single", "Power Station Control Node").getStackForm(1L));
+ int tID = 886;
+ GregtechItemList.Hatch_Input_Battery_MV.set(new GT_MetaTileEntity_Hatch_InputBattery(tID++, "hatch.input_battery.tier.00", "Charging Bus (MV)", 2).getStackForm(1L));
+ GregtechItemList.Hatch_Input_Battery_EV.set(new GT_MetaTileEntity_Hatch_InputBattery(tID++, "hatch.input_battery.tier.01", "Charging Bus (EV)", 4).getStackForm(1L));
+ GregtechItemList.Hatch_Output_Battery_MV.set(new GT_MetaTileEntity_Hatch_OutputBattery(tID++, "hatch.output_battery.tier.00", "Discharging Bus (MV)", 2).getStackForm(1L));
+ GregtechItemList.Hatch_Output_Battery_EV.set(new GT_MetaTileEntity_Hatch_OutputBattery(tID++, "hatch.output_battery.tier.01", "Discharging Bus (EV)", 4).getStackForm(1L));
+
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Input_Battery_MV.get(1L, new Object[0]), CI.bitsd, new Object[]{"C", "M", 'M', ItemList.Hull_MV, 'C', ItemList.Battery_Buffer_2by2_MV});
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Input_Battery_EV.get(1L, new Object[0]), CI.bitsd, new Object[]{"C", "M", 'M', ItemList.Hull_EV, 'C', ItemList.Battery_Buffer_4by4_EV});
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Output_Battery_MV.get(1L, new Object[0]), CI.bitsd, new Object[]{"M", "C", 'M', ItemList.Hull_MV, 'C', ItemList.Battery_Buffer_2by2_MV});
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Output_Battery_EV.get(1L, new Object[0]), CI.bitsd, new Object[]{"M", "C", 'M', ItemList.Hull_EV, 'C', ItemList.Battery_Buffer_4by4_EV});
+
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRTG.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRTG.java
index 4d3738f585..954f652b40 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRTG.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRTG.java
@@ -15,7 +15,7 @@ public class GregtechRTG {
private static void run1() {
GregtechItemList.RTG.set(
- new GregtechMetaTileEntity_RTG(869, "rtg.01.tier.single", "Radioisotope Thermoelectric Generator", 3)
+ new GregtechMetaTileEntity_RTG(869, "basicgenerator.rtg.tier.01", "Radioisotope Thermoelectric Generator", 3)
.getStackForm(1L));
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java
index 87da39b54b..d8d73f9052 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java
@@ -15,25 +15,54 @@ public class GregtechSimpleWasher {
public static void run() {
if (CORE.configSwitches.enableMachine_SimpleWasher){
-
- // Generate Recipe Map for the Dust Washer.
- ItemStack dustClean;
- ItemStack dustDirty;
- for (Materials v : Materials.values()) {
- dustClean = GT_OreDictUnificator.get(OrePrefixes.dust, v, 1L);
- dustDirty = GT_OreDictUnificator.get(OrePrefixes.dustImpure, v, 1L);
- if (dustClean != null && dustDirty != null) {
- Recipe_GT.Gregtech_Recipe_Map.sSimpleWasherRecipes.addRecipe(false, new ItemStack[] { dustDirty },
- new ItemStack[] { dustClean }, null,
- new FluidStack[] { FluidUtils.getFluidStack("water", 100) }, null, 20, 8, 0);
- }
- }
-
+ generateDirtyDustRecipes();
+ generateDirtyCrushedRecipes();
// Register the Simple Washer Entity.
GregtechItemList.SimpleDustWasher
.set(new GregtechMetaTileEntity_BasicWasher(767, "simplewasher.01.tier.00", "Simple Washer", 0)
.getStackForm(1L));
+ }
+ }
+
+ private static boolean generateDirtyDustRecipes(){
+ int mRecipeCount = 0;
+ // Generate Recipe Map for the Dust Washer.
+ ItemStack dustClean;
+ ItemStack dustDirty;
+ for (Materials v : Materials.values()) {
+ dustClean = GT_OreDictUnificator.get(OrePrefixes.dust, v, 1L);
+ dustDirty = GT_OreDictUnificator.get(OrePrefixes.dustImpure, v, 1L);
+ if (dustClean != null && dustDirty != null) {
+ Recipe_GT.Gregtech_Recipe_Map.sSimpleWasherRecipes.addRecipe(false, new ItemStack[] { dustDirty },
+ new ItemStack[] { dustClean }, null,
+ new FluidStack[] { FluidUtils.getFluidStack("water", 100) }, null, 20, 8, 0);
+ }
+ }
+
+ if (Recipe_GT.Gregtech_Recipe_Map.sSimpleWasherRecipes.mRecipeList.size() > mRecipeCount){
+ return true;
+ }
+ return false;
+ }
+
+ private static boolean generateDirtyCrushedRecipes(){
+ int mRecipeCount = Recipe_GT.Gregtech_Recipe_Map.sSimpleWasherRecipes.mRecipeList.size();
+ // Generate Recipe Map for the Dust Washer.
+ ItemStack crushedClean;
+ ItemStack crushedDirty;
+ for (Materials v : Materials.values()) {
+ crushedClean = GT_OreDictUnificator.get(OrePrefixes.crushedPurified, v, 1L);
+ crushedDirty = GT_OreDictUnificator.get(OrePrefixes.crushed, v, 1L);
+ if (crushedClean != null && crushedDirty != null) {
+ Recipe_GT.Gregtech_Recipe_Map.sSimpleWasherRecipes.addRecipe(false, new ItemStack[] { crushedDirty },
+ new ItemStack[] { crushedClean }, null,
+ new FluidStack[] { FluidUtils.getFluidStack("water", 100) }, null, 20, 8, 0);
+ }
+ }
+ if (Recipe_GT.Gregtech_Recipe_Map.sSimpleWasherRecipes.mRecipeList.size() > mRecipeCount){
+ return true;
}
+ return false;
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechWirelessChargers.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechWirelessChargers.java
new file mode 100644
index 0000000000..48d516e4cf
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechWirelessChargers.java
@@ -0,0 +1,49 @@
+package gtPlusPlus.xmod.gregtech.registration.gregtech;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import gregtech.api.util.GT_ModHandler;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaWirelessCharger;
+import net.minecraftforge.common.MinecraftForge;
+
+public class GregtechWirelessChargers {
+
+
+ public static void run(){
+
+ if (gtPlusPlus.core.lib.LoadedMods.Gregtech) {
+ Utils.LOG_INFO("Gregtech5u Content | Registering Wireless Chargers.");
+
+
+ long bitsd = GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE
+ | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED;
+ int mID = 890;
+
+ FMLCommonHandler.instance().bus().register(new ChargingHelper());
+ MinecraftForge.EVENT_BUS.register(new ChargingHelper());
+
+ GregtechItemList.Charger_LV.set(new GregtechMetaWirelessCharger(mID++, "wificharger.01.tier.single",
+ "Wireless Charger MK I", 1, "Hopefully won't give you cancer.", 0).getStackForm(1L));
+ GregtechItemList.Charger_MV.set(new GregtechMetaWirelessCharger(mID++, "wificharger.02.tier.single",
+ "Wireless Charger MK II", 2, "Hopefully won't give you cancer.", 0).getStackForm(1L));
+ GregtechItemList.Charger_HV.set(new GregtechMetaWirelessCharger(mID++, "wificharger.03.tier.single",
+ "Wireless Charger MK III", 3, "Hopefully won't give you cancer.", 0).getStackForm(1L));
+ GregtechItemList.Charger_EV.set(new GregtechMetaWirelessCharger(mID++, "wificharger.04.tier.single",
+ "Wireless Charger MK IV", 4, "Hopefully won't give you cancer.", 0).getStackForm(1L));
+ GregtechItemList.Charger_IV.set(new GregtechMetaWirelessCharger(mID++, "wificharger.05.tier.single",
+ "Wireless Charger MK V", 5, "Hopefully won't give you cancer.", 0).getStackForm(1L));
+ GregtechItemList.Charger_LuV.set(new GregtechMetaWirelessCharger(mID++, "wificharger.06.tier.single",
+ "Wireless Charger MK VI", 6, "Hopefully won't give you cancer.", 0).getStackForm(1L));
+ GregtechItemList.Charger_ZPM.set(new GregtechMetaWirelessCharger(mID++, "wificharger.07.tier.single",
+ "Wireless Charger MK VII", 7, "Hopefully won't give you cancer.", 0).getStackForm(1L));
+ GregtechItemList.Charger_UV.set(new GregtechMetaWirelessCharger(mID++, "wificharger.08.tier.single",
+ "Wireless Charger MK VIII", 8, "Hopefully won't give you cancer.", 0).getStackForm(1L));
+ GregtechItemList.Charger_MAX.set(new GregtechMetaWirelessCharger(mID++, "wificharger.09.tier.single",
+ "Wireless Charger MK IX", 9, "Hopefully won't give you cancer.", 0).getStackForm(1L));
+
+ }
+ }
+
+}