From 7791d340e19ec7a345476dfcd61a1ffcdebdef6d Mon Sep 17 00:00:00 2001 From: reidbhuntley Date: Wed, 22 Dec 2021 21:30:30 -0500 Subject: [PATCH] Add null check to chutes --- .../logistics/block/chute/ChuteTileEntity.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java index 028318c5f..4d0a657a3 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java @@ -153,7 +153,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor } float nextOffset = itemPosition.value + itemMotion; - + if (itemMotion < 0) { if (nextOffset < .5f) { if (!handleDownwardOutput(true)) @@ -352,9 +352,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor ChuteTileEntity targetChute = getTargetChute(blockState); Direction direction = AbstractChuteBlock.getChuteFacing(blockState); - if (level == null) - return false; - if (!this.canOutputItems()) + if (level == null || direction == null || !this.canOutputItems()) return false; if (!capBelow.isPresent()) capBelow = grabCapability(Direction.DOWN); @@ -406,12 +404,9 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor private boolean handleUpwardOutput(boolean simulate) { BlockState stateAbove = level.getBlockState(worldPosition.above()); - if (level == null) + if (level == null || !this.canOutputItems()) return false; - if (!this.canOutputItems()) - return false; - if (AbstractChuteBlock.isOpenChute(getBlockState())) { if (!capAbove.isPresent()) capAbove = grabCapability(Direction.UP); @@ -481,7 +476,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor protected boolean canCollectItemsFromBelow() { return true; } - + protected boolean canOutputItems() { return true; }