Lithium (Fabric)

Lithium (Fabric)

22M Downloads

Hoppers clone items when inserting

vlad2305m opened this issue ยท 5 comments

commented

Version Information

lithium-fabric-mc1.17.1-0.7.3

Expected Behavior

Hopper should split(1) from the stack it is pushing.

Actual Behavior

Hopper clones the stack it is pushing, sets count to 1 and decrements the original stack.
(Congratulations on copying code from ItemStack.split(I) method, but that doesn't help)

Reproduction Steps

Place a hopper facing into a chest
Put my Akashic Tome of Tools, morphed into a stack of somethig, into the hopper
Collect 27 Akashic tomes of that item from the chest ans see more come

Other Information

src/main/java/me/jellysquid/mods/lithium/common/hopper/HopperHelper.java
line 77-79

I wonder if it also breaks \dev\null and alike...
My mod: https://github.com/vlad2305m/AkashicTomeOfToolsFabric

commented

Why should the hopper use ItemStack.split?

commented

This is a change I can do, I just don't see how it will help your cause.

commented

Replaced the duplicated code as you recommended

commented

Thank you! I override it to detach items from the tome. Surprisingly, almost all Minecraft uses split() when it plans to continue using the copy, and copy() when it just wants to cache it or directly sets slot to air.

commented

Confirmed, no more duping.
Its behaviour is just a bit weird now, but that is partially my fault (vanilla splits 1 from the stack before performing any of those checks, so I didn't bother to implement them).
Thank you very much for such quick release!