fixed a rare exception when streaming modules

closes #148
This commit is contained in:
Ell 2022-10-22 10:28:32 +02:00
parent 7a44dc50ca
commit 4a49e2518e

View file

@ -339,9 +339,8 @@ public class PipeBlockEntity extends BlockEntity implements MenuProvider, IPipeC
Stream.Builder<Pair<ItemStack, IModule>> builder = Stream.builder(); Stream.Builder<Pair<ItemStack, IModule>> builder = Stream.builder();
for (var i = 0; i < this.modules.getSlots(); i++) { for (var i = 0; i < this.modules.getSlots(); i++) {
var stack = this.modules.getStackInSlot(i); var stack = this.modules.getStackInSlot(i);
if (stack.isEmpty()) if (!stack.isEmpty() && stack.getItem() instanceof IModule module)
continue; builder.accept(Pair.of(stack, module));
builder.accept(Pair.of(stack, (IModule) stack.getItem()));
} }
return builder.build(); return builder.build();
} }