diff options
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r-- | src/main/java/gregtech/common/GT_RecipeAdder.java | 95 |
1 files changed, 43 insertions, 52 deletions
diff --git a/src/main/java/gregtech/common/GT_RecipeAdder.java b/src/main/java/gregtech/common/GT_RecipeAdder.java index 6b2d556242..b8a76d8980 100644 --- a/src/main/java/gregtech/common/GT_RecipeAdder.java +++ b/src/main/java/gregtech/common/GT_RecipeAdder.java @@ -44,10 +44,9 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { if (aInput1 == null || aInput2 == null || aOutput1 == null || aDuration < 1 || aEUt < 1 || aStartEU < 1) { return false; } - if ((aOutput1 != null) - && ((aDuration = GregTech_API.sRecipeFile.get( - "fusion", aOutput1.getFluid().getName(), aDuration)) - <= 0)) { + if ((aDuration = GregTech_API.sRecipeFile.get( + "fusion", aOutput1.getFluid().getName(), aDuration)) + <= 0) { return false; } GT_Recipe.GT_Recipe_Map.sFusionRecipes.addRecipe( @@ -67,8 +66,8 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { if (FluidOutputArray.length == 0) return false; // If the recipe has more than 2 inputs or 2 outputs it is added to a different recipe map. - // This is so NEI can function properly and understand the recipe. Otherwise it gets cut off. - if ((FluidInputArray.length > 2) || (FluidInputArray.length > 2)) { + // This is so NEI can function properly and understand the recipe. Otherwise, it gets cut off. + if ((FluidInputArray.length > 2) || (FluidOutputArray.length > 2)) { GT_Recipe.GT_Recipe_Map.sComplexFusionRecipes.addRecipe( null, FluidInputArray, @@ -232,7 +231,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { if ((aInput1 == null) || (aOutput1 == null)) { return false; } - if ((aInput1 != null) && ((aDuration = GregTech_API.sRecipeFile.get("compressor", aInput1, aDuration)) <= 0)) { + if ((aDuration = GregTech_API.sRecipeFile.get("compressor", aInput1, aDuration)) <= 0) { return false; } GT_Recipe.GT_Recipe_Map.sCompressorRecipes.addRecipe( @@ -709,7 +708,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { GT_Recipe.GT_Recipe_Map.sPrimitiveBlastRecipes.addRecipe( true, new ItemStack[] { - aInput1, aInput2, GT_ModHandler.getModItem("miscutils", "itemCactusCoke", (aCoalAmount * 2)) + aInput1, aInput2, GT_ModHandler.getModItem("miscutils", "itemCactusCoke", (aCoalAmount * 2L)) }, new ItemStack[] {aOutput1, aOutput2, Materials.Ash.getDustTiny(aCoalAmount * 2)}, null, @@ -722,7 +721,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { GT_Recipe.GT_Recipe_Map.sPrimitiveBlastRecipes.addRecipe( true, new ItemStack[] { - aInput1, aInput2, GT_ModHandler.getModItem("miscutils", "itemSugarCoke", (aCoalAmount * 2)) + aInput1, aInput2, GT_ModHandler.getModItem("miscutils", "itemSugarCoke", (aCoalAmount * 2L)) }, new ItemStack[] {aOutput1, aOutput2, Materials.Ash.getDustTiny(aCoalAmount * 2)}, null, @@ -737,10 +736,10 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { && (aInput2 == null || aInput2.stackSize <= 6) && (aOutput1 == null || aOutput1.stackSize <= 6) && (aOutput2 == null || aOutput2.stackSize <= 6)) { - aInput1 = aInput1 == null ? null : GT_Utility.copyAmount(aInput1.stackSize * 10, aInput1); - aInput2 = aInput2 == null ? null : GT_Utility.copyAmount(aInput2.stackSize * 10, aInput2); - aOutput1 = aOutput1 == null ? null : GT_Utility.copyAmount(aOutput1.stackSize * 10, aOutput1); - aOutput2 = aOutput2 == null ? null : GT_Utility.copyAmount(aOutput2.stackSize * 10, aOutput2); + aInput1 = aInput1 == null ? null : GT_Utility.copyAmount(aInput1.stackSize * 10L, aInput1); + aInput2 = aInput2 == null ? null : GT_Utility.copyAmount(aInput2.stackSize * 10L, aInput2); + aOutput1 = aOutput1 == null ? null : GT_Utility.copyAmount(aOutput1.stackSize * 10L, aOutput1); + aOutput2 = aOutput2 == null ? null : GT_Utility.copyAmount(aOutput2.stackSize * 10L, aOutput2); for (Materials coal : coals) { GT_Recipe.GT_Recipe_Map.sPrimitiveBlastRecipes.addRecipe( true, @@ -818,7 +817,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { return false; } GT_Recipe tRecipe = new GT_Recipe(aInput1, aInput2, aEUt, aDuration, aOutput1); - if ((hidden) && (tRecipe != null)) { + if (hidden) { tRecipe.mHidden = true; } return true; @@ -830,10 +829,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { if ((aInput1 == null) || (aOutput1 == null)) { return false; } - if ((aDuration = GregTech_API.sRecipeFile.get("cnc", aOutput1, aDuration)) <= 0) { - return false; - } - return true; + return GregTech_API.sRecipeFile.get("cnc", aOutput1, aDuration) > 0; } @Override @@ -1066,8 +1062,6 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { return false; } - boolean ret = false; - for (int oreID : OreDictionary.getOreIDs(aOutput1)) { if (OreDictionary.getOreName(oreID).startsWith("circuit")) { return this.addAssemblerRecipeNonOD(aInputs, aFluidInput, aOutput1, aDuration, aEUt, aCleanroom); @@ -1076,25 +1070,22 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { for (ItemStack aInput : aInputs) { if (!GT_Utility.isStackValid(aInput)) { - GT_FML_LOGGER.debug("GT_RecipeAdder: Invalid input for (" + aOutput1.toString() + ")"); + GT_FML_LOGGER.debug("GT_RecipeAdder: Invalid input for (" + aOutput1 + ")"); } } - if (!ret) { - GT_Recipe.GT_Recipe_Map.sAssemblerRecipes.addRecipe( - true, - aInputs, - new ItemStack[] {aOutput1}, - null, - new FluidStack[] {aFluidInput}, - null, - aDuration, - aEUt, - aCleanroom ? -200 : 0); - ret = true; - } + GT_Recipe.GT_Recipe_Map.sAssemblerRecipes.addRecipe( + true, + aInputs, + new ItemStack[] {aOutput1}, + null, + new FluidStack[] {aFluidInput}, + null, + aDuration, + aEUt, + aCleanroom ? -200 : 0); - return ret; + return true; } public boolean addAssemblerRecipeNonOD( @@ -1326,7 +1317,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { if ((aInput2 = GregTech_API.sRecipeFile.get("implosion", aInput1, aInput2)) <= 0) { return false; } - int tExplosives = aInput2 > 0 ? aInput2 < 64 ? aInput2 : 64 : 1; + int tExplosives = Math.min(aInput2, 64); int tGunpowder = tExplosives << 1; // Worst int tDynamite = Math.max(1, tExplosives >> 1); // good int tTNT = tExplosives; // Slightly better @@ -1424,7 +1415,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { null, new FluidStack[] {aInput}, aOutputs, - Math.max(1, aDuration), + aDuration, Math.max(1, aEUt), 0); return false; @@ -1451,7 +1442,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { null, new FluidStack[] {aInput}, aOutputs, - Math.max(1, aDuration), + aDuration, Math.max(1, aEUt), 0); return false; @@ -1565,9 +1556,9 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { GT_Mod.gregtechproxy.mSoundItems.add(aItemStack); GT_Mod.gregtechproxy.mSoundNames.add(aSoundName); if (aSoundName.startsWith("note.")) { - GT_Mod.gregtechproxy.mSoundCounts.add(Integer.valueOf(25)); + GT_Mod.gregtechproxy.mSoundCounts.add(25); } else { - GT_Mod.gregtechproxy.mSoundCounts.add(Integer.valueOf(1)); + GT_Mod.gregtechproxy.mSoundCounts.add(1); } return true; } @@ -1834,10 +1825,10 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { ItemData tData = GT_OreDictUnificator.getItemData(aSolidOutput); if (tData != null && (tData.mPrefix == OrePrefixes.dust - || OrePrefixes.dust.mFamiliarPrefixes.contains(tData.mPrefix))) + || OrePrefixes.dust.mFamiliarPrefixes.contains(tData.mPrefix))) { aSolidOutput = GT_OreDictUnificator.getDust( tData.mMaterial.mMaterial, tData.mMaterial.mAmount * aSolidOutput.stackSize / tScale); - else { + } else { if (aSolidOutput.stackSize / tScale == 0) aSolidOutput = GT_Values.NI; else aSolidOutput = new ItemStack(aSolidOutput.getItem(), aSolidOutput.stackSize / tScale); } @@ -2013,8 +2004,8 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { new ItemStack[] {aInput}, new ItemStack[] {aOutput}, null, - new FluidStack[] {aFluidInput == null ? null : aFluidInput}, - new FluidStack[] {aFluidOutput == null ? null : aFluidOutput}, + new FluidStack[] {aFluidInput}, + new FluidStack[] {aFluidOutput}, aDuration, 1, 0); @@ -2043,8 +2034,8 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { new ItemStack[] {aInput}, new ItemStack[] {aOutput}, null, - new FluidStack[] {aFluidInput == null ? null : aFluidInput}, - new FluidStack[] {aFluidOutput == null ? null : aFluidOutput}, + new FluidStack[] {aFluidInput}, + new FluidStack[] {aFluidOutput}, aDuration, aEUt, 0); @@ -2678,7 +2669,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { aChances, new FluidStack[] {Materials.Oxygen.getGas(aDuration)}, null, - Math.max(1, aDuration), + aDuration, Math.max(1, aEUt), 0); if ((hidden) && (sRecipe != null)) { @@ -2728,7 +2719,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { aChances, new FluidStack[] {aFluidInput}, null, - Math.max(1, aDuration), + aDuration, Math.max(1, aEUt), 0); return true; @@ -2756,7 +2747,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { aChances, new FluidStack[] {aFluidInput}, null, - Math.max(1, aDuration), + aDuration, Math.max(1, aEUt), 0); return true; @@ -2790,7 +2781,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { aChances, new FluidStack[] {aFluidInput}, new FluidStack[] {aFluidOutput}, - Math.max(1, aDuration), + aDuration, Math.max(1, aEUt), 0); return true; @@ -2973,7 +2964,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { ItemStack[] aStacks = (ItemStack[]) obj; if (aStacks.length > 0) { tInputs[i] = aStacks[0]; - tAlts[i] = (ItemStack[]) Arrays.copyOf(aStacks, aStacks.length); + tAlts[i] = Arrays.copyOf(aStacks, aStacks.length); for (ItemStack tAlt : tAlts[i]) { tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(tAlt, true, false); } @@ -3004,7 +2995,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { tPersistentHash = tPersistentHash * 31 + (objs[0] == null ? "" : objs[0].toString()).hashCode(); tPersistentHash = tPersistentHash * 31 + tAmount; continue; - } catch (Exception t) { + } catch (Exception ignored) { } } } |