Skip to content

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
GeyserMC:masterfrom
BUGTeas:fix-villager-overflow
Open

Avoid have no response when trading using touch or the Shift key cause by client bug since v1.21.30#6667
BUGTeas wants to merge 1 commit into
GeyserMC:masterfrom
BUGTeas:fix-villager-overflow

Conversation

@BUGTeas

@BUGTeas BUGTeas commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

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}

…o response when trading using touch or the Shift key by client bug since v1.21.30
@BUGTeas BUGTeas changed the title Avoid have no response when trading using touch or the Shift key by client bug since v1.21.30 Avoid have no response when trading using touch or the Shift key cause by client bug since v1.21.30 Aug 24, 2026

@onebeastchris onebeastchris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

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));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this just be Math.max(trade.getUses(), 0)? Seems like a negative number is the root issue here, that approach sounds simpler?

@BUGTeas BUGTeas Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

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

Successfully merging this pull request may close these issues.

2 participants