Fix possible dupe bug, and allow better support for larger item stack sizes

This commit is contained in:
modmuss50 2018-07-30 19:42:08 +01:00
parent c0b7c16dfd
commit 3d9b81a6b0
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82

View file

@ -120,14 +120,15 @@ public class TileTechStorageBase extends TileLegacyMachineBase
if (!getStackInSlot(1).isEmpty()) { if (!getStackInSlot(1).isEmpty()) {
stacks.add(getStackInSlot(1)); stacks.add(getStackInSlot(1));
} }
for (int i = 0; i < getStoredCount() / 64; i++) { int size = storedItem.getMaxStackSize();
for (int i = 0; i < getStoredCount() / size; i++) {
ItemStack droped = storedItem.copy(); ItemStack droped = storedItem.copy();
droped.setCount(64); droped.setCount(size);
stacks.add(droped); stacks.add(droped);
} }
if (getStoredCount() % 64 != 0) { if (getStoredCount() % size != 0) {
ItemStack droped = storedItem.copy(); ItemStack droped = storedItem.copy();
droped.setCount(getStoredCount() % 64); droped.setCount(getStoredCount() % size);
stacks.add(droped); stacks.add(droped);
} }
} }