AdvancedPeripherals icon indicating copy to clipboard operation
AdvancedPeripherals copied to clipboard

ME bridge `importFluid`/`importFluidFromPeripheral` method throws a java error when an empty item filter is supplied

Open programmer3481 opened this issue 1 month ago • 0 comments

Describe

ME bridge importFluid/importFluidFromPeripheral method throws a java.lang.IllegalStateException: Can't modify the empty stack, due to seemingly matching an empty slot.

For example, the bug happens when trying to import from an empty tank with a filter only with the count specified.

Full stack trace:

[23:56:26] [Server thread/ERROR] [da.co.co.co.LuaContext/COMPUTER_ERROR.JAVA]: Error running task
java.lang.IllegalStateException: Can't modify the empty stack.
	at net.minecraftforge.fluids.FluidStack.setAmount(FluidStack.java:175) ~[forge-1.20.1-47.4.6-universal.jar%23615!/:?] {re:mixin,re:classloading}
	at de.srendi.advancedperipherals.common.util.inventory.InventoryUtil.moveFluid(InventoryUtil.java:129) ~[AdvancedPeripherals-1.20.1-0.7.46r.jar%23390!/:0.7.46r] {re:classloading}
	at de.srendi.advancedperipherals.common.addons.computercraft.peripheral.MeBridgePeripheral.importToME(MeBridgePeripheral.java:145) ~[AdvancedPeripherals-1.20.1-0.7.46r.jar%23390!/:0.7.46r] {re:classloading}
	at de.srendi.advancedperipherals.common.addons.computercraft.peripheral.MeBridgePeripheral.importFluidFromPeripheral(MeBridgePeripheral.java:363) ~[AdvancedPeripherals-1.20.1-0.7.46r.jar%23390!/:0.7.46r] {re:classloading}
	at dan200.computercraft.core.asm.PeripheralMethodSupplier.lambda$static$0(PeripheralMethodSupplier.java:28) ~[cc-tweaked-1.20.1-forge-1.116.1.jar%23416!/:1.116.1] {re:classloading}
	at dan200.computercraft.core.asm.PeripheralMethodSupplier.lambda$static$2(PeripheralMethodSupplier.java:35) ~[cc-tweaked-1.20.1-forge-1.116.1.jar%23416!/:1.116.1] {re:classloading}
	at dan200.computercraft.api.lua.TaskCallback.execute(TaskCallback.java:28) ~[cc-tweaked-1.20.1-forge-1.116.1.jar%23416!/:1.116.1] {re:classloading}
	at dan200.computercraft.core.computer.GuardedLuaContext.lambda$issueMainThreadTask$0(GuardedLuaContext.java:45) ~[cc-tweaked-1.20.1-forge-1.116.1.jar%23416!/:1.116.1] {re:classloading}
	at dan200.computercraft.core.computer.LuaContext.lambda$issueMainThreadTask$0(LuaContext.java:29) ~[cc-tweaked-1.20.1-forge-1.116.1.jar%23416!/:1.116.1] {re:classloading}
	at dan200.computercraft.core.computer.mainthread.MainThreadExecutor.execute(MainThreadExecutor.java:138) ~[cc-tweaked-1.20.1-forge-1.116.1.jar%23416!/:1.116.1] {re:classloading}
	at dan200.computercraft.core.computer.mainthread.MainThread.tick(MainThread.java:139) ~[cc-tweaked-1.20.1-forge-1.116.1.jar%23416!/:1.116.1] {re:classloading}
	at dan200.computercraft.shared.computer.core.ServerContext.tick(ServerContext.java:154) ~[cc-tweaked-1.20.1-forge-1.116.1.jar%23416!/:1.116.1] {re:classloading}
	at dan200.computercraft.shared.CommonHooks.onServerTickStart(CommonHooks.java:49) ~[cc-tweaked-1.20.1-forge-1.116.1.jar%23416!/:1.116.1] {re:classloading}
	at dan200.computercraft.shared.ForgeCommonHooks.onServerTick(ForgeCommonHooks.java:58) ~[cc-tweaked-1.20.1-forge-1.116.1.jar%23416!/:1.116.1] {re:classloading}
	at dan200.computercraft.shared.__ForgeCommonHooks_onServerTick_ServerTickEvent.invoke(.dynamic) ~[cc-tweaked-1.20.1-forge-1.116.1.jar%23416!/:1.116.1] {re:classloading,pl:eventbus:B}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.5.jar%23137!/:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.5.jar%23137!/:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.5.jar%23137!/:?] {}
	at net.minecraftforge.event.ForgeEventFactory.onPreServerTick(ForgeEventFactory.java:970) ~[forge-1.20.1-47.4.6-universal.jar%23615!/:?] {re:mixin,re:classloading,pl:mixin:A}
	at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:812) ~[client-1.20.1-20230612.114412-srg.jar%23610!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:A}
	at net.minecraft.client.server.IntegratedServer.m_5705_(IntegratedServer.java:89) ~[client-1.20.1-20230612.114412-srg.jar%23610!/:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:APP:lithostitched.mixins.json:client.IntegratedServerMixin,pl:mixin:APP:smoothboot.mixins.json:client.IntegratedServerMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:661) ~[client-1.20.1-20230612.114412-srg.jar%23610!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:A}
	at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[client-1.20.1-20230612.114412-srg.jar%23610!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:A}
	at java.lang.Thread.run(Thread.java:833) ~[?:?] {re:mixin}

The bug is in latest versions of AP in 1.20.1, seems to be fixed in 1.21.1

Steps to reproduce

  1. Connect an ME bridge (connected to an me system with storage space) and an empty tank to a computer.
  2. Try to import fluids from the tank to the ME system with an empty filter (ex. bridge.importFluidFromPeripheral({}, "top"))
  3. An IllegalStateException is thrown, visible in the logs.

Multiplayer?

No

Version

1.20.1-0.7.45r (Latest 1.20.1)

Minecraft, Forge and maybe other related mods versions

forge 47.4.6 minecraft 1.20.1

Screenshots or Videos

No response

Crashlog/log

No response

programmer3481 avatar Nov 18 '25 15:11 programmer3481