From 18c7ac051b3e7c392666c63b7b439560ae915c07 Mon Sep 17 00:00:00 2001 From: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Date: Sun, 19 Jun 2022 19:47:52 +0100 Subject: Add Plasma Forge (Endgame multi) (#1076) * Basis of changes. * Fix item stack and fluid vanishing. * Add new plasma forge UI, change tooltip and fix recipe map. * Fix corrupted fluid registry. * Fix fluids in recipes. Items still need adjusting. * Working. * Liquid spacetime and rename multi to D.T.P.S. so it can fit in GUI properly. * Make animation of spacetime fluid slower. * Fix recipe map (again). * Remove screwdriver junk. Clean up code slightly. * More cleaning. * Comments * Add hatch limitations and add some additional information. Also update NEI GUI. * Add proper recipes and change SpaceTime to a fluid not a gas. * Remove depreciated coil check (since I stole the IDs). * Remove depreciated coil check (since I stole the IDs). Add more comments. * Change temp of SpaceTime. * Add catalyst recipes + support for 16:16 fusion recipes. * Add comments. * Scala fix maybe? * Change plasma forge GUI. * Uncap temperature of materials. (Short -> Int) * Add chunkloading support (when multi is active). * Fix NEI merge issues. * fix used ids in kevlar * Add fluid support for laser engraver. * fix sh***t (cherry picked from commit 01851c100c52fd8292028cf6dda2cb136c617afc) * Add new intermediate materials to facilitate crafting. Also fix fusion typo. * Fix heat/fluid quantity display to be formatted correctly. * Change recipes to be more balanced. * Change residue fluid texture. * Restore better naming for multiblock. * Fix recipe typo. * Fix text not wrapping in multi controller. * Give laser engraver internal fluid storage. * Add IMC NEI support. * Update material properties. * Remove old dev comments. * Fix NEI texture. Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Co-authored-by: Martin Robertz --- .../java/gregtech/nei/GT_NEI_DefaultHandler.java | 112 ++++++++++++++------- 1 file changed, 74 insertions(+), 38 deletions(-) (limited to 'src/main/java/gregtech/nei') diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java index 39b0c9e3bb..153fb03f43 100644 --- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java +++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java @@ -14,14 +14,17 @@ import codechicken.nei.recipe.IUsageHandler; import codechicken.nei.recipe.RecipeCatalysts; import codechicken.nei.recipe.TemplateRecipeHandler; import gregtech.GT_Mod; -import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.OrePrefixes; import gregtech.api.gui.GT_GUIContainer; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; import gregtech.api.objects.ItemData; -import gregtech.api.util.*; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; import gregtech.common.power.EUPower; import gregtech.common.power.Power; import gregtech.common.power.UnspecifiedEUPower; @@ -61,7 +64,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { private NEIHandlerAbsoluteTooltip mRecipeNameTooltip; private static final int RECIPE_NAME_WIDTH = 140; - /** + /** * Static version of {@link TemplateRecipeHandler#cycleticks}. * Can be referenced from cached recipes. */ @@ -93,10 +96,10 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { List cache; if (cacheHolder.getCachedRecipesVersion() != GT_Mod.gregtechproxy.getReloadCount() || (cache = cacheHolder.getCachedRecipes()) == null) { cache = mRecipeMap.mRecipeList.stream() // do not use parallel stream. This is already parallelized by NEI - .filter(r -> !r.mHidden) - .sorted() - .map(CachedDefaultRecipe::new) - .collect(Collectors.toList()); + .filter(r -> !r.mHidden) + .sorted() + .map(CachedDefaultRecipe::new) + .collect(Collectors.toList()); // while the NEI parallelize handlers, for each individual handler it still uses sequential execution model // so we do not need any synchronization here // even if it does break, at worst case it's just recreating the cache multiple times, which should be fine @@ -384,7 +387,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { lineCounter++; } } - if (this.mRecipeMap.mNEIName.equals("gt.recipe.fusionreactor")) { + if (this.mRecipeMap.mNEIName.equals("gt.recipe.fusionreactor") || this.mRecipeMap.mNEIName.equals("gt.recipe.complexfusionreactor")) { drawOptionalLine(lineCounter, getSpecialInfo(recipe.mSpecialValue) + " " + formatSpecialValueFusion(recipe.mSpecialValue, recipe.mEUt)); } drawOptionalLine(lineCounter, getSpecialInfo(recipe.mSpecialValue)); @@ -537,16 +540,13 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { } @Override - public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) { - } + public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) {} @Override - public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) { - } + public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) {} @Override - public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) { - } + public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) {} @Override public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { @@ -554,12 +554,10 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { } @Override - public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { - } + 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 void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime) {} } public static class FixedPositionedStack extends PositionedStack { @@ -1060,30 +1058,68 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { } tStartIndex++; } - 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 > 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)); + + // Generates a 4x4 grid of fluid icons if it's a complex fusion recipe. + if (GT_Recipe.GT_Recipe_Map.sComplexFusionRecipes == GT_NEI_DefaultHandler.this.mRecipeMap) { + // 1234 + int x_coord = 3; + int y_coord = -1; + + int x_max = x_coord + 4 * 18; + + for(FluidStack fluid : aRecipe.mFluidInputs) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(fluid, true), x_coord, y_coord)); + x_coord += 18; + if (x_coord == x_max) { + x_coord = 3; + y_coord += 18; + } } - 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)); + + } else { + 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 > 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 (GT_Recipe.GT_Recipe_Map.sComplexFusionRecipes == GT_NEI_DefaultHandler.this.mRecipeMap) { + + int x_coord = 93; + int y_coord = -1; + + int x_max = x_coord + 4 * 18; + + for(FluidStack fluid : aRecipe.mFluidOutputs) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(fluid, true), x_coord, y_coord)); + x_coord += 18; + if (x_coord == x_max) { + x_coord = 93; + y_coord += 18; + } } - 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 > 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[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)); } } -- cgit