GTNewHorizons / GT-New-Horizons-Modpack

New Modpack with Gregtech, Thaumcraft and Witchery
https://www.gtnewhorizons.com/
Other
992 stars 301 forks source link

Let it be more than 64 stacks of item on the ground at the same time. #17503

Open CatsLeftEar opened 3 weeks ago

CatsLeftEar commented 3 weeks ago

Your GTNH Discord Username

Keyla3300

Your Pack Version

2.6.1

Your Proposal

Let it be more than 64 stacks of same item on the ground at the same time. When breaking a barrel, for example, with 128 stacks of item, you will only get 64 stacks after its broken by accident (and some more if you are lucky by picking up some stacks in your inventory). All stacks over the limit are just voided.

Your Goal

Make items not void

Your Vision

Group same items in one stack by texture, but let there be next to infinite amount of items on the ground

Final Checklist

dvdmandt commented 3 weeks ago

I don't think it's a limit of how many stacks can be on the ground, I believe it's a special handling of breaking drawers so that they don't spawn thousands of stacks at once, crashing the server.

CatsLeftEar commented 3 weeks ago

I don't think it's a limit of how many stacks can be on the ground, I believe it's a special handling of breaking drawers so that they don't spawn thousands of stacks at once, crashing the server.

Could be, i have only tested it with the barrel

dvdmandt commented 3 weeks ago

I could definitely be wrong about how it was implemented, but I'm pretty sure the reason for it is that it slows down performance to the level where the server essentially stops responding. Just removing the limit would bring back that issue, so that's not really an option. What would perhaps be a solution would be to somehow merge stacks into some form of superstack, but since it hasn't already been done, I'm guessing it's non-trivial to do so.

RecursivePineapple commented 3 weeks ago

You can easily make a single EntityItem with more than 64 items by just setting the stackSize to a higher value. I'm not sure if there are any side effects, but it worked fine when I tested it (I tested stacks of a few hundred).

dvdmandt commented 3 weeks ago

I know I was looking at some mod that was designed for that purpose (merging item stacks and xp orbs) and they had crossed over arbitrary size for item stacks and had it at 127 max due to "vanilla limitations". Did you try those big item stacks across network etc?

RecursivePineapple commented 3 weeks ago

It looks like ItemStacks cast their stackSize to a byte in writeToNBT, so that could be the problem. It would be trivial to subclass EntityItem and override the nbt serialization, which is what I'll probably do. Thanks for pointing that out, I probably wouldn't've found it on my own.

dvdmandt commented 3 weeks ago

That sounds like a likely cause of the limitations they mentioned indeed. Also need to verify compatibility with other stuff that interacts with items on ground, like golems, Botania flowers, hoppers etc, but that seems doable. Do we have any entity counters or stuff like weighted pressure plates that could break?