mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 04:52:26 +00:00
Fix for missing meta value on ItemStack string
This commit is contained in:
1 parent
1a048c29ad
commit
af3d007da4
3 files changed
+10
-10
No files matched your search
@@ -471,17 +471,17 @@ public class StackUtils {
|
||||
return block == getBlock(stack) && meta == stack.getItemDamage();
|
||||
}
|
||||
|
||||
public static List<ItemStack> parseItemStackStrings(String itemStackStrings) {
|
||||
public static List<ItemStack> parseItemStackStrings(String itemStackStrings, int missingMetaValue) {
|
||||
String[] parts = itemStackStrings.split("(\\s*;\\s*)+");
|
||||
return parseItemStackStrings(parts);
|
||||
return parseItemStackStrings(parts, missingMetaValue);
|
||||
}
|
||||
|
||||
public static List<ItemStack> parseItemStackStrings(String[] parts) {
|
||||
public static List<ItemStack> parseItemStackStrings(String[] parts, int missingMetaValue) {
|
||||
|
||||
List<ItemStack> itemStacks = new ArrayList<ItemStack>();
|
||||
|
||||
for (String itemStackString : parts) {
|
||||
ItemStack itemStack = StackUtils.parseItemStackString(itemStackString);
|
||||
ItemStack itemStack = StackUtils.parseItemStackString(itemStackString, missingMetaValue);
|
||||
if (itemStack != null) {
|
||||
itemStacks.add(itemStack);
|
||||
}
|
||||
@@ -490,7 +490,7 @@ public class StackUtils {
|
||||
return itemStacks;
|
||||
}
|
||||
|
||||
public static ItemStack parseItemStackString(String itemStackString) {
|
||||
public static ItemStack parseItemStackString(String itemStackString, int missingMetaValue) {
|
||||
itemStackString = itemStackString.trim();
|
||||
if (itemStackString.isEmpty()) {
|
||||
return null;
|
||||
@@ -507,7 +507,7 @@ public class StackUtils {
|
||||
int meta;
|
||||
|
||||
if (parts.length == 2) {
|
||||
meta = OreDictionary.WILDCARD_VALUE;
|
||||
meta = missingMetaValue;
|
||||
} else {
|
||||
try {
|
||||
meta = parts[2].equals("*") ? OreDictionary.WILDCARD_VALUE : NumberFormat.getIntegerInstance().parse(parts[2]).intValue();
|
||||
|
||||
@@ -859,7 +859,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
}
|
||||
|
||||
private static void parseAdditionalFlowers(String list, ArrayList<ItemStack> target) {
|
||||
List<ItemStack> flowers = StackUtils.parseItemStackStrings(list);
|
||||
List<ItemStack> flowers = StackUtils.parseItemStackStrings(list, 0);
|
||||
target.addAll(flowers);
|
||||
}
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ public class PluginStorage extends ForestryPlugin {
|
||||
}
|
||||
|
||||
private static void old_parseBackpackItems(String list, IBackpackDefinition backpackDefinition) {
|
||||
List<ItemStack> backpackItems = StackUtils.parseItemStackStrings(list);
|
||||
List<ItemStack> backpackItems = StackUtils.parseItemStackStrings(list, 0);
|
||||
backpackDefinition.addValidItems(backpackItems);
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ public class PluginStorage extends ForestryPlugin {
|
||||
backpackConf.comment = "Add itemStacks for the " + backpackName + "'s backpack here in the format 'modid:name:meta'. For wildcard metadata the format is 'modid:name'.";
|
||||
|
||||
String[] backpackItemList = backpackConf.getStringList();
|
||||
backpackItems = StackUtils.parseItemStackStrings(backpackItemList);
|
||||
backpackItems = StackUtils.parseItemStackStrings(backpackItemList, OreDictionary.WILDCARD_VALUE);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -487,7 +487,7 @@ public class PluginStorage extends ForestryPlugin {
|
||||
}
|
||||
|
||||
IBackpackDefinition backpackDefinition = BackpackManager.definitions.get(tokens[0]);
|
||||
List<ItemStack> itemStacks = StackUtils.parseItemStackStrings(tokens[1]);
|
||||
List<ItemStack> itemStacks = StackUtils.parseItemStackStrings(tokens[1], 0);
|
||||
backpackDefinition.addValidItems(itemStacks);
|
||||
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user