Maybe fix NPE in basin tile entity. Probably should check more thoroughly, but this should patch it for now

This commit is contained in:
grimmauld 2021-06-22 20:58:12 +02:00
parent 02ff18fcce
commit e4a340deef

View file

@ -329,7 +329,7 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
update = true; update = true;
continue; continue;
} }
if (targetInv == null) { if (targetInv == null) {
return; return;
} }
@ -338,7 +338,7 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
continue; continue;
if (filter != null && !filter.test(itemStack)) if (filter != null && !filter.test(itemStack))
continue; continue;
update = true; update = true;
ItemHandlerHelper.insertItemStacked(targetInv, itemStack.copy(), false); ItemHandlerHelper.insertItemStacked(targetInv, itemStack.copy(), false);
iterator.remove(); iterator.remove();
@ -426,7 +426,7 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
IItemHandler targetInv = null; IItemHandler targetInv = null;
IFluidHandler targetTank = null; IFluidHandler targetTank = null;
TileEntity te = null; TileEntity te = null;
InvManipulationBehaviour inserter = null; InvManipulationBehaviour inserter = null;
if (direction == Direction.DOWN) { if (direction == Direction.DOWN) {
@ -443,7 +443,7 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
.offset(direction)); .offset(direction));
if (te == null) if (te == null)
return false; return false;
inserter = TileEntityBehaviour.get(world, te.getPos(), InvManipulationBehaviour.TYPE); inserter = TileEntityBehaviour.get(world, te.getPos(), InvManipulationBehaviour.TYPE);
targetInv = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, direction.getOpposite()) targetInv = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, direction.getOpposite())
.orElse(inserter == null ? null : inserter.getInventory()); .orElse(inserter == null ? null : inserter.getInventory());
@ -453,13 +453,13 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
if (targetInv == null && !outputItems.isEmpty()) if (targetInv == null && !outputItems.isEmpty())
return false; return false;
FilteringBehaviour filter = TileEntityBehaviour.get(world, te.getPos(), FilteringBehaviour.TYPE); FilteringBehaviour filter = world == null || te == null ? null : TileEntityBehaviour.get(world, te.getPos(), FilteringBehaviour.TYPE);
for (ItemStack itemStack : outputItems) { for (ItemStack itemStack : outputItems) {
// Catalyst items are never consumed // Catalyst items are never consumed
if (itemStack.hasContainerItem() && itemStack.getContainerItem() if (itemStack.hasContainerItem() && itemStack.getContainerItem()
.isItemEqual(itemStack)) .isItemEqual(itemStack))
continue; continue;
if (simulate || direction == Direction.DOWN) { if (simulate || direction == Direction.DOWN) {
if (!ItemHandlerHelper.insertItemStacked(targetInv, itemStack.copy(), simulate) if (!ItemHandlerHelper.insertItemStacked(targetInv, itemStack.copy(), simulate)
.isEmpty() || (filter != null && !filter.test(itemStack))) .isEmpty() || (filter != null && !filter.test(itemStack)))