From 236fa495e51ef1aee542954a99baed22c2a7194b Mon Sep 17 00:00:00 2001 From: direwolf20 <39863894+Direwolf20-MC@users.noreply.github.com> Date: Sun, 28 Jul 2024 12:59:35 -0400 Subject: [PATCH] Nullcheck - should resolve #256 --- gradle.properties | 2 +- src/main/java/com/direwolf20/laserio/common/LaserIO.java | 1 + .../direwolf20/laserio/common/blockentities/LaserNodeBE.java | 1 + .../com/direwolf20/laserio/common/items/cards/CardItem.java | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index c62799cd..960dad7d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ minecraft_version=1.21 # as they do not follow standard versioning conventions. minecraft_version_range=[1.21,1.22) # The Neo version must agree with the Minecraft version to get a valid artifact -neo_version=21.0.117-beta +neo_version=21.0.139-beta # The Neo version range can use any version of Neo as bounds neo_version_range=[21.0,) # The loader version range can only use the major version of FML as bounds diff --git a/src/main/java/com/direwolf20/laserio/common/LaserIO.java b/src/main/java/com/direwolf20/laserio/common/LaserIO.java index 9249018f..a1c33f48 100644 --- a/src/main/java/com/direwolf20/laserio/common/LaserIO.java +++ b/src/main/java/com/direwolf20/laserio/common/LaserIO.java @@ -49,6 +49,7 @@ public LaserIO(IEventBus eventBus, ModContainer container) { } private void registerCapabilities(RegisterCapabilitiesEvent event) { + //TODO 1.22 REMOVE event.registerBlock(Capabilities.ItemHandler.BLOCK, (level, pos, state, be, side) -> { if (side != null) diff --git a/src/main/java/com/direwolf20/laserio/common/blockentities/LaserNodeBE.java b/src/main/java/com/direwolf20/laserio/common/blockentities/LaserNodeBE.java index d543ab88..b4b48645 100644 --- a/src/main/java/com/direwolf20/laserio/common/blockentities/LaserNodeBE.java +++ b/src/main/java/com/direwolf20/laserio/common/blockentities/LaserNodeBE.java @@ -2189,6 +2189,7 @@ public IFluidHandler getAttachedFluidTankNoCache(Direction direction, Byte sneak public LaserNodeEnergyHandler getLaserNodeHandlerEnergy(InserterCardCache inserterCardCache) { if (!inserterCardCache.cardType.equals(BaseCard.CardType.ENERGY)) return null; + if (level == null) return null; GlobalPos nodeWorldPos = new GlobalPos(MiscTools.getLevel(level.getServer(), inserterCardCache.relativePos).dimension(), getWorldPos(inserterCardCache.relativePos.pos())); if (!chunksLoaded(nodeWorldPos, nodeWorldPos.pos().relative(inserterCardCache.direction))) return null; LaserNodeBE be = getNodeAt(new GlobalPos(MiscTools.getLevel(level.getServer(), inserterCardCache.relativePos).dimension(), getWorldPos(inserterCardCache.relativePos.pos()))); diff --git a/src/main/java/com/direwolf20/laserio/common/items/cards/CardItem.java b/src/main/java/com/direwolf20/laserio/common/items/cards/CardItem.java index f8af4c37..737edb4c 100644 --- a/src/main/java/com/direwolf20/laserio/common/items/cards/CardItem.java +++ b/src/main/java/com/direwolf20/laserio/common/items/cards/CardItem.java @@ -32,6 +32,7 @@ public InteractionResultHolder use(Level level, Player player, Intera return new InteractionResultHolder<>(InteractionResult.PASS, itemstack); } + //TODO: 1.22 Consider setting default to 8 public static byte setItemExtractAmt(ItemStack card, byte itemextractamt) { if (itemextractamt == 1) card.remove(LaserIODataComponents.ITEM_CARD_EXTRACT_AMT);