Avoid have no response when trading using touch or the Shift key cause by client bug since v1.21.30 - #6667
Open
BUGTeas wants to merge 1 commit into
Open
Avoid have no response when trading using touch or the Shift key cause by client bug since v1.21.30#6667BUGTeas wants to merge 1 commit into
BUGTeas wants to merge 1 commit into
Conversation
…o response when trading using touch or the Shift key by client bug since v1.21.30
onebeastchris
approved these changes
Aug 24, 2026
| recipe.putInt("uses", Math.max(trade.getUses(), | ||
| // Limit the total uses to within the max integer value | ||
| // to avoid have no response when trading using touch or the Shift key by client bug since v1.21.30 | ||
| trade.getMaxUses() - Integer.MAX_VALUE)); |
Member
There was a problem hiding this comment.
Can't this just be Math.max(trade.getUses(), 0)? Seems like a negative number is the root issue here, that approach sounds simpler?
Contributor
Author
There was a problem hiding this comment.
In my tests, negative numbers are not the direct cause of this problem. It is only cause by maxUses - 2147483647 > uses now, meaning the final total uses is exceeds the max integer value.
Maybe we can ignore the negative numbers temporarily? or continue to avoid negative numbers but also adjuct maxUses to ensure the final total uses match Java client as possible?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Limit the total uses to within the max value, to avoid have no response when trading with touch or shift key cause by client bug since v1.21.30
How to test:
/summon villager ~ ~ ~ {Offers:{Recipes:[{maxUses:2147483647,uses:-2147483648,buy:{id:egg},sell:{id:snowball}}]},NoAI:true}