Skip to content

Change EntityPlayer ASM code for Java 21+ compat #37

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

Open
wants to merge 1 commit into
base: 1.12
Choose a base branch
from

Conversation

jchung01
Copy link

@jchung01 jchung01 commented Sep 27, 2024

Previous method was counting InvokeSpecial instructions, which break in Java 11+ because one of the instructions (EntityPlayer#isInBed) is instead compiled as an InvokeVirutal (See related question).
Fugue (a mod for Java 21+/Cleanroom to fix other mods) patches the AR transformer by looking for a specific LineNumberNode, but line numbers don't match between original AR and this fork. So this PR changes the way the position to inject code is found.

Slightly changes the injection point of the code, but should be functionally equivalent.
Original AR:

if (RocketInventoryHelper.allowAccess(this) &&
    !this.world.isRemote &&
    this.openContainer != null && 
    !this.openContainer.canInteractWith(this))

This PR:

if (!this.world.isRemote &&
    RocketInventoryHelper.allowAccess(this) &&
    this.openContainer != null &&
    !this.openContainer.canInteractWith(this))

Enable Advanced Rocketry Patch in fugue.cfg must be false until CleanroomMC/Fugue#58 is merged.
Fixes #27.

@jchung01
Copy link
Author

Actually, realized the Fugue PR should be enough to fix this. Will still leave this PR open if you want to merge it, as it should be more robust than the existing ASM code.

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.

[Bug]Error in Cleanroom Loader
1 participant