From 4a49e2518e0aa8c71f1992c0caf8810518c0f983 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 22 Oct 2022 10:28:32 +0200 Subject: [PATCH] fixed a rare exception when streaming modules closes #148 --- .../java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java b/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java index 4a8eb8f..c4994be 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java @@ -339,9 +339,8 @@ public class PipeBlockEntity extends BlockEntity implements MenuProvider, IPipeC Stream.Builder> builder = Stream.builder(); for (var i = 0; i < this.modules.getSlots(); i++) { var stack = this.modules.getStackInSlot(i); - if (stack.isEmpty()) - continue; - builder.accept(Pair.of(stack, (IModule) stack.getItem())); + if (!stack.isEmpty() && stack.getItem() instanceof IModule module) + builder.accept(Pair.of(stack, module)); } return builder.build(); }