FIx: crash when using Bone Meal#1171
Conversation
|
The original method returns PASS in two conditions where only the first one changed, these changes would break the logic since they always redirect PASS->SUCCESS, even in the unchanged case. |
Oh right... i forgot there is one when fail to apply. Will look into that. |
|
Auto-Closed because creator of this PR deleted their account. |
|
what |
If it says "ghost" as OP's name then it's because the person's account is gone, hence why this happens. |
|
Yeah I know, but why |
Unfortunately, i cannot read other people's minds so this probably will remain a mystery. |
FIx a crash when applying bone meal on ≤ 1.21.11 servers
Closes: #1164
In 26.1.x the method
BoneMealItem.useOn()emits a checkcast toInteractionResult$Passafter readingPASS, but when targeting ≤ 1.21.11 servers, the@Redirectinjects aSUCCESSthere, which fails the cast and crashes the gameFix: replace the
@Redirectwith an@InjectatRETURNwhich intercepts the final return value after the game logic is completed. The result is typed asInteractionResultwith no internal casts, allowing to replacePASStoSUCCESSfor <=1.21.11 servers as intendedTest:
Joining a server using 1.21.11 version and start using bone meal anywhere. Everything works fine.
Joining a server using 26.1-26.1.2 version: works fine as well.