Lithium incompatibility - java.lang.IllegalAccessError: tried to access field EntityTracker.entity from class ThreadedAnvilChunkStorage
Opened this issue · 17 comments
java.lang.IllegalAccessError: tried to access field net.minecraft.class_3898$class_3208.field_18247 from class net.minecraft.class_3898
at net.minecraft.class_3898.method_18713(class_3898.java:1749)
at net.minecraft.class_3215.method_14096(class_3215.java:467)
at net.minecraft.class_3244.method_12063(class_3244.java:863)
at net.minecraft.class_2828.method_12272(class_2828.java:122)
at net.minecraft.class_2828$class_2830.method_11054(class_2828.java:18)
at net.minecraft.class_2600.lambda$checkThreadAndEnqueue$0(class_2600.java:34)
at net.minecraft.class_3738.run(class_3738.java:18)
at net.minecraft.class_1255.method_18859(class_1255.java:172)
at net.minecraft.class_4093.method_18859(class_4093.java:23)
at net.minecraft.server.MinecraftServer.method_24306(MinecraftServer.java:758)
at net.minecraft.server.MinecraftServer.method_18859(MinecraftServer.java:152)
at net.minecraft.class_1255.method_16075(class_1255.java:134)
at net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:740)
at net.minecraft.server.MinecraftServer.method_16075(MinecraftServer.java:734)
at net.minecraft.class_1255.method_5383(class_1255.java:115)
at net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:718)
at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:671)
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:254)
at java.lang.Thread.run(Thread.java:745)
Source of error
while(var2.hasNext()) {
ThreadedAnvilChunkStorage.EntityTracker entityTracker = (ThreadedAnvilChunkStorage.EntityTracker)var2.next();
if (entityTracker.entity == player) {
entityTracker.updateCameraPosition(this.world.getPlayers());
} else {
entityTracker.updateCameraPosition(player);
}
}
Isn't that a Minecraft problem or is OptiFabric changing something with Vanilla Minecraft's chunk storage?
Optifine is touching the class, and from what I understand, Optifabric is applying some access widener or so stuff to allow private methods and fields to be accessible publically. The problem is that lithium is also making some changes to the class, and is applying access wideners to it as well, which causes conflict.
remapped error stacktrace
java.lang.IllegalAccessError: tried to access field net.minecraft.ThreadedAnvilChunkStorage$EntityTracker.entity from class net.minecraft.ThreadedAnvilChunkStorage
at net.minecraft.ThreadedAnvilChunkStorage.updateCameraPosition(ThreadedAnvilChunkStorage.java:1749)
at net.minecraft.ServerChunkManager.updateCameraPosition(ServerChunkManager.java:467)
at net.minecraft.ServerPlayNetworkHandler.onPlayerMove(ServerPlayNetworkHandler.java:863)
at net.minecraft.PlayerMoveC2SPacket.apply(PlayerMoveC2SPacket.java:122)
at net.minecraft.PlayerMoveC2SPacket$Both.apply(PlayerMoveC2SPacket.java:18)
at net.minecraft.NetworkThreadUtils.lambda$checkThreadAndEnqueue$0(NetworkThreadUtils.java:34)
at net.minecraft.ServerTask.run(ServerTask.java:18)
at net.minecraft.ThreadExecutor.executeTask(ThreadExecutor.java:172)
at net.minecraft.ReentrantThreadExecutor.executeTask(ReentrantThreadExecutor.java:23)
at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:758)
at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:152)
at net.minecraft.ThreadExecutor.runTask(ThreadExecutor.java:134)
at net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:740)
at net.minecraft.server.MinecraftServer.runTask(MinecraftServer.java:734)
at net.minecraft.ThreadExecutor.runTask(ThreadExecutor.java:115)
at net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:718)
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:671)
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:254)
at java.lang.Thread.run(Thread.java:745)
hmm. Is it possible you could change something so that when Lithium is installed, you could disable OF's class changes and access wideners?
yes. But I don't yet know how as of today, I am still learning how this mod's architecture works.
you could add an "if("mod-id":"lithium"){...}" and change the quote fields to their actual names, maybe even make some functions that cover the changes and stuff and put them in a group, and make it so that the brackets have something similar to a goto statement in them.
I think that a similar approach to this may work: 70c0be2
Preferably, I would like to preserve the mod's structure & methodology as much as possible until I understand it better. The fix would probably go here:
Would it be worth it to add the lithium compatibility as a configurable option in a "compatibility.txt" file whose true/false value is read upon each startup?
Perhaps. At some point we will have to incorporate a config file somewhere as Optifine makes more and more invasive changes. Still, it would be preferable to make optifabric compatible with other mods without configuring it for simplicity's sake.
As with this case, since its a relatively simple access conflict, I think it will be possible to resolve the conflict without compromises.
Lithium hasn't been released on 1.16.2. The curseforge release is 1.16.1, and the sources are still being worked on for 1.16.2
Yep. This was an issue with optifabric 1.16.1 that I just posted here. The issue has been reproduced with 1.16.2 lithium built from the source.
For reference: modmuss50#237
modmuss50#236
CaffeineMC/lithium#73
From OptifineInstaller.java: "// Lets make every class we touch public"
If all the classes are public, why should ThreadedAnvilChunkStorage be unable to access it? It performs access widening, not restricting.
Looking at the lithium wiki, there are configuration settings for:
mixin.entity.data_tracker.use_arrays
mixin.entity.data_tracker.no_locks
Maybe just turning these off would help.
I tested lithium-fabric-mc1.16.2-0.5.2.jar and it seems to work fine.