CompactStorage

CompactStorage

11M Downloads

java.lang.IllegalArgumentException: Got 276 items, but maximum is 256

Paulem79 opened this issue ยท 5 comments

commented

Describe the bug
When the amount of slots is above 256, the client is kicked of the server

To Reproduce

  1. Have a chest of 256+ slots
  2. Open it
  3. You'll crash

Expected behavior
I wanted my chest to... open

Log files
[Server thread/ERROR]: Failed to handle packet class_2873[slotNum=39, itemStack=1 compact_storage:oak_compact_chest], suppressing error
java.lang.IllegalArgumentException: Got 276 items, but maximum is 256
at net.minecraft.class_9288.(class_9288.java:33) ~[server-intermediary.jar:?]
at net.minecraft.class_9288.(class_9288.java:40) ~[server-intermediary.jar:?]
at net.minecraft.class_9288.method_57493(class_9288.java:69) ~[server-intermediary.jar:?]
at net.minecraft.class_2624.method_57567(class_2624.java:169) ~[server-intermediary.jar:?]
at net.minecraft.class_2621.method_57567(class_2621.java:106) ~[server-intermediary.jar:?]
at com.witchica.compactstorage.common.block.entity.CompactChestBlockEntity.method_57567(CompactChestBlockEntity.java:175) ~[compact_storage-1.21-fabric-8.0.74.jar:?]
at net.minecraft.class_2586.method_57590(class_2586.java:327) ~[server-intermediary.jar:?]
at com.witchica.compactstorage.common.block.entity.CompactChestBlockEntity.method_38240(CompactChestBlockEntity.java:170) ~[compact_storage-1.21-fabric-8.0.74.jar:?]
at net.minecraft.class_3244.method_12070(class_3244.java:1791) ~[server-intermediary.jar:?]
at net.minecraft.class_2873.method_12480(class_2873.java:31) ~[server-intermediary.jar:?]
at net.minecraft.class_2873.method_11054(class_2873.java:10) ~[server-intermediary.jar:?]
at net.minecraft.class_2600.method_11072(class_2600.java:27) ~[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:162) ~[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:864) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_18859(MinecraftServer.java:173) ~[server-intermediary.jar:?]
at net.minecraft.class_1255.method_16075(class_1255.java:136) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:846) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_16075(MinecraftServer.java:840) ~[server-intermediary.jar:?]
at net.minecraft.class_1255.method_5383(class_1255.java:121) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:814) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:702) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:281) ~[server-intermediary.jar:?]
at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]

Additional context
It's on a modded server, with other mods, but I don't think it's related to the other mods but here is the full list if you want
https://github.com/Paulem79/Launcher/blob/updater/mods_list.json

commented

Okay interesting, seems to be an issue with 1.20.6 and 1.21 specifically. I shall take a look

commented

So, did you checked ?

commented

In ItemContainerContents :

    private ItemContainerContents(NonNullList<ItemStack> items) {
        if (items.size() > 256) {
            throw new IllegalArgumentException("Got " + items.size() + " items, but maximum is 256");
        } else {
            this.items = items;
            this.hashCode = ItemStack.hashStackList(items);
        }
    }

I'll do a PR to mixin this and remove this annoying condition

commented

You would have to mixin in a lot of places in that file, I have a solution in the works right now :)

commented

I'm going to chuck a temporary solution in, I am planning a big upgrade to storage that this will fit nicely with anyways. For now, maxing out at 21x12 9c42d00 68a62f0