diff options
author | Jordan Byrne <draknyte1@hotmail.com> | 2018-02-27 01:47:11 +1000 |
---|---|---|
committer | Jordan Byrne <draknyte1@hotmail.com> | 2018-02-27 01:47:11 +1000 |
commit | 04210cce5ade5d59182efbe340fa89a9e7ff678d (patch) | |
tree | 31d161bbda949feaea63c1d16a1f2c691c09de4f /src/Java/gtPlusPlus/core/util | |
parent | fe89a9835edc5b10a052cd58669b1826f5b57abd (diff) | |
download | GT5-Unofficial-04210cce5ade5d59182efbe340fa89a9e7ff678d.tar.gz GT5-Unofficial-04210cce5ade5d59182efbe340fa89a9e7ff678d.tar.bz2 GT5-Unofficial-04210cce5ade5d59182efbe340fa89a9e7ff678d.zip |
$ PMD Cleanup.
Diffstat (limited to 'src/Java/gtPlusPlus/core/util')
3 files changed, 12 insertions, 26 deletions
diff --git a/src/Java/gtPlusPlus/core/util/data/LocaleUtils.java b/src/Java/gtPlusPlus/core/util/data/LocaleUtils.java index 957f7923f8..1b225934fd 100644 --- a/src/Java/gtPlusPlus/core/util/data/LocaleUtils.java +++ b/src/Java/gtPlusPlus/core/util/data/LocaleUtils.java @@ -16,7 +16,7 @@ import net.minecraft.item.ItemStack; public class LocaleUtils { - public static boolean GenerateFakeLocaleFile() { + public static boolean generateFakeLocaleFile() { for (ModContainer modcontainer : Loader.instance().getModList()){ if (modcontainer.getModId().toLowerCase().equals("miscutils")) { String S = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index 6d61335fe8..4d5e5eb626 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -27,14 +27,11 @@ public class MathUtils { public static int randInt(final int min, final int max) { // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive - final int randomNum = rand.nextInt((max - min) + 1) + min; - - return randomNum; + return rand.nextInt((max - min) + 1) + min; } public static double getChanceOfXOverYRuns(final double x, final double y){ - final double z = (1-Math.pow((1-x), y)); - return z; + return (1-Math.pow((1-x), y)); } @@ -51,9 +48,7 @@ public class MathUtils { public static long randLong(final long min, final long max) { // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive - final long randomNum = MathUtils.nextLong(rand,(max - min) + 1) + min; - - return randomNum; + return MathUtils.nextLong(rand,(max - min) + 1) + min; } private static long nextLong(final Random rng, final long n) { // error checking and 2^x checking removed for simplicity. @@ -79,8 +74,7 @@ public class MathUtils { public static double randDouble(final double min, final double max) { // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive - final double randomNum = MathUtils.nextDouble(rand,(max - min) + 1) + min; - return randomNum; + return MathUtils.nextDouble(rand,(max - min) + 1) + min; } private static double nextDouble(final Random rng, final double n) { @@ -106,8 +100,7 @@ public class MathUtils { public static float randFloat(final float min, final float max) { // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive - final float randomNum = MathUtils.nextFloat(rand,(max - min) + 1) + min; - return randomNum; + return MathUtils.nextFloat(rand,(max - min) + 1) + min; } private static float nextFloat(final Random rng, final float n) { @@ -131,9 +124,7 @@ public class MathUtils { * @return double between min and max, inclusive. */ public static double findPercentage(final double current, final double max){ - final double c = (current / max) * 100; - final double roundOff = Math.round(c * 100.00) / 100.00; - return roundOff; + return Math.round(((current / max) * 100) * 100.00) / 100.00; } public static int findPercentageOfInt(long input, float percentage){ @@ -284,8 +275,7 @@ public class MathUtils { * @return hexInteger between min and max, inclusive. */ public static int generateRandomHexValue(final int min, final int max){ - final int result = getHexNumberFromInt(randInt(min, max)); - return result; + return getHexNumberFromInt(randInt(min, max)); } @@ -327,7 +317,7 @@ public class MathUtils { if (outputArray.length > 0) { return outputArray; } - return null; + return new long[] {}; } private static long gcd(long a, long b){ @@ -349,12 +339,8 @@ public class MathUtils { } final public static int getRgbAsHex(final short[] RGBA){ - final int returnValue = Utils.rgbtoHexValue(RGBA[0], RGBA[1], RGBA[2]); - if (returnValue == 0){ - return 0; - } - return Utils.rgbtoHexValue(RGBA[0], RGBA[1], RGBA[2]); + return (returnValue == 0) ? 0 : returnValue; } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java index 854f813d2b..70d90001c5 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java @@ -47,7 +47,7 @@ class LibProxy1 extends LibraryProxy { @Override public boolean addSmeltingAndAlloySmeltingRecipe(final ItemStack aInput, final ItemStack aOutput) { try { - Logger.INFO("Trying with Gt 5.7/5.8 Method."); + //Logger.INFO("Trying with Gt 5.7/5.8 Method."); return (boolean) this.m1.invoke(null, aInput, aOutput); } catch (final Exception e) { throw new RuntimeException(e); @@ -65,7 +65,7 @@ class LibProxy2 extends LibraryProxy { @Override public boolean addSmeltingAndAlloySmeltingRecipe(final ItemStack aInput, final ItemStack aOutput) { try { - Logger.INFO("Trying with Gt 5.9 Method."); + //Logger.INFO("Trying with Gt 5.9 Method."); return (boolean) this.m2.invoke(null, aInput, aOutput, true); } catch (final Exception e) { throw new RuntimeException(e); |