crashdemons / DisplayItem-Spigot

rewrite of DisplayItem for use in Spigot 1.13+ (uses BungeeChat components)
5 stars 0 forks source link

Shulkers not showing correct content sometimes #23

Closed sovtec closed 1 year ago

sovtec commented 1 year ago

When displaying a full shulker of for example armor, it will only display the first 6 slots and the rest will display as ice blocks

This is the output on hover: 2023-01-10_21 37 56

Shulker was containing this: thisssss

Other chat plugins I use: EssentialsX and UltraColor (colored name/chat)

crashdemons commented 1 year ago

So, the reason for this is because there is a limit to the amount of NBT data that can be sent to chat before it kicks everyone off the server - or at least it did at the time. To prevent this DisplayItem has a limit to the amount of tag data (as json) that can be displayed - otherwise it shows just the name and "too long" as a safety precaution without a hover item.

This was less than ideal, so a compromise was made for shulker boxes* where just the first 5-6 items (used in the vanilla tooltip) are shown, while still reducing the tags used by items that aren't normally shown. The ice is used as a placeholder to maintain the item count in vanilla. This is the "item minimizer" feature mentioned in the config.

I'm guessing you're using a mod to display the shulker contents. Here's how it looks in vanilla minecraft image

So, having said that - you have the option of disabling the minimize-items option and showing the full contents of shulker boxes - but it will mean more of your shulker boxes will hit the safety limit for tags (controlled by jsonlimit).

You can also increase jsonlimit, but at a certain point a shulker box with enough tag-heavy items may kick people out of the server. [Though I should note that since the server actually sends NBT and not JSON, the JSON limit is an approximation of true length and the default was set to be slightly on the cautious side.]

(* I believe books and some other items are "minimized" in a similar fashion)

sovtec commented 1 year ago

So, the reason for this is because there is a limit to the amount of NBT data that can be sent to chat before it kicks everyone off the server - or at least it did at the time. To prevent this DisplayItem has a limit to the amount of tag data (as json) that can be displayed - otherwise it shows just the name and "too long" as a safety precaution without a hover item.

This was less than ideal, so a compromise was made for shulker boxes* where just the first 5-6 items (used in the vanilla tooltip) are shown, while still reducing the tags used by items that aren't normally shown. The ice is used as a placeholder to maintain the item count in vanilla. This is the "item minimizer" feature mentioned in the config.

I'm guessing you're using a mod to display the shulker contents. Here's how it looks in vanilla minecraft image

So, having said that - you have the option of disabling the minimize-items option and showing the full contents of shulker boxes - but it will mean more of your shulker boxes will hit the safety limit for tags (controlled by jsonlimit).

You can also increase jsonlimit, but at a certain point a shulker box with enough tag-heavy items may kick people out of the server. [Though I should note that since the server actually sends NBT and not JSON, the JSON limit is an approximation of true length and the default was set to be slightly on the cautious side.]

(* I believe books and some other items are "minimized" in a similar fashion)

Interesting! Thanks for your detailed response.

You are right, I am using a mod to display shulker contents, and by a coincidence, the user(s) who reported this issue also had that mod. I have been using that mod for so long that I forgot.. that is my bad. Tho, when it comes to that, is there a way to "force" clients to use the vanilla method instead of sending the "shulker preview enabled by the mod MiniHud link ? or any other type of client changing shulker previews?

Last thing, regarding jsonlimit. What would you say is a good limit to be within for optimal player performance?

crashdemons commented 1 year ago

I don't think you can "disable" the preview of shulker box items on those mods to not preview the items any way except to 'lie' about the item and add loretext that looks like the item list (probably not perfectly either).

For jsonlimit, the limit that was set default (8000) was good for when the feature was added, but I'd need to check again to see if the chat limit is still the same. I don't think there's much of a performance impact really beyond the safety issue, but it would depend on the individual's internet and hardware.

sovtec commented 1 year ago

I don't think you can "disable" the preview of shulker box items on those mods to not preview the items any way except to 'lie' about the item and add loretext that looks like the item list (probably not perfectly either).

For jsonlimit, the limit that was set default (8000) was good for when the feature was added, but I'd need to check again to see if the chat limit is still the same. I don't think there's much of a performance impact really beyond the safety issue, but it would depend on the individual's internet and hardware.

I have json limit at 6k now. Everything works as it should, tempted to just turn it back to 8k.

Thanks for reply, have a nice day 💯