fixed a rare exception when streaming modules

closes #148
This commit is contained in:
Ell 2022-10-22 10:28:32 +02:00
parent c4fde68c3c
commit b53affa30c

View file

@ -338,9 +338,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();
} }