From 93fcacdacb4bcacf72cb189ce3795f9569761000 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 3 Jan 2016 19:01:40 +0100 Subject: [PATCH] Fixed a problem with OreDict entries getting added for items with stack sizes of 8 Closes #35 --- .../items/lens/LensNoneRecipeHandler.java | 28 ++++++++++--- .../recipe/CrusherRecipeRegistry.java | 42 +++++++++++++++---- 2 files changed, 55 insertions(+), 15 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/items/lens/LensNoneRecipeHandler.java b/src/main/java/de/ellpeck/actuallyadditions/items/lens/LensNoneRecipeHandler.java index a71a66c0a..2aecd4dbc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/items/lens/LensNoneRecipeHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/items/lens/LensNoneRecipeHandler.java @@ -145,10 +145,18 @@ public class LensNoneRecipeHandler{ } List stacks = OreDictionary.getOres(this.output, false); - for(ItemStack stack : stacks){ - stack.stackSize = 1; + if(stacks != null && !stacks.isEmpty()){ + List stacksCopy = new ArrayList(); + for(ItemStack stack : stacks){ + if(stack != null){ + ItemStack stackCopy = stack.copy(); + stackCopy.stackSize = 1; + stacksCopy.add(stackCopy); + } + } + return stacksCopy; } - return stacks; + return null; } public List getInputs(){ @@ -161,10 +169,18 @@ public class LensNoneRecipeHandler{ } List stacks = OreDictionary.getOres(this.input, false); - for(ItemStack stack : stacks){ - stack.stackSize = 1; + if(stacks != null && !stacks.isEmpty()){ + List stacksCopy = new ArrayList(); + for(ItemStack stack : stacks){ + if(stack != null){ + ItemStack stackCopy = stack.copy(); + stackCopy.stackSize = 1; + stacksCopy.add(stackCopy); + } + } + return stacksCopy; } - return stacks; + return null; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/recipe/CrusherRecipeRegistry.java b/src/main/java/de/ellpeck/actuallyadditions/recipe/CrusherRecipeRegistry.java index 85aa1290f..d62cdfabe 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/recipe/CrusherRecipeRegistry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/recipe/CrusherRecipeRegistry.java @@ -172,10 +172,18 @@ public class CrusherRecipeRegistry{ } List stacks = OreDictionary.getOres(this.outputOne, false); - for(ItemStack stack : stacks){ - stack.stackSize = this.outputOneAmount; + if(stacks != null && !stacks.isEmpty()){ + List stacksCopy = new ArrayList(); + for(ItemStack stack : stacks){ + if(stack != null){ + ItemStack stackCopy = stack.copy(); + stackCopy.stackSize = this.outputOneAmount; + stacksCopy.add(stackCopy); + } + } + return stacksCopy; } - return stacks; + return null; } public List getRecipeOutputTwos(){ @@ -188,10 +196,18 @@ public class CrusherRecipeRegistry{ } List stacks = OreDictionary.getOres(this.outputTwo, false); - for(ItemStack stack : stacks){ - stack.stackSize = this.outputTwoAmount; + if(stacks != null && !stacks.isEmpty()){ + List stacksCopy = new ArrayList(); + for(ItemStack stack : stacks){ + if(stack != null){ + ItemStack stackCopy = stack.copy(); + stackCopy.stackSize = this.outputTwoAmount; + stacksCopy.add(stackCopy); + } + } + return stacksCopy; } - return stacks; + return null; } public List getRecipeInputs(){ @@ -204,10 +220,18 @@ public class CrusherRecipeRegistry{ } List stacks = OreDictionary.getOres(this.input, false); - for(ItemStack stack : stacks){ - stack.stackSize = 1; + if(stacks != null && !stacks.isEmpty()){ + List stacksCopy = new ArrayList(); + for(ItemStack stack : stacks){ + if(stack != null){ + ItemStack stackCopy = stack.copy(); + stackCopy.stackSize = 1; + stacksCopy.add(stackCopy); + } + } + return stacksCopy; } - return stacks; + return null; } }