diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2017-01-20 02:07:40 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2017-01-20 02:07:40 +1000 |
commit | a6bb1b33da251f4a2ec7a6d6facb4864e9905341 (patch) | |
tree | 84d47440794cadd5c64598355903b123e18e0662 /src/Java/gtPlusPlus/core/util | |
parent | 142fe00070526484862f15f3a125400a22a2fe96 (diff) | |
download | GT5-Unofficial-a6bb1b33da251f4a2ec7a6d6facb4864e9905341.tar.gz GT5-Unofficial-a6bb1b33da251f4a2ec7a6d6facb4864e9905341.tar.bz2 GT5-Unofficial-a6bb1b33da251f4a2ec7a6d6facb4864e9905341.zip |
+ Added a power cost of 32eu/action for the Tree Farmer. (Will eventually get a config option).
% Moved the internal power buffer variable out of the cut method into the class.
% Massive project tidy up, lots of old unused code removed or tidied up.
$ Fixed lots of String comparisons that used == instead of .equals().
$ Fixed Double/Triple/Quad null checks in certain places.
$ Fixed returns that set values at the same time.
$ Swapped 3.14 and 1.57 to Math.PI and Math.PI/2.
$ Fixed possible cases where a NPE may be thrown, by calling logging outside of null checks.
+ Added PI to CORE.java, since it's a double and MC uses it as a float in each instance.
- Stripped 95% of the useless code out of Meta_GT_Proxy.java
Diffstat (limited to 'src/Java/gtPlusPlus/core/util')
-rw-r--r-- | src/Java/gtPlusPlus/core/util/Utils.java | 13 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/util/item/ItemUtils.java | 33 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/util/player/UtilsMining.java | 17 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java | 10 |
4 files changed, 31 insertions, 42 deletions
diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index 10a8f0fa3e..4d944788dd 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -77,7 +77,7 @@ public class Utils { TC_AspectStack returnValue = null; - if (aspect.toUpperCase() == "COGNITIO"){ + if (aspect.toUpperCase().equals("COGNITIO")){ //Adds in Compat for older GT Versions which Misspell aspects. try { if (EnumUtils.isValidEnum(TC_Aspects.class, "COGNITIO")){ @@ -92,7 +92,7 @@ public class Utils { Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); } } - else if (aspect.toUpperCase() == "EXANIMUS"){ + else if (aspect.toUpperCase().equals("EXANIMUS")){ //Adds in Compat for older GT Versions which Misspell aspects. try { if (EnumUtils.isValidEnum(TC_Aspects.class, "EXANIMUS")){ @@ -109,7 +109,7 @@ public class Utils { } - else if (aspect.toUpperCase() == "PRAECANTATIO"){ + else if (aspect.toUpperCase().equals("PRAECANTATIO")){ //Adds in Compat for older GT Versions which Misspell aspects. try { if (EnumUtils.isValidEnum(TC_Aspects.class, "PRAECANTATIO")){ @@ -201,7 +201,9 @@ public class Utils { * Returns if that Liquid is IC2Steam. */ public static boolean isIC2Steam(FluidStack aFluid) { - if (aFluid == null) return false; + if (aFluid == null) { + return false; + } return aFluid.isFluidEqual(getIC2Steam(1)); } @@ -441,8 +443,7 @@ public class Utils { result = hexChar+hexAsStringOrInt; return result; } - else if (hexAsStringOrInt.getClass() == Integer.class){ - ; + else if (hexAsStringOrInt.getClass() == Integer.class){ if (((String) hexAsStringOrInt).length() != 6){ String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6); result = temp; diff --git a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java index 82c38de8bd..1f597302ba 100644 --- a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java @@ -78,7 +78,7 @@ public class ItemUtils { try { Item em = null; Item em1 = getItem(FQRN); - Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); + //Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); if (em1 != null){ em = em1; } @@ -103,13 +103,12 @@ public class ItemUtils { } } - @SuppressWarnings("unused") public static ItemStack getItemStackWithMeta(boolean MOD, String FQRN, String itemName, int meta, int itemstackSize){ if (MOD){ try { Item em = null; Item em1 = getItem(FQRN); - Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); + //Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); if (em1 != null){ if (null == em){ em = em1; @@ -128,12 +127,11 @@ public class ItemUtils { return null; } - @SuppressWarnings("unused") public static ItemStack simpleMetaStack(String FQRN, int meta, int itemstackSize){ try { Item em = null; Item em1 = getItem(FQRN); - Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); + //Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); if (em1 != null){ if (null == em){ em = em1; @@ -170,7 +168,7 @@ public class ItemUtils { } return null; } catch (NullPointerException e) { - Utils.LOG_ERROR(item.getUnlocalizedName()+" not found. [NULL]"); + //Utils.LOG_ERROR(item.getUnlocalizedName()+" not found. [NULL]"); return null; } } @@ -218,17 +216,6 @@ public class ItemUtils { return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size); } - // TODO - /*public static FluidStack getFluidStack(Materials m, int Size) // fqrn = fully qualified resource name - { - String[] fqrnSplit = fqrn.split(":"); - - FluidStack x = (FluidStack) "Materials."+m+".getFluid"(Size); - - return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size); - }*/ - - public static void generateSpawnEgg(String entityModID, String parSpawnName, int colourEgg, int colourOverlay){ Item itemSpawnEgg = new BasicSpawnEgg(entityModID, parSpawnName, colourEgg, colourOverlay).setUnlocalizedName("spawn_egg_"+parSpawnName.toLowerCase()).setTextureName(CORE.MODID+":spawn_egg"); GameRegistry.registerItem(itemSpawnEgg, "spawnEgg"+parSpawnName); @@ -405,8 +392,9 @@ public class ItemUtils { public static BaseItemDecidust generateDecidust(Materials material){ if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null){ Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); - if (placeholder != null) - generateDecidust(placeholder); + if (placeholder != null) { + generateDecidust(placeholder); + } } return null; } @@ -422,8 +410,9 @@ public class ItemUtils { public static BaseItemCentidust generateCentidust(Materials material){ if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null){ Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); - if (placeholder != null) - generateCentidust(placeholder); + if (placeholder != null) { + generateCentidust(placeholder); + } } return null; } @@ -515,7 +504,7 @@ public class ItemUtils { if (blockDrops.isEmpty()){ return null; } - ItemStack outputs[] = new ItemStack[blockDrops.size()]; + ItemStack[] outputs = new ItemStack[blockDrops.size()]; short forCounter = 0; for (ItemStack I : blockDrops){ outputs[forCounter] = I; diff --git a/src/Java/gtPlusPlus/core/util/player/UtilsMining.java b/src/Java/gtPlusPlus/core/util/player/UtilsMining.java index 9147f4195c..8468c4b3a2 100644 --- a/src/Java/gtPlusPlus/core/util/player/UtilsMining.java +++ b/src/Java/gtPlusPlus/core/util/player/UtilsMining.java @@ -2,7 +2,6 @@ package gtPlusPlus.core.util.player; import gtPlusPlus.core.util.Utils; import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -44,7 +43,7 @@ public class UtilsMining { } } - public static void customMine(World world, String FACING, EntityPlayer aPlayer){ + /*public static void customMine(World world, String FACING, EntityPlayer aPlayer){ float DURABILITY_LOSS = 0; if (!world.isRemote){ @@ -71,10 +70,10 @@ public class UtilsMining { for(int i = -2; i < 3; i++) { for(int j = -2; j < 3; j++) { for(int k = -2; k < 3; k++) { -/*// float dur = calculateDurabilityLoss(world, X + i, Y + k, Z + j); +// float dur = calculateDurabilityLoss(world, X + i, Y + k, Z + j); // DURABILITY_LOSS = (DURABILITY_LOSS + dur); // Utils.LOG_WARNING("Added Loss: "+dur); -*/ removeBlockAndDropAsItem(world, X + i, Y + k, Z + j); + removeBlockAndDropAsItem(world, X + i, Y + k, Z + j); } } } @@ -95,9 +94,9 @@ public class UtilsMining { for(int i = -1; i < 2; i++) { for(int j = -1; j < 2; j++) { for(int k = -1; k < 2; k++) { - /*float dur = calculateDurabilityLoss(world, X+k, Y + i, Z + j); + float dur = calculateDurabilityLoss(world, X+k, Y + i, Z + j); DURABILITY_LOSS = (DURABILITY_LOSS + dur); - Utils.LOG_WARNING("Added Loss: "+dur);*/ + Utils.LOG_WARNING("Added Loss: "+dur); removeBlockAndDropAsItem(world, X+k, Y + i, Z + j); } } @@ -119,9 +118,9 @@ public class UtilsMining { for(int i = -1; i < 2; i++) { for(int j = -1; j < 2; j++) { for(int k = -1; k < 2; k++) { - /*float dur = calculateDurabilityLoss(world, X + j, Y + i, Z+k); + float dur = calculateDurabilityLoss(world, X + j, Y + i, Z+k); DURABILITY_LOSS = (DURABILITY_LOSS + dur); - Utils.LOG_WARNING("Added Loss: "+dur);*/ + Utils.LOG_WARNING("Added Loss: "+dur); removeBlockAndDropAsItem(world, X + j, Y + i, Z+k); } } @@ -137,7 +136,7 @@ public class UtilsMining { } DURABILITY_LOSS = 0; } - } + }*/ public static boolean getBlockType(Block block, World world, int[] xyz, int miningLevel){ diff --git a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java index fe4399a579..c1972f4cfd 100644 --- a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java +++ b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java @@ -87,7 +87,11 @@ public class RecipeUtils { Utils.LOG_WARNING("Adding 1."); j++; } - else if (j >= 3){ + else if (j == l){ + Utils.LOG_WARNING("Done iteration."); + break; + } + else { Utils.LOG_WARNING("ArrayList Values: '"+validSlots.get(j)+"' "+validSlots.get(j+1)); if (j < (l-2)){ Utils.LOG_WARNING("Adding 2."); @@ -98,10 +102,6 @@ public class RecipeUtils { break; } } - else if (j == l){ - Utils.LOG_WARNING("Done iteration."); - break; - } if (validSlots.get(j) instanceof String || validSlots.get(j) instanceof ItemStack){ //Utils.LOG_WARNING("Is Valid: "+validSlots.get(j)); } |