fixrtm / fixRTM

Fixes some bugs of RTM and make RTM more useful!
Other
24 stars 6 forks source link

crash with CubicChunksCore #365

Open anatawa12 opened 2 years ago

anatawa12 commented 2 years ago

Before submitting a bug, please make sure following checks.

Descrive the bug

Original: https://discord.com/channels/749186892733480970/749187907033497601/909110518697042001

Crashes the game with CubicChunksCore.

java.lang.NoClassDefFoundError: net/minecraft/entity/EntityTracker
    at net.minecraft.world.WorldServer.<init>(WorldServer.java:112)
    at net.minecraft.server.integrated.IntegratedServer.func_71247_a(IntegratedServer.java:132)
    at net.minecraft.server.integrated.IntegratedServer.func_71197_b(IntegratedServer.java:233)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: net.minecraft.entity.EntityTracker
    at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 5 more
Caused by: org.spongepowered.asm.mixin.transformer.throwables.MixinTransformerError: An unexpected critical error was encountered
    at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:363)
    at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:208)
    at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClassBytes(MixinTransformer.java:178)
    at org.spongepowered.asm.mixin.transformer.Proxy.transform(Proxy.java:72)
    at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279)
    at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176)
    ... 7 more
Caused by: org.spongepowered.asm.mixin.throwables.MixinApplyError: Mixin [cubicchunks.mixins.core.json:common.MixinEntityTracker] from phase [DEFAULT] in config [cubicchunks.mixins.core.json] FAILED during APPLY
    at org.spongepowered.asm.mixin.transformer.MixinProcessor.handleMixinError(MixinProcessor.java:642)
    at org.spongepowered.asm.mixin.transformer.MixinProcessor.handleMixinApplyError(MixinProcessor.java:594)
    at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:356)
    ... 12 more
Caused by: org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException: @Redirect ctor invocation was not found in net/minecraft/entity/EntityTracker::func_72785_a(Lnet/minecraft/entity/Entity;IIZ)V [INJECT Applicator Phase -> cubicchunks.mixins.core.json:common.MixinEntityTracker -> Apply Injections ->  -> Inject -> cubicchunks.mixins.core.json:common.MixinEntityTracker->@Redirect::onCreateEntry(Lnet/minecraft/entity/Entity;IIIZ)Lnet/minecraft/entity/EntityTrackerEntry;]
    at org.spongepowered.asm.mixin.injection.invoke.RedirectInjector.postInject(RedirectInjector.java:368)
    at org.spongepowered.asm.mixin.injection.code.Injector.inject(Injector.java:268)
    at org.spongepowered.asm.mixin.injection.struct.InjectionInfo.inject(InjectionInfo.java:385)
    at org.spongepowered.asm.mixin.transformer.MixinTargetContext.applyInjections(MixinTargetContext.java:1284)
    at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyInjections(MixinApplicatorStandard.java:1042)
    at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyMixin(MixinApplicatorStandard.java:395)
    at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.apply(MixinApplicatorStandard.java:320)
    at org.spongepowered.asm.mixin.transformer.TargetClassContext.applyMixins(TargetClassContext.java:345)
    at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:569)
    at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:351)
    ... 12 more
Caused by: org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException: @Redirect ctor invocation was not found in net/minecraft/entity/EntityTracker::func_72785_a(Lnet/minecraft/entity/Entity;IIZ)V
    at org.spongepowered.asm.mixin.injection.invoke.RedirectInjector.injectAtConstructor(RedirectInjector.java:616)
    at org.spongepowered.asm.mixin.injection.invoke.RedirectInjector.inject(RedirectInjector.java:339)
    at org.spongepowered.asm.mixin.injection.code.Injector.inject(Injector.java:264)
    ... 20 more

message (2).txt

To Reproduce

Launch the game with CubicChunksCore

Expected Behavior

No Crash

Actual Behavior

Crashes

OS

Windows 8.1 (amd64) version 6.3

Minecraft Forge Version

14.23.5.2855

fixRTM Version

2.0.20

Other Mods

CubicChunksCore

anatawa12 commented 2 years ago

https://github.com/OpenCubicChunks/CubicChunks/blob/dc16fef38129b86de11cd8a0c94069dd8eab56e4/src/main/java/io/github/opencubicchunks/cubicchunks/core/asm/mixin/core/common/MixinEntityTracker.java#L59-L60 According to this code, OpenCubicChunks depends on the instantiation of EntityTrackerEntry in EntityTracker#track method.

However, the fixRTM replaces all instantiation of EntityTrackerEntry to fixRTM's hook method in the following code.

https://github.com/fixrtm/fixRTM/blob/d23bca58b0c8858a0ee64b221875518e6a1e59c7/src/main/java/com/anatawa12/fixRtm/asm/hooking/HookingTransformer.kt#L23-L53

This makes incompatibility.

anatawa12 commented 2 years ago

If OpenCubicChunks provide us the way to detect if OpenCubicChunks is installed, if OpenCubicChunks is installed, It's possible to suppress replacing instantiation of EntityTrackerEntry in EntityTracker#track method and replace instantiation in OpenCubicChunks's hook instead.

anatawa12 commented 2 years ago

RTM is compatible with OCC so I'll fix this

anatawa12 commented 2 years ago

https://github.com/OpenCubicChunks/CubicChunks/issues/741#issuecomment-969339957

Leaving it open for now because i would like to attempt to fix it. I should be able to do it in about 2 weeks