aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/nei
diff options
context:
space:
mode:
authorRaven Szewczyk <git@eigenraven.me>2022-08-27 10:19:57 +0100
committerGitHub <noreply@github.com>2022-08-27 11:19:57 +0200
commit6f31720697bcc351421a4d86ba3bf749375dd12c (patch)
tree3adf8f318f22c892d74cd7c9d30b6dd3f11f11bd /src/main/java/gregtech/nei
parentc3eac50decd33ee2be8703dfb2ecf9cdc31c2b67 (diff)
downloadGT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.tar.gz
GT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.tar.bz2
GT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.zip
Update buildscript & apply spotless (#1306)
* Update dependencies * Update buildscript, apply spotless
Diffstat (limited to 'src/main/java/gregtech/nei')
-rw-r--r--src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java239
-rw-r--r--src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java513
-rw-r--r--src/main/java/gregtech/nei/NEIHandlerAbsoluteTooltip.java8
-rw-r--r--src/main/java/gregtech/nei/NEI_GT_Config.java8
-rw-r--r--src/main/java/gregtech/nei/NEI_TransferRectHost.java3
-rw-r--r--src/main/java/gregtech/nei/RecipeMapHandler.java4
6 files changed, 408 insertions, 367 deletions
diff --git a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java
index 3fdefd07d9..8026e8b4ec 100644
--- a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java
+++ b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java
@@ -1,5 +1,7 @@
package gregtech.nei;
+import static gregtech.api.util.GT_Utility.trans;
+
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.PositionedStack;
@@ -20,26 +22,18 @@ 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 net.minecraft.client.Minecraft;
+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.client.resources.IResource;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
-import java.awt.*;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import static gregtech.api.util.GT_Utility.trans;
-
public class GT_NEI_AssLineHandler extends RecipeMapHandler {
public static final int sOffsetX = 5;
public static final int sOffsetY = 11;
@@ -49,14 +43,13 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
* 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) { // this is called when recipes should be shown
super(aRecipeMap);
this.transferRects.add(new RecipeTransferRect(new Rectangle(138, 18, 18, 18), getOverlayIdentifier()));
}
@@ -69,7 +62,7 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
@Override
public TemplateRecipeHandler newInstance() {
- NEI_GT_Config.ALH=new GT_NEI_AssLineHandler(this.mRecipeMap);
+ NEI_GT_Config.ALH = new GT_NEI_AssLineHandler(this.mRecipeMap);
return NEI_GT_Config.ALH;
}
@@ -79,7 +72,7 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
for (GT_Recipe tRecipe : getSortedRecipes()) {
if (!tRecipe.mHidden) {
this.arecipes.add(new CachedDefaultRecipe(tRecipe));
- }else{
+ } else {
this.arecipes.remove(new CachedDefaultRecipe(tRecipe));
}
}
@@ -95,7 +88,9 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
ArrayList<ItemStack> tResults = new ArrayList();
tResults.add(aResult);
tResults.add(GT_OreDictUnificator.get(true, aResult));
- if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) {
+ 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));
}
@@ -103,7 +98,8 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true);
if (tFluid != null) {
tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false));
- for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
+ for (FluidContainerRegistry.FluidContainerData tData :
+ FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (tData.fluid.isFluidEqual(tFluid)) {
tResults.add(GT_Utility.copyOrNull(tData.filledContainer));
}
@@ -145,7 +141,8 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true);
if (tFluid != null) {
tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false));
- for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
+ for (FluidContainerRegistry.FluidContainerData tData :
+ FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (tData.fluid.isFluidEqual(tFluid)) {
tInputs.add(GT_Utility.copyOrNull(tData.filledContainer));
}
@@ -160,7 +157,7 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
break;
}
}
- }else{
+ } else {
CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe);
for (ItemStack tStack : tInputs) {
if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) {
@@ -188,8 +185,7 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
@Override
public void onUpdate() {
super.onUpdate();
- if (!NEIClientUtils.shiftKey())
- cycleTicksStatic++;
+ if (!NEIClientUtils.shiftKey()) cycleTicksStatic++;
}
@Override
@@ -199,11 +195,7 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
@Override
public String getRecipeName() {
- if (mRecipeName == null) {
- mRecipeName = GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName);
- updateOverrideTextColor();
- }
- return mRecipeName;
+ return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName);
}
@Override
@@ -212,23 +204,30 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
}
@Override
- public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack aStack, List<String> currenttip, int aRecipeIndex) {
+ 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)) {
+ 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)) + "%");
+ 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)) {
+ 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");
@@ -241,67 +240,67 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
@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();
+ int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt;
+ int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration;
+ String[] recipeDesc = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.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);
+ 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);
+ drawText(
+ 10,
+ 93,
+ trans("154", "Voltage: ") + GT_Utility.formatNumbers(voltage) + " EU",
+ 0xFFFF0000);
} else {
- drawText(10, 93, trans("154","Voltage: ") + GT_Utility.formatNumbers(voltage) + " EU (" + GT_Values.VN[tier] + ")", 0xFF000000);
+ 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);
+ 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);
+ 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);
+ 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;
+ drawText(10, 123, trans("159", "Needs Low Gravity"), 0xFF000000);
} else if (tSpecial == -200 && GT_Mod.gregtechproxy.mEnableCleanroom) {
- drawText(10, 123, trans("160","Needs Cleanroom"), 0xFF000000);
- specialDrew = true;
+ drawText(10, 123, trans("160", "Needs Cleanroom"), 0xFF000000);
} 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("226", "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("227", "Modified by: ") + recipe.owners.get(i).getName(), 0xFF000000);
- y += 10;
- }
- } else if (recipe.owners.size() > 0) {
- drawText(10, y, EnumChatFormatting.ITALIC + GT_Utility.trans("225", "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;
- }
+ drawText(10, 123, trans("206", "Scan for Assembly Line"), 0xFF000000);
+ } 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);
}
} else {
int i = 0;
@@ -326,7 +325,8 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
public boolean canHandle(GuiContainer gui) {
return false;
- //return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)));
+ // return (((gui instanceof GT_GUIContainer_BasicMachine)) &&
+ // (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)));
}
@Override
@@ -335,8 +335,19 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
}
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]));
-
+ 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
@@ -345,7 +356,8 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
}
@Override
- public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey, List<String> currenttip) {
+ public List<String> handleItemTooltip(
+ GuiContainer gui, ItemStack itemstack, int mousex, int mousey, List<String> currenttip) {
return currenttip;
}
@@ -355,16 +367,13 @@ public class GT_NEI_AssLineHandler 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) {
@@ -372,16 +381,13 @@ public class GT_NEI_AssLineHandler 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 class FixedPositionedStack
- extends PositionedStack {
+ public class FixedPositionedStack extends PositionedStack {
public final int mChance;
public boolean permutated = false;
@@ -406,7 +412,9 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
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}))) {
+ for (Iterator i$ = permutations.iterator();
+ i$.hasNext();
+ tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[] {stack}))) {
stack = (ItemStack) i$.next();
}
} else {
@@ -421,15 +429,14 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
}
this.items = ((ItemStack[]) tDisplayStacks.toArray(new ItemStack[0]));
if (this.items.length == 0) {
- this.items = new ItemStack[]{new ItemStack(Blocks.fire)};
+ this.items = new ItemStack[] {new ItemStack(Blocks.fire)};
}
this.permutated = true;
setPermutationToRender(0);
}
}
- public class CachedDefaultRecipe
- extends CachedRecipe {
+ public class CachedDefaultRecipe extends CachedRecipe {
public final GT_Recipe mRecipe;
public final List<PositionedStack> mOutputs = new ArrayList();
public final List<PositionedStack> mInputs = new ArrayList();
@@ -439,10 +446,12 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
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)));
- }
+ 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) {
@@ -451,14 +460,26 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
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));
+ 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));
}
}
}
diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
index 8932e35710..06f7bde416 100644
--- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
+++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
@@ -1,5 +1,7 @@
package gregtech.nei;
+import static codechicken.nei.recipe.RecipeInfo.getGuiOffset;
+
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.PositionedStack;
@@ -15,7 +17,6 @@ import codechicken.nei.recipe.RecipeCatalysts;
import codechicken.nei.recipe.TemplateRecipeHandler;
import gregtech.GT_Mod;
import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.gui.GT_GUIContainer;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -30,47 +31,40 @@ import gregtech.common.blocks.GT_Item_Machines;
import gregtech.common.power.EUPower;
import gregtech.common.power.Power;
import gregtech.common.power.UnspecifiedEUPower;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-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.FluidStack;
-import org.apache.commons.lang3.Range;
-import org.lwjgl.opengl.GL11;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import java.awt.*;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+import org.apache.commons.lang3.Range;
+import org.lwjgl.opengl.GL11;
-import static codechicken.nei.recipe.RecipeInfo.getGuiOffset;
-
+@SuppressWarnings("all")
public class GT_NEI_DefaultHandler extends RecipeMapHandler {
- @SuppressWarnings("unused") // Public constant
public static final int sOffsetX = 5;
- @SuppressWarnings("unused") // Public constant
public static final int sOffsetY = 11;
private static final int M = 1000000;
- private static final ConcurrentMap<GT_Recipe.GT_Recipe_Map, SortedRecipeListCache> CACHE = new ConcurrentHashMap<>();
+ private static final ConcurrentMap<GT_Recipe.GT_Recipe_Map, SortedRecipeListCache> CACHE =
+ new ConcurrentHashMap<>();
- protected Power mPower;
+ private Power mPower;
private String mRecipeName; // Name of the handler displayed on top
private NEIHandlerAbsoluteTooltip mRecipeNameTooltip;
private static final int RECIPE_NAME_WIDTH = 140;
- /**
+ /**
* Static version of {@link TemplateRecipeHandler#cycleticks}.
* Can be referenced from cached recipes.
*/
@@ -85,8 +79,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
super(aRecipeMap);
if ("gt.recipe.complexfusionreactor".equals(aRecipeMap.mUnlocalizedName)) {
this.transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 18, 18), getOverlayIdentifier()));
- }
- else {
+ } else {
this.transferRects.add(new RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier()));
}
}
@@ -105,13 +98,14 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
public List<CachedDefaultRecipe> getCache() {
SortedRecipeListCache cacheHolder = getCacheHolder();
List<CachedDefaultRecipe> 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
+ 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());
- // while the NEI parallelize handlers, for each individual handler it still uses sequential execution model,
+ // 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
cacheHolder.setCachedRecipes(cache);
@@ -146,15 +140,16 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
ArrayList<ItemStack> tResults = new ArrayList<>();
tResults.add(aResult);
tResults.add(GT_OreDictUnificator.get(true, aResult));
- if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) {
+ 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));
}
}
addFluidStacks(aResult, tResults);
for (CachedDefaultRecipe recipe : getCache()) {
- if (tResults.stream().anyMatch(stack -> recipe.contains(recipe.mOutputs, stack)))
- arecipes.add(recipe);
+ if (tResults.stream().anyMatch(stack -> recipe.contains(recipe.mOutputs, stack))) arecipes.add(recipe);
}
}
@@ -171,13 +166,13 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
}
private void loadTieredCraftingRecipesUpTo(byte upperTier) {
- arecipes.addAll(getTieredRecipes(upperTier));
+ arecipes.addAll(getTieredRecipes((byte) 0, upperTier));
}
- private List<CachedDefaultRecipe> getTieredRecipes(byte upperTier) {
+ private List<CachedDefaultRecipe> getTieredRecipes(byte lowerTier, byte upperTier) {
List<CachedDefaultRecipe> recipes = getCache();
- if ( recipes.size() > 0 ) {
- Range<Integer> indexRange = getCacheHolder().getIndexRangeForTiers((byte) 0, upperTier);
+ if (recipes.size() > 0) {
+ Range<Integer> indexRange = getCacheHolder().getIndexRangeForTiers(lowerTier, upperTier);
recipes = recipes.subList(indexRange.getMinimum(), indexRange.getMaximum() + 1);
}
return recipes;
@@ -196,8 +191,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
}
addFluidStacks(aInput, tInputs);
for (CachedDefaultRecipe recipe : getCache()) {
- if (tInputs.stream().anyMatch(stack -> recipe.contains(recipe.mInputs, stack)))
- arecipes.add(recipe);
+ if (tInputs.stream().anyMatch(stack -> recipe.contains(recipe.mInputs, stack))) arecipes.add(recipe);
}
}
@@ -211,10 +205,11 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
if (gtTileEntity instanceof GT_MetaTileEntity_BasicMachine) {
Power power = ((GT_MetaTileEntity_BasicMachine) gtTileEntity).getPower();
handler.loadCraftingRecipes(getOverlayIdentifier(), power);
+ return handler;
} else {
handler.loadCraftingRecipes(getOverlayIdentifier(), (Object) null);
+ return handler;
}
- return handler;
}
}
return this.getUsageHandler(inputId, ingredients);
@@ -244,8 +239,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
@Override
public void onUpdate() {
super.onUpdate();
- if (!NEIClientUtils.shiftKey())
- cycleTicksStatic++;
+ if (!NEIClientUtils.shiftKey()) cycleTicksStatic++;
}
@Override
@@ -257,7 +251,6 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
public String getRecipeName() {
if (mRecipeName == null) {
mRecipeName = computeRecipeName();
- updateOverrideTextColor();
}
return mRecipeName;
}
@@ -265,24 +258,19 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
private String computeRecipeName() {
String recipeName = GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName);
if (mPower != null) {
- recipeName = addSuffixToRecipeName(recipeName, mPower.getTierString() + ")");
+ recipeName = addSuffixToRecipeName(recipeName, " (", mPower.getTierString() + ")");
}
return recipeName;
}
- private String addSuffixToRecipeName(final String aRecipeName, final String suffix) {
- final String recipeName;
- final String separator;
+ private String addSuffixToRecipeName(String recipeName, String separator, String suffix) {
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
- int recipeNameWidth = fontRenderer.getStringWidth(aRecipeName);
+ int recipeNameWidth = fontRenderer.getStringWidth(recipeName);
int targetWidth = RECIPE_NAME_WIDTH - fontRenderer.getStringWidth(suffix);
- if (recipeNameWidth + fontRenderer.getStringWidth(" (") <= targetWidth) {
- recipeName = aRecipeName;
- separator = " (";
- } else {
- setupRecipeNameTooltip(aRecipeName + " (" + suffix);
+ if (recipeNameWidth + fontRenderer.getStringWidth(separator) > targetWidth) {
+ setupRecipeNameTooltip(recipeName + separator + suffix);
separator = "...(";
- recipeName = shrinkRecipeName(aRecipeName, targetWidth - fontRenderer.getStringWidth(separator));
+ recipeName = shrinkRecipeName(recipeName, targetWidth - fontRenderer.getStringWidth(separator));
}
return recipeName + separator + suffix;
}
@@ -291,7 +279,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
do {
recipeName = recipeName.substring(0, recipeName.length() - 2);
- } while (fontRenderer.getStringWidth(recipeName) > targetWidth);
+ } while (fontRenderer.getStringWidth(recipeName) > targetWidth);
return recipeName;
}
@@ -310,35 +298,43 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
}
@Override
- public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack aStack, List<String> currentTip, int aRecipeIndex) {
+ public List<String> handleItemTooltip(
+ GuiRecipe<?> gui, ItemStack aStack, List<String> currenttip, int aRecipeIndex) {
CachedRecipe tObject = 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)) {
+ if ((!(tStack instanceof FixedPositionedStack))
+ || (((FixedPositionedStack) tStack).mChance <= 0)
+ || (((FixedPositionedStack) tStack).mChance == 10000)) {
break;
}
- currentTip.add(GT_Utility.trans("150", "Chance: ") + ((FixedPositionedStack) tStack).mChance / 100 + "." + (((FixedPositionedStack) tStack).mChance % 100 < 10 ? "0" + ((FixedPositionedStack) tStack).mChance % 100 : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%");
+ currenttip.add(
+ GT_Utility.trans("150", "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)) {
+ if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true))
+ || (tStack.item.stackSize != 0)) {
break;
}
- currentTip.add(GT_Utility.trans("151", "Does not get consumed in the process"));
+ currenttip.add(GT_Utility.trans("151", "Does not get consumed in the process"));
break;
}
}
}
if (mRecipeNameTooltip != null) {
- mRecipeNameTooltip.handleTooltip(currentTip, aRecipeIndex);
+ mRecipeNameTooltip.handleTooltip(currenttip, aRecipeIndex);
}
- return currentTip;
+ return currenttip;
}
private Power getPowerFromRecipeMap() {
@@ -376,21 +372,9 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
String amperage = mPower.getAmperageString();
String powerUsage = mPower.getPowerUsageString();
- if (amperage == null || amperage.equals("unspecified") || powerUsage.contains("(OC)")){
+ if (amperage == null || amperage.equals("unspecified") || powerUsage.contains("(OC)")) {
drawLine(lineCounter, GT_Utility.trans("153", "Usage: ") + powerUsage);
lineCounter++;
- if (GT_Mod.gregtechproxy.mNEIOriginalVoltage) {
- Power originalPower = getPowerFromRecipeMap();
- if (!(originalPower instanceof UnspecifiedEUPower)) {
- originalPower.computePowerUsageAndDuration(recipe.mEUt, recipe.mDuration);
- drawLine(lineCounter, GT_Utility.trans("228", "Original voltage: ") + originalPower.getVoltageString());
- lineCounter++;
- }
- }
- if (amperage != null && !amperage.equals("unspecified") && !amperage.equals("1")) {
- drawLine(lineCounter, GT_Utility.trans("155", "Amperage: ") + amperage);
- lineCounter++;
- }
} else if (amperage.equals("1")) {
drawLine(lineCounter, GT_Utility.trans("154", "Voltage: ") + mPower.getVoltageString());
lineCounter++;
@@ -402,50 +386,24 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
drawLine(lineCounter, GT_Utility.trans("155", "Amperage: ") + amperage);
lineCounter++;
}
-
}
if (mPower.getDurationTicks() > 0) {
- if(GT_Mod.gregtechproxy.mNEIRecipeSecondMode) {
+ if (GT_Mod.gregtechproxy.mNEIRecipeSecondMode) {
drawLine(lineCounter, GT_Utility.trans("158", "Time: ") + mPower.getDurationStringSeconds());
+ lineCounter++;
} else {
drawLine(lineCounter, GT_Utility.trans("158", "Time: ") + mPower.getDurationStringTicks());
- }
- lineCounter++;
- }
- if (this.mRecipeMap.mNEIName.equals("gt.recipe.fusionreactor") || this.mRecipeMap.mNEIName.equals("gt.recipe.complexfusionreactor")) {
- if (drawOptionalLine(lineCounter, getSpecialInfo(recipe.mSpecialValue) + " " + formatSpecialValueFusion(recipe.mSpecialValue, recipe.mEUt))) {
lineCounter++;
}
- } else if (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre) && this.mRecipeMap.mNEISpecialValuePre.toLowerCase().contains("heat capacity")) {
- drawLine(lineCounter, getSpecialInfo(recipe.mSpecialValue));
- lineCounter++;
- drawLine(lineCounter, " " + formatSpecialValueHeatCoil(recipe.mSpecialValue));
- lineCounter++;
- } else if (drawOptionalLine(lineCounter, getSpecialInfo(recipe.mSpecialValue))) {
- lineCounter++;
}
- if (GT_Mod.gregtechproxy.mNEIRecipeOwner) {
- if (recipe.owners.size() > 1) {
- drawLine(lineCounter, EnumChatFormatting.ITALIC + GT_Utility.trans("226", "Original Recipe by: ") + recipe.owners.get(0).getName());
- lineCounter++;
- for (int i = 1; i < recipe.owners.size(); i++) {
- drawLine(lineCounter, EnumChatFormatting.ITALIC + GT_Utility.trans("227", "Modified by: ") + recipe.owners.get(i).getName());
- lineCounter++;
- }
- } else if (recipe.owners.size() > 0) {
- drawLine(lineCounter, EnumChatFormatting.ITALIC + GT_Utility.trans("225", "Recipe by: ") + recipe.owners.get(0).getName());
- lineCounter++;
- }
- }
- if (GT_Mod.gregtechproxy.mNEIRecipeOwnerStackTrace && recipe.stackTraces != null && !recipe.stackTraces.isEmpty()) {
- drawLine(lineCounter, "stackTrace:");
- lineCounter++;
- // todo: good way to show all stacktraces
- for (StackTraceElement stackTrace : recipe.stackTraces.get(0)) {
- drawLine(lineCounter, stackTrace.toString());
- lineCounter++;
- }
+ 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));
}
private void drawOverrideDescription(String[] recipeDesc) {
@@ -456,7 +414,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
}
}
- protected String getSpecialInfo(int specialValue) {
+ private String getSpecialInfo(int specialValue) {
String specialInfo = null;
if (specialValue == -100 && GT_Mod.gregtechproxy.mLowGravProcessing) {
specialInfo = GT_Utility.trans("159", "Needs Low Gravity");
@@ -476,17 +434,17 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
private boolean hasSpecialValueFormat() {
return (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre))
- || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost));
+ || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost));
}
- protected String formatSpecialValue(int SpecialValue) {
- return this.mRecipeMap.mNEISpecialValuePre + GT_Utility.formatNumbers(
- (long) SpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier)
- + this.mRecipeMap.mNEISpecialValuePost;
+ private String formatSpecialValue(int SpecialValue) {
+ return this.mRecipeMap.mNEISpecialValuePre
+ + GT_Utility.formatNumbers((long) SpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier)
+ + this.mRecipeMap.mNEISpecialValuePost;
}
private String formatSpecialValueFusion(int SpecialValue, int Voltage) {
- int tier;
+ int tier = 0;
if (SpecialValue <= 10 * M * 16) {
tier = 1;
} else if (SpecialValue <= 20 * M * 16) {
@@ -496,60 +454,40 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
} else {
tier = 4;
}
- if (Voltage <= GT_Values.V[6]) {
- //no-op
- } else if (Voltage <= GT_Values.V[7]) {
+ if (Voltage <= 32768) {
+ tier = Math.max(tier, 1);
+ } else if (Voltage <= 65536) {
tier = Math.max(tier, 2);
- } else if (Voltage <= GT_Values.V[8]) {
+ } else if (Voltage <= 131072) {
tier = Math.max(tier, 3);
} else {
- tier = 4;
+ tier = Math.max(tier, 4);
}
return "(MK " + tier + ")";
}
- private String formatSpecialValueHeatCoil(int heat) {
- for (HeatingCoilLevel heatLevel : HeatingCoilLevel.values()) {
- if (heatLevel == HeatingCoilLevel.None || heatLevel == HeatingCoilLevel.ULV) continue;
- if (heatLevel.getHeat() >= heat) {
- return "(" + heatLevel.getName() + ")";
- }
- }
- return "(" + HeatingCoilLevel.MAX.getName() + "+)";
- }
-
- @SuppressWarnings("unused") //TODO: Consider removing
- protected boolean drawOptionalLine(int lineNumber, String line, String prefix) {
- if (!(line == null || "unspecified".equals(line))) {
+ private void drawOptionalLine(int lineNumber, String line, String prefix) {
+ if (!"unspecified".equals(line)) {
drawLine(lineNumber, prefix + line);
- return true;
}
- return false;
}
- protected boolean drawOptionalLine(int lineNumber, String line) {
- if (!(line == null || "unspecified".equals(line))) {
+ private void drawOptionalLine(int lineNumber, String line) {
+ if (!"unspecified".equals(line)) {
drawLine(lineNumber, line);
- return true;
}
- return false;
}
- protected void drawLine(int lineNumber, String line) {
- drawText(10, getDescriptionYOffset() + lineNumber * 10, line, 0xFF000000);
+ private void drawLine(int lineNumber, String line) {
+ drawText(10, 73 + lineNumber * 10, line, 0xFF000000);
}
- protected int getDescriptionYOffset() {
- return 73;
- }
-
- public static class GT_RectHandler
- implements IContainerInputHandler, IContainerTooltipHandler {
+ public static class GT_RectHandler implements IContainerInputHandler, IContainerTooltipHandler {
@Override
- public boolean mouseClicked(GuiContainer gui, int mouseX, int mouseY, int button) {
+ public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
if (canHandle(gui)) {
NEI_TransferRectHost host = (NEI_TransferRectHost) gui;
- if (hostRectContainsMouse(host, getMousePos(gui, mouseX, mouseY))) {
+ if (hostRectContainsMouse(host, getMousePos(gui, mousex, mousey))) {
if (button == 0) {
return handleTransferRectMouseClick(host, false);
}
@@ -561,10 +499,11 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
return false;
}
- private Point getMousePos(GuiContainer gui, int mouseX, int mouseY) {
- return new Point(
- mouseX - ((GT_GUIContainer) gui).getLeft() - getGuiOffset(gui)[0],
- mouseY - ((GT_GUIContainer) gui).getTop() - getGuiOffset(gui)[1]);
+ private Point getMousePos(GuiContainer gui, int mousex, int mousey) {
+ Point point = new Point(
+ mousex - ((GT_GUIContainer) gui).getLeft() - getGuiOffset(gui)[0],
+ mousey - ((GT_GUIContainer) gui).getTop() - getGuiOffset(gui)[1]);
+ return point;
}
private boolean hostRectContainsMouse(NEI_TransferRectHost host, Point mousePos) {
@@ -583,28 +522,30 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
}
public boolean canHandle(GuiContainer gui) {
- return gui instanceof NEI_TransferRectHost && GT_Utility.isStringValid(((NEI_TransferRectHost) gui).getNeiTransferRectString());
+ return gui instanceof NEI_TransferRectHost
+ && GT_Utility.isStringValid(((NEI_TransferRectHost) gui).getNeiTransferRectString());
}
@Override
- public List<String> handleTooltip(GuiContainer gui, int mouseX, int mouseY, List<String> currentTip) {
- if ((canHandle(gui)) && (currentTip.isEmpty())) {
+ public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
+ if ((canHandle(gui)) && (currenttip.isEmpty())) {
NEI_TransferRectHost host = (NEI_TransferRectHost) gui;
- if (hostRectContainsMouse(host, getMousePos(gui, mouseX, mouseY))) {
- currentTip.add(host.getNeiTransferRectTooltip());
+ if (hostRectContainsMouse(host, getMousePos(gui, mousex, mousey))) {
+ currenttip.add(host.getNeiTransferRectTooltip());
}
}
- return currentTip;
+ return currenttip;
}
@Override
- public List<String> handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List<String> currentTip) {
- return currentTip;
+ 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;
+ public List<String> handleItemTooltip(
+ GuiContainer gui, ItemStack itemstack, int mousex, int mousey, List<String> currenttip) {
+ return currenttip;
}
@Override
@@ -616,21 +557,21 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
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) {
+ 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) {}
+ 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 {
@@ -680,7 +621,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
}
this.items = tDisplayStacks.toArray(new ItemStack[0]);
if (this.items.length == 0) {
- this.items = new ItemStack[]{new ItemStack(Blocks.fire)};
+ this.items = new ItemStack[] {new ItemStack(Blocks.fire)};
}
this.permutated = true;
setPermutationToRender(0);
@@ -693,8 +634,15 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
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) {
+ 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.");
}
@@ -704,12 +652,17 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
int x_coord = x_coord_origin;
int y_coord = y_coord_origin;
- for(FluidStack fluid : FluidArray) {
+ 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));
+ 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));
+ 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) {
@@ -721,12 +674,17 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
// Iterate over all items in array and display them.
int special_counter = 0;
- for(ItemStack item : ItemArray) {
+ 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));
+ mOutputs.add(new FixedPositionedStack(
+ item,
+ x_coord,
+ y_coord,
+ Recipe.getOutputChance(special_counter),
+ GT_NEI_DefaultHandler.this.mRecipeMap.mNEIUnificateOutput));
special_counter++;
}
x_coord += 18;
@@ -736,30 +694,42 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
}
}
}
-
}
-
+ ;
// Draws a grid of items for NEI rendering.
- private void drawNEIItemGrid(ItemStack[] ItemArray, 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) {
+ private void drawNEIItemGrid(
+ ItemStack[] ItemArray,
+ 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 > 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.");
}
- // 18 pixels to get to a new grid for placing an item tile since they are 16x16 and have 1 pixel buffers around them.
+ // 18 pixels to get to a new grid for placing a item tile since they are 16x16 and have 1 pixel buffers
+ // around them.
int x_max = x_coord_origin + x_dir_max_items * 18;
- // Temp variables to keep track of current coordinates to place item at.
+ // Temp variables to keep track of current coords to place item at.
int x_coord = x_coord_origin;
int y_coord = y_coord_origin;
// Iterate over all items in array and display them.
int special_counter = 0;
- for(ItemStack item : ItemArray) {
+ 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));
+ mOutputs.add(new FixedPositionedStack(
+ item,
+ x_coord,
+ y_coord,
+ Recipe.getOutputChance(special_counter),
+ GT_NEI_DefaultHandler.this.mRecipeMap.mNEIUnificateOutput));
special_counter++;
}
x_coord += 18;
@@ -771,7 +741,50 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
}
}
- @SuppressWarnings("deprecation")
+ // Draws a grid of fluids for NEI rendering.
+ private void drawNEIFluidGrid(
+ FluidStack[] FluidArray,
+ int x_coord_origin,
+ int y_coord_origin,
+ int x_dir_max_fluids,
+ int y_max_dir_max_fluids,
+ GT_Recipe Recipe,
+ boolean is_input) {
+
+ if (FluidArray.length > x_dir_max_fluids * y_max_dir_max_fluids) {
+ GT_Log.err.println("Recipe cannot be properly displayed in NEI due to too many fluids.");
+ }
+
+ // 18 pixels to get to a new grid for placing a fluid tile since they are 16x16 and have 1 pixel buffers
+ // around them.
+ int x_max = x_coord_origin + x_dir_max_fluids * 18;
+
+ // Temp variables to keep track of current coords to place fluid at.
+ int x_coord = x_coord_origin;
+ int y_coord = y_coord_origin;
+
+ // Iterate over all fluids in array and display them.
+ 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;
+ }
+ }
+ }
+ }
+
public CachedDefaultRecipe(GT_Recipe aRecipe) {
super();
this.mRecipe = aRecipe;
@@ -779,27 +792,6 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
List<PositionedStack> maybeOut;
try {
- maybeIn = GT_NEI_DefaultHandler.this.mRecipeMap.getInputPositionedStacks(aRecipe);
- } catch (NullPointerException npe) {
- maybeIn = null;
- GT_Log.err.println("CachedDefaultRecipe - Invalid InputPositionedStacks " + aRecipe);
- npe.printStackTrace(GT_Log.err);
- }
- try {
- maybeOut = GT_NEI_DefaultHandler.this.mRecipeMap.getOutputPositionedStacks(aRecipe);
- } 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;
- }
-
- try {
maybeIn = aRecipe.getInputPositionedStacks();
} catch (NullPointerException npe) {
maybeIn = null;
@@ -837,6 +829,8 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
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;
@@ -845,7 +839,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
break;
default:
drawNEIItemGrid(aRecipe.mInputs, 12, -4, 3, 3, aRecipe, true);
- }
+ }
switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualOutputCount) {
case 0:
@@ -863,44 +857,66 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
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.
- if (aRecipe.mSpecialItems != null) {
- this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52));
- }
+ // ??? 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 ((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
@@ -926,9 +942,11 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
private class SortedRecipeListCache {
private int mCachedRecipesVersion = -1;
+
@Nullable
private SoftReference<List<CachedDefaultRecipe>> mCachedRecipes;
- private Map<Byte, Range<Integer>> mTierIndexes;
+
+ private Range<Integer>[] mTierIndexes;
private Range<Byte> mTierRange;
public int getCachedRecipesVersion() {
@@ -956,22 +974,21 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
}
private void computeTierIndexes() {
- // Holds 16 elements without rehashing
- mTierIndexes = new HashMap<>(GT_Values.V.length + 1, 1f);
- assert mCachedRecipes != null;
- Iterator<CachedDefaultRecipe> iterator = Objects.requireNonNull(mCachedRecipes.get()).iterator();
+ mTierIndexes = new Range[GT_Values.V.length];
+ Iterator<CachedDefaultRecipe> iterator = mCachedRecipes.get().iterator();
int index = 0;
int minIndex = 0;
int maxIndex = -1;
byte previousTier = -1;
byte lowestTier = 0;
- while(iterator.hasNext()) {
+ while (iterator.hasNext()) {
CachedDefaultRecipe recipe = iterator.next();
- byte recipeTier = GT_Utility.getTier(recipe.mRecipe.mEUt / GT_NEI_DefaultHandler.this.mRecipeMap.mAmperage);
+ byte recipeTier =
+ GT_Utility.getTier(recipe.mRecipe.mEUt / GT_NEI_DefaultHandler.this.mRecipeMap.mAmperage);
if (recipeTier != previousTier) {
if (maxIndex != -1) {
- mTierIndexes.put(previousTier, Range.between(minIndex, maxIndex));
+ mTierIndexes[previousTier] = Range.between(minIndex, maxIndex);
} else {
lowestTier = recipeTier;
}
@@ -981,7 +998,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
maxIndex = index;
index++;
if (!iterator.hasNext()) {
- mTierIndexes.put(recipeTier, Range.between(minIndex, maxIndex));
+ mTierIndexes[recipeTier] = Range.between(minIndex, maxIndex);
mTierRange = Range.between(lowestTier, recipeTier);
}
}
@@ -989,18 +1006,18 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
private int getLowIndexForTier(byte lowerTier) {
byte lowTier = (byte) Math.max(mTierRange.getMinimum(), lowerTier);
- while (mTierIndexes.get(lowTier) == null) {
+ while (mTierIndexes[lowTier] == null) {
lowTier++;
}
- return mTierIndexes.get(lowTier).getMinimum();
+ return mTierIndexes[lowTier].getMinimum();
}
private int getHighIndexForTier(byte upperTier) {
byte highTier = (byte) Math.min(mTierRange.getMaximum(), upperTier);
- while (mTierIndexes.get(highTier) == null) {
+ while (mTierIndexes[highTier] == null) {
highTier--;
}
- return mTierIndexes.get(highTier).getMaximum();
+ return mTierIndexes[highTier].getMaximum();
}
}
}
diff --git a/src/main/java/gregtech/nei/NEIHandlerAbsoluteTooltip.java b/src/main/java/gregtech/nei/NEIHandlerAbsoluteTooltip.java
index fae3b68882..e136a67c99 100644
--- a/src/main/java/gregtech/nei/NEIHandlerAbsoluteTooltip.java
+++ b/src/main/java/gregtech/nei/NEIHandlerAbsoluteTooltip.java
@@ -1,7 +1,6 @@
package gregtech.nei;
import codechicken.lib.gui.GuiDraw;
-
import java.awt.*;
import java.util.List;
@@ -18,7 +17,7 @@ public class NEIHandlerAbsoluteTooltip {
public void handleTooltip(List<String> currenttip, int recipeIndex) {
displaySize = GuiDraw.displaySize();
if (shouldAddTooltip(recipeIndex)) {
- currenttip.add(tooltip);
+ currenttip.add(tooltip);
}
}
@@ -31,10 +30,9 @@ public class NEIHandlerAbsoluteTooltip {
return area.contains(mousePos);
}
-
private Point getRelMouse() {
int ySize = Math.min(Math.max(displaySize.height - 68, 166), 370);
- int guiLeft = (displaySize.width - 176) / 2;
+ int guiLeft = (displaySize.width - 176) / 2;
int guiTop = (displaySize.height - ySize) / 2 + 10;
Point mousePos = GuiDraw.getMousePosition();
return new Point(mousePos.x - guiLeft - 5, mousePos.y - guiTop - 38);
@@ -47,6 +45,6 @@ public class NEIHandlerAbsoluteTooltip {
private int getActualRecipesPerPage() {
int ySize = Math.min(Math.max(displaySize.height - 68, 166), 370);
- return (ySize - (12*3)) / 135;
+ return (ySize - (12 * 3)) / 135;
}
}
diff --git a/src/main/java/gregtech/nei/NEI_GT_Config.java b/src/main/java/gregtech/nei/NEI_GT_Config.java
index 0b4476eeef..150b434e6b 100644
--- a/src/main/java/gregtech/nei/NEI_GT_Config.java
+++ b/src/main/java/gregtech/nei/NEI_GT_Config.java
@@ -10,7 +10,6 @@ import cpw.mods.fml.common.event.FMLInterModComms;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
import gregtech.api.util.GT_Recipe;
-
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@@ -29,15 +28,16 @@ public class NEI_GT_Config implements IConfigureNEI {
.build();
private static final Comparator<RecipeMapHandler> RECIPE_MAP_HANDLER_COMPARATOR =
- Comparator.comparingInt(
- handler -> RECIPE_MAP_ORDERING.getOrDefault(handler.getRecipeMap(), 0));
+ 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(
- GT_Values.GT, "NEIPlugins", "register-crafting-handler",
+ GT_Values.GT,
+ "NEIPlugins",
+ "register-crafting-handler",
"gregtech@" + handler.getRecipeName() + "@" + handler.getOverlayIdentifier());
GuiCraftingRecipe.craftinghandlers.add(handler);
GuiUsageRecipe.usagehandlers.add(handler);
diff --git a/src/main/java/gregtech/nei/NEI_TransferRectHost.java b/src/main/java/gregtech/nei/NEI_TransferRectHost.java
index e04740cf99..8c649d8695 100644
--- a/src/main/java/gregtech/nei/NEI_TransferRectHost.java
+++ b/src/main/java/gregtech/nei/NEI_TransferRectHost.java
@@ -4,7 +4,10 @@ import java.awt.*;
public interface NEI_TransferRectHost {
String getNeiTransferRectString();
+
String getNeiTransferRectTooltip();
+
Object[] getNeiTransferRectArgs();
+
Rectangle getNeiTransferRect();
}
diff --git a/src/main/java/gregtech/nei/RecipeMapHandler.java b/src/main/java/gregtech/nei/RecipeMapHandler.java
index 954f7ae7ba..7a644d8ad0 100644
--- a/src/main/java/gregtech/nei/RecipeMapHandler.java
+++ b/src/main/java/gregtech/nei/RecipeMapHandler.java
@@ -29,6 +29,8 @@ abstract class RecipeMapHandler extends TemplateRecipeHandler {
}
protected void drawText(int aX, int aY, String aString, int aColor) {
- Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, overrideTextColor != -1 ? overrideTextColor : aColor);
+ Minecraft.getMinecraft()
+ .fontRenderer
+ .drawString(aString, aX, aY, overrideTextColor != -1 ? overrideTextColor : aColor);
}
}