From a6bb1b33da251f4a2ec7a6d6facb4864e9905341 Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Fri, 20 Jan 2017 02:07:40 +1000 Subject: + 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 --- src/Java/gtPlusPlus/core/util/item/ItemUtils.java | 33 ++++++++--------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'src/Java/gtPlusPlus/core/util/item') 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; -- cgit