Lithium (Fabric)

Lithium (Fabric)

22M Downloads

Running Lithium and MmmMmmMmmMmm on a Server breaks some features of the Target Dummy

Joulanh opened this issue ยท 8 comments

commented

###Version / Mods Used:
Lithium mc1.18.1-0.7.6
MmmMmmMmmMmm-1.18-1.5.0-FABRIC https://www.curseforge.com/minecraft/mc-mods/mmmmmmmmmmmm/files
Fabric Api 0.44.0+1.18

Expected Behavior

The target dummy usually makes a special sound, shows the dealt dmg from every single hit as numbers flying away from the dummys head and shows a dmg/s counter above the hotbar when hit.

Actual Behavior

In single player with lithium installed on the client everything works fine, but on a dedicated server with lithium installed on the server all those features are missing and only the hitting animation is left.

Reproduction Steps

  1. Start a dedicated server with MmmMmmMmmMmm and Lithium installed
  2. Place down the Target Dummy
  3. Hit the Target Dummy
commented

The other mod doesn't seem to be open source anymore, I won't look into it in more detail then.

commented

Just to clarify before looking into it: Did you try running the server without lithium and if yes, did you get the expected behavior?

commented

Yes I tried that. Without lithium it works like intended.

commented

So I can't figure this out on my own. Could anybody from Lithium dev team help me fix this, assuming it's an issue on my end?
I've updated the Fabric github repo here https://github.com/MehVahdJukaar/DummyFabric1.16

commented

I offer my help to fix it. Can you show me what the exact code pieces are that implement the features that are broken when used together with lithium?

commented

Hi.
So according to this crash report https://www.curseforge.com/minecraft/mc-mods/mmmmmmmmmmmm/issues/8 (and 3 other similar ones I've got) the issue would start here https://github.com/MehVahdJukaar/DummyFabric/blob/6823e25f1dd9021d59020edc2eb563e5c8416c41/src/main/java/net/mehvahdjukaar/dummmmmmy/entity/TargetDummyEntity.java#L394-L406
It then goes inside some of fabric inner workings so I'm not sure exactly what's going wrong
Thanks for your help and let me know if you have any updates on this

commented

The problem is that Lithium accesses all methods declared in the class DummyNumberEntity to find out which methods it is overriding (e.g. does it have a hard collision box like shulkers?). This crashes, because there is a method

public boolean canPlayerSee(LocalPlayer player) { return player == null || this.targetPlayers.contains(player.getUUID()); }
which has the parameter LocalPlayer. However getting the object LocalPlayer.class does not seem to work, because it is only present on Clients and doesn't exist when on a server. Annotating the method with @Environment(value=EnvType.CLIENT) should work.
However I will also add a workaround in lithium since this isn't the first time another mod does not use these annotations where they are needed.

commented

Oh thanks I see. Just changed that method to use a normal Player instead and that should do the trick. Was totally an oversight on my part since there was no reason for it to be a client only method in the entity class. Good to know tho that lithium does this so I'll watch out for those misplaced or non annotated client methods in the future