diff options
author | Yang Xizhi <60341015+GlodBlock@users.noreply.github.com> | 2022-06-26 15:52:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-26 09:52:03 +0200 |
commit | 8ac651ee86fbd3690b8d7902f31bf81de6ba9b29 (patch) | |
tree | 3146bfe0a13ca8f42566cfc2e9127f07eaf6b4f8 /src/main/java/gregtech/nei | |
parent | e670f02425085e2b18e4b19fe31b6036b3eb23cf (diff) | |
download | GT5-Unofficial-8ac651ee86fbd3690b8d7902f31bf81de6ba9b29.tar.gz GT5-Unofficial-8ac651ee86fbd3690b8d7902f31bf81de6ba9b29.tar.bz2 GT5-Unofficial-8ac651ee86fbd3690b8d7902f31bf81de6ba9b29.zip |
fix nei (#1097)
Diffstat (limited to 'src/main/java/gregtech/nei')
-rw-r--r-- | src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java | 198 |
1 files changed, 97 insertions, 101 deletions
diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java index 282261e1d8..d2eefbd9f3 100644 --- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java +++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java @@ -77,7 +77,12 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { public GT_NEI_DefaultHandler(GT_Recipe.GT_Recipe_Map aRecipeMap) { super(aRecipeMap); - this.transferRects.add(new RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier())); + if ("gt.recipe.complexfusionreactor".equals(aRecipeMap.mUnlocalizedName)) { + this.transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 18, 18), getOverlayIdentifier())); + } + else { + this.transferRects.add(new RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier())); + } } @Deprecated @@ -620,7 +625,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { public final List<PositionedStack> mInputs; // Draw a grid of fluids and items (in that order). - private 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) { + 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."); } @@ -735,84 +740,79 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { List<PositionedStack> maybeIn; List<PositionedStack> maybeOut; + try { + maybeIn = aRecipe.getInputPositionedStacks(); + } catch (NullPointerException npe) { + maybeIn = null; + GT_Log.err.println("CachedDefaultRecipe - Invalid InputPositionedStacks " + aRecipe); + npe.printStackTrace(GT_Log.err); + } + try { + maybeOut = aRecipe.getOutputPositionedStacks(); + } catch (NullPointerException npe) { + maybeOut = null; + GT_Log.err.println("CachedDefaultRecipe - Invalid OutputPositionedStacks " + aRecipe); + npe.printStackTrace(GT_Log.err); + } + + if (maybeOut != null && maybeIn != null) { + mOutputs = maybeOut; + mInputs = maybeIn; + return; + } + mOutputs = new ArrayList<>(); mInputs = new ArrayList<>(); - if (GT_Recipe.GT_Recipe_Map.sComplexFusionRecipes == GT_NEI_DefaultHandler.this.mRecipeMap) { - // Special handler for complex fusion NEI display. - // Generates a 4x4 grid of fluid icons if it's a complex fusion recipe. - drawNEIFluidGrid(aRecipe.mFluidInputs, 3, -1, 4, 4, aRecipe, true); - drawNEIFluidGrid(aRecipe.mFluidOutputs, 93, -1, 4, 4, aRecipe, false); - } else if (GT_Recipe.GT_Recipe_Map.sPlasmaForgeRecipes == GT_NEI_DefaultHandler.this.mRecipeMap) { - // Special handeler for plasma forge NEI display. - // Generates a 3x3 grid of fluid icons if it's a plasma forge recipe. - drawNEIItemAndFluidGrid(aRecipe.mInputs, aRecipe.mFluidInputs, 12, 5, 3, 2, aRecipe, true); - drawNEIItemAndFluidGrid(aRecipe.mOutputs, aRecipe.mFluidOutputs, 102, 5, 3, 2, aRecipe, false); - } else if (GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes == GT_NEI_DefaultHandler.this.mRecipeMap) { - // Special handler for LCR. - drawNEIItemAndFluidGrid(aRecipe.mInputs, aRecipe.mFluidInputs, 12, 5, 3, 2, aRecipe, true); - drawNEIItemAndFluidGrid(aRecipe.mOutputs, aRecipe.mFluidOutputs, 102, 5, 3, 2, aRecipe, false); - } else { - // 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: - drawNEIItemGrid(aRecipe.mInputs, 12, 14, 3, 2, aRecipe, true); - break; - 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: - if (GT_NEI_DefaultHandler.this.mRecipeMap.mUnlocalizedName.equals("gg.recipe.precise_assembler")) { - drawNEIItemGrid(aRecipe.mInputs, 4, 3, 4, 1, aRecipe, true); - drawNEIFluidGrid(aRecipe.mFluidInputs, 4, 38, 4, 1, aRecipe, true); - break; - } - - drawNEIItemGrid(aRecipe.mInputs, 12, -4, 3, 3, aRecipe, true); + // 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: + drawNEIItemGrid(aRecipe.mInputs, 12, 14, 3, 2, aRecipe, true); + break; + 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: - drawNEIItemGrid(aRecipe.mOutputs, 102, 5, 3, 2, aRecipe, false); - break; - case 6: - drawNEIItemGrid(aRecipe.mOutputs, 102, 5, 3, 2, aRecipe, false); - break; - default: - // Custom handlers from addons. - if (GT_NEI_DefaultHandler.this.mRecipeMap.mUnlocalizedName == "gg.recipe.precise_assembler") { - drawNEIItemGrid(aRecipe.mOutputs, 111, 20, 1, 1, aRecipe, false); - break; - } - drawNEIItemGrid(aRecipe.mOutputs, 102, -4, 3, 3, aRecipe, false); + 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: + drawNEIItemGrid(aRecipe.mOutputs, 102, 5, 3, 2, aRecipe, false); + break; + 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. @@ -820,36 +820,32 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); } - if (!GT_NEI_DefaultHandler.this.mRecipeMap.mUnlocalizedName.equals("gg.recipe.precise_assembler")) { - - 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.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)); - } - 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)); + 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)); } - } } @Override |