aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/nei
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/nei')
-rw-r--r--src/main/java/gtPlusPlus/nei/DecayableRecipeHandler.java61
-rw-r--r--src/main/java/gtPlusPlus/nei/LFTRSpargingNEIHandler.java35
-rw-r--r--src/main/java/gtPlusPlus/nei/handlers/NeiTextureHandler.java10
3 files changed, 36 insertions, 70 deletions
diff --git a/src/main/java/gtPlusPlus/nei/DecayableRecipeHandler.java b/src/main/java/gtPlusPlus/nei/DecayableRecipeHandler.java
index 3563c7a040..5928fe212a 100644
--- a/src/main/java/gtPlusPlus/nei/DecayableRecipeHandler.java
+++ b/src/main/java/gtPlusPlus/nei/DecayableRecipeHandler.java
@@ -47,19 +47,15 @@ public class DecayableRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadTransferRects() {
- this.transferRects
- .add(new RecipeTransferRect(new Rectangle(6, 3, 16, 16), getOverlayIdentifier(), new Object[0]));
+ this.transferRects.add(new RecipeTransferRect(new Rectangle(6, 3, 16, 16), getOverlayIdentifier()));
}
@Override
public void loadCraftingRecipes(ItemStack result) {
- if (result == null || (!DustDecayable.class.isInstance(result.getItem())
- && !BaseItemDustUnique.class.isInstance(result.getItem()))) {
+ if (result == null
+ || (!(result.getItem() instanceof DustDecayable) && !(result.getItem() instanceof BaseItemDustUnique))) {
return;
}
- if (result != null) {
- // Logger.INFO("Looking up crafting recipes for "+ItemUtils.getItemName(result));
- }
final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes;
for (final DecayableRecipe recipe : recipes) {
if (recipe.isValid()) {
@@ -136,16 +132,16 @@ public class DecayableRecipeHandler extends TemplateRecipeHandler {
if (cost > 0) {
// NEI Strings
- String s = I18n.format("GTPP.nei.info", new Object[] { cost });
- String s0 = I18n.format("GTPP.nei.timetaken", new Object[] { cost });
+ String s = I18n.format("GTPP.nei.info", cost);
+ String s0 = I18n.format("GTPP.nei.timetaken", cost);
// Time Strings
- String s1 = I18n.format("GTPP.time.ticks", new Object[] { cost });
- String s2 = I18n.format("GTPP.time.seconds", new Object[] { cost });
- String s3 = I18n.format("GTPP.time.minutes", new Object[] { cost });
- String s4 = I18n.format("GTPP.time.hours", new Object[] { cost });
- String s5 = I18n.format("GTPP.time.days", new Object[] { cost });
- String s6 = I18n.format("GTPP.time.months", new Object[] { cost });
+ String s1 = I18n.format("GTPP.time.ticks", cost);
+ String s2 = I18n.format("GTPP.time.seconds", cost);
+ String s3 = I18n.format("GTPP.time.minutes", cost);
+ String s4 = I18n.format("GTPP.time.hours", cost);
+ String s5 = I18n.format("GTPP.time.days", cost);
+ String s6 = I18n.format("GTPP.time.months", cost);
int y = 20;
int secs = cost / 20;
@@ -204,8 +200,8 @@ public class DecayableRecipeHandler extends TemplateRecipeHandler {
public class DecayableRecipeNEI extends TemplateRecipeHandler.CachedRecipe implements Comparable<CachedRecipe> {
- private PositionedStack input;
- private PositionedStack output;
+ private final PositionedStack input;
+ private final PositionedStack output;
public int time;
@Override
@@ -227,16 +223,8 @@ public class DecayableRecipeHandler extends TemplateRecipeHandler {
@Override
public int compareTo(CachedRecipe o) {
- boolean b = DecayableRecipeNEI.class.isInstance(o);
- if (b) {
- DecayableRecipeNEI p = (DecayableRecipeNEI) o;
- if (p.time > this.time) {
- return 1;
- } else if (p.time == this.time) {
- return 0;
- } else {
- return -1;
- }
+ if (o instanceof DecayableRecipeNEI p) {
+ return Integer.compare(p.time, this.time);
}
return 0;
}
@@ -244,18 +232,13 @@ public class DecayableRecipeHandler extends TemplateRecipeHandler {
@Override
public boolean equals(Object obj) {
if (obj != null) {
- if (DecayableRecipeNEI.class.isInstance(obj)) {
- DecayableRecipeNEI p = (DecayableRecipeNEI) obj;
- if (p != null) {
- // Time check first to keep it simple and not unbox the Recipes.
- if (p.time == this.time) {
- ItemStack aInput = p.input.item;
- ItemStack aOutput = p.output.item;
- if (GTUtility.areStacksEqual(aInput, this.input.item, true)) {
- if (GTUtility.areStacksEqual(aOutput, this.output.item, true)) {
- return true;
- }
- }
+ if (obj instanceof DecayableRecipeNEI p) {
+ // Time check first to keep it simple and not unbox the Recipes.
+ if (p.time == this.time) {
+ ItemStack aInput = p.input.item;
+ ItemStack aOutput = p.output.item;
+ if (GTUtility.areStacksEqual(aInput, this.input.item, true)) {
+ return GTUtility.areStacksEqual(aOutput, this.output.item, true);
}
}
}
diff --git a/src/main/java/gtPlusPlus/nei/LFTRSpargingNEIHandler.java b/src/main/java/gtPlusPlus/nei/LFTRSpargingNEIHandler.java
index 2cb6ac62b8..33018f2ce2 100644
--- a/src/main/java/gtPlusPlus/nei/LFTRSpargingNEIHandler.java
+++ b/src/main/java/gtPlusPlus/nei/LFTRSpargingNEIHandler.java
@@ -39,10 +39,7 @@ public class LFTRSpargingNEIHandler extends TemplateRecipeHandler {
public LFTRSpargingNEIHandler() {
this.transferRects.add(
- new TemplateRecipeHandler.RecipeTransferRect(
- new Rectangle(65, 13, 36, 18),
- this.getOverlayIdentifier(),
- new Object[0]));
+ new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getOverlayIdentifier()));
if (!NEIGTPPConfig.sIsAdded) {
FMLInterModComms.sendRuntimeMessage(
GTValues.GT,
@@ -83,8 +80,7 @@ public class LFTRSpargingNEIHandler extends TemplateRecipeHandler {
@Override
public void loadTransferRects() {
- this.transferRects
- .add(new RecipeTransferRect(new Rectangle(72, 14, 22, 16), getOverlayIdentifier(), new Object[0]));
+ this.transferRects.add(new RecipeTransferRect(new Rectangle(72, 14, 22, 16), getOverlayIdentifier()));
}
public List<GasSpargingRecipeNEI> getCache() {
@@ -178,7 +174,7 @@ public class LFTRSpargingNEIHandler extends TemplateRecipeHandler {
public void drawExtras(int aRecipeIndex) {
final long tEUt = ((GasSpargingRecipeNEI) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt;
final long tDuration = ((GasSpargingRecipeNEI) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration;
- drawText(10, 73, "Total: " + MathUtils.formatNumbers((long) (tDuration * tEUt)) + " EU", -16777216);
+ drawText(10, 73, "Total: " + MathUtils.formatNumbers(tDuration * tEUt) + " EU", -16777216);
drawText(10, 83, "Usage: " + MathUtils.formatNumbers(tEUt) + " EU/t", -16777216);
drawText(
10,
@@ -233,7 +229,7 @@ public class LFTRSpargingNEIHandler extends TemplateRecipeHandler {
return currenttip;
}
- public class FixedPositionedStack extends PositionedStack {
+ public static class FixedPositionedStack extends PositionedStack {
public final int mChance;
public boolean permutated = false;
@@ -444,16 +440,8 @@ public class LFTRSpargingNEIHandler extends TemplateRecipeHandler {
@Override
public int compareTo(CachedRecipe o) {
- boolean b = GasSpargingRecipeNEI.class.isInstance(o);
- if (b) {
- GasSpargingRecipeNEI p = (GasSpargingRecipeNEI) o;
- if (p.mOutputs.size() > this.mOutputs.size()) {
- return 1;
- } else if (p.mOutputs.size() == this.mOutputs.size()) {
- return 0;
- } else {
- return -1;
- }
+ if (o instanceof GasSpargingRecipeNEI p) {
+ return Integer.compare(p.mOutputs.size(), this.mOutputs.size());
}
return 0;
}
@@ -461,14 +449,9 @@ public class LFTRSpargingNEIHandler extends TemplateRecipeHandler {
@Override
public boolean equals(Object obj) {
if (obj != null) {
- if (GasSpargingRecipeNEI.class.isInstance(obj)) {
- GasSpargingRecipeNEI p = (GasSpargingRecipeNEI) obj;
- if (p != null) {
- if (GTUtility.areStacksEqual(p.mInputs.get(0).item, this.mInputs.get(0).item, true)) {
- if (p.mOutputs.size() == this.mOutputs.size()) {
- return true;
- }
- }
+ if (obj instanceof GasSpargingRecipeNEI p) {
+ if (GTUtility.areStacksEqual(p.mInputs.get(0).item, this.mInputs.get(0).item, true)) {
+ return p.mOutputs.size() == this.mOutputs.size();
}
}
}
diff --git a/src/main/java/gtPlusPlus/nei/handlers/NeiTextureHandler.java b/src/main/java/gtPlusPlus/nei/handlers/NeiTextureHandler.java
index 2644ffb4ff..3084a67bf5 100644
--- a/src/main/java/gtPlusPlus/nei/handlers/NeiTextureHandler.java
+++ b/src/main/java/gtPlusPlus/nei/handlers/NeiTextureHandler.java
@@ -14,23 +14,23 @@ import org.lwjgl.opengl.GL11;
* Based on crazypants.enderio.gui.IconEIO
*
* @author Original EIO Author
- *
+ * <p>
* This is free and unencumbered software released into the public domain.
- *
+ * <p>
* Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source
* code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
- *
+ * <p>
* In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all
* copyright interest in the software to the public domain. We make this dedication for the benefit of the
* public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt
* act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
- *
+ * <p>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
- *
+ * <p>
* For more information, please refer to <http://unlicense.org/>
*
* https://github.com/SleepyTrousers/EnderIO/blob/release/1.7.10/2.2/src/main/java/crazypants/render/RenderUtil.java