Skip to content

Commit

Permalink
only use valid handlers in contraption inventories
Browse files Browse the repository at this point in the history
fix #965
  • Loading branch information
TropheusJ committed Jul 3, 2023
1 parent ad64c63 commit 75a6748
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions FABRIC_CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Change logging starts below:
- fix pipe ponder crashing (#987, #970)
- added safety on train carriage loading (#985)
- fix visibility in fluids (#967)
- fix unsupported inventories on contraptions causing crashes (#965)
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static boolean canUseAsStorage(BlockEntity be) {
Storage<ItemVariant> handler = TransferUtil.getItemStorage(be);
if (handler instanceof ItemStackHandler)
return !(handler instanceof ProcessingInventory);
return canUseModdedInventory(be, handler);
return handler != null && canUseModdedInventory(be, handler);

} catch (Exception e) {
return false;
Expand Down Expand Up @@ -216,7 +216,7 @@ public boolean isValid() {
}

public boolean canUseForFuel() {
return !noFuel;
return isValid() && !noFuel;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public void createHandlers() {
Collection<MountedStorage> itemHandlers = storage.values();

inventory = wrapItems(itemHandlers.stream()
.filter(MountedStorage::isValid)
.map(MountedStorage::getItemHandler)
.toList(), false);

Expand Down

0 comments on commit 75a6748

Please sign in to comment.