diff options
Diffstat (limited to 'src/Java/miscutil/core/util')
-rw-r--r-- | src/Java/miscutil/core/util/Utils.java | 8 | ||||
-rw-r--r-- | src/Java/miscutil/core/util/UtilsText.java | 32 | ||||
-rw-r--r-- | src/Java/miscutil/core/util/item/UtilsItems.java | 88 |
3 files changed, 82 insertions, 46 deletions
diff --git a/src/Java/miscutil/core/util/Utils.java b/src/Java/miscutil/core/util/Utils.java index 026e86ef48..8f6a988a27 100644 --- a/src/Java/miscutil/core/util/Utils.java +++ b/src/Java/miscutil/core/util/Utils.java @@ -119,28 +119,28 @@ public class Utils { //Non-Dev Comments public static void LOG_INFO(String s){ //if (CORE.DEBUG){ - FMLLog.info("MiscUtils: "+s); + FMLLog.info("GT++: "+s); //} } //Developer Comments public static void LOG_WARNING(String s){ if (CORE.DEBUG){ - FMLLog.warning("MiscUtils: "+s); + FMLLog.warning("GT++: "+s); } } //Errors public static void LOG_ERROR(String s){ if (CORE.DEBUG){ - FMLLog.severe("MiscUtils: "+s); + FMLLog.severe("GT++: "+s); } } //Developer Logger public static void LOG_SPECIFIC_WARNING(String whatToLog, String msg, int line){ if (CORE.DEBUG){ - FMLLog.warning("MiscUtils |"+line+"| "+whatToLog+" | "+msg); + FMLLog.warning("GT++ |"+line+"| "+whatToLog+" | "+msg); } } diff --git a/src/Java/miscutil/core/util/UtilsText.java b/src/Java/miscutil/core/util/UtilsText.java new file mode 100644 index 0000000000..79f2b4d4ac --- /dev/null +++ b/src/Java/miscutil/core/util/UtilsText.java @@ -0,0 +1,32 @@ +package miscutil.core.util; + +public enum UtilsText { + + blue('1'), + green('2'), + teal('3'), + maroon('4'), + purple('5'), + orange('6'), + lightGray('7'), + darkGray('8'), + lightBlue('9'), + black('0'), + lime('a'), + aqua('b'), + red('c'), + pink('d'), + yellow('e'), + white('f'); + + private char colourValue; + private UtilsText (char value) + { + this.colourValue = value; + } + + public String colour() { + return "§"+colourValue; + } + +} diff --git a/src/Java/miscutil/core/util/item/UtilsItems.java b/src/Java/miscutil/core/util/item/UtilsItems.java index f8bf9fc029..bda8849768 100644 --- a/src/Java/miscutil/core/util/item/UtilsItems.java +++ b/src/Java/miscutil/core/util/item/UtilsItems.java @@ -4,6 +4,7 @@ import gregtech.api.util.GT_OreDictUnificator; import java.util.ArrayList; +import miscutil.core.item.ModItems; import miscutil.core.item.base.BasicSpawnEgg; import miscutil.core.lib.CORE; import miscutil.core.lib.LoadedMods; @@ -44,7 +45,7 @@ public class UtilsItems { public static ItemStack getSimpleStack(Item x){ return getSimpleStack(x, 1); } - + public static ItemStack getSimpleStack(Item x, int i){ try { ItemStack r = new ItemStack(x, i); @@ -100,49 +101,49 @@ public class UtilsItems { } 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); - if (em1 != null){ - if (null == em){ - em = em1; - } - if (em != null){ - ItemStack metaStack = new ItemStack(em,itemstackSize,meta); - return metaStack; - } + try { + Item em = null; + Item em1 = getItem(FQRN); + Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); + if (em1 != null){ + if (null == em){ + em = em1; } - return null; - } catch (NullPointerException e) { - Utils.LOG_ERROR(FQRN+" not found. [NULL]"); - return null; - } + if (em != null){ + ItemStack metaStack = new ItemStack(em,itemstackSize,meta); + return metaStack; + } + } + return null; + } catch (NullPointerException e) { + Utils.LOG_ERROR(FQRN+" not found. [NULL]"); + return null; + } } - + @SuppressWarnings("unused") public static ItemStack simpleMetaStack(Item item, int meta, int itemstackSize){ - try { - Item em = item; - Item em1 = item; - Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); - if (em1 != null){ - if (null == em){ - em = em1; - } - if (em != null){ - ItemStack metaStack = new ItemStack(em,itemstackSize,meta); - return metaStack; - } + try { + Item em = item; + Item em1 = item; + Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); + if (em1 != null){ + if (null == em){ + em = em1; } - return null; - } catch (NullPointerException e) { - Utils.LOG_ERROR(item.getUnlocalizedName()+" not found. [NULL]"); - return null; - } + if (em != null){ + ItemStack metaStack = new ItemStack(em,itemstackSize,meta); + return metaStack; + } + } + return null; + } catch (NullPointerException e) { + Utils.LOG_ERROR(item.getUnlocalizedName()+" not found. [NULL]"); + return null; + } } public static ItemStack getCorrectStacktype(String fqrn, int stackSize){ @@ -158,7 +159,7 @@ public class UtilsItems { temp = UtilsItems.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(fqrnSplit[2]), stackSize); return temp; } - + public static ItemStack getCorrectStacktype(Object item_Input, int stackSize) { if (item_Input instanceof String){ return getCorrectStacktype(item_Input, stackSize); @@ -207,7 +208,7 @@ public class UtilsItems { return null; } - + 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); @@ -215,9 +216,12 @@ public class UtilsItems { public static ItemStack getItemStackOfAmountFromOreDict(String oredictName, int amount){ ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); - ItemStack temp = oreDictList.get(0); - ItemStack returnValue = new ItemStack(temp.getItem(), amount); + if (!oreDictList.isEmpty()){ + ItemStack returnValue = oreDictList.get(0).copy(); + returnValue.stackSize = amount; return returnValue; + } + return getSimpleStack(ModItems.AAA_Broken, amount); } - + } |