From 03332dbfecf8adb2b9b0c06ef0ecf85b5d146865 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sun, 17 Sep 2023 19:35:18 -0500 Subject: [PATCH] fix inventory crash --- .../java/ebf/tim/utility/TransportSlotManager.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/ebf/tim/utility/TransportSlotManager.java b/src/main/java/ebf/tim/utility/TransportSlotManager.java index aa60a7318..6e6808872 100644 --- a/src/main/java/ebf/tim/utility/TransportSlotManager.java +++ b/src/main/java/ebf/tim/utility/TransportSlotManager.java @@ -643,13 +643,16 @@ public void onContainerClosed(EntityPlayer p_75134_1_) { */ @Override public boolean canInteractWith(EntityPlayer player) { - if (((GenericRailTransport) hostInventory).seats.size() > 0) { //TODO: this feels super janky and it feels like this should be added in getPermissions - for(EntitySeat seat : ((GenericRailTransport) hostInventory).seats) { - if (seat.getPassenger() == player && ((GenericRailTransport) hostInventory).seats.indexOf(seat) != 0) { - return true; + if(hostInventory instanceof GenericRailTransport) { + if (((GenericRailTransport) hostInventory).seats.size() > 0) { //TODO: this feels super janky and it feels like this should be added in getPermissions + for (EntitySeat seat : ((GenericRailTransport) hostInventory).seats) { + if (seat.getPassenger() == player && ((GenericRailTransport) hostInventory).seats.indexOf(seat) != 0) { + return true; + } } } + return ((GenericRailTransport)hostInventory).getPermissions(player, hostInventory instanceof EntityTrainCore, false); } - return (hostInventory instanceof GenericRailTransport?((GenericRailTransport)hostInventory).getPermissions(player, hostInventory instanceof EntityTrainCore, false): hostInventory!=null); + return hostInventory!=null; } }