Hello!
I'm currently deciding how to approach a new project, one which relies heavily on passive items in a player's inventory. I've been thinking of ways to track what items a player is currently holding, and I have a few approaches I'll list, but the main thing I'm looking for is advice as to what methods you would use to minimize server load. (the passive items are identified through nbt tags)
The first and worst way is to just loop the player's inventory periodically. This is inefficient and bad, but has the benefits of being very reliable and takes minimal effort to code.
The second way I was considering was to keep a running list of what slots are important, updated in inventory click/drag, pickup, drop, and interact events. This is much more efficient, but more prone to bugs and oversights, and requires a lot more effort to code.
Finally, I was considering adding a specific little inventory to place these passive items in. This would be very efficient, but also really limiting in terms of gameplay impact. I'd prefer not to use this method, if possible.
Any comments, suggestions, alternative methods, anything is welcome!