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

Server does not send repair cost to client on some versions #353

Open
FomkaZZZ opened this issue Aug 26, 2024 · 5 comments
Open

Server does not send repair cost to client on some versions #353

FomkaZZZ opened this issue Aug 26, 2024 · 5 comments
Labels

Comments

@FomkaZZZ
Copy link

How do I remove the inscription "Enchantment cost"? Is it even possible. If so, how?

@0dinD
Copy link
Collaborator

0dinD commented Aug 27, 2024

I assume you might be using a Minecraft version between 1.7 and 1.10?

From a quick look at the code, it seems like the enchantment cost is not properly sent from the server to the client on Minecraft versions between 1.7 and 1.10, so on those versions, the client will set the enchantment cost according to vanilla mechanics. However, on Minecraft versions 1.11 and above, you should see that the enchantment cost gets sent (AnvilGUI always sets a cost of 0, so basically the cost should not be shown in the client).

Side note: Even on 1.11+, you can sometimes see a "flicker" of an enchantment cost for a split second when typing in the text box. This is because the client always sets a repair cost first, even if the server sends a repair cost of 0 as an override. This is, as far as I can tell, an unavoidable limitation of the game, it's impossible to always send the 0 repair cost from the server fast enough so that the client value never gets shown. But again, at least it only shows for a split second. It's just a limitation we'll have to live with, I think.


I can fix the AnvilGUI code for 1.7 - 1.10 so that it properly sends the repair cost to the client though. But it'll have to wait a few days, I'm pretty busy right now.

@FomkaZZZ
Copy link
Author

I am using version 1.16.5. This can be fixed if you put the item in the right slot, but this is not an option and errors occur. I wish there was no inscription with an empty slot. I have attached my photo

hRCeGaXekoA

@FomkaZZZ
Copy link
Author

I just checked on 1.20.2 and everything works fine there, sometimes it flickers. And at 1.16.5 the inscription does not even disappear

@0dinD
Copy link
Collaborator

0dinD commented Aug 27, 2024

You're right, it also doesn't send the repair cost to the client on 1.16.5. I had another look at the code, and it turns out that it was messier than I initially thought:

  • 1.7-1.10: Repair cost is not sent properly
  • 1.11: Repair cost is sent properly
  • 1.12-1.13: Repair cost is not sent properly on Spigot, but Paper has a patch for it, so it works correctly on Paper servers
  • 1.14-1.16: Repair cost is not sent properly
  • 1.17-1.21: Repair cost is sent properly

Anyways, I'm pretty confident that this can be fixed by AnvilGUI, will have a look at it in a few days.

Update: Those few days turned into weeks, but I've made some progress and will hopefully push a PR in a few days.

@0dinD 0dinD changed the title How do I remove the inscription "Enchantment cost"? Server does not send repair cost to client on some versions Aug 27, 2024
@0dinD 0dinD added the bug label Aug 27, 2024
@FomkaZZZ
Copy link
Author

Thanks!

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

No branches or pull requests

2 participants