Skip to content
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

Fix MCEternal #909

Merged
merged 1 commit into from
Dec 31, 2024
Merged

Fix MCEternal #909

merged 1 commit into from
Dec 31, 2024

Conversation

HaHaWTH
Copy link

@HaHaWTH HaHaWTH commented Dec 18, 2024

This pull request closes #904.

Changes made

  • Move tilesThisCycle to member variable to keep LVT clean and make Mixin happy
  • Make iterator can be captured by Mixin

Error analysis

Error log:

[main/ERROR] [mixin]: Critical injection failure: LVT in net/minecraft/world/World::func_72939_s()V has incompatible changes at opcode 787 in callback net/minecraft/world/World::beforeTick.
Expected: [Ljava/util/Iterator;, Lnet/minecraft/tileentity/TileEntity;, Lnet/minecraft/util/math/BlockPos;]
Found: [I, Lnet/minecraft/tileentity/TileEntity;, Lnet/minecraft/util/math/BlockPos;]

The original code Iterator<TileEntity> iterator = null; will be considered as unused by javac and will be optimized to bytecode like this:

0: aconst_null
1: astore_1

Not real code, just for example.

Which causes Iterator is missing in LVT, mod mixins cannot capture the variable and lead to errors. After fixing this, the LVT order should be [Ljava/util/Iterator;, I, Lnet/minecraft/tileentity/TileEntity;]

Also int tilesThisCycle = 0; statement causes inconsistent order in local variable table, made mixins capture the wrong value. Moving to member var resolves this.

@Luohuayu Luohuayu merged commit 375da46 into Luohuayu:1.12.2 Dec 31, 2024
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