tr7zw/ItemSwapper

Shulker inside shulker inside shulker inside...[BUG] <title>

ThaSilentOne opened this issue · 5 comments

Version information

itemswapper-fabric-0.5.1-mc1.20.1

Other relevant installed mods

No response

Expected Behavior

I went to clear my inventory slot via item swapper while holding a shulker in my hand, my inventory was full including a few other shulkers (i was working on a farm), i didn't notice my inventory was full. Item swapper allows items to be moved into shulkers, but with the feature of no stacking shulkers you'd think nothing would happen.

Actual Behavior

To my surprise the shulker was swapped into another shulker, creating an illegal item.

The Reproduction Steps

1 - Fill your inventory/hotbar completely with random items, but have at least two shulkers, one for the hotbar and one for the inventory. (I have been able to replicate without full inv but its not consistent)
2 - While holding the shulker in your hotbar open the item swapper menu.
3 - Select the "move current item to a free slot..." option
4 - watch as the shulker is moved into another shulker as the mod clears room for you in your inventory.

Render engine

  • Vanilla
  • Sodium(optionally with Iris)
  • Optifine
  • VulkanMod
  • Canvas
  • Other

Additional information

https://media.essential.gg/1157251d-20b9-40f5-aefe-5bb125b0b300
https://media.essential.gg/dd411a96-22f6-4f21-dcb2-80ea6bac6900
i've provided some screenshots via the mod essential which i use. I apologize, but by default the images are quite large.
None of my other mods should effect shulkers in anyways, although I will list any and all mods that effect inventories and shulkers:
itemscroller-fabric-1.20.1-0.20.0
tweakeroo-fabric-1.20.1-0.17.1

Vaskyy commented

Can confirm this Issue also for

itemswapper-fabric-0.5.2-mc1.20.1.jar

2023-08-17_00 29 23

You can also just place items that u have in the litematica build in a box in ur inventory, and then "pickBlock" with the box in your hand to move the box over to the slot where the picked item was.
Works indefinetly and the box is still in the box even after restart or relog.

Vaskyy commented

And if there is no empty slot inside of boxes and u try to put the box in next empty slot inside the inventory or next available container, it just doesnt pick an empty inventory slot. Instead, it trys to put it inside of a container, fails

[Server thread/ERROR]: Error handeling network packet!

and deletes the box out of existence.

[18:42:56] [Server thread/ERROR]: Error handeling network packet!
java.lang.IndexOutOfBoundsException: readerIndex(8) + length(4) exceeds writerIndex(8): PooledUnsafeDirectByteBuf(ridx: 8, widx: 8, cap: 8)
at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1442) ~[netty-buffer-4.1.82.Final.jar:?]
at io.netty.buffer.AbstractByteBuf.readInt(AbstractByteBuf.java:809) ~[netty-buffer-4.1.82.Final.jar:?]
at net.minecraft.class_2540.readInt(class_2540.java:1353) ~[server-intermediary.jar:?]
at net.minecraft.class_3244.swapItem(class_3244.java:3485) ~[server-intermediary.jar:?]
at net.minecraft.class_3244.handler$zgj000$itemswapper$handleCustomPayload(class_3244.java:3474) ~[server-intermediary.jar:?]
at net.minecraft.class_3244.method_12075(class_3244.java) ~[server-intermediary.jar:?]
at net.minecraft.class_2817.method_12199(class_2817.java:38) ~[server-intermediary.jar:?]
at net.minecraft.class_2817.method_11054(class_2817.java:7) ~[server-intermediary.jar:?]
at net.minecraft.class_2600.method_11072(class_2600.java:22) ~[server-intermediary.jar:?]
at net.minecraft.class_3738.run(class_3738.java:18) ~[server-intermediary.jar:?]
at net.minecraft.class_1255.method_18859(class_1255.java:156) ~[server-intermediary.jar:?]
at net.minecraft.class_4093.method_18859(class_4093.java:23) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_24306(MinecraftServer.java:782) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_18859(MinecraftServer.java:164) ~[server-intermediary.jar:?]
at net.minecraft.class_1255.method_16075(class_1255.java:130) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:764) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_16075(MinecraftServer.java:758) ~[server-intermediary.jar:?]
at net.minecraft.class_1255.method_18857(class_1255.java:139) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:743) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:675) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265) ~[server-intermediary.jar:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]

tr7zw commented

Oof yea, this shouldn't happen.

tr7zw commented

For now the "fix" is that the client won't even try to put a shulker into a shulker, and the server will also refuse to do so. This will have the side effect for now, that you can't pickblock/switch to an item that is only inside a shulker while holding a shulker. Some future cleanup and unification of code strands could clean this further up, that it first tries to get the shulker out of the hand and then grabs the item(not sure how often this scenario even happens during normal gameplay?).