aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/nei
diff options
context:
space:
mode:
authormiozune <miozune@gmail.com>2022-11-26 01:45:28 +0900
committerGitHub <noreply@github.com>2022-11-25 17:45:28 +0100
commit9a2741128a78bb52eba50a631126e090a5a2abd8 (patch)
treea90f47aa94951acb4050e45dc3ed60698e79cf32 /src/main/java/gregtech/nei
parent51537482fefc4f9c6d3fbd93d119c333a63dcd7b (diff)
downloadGT5-Unofficial-9a2741128a78bb52eba50a631126e090a5a2abd8.tar.gz
GT5-Unofficial-9a2741128a78bb52eba50a631126e090a5a2abd8.tar.bz2
GT5-Unofficial-9a2741128a78bb52eba50a631126e090a5a2abd8.zip
Rewrite GUIs with ModularUI (#1381)
* Base work for ModularUI compat * Remove useless interface * Add almost all the widgets * Invert method * Refactor NEI stack placement positions * NEI handlers on ModularUI * Add some more docs * AdvDebugStructureWriter * Fix NEI progressbar not working * PrimitiveBlastFurnace * clean * derp * clean * spotlessApply * Boilers * Buffers * clean * N by N slots containers * Fix boilers not having bucket interaction Put opening UI to individual MetaTEs * Maintenance Hatch * clean * spotlessApply * Add dependency * IndustrialApiary * Adapt to ModularUI change * Base work for covers & fix crash with MP * Fix crash with server * Rewrite base work for covers * Send initial cover data on cover GUI open so that the time of showing incorrect data will be eliminated * Covers part 1 * Rename package: ModularUI -> modularui * Rename class: GT_UIInfo -> GT_UIInfos * Fix build * Covers part2 * Fix missing client check with tile UI & fix title overlap * CoverTabLine * Move cover window creators to inner class * Fix crash with null base TE * Close GUI when tile is broken * Color cover window with tile colorization * Change signature of addUIWidgets * FluidFilter cover, FluidDisplaySlotWidget, BasicTank, BasicGenerator, Output Hatch, MicrowaveEnergyTransmitter, Teleporter, DigitalChest, DigitalTank * Add title tab * Move package: modularui -> modularui/widget * Programmed circuit + IConfigurationCircuitSupport * clean * VolumetricFlask * Remove integrated circuit overlay from recipe input slots * Input Hatch & Quadruple Input Hatch * Multiblock * Deprecate old cover GUI * BasicMachines * Finish BasicMachine & NEI * Expand DTPF NEI to 9 slots * Fix ME input bus on MP * Move AESlotWidget to public class * Move GT_Recipe_Map constructors with mNEIUnificateOutput to setter method * Move SteamTexture.Variant to outer enum * Switch to remote repository * oops * Update MUI * Update MUI * Minor refactor for change amount buttons * Display items and fluids that exceed usual count * blah * use +=, why didn't I do this * Update MUI * Move ModularUI to Base (#1510) * Move ModularUI to Base * Move most of the ModularUI functionality to `BaseTileEntity` (and `CoverableTileEntity`) * `CommonMetaTileEntity` delegates ato the MetaTileEntity * Added several interfaces (with defaults) to indicate if a tile/metatile override/implement certain behaviors. * Moved `IConfigurationCircuitSupport` interface such that it will work with BaseTileEntity or a MetaTileEntity * Address reviews Co-authored-by: miozune <miozune@gmail.com> * Update MUI * Minor changes to NEI * Return :facepalm: * IGetTabIconSet override * Some more changes to NEI * Merge texture getter interfaces to new class GUITextureSet * Remove BBF structure picture as it's auto-buildable now * Make unified title tab style of texture angular * Expose some boiler texture getters for addon * Fix crash with cover GUI on pipe * Lower the number of recipe per page for DTPF & update MUI * Update MUI * Fix crash with middle-clicking slot on circuit selection GUI * Fix circuit selection window not syncing item from base machine * Merge GT_NEI_AssLineHandler into GT_NEI_DefaultHandler * Update MUI * Add in TecTech multi message * Allow changing the way of binding player inventory * Update MUI * Update MUI * Update MUI * Update MUI * Update MUI * Make MUI non-transitive to allow addons to use their own version * Force enable mixin * Format fluid amount tooltip * Add GUITextureSet.STEAM * Add guard against null ModularWindow creation * Add constructors for Muffler Hatch with inventory * Fix output slot on digital chest and tank allowing insertion * Don't log null ModularWindow * Add default implementation for IHasWorldObjectAndCoords#openGUI * Make openGTTileEntityUI accept MultiTE & cleanup Co-authored-by: Jason Mitchell <mitchej@gmail.com>
Diffstat (limited to 'src/main/java/gregtech/nei')
-rw-r--r--src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java548
-rw-r--r--src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java443
-rw-r--r--src/main/java/gregtech/nei/IMCForNEI.java13
-rw-r--r--src/main/java/gregtech/nei/NEI_GT_Config.java4
4 files changed, 298 insertions, 710 deletions
diff --git a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java
index 90b0532bbc..bb14a02618 100644
--- a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java
+++ b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java
@@ -1,559 +1,21 @@
package gregtech.nei;
-import static gregtech.api.util.GT_Utility.trans;
-
-import codechicken.lib.gui.GuiDraw;
-import codechicken.nei.NEIClientUtils;
-import codechicken.nei.PositionedStack;
-import codechicken.nei.guihook.GuiContainerManager;
-import codechicken.nei.guihook.IContainerInputHandler;
-import codechicken.nei.guihook.IContainerTooltipHandler;
-import codechicken.nei.recipe.GuiCraftingRecipe;
-import codechicken.nei.recipe.GuiRecipe;
-import codechicken.nei.recipe.GuiUsageRecipe;
-import codechicken.nei.recipe.TemplateRecipeHandler;
-import gregtech.GT_Mod;
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.OrePrefixes;
-import gregtech.api.gui.GT_GUIContainer_BasicMachine;
-import gregtech.api.objects.ItemData;
-import gregtech.api.util.GT_LanguageManager;
-import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_WithAlt;
-import gregtech.api.util.GT_Utility;
-import java.awt.*;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import net.minecraft.client.gui.inventory.GuiContainer;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraftforge.fluids.FluidContainerRegistry;
-import net.minecraftforge.fluids.FluidStack;
-import org.lwjgl.opengl.GL11;
+@Deprecated
public class GT_NEI_AssLineHandler extends RecipeMapHandler {
- public static final int sOffsetX = 5;
- public static final int sOffsetY = 11;
-
- /**
- * Static version of {@link TemplateRecipeHandler#cycleticks}.
- * Can be referenced from cached recipes.
- */
- public static int cycleTicksStatic = Math.abs((int) System.currentTimeMillis());
-
- private String mRecipeName;
-
- static {
- GuiContainerManager.addInputHandler(new GT_RectHandler());
- GuiContainerManager.addTooltipHandler(new GT_RectHandler());
- }
- public GT_NEI_AssLineHandler(GT_Recipe.GT_Recipe_Map aRecipeMap) { // this is called when recipes should be shown
+ public GT_NEI_AssLineHandler(GT_Recipe.GT_Recipe_Map aRecipeMap) {
super(aRecipeMap);
- this.transferRects.add(new RecipeTransferRect(new Rectangle(138, 18, 18, 18), getOverlayIdentifier()));
- }
-
- public List<GT_Recipe> getSortedRecipes() {
- List<GT_Recipe> result = new ArrayList<>(this.mRecipeMap.mRecipeList);
- Collections.sort(result);
- return result;
- }
-
- @Override
- public TemplateRecipeHandler newInstance() {
- NEI_GT_Config.ALH = new GT_NEI_AssLineHandler(this.mRecipeMap);
- return NEI_GT_Config.ALH;
- }
-
- @Override
- public void loadCraftingRecipes(String outputId, Object... results) {
- if (outputId.equals(getOverlayIdentifier())) {
- for (GT_Recipe tRecipe : getSortedRecipes()) {
- if (!tRecipe.mHidden) {
- this.arecipes.add(new CachedDefaultRecipe(tRecipe));
- } else {
- this.arecipes.remove(new CachedDefaultRecipe(tRecipe));
- }
- }
- } else {
- super.loadCraftingRecipes(outputId, results);
- }
- }
-
- @Override
- public void loadCraftingRecipes(ItemStack aResult) {
- ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult);
-
- ArrayList<ItemStack> tResults = new ArrayList();
- tResults.add(aResult);
- tResults.add(GT_OreDictUnificator.get(true, aResult));
- if ((tPrefixMaterial != null)
- && (!tPrefixMaterial.mBlackListed)
- && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) {
- for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) {
- tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L));
- }
- }
- FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true);
- if (tFluid != null) {
- tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false));
- for (FluidContainerRegistry.FluidContainerData tData :
- FluidContainerRegistry.getRegisteredFluidContainerData()) {
- if (tData.fluid.isFluidEqual(tFluid)) {
- tResults.add(GT_Utility.copyOrNull(tData.filledContainer));
- }
- }
- }
- for (GT_Recipe tRecipe : getSortedRecipes()) {
- if (!tRecipe.mHidden) {
- CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe);
- for (ItemStack tStack : tResults) {
- if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) {
- this.arecipes.add(tNEIRecipe);
- break;
- }
- }
- } else {
- CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe);
- for (ItemStack tStack : tResults) {
- if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) {
- this.arecipes.remove(tNEIRecipe);
- break;
- }
- }
- }
- }
- }
-
- @Override
- public void loadUsageRecipes(ItemStack aInput) {
- ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput);
-
- ArrayList<ItemStack> tInputs = new ArrayList();
- tInputs.add(aInput);
- tInputs.add(GT_OreDictUnificator.get(false, aInput));
- if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) {
- for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) {
- tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L));
- }
- }
- FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true);
- if (tFluid != null) {
- tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false));
- for (FluidContainerRegistry.FluidContainerData tData :
- FluidContainerRegistry.getRegisteredFluidContainerData()) {
- if (tData.fluid.isFluidEqual(tFluid)) {
- tInputs.add(GT_Utility.copyOrNull(tData.filledContainer));
- }
- }
- }
- for (GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) {
- if (!tRecipe.mHidden) {
- CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe);
- for (ItemStack tStack : tInputs) {
- if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) {
- this.arecipes.add(tNEIRecipe);
- break;
- }
- }
- } else {
- CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe);
- for (ItemStack tStack : tInputs) {
- if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) {
- this.arecipes.remove(tNEIRecipe);
- break;
- }
- }
- }
- }
- CachedDefaultRecipe tNEIRecipe;
- }
-
- @Override
- public String getOverlayIdentifier() {
- return this.mRecipeMap.mNEIName;
- }
-
- @Override
- public void drawBackground(int recipe) {
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GuiDraw.changeTexture(getGuiTexture());
- GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 79);
- }
-
- @Override
- public void onUpdate() {
- super.onUpdate();
- if (!NEIClientUtils.shiftKey()) cycleTicksStatic++;
- }
-
- @Override
- public int recipiesPerPage() {
- return 1;
- }
-
- @Override
- public String getRecipeName() {
- if (mRecipeName == null) {
- mRecipeName = GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName);
- updateOverrideTextColor();
- }
- return mRecipeName;
}
@Override
public String getGuiTexture() {
- return this.mRecipeMap.mNEIGUIPath;
- }
-
- @Override
- public List<String> handleItemTooltip(
- GuiRecipe<?> gui, ItemStack aStack, List<String> currenttip, int aRecipeIndex) {
- CachedRecipe tObject = (CachedRecipe) this.arecipes.get(aRecipeIndex);
- if ((tObject instanceof CachedDefaultRecipe)) {
- CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject;
- for (PositionedStack tStack : tRecipe.mOutputs) {
- if (aStack == tStack.item) {
- if ((!(tStack instanceof FixedPositionedStack))
- || (((FixedPositionedStack) tStack).mChance <= 0)
- || (((FixedPositionedStack) tStack).mChance == 10000)) {
- break;
- }
- currenttip.add("Chance: " + ((FixedPositionedStack) tStack).mChance / 100 + "."
- + (((FixedPositionedStack) tStack).mChance % 100 < 10
- ? "0" + ((FixedPositionedStack) tStack).mChance % 100
- : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100))
- + "%");
- break;
- }
- }
- for (PositionedStack tStack : tRecipe.mInputs) {
- if (aStack == tStack.item) {
- if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true))
- || (tStack.item.stackSize != 0)) {
- break;
- }
- currenttip.add("Does not get consumed in the process");
- break;
- }
- }
- }
- return currenttip;
+ return null;
}
@Override
- public void drawExtras(int aRecipeIndex) {
- GT_Recipe recipe = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe;
- int tEUt = recipe.mEUt;
- int tDuration = recipe.mDuration;
- String[] recipeDesc = recipe.getNeiDesc();
- if (recipeDesc == null) {
- if (tEUt != 0) {
- drawText(
- 10,
- 73,
- trans("152", "Total: ") + GT_Utility.formatNumbers((long) tDuration * tEUt) + " EU",
- 0xFF000000);
- drawText(10, 83, trans("153", "Usage: ") + GT_Utility.formatNumbers(tEUt) + " EU/t", 0xFF000000);
- if (this.mRecipeMap.mShowVoltageAmperageInNEI) {
- int voltage = tEUt / this.mRecipeMap.mAmperage;
- byte tier = GT_Utility.getTier(voltage);
- if (tier < 0 || tier >= 16) {
- drawText(
- 10,
- 93,
- trans("154", "Voltage: ") + GT_Utility.formatNumbers(voltage) + " EU",
- 0xFF000000);
- } else {
- drawText(
- 10,
- 93,
- trans("154", "Voltage: ") + GT_Utility.formatNumbers(voltage) + " EU ("
- + GT_Values.VN[tier] + ")",
- 0xFF000000);
- }
- drawText(
- 10,
- 103,
- trans("155", "Amperage: ") + GT_Utility.formatNumbers(this.mRecipeMap.mAmperage),
- 0xFF000000);
- } else {
- drawText(10, 93, trans("156", "Voltage: unspecified"), 0xFF000000);
- drawText(10, 103, trans("157", "Amperage: unspecified"), 0xFF000000);
- }
- }
- if (tDuration > 0) {
- drawText(
- 10,
- 113,
- trans("158", "Time: ") + GT_Utility.formatNumbers(0.05d * tDuration) + trans("161", " secs"),
- 0xFF000000);
- }
- int tSpecial = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue;
- boolean specialDrew = false;
- if (tSpecial == -100 && GT_Mod.gregtechproxy.mLowGravProcessing) {
- drawText(10, 123, trans("159", "Needs Low Gravity"), 0xFF000000);
- specialDrew = true;
- } else if (tSpecial == -200 && GT_Mod.gregtechproxy.mEnableCleanroom) {
- drawText(10, 123, trans("160", "Needs Cleanroom"), 0xFF000000);
- specialDrew = true;
- } else if (tSpecial == -201) {
- drawText(10, 123, trans("206", "Scan for Assembly Line"), 0xFF000000);
- specialDrew = true;
- } else if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre))
- || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) {
- drawText(
- 10,
- 123,
- this.mRecipeMap.mNEISpecialValuePre
- + GT_Utility.formatNumbers(tSpecial * this.mRecipeMap.mNEISpecialValueMultiplier)
- + this.mRecipeMap.mNEISpecialValuePost,
- 0xFF000000);
- specialDrew = true;
- }
- int y = 123 + (specialDrew ? 10 : 0);
- if (GT_Mod.gregtechproxy.mNEIRecipeOwner) {
- if (recipe.owners.size() > 1) {
- drawText(
- 10,
- y,
- EnumChatFormatting.ITALIC
- + GT_Utility.trans("273", "Original Recipe by: ")
- + recipe.owners.get(0).getName(),
- 0xFF000000);
- y += 10;
- for (int i = 1; i < recipe.owners.size(); i++) {
- drawText(
- 10,
- y,
- EnumChatFormatting.ITALIC
- + GT_Utility.trans("274", "Modified by: ")
- + recipe.owners.get(i).getName(),
- 0xFF000000);
- y += 10;
- }
- } else if (recipe.owners.size() > 0) {
- drawText(
- 10,
- y,
- EnumChatFormatting.ITALIC
- + GT_Utility.trans("272", "Recipe by: ")
- + recipe.owners.get(0).getName(),
- 0xFF000000);
- y += 10;
- }
- }
- if (GT_Mod.gregtechproxy.mNEIRecipeOwnerStackTrace
- && recipe.stackTraces != null
- && !recipe.stackTraces.isEmpty()) {
- drawText(10, y, "stackTrace:", 0xFF000000);
- y += 10;
- for (StackTraceElement stackTrace : recipe.stackTraces.get(0)) {
- drawText(10, y, stackTrace.toString(), 0xFF000000);
- y += 10;
- }
- }
- } else {
- int i = 0;
- for (String descLine : recipeDesc) {
- drawText(10, 73 + 10 * i, descLine, 0xFF000000);
- i++;
- }
- }
- }
-
- public static class GT_RectHandler implements IContainerInputHandler, IContainerTooltipHandler {
- @Override
- public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
-
- return false;
- }
-
- @Override
- public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) {
- return false;
- }
-
- public boolean canHandle(GuiContainer gui) {
- return false;
- // return (((gui instanceof GT_GUIContainer_BasicMachine)) &&
- // (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)));
- }
-
- @Override
- public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
- return currenttip;
- }
-
- private boolean transferRect(GuiContainer gui, boolean usage) {
- return (canHandle(gui))
- && (new Rectangle(138, 18, 18, 18)
- .contains(new Point(
- GuiDraw.getMousePosition().x
- - ((GT_GUIContainer_BasicMachine) gui).getLeft()
- - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0],
- GuiDraw.getMousePosition().y
- - ((GT_GUIContainer_BasicMachine) gui).getTop()
- - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1])))
- && (usage
- ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0])
- : GuiCraftingRecipe.openRecipeGui(
- ((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]));
- }
-
- @Override
- public List<String> handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List<String> currenttip) {
- return currenttip;
- }
-
- @Override
- public List<String> handleItemTooltip(
- GuiContainer gui, ItemStack itemstack, int mousex, int mousey, List<String> currenttip) {
- return currenttip;
- }
-
- @Override
- public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) {
- return false;
- }
-
- @Override
- public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) {}
-
- @Override
- public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) {}
-
- @Override
- public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) {}
-
- @Override
- public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {
- return false;
- }
-
- @Override
- public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {}
-
- @Override
- public void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime) {}
- }
-
- public class FixedPositionedStack extends PositionedStack {
- public final int mChance;
- public boolean permutated = false;
-
- public FixedPositionedStack(Object object, int x, int y) {
- this(object, x, y, 0);
- }
-
- public FixedPositionedStack(Object object, int x, int y, int aChance) {
- super(object, x, y, true);
- this.mChance = aChance;
- }
-
- @Override
- public void generatePermutations() {
- if (this.permutated) {
- return;
- }
- ArrayList<ItemStack> tDisplayStacks = new ArrayList();
- for (ItemStack tStack : this.items) {
- if (GT_Utility.isStackValid(tStack)) {
- if (tStack.getItemDamage() == 32767) {
- List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem());
- if (!permutations.isEmpty()) {
- ItemStack stack;
- for (Iterator i$ = permutations.iterator();
- i$.hasNext();
- tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[] {stack}))) {
- stack = (ItemStack) i$.next();
- }
- } else {
- ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize);
- base.stackTagCompound = tStack.stackTagCompound;
- tDisplayStacks.add(base);
- }
- } else {
- tDisplayStacks.add(GT_Utility.copyOrNull(tStack));
- }
- }
- }
- this.items = ((ItemStack[]) tDisplayStacks.toArray(new ItemStack[0]));
- if (this.items.length == 0) {
- this.items = new ItemStack[] {new ItemStack(Blocks.fire)};
- }
- this.permutated = true;
- setPermutationToRender(0);
- }
- }
-
- public class CachedDefaultRecipe extends CachedRecipe {
- public final GT_Recipe mRecipe;
- public final List<PositionedStack> mOutputs = new ArrayList();
- public final List<PositionedStack> mInputs = new ArrayList();
-
- public CachedDefaultRecipe(GT_Recipe aRecipe) {
- super();
- this.mRecipe = aRecipe;
-
- for (int i = 0; i < 16; i++) {
- Object obj = aRecipe instanceof GT_Recipe_WithAlt
- ? ((GT_Recipe_WithAlt) aRecipe).getAltRepresentativeInput(i)
- : aRecipe.getRepresentativeInput(i);
- if (obj != null) {
- this.mInputs.add(new FixedPositionedStack(obj, 18 * (i % 4) + 12, 18 * (i / 4)));
- }
- }
-
- if (aRecipe.mSpecialItems != null) {
- this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 138, 36));
- }
- if (aRecipe.getOutput(0) != null) {
- this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(0), 138, 0, aRecipe.getOutputChance(0)));
- }
- if ((aRecipe.mFluidInputs.length > 0)
- && (aRecipe.mFluidInputs[0] != null)
- && (aRecipe.mFluidInputs[0].getFluid() != null)) {
- this.mInputs.add(new FixedPositionedStack(
- GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 102, 0));
- if ((aRecipe.mFluidInputs.length > 1)
- && (aRecipe.mFluidInputs[1] != null)
- && (aRecipe.mFluidInputs[1].getFluid() != null)) {
- this.mInputs.add(new FixedPositionedStack(
- GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 102, 18));
- if ((aRecipe.mFluidInputs.length > 2)
- && (aRecipe.mFluidInputs[2] != null)
- && (aRecipe.mFluidInputs[2].getFluid() != null)) {
- this.mInputs.add(new FixedPositionedStack(
- GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[2], true), 102, 36));
- if ((aRecipe.mFluidInputs.length > 3)
- && (aRecipe.mFluidInputs[3] != null)
- && (aRecipe.mFluidInputs[3].getFluid() != null)) {
- this.mInputs.add(new FixedPositionedStack(
- GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[3], true), 102, 54));
- }
- }
- }
- }
- }
-
- @Override
- public List<PositionedStack> getIngredients() {
- return getCycledIngredients(cycleTicksStatic / 10, this.mInputs);
- }
-
- @Override
- public PositionedStack getResult() {
- return null;
- }
-
- @Override
- public List<PositionedStack> getOtherStacks() {
- return this.mOutputs;
- }
+ public String getRecipeName() {
+ return null;
}
}
diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
index d5c59c61c6..2ff5142ace 100644
--- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
+++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
@@ -15,10 +15,19 @@ import codechicken.nei.recipe.ICraftingHandler;
import codechicken.nei.recipe.IUsageHandler;
import codechicken.nei.recipe.RecipeCatalysts;
import codechicken.nei.recipe.TemplateRecipeHandler;
+import com.gtnewhorizons.modularui.api.GlStateManager;
+import com.gtnewhorizons.modularui.api.UIInfos;
+import com.gtnewhorizons.modularui.api.drawable.IDrawable;
+import com.gtnewhorizons.modularui.api.forge.ItemStackHandler;
+import com.gtnewhorizons.modularui.api.math.Pos2d;
+import com.gtnewhorizons.modularui.api.screen.ModularWindow;
+import com.gtnewhorizons.modularui.api.widget.Widget;
+import com.gtnewhorizons.modularui.common.widget.SlotWidget;
import gregtech.GT_Mod;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.SteamVariant;
import gregtech.api.gui.GT_GUIContainer;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
@@ -29,6 +38,7 @@ import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.common.blocks.GT_Item_Machines;
+import gregtech.common.gui.modularui.UIHelper;
import gregtech.common.power.EUPower;
import gregtech.common.power.Power;
import gregtech.common.power.UnspecifiedEUPower;
@@ -77,6 +87,20 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
* Can be referenced from cached recipes.
*/
public static int cycleTicksStatic = Math.abs((int) System.currentTimeMillis());
+ /**
+ * Basically {@link #cycleTicksStatic} but always updated even while holding shift
+ */
+ private static int drawTicks;
+
+ protected static final int PROGRESSBAR_CYCLE_TICKS = 200;
+
+ protected final ModularWindow modularWindow;
+ protected final ItemStackHandler itemInputsInventory;
+ protected final ItemStackHandler itemOutputsInventory;
+ protected final ItemStackHandler specialSlotInventory;
+ protected final ItemStackHandler fluidInputsInventory;
+ protected final ItemStackHandler fluidOutputsInventory;
+ protected static final Pos2d WINDOW_OFFSET = new Pos2d(-sOffsetX, -sOffsetY);
static {
GuiContainerManager.addInputHandler(new GT_RectHandler());
@@ -85,10 +109,25 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
public GT_NEI_DefaultHandler(GT_Recipe.GT_Recipe_Map aRecipeMap) {
super(aRecipeMap);
- if ("gt.recipe.complexfusionreactor".equals(aRecipeMap.mUnlocalizedName)) {
- this.transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 18, 18), getOverlayIdentifier()));
+ Rectangle transferRect = new Rectangle(aRecipeMap.neiTransferRect);
+ transferRect.translate(WINDOW_OFFSET.x, WINDOW_OFFSET.y);
+ this.transferRects.add(new RecipeTransferRect(transferRect, getOverlayIdentifier()));
+
+ if (mRecipeMap.useModularUI) {
+ ModularWindow.Builder builder = mRecipeMap.createNEITemplate(
+ itemInputsInventory = new ItemStackHandler(mRecipeMap.mUsualInputCount),
+ itemOutputsInventory = new ItemStackHandler(mRecipeMap.mUsualOutputCount),
+ specialSlotInventory = new ItemStackHandler(1),
+ fluidInputsInventory = new ItemStackHandler(mRecipeMap.getUsualFluidInputCount()),
+ fluidOutputsInventory = new ItemStackHandler(mRecipeMap.getUsualFluidOutputCount()),
+ () -> ((float) getDrawTicks() % PROGRESSBAR_CYCLE_TICKS) / PROGRESSBAR_CYCLE_TICKS,
+ WINDOW_OFFSET);
+ modularWindow = builder.build();
+ UIInfos.initializeWindow(Minecraft.getMinecraft().thePlayer, modularWindow);
} else {
- this.transferRects.add(new RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier()));
+ itemInputsInventory =
+ itemOutputsInventory = specialSlotInventory = fluidInputsInventory = fluidOutputsInventory = null;
+ modularWindow = null;
}
}
@@ -238,15 +277,31 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
@Override
public void drawBackground(int recipe) {
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GuiDraw.changeTexture(getGuiTexture());
- GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78);
+ if (modularWindow != null) {
+ drawUI(modularWindow);
+ } else {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GuiDraw.changeTexture(getGuiTexture());
+ GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78);
+ }
+ }
+
+ @Override
+ public void drawForeground(int recipe) {
+ if (mRecipeMap.useModularUI) {
+ GL11.glColor4f(1, 1, 1, 1);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ drawExtras(recipe);
+ } else {
+ super.drawForeground(recipe);
+ }
}
@Override
public void onUpdate() {
super.onUpdate();
if (!NEIClientUtils.shiftKey()) cycleTicksStatic++;
+ drawTicks++;
}
@Override
@@ -577,7 +632,35 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
}
protected int getDescriptionYOffset() {
- return 73;
+ return mRecipeMap.neiBackgroundSize.height + mRecipeMap.neiBackgroundOffset.y + WINDOW_OFFSET.y + 3;
+ }
+
+ protected void drawUI(ModularWindow window) {
+ for (IDrawable background : window.getBackground()) {
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(
+ WINDOW_OFFSET.x + mRecipeMap.neiBackgroundOffset.x,
+ WINDOW_OFFSET.y + mRecipeMap.neiBackgroundOffset.y,
+ 0);
+ GlStateManager.color(1f, 1f, 1f, 1f);
+ background.draw(Pos2d.ZERO, window.getSize(), 0);
+ GlStateManager.popMatrix();
+ }
+ for (Widget widget : window.getChildren()) {
+ // NEI already did translation, so we can't use Widget#drawInternal here
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(widget.getPos().x, widget.getPos().y, 0);
+ GlStateManager.color(1, 1, 1, window.getAlpha());
+ GlStateManager.enableBlend();
+ // maybe we can use Minecraft#timer but none of the IDrawables use partialTicks
+ widget.drawBackground(0);
+ widget.draw(0);
+ GlStateManager.popMatrix();
+ }
+ }
+
+ public static int getDrawTicks() {
+ return drawTicks;
}
public static class GT_RectHandler implements IContainerInputHandler, IContainerTooltipHandler {
@@ -730,70 +813,6 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
public final List<PositionedStack> mOutputs;
public final List<PositionedStack> mInputs;
- // Draw a grid of fluids and items (in that order).
- @SuppressWarnings("unused") // Public API method
- public void drawNEIItemAndFluidGrid(
- ItemStack[] ItemArray,
- FluidStack[] FluidArray,
- int x_coord_origin,
- int y_coord_origin,
- int x_dir_max_items,
- int y_max_dir_max_items,
- GT_Recipe Recipe,
- boolean is_input) {
- if (ItemArray.length + FluidArray.length > x_dir_max_items * y_max_dir_max_items) {
- GT_Log.err.println("Recipe cannot be properly displayed in NEI due to too many items/fluids.");
- }
-
- int x_max = x_coord_origin + x_dir_max_items * 18;
-
- int x_coord = x_coord_origin;
- int y_coord = y_coord_origin;
-
- for (FluidStack fluid : FluidArray) {
- if (fluid != GT_Values.NF) {
- if (is_input) {
- this.mInputs.add(new FixedPositionedStack(
- GT_Utility.getFluidDisplayStack(fluid, true), x_coord, y_coord, true));
- } else {
- this.mOutputs.add(new FixedPositionedStack(
- GT_Utility.getFluidDisplayStack(fluid, true),
- x_coord,
- y_coord,
- GT_NEI_DefaultHandler.this.mRecipeMap.mNEIUnificateOutput));
- }
- x_coord += 18;
- if (x_coord == x_max) {
- x_coord = x_coord_origin;
- y_coord += 18;
- }
- }
- }
-
- // Iterate over all items in array and display them.
- int special_counter = 0;
- for (ItemStack item : ItemArray) {
- if (item != GT_Values.NI) {
- if (is_input) {
- mInputs.add(new FixedPositionedStack(item, x_coord, y_coord, true));
- } else {
- mOutputs.add(new FixedPositionedStack(
- item,
- x_coord,
- y_coord,
- Recipe.getOutputChance(special_counter),
- GT_NEI_DefaultHandler.this.mRecipeMap.mNEIUnificateOutput));
- special_counter++;
- }
- x_coord += 18;
- if (x_coord == x_max) {
- x_coord = x_coord_origin;
- y_coord += 18;
- }
- }
- }
- }
-
// Draws a grid of items for NEI rendering.
private void drawNEIItemGrid(
ItemStack[] ItemArray,
@@ -890,103 +909,207 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
mOutputs = new ArrayList<>();
mInputs = new ArrayList<>();
- // Default GT NEI handler for drawing fluids/items on screen.
- switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualInputCount) {
- case 0:
- break;
- case 1: // 1x1
- drawNEIItemGrid(aRecipe.mInputs, 48, 14, 1, 1, aRecipe, true);
- break;
- case 2: // 2x1
- drawNEIItemGrid(aRecipe.mInputs, 30, 14, 2, 1, aRecipe, true);
- break;
- case 3: //
- drawNEIItemGrid(aRecipe.mInputs, 12, 14, 3, 1, aRecipe, true);
- break;
- case 4:
- case 5:
- drawNEIItemGrid(aRecipe.mInputs, 12, 14, 3, 2, aRecipe, true);
- break;
- case 6:
- drawNEIItemGrid(aRecipe.mInputs, 12, 5, 3, 2, aRecipe, true);
- break;
- default:
- drawNEIItemGrid(aRecipe.mInputs, 12, -4, 3, 3, aRecipe, true);
- }
-
- switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualOutputCount) {
- case 0:
- break;
- case 1:
- drawNEIItemGrid(aRecipe.mOutputs, 102, 14, 1, 1, aRecipe, false);
- break;
- case 2:
- drawNEIItemGrid(aRecipe.mOutputs, 102, 14, 2, 1, aRecipe, false);
- break;
- case 3:
- drawNEIItemGrid(aRecipe.mOutputs, 102, 14, 3, 1, aRecipe, false);
- break;
- case 4:
- drawNEIItemGrid(aRecipe.mOutputs, 102, 5, 2, 2, aRecipe, false);
- break;
- case 5:
- case 6:
- drawNEIItemGrid(aRecipe.mOutputs, 102, 5, 3, 2, aRecipe, false);
- break;
- default:
- drawNEIItemGrid(aRecipe.mOutputs, 102, -4, 3, 3, aRecipe, false);
- }
-
- // ??? No idea what this does. Leaving it alone.
- if (aRecipe.mSpecialItems != null) {
- this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52));
- }
-
- if ((aRecipe.mFluidInputs.length > 0)
- && (aRecipe.mFluidInputs[0] != null)
- && (aRecipe.mFluidInputs[0].getFluid() != null)) {
- this.mInputs.add(new FixedPositionedStack(
- GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 48, 52));
- if ((aRecipe.mFluidInputs.length > 1)
- && (aRecipe.mFluidInputs[1] != null)
- && (aRecipe.mFluidInputs[1].getFluid() != null)) {
- this.mInputs.add(new FixedPositionedStack(
- GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 30, 52));
+ if (GT_NEI_DefaultHandler.this.mRecipeMap.useModularUI) {
+ for (Widget child : modularWindow.getChildren()) {
+ if (child instanceof SlotWidget) {
+ SlotWidget widget = (SlotWidget) child;
+ if (widget.getMcSlot().getItemHandler() == itemInputsInventory) {
+ int i = widget.getMcSlot().getSlotIndex();
+ Object input = aRecipe instanceof GT_Recipe.GT_Recipe_WithAlt
+ ? ((GT_Recipe.GT_Recipe_WithAlt) aRecipe).getAltRepresentativeInput(i)
+ : aRecipe.getRepresentativeInput(i);
+ if (input != null) {
+ mInputs.add(new FixedPositionedStack(
+ input, widget.getPos().x + 1, widget.getPos().y + 1, true));
+ }
+ } else if (widget.getMcSlot().getItemHandler() == itemOutputsInventory) {
+ int i = widget.getMcSlot().getSlotIndex();
+ if (aRecipe.mOutputs.length > i && aRecipe.mOutputs[i] != null) {
+ mOutputs.add(new FixedPositionedStack(
+ aRecipe.mOutputs[i],
+ widget.getPos().x + 1,
+ widget.getPos().y + 1,
+ aRecipe.getOutputChance(i),
+ GT_NEI_DefaultHandler.this.mRecipeMap.mNEIUnificateOutput));
+ }
+ } else if (widget.getMcSlot().getItemHandler() == specialSlotInventory) {
+ if (aRecipe.mSpecialItems != null) {
+ mInputs.add(new FixedPositionedStack(
+ aRecipe.mSpecialItems, widget.getPos().x + 1, widget.getPos().y + 1));
+ }
+ } else if (widget.getMcSlot().getItemHandler() == fluidInputsInventory) {
+ int i = widget.getMcSlot().getSlotIndex();
+ if (aRecipe.mFluidInputs.length > i
+ && aRecipe.mFluidInputs[i] != null
+ && aRecipe.mFluidInputs[i].getFluid() != null) {
+ mInputs.add(new FixedPositionedStack(
+ GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[i], true),
+ widget.getPos().x + 1,
+ widget.getPos().y + 1));
+ }
+ } else if (widget.getMcSlot().getItemHandler() == fluidOutputsInventory) {
+ int i = widget.getMcSlot().getSlotIndex();
+ if (aRecipe.mFluidOutputs.length > i
+ && aRecipe.mFluidOutputs[i] != null
+ && aRecipe.mFluidOutputs[i].getFluid() != null) {
+ mOutputs.add(new FixedPositionedStack(
+ GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[i], true),
+ widget.getPos().x + 1,
+ widget.getPos().y + 1));
+ }
+ }
+ }
}
- }
- if (aRecipe.mFluidOutputs.length > 1) {
- if (aRecipe.mFluidOutputs[0] != null && (aRecipe.mFluidOutputs[0].getFluid() != null)) {
- this.mOutputs.add(new FixedPositionedStack(
- GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 120, 5));
+ // items and fluids that exceed usual count
+ UIHelper.forEachSlots(
+ (i, backgrounds, pos) -> {
+ if (i >= GT_NEI_DefaultHandler.this.mRecipeMap.mUsualInputCount
+ && aRecipe.mInputs[i] != null) {
+ mInputs.add(new FixedPositionedStack(aRecipe.mInputs[i], pos.x + 1, pos.y + 1, true));
+ }
+ },
+ (i, backgrounds, pos) -> {
+ if (i >= GT_NEI_DefaultHandler.this.mRecipeMap.mUsualOutputCount
+ && aRecipe.mOutputs[i] != null) {
+ mOutputs.add(new FixedPositionedStack(
+ aRecipe.mOutputs[i],
+ pos.x + 1,
+ pos.y + 1,
+ aRecipe.getOutputChance(i),
+ GT_NEI_DefaultHandler.this.mRecipeMap.mNEIUnificateOutput));
+ }
+ },
+ (i, backgrounds, pos) -> {},
+ (i, backgrounds, pos) -> {
+ if (i >= GT_NEI_DefaultHandler.this.mRecipeMap.getUsualFluidInputCount()
+ && aRecipe.mFluidInputs[i] != null
+ && aRecipe.mFluidInputs[i].getFluid() != null) {
+ mInputs.add(new FixedPositionedStack(
+ GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[i], true),
+ pos.x + 1,
+ pos.y + 1));
+ }
+ },
+ (i, backgrounds, pos) -> {
+ if (i >= GT_NEI_DefaultHandler.this.mRecipeMap.getUsualFluidOutputCount()
+ && aRecipe.mFluidOutputs[i] != null
+ && aRecipe.mFluidOutputs[i].getFluid() != null) {
+ mOutputs.add(new FixedPositionedStack(
+ GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[i], true),
+ pos.x + 1,
+ pos.y + 1));
+ }
+ },
+ null,
+ null,
+ GT_NEI_DefaultHandler.this.mRecipeMap,
+ aRecipe.mInputs.length,
+ aRecipe.mOutputs.length,
+ aRecipe.mFluidInputs.length,
+ aRecipe.mFluidOutputs.length,
+ SteamVariant.NONE,
+ WINDOW_OFFSET);
+ } else {
+ // todo remove after all the migrations are done
+ // Default GT NEI handler for drawing fluids/items on screen.
+ switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualInputCount) {
+ case 0:
+ break;
+ case 1: // 1x1
+ drawNEIItemGrid(aRecipe.mInputs, 48, 14, 1, 1, aRecipe, true);
+ break;
+ case 2: // 2x1
+ drawNEIItemGrid(aRecipe.mInputs, 30, 14, 2, 1, aRecipe, true);
+ break;
+ case 3: //
+ drawNEIItemGrid(aRecipe.mInputs, 12, 14, 3, 1, aRecipe, true);
+ break;
+ case 4:
+ case 5:
+ drawNEIItemGrid(aRecipe.mInputs, 12, 14, 3, 2, aRecipe, true);
+ break;
+ case 6:
+ drawNEIItemGrid(aRecipe.mInputs, 12, 5, 3, 2, aRecipe, true);
+ break;
+ default:
+ drawNEIItemGrid(aRecipe.mInputs, 12, -4, 3, 3, aRecipe, true);
}
- if (aRecipe.mFluidOutputs[1] != null && (aRecipe.mFluidOutputs[1].getFluid() != null)) {
- this.mOutputs.add(new FixedPositionedStack(
- GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 138, 5));
+
+ switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualOutputCount) {
+ case 0:
+ break;
+ case 1:
+ drawNEIItemGrid(aRecipe.mOutputs, 102, 14, 1, 1, aRecipe, false);
+ break;
+ case 2:
+ drawNEIItemGrid(aRecipe.mOutputs, 102, 14, 2, 1, aRecipe, false);
+ break;
+ case 3:
+ drawNEIItemGrid(aRecipe.mOutputs, 102, 14, 3, 1, aRecipe, false);
+ break;
+ case 4:
+ drawNEIItemGrid(aRecipe.mOutputs, 102, 5, 2, 2, aRecipe, false);
+ break;
+ case 5:
+ case 6:
+ drawNEIItemGrid(aRecipe.mOutputs, 102, 5, 3, 2, aRecipe, false);
+ break;
+ default:
+ drawNEIItemGrid(aRecipe.mOutputs, 102, -4, 3, 3, aRecipe, false);
}
- if (aRecipe.mFluidOutputs.length > 2
- && aRecipe.mFluidOutputs[2] != null
- && (aRecipe.mFluidOutputs[2].getFluid() != null)) {
- this.mOutputs.add(new FixedPositionedStack(
- GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[2], true), 102, 23));
+
+ // ??? No idea what this does. Leaving it alone.
+ if (aRecipe.mSpecialItems != null) {
+ this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52));
}
- if (aRecipe.mFluidOutputs.length > 3
- && aRecipe.mFluidOutputs[3] != null
- && (aRecipe.mFluidOutputs[3].getFluid() != null)) {
- this.mOutputs.add(new FixedPositionedStack(
- GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[3], true), 120, 23));
+
+ if ((aRecipe.mFluidInputs.length > 0)
+ && (aRecipe.mFluidInputs[0] != null)
+ && (aRecipe.mFluidInputs[0].getFluid() != null)) {
+ this.mInputs.add(new FixedPositionedStack(
+ GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 48, 52));
+ if ((aRecipe.mFluidInputs.length > 1)
+ && (aRecipe.mFluidInputs[1] != null)
+ && (aRecipe.mFluidInputs[1].getFluid() != null)) {
+ this.mInputs.add(new FixedPositionedStack(
+ GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 30, 52));
+ }
}
- if (aRecipe.mFluidOutputs.length > 4
- && aRecipe.mFluidOutputs[4] != null
- && (aRecipe.mFluidOutputs[4].getFluid() != null)) {
+
+ if (aRecipe.mFluidOutputs.length > 1) {
+ if (aRecipe.mFluidOutputs[0] != null && (aRecipe.mFluidOutputs[0].getFluid() != null)) {
+ this.mOutputs.add(new FixedPositionedStack(
+ GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 120, 5));
+ }
+ if (aRecipe.mFluidOutputs[1] != null && (aRecipe.mFluidOutputs[1].getFluid() != null)) {
+ this.mOutputs.add(new FixedPositionedStack(
+ GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 138, 5));
+ }
+ if (aRecipe.mFluidOutputs.length > 2
+ && aRecipe.mFluidOutputs[2] != null
+ && (aRecipe.mFluidOutputs[2].getFluid() != null)) {
+ this.mOutputs.add(new FixedPositionedStack(
+ GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[2], true), 102, 23));
+ }
+ if (aRecipe.mFluidOutputs.length > 3
+ && aRecipe.mFluidOutputs[3] != null
+ && (aRecipe.mFluidOutputs[3].getFluid() != null)) {
+ this.mOutputs.add(new FixedPositionedStack(
+ GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[3], true), 120, 23));
+ }
+ if (aRecipe.mFluidOutputs.length > 4
+ && aRecipe.mFluidOutputs[4] != null
+ && (aRecipe.mFluidOutputs[4].getFluid() != null)) {
+ this.mOutputs.add(new FixedPositionedStack(
+ GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[4], true), 138, 23));
+ }
+ } else if ((aRecipe.mFluidOutputs.length > 0)
+ && (aRecipe.mFluidOutputs[0] != null)
+ && (aRecipe.mFluidOutputs[0].getFluid() != null)) {
this.mOutputs.add(new FixedPositionedStack(
- GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[4], true), 138, 23));
+ GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 102, 52));
}
- } else if ((aRecipe.mFluidOutputs.length > 0)
- && (aRecipe.mFluidOutputs[0] != null)
- && (aRecipe.mFluidOutputs[0].getFluid() != null)) {
- this.mOutputs.add(new FixedPositionedStack(
- GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 102, 52));
}
}
diff --git a/src/main/java/gregtech/nei/IMCForNEI.java b/src/main/java/gregtech/nei/IMCForNEI.java
index 8f52f4ba97..ca0b0daf34 100644
--- a/src/main/java/gregtech/nei/IMCForNEI.java
+++ b/src/main/java/gregtech/nei/IMCForNEI.java
@@ -10,7 +10,7 @@ public class IMCForNEI {
return;
}
- sendHandler("gt.recipe.plasmaforge", "gregtech:gt.blockmachines:1004");
+ sendHandler("gt.recipe.plasmaforge", "gregtech:gt.blockmachines:1004", 1);
sendCatalyst("gt.recipe.plasmaforge", "gregtech:gt.blockmachines:1004");
sendHandler("gt.recipe.complexfusionreactor", "gregtech:gt.blockmachines:1193");
@@ -19,9 +19,12 @@ public class IMCForNEI {
sendCatalyst("gt.recipe.complexfusionreactor", "gregtech:gt.blockmachines:1195");
sendCatalyst("gt.recipe.gasturbinefuel", "gregtech:gt.blockmachines:1005", -1);
+
+ // overwrite yShift to 6
+ sendHandler("gt.recipe.fakeAssemblylineProcess", "gregtech:gt.blockmachines:1170");
}
- private static void sendHandler(String aName, String aBlock) {
+ private static void sendHandler(String aName, String aBlock, int aMaxRecipesPerPage) {
NBTTagCompound aNBT = new NBTTagCompound();
aNBT.setString("handler", aName);
aNBT.setString("modName", "GregTech");
@@ -30,11 +33,15 @@ public class IMCForNEI {
aNBT.setString("itemName", aBlock);
aNBT.setInteger("handlerHeight", 135);
aNBT.setInteger("handlerWidth", 166);
- aNBT.setInteger("maxRecipesPerPage", 2);
+ 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);
diff --git a/src/main/java/gregtech/nei/NEI_GT_Config.java b/src/main/java/gregtech/nei/NEI_GT_Config.java
index 150b434e6b..2a85b788ab 100644
--- a/src/main/java/gregtech/nei/NEI_GT_Config.java
+++ b/src/main/java/gregtech/nei/NEI_GT_Config.java
@@ -31,7 +31,6 @@ public class NEI_GT_Config implements IConfigureNEI {
Comparator.comparingInt(handler -> RECIPE_MAP_ORDERING.getOrDefault(handler.getRecipeMap(), 0));
public static boolean sIsAdded = true;
- public static GT_NEI_AssLineHandler ALH;
private static void addHandler(TemplateRecipeHandler handler) {
FMLInterModComms.sendRuntimeMessage(
@@ -49,9 +48,6 @@ public class NEI_GT_Config implements IConfigureNEI {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
List<RecipeMapHandler> handlers = new ArrayList<>();
- ALH = new GT_NEI_AssLineHandler(GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes);
- handlers.add(ALH);
-
for (GT_Recipe.GT_Recipe_Map tMap : GT_Recipe.GT_Recipe_Map.sMappings) {
if (tMap.mNEIAllowed) {
handlers.add(new GT_NEI_DefaultHandler(tMap));