gniftygnome / cooldown-coordinator

Helper library to coordinate setting cooldown timers
Other
2 stars 1 forks source link

[1.20] Crash when used with Lithium #1

Open quiqueck opened 1 year ago

quiqueck commented 1 year ago

Sorry, I know you have a lot to do. But this time I am here as a player not because of my mods.

I am using cooldown-coordinator 0.6.1 and lithium 0.11.2. The game crashes when a HopperBlockEntity receives a tick:

[18:25:32] [Server thread/ERROR]: Encountered an unexpected exception
net.minecraft.class_148: Ticking block entity
    at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:901) ~[client-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:824) ~[client-intermediary.jar:?]
    at net.minecraft.class_1132.method_3748(class_1132.java:105) ~[client-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:671) ~[client-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265) ~[client-intermediary.jar:?]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.AbstractMethodError: Receiver class net.minecraft.class_2614 does not define or inherit an implementation of the resolved method 'boolean canReceiveTransferCooldown()' of interface me.jellysquid.mods.lithium.api.inventory.LithiumCooldownReceivingInventory.
    at net.minecraft.class_2614.handler$cha000$lithium$lithiumInsert(class_2614.java:679) ~[client-intermediary.jar:?]
    at net.minecraft.class_2614.method_11246(class_2614.java:148) ~[client-intermediary.jar:?]
    at net.minecraft.class_2614.method_11243(class_2614.java:115) ~[client-intermediary.jar:?]
    at net.minecraft.class_2614.method_31692(class_2614.java:102) ~[client-intermediary.jar:?]
    at net.minecraft.class_2818$class_5563.method_31703(class_2818.java:662) ~[client-intermediary.jar:?]
    at net.minecraft.class_2818$class_5564.method_31703(class_2818.java:716) ~[client-intermediary.jar:?]
    at net.minecraft.class_1937.method_18471(class_1937.java:470) ~[client-intermediary.jar:?]
    at net.minecraft.class_3218.method_18765(class_3218.java:390) ~[client-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:897) ~[client-intermediary.jar:?]
    ... 5 more

Removing either cooldown or lithium does not cause the crash, so it might be an issue with Lithium as well.

quiqueck commented 1 year ago

Here is a Lithium issue mentioning the same crash: https://github.com/CaffeineMC/lithium-fabric/issues/476

gniftygnome commented 1 year ago

That crash looks like either 2No2Name and I had a miscommunication or Lithium does not implement that interface in the way I thought we agreed. I could just solve it by pulling in Lithium as a build dependency but (frustratingly) newer versions of Loom use maven data instead of mod dependency data to decide what to pull into development environments, so that will cause anybody developing to CC's API to pull in Lithium. I need to figure out how to suppress the deps in maven.

gniftygnome commented 1 year ago

Hmmm. This might be something more complicated. Are you using OmniHopper?

gniftygnome commented 1 year ago

OK this is pretty much mysterious to me, so I've asked the folks over at CaffeineMC. I don't really agree with replacing as much of HopperBlockEntity as Lithium does, because it seems to me they are trying to make performance improvements that are mainly for technical users and at the same time, messing with fundamental implementation details which are relevant to technical users. So what I am getting at is rather than trying to use the API they added another option I might prefer at this point is just to go back to suppressing Lithium's HopperBlockEntity mixins. But first I want to see if we can fix whatever is going wrong.

gniftygnome commented 1 year ago

Rather than spend a bunch of time targeting a Lithium API that will probably never completely serve the needs of cross-mod cooldown coordination, I've decided to go back to suppressing Lithium's HopperBlockEntity mixins. This has the added benefit of making Hoppers behave exactly as they do in vanilla, rather than however they behave with the majority of their most complex implementation replaced by Lithium.

If you are using a mod that bundles CC you can download the latest version of CC from Modrinth or CF and add it to your mods so you do not have to wait for the other mod to update. I'll leave this issue open a while longer just in case some new option comes to light, but I don't really expect anything.

2No2Name commented 1 year ago

I guess overriding the interface methods provided by lithium doesn't work by implementing a default method. I expected that you would implement the methods in the hopper block entity itself instead of the CoordinatedCooldown interface.