Skip to content
This repository has been archived by the owner on Aug 30, 2020. It is now read-only.

Lithium incompatibility - java.lang.IllegalAccessError: tried to access field EntityTracker.entity from class ThreadedAnvilChunkStorage #1

Open
Andrews54757 opened this issue Aug 17, 2020 · 17 comments
Labels
help wanted Extra attention is needed incompatibility When optifabric is not compatible with another mod

Comments

@Andrews54757
Copy link
Owner

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)
@Andrews54757
Copy link
Owner Author

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);
         }
      }

@TheoCGaming
Copy link

Isn't that a Minecraft problem or is OptiFabric changing something with Vanilla Minecraft's chunk storage?

@Andrews54757
Copy link
Owner Author

Andrews54757 commented Aug 18, 2020

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.

@Andrews54757
Copy link
Owner Author

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)

@TheoCGaming
Copy link

hmm. Is it possible you could change something so that when Lithium is installed, you could disable OF's class changes and access wideners?

@Andrews54757
Copy link
Owner Author

Andrews54757 commented Aug 18, 2020

yes. But I don't yet know how as of today, I am still learning how this mod's architecture works.

@Andrews54757 Andrews54757 added help wanted Extra attention is needed incompatibility When optifabric is not compatible with another mod labels Aug 18, 2020
@TheoCGaming
Copy link

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.

@Andrews54757
Copy link
Owner Author

I think that a similar approach to this may work: 70c0be2

@Andrews54757
Copy link
Owner Author

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:

https://github.com/Andrews54757/OptiFabric-updated/blob/master/src/main/java/me/modmuss50/optifabric/patcher/fixes/ThreadedAnvilChunkStorageFix.java

@amusingimpala75
Copy link

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?

@Andrews54757
Copy link
Owner Author

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.

@amusingimpala75
Copy link

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

@Andrews54757
Copy link
Owner Author

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.

@Andrews54757
Copy link
Owner Author

Andrews54757 commented Aug 20, 2020

For reference: modmuss50#237
modmuss50#236
CaffeineMC/lithium#73

@Andrews54757 Andrews54757 changed the title Lithium incompatibility - ThreadedAnvilChunkStorage tries to access property of entity Lithium incompatibility - java.lang.IllegalAccessError: tried to access field EntityTracker.entity from class ThreadedAnvilChunkStorage Aug 20, 2020
@amusingimpala75
Copy link

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.

@amusingimpala75
Copy link

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.

@10935336
Copy link

10935336 commented Aug 28, 2020

I tested lithium-fabric-mc1.16.2-0.5.2.jar and it seems to work fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed incompatibility When optifabric is not compatible with another mod
Projects
None yet
Development

No branches or pull requests

4 participants