Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't read books in creative #63

Open
Londiuh opened this issue Mar 13, 2022 · 2 comments
Open

Can't read books in creative #63

Londiuh opened this issue Mar 13, 2022 · 2 comments

Comments

@Londiuh
Copy link

Londiuh commented Mar 13, 2022

Players aren't able to read books while in creative mode. Even if pages it's inside whitelistedNBT and removeCreativeNBTTags = false

Mod version: 0.5.1

@samolego
Copy link
Owner

So book loses all the pages once you switch to creative?

@Ampflower
Copy link
Collaborator

This is likely related to the item sanitiser always being ran on creative to avoid accidentally clearing the inventory by giving known hashes to fetch the correct item against, although it does end up giving clients semi-broken items that aren't actually broken to the server (at least, until the item gets inadvertently overwritten by other means). Creative really isn't sane to deal with here. Fun fact: The creative client will resend every item that has been updated since the last time the inventory was opened back to the server, overwriting what was there before. This had the effect of clearing the entire inventory of, what was to GolfIV, denied NBT when removeCreativeNBTTags was set to true.

A quick workaround for now would be:

  1. Go into Survival or Adventure (or any other non-creative gamemodes)
  2. Click the book in the inventory to force the server to send the correct NBT
  3. Use the book as you would normally.

An idea that I have in mind is to try to send the correct NBT for the item when one holds something in the hotbar to open it. This would mainly be useful for books, but could be applied to other items that may require their NBT intact on the client in order to be used. This can also be extended to survival since there maybe a case where the player's inventory was sanitised for being oversized, but the individual item could be fine.

Should also be possible to make this just not happen at all when removeCreativeNBTTags is set to false, and to only append to the NBT when the inventory isn't oversized, since the mechanism is meant for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants