diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-09-07 16:36:25 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-09-07 16:36:25 +1000 |
commit | 221c2f0fe81430e7dd4087e5f5845bd7c62ec56d (patch) | |
tree | d6e0faaef01b9d517828557e1be82500d476f95e /src/Java/gtPlusPlus/core/util/wrapper | |
parent | 5872c0947ce7bc788b03fa2fb690b8815d3d0a04 (diff) | |
download | GT5-Unofficial-221c2f0fe81430e7dd4087e5f5845bd7c62ec56d.tar.gz GT5-Unofficial-221c2f0fe81430e7dd4087e5f5845bd7c62ec56d.tar.bz2 GT5-Unofficial-221c2f0fe81430e7dd4087e5f5845bd7c62ec56d.zip |
% Refactored the entire project to stop using MiscUtils everywhere possible, now it's gtPlusPlus.
Diffstat (limited to 'src/Java/gtPlusPlus/core/util/wrapper')
-rw-r--r-- | src/Java/gtPlusPlus/core/util/wrapper/var.java | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/util/wrapper/var.java b/src/Java/gtPlusPlus/core/util/wrapper/var.java new file mode 100644 index 0000000000..d5e55bd658 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/wrapper/var.java @@ -0,0 +1,67 @@ +package gtPlusPlus.core.util.wrapper; + +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.UtilsItems; +import net.minecraft.item.ItemStack; + +public class var{ + + private ItemStack temp = null; + private String sanitizedName; + private String fqrn; + + public var(String o){ + String t = sanitize('<', o); + String t2 = sanitize('>', t); + sanitizedName = t2; + o = sanitize('"', t2); + fqrn = o; + } + + private String sanitize(char token, String input){ + for (int i=0;i<input.length();i++) { + if (input.charAt(i) == token) { + input = input.replace(input.charAt(i), ' '); + Utils.LOG_WARNING("MATCH FOUND"); + } + input = input.replaceAll(" ", ""); + } + String output = input; + return output; + } + + public String getFQRN(){ + String s = fqrn; + return s; + } + + public String getsanitizedName(){ + String s = sanitizedName; + return s; + } + + private ItemStack getOreDictStack(int stackSize){ + ItemStack v = UtilsItems.getItemStack(sanitizedName, stackSize); + return v; + } + + public ItemStack getStack(int stackSize){ + String oreDict = "ore:"; + if (fqrn.toLowerCase().contains(oreDict.toLowerCase())){ + ItemStack v = getOreDictStack(stackSize); + return v; + } + String[] fqrnSplit = fqrn.split(":"); + String meta = "0"; + try { + if(fqrnSplit[2] != null){meta = fqrnSplit[2];} + temp = UtilsItems.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(meta), stackSize); + } + catch (ArrayIndexOutOfBoundsException a){ + temp = UtilsItems.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(meta), stackSize); + } + return temp; + } + + }
\ No newline at end of file |