Skip to content

Fixed bug in import* and export* functions for chemical and fluid in MEBridgePeripheral throwing java.lang.NullPointerException when remote tank peripherals are specified. - #780

Merged
SirEndii merged 3 commits into
IntelligenceModding:dev/1.21.1from
MineCake147E:dev/1.21.1
Sep 8, 2025
Merged

SirEndii merged 3 commits into
IntelligenceModding:dev/1.21.1from
MineCake147E:dev/1.21.1

Conversation

@MineCake147E

Copy link
Copy Markdown
Contributor
  • Please check if the PR fulfills these requirements
  • The commit message are well described
  • All changes have fully been tested
  • What kind of change does this PR introduce? (Bug fix, feature, ...)
    Bug fix

  • What is the current behavior? (You can also link to an open issue here)
    Unable to import chemical/fluid from any remote inventory peripherals to ME storage
    Unable to export chemical/fluid from ME storage to any remote inventory peripherals

  • What is the new behavior (if this is a feature change)?
    Able to import chemical/fluid from any remote inventory peripherals to ME storage
    Able to export chemical/fluid from ME storage to any remote inventory peripherals

  • Does this PR introduce a breaking change? (What changes might users need to make in their scripts due to this PR?)
    No

  • Other information:
    Related to Fix bug in import* and export* functions in MEBridgePeripheral not detecting any remote inventory peripherals. #746

FluidUtil.getHandlerFromDirection and ChemicalUtil.getHandlerFromDirection lacked null checks after CoordUtil.getDirection(owner.getOrientation(), direction);, which caused import/export functions for chemical and fluid to throw java.lang.NullPointerException.
I should have noticed these bugs before I submitted #746.
I apologize for my mistake.

Log output after running me_bridge.exportChemical:

[019月2025 14:05:56.395] [Server thread/ERROR] [dan200.computercraft.core.computer.LuaContext/COMPUTER_ERROR.JAVA]: Error running task
java.lang.NullPointerException: Cannot invoke "net.minecraft.core.Direction.getStepX()" because "p_121946_" is null
	at TRANSFORMER/minecraft@1.21.1/net.minecraft.core.BlockPos.relative(BlockPos.java:246) ~[client-1.21.1-20240808.144430-srg.jar%23215!/:?]
	at TRANSFORMER/advancedperipherals@0.7.56b/de.srendi.advancedperipherals.common.util.inventory.ChemicalUtil.getHandlerFromDirection(ChemicalUtil.java:80) ~[AdvancedPeripherals-1.21.1-0.7.56b.jar%23217!/:0.7.56b]
	at TRANSFORMER/advancedperipherals@0.7.56b/de.srendi.advancedperipherals.common.addons.appliedenergistics.AEMekanismApi.exportToTank(AEMekanismApi.java:71) ~[AdvancedPeripherals-1.21.1-0.7.56b.jar%23217!/:0.7.56b]
	at TRANSFORMER/advancedperipherals@0.7.56b/de.srendi.advancedperipherals.common.addons.computercraft.peripheral.MEBridgePeripheral.exportChemical(MEBridgePeripheral.java:434) ~[AdvancedPeripherals-1.21.1-0.7.56b.jar%23217!/:0.7.56b]
	at TRANSFORMER/computercraft@1.116.1/dan200.computercraft.core.asm.PeripheralMethodSupplier.lambda$static$0(PeripheralMethodSupplier.java:28) ~[cc-tweaked-1.21.1-forge-1.116.1.jar%23221!/:1.116.1]
	at TRANSFORMER/computercraft@1.116.1/dan200.computercraft.core.asm.PeripheralMethodSupplier.lambda$static$2(PeripheralMethodSupplier.java:35) ~[cc-tweaked-1.21.1-forge-1.116.1.jar%23221!/:1.116.1]
	at TRANSFORMER/computercraft@1.116.1/dan200.computercraft.api.lua.TaskCallback.execute(TaskCallback.java:28) ~[cc-tweaked-1.21.1-forge-1.116.1.jar%23221!/:1.116.1]
	at TRANSFORMER/computercraft@1.116.1/dan200.computercraft.core.computer.GuardedLuaContext.lambda$issueMainThreadTask$0(GuardedLuaContext.java:45) ~[cc-tweaked-1.21.1-forge-1.116.1.jar%23221!/:1.116.1]
	at TRANSFORMER/computercraft@1.116.1/dan200.computercraft.core.computer.GuardedLuaContext.lambda$issueMainThreadTask$0(GuardedLuaContext.java:45) ~[cc-tweaked-1.21.1-forge-1.116.1.jar%23221!/:1.116.1]
	at TRANSFORMER/computercraft@1.116.1/dan200.computercraft.core.computer.LuaContext.lambda$issueMainThreadTask$0(LuaContext.java:29) ~[cc-tweaked-1.21.1-forge-1.116.1.jar%23221!/:1.116.1]
	at TRANSFORMER/computercraft@1.116.1/dan200.computercraft.core.computer.mainthread.MainThreadExecutor.execute(MainThreadExecutor.java:138) ~[cc-tweaked-1.21.1-forge-1.116.1.jar%23221!/:1.116.1]
	at TRANSFORMER/computercraft@1.116.1/dan200.computercraft.core.computer.mainthread.MainThread.tick(MainThread.java:139) ~[cc-tweaked-1.21.1-forge-1.116.1.jar%23221!/:1.116.1]
	at TRANSFORMER/computercraft@1.116.1/dan200.computercraft.shared.computer.core.ServerContext.tick(ServerContext.java:154) ~[cc-tweaked-1.21.1-forge-1.116.1.jar%23221!/:1.116.1]
	at TRANSFORMER/computercraft@1.116.1/dan200.computercraft.shared.CommonHooks.onServerTickStart(CommonHooks.java:61) ~[cc-tweaked-1.21.1-forge-1.116.1.jar%23221!/:1.116.1]
	at TRANSFORMER/computercraft@1.116.1/dan200.computercraft.shared.ForgeCommonHooks.onServerTick(ForgeCommonHooks.java:39) ~[cc-tweaked-1.21.1-forge-1.116.1.jar%23221!/:1.116.1]
	at MC-BOOTSTRAP/net.neoforged.bus/net.neoforged.bus.EventBus.post(EventBus.java:360) ~[bus-8.0.5.jar%23155!/:?]
	at MC-BOOTSTRAP/net.neoforged.bus/net.neoforged.bus.EventBus.post(EventBus.java:328) ~[bus-8.0.5.jar%23155!/:?]
	at TRANSFORMER/neoforge@21.1.206/net.neoforged.neoforge.event.EventHooks.fireServerTickPre(EventHooks.java:1010) ~[neoforge-21.1.206-universal.jar%23216!/:?]
	at TRANSFORMER/minecraft@1.21.1/net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:915) ~[client-1.21.1-20240808.144430-srg.jar%23215!/:?]
	at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.server.IntegratedServer.tickServer(IntegratedServer.java:110) ~[client-1.21.1-20240808.144430-srg.jar%23215!/:?]
	at TRANSFORMER/minecraft@1.21.1/net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:707) ~[client-1.21.1-20240808.144430-srg.jar%23215!/:?]
	at TRANSFORMER/minecraft@1.21.1/net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:267) ~[client-1.21.1-20240808.144430-srg.jar%23215!/:?]
	at java.base/java.lang.Thread.run(Unknown Source) [?:?]

…gePeripheral` not detecting any remote inventory peripherals.
…pheral` not detecting any remote inventory peripherals.
@github-actions

github-actions Bot commented Sep 1, 2025

Copy link
Copy Markdown
Contributor

Build Preview

badge

You can find files attached to the below linked Workflow Run URL (Logs).

Name Link
Commit b9e277a
Logs https://github.com/IntelligenceModding/AdvancedPeripherals/actions/runs/17557151475
Jar Files AdvancedPeripherals PR 780
Expires At 2025-12-07T16:13:16Z

@MineCake147E
MineCake147E marked this pull request as draft September 1, 2025 12:02

@zyxkad zyxkad left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, and ignore the github action since its error is caused by the base code

@MineCake147E
MineCake147E marked this pull request as ready for review September 1, 2025 12:54
@SirEndii
SirEndii merged commit 111341c into IntelligenceModding:dev/1.21.1 Sep 8, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants