tryashtar / shulker-preview

Data+resource pack for viewing inside of shulker boxes in your inventory
https://tryashtar.github.io/shulker-preview
61 stars 3 forks source link

Empty Shulker #18

Closed flashpaul closed 2 years ago

flashpaul commented 2 years ago

I have a problem with empty shulkers. If I fill a shulker and then empty it, the shulker is effectively empty, but when you move the mouse over it as if to preview in the description of the shulker, the contents of the contents remain as if there were still the previous objects in the shulker. If you need further explanations or tests I can do them and attach pictures to better understand.

tryashtar commented 2 years ago

How are you emptying it?

flashpaul commented 2 years ago

First, I add that I use Paper Spigot which I have not specified before. I don't know if this could affect it. In any case, I manually extract the objects when a shulker is placed on the ground and then when I pick it up it is empty but from the description, it appears as if it still had the previous objects inside

tryashtar commented 2 years ago

How strange! Normally when you place a block, all the display information gets wiped. Could you attach a video of this happening? I would love to fix it if I could figure out how to recreate it

flashpaul commented 2 years ago

I am forwarding you a sample video: https://drive.google.com/file/d/1L5waeyzkXgIF90y1Jg2FCZa3_45iZSfA/view?usp=sharing

flashpaul commented 2 years ago

I also tried to reposition the shulker on the ground which is effectively empty, but breaking it again still remains the purple writing

tryashtar commented 2 years ago

Thanks for the video. Would it be possible if I could join the server to investigate a bit?

flashpaul commented 2 years ago

What you saw was a local server where I test various plugins. I am sending you a zipped copy of the world with all the plugins present. But I can only do it tomorrow evening. (about 22 hours from now)

tryashtar commented 2 years ago

Thanks, that'll work

flashpaul commented 2 years ago

I sent you an email with the world link. Thanks for your work!

tryashtar commented 2 years ago

Thanks, I was able to figure out the problem with that download! This is definitely caused by the plugin TileDataSaver.

It saves the lore of the item to the placed block. So when the box is emptied and broken, it restores the original lore to the dropped item. It seems to be implemented very strangely, serializing the entire item to bytes and ultimately saving it as a base64 string, instead of just copying the NBT structure. It's hard to say for sure, but that seems to me to be the reason why it changes from the proper image to purple text -- something about text component serialization is lossy.

Empty boxes are not processed by this data pack, for a few reasons. Mostly because I prefer a blank tooltip than an empty inventory tooltip, and also because checking for the presence of an item in the container is a safe and performant filter to process only relevant items. As a result, the lore saved by the plugin persists.

So, as for solutions...

If you don't want to do that, I was able to modify the data pack to work around the issue, but I would prefer not to include those modifications in the main download because there are minor performance implications. So I have two different modified versions:

Please let me know which of these you prefer :)

flashpaul commented 2 years ago

Thanks so much for your work! I would say that either solution would be fine. I leave it up to you to decide which one you think is best since the data pack is yours! Currently, I don't have a solution that allows me to remove the plugin causing the problem because it's the only one I've found that allows players to place and break custom heads without them losing their data and becoming Steve's heads when broken.

tryashtar commented 2 years ago

Alright! Here is the custom version of the data pack -- three files are changed. Do let me know if this works for you :) Shulker Preview Data Pack (1.18).zip

flashpaul commented 2 years ago

Can You please update this version to 1.19?

tryashtar commented 2 years ago

Hi sorry for the delay, I saw your email. I'll get to this as soon as I get a chance :)

flashpaul commented 2 years ago

Ok! Thank you!