Fix vanilla parity on enchantable items with no targets #11896
+5
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request fixes #11821
Previously after the enchantment event took place bukkit would clear out all empty enchantments and send a completely empty offer list to the client. Minecraft handles this differently by default by still sending a cost to the client so the slots illuminate as seen in the attached issue.
This pull request attempts to address this issue by not setting back enchantment offer cost to 0 after PrepareItemEnchantEvent. This keeps the original price that was generated through the loop earlier within the slotsChanged method.
As far as drawbacks go for this fix after looking into this it would largely be thinking about how things are handled event side, because something would need to be done. If a developer wants to null out a spot how do we address this while maintaining vanilla behavior when an item may have no offers available? Or should vanilla behavior be kept to start with?
For reference when blanking out all 3 offers an enchanment table now looks like this, client side the hover shows no enchantment names, however displays all levels.
within default vanilla behavior as far as I'm aware there is no scenario where three enchantments aren't sent.