aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/gregtech/api/util/GTPP_Recipe.java3
-rw-r--r--src/main/java/gtPlusPlus/core/util/minecraft/RecipeUtils.java14
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java61
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java82
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DataHatch.java41
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java34
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java57
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java30
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java567
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElementDuplicator.java2
-rw-r--r--src/main/resources/assets/gregtech/lang/en_US.lang2
-rw-r--r--src/main/resources/assets/gregtech/textures/gui/HatchDataOrb.pngbin0 -> 2831 bytes
12 files changed, 749 insertions, 144 deletions
diff --git a/src/main/java/gregtech/api/util/GTPP_Recipe.java b/src/main/java/gregtech/api/util/GTPP_Recipe.java
index 8fde47ad80..0b081adec4 100644
--- a/src/main/java/gregtech/api/util/GTPP_Recipe.java
+++ b/src/main/java/gregtech/api/util/GTPP_Recipe.java
@@ -364,6 +364,9 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe {
//Molecular Transformer Map
public static final GTPP_Recipe_Map_Internal sMolecularTransformerRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(3), "gtpp.recipe.moleculartransformer", "Molecular Transformer", null, RES_PATH_GUI + "basicmachines/Scanner", 1, 1, 0, 0, 1, E, 1, E, true, true);
+ //Elemental Duplicator Map
+ public static final GTPP_Recipe_Map_Internal sElementalDuplicatorRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(3), "gtpp.recipe.elementaldupe", "Elemental Duplicator", null, RES_PATH_GUI + "basicmachines/Replicator", 1, 1, 0, 1, 1, E, 1, E, true, false);
+
//public static final GT_Recipe_Map sSimpleWasherRecipes_FakeFuckBW = new GT_Recipe_Map(new HashSet<GT_Recipe>(3), "gtpp.recipe.simplewasher", "Fuck you Bart", null, RES_PATH_GUI + "basicmachines/PotionBrewer", 1, 1, 0, 0, 1, E, 1, E, true, false);
diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/RecipeUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/RecipeUtils.java
index da5bc071bc..595635d411 100644
--- a/src/main/java/gtPlusPlus/core/util/minecraft/RecipeUtils.java
+++ b/src/main/java/gtPlusPlus/core/util/minecraft/RecipeUtils.java
@@ -703,14 +703,14 @@ public static int mInvalidID = 1;
CORE.crash("Bad Shaped Recipe.");
}
}
- Logger.INFO("Using String: "+aFullString);
+ Logger.RECIPE("Using String: "+aFullString);
String aRow1 = aFullString.substring(0, 3);
String aRow2 = aFullString.substring(3, 6);
String aRow3 = aFullString.substring(6, 9);
- Logger.INFO(""+aRow1);
- Logger.INFO(""+aRow2);
- Logger.INFO(""+aRow3);
+ Logger.RECIPE(""+aRow1);
+ Logger.RECIPE(""+aRow2);
+ Logger.RECIPE(""+aRow3);
String[] aStringData = new String[] {aRow1, aRow2, aRow3};
Object[] aDataObject = new Object[19];
@@ -730,10 +730,10 @@ public static int mInvalidID = 1;
aIndex++;
}
- Logger.INFO("Data Size: "+aDataObject.length);
+ Logger.RECIPE("Data Size: "+aDataObject.length);
aDataObject = ArrayUtils.removeNulls(aDataObject);
- Logger.INFO("Clean Size: "+aDataObject.length);
- Logger.INFO("ArrayData: "+Arrays.toString(aDataObject));
+ Logger.RECIPE("Clean Size: "+aDataObject.length);
+ Logger.RECIPE("ArrayData: "+Arrays.toString(aDataObject));
ShapedOreRecipe aRecipe = new ShapedOreRecipe(aOutputStack, aDataObject);
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java
index 7396915483..d42ea35a78 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java
@@ -9,17 +9,22 @@ import java.util.List;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.Element;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map;
import gregtech.api.util.GT_Config;
import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_ModHandler.RecipeBits;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import gregtech.common.items.GT_MetaGenerated_Tool_01;
+import gregtech.common.items.behaviors.Behaviour_DataOrb;
import gtPlusPlus.api.helpers.GregtechPlusPlus_API.Multiblock_API;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
@@ -50,6 +55,7 @@ import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
import gtPlusPlus.xmod.gregtech.common.StaticFields59;
import gtPlusPlus.xmod.gregtech.common.blocks.fluid.GregtechFluidHandler;
import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMTE_ElementalDuplicator;
import gtPlusPlus.xmod.gregtech.loaders.Gregtech_Blocks;
import gtPlusPlus.xmod.gregtech.loaders.ProcessingAngleGrinder;
import gtPlusPlus.xmod.gregtech.loaders.ProcessingElectricButcherKnife;
@@ -64,6 +70,7 @@ import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechNitroDieselFix;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
public class HANDLER_GT {
@@ -167,6 +174,7 @@ public class HANDLER_GT {
}
RecipesToRemove.go();
convertPyroToCokeOven();
+ generateElementalDuplicatorRecipes();
Meta_GT_Proxy.fixIC2FluidNames();
RecipeLoader_AlgaeFarm.generateRecipes();
if (LoadedMods.AdvancedSolarPanel) {
@@ -181,6 +189,59 @@ public class HANDLER_GT {
}
}
+
+ private static void generateElementalDuplicatorRecipes() {
+ for (GT_Recipe aRecipe : GT_Recipe_Map.sReplicatorFakeRecipes.mRecipeList) {
+ Object aDataOrb = aRecipe.mSpecialItems;
+ if (aDataOrb != null) {
+ ItemStack aOutput = aRecipe.mOutputs[0];
+ if (aOutput != null) {
+ FluidStack aFluid = aRecipe.mFluidInputs[0];
+ if (aFluid != null && aFluid.amount > 0) {
+ ItemStack tDataOrb = GregtechMTE_ElementalDuplicator.getSpecialSlotStack(aRecipe);
+ Materials tMaterial = Element.get(Behaviour_DataOrb.getDataName(tDataOrb)).mLinkedMaterials.get(0);
+ FluidStack aOutputFluid = null;
+ ItemStack aOutputItem = null;
+ if (tMaterial != null) {
+ boolean aUsingFluid = false;
+ if ((aOutputItem = GT_OreDictUnificator.get(OrePrefixes.dust, tMaterial, 1L)) == null) {
+ if ((aOutputItem = GT_OreDictUnificator.get(OrePrefixes.cell, tMaterial, 1L)) != null) {
+ aOutputFluid = GT_Utility.getFluidForFilledItem(aOutputItem, true);
+ aUsingFluid = true;
+ }
+ }
+ GTPP_Recipe aNewRecipe = new GTPP_Recipe(
+ false,
+ new ItemStack[] {},
+ new ItemStack[] {!aUsingFluid ? aOutputItem : null},
+ aRecipe.mSpecialItems,
+ null,
+ aRecipe.mFluidInputs,
+ new FluidStack[] {aUsingFluid ? aOutputFluid : null},
+ aRecipe.mDuration,
+ aRecipe.mEUt,
+ aRecipe.mFluidInputs[0].amount);
+ GTPP_Recipe_Map.sElementalDuplicatorRecipes.add(aNewRecipe);
+
+ Logger.INFO("[EM] Generated recipe for "+tMaterial.mLocalizedName+", Outputs "+(aUsingFluid ? "Fluid" : "Dust"));
+ }
+ }
+ else {
+ Logger.INFO("[EM] Bad UU Requirement. "+RecipeUtils.getRecipeInfo(aRecipe));
+ }
+ }
+ else {
+ Logger.INFO("[EM] Bad Output. "+RecipeUtils.getRecipeInfo(aRecipe));
+ }
+ }
+ else {
+ Logger.INFO("[EM] Bad Data Orb. "+RecipeUtils.getRecipeInfo(aRecipe));
+ }
+ }
+ int aSize = GTPP_Recipe_Map.sElementalDuplicatorRecipes.mRecipeList.size();
+ Logger.INFO("[EM] Generated "+aSize+"/"+GT_Recipe_Map.sReplicatorFakeRecipes.mRecipeList.size()+" Replicator recipes.");
+ }
+
private static void convertPyroToCokeOven() {
if (ReflectionUtils.doesFieldExist(GT_Recipe.GT_Recipe_Map.class, "sPyrolyseRecipes")) {
int aCount = 0;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java
new file mode 100644
index 0000000000..fe100955e0
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java
@@ -0,0 +1,82 @@
+package gtPlusPlus.xmod.gregtech.api.gui;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.gui.GT_ContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.slots.SlotIntegratedCircuit;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class CONTAINER_DataHatch extends GT_ContainerMetaTile_Machine {
+
+ public CONTAINER_DataHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 0, 53, 8));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 1, 71, 8));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 2, 89, 8));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 3, 107, 8));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 4, 53, 26));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 5, 71, 26));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 6, 89, 26));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 7, 107, 26));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 8, 53, 44));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 9, 71, 44));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 10, 89, 44));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 11, 107, 44));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 12, 53, 62));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 13, 71, 62));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 14, 89, 62));
+ addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 15, 107, 62));
+ addSlotToContainer(new SlotIntegratedCircuit(mTileEntity, 16, 19, 35));
+
+ }
+
+ @Override
+ public int getSlotCount() {
+ return 17;
+ }
+
+ @Override
+ public int getShiftClickSlotCount() {
+ return 0;
+ }
+
+ @Override
+ public void putStackInSlot(int par1, ItemStack par2ItemStack) {
+ /*Logger.INFO("Slot: "+par1);
+ if (par1 < 16 && ItemList.Tool_DataOrb.isStackEqual(par2ItemStack)) {
+ super.putStackInSlot(par1, par2ItemStack);
+ }
+ if (par1 == 16 && ItemUtils.isControlCircuit(par2ItemStack)) {
+ super.putStackInSlot(par1, par2ItemStack);
+ }*/
+ super.putStackInSlot(par1, par2ItemStack);
+ }
+
+ @Override
+ public boolean canDragIntoSlot(Slot par1Slot) {
+ return super.canDragIntoSlot(par1Slot);
+ }
+
+ public class GT_Slot_DataOrb extends Slot {
+ public GT_Slot_DataOrb(IInventory par1iInventory, int par2, int par3, int par4) {
+ super(par1iInventory, par2, par3, par4);
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack aStack) {
+ return ItemList.Tool_DataOrb.isStackEqual(aStack, false, true);
+ }
+ }
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DataHatch.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DataHatch.java
new file mode 100644
index 0000000000..77cb0d71a2
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DataHatch.java
@@ -0,0 +1,41 @@
+package gtPlusPlus.xmod.gregtech.api.gui;
+
+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_DataHatch extends GT_GUIContainerMetaTile_Machine {
+
+ private final String mName;
+
+ public GUI_DataHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(new CONTAINER_DataHatch(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "HatchDataOrb.png");
+ mName = aName;
+ }
+
+ public GUI_DataHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) {
+ super(new CONTAINER_DataHatch(aInventoryPlayer, aTileEntity), RES_PATH_GUI + aBackground + "HatchDataOrb.png");
+ mName = aName;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString(mName, 8, 4, 4210752);
+ /*String[] aName = mName.trim().split("\\s+");
+ int aY = 4;
+ for (String s : aName) {
+ fontRendererObj.drawString(s, 120, (aY += 12), 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/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java
index c78e7789b8..61cf59f6c9 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java
@@ -112,18 +112,32 @@ public class GUI_MultiMachine extends GT_GUIContainerMetaTile_Machine {
mInfo.add(StatCollector.translateToLocal("GTPP.machines.output")+" "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+ EnumChatFormatting.GREEN +GT_Values.VOLTAGE_NAMES[aOutputTier]);
}
+
+
+
mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.progress")+": "+
EnumChatFormatting.GREEN + Integer.toString(((CONTAINER_MultiMachine) this.mContainer).mProgressTime/20) + EnumChatFormatting.RESET +" s / "+
EnumChatFormatting.YELLOW + Integer.toString(((CONTAINER_MultiMachine) this.mContainer).mMaxProgressTime/20) + EnumChatFormatting.RESET +" s");
- mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+": "+
- EnumChatFormatting.GREEN + Long.toString(aStoredEnergy) + EnumChatFormatting.RESET +" "+EU+" / "+
- EnumChatFormatting.YELLOW + Long.toString(aMaxEnergy) + EnumChatFormatting.RESET +" "+EU+"");
+
+
+
+
+
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+":");
+ mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.GREEN + Long.toString(aStoredEnergy) + EnumChatFormatting.RESET +" EU / "+
+ EnumChatFormatting.YELLOW + Long.toString(aMaxEnergy) + EnumChatFormatting.RESET +" EU"));
if (aRecipeEU != 0 && aRecipeDuration > 0) {
- mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage")+": "+
- EnumChatFormatting.RED + Integer.toString(-aRecipeEU) + EnumChatFormatting.RESET + " "+EU+"/t");
+ if (aRecipeEU > 0) {
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage")+":");
+ mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.RED + Integer.toString(-aRecipeEU) + EnumChatFormatting.RESET + " EU/t/parallel"));
+ }
+ else {
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.generation")+":");
+ mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.GREEN + Integer.toString(aRecipeEU) + EnumChatFormatting.RESET + " EU/t/parallel"));
+ }
mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.duration")+": "+
EnumChatFormatting.RED + Integer.toString(aRecipeDuration) + EnumChatFormatting.RESET + " ticks");
if (aRecipeSpecial > 0) {
@@ -132,18 +146,16 @@ public class GUI_MultiMachine extends GT_GUIContainerMetaTile_Machine {
}
}
- mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei")+": "+
- EnumChatFormatting.YELLOW+Long.toString(aMaxInputVoltage)+EnumChatFormatting.RESET+ " "+EU+"/t"+EnumChatFormatting.RESET);
-
- mInfo.add(StatCollector.translateToLocal(StatCollector.translateToLocal("GTPP.machines.tier")+": "+
- EnumChatFormatting.YELLOW+GT_Values.VN[GT_Utility.getTier(aMaxInputVoltage)]+ EnumChatFormatting.RESET));
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei")+":");
+ mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.YELLOW+Long.toString(aMaxInputVoltage)+EnumChatFormatting.RESET+ " EU/t(*2A) "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+
+ EnumChatFormatting.YELLOW+GT_Values.VN[GT_Utility.getTier(aMaxInputVoltage)]+ EnumChatFormatting.RESET));
mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.efficiency")+": "+ EnumChatFormatting.YELLOW+Float.toString(aEfficiency / 100.0F)+EnumChatFormatting.RESET + " %");
mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollution")+": "+ EnumChatFormatting.RED + (aPollutionTick*20)+ EnumChatFormatting.RESET+"/sec");
mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced")+": "+ EnumChatFormatting.GREEN + aPollutionReduction + EnumChatFormatting.RESET+" %");
- mInfo.add(StatCollector.translateToLocal("GTPP.CC.parallel")+": "+EnumChatFormatting.GREEN+(aMaxParallel)+EnumChatFormatting.RESET);
+ //mInfo.add(StatCollector.translateToLocal("GTPP.CC.parallel")+": "+EnumChatFormatting.GREEN+(aMaxParallel)+EnumChatFormatting.RESET);
mInfo.add("Total Time Since Built: ");
mInfo.add("" + EnumChatFormatting.DARK_GREEN + Integer.toString(weeks)+EnumChatFormatting.RESET+" Weeks,");
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java
index a892346463..9dc3f4e1d5 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java
@@ -2,8 +2,6 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
import java.util.ArrayList;
-import gregtech.api.gui.GT_Container_4by4;
-import gregtech.api.gui.GT_GUIContainer_4by4;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
@@ -11,7 +9,11 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_DataHatch;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_DataHatch;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -22,18 +24,18 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE
public GT_Recipe_Map mRecipeMap = null;
public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 16, new String[]{
+ super(aID, aName, aNameRegional, aTier, 17, new String[]{
"Holds Data Orbs for the Elemental Duplicator",
CORE.GT_Tooltip
});
}
public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, 16, aDescription, aTextures);
+ super(aName, aTier, 17, aDescription, aTextures);
}
public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, 16, aDescription, aTextures);
+ super(aName, aTier, 17, aDescription, aTextures);
}
@Override
@@ -80,12 +82,12 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE
@Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_4by4(aPlayerInventory, aBaseMetaTileEntity);
+ return new CONTAINER_DataHatch(aPlayerInventory, aBaseMetaTileEntity);
}
@Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, "Data Orb Repository");
+ return new GUI_DataHatch(aPlayerInventory, aBaseMetaTileEntity, "Data Orb Repository");
}
@Override
@@ -96,13 +98,13 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE
}
public void updateSlots() {
- for (int i = 0; i < mInventory.length; i++)
+ for (int i = 0; i < mInventory.length-1; 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 i = 0; i < mInventory.length-1; i++) {
if (mInventory[i] != null && mInventory[i].stackSize <= 0) {
mInventory[i] = null;
}
@@ -130,20 +132,47 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE
@Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return true;
+ Logger.INFO("Checking if we can pull "+aStack.getDisplayName()+" from slot "+aIndex);
+ if (aIndex == mInventory.length-1 && ItemUtils.isControlCircuit(aStack) && aSide == getBaseMetaTileEntity().getFrontFacing()) {
+ return true;
+ }
+ return false;
}
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return aSide == getBaseMetaTileEntity().getFrontFacing() && (mRecipeMap == null || mRecipeMap.containsInput(aStack));
+ Logger.INFO("Checking if we can put "+aStack.getDisplayName()+" into slot "+aIndex);
+ if (aIndex == mInventory.length-1 && ItemUtils.isControlCircuit(aStack) && aSide == getBaseMetaTileEntity().getFrontFacing()) {
+ return true;
+ }
+ return false;
}
public ArrayList<ItemStack> getInventory(){
ArrayList<ItemStack> aContents = new ArrayList<ItemStack>();
- for (int i=0;i<this.getSizeInventory();i++) {
- aContents.add(this.getStackInSlot(i));
- }
+ for (int i = getBaseMetaTileEntity().getSizeInventory() - 2; i >= 0; i--) {
+ if (getBaseMetaTileEntity().getStackInSlot(i) != null)
+ aContents.add(getBaseMetaTileEntity().getStackInSlot(i));
+ }
return aContents;
}
+ @Override
+ public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
+ if (aIndex == mInventory.length-1 && ItemUtils.isControlCircuit(aStack) && aSide == getBaseMetaTileEntity().getFrontFacing()) {
+ Logger.INFO("Putting "+aStack.getDisplayName()+" into slot "+aIndex);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
+ if (aIndex == mInventory.length-1 && ItemUtils.isControlCircuit(aStack)) {
+ Logger.INFO("Pulling "+aStack.getDisplayName()+" from slot "+aIndex);
+ return true;
+ }
+ return false;
+ }
+
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index c8b58ff097..e2ca92d8b0 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -224,28 +224,30 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En
if (!this.mAllEnergyHatches.isEmpty()) {
long storedEnergy = getStoredEnergyInAllEnergyHatches();
long maxEnergy = getMaxEnergyStorageOfAllEnergyHatches();
- mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+": "+
- EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+
- EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU");
- mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei")+": "+
- EnumChatFormatting.YELLOW+Long.toString(getMaxInputVoltage())+EnumChatFormatting.RESET+ " EU/t(*2A) "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+
- EnumChatFormatting.YELLOW+GT_Values.VN[GT_Utility.getTier(getMaxInputVoltage())]+ EnumChatFormatting.RESET);
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+":");
+ mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+
+ EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU"));
+
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei")+":");
+ mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.YELLOW+Long.toString(getMaxInputVoltage())+EnumChatFormatting.RESET+ " EU/t(*2A) "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+
+ EnumChatFormatting.YELLOW+GT_Values.VN[GT_Utility.getTier(getMaxInputVoltage())]+ EnumChatFormatting.RESET));
+ ;
}
if (!this.mAllDynamoHatches.isEmpty()) {
long storedEnergy = getStoredEnergyInAllDynamoHatches();
long maxEnergy = getMaxEnergyStorageOfAllDynamoHatches();
- mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+" In Dynamos: "+
- EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+
- EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU");
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+" In Dynamos:");
+ mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+
+ EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU"));
}
if (-mEUt > 0) {
- mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage")+": "+
- EnumChatFormatting.RED + Integer.toString(-mEUt) + EnumChatFormatting.RESET + " EU/t");
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage")+":");
+ mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.RED + Integer.toString(-mEUt) + EnumChatFormatting.RESET + " EU/t"));
}
else {
- mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.generation")+": "+
- EnumChatFormatting.GREEN + Integer.toString(mEUt) + EnumChatFormatting.RESET + " EU/t");
+ mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.generation")+":");
+ mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.GREEN + Integer.toString(mEUt) + EnumChatFormatting.RESET + " EU/t"));
}
mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.problems")+": "+
@@ -2452,7 +2454,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En
}
else {
try {
- return (GT_Recipe) findRecipe09.invoke(getRecipeMap(), aTileEntity, aRecipe, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, aSpecialSlot, aInputs);
+ return (GT_Recipe) findRecipe09.invoke(getRecipeMap(), aTileEntity, aRecipe, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, aSpecialSlot, aInputs);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
e.printStackTrace();
return null;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java
index 5d2dc5b9a2..b80aa02461 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java
@@ -5,28 +5,43 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.lang3.ArrayUtils;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.Element;
+import gregtech.api.enums.Materials;
import gregtech.api.enums.TAE;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
+import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+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 gregtech.common.items.behaviors.Behaviour_DataOrb;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ElementalDataOrbHolder;
@@ -34,6 +49,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.Gregtech
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase<GregtechMTE_ElementalDuplicator> {
@@ -63,87 +79,95 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
- .addInfo("Produces Elemental Material from UU Matter")
- .addInfo("This multiblock cannot be overclocked")
- .addInfo("Maximum 1x of each bus/hatch.")
- .addPollutionAmount(getPollutionPerSecond(null))
- .addSeparator()
- .beginStructureBlock(7, 7, 7, false)
- .addController("Top Center")
- .addCasingInfo("Robust Tungstensteel Machine Casing", 40)
- .addCasingInfo("Tungstensteel Coils", 16)
- .addCasingInfo("Molecular Containment Casing", 52)
- .addCasingInfo("High Voltage Current Capacitor", 32)
- .addCasingInfo("Particle Containment Casing", 4)
- .addCasingInfo("Resonance Chamber I", 5)
- .addCasingInfo("Modulator I", 4)
- .addInputBus("Any Robust Tungstensteel Machine Casing", 1)
- .addOutputBus("Any Robust Tungstensteel Machine Casing", 1)
- .addEnergyHatch("Any Robust Tungstensteel Machine Casing", 1)
- .addMaintenanceHatch("Any Robust Tungstensteel Machine Casing", 1)
- .addMufflerHatch("Any Robust Tungstensteel Machine Casing", 1)
- .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ .addInfo("Produces Elemental Material from UU Matter")
+ .addInfo("This multiblock cannot be overclocked")
+ .addInfo("Maximum 1x of each bus/hatch.")
+ .addInfo("Does not require both Output Hatch & Bus")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(9, 6, 9, true)
+ .addController("Top Center")
+ .addCasingInfo("Elemental Confinement Shell", 138)
+ .addCasingInfo("Matter Fabricator Casing", 24)
+ .addCasingInfo("Containment Casing", 24)
+ .addCasingInfo("Matter Generation Coil", 24)
+ .addCasingInfo("High Voltage Current Capacitor", 20)
+ .addCasingInfo("Resonance Chamber III", 24)
+ .addCasingInfo("Modulator III", 16)
+ .addOtherStructurePart("Data Orb Repository", "1x", 1)
+ .addInputHatch("Any 1 dot hint", 1)
+ .addOutputBus("Any 1 dot hint", 1)
+ .addOutputHatch("Any 1 dot hint", 1)
+ .addEnergyHatch("Any 1 dot hint", 1)
+ .addMaintenanceHatch("Any 1 dot hint", 1)
+ .addMufflerHatch("Any 1 dot hint", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
return tt;
}
-
+
private static final String STRUCTURE_PIECE_MAIN = "main";
private IStructureDefinition<GregtechMTE_ElementalDuplicator> STRUCTURE_DEFINITION = null;
-
+
@Override
public IStructureDefinition<GregtechMTE_ElementalDuplicator> getStructureDefinition() {
- STRUCTURE_DEFINITION = null;
- log("Reset Structure Def");
if (STRUCTURE_DEFINITION == null) {
STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_ElementalDuplicator>builder()
-
+
// h = Hatch
// c = Casing
-
+
// a = MF Casing 1
// b = Matter Gen Coil
-
+
// d = Current Capacitor
// e = Particle
-
+
// f = Resonance III
// g = Modulator III
-
+
.addShape(STRUCTURE_PIECE_MAIN, (new String[][]{
{" ccc ", " ccccc ", " ccccccc ", "ccchhhccc", "ccch~hccc", "ccchhhccc", " ccccccc ", " ccccc ", " ccc "},
- {" ", " ", " ", " ", " ", " ", " ", " ", " "},
- {" ", " ", " ", " ", " ", " ", " ", " ", " "},
- {" ", " ", " ", " ", " ", " ", " ", " ", " "},
- {" ", " ", " ", " ", " ", " ", " ", " ", " "},
- {" ", " ", " ", " ", " ", " ", " ", " ", " "},
- {" ", " ", " ", " ", " ", " ", " ", " ", " "},
+ {" cac ", " abfba ", " abfgfba ", "cbfgdgfbc", "afgdddgfa", "cbfgdgfbc", " abfgfba ", " abfba ", " cac "},
+ {" cec ", " e e ", " e e ", "c d c", "e ddd e", "c d c", " e e ", " e e ", " cec "},
+ {" cec ", " e e ", " e e ", "c d c", "e ddd e", "c d c", " e e ", " e e ", " cec "},
+ {" cac ", " abfba ", " abfgfba ", "cbfgdgfbc", "afgdddgfa", "cbfgdgfbc", " abfgfba ", " abfba ", " cac "},
+ {" ccc ", " ccccc ", " ccccccc ", "ccchhhccc", "ccchhhccc", "ccchhhccc", " ccccccc ", " ccccc ", " ccc "},
}))
-
- //.addElement('c', ofBlock(getCasingBlock(), getCasingMeta()))
+
+ .addElement('a', ofBlock(getCasingBlock4(), getCasingMeta6()))
+ .addElement('b', ofBlock(getCasingBlock4(), getCasingMeta7()))
+
+ .addElement('d', ofBlock(getCasingBlock2(), getCasingMeta2()))
+ .addElement('e', ofBlock(getCasingBlock2(), getCasingMeta3()))
+
+ .addElement('f', ofBlock(getCasingBlock3(), getCasingMeta4()))
+ .addElement('g', ofBlock(getCasingBlock3(), getCasingMeta5()))
.addElement('c', lazy(t -> onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta()))))
.addElement('h', lazy(t -> ofChain(
ofHatchAdder(GregtechMTE_ElementalDuplicator::addGenericHatch, getCasingTextureIndex(), 1),
- onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock3(), getTungstenCasingMeta()))
+ onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta()))
)))
.build();
}
return STRUCTURE_DEFINITION;
}
-
+
@Override
public void construct(ItemStack stackSize, boolean hintsOnly) {
- buildPiece(STRUCTURE_PIECE_MAIN , stackSize, hintsOnly, 3, 3, 0);
+ buildPiece(STRUCTURE_PIECE_MAIN , stackSize, hintsOnly, 4, 4, 0);
}
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
mCasing = 0;
- boolean aDidBuild = checkPiece(STRUCTURE_PIECE_MAIN, 3, 3, 0);
- if (this.mInputBusses.size() != 1 || this.mOutputBusses.size() != 1 || this.mEnergyHatches.size() != 1) {
+ boolean aDidBuild = checkPiece(STRUCTURE_PIECE_MAIN, 4, 4, 0);
+ if (this.mInputHatches.size() != 1 || (this.mOutputBusses.size() != 1 && this.mOutputHatches.size() !=0) || this.mEnergyHatches.size() != 1 || this.mReplicatorDataOrbHatches.size() != 1) {
return false;
}
- return aDidBuild && mCasing >= 40 && checkHatch();
+ log("Casings: "+mCasing);
+ return aDidBuild && mCasing >= 138 && checkHatch();
}
protected static int getCasingTextureIndex() {
@@ -153,33 +177,45 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase
protected static Block getCasingBlock() {
return ModBlocks.blockCasings5Misc;
}
-
+
protected static Block getCasingBlock2() {
- return ModBlocks.blockSpecialMultiCasings2;
+ return ModBlocks.blockSpecialMultiCasings;
}
-
+
protected static Block getCasingBlock3() {
- return GregTech_API.sBlockCasings4;
+ return ModBlocks.blockSpecialMultiCasings2;
}
-
- protected static Block getCoilBlock() {
- return GregTech_API.sBlockCasings5;
+
+ protected static Block getCasingBlock4() {
+ return ModBlocks.blockCasingsMisc;
}
-
+
protected static int getCasingMeta() {
return 3;
}
-
+
protected static int getCasingMeta2() {
return 12;
}
-
+
protected static int getCasingMeta3() {
return 13;
}
-
- protected static int getTungstenCasingMeta() {
- return 0;
+
+ protected static int getCasingMeta4() {
+ return 2;
+ }
+
+ protected static int getCasingMeta5() {
+ return 6;
+ }
+
+ protected static int getCasingMeta6() {
+ return 9;
+ }
+
+ protected static int getCasingMeta7() {
+ return 8;
}
public final boolean addGenericHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
@@ -188,13 +224,19 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase
}
else {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
- else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
@@ -204,11 +246,15 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) {
- ((GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) aTileEntity).mRecipeMap = getRecipeMap();
- return addToMachineListInternal(mReplicatorDataOrbHatches, aMetaTileEntity, aBaseCasingIndex);
- }
+ try {
+ ((GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) aMetaTileEntity).mRecipeMap = getRecipeMap();
+ return addToMachineListInternal(mReplicatorDataOrbHatches, aMetaTileEntity, aBaseCasingIndex);
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
}
- log("Bad Hatch");
return false;
}
@@ -223,21 +269,21 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase
@Override
public boolean hasSlotInGUI() {
- return true;
+ return false;
}
-
+
@Override
public boolean requiresVanillaGtGUI() {
- return true;
+ return false;
}
@Override
public String getCustomGUIResourceName() {
- return "VacuumFreezer";
+ return null;
}
public GT_Recipe.GT_Recipe_Map getRecipeMap() {
- return GTPP_Recipe_Map.sMolecularTransformerRecipes;
+ return GTPP_Recipe_Map.sElementalDuplicatorRecipes;
}
public boolean isCorrectMachinePart(final ItemStack aStack) {
@@ -246,12 +292,220 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase
@Override
public boolean checkRecipe(final ItemStack aStack) {
- return checkRecipeGeneric(1, 100, 100);
+ return checkRecipeGeneric(getMaxParallelRecipes(), 100, 100);
}
-
+
+
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isPerpectOC) {
+ // Based on the Processing Array. A bit overkill, but very flexible.
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ log("Running checkRecipeGeneric(0)");
+
+ GT_Recipe tRecipe = null;
+
+ try {
+ log("Checking "+aItemInputs.length+" Data Orbs");
+
+ for (int i=0;i<aItemInputs.length;i++) {
+ ItemStack aItem = aItemInputs[i];
+ log("Found: "+aItem.getDisplayName());
+ }
+ ItemStack aDataOrbStack = null;
+ recipe : for (GT_Recipe nRecipe : this.getRecipeMap().mRecipeList) {
+ log("Checking Recipe for: "+(nRecipe.mOutputs.length > 0 && nRecipe.mOutputs[0] != null ? nRecipe.mOutputs[0].getDisplayName() : nRecipe.mFluidOutputs[0].getLocalizedName()));
+ ItemStack aTempStack = getSpecialSlotStack(nRecipe);
+ if (aTempStack != null) {
+ for (ItemStack aItem : aItemInputs) {
+ if (nRecipe.mSpecialItems != null) {
+ if (GT_Utility.areStacksEqual(aTempStack, aItem, false)) {
+ Materials tMaterial = Element.get(Behaviour_DataOrb.getDataName(aTempStack)).mLinkedMaterials.get(0);
+ log("Found: "+aTempStack.getDisplayName()+" for "+tMaterial.name());
+ aDataOrbStack = aTempStack;
+ break recipe;
+ }
+ }
+ }
+ }
+ }
+ if (aDataOrbStack != null) {
+ tRecipe = findRecipe(
+ getBaseMetaTileEntity(), mLastRecipe, false, false,
+ gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aDataOrbStack, aItemInputs);
+ if (tRecipe != null) {
+ Materials tMaterial = Element.get(Behaviour_DataOrb.getDataName(aDataOrbStack)).mLinkedMaterials.get(0);
+ log("Found recipe for "+tMaterial.name());
+ }
+ else {
+ log("No Recipe Found");
+ }
+ }
+ else {
+ log("Null DO");
+ }
+
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+
+
+ log("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+ if (tRecipe == null) {
+ log("BAD RETURN - 1");
+ return false;
+ }
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ log("BAD RETURN - 2");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+
+ log("parallelRecipes: "+parallelRecipes);
+ log("aMaxParallelRecipes: "+aMaxParallelRecipes);
+ log("tTotalEUt: "+tTotalEUt);
+ log("tVoltage: "+tVoltage);
+ log("tRecipeEUt: "+tRecipeEUt);
+ // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ log("Broke at "+parallelRecipes+".");
+ break;
+ }
+ log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ log("BAD RETURN - 3");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor);
+
+ this.mEUt = (int)Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ if (isPerpectOC) this.mMaxProgresstime /= 4;
+ else this.mMaxProgresstime /= 2;
+ }
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0) tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ log("GOOD RETURN - 1");
+ return true;
+ }
+
+
@Override
public int getMaxParallelRecipes() {
- return 1;
+ return (8 * GT_Utility.getTier(this.getMaxInputVoltage()));
}
@Override
@@ -274,36 +528,157 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase
public boolean explodesOnComponentBreak(final ItemStack aStack) {
return false;
}
-
+
@Override
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPreTick(aBaseMetaTileEntity, aTick);
// Fix GT bug
- /*if (this.getBaseMetaTileEntity().getFrontFacing() != 1) {
+ if (this.getBaseMetaTileEntity().getFrontFacing() != 1) {
this.getBaseMetaTileEntity().setFrontFacing((byte) 1);
- }*/
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if (aBaseMetaTileEntity.isServerSide()) {
- if (this.mUpdate == 1 || this.mStartUpCheck == 1) {
- this.mReplicatorDataOrbHatches.clear();
- }
- }
- super.onPostTick(aBaseMetaTileEntity, aTick);
- }
-
- @Override
- public ArrayList<ItemStack> getStoredInputs() {
- ArrayList<ItemStack> tItems = super.getStoredInputs();
- for (GT_MetaTileEntity_Hatch_ElementalDataOrbHolder tHatch : mReplicatorDataOrbHatches) {
- tHatch.mRecipeMap = getRecipeMap();
- if (isValidMetaTileEntity(tHatch)) {
- tItems.addAll(tHatch.getInventory());
- }
- }
- return tItems;
- }
+ }
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ if (this.mUpdate == 1 || this.mStartUpCheck == 1) {
+ this.mReplicatorDataOrbHatches.clear();
+ }
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public ArrayList<ItemStack> getStoredInputs() {
+ ArrayList<ItemStack> tItems = super.getStoredInputs();
+ for (GT_MetaTileEntity_Hatch_ElementalDataOrbHolder tHatch : mReplicatorDataOrbHatches) {
+ tHatch.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tHatch)) {
+ tItems.addAll(tHatch.getInventory());
+ }
+ }
+ tItems.removeAll(Collections.singleton(null));
+ return tItems;
+ }
+
+ /**
+ * finds a Recipe matching the aFluid and ItemStack Inputs.
+ *
+ * @param aTileEntity an Object representing the current coordinates of the executing Block/Entity/Whatever. This may be null, especially during Startup.
+ * @param aRecipe in case this is != null it will try to use this Recipe first when looking things up.
+ * @param aNotUnificated if this is T the Recipe searcher will unificate the ItemStack Inputs
+ * @param aDontCheckStackSizes if set to false will only return recipes that can be executed at least once with the provided input
+ * @param aVoltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage
+ * @param aFluids the Fluid Inputs
+ * @param aSpecialSlot the content of the Special Slot, the regular Manager doesn't do anything with this, but some custom ones do.
+ * @param aInputs the Item Inputs
+ * @return the Recipe it has found or null for no matching Recipe
+ */
+ public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, boolean aDontCheckStackSizes, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) {
+
+ GT_Recipe_Map mRecipeMap = this.getRecipeMap();
+ // No Recipes? Well, nothing to be found then.
+ if (mRecipeMap.mRecipeList.isEmpty()) {
+ return null;
+ }
+
+ // Some Recipe Classes require a certain amount of Inputs of certain kinds. Like "at least 1 Fluid + 1 Stack" or "at least 2 Stacks" before they start searching for Recipes.
+ // This improves Performance massively, especially if people leave things like Circuits, Molds or Shapes in their Machines to select Sub Recipes.
+ if (GregTech_API.sPostloadFinished) {
+ if (mRecipeMap.mMinimalInputFluids > 0) {
+ if (aFluids == null) return null;
+ int tAmount = 0;
+ for (FluidStack aFluid : aFluids) if (aFluid != null) tAmount++;
+ if (tAmount < mRecipeMap.mMinimalInputFluids) return null;
+ }
+ if (mRecipeMap.mMinimalInputItems > 0) {
+ if (aInputs == null) return null;
+ int tAmount = 0;
+ for (ItemStack aInput : aInputs) if (aInput != null) tAmount++;
+ if (tAmount < mRecipeMap.mMinimalInputItems) return null;
+ }
+ }
+
+ // Unification happens here in case the Input isn't already unificated.
+ if (aNotUnificated) {
+ aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs);
+ }
+
+ // Check the Recipe which has been used last time in order to not have to search for it again, if possible.
+ if (aRecipe != null) {
+ ItemStack aRecipeSpecial = getSpecialSlotStack(aRecipe);
+ if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs) && GT_Utility.areStacksEqual(aRecipeSpecial, aSpecialSlot, false) && areDataOrbsEqual(aRecipeSpecial, aSpecialSlot)) {
+ return aRecipe.mEnabled && aVoltage * mRecipeMap.mAmperage >= aRecipe.mEUt ? aRecipe : null;
+ }
+ }
+
+ // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items.
+ if (mRecipeMap.mUsualInputCount > 0 && aInputs != null) for (ItemStack tStack : aInputs)
+ if (tStack != null) {
+ Collection<GT_Recipe> tRecipes = mRecipeMap.mRecipeItemMap.get(new GT_ItemStack(tStack));
+ if (tRecipes != null) {
+ for (GT_Recipe tRecipe : tRecipes) {
+ if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) {
+ ItemStack aRecipeSpecial = getSpecialSlotStack(tRecipe);
+ if (GT_Utility.areStacksEqual(aRecipeSpecial, aSpecialSlot, false) && areDataOrbsEqual(aRecipeSpecial, aSpecialSlot)) {
+ return tRecipe.mEnabled && aVoltage * mRecipeMap.mAmperage >= tRecipe.mEUt ? tRecipe : null;
+ }
+ }
+ tRecipes = mRecipeMap.mRecipeItemMap.get(new GT_ItemStack(tStack, true));
+ }
+ }
+ if (tRecipes != null) {
+ for (GT_Recipe tRecipe : tRecipes) {
+ if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) {
+ ItemStack aRecipeSpecial = getSpecialSlotStack(tRecipe);
+ if (GT_Utility.areStacksEqual(aRecipeSpecial, aSpecialSlot, false) && areDataOrbsEqual(aRecipeSpecial, aSpecialSlot)) {
+ return tRecipe.mEnabled && aVoltage * mRecipeMap.mAmperage >= tRecipe.mEUt ? tRecipe : null;
+ }
+ }
+ }
+ }
+ }
+
+ // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that Map too.
+ if (mRecipeMap.mMinimalInputItems == 0 && aFluids != null) for (FluidStack aFluid : aFluids)
+ if (aFluid != null) {
+ Collection<GT_Recipe>
+ tRecipes = mRecipeMap.mRecipeFluidMap.get(aFluid.getFluid());
+ if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) {
+ if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) {
+ ItemStack aRecipeSpecial = getSpecialSlotStack(tRecipe);
+ if (GT_Utility.areStacksEqual(aRecipeSpecial, aSpecialSlot, false) && areDataOrbsEqual(aRecipeSpecial, aSpecialSlot)) {
+ return tRecipe.mEnabled && aVoltage * mRecipeMap.mAmperage >= tRecipe.mEUt ? tRecipe : null;
+ }
+ }
+ }
+ }
+
+ // And nothing has been found.
+ return null;
+ }
+
+ public static ItemStack getSpecialSlotStack(GT_Recipe aRecipe) {
+ ItemStack aStack = null;
+ if (aRecipe.mSpecialItems != null) {
+ if (aRecipe.mSpecialItems instanceof ItemStack[]) {
+ ItemStack[] aTempStackArray = (ItemStack[]) aRecipe.mSpecialItems;
+ aStack = aTempStackArray[0];
+ }
+ }
+ return aStack;
+ }
+
+ private static boolean areDataOrbsEqual(ItemStack aOrb1, ItemStack aOrb2) {
+ if (aOrb1 != null && aOrb2 != null) {
+ Materials tMaterial1 = Element.get(Behaviour_DataOrb.getDataName(aOrb1)).mLinkedMaterials.get(0);
+ Materials tMaterial2 = Element.get(Behaviour_DataOrb.getDataName(aOrb2)).mLinkedMaterials.get(0);
+ if (tMaterial1.equals(tMaterial2)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElementDuplicator.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElementDuplicator.java
index 9e940dff26..9301844071 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElementDuplicator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElementDuplicator.java
@@ -12,7 +12,7 @@ public class GregtechIndustrialElementDuplicator {
Logger.INFO("Gregtech5u Content | Registering Elemental Duplicator Multiblock.");
GregtechItemList.Controller_ElementalDuplicator.set(new GregtechMTE_ElementalDuplicator(31050, "gtpp.multimachine.replicator", "Elemental Duplicator").getStackForm(1L));
- GregtechItemList.Hatch_Input_Elemental_Duplicator.set(new GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(31051, "hatch.input_bus.elementalorbholder", "Elemental Data Orb Storage", 7).getStackForm(1L));
+ GregtechItemList.Hatch_Input_Elemental_Duplicator.set(new GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(31051, "hatch.input_bus.elementalorbholder", "Data Orb Repository", 7).getStackForm(1L));
}
diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang
index bd455a2c4c..cd01a7a2aa 100644
--- a/src/main/resources/assets/gregtech/lang/en_US.lang
+++ b/src/main/resources/assets/gregtech/lang/en_US.lang
@@ -23,7 +23,7 @@ GTPP.multiblock.duration=Duration
GTPP.CC.machinetier=Control Core Tier
GTPP.CC.discount=EU Discount
-GTPP.CC.parallel=Maximum Parallel Processing
+GTPP.CC.parallel=Maximum Parallel
//Tooltips for the Charger Packs
GTPP.battpack.tooltip.1=Worn as a Belt within Baubles
diff --git a/src/main/resources/assets/gregtech/textures/gui/HatchDataOrb.png b/src/main/resources/assets/gregtech/textures/gui/HatchDataOrb.png
new file mode 100644
index 0000000000..c161ec40af
--- /dev/null
+++ b/src/main/resources/assets/gregtech/textures/gui/HatchDataOrb.png
Binary files differ