aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorGTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>2022-12-23 05:38:11 +0000
committerGTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>2022-12-23 05:38:11 +0000
commit37da5aa8693ab075ec25b3703733c14d24068cdc (patch)
tree49d42e34c6735597ed141f2e9a7e26d2b16b81fb /src/main
parent757d6169bf37acf5206bdb1f7c79c7526bc17a4d (diff)
downloadGT5-Unofficial-37da5aa8693ab075ec25b3703733c14d24068cdc.tar.gz
GT5-Unofficial-37da5aa8693ab075ec25b3703733c14d24068cdc.tar.bz2
GT5-Unofficial-37da5aa8693ab075ec25b3703733c14d24068cdc.zip
NEI support + rendering it
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java39
-rw-r--r--src/main/java/com/github/technus/tectech/nei/TT_NEI_EyeOfHarmonyHandler.java125
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java62
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipeStorage.java15
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/TT_recipe.java124
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java8
-rw-r--r--src/main/java/com/github/technus/tectech/util/ItemStackLong.java4
7 files changed, 343 insertions, 34 deletions
diff --git a/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java b/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java
index 1871f87875..07fbacb87a 100644
--- a/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java
+++ b/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java
@@ -3,11 +3,14 @@ package com.github.technus.tectech.nei;
import codechicken.nei.api.IConfigureNEI;
import com.github.technus.tectech.recipe.TT_recipe;
import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.event.FMLInterModComms;
+import net.minecraft.nbt.NBTTagCompound;
public class NEI_TT_Config implements IConfigureNEI { // must be NEI*Config
public static boolean sIsAdded = true;
public static TT_NEI_ResearchHandler TT_RH;
public static TT_NEI_ScannerHandler TT_SH;
+ public static TT_NEI_EyeOfHarmonyHandler TT_EOH;
@Override
public void loadConfig() {
@@ -15,6 +18,12 @@ public class NEI_TT_Config implements IConfigureNEI { // must be NEI*Config
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
TT_RH = new TT_NEI_ResearchHandler(TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes);
TT_SH = new TT_NEI_ScannerHandler(TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes);
+ TT_EOH = new TT_NEI_EyeOfHarmonyHandler(TT_recipe.GT_Recipe_MapTT.sEyeofHarmonyRecipes);
+
+ sendHandler("gt.recipe.eyeofharmony", "gregtech:gt.blockmachines:15410", 1);
+ sendCatalyst("gt.recipe.eyeofharmony", "gregtech:gt.blockmachines:15410");
+
+
}
sIsAdded = true;
}
@@ -28,4 +37,34 @@ public class NEI_TT_Config implements IConfigureNEI { // must be NEI*Config
public String getVersion() {
return "(1.0)";
}
+
+ private static void sendHandler(String aName, String aBlock, int aMaxRecipesPerPage) {
+ NBTTagCompound aNBT = new NBTTagCompound();
+ aNBT.setString("handler", aName);
+ aNBT.setString("modName", "GregTech");
+ aNBT.setString("modId", "gregtech");
+ aNBT.setBoolean("modRequired", true);
+ aNBT.setString("itemName", aBlock);
+ aNBT.setInteger("handlerHeight", 135);
+ aNBT.setInteger("handlerWidth", 166);
+ aNBT.setInteger("maxRecipesPerPage", aMaxRecipesPerPage);
+ aNBT.setInteger("yShift", 6);
+ FMLInterModComms.sendMessage("NotEnoughItems", "registerHandlerInfo", aNBT);
+ }
+
+ private static void sendHandler(String aName, String aBlock) {
+ sendHandler(aName, aBlock, 2);
+ }
+
+ private static void sendCatalyst(String aName, String aStack, int aPriority) {
+ NBTTagCompound aNBT = new NBTTagCompound();
+ aNBT.setString("handlerID", aName);
+ aNBT.setString("itemName", aStack);
+ aNBT.setInteger("priority", aPriority);
+ FMLInterModComms.sendMessage("NotEnoughItems", "registerCatalystInfo", aNBT);
+ }
+
+ private static void sendCatalyst(String aName, String aStack) {
+ sendCatalyst(aName, aStack, 0);
+ }
}
diff --git a/src/main/java/com/github/technus/tectech/nei/TT_NEI_EyeOfHarmonyHandler.java b/src/main/java/com/github/technus/tectech/nei/TT_NEI_EyeOfHarmonyHandler.java
new file mode 100644
index 0000000000..76b264d3f2
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/nei/TT_NEI_EyeOfHarmonyHandler.java
@@ -0,0 +1,125 @@
+package com.github.technus.tectech.nei;
+
+import appeng.core.localization.GuiColors;
+import appeng.util.ReadableNumberConverter;
+import codechicken.nei.PositionedStack;
+import codechicken.nei.guihook.GuiContainerManager;
+import codechicken.nei.recipe.GuiCraftingRecipe;
+import codechicken.nei.recipe.GuiRecipe;
+import codechicken.nei.recipe.GuiUsageRecipe;
+import codechicken.nei.recipe.TemplateRecipeHandler;
+import com.github.technus.tectech.recipe.EyeOfHarmonyRecipe;
+import com.github.technus.tectech.util.ItemStackLong;
+import com.gtnewhorizons.modularui.api.GlStateManager;
+import cpw.mods.fml.common.event.FMLInterModComms;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.nei.GT_NEI_DefaultHandler;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
+import java.util.List;
+
+import static com.github.technus.tectech.Reference.MODID;
+import static gregtech.api.util.GT_Utility.formatNumbers;
+
+public class TT_NEI_EyeOfHarmonyHandler extends GT_NEI_DefaultHandler {
+
+ public TT_NEI_EyeOfHarmonyHandler(final GT_Recipe.GT_Recipe_Map tMap) {
+ super(tMap);
+ if (!NEI_TT_Config.sIsAdded) {
+
+ FMLInterModComms.sendRuntimeMessage(
+ GT_Values.GT,
+ "NEIPlugins",
+ "register-crafting-handler",
+ MODID + "@" + this.getRecipeName() + "@" + this.getOverlayIdentifier());
+ GuiCraftingRecipe.craftinghandlers.add(this);
+ GuiUsageRecipe.usagehandlers.add(this);
+ }
+ }
+
+
+ @Override
+ public TemplateRecipeHandler newInstance() {
+ return new TT_NEI_EyeOfHarmonyHandler(this.mRecipeMap);
+ }
+
+ @Override
+ public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack aStack, List<String> currentToolTip, int aRecipeIndex) {
+ super.handleItemTooltip(gui, aStack, currentToolTip, aRecipeIndex);
+
+ if (aStack == null) {
+ return currentToolTip;
+ }
+
+ CachedRecipe tObject = this.arecipes.get(aRecipeIndex);
+ if (tObject instanceof CachedDefaultRecipe) {
+
+ CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject;
+ EyeOfHarmonyRecipe currentRecipe = (EyeOfHarmonyRecipe) tRecipe.mRecipe.mSpecialItems;
+
+ double percentage = currentRecipe.getItemStackToProbabilityMap().getOrDefault(aStack, -1.0);
+
+ if (percentage != -1.0) {
+ currentToolTip.add(EnumChatFormatting.GRAY + "Percentage of Solid Mass: " + percentage + "%");
+ currentToolTip.add(EnumChatFormatting.GRAY + "Item Count: " + formatNumbers(currentRecipe.getItemStackToTrueStackSizeMap().get(aStack)));
+ }
+ }
+
+ return currentToolTip;
+ }
+
+ @Override
+ protected void drawOverlays(CachedDefaultRecipe recipe) {
+ for (PositionedStack stack : recipe.mOutputs) {
+ if (!(stack instanceof FixedPositionedStack)) continue;
+
+ EyeOfHarmonyRecipe EOHRecipe = (EyeOfHarmonyRecipe) recipe.mRecipe.mSpecialItems;
+
+ if (EOHRecipe.getItemStackToTrueStackSizeMap().containsKey(stack.item)) {
+ drawOverlayForStack((FixedPositionedStack) stack, EOHRecipe.getItemStackToTrueStackSizeMap().get(stack.item));
+ }
+ }
+// for (PositionedStack stack : recipe.mOutputs) {
+// if (!(stack instanceof FixedPositionedStack)) continue;
+// drawOverlayForStack((FixedPositionedStack) stack);
+// }
+ }
+
+ protected void drawOverlayForStack(FixedPositionedStack stack, long stackSize) {
+
+ FontRenderer fontRender = Minecraft.getMinecraft().fontRenderer;
+ float smallTextScale = 0.5f;
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef(stack.relx, stack.rely, 300);
+ GL11.glScalef(smallTextScale, smallTextScale, 1.0f);
+
+ String displayString;
+
+ if (stackSize > 9999) {
+ displayString = ReadableNumberConverter.INSTANCE.toWideReadableForm(stackSize);
+ } else {
+ displayString = String.valueOf(stackSize);
+ }
+
+ fontRender.drawString(
+ displayString, 0, (int) (16 / smallTextScale) - fontRender.FONT_HEIGHT + 1, 0xFFFFFF, true);
+
+ GL11.glPopMatrix();
+
+ GL11.glDisable(GL11.GL_ALPHA_TEST);
+
+ super.drawOverlayForStack(stack);
+ }
+
+}
+
diff --git a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java
index 69064a1ee4..db30f9cc08 100644
--- a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java
+++ b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java
@@ -4,6 +4,10 @@ import static com.google.common.math.LongMath.pow;
import static gregtech.api.util.GT_Utility.getPlasmaFuelValueInEUPerLiterFromMaterial;
import com.github.technus.tectech.util.ItemStackLong;
+import com.gtnewhorizons.modularui.api.math.Pos2d;
+import gnu.trove.map.TMap;
+import gnu.trove.map.hash.TCustomHashMap;
+import gnu.trove.strategy.HashingStrategy;
import gregtech.api.enums.Materials;
import java.util.*;
import java.util.stream.Collectors;
@@ -18,6 +22,24 @@ import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper;
public class EyeOfHarmonyRecipe {
+ HashingStrategy<ItemStack> itemStackHashingStrategy = new HashingStrategy<ItemStack>() {
+ @Override
+ public int computeHashCode(ItemStack stack) {
+ // Not really sure how this works or if it is "unique enough".
+ int result = stack.getItem().hashCode();
+ result = 31 * result + stack.getItemDamage();
+ return result;
+ }
+
+ @Override
+ public boolean equals(ItemStack item1, ItemStack item2) {
+ return item1.getUnlocalizedName().equals(item2.getUnlocalizedName());
+ }
+ };
+
+ private final TMap<ItemStack, Double> itemStackToProbabilityMap = new TCustomHashMap<>(itemStackHashingStrategy);
+ private final TMap<ItemStack, Long> itemStackToTrueStackSizeMap = new TCustomHashMap<>(itemStackHashingStrategy);
+
private final List<ItemStackLong> outputItems;
private final FluidStack[] outputFluids;
@@ -35,6 +57,14 @@ public class EyeOfHarmonyRecipe {
private final ItemStack recipeTriggerItem;
+ public TMap<ItemStack, Double> getItemStackToProbabilityMap() {
+ return itemStackToProbabilityMap;
+ }
+
+ public TMap<ItemStack, Long> getItemStackToTrueStackSizeMap() {
+ return itemStackToTrueStackSizeMap;
+ }
+
public EyeOfHarmonyRecipe(
GT5OreLayerHelper.NormalOreDimensionWrapper normalOreDimensionWrapper,
GT5OreSmallHelper.SmallOreDimensionWrapper smallOreDimensionWrapper,
@@ -54,7 +84,28 @@ public class EyeOfHarmonyRecipe {
processDimension(normalOreDimensionWrapper, smallOreDimensionWrapper, miningTimeSeconds, 6 * 64);
this.outputItems = validDustGenerator(materialList);
- this.outputFluids = validPlasmaGenerator(materialList, 0.1);
+ this.outputItems.sort(Comparator.comparingLong(ItemStackLong::getStackSize));
+ Collections.reverse(this.outputItems);
+
+ long sumOfItems = this.outputItems.stream()
+ .map(ItemStackLong::getStackSize)
+ .reduce(0L, Long::sum);
+
+ for (ItemStackLong itemStackLong : outputItems) {
+ double stackSize = (double) itemStackLong.getStackSize();
+ double probability = Math.round(100_000 * stackSize / sumOfItems) / 1000.0;
+
+ itemStackToProbabilityMap.put(itemStackLong.itemStack, probability);
+ itemStackToTrueStackSizeMap.put(itemStackLong.itemStack, itemStackLong.stackSize);
+ }
+
+ // --- Output fluids and sort them.
+ ArrayList<FluidStack> tmpFluidOutputs = validPlasmaGenerator(materialList, 0.1);
+ tmpFluidOutputs.sort(Comparator.comparingLong((FluidStack fluid) -> fluid.amount));
+ Collections.reverse(tmpFluidOutputs);
+
+ outputFluids = tmpFluidOutputs.toArray(new FluidStack[0]);
+ // End.
this.spacetimeCasingTierRequired = spacetimeCasingTierRequired;
@@ -73,7 +124,7 @@ public class EyeOfHarmonyRecipe {
this.miningTimeSeconds = miningTimeSeconds;
}
- // Return clone of list.
+ // Return clone of list. Deep copy. Maybe a better way to do this?
public ArrayList<ItemStackLong> getOutputItems() {
ArrayList<ItemStackLong> copyOutputList = new ArrayList<>();
for (ItemStackLong itemStackLong : outputItems) {
@@ -188,17 +239,17 @@ public class EyeOfHarmonyRecipe {
return outputList;
}
- static FluidStack[] validPlasmaGenerator(
+ static ArrayList<FluidStack> validPlasmaGenerator(
final List<Pair<Materials, Long>> planetList, final double percentageOfPlasma) {
- List<FluidStack> plasmaList = new ArrayList<>();
+ ArrayList<FluidStack> plasmaList = new ArrayList<>();
for (Pair<Materials, Long> pair : planetList) {
if (validPlasmas.contains(pair.getLeft())) {
plasmaList.add(pair.getLeft().getPlasma((int) (pair.getRight() * percentageOfPlasma)));
}
}
- return plasmaList.toArray(new FluidStack[0]);
+ return plasmaList;
}
static ArrayList<ItemStackLong> validDustGenerator(final ArrayList<Pair<Materials, Long>> planetList) {
@@ -226,6 +277,7 @@ public class EyeOfHarmonyRecipe {
public static double getMaxPlasmaTurbineEfficiency() {
// I hate Shirabon.
+// return getMaxPlasmaTurbineEfficiency();
return 3.85;
}
diff --git a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipeStorage.java b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipeStorage.java
index 781d5e5f8d..00a3aec8b9 100644
--- a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipeStorage.java
+++ b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipeStorage.java
@@ -77,21 +77,12 @@ public class EyeOfHarmonyRecipeStorage {
outputItems.add(itemStackLong.itemStack);
}
- // GT_Recipe addRecipe(
- // boolean aOptimize,
- // ItemStack[] aInputs,
- // ItemStack[] aOutputs,
- // Object aSpecial,
- // int[] aOutputChances,
- // FluidStack[] aFluidInputs,
- // FluidStack[] aFluidOutputs,
- // int aDuration,
- // int aEUt,
- // int aSpecialValue) {
+ ItemStack planetItem = recipe.getRecipeTriggerItem().copy();
+ planetItem.stackSize = 0;
sEyeofHarmonyRecipes.addRecipe(
false,
- new ItemStack[] {recipe.getRecipeTriggerItem()},
+ new ItemStack[] {planetItem},
outputItems.toArray(new ItemStack[0]),
recipe,
null,
diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java
index a0d08c6412..7fe66d4af9 100644
--- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java
+++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java
@@ -1,6 +1,5 @@
package com.github.technus.tectech.recipe;
-import static gregtech.api.enums.GT_Values.E;
import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
@@ -8,14 +7,16 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstant
import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead;
import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
+import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable;
+import com.gtnewhorizons.modularui.api.math.Pos2d;
+import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.common.widget.ProgressBar;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.gui.modularui.GT_UITextures;
import gregtech.api.util.GT_Recipe;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
+import gregtech.common.gui.modularui.UIHelper;
+import java.util.*;
+import java.util.function.Supplier;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -244,26 +245,25 @@ public class TT_recipe extends GT_Recipe {
public static class GT_Recipe_MapTT extends GT_Recipe.GT_Recipe_Map {
- public static final GT_Recipe_Map sEyeofHarmonyRecipes = new GT_Recipe_Map(
+ public static final GT_Recipe_Map sEyeofHarmonyRecipes = new Eye_Of_Harmony_Recipe_Map(
new HashSet<>(250),
"gt.recipe.eyeofharmony",
"Eye of Harmony",
null,
RES_PATH_GUI + "basicmachines/Extractor",
1,
- 1,
+ 9 * 10,
1,
0,
1,
- E,
+ "",
1,
- E,
+ "",
true,
- true)
- .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE)
- .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT)
- .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE_STEAM)
- .setProgressBarSteam(GT_UITextures.PROGRESSBAR_EXTRACT_STEAM);
+ false) // Custom NEI handler means this must be false.
+ .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.DOWN)
+ .setUsualFluidOutputCount(18)
+ .setLogoPos(10,10);
public static GT_Recipe_MapTT sResearchableFakeRecipes = new GT_Recipe_MapTT(
new HashSet<>(32),
@@ -493,4 +493,100 @@ public class TT_recipe extends GT_Recipe {
return mRecipeMap.values();
}
}
+
+ public static class Eye_Of_Harmony_Recipe_Map extends GT_Recipe_Map {
+
+ private static final int xDirMaxCount = 9;
+ private static final int yOrigin = 8;
+
+ public Eye_Of_Harmony_Recipe_Map(
+ Collection<GT_Recipe> aRecipeList,
+ String aUnlocalizedName,
+ String aLocalName,
+ String aNEIName,
+ String aNEIGUIPath,
+ int aUsualInputCount,
+ int aUsualOutputCount,
+ int aMinimalInputItems,
+ int aMinimalInputFluids,
+ int aAmperage,
+ String aNEISpecialValuePre,
+ int aNEISpecialValueMultiplier,
+ String aNEISpecialValuePost,
+ boolean aShowVoltageAmperageInNEI,
+ boolean aNEIAllowed) {
+ super(
+ aRecipeList,
+ aUnlocalizedName,
+ aLocalName,
+ aNEIName,
+ aNEIGUIPath,
+ aUsualInputCount,
+ aUsualOutputCount,
+ aMinimalInputItems,
+ aMinimalInputFluids,
+ aAmperage,
+ aNEISpecialValuePre,
+ aNEISpecialValueMultiplier,
+ aNEISpecialValuePost,
+ aShowVoltageAmperageInNEI,
+ aNEIAllowed);
+ useModularUI(true);
+ setLogoPos(8, yOrigin);
+ }
+
+ @Override
+ public boolean usesSpecialSlot() {
+ return false;
+ }
+
+ @Override
+ public List<Pos2d> getItemInputPositions(int itemInputCount) {
+ return UIHelper.getItemGridPositions(itemInputCount, 80, yOrigin, 1, 1);
+ }
+
+ @Override
+ public List<Pos2d> getItemOutputPositions(int itemOutputCount) {
+ return UIHelper.getItemGridPositions(itemOutputCount, 8, yOrigin + 36, xDirMaxCount, 12);
+ }
+
+ @Override
+ public List<Pos2d> getFluidInputPositions(int fluidInputCount) {
+ return UIHelper.getItemGridPositions(fluidInputCount, 0, 0, 0, 0);
+ }
+
+ @Override
+ public List<Pos2d> getFluidOutputPositions(int fluidOutputCount) {
+ return UIHelper.getItemGridPositions(fluidOutputCount, 8, yOrigin + 13 * 17 - 4, xDirMaxCount, 3);
+ }
+
+ @Override
+ public ModularWindow.Builder createNEITemplate(
+ IItemHandlerModifiable itemInputsInventory,
+ IItemHandlerModifiable itemOutputsInventory,
+ IItemHandlerModifiable specialSlotInventory,
+ IItemHandlerModifiable fluidInputsInventory,
+ IItemHandlerModifiable fluidOutputsInventory,
+ Supplier<Float> progressSupplier,
+ Pos2d windowOffset) {
+ // Delay setter so that calls to #setUsualFluidInputCount and #setUsualFluidOutputCount are considered
+ setNEIBackgroundSize(172, 82 + (Math.max(getItemRowCount() + getFluidRowCount() - 4, 0)) * 18);
+ return super.createNEITemplate(
+ itemInputsInventory,
+ itemOutputsInventory,
+ specialSlotInventory,
+ fluidInputsInventory,
+ fluidOutputsInventory,
+ progressSupplier,
+ windowOffset);
+ }
+
+ private int getItemRowCount() {
+ return (Math.max(mUsualInputCount, mUsualOutputCount) - 1) / xDirMaxCount + 1;
+ }
+
+ private int getFluidRowCount() {
+ return (Math.max(getUsualFluidInputCount(), getUsualFluidOutputCount()) - 1) / xDirMaxCount + 1;
+ }
+ }
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java
index 74650c1930..a45d121dd2 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java
@@ -1466,6 +1466,10 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl
@Override
public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) {
+ spacetimeCompressionFieldMetadata = -1;
+ timeAccelerationFieldMetadata = -1;
+ stabilisationFieldMetadata = -1;
+
// Check structure of multi.
if (!structureCheck_EM("main", 16, 16, 0)) {
return false;
@@ -1631,9 +1635,7 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl
@Override
public void construct(ItemStack stackSize, boolean hintsOnly) {
- spacetimeCompressionFieldMetadata = -1;
- timeAccelerationFieldMetadata = -1;
- stabilisationFieldMetadata = -1;
+
structureBuild_EM("main", 16, 16, 0, stackSize, hintsOnly);
}
diff --git a/src/main/java/com/github/technus/tectech/util/ItemStackLong.java b/src/main/java/com/github/technus/tectech/util/ItemStackLong.java
index 68a7bafd04..82321bdecb 100644
--- a/src/main/java/com/github/technus/tectech/util/ItemStackLong.java
+++ b/src/main/java/com/github/technus/tectech/util/ItemStackLong.java
@@ -17,4 +17,8 @@ public class ItemStackLong {
this.itemStack = itemStackLong.itemStack;
this.stackSize = itemStackLong.stackSize;
}
+
+ public long getStackSize() {
+ return stackSize;
+ }
}