diff options
author | miozune <miozune@gmail.com> | 2022-08-26 17:16:19 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-26 10:16:19 +0200 |
commit | 3187571a15ef7b4fd4648b75eb7aa87254e3451d (patch) | |
tree | 1b17b03d454cb266f04de676bf006f63108bb8e6 /src | |
parent | 07eb934593497b678b07b3e188a3bc525edf34a9 (diff) | |
download | GT5-Unofficial-3187571a15ef7b4fd4648b75eb7aa87254e3451d.tar.gz GT5-Unofficial-3187571a15ef7b4fd4648b75eb7aa87254e3451d.tar.bz2 GT5-Unofficial-3187571a15ef7b4fd4648b75eb7aa87254e3451d.zip |
Fix void protection requires too many slots than actual (#301)
* Fix void protection requires too many slots than actual
* remove proper stack size
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 0e5027fc09..f6d4d3946c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -475,9 +475,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En } } - // Count the slots we need, later we can check if any are able to merge with existing stacks - int aRecipeSlotsRequired = 0; - // A map to hold the items we will be 'inputting' into the output buses. These itemstacks are actually the recipe outputs. ConcurrentSet<FlexiblePair<ItemStack, Integer>> aInputMap = new ConcurrentHashSet<FlexiblePair<ItemStack, Integer>>(); @@ -489,24 +486,17 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En } else { int aStackSize = aY.stackSize * aParallelRecipes; - if (aStackSize > 64) { - int aSlotsNeedsForThisStack = (int) Math.ceil((double) ((float) aStackSize / 64f)); - // Should round up and add as many stacks as required nicely. - aRecipeSlotsRequired += aSlotsNeedsForThisStack; - for (int o=0;o<aRecipeSlotsRequired;o++) { - int aStackToRemove = (aStackSize -= 64) > 64 ? 64 : aStackSize; - aY = aY.copy(); - aY.stackSize = 0; - aInputMap.add(new FlexiblePair<ItemStack, Integer>(aY, aStackToRemove)); - } - } - else { - // Only requires one slot - aRecipeSlotsRequired++; + + int aSlotsNeedsForThisStack = (int) Math.ceil((float) aStackSize / aY.getMaxStackSize()); + // Should round up and add as many stacks as required nicely. + for (int o=0;o<aSlotsNeedsForThisStack;o++) { + if (aStackSize < 1) break; + int aStackToRemove = Math.min(aStackSize, aY.getMaxStackSize()); + aStackSize -= aStackToRemove; aY = aY.copy(); aY.stackSize = 0; - aInputMap.add(new FlexiblePair<ItemStack, Integer>(aY, aStackSize)); - } + aInputMap.add(new FlexiblePair<ItemStack, Integer>(aY, aStackToRemove)); + } } } |