Lib Block Attributes

Lib Block Attributes

853k Downloads

Item-fluid inventory interaction weirdness

reoseah opened this issue ยท 5 comments

commented

I made simple tank using code from SimplePipes tank, including using this call for item interaction https://github.com/AlexIIL/SimplePipes/blob/d2966aa76fd670904a245a3e648f3b8c5ad9cf62/src/main/java/alexiil/mc/mod/pipes/blocks/TileTank.java#L114

The behavior I get:

  1. It drains/fills item for creative player, which I think is not consistent with how vanilla things work

  2. If I fill tank with one water bottle, right clicking with an empty bottle fills it and empties tank; but if I fill it with two or more bottles, right clicking with empty bottle does nothing. Also, can't use empty bucket to fill it at all, not sure if it should do something but I sort of expected it to work too.

commented

Seems like bottles fill correctly, empty bucket doesn't work. Right-clicking with water bottle on already filled tank prints to log such errors

[00:02:26] [Server thread/FATAL]: Error executing task on Server
java.lang.IllegalStateException: Tried to extract the filter (C) from A but it returned an empty item stack after we have already inserted the expected stack into B!
The inventory is now in an invalid (duped) state!

from A = alexiil.mc.lib.attributes.fluid.FluidVolumeUtil$$Lambda$2987/0x0000000100b44840@763586c2
to B = alexiil.mc.lib.attributes.fluid.impl.GroupedFluidInvFixedWrapper@1f8fb902
filter C = null
	at alexiil.mc.lib.attributes.fluid.FluidVolumeUtil.throwBadImplException(FluidVolumeUtil.java:302) ~[net.fabricmc.yarn.1_14_2.7.alexiil.mc.lib.libblockattributes-fluids-0.4.6.jar:?]
	at alexiil.mc.lib.attributes.fluid.FluidVolumeUtil.move(FluidVolumeUtil.java:76) ~[net.fabricmc.yarn.1_14_2.7.alexiil.mc.lib.libblockattributes-fluids-0.4.6.jar:?]
	at alexiil.mc.lib.attributes.fluid.FluidVolumeUtil.move(FluidVolumeUtil.java:44) ~[net.fabricmc.yarn.1_14_2.7.alexiil.mc.lib.libblockattributes-fluids-0.4.6.jar:?]
	at alexiil.mc.lib.attributes.fluid.FluidVolumeUtil.interactWithTank(FluidVolumeUtil.java:191) ~[net.fabricmc.yarn.1_14_2.7.alexiil.mc.lib.libblockattributes-fluids-0.4.6.jar:?]
	at alexiil.mc.lib.attributes.fluid.FluidVolumeUtil.interactWithTank(FluidVolumeUtil.java:157) ~[net.fabricmc.yarn.1_14_2.7.alexiil.mc.lib.libblockattributes-fluids-0.4.6.jar:?]
	at messproduction.blockentity.TankBlockEntity.activate(TankBlockEntity.java:54) ~[main/:?]
	at messproduction.block.TankBlock.activate(TankBlock.java:47) ~[main/:?]
	at net.minecraft.block.BlockState.activate(BlockState.java:270) ~[minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.network.ServerPlayerInteractionManager.interactBlock(ServerPlayerInteractionManager.java:298) ~[minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.network.ServerPlayNetworkHandler.onPlayerInteractBlock(ServerPlayNetworkHandler.java:874) ~[minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.network.packet.PlayerInteractBlockC2SPacket.method_12547(PlayerInteractBlockC2SPacket.java:36) ~[minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.network.packet.PlayerInteractBlockC2SPacket.apply(PlayerInteractBlockC2SPacket.java:17) ~[minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.network.NetworkThreadUtils.method_11072(NetworkThreadUtils.java:14) ~[minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.ServerTask.run(ServerTask.java:17) ~[minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.util.ThreadExecutor.runSafely(ThreadExecutor.java:127) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.util.NonBlockingThreadExecutor.runSafely(NonBlockingThreadExecutor.java:22) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.util.ThreadExecutor.executeQueuedTask(ThreadExecutor.java:105) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:695) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.MinecraftServer.executeQueuedTask(MinecraftServer.java:689) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.util.ThreadExecutor.waitFor(ThreadExecutor.java:115) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:675) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:630) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]
commented

...Ok, and that should be fixed in 0.4.7?

commented

Sorry about that, it should be fixed in 0.4.6?

commented

Yes, it no longer logs errors on right-clicking filled tank with water bottles. However, I found another issue when using water bucket on a tank with less then a bucket of empty volume.

So, steps I make

  • create tank with capacity of 1 bucket and place it in game
  • right click the tank with water bottle (or twice, same result)
  • right click the tank with water bucket

Expected: nothing as tank has less space then bucket and bucket cannot be consumed partially.
What happens:

  • tank fills completely
  • water bucket not changed, i.e., still filled
  • it logs such errors
ava.lang.IllegalStateException: Tried to extract the filter (C) from A but it returned an empty item stack after we have already inserted the expected stack into B!
The inventory is now in an invalid (duped) state!

from A = alexiil.mc.lib.attributes.fluid.FluidVolumeUtil$$Lambda$3001/0x0000000100b57c40@1065b65f
to B = alexiil.mc.lib.attributes.fluid.impl.GroupedFluidInvFixedWrapper@6ca66177
filter C = null
	at alexiil.mc.lib.attributes.fluid.FluidVolumeUtil.throwBadImplException(FluidVolumeUtil.java:305) ~[net.fabricmc.yarn.1_14_2.7.alexiil.mc.lib.libblockattributes-fluids-0.4.7.jar:?]
	at alexiil.mc.lib.attributes.fluid.FluidVolumeUtil.move(FluidVolumeUtil.java:79) ~[net.fabricmc.yarn.1_14_2.7.alexiil.mc.lib.libblockattributes-fluids-0.4.7.jar:?]
	at alexiil.mc.lib.attributes.fluid.FluidVolumeUtil.move(FluidVolumeUtil.java:44) ~[net.fabricmc.yarn.1_14_2.7.alexiil.mc.lib.libblockattributes-fluids-0.4.7.jar:?]
	at alexiil.mc.lib.attributes.fluid.FluidVolumeUtil.interactWithTank(FluidVolumeUtil.java:194) ~[net.fabricmc.yarn.1_14_2.7.alexiil.mc.lib.libblockattributes-fluids-0.4.7.jar:?]
	at alexiil.mc.lib.attributes.fluid.FluidVolumeUtil.interactWithTank(FluidVolumeUtil.java:160) ~[net.fabricmc.yarn.1_14_2.7.alexiil.mc.lib.libblockattributes-fluids-0.4.7.jar:?]
	at messproduction.blockentity.TankBlockEntity.activate(TankBlockEntity.java:54) ~[main/:?]
	at messproduction.block.TankBlock.activate(TankBlock.java:47) ~[main/:?]
	at net.minecraft.block.BlockState.activate(BlockState.java:270) ~[minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.network.ServerPlayerInteractionManager.interactBlock(ServerPlayerInteractionManager.java:298) ~[minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.network.ServerPlayNetworkHandler.onPlayerInteractBlock(ServerPlayNetworkHandler.java:874) ~[minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.network.packet.PlayerInteractBlockC2SPacket.method_12547(PlayerInteractBlockC2SPacket.java:36) ~[minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.network.packet.PlayerInteractBlockC2SPacket.apply(PlayerInteractBlockC2SPacket.java:17) ~[minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.network.NetworkThreadUtils.method_11072(NetworkThreadUtils.java:14) ~[minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.ServerTask.run(ServerTask.java:17) ~[minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.util.ThreadExecutor.runSafely(ThreadExecutor.java:127) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.util.NonBlockingThreadExecutor.runSafely(NonBlockingThreadExecutor.java:22) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.util.ThreadExecutor.executeQueuedTask(ThreadExecutor.java:105) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:695) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.MinecraftServer.executeQueuedTask(MinecraftServer.java:689) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.util.ThreadExecutor.waitFor(ThreadExecutor.java:115) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:675) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:630) [minecraft-1.14.2-mapped-net.fabricmc.yarn-7.jar:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]
commented

Ok, that one (plus the one you mentioned in ItemFixedInv.extractSingle()) should be fixed in 0.4.8. Please open any more issues if you come across them though :)