Auto HUD

Auto HUD

69.4k Downloads

Scoreboard support: check for score name changes and/or include title changes

JuggleStruggle opened this issue ยท 12 comments

commented

I recently installed this mod because it it just that good.

Anyways, the reason why I want this is because I play on servers that does not change the score numbers and oftentimes updates the score name instead so AutoHUD assumes that nothing is being updated in the scoreboard when, in reality, it is. This is like as if I were to change a player's name and keep their score and still wouldn't know that it got updated.

As far as I am aware, there are some techniques used to update the scoreboard's score names but the only one I am aware of is using Teams (which I assume this mod does not seem to detect), which can be used to update names without breaking the scores in the scoreboard.

What would be ideal to have in the settings as toggles:

  • Changes in the scoreboard title
  • Changes in score names / teams
  • Changes in score values (the red numbers)
commented

I personally don't play on servers that make big use of the scoreboard, so for me just glancing quickly at it was enough for the time being. That is why currently the scoreboard isn't dynamic at all.

Knowing that there is demand for it, I will gladly investigate how to make it dynamic :)

commented

I tried to implement it in 543673f, released as 1.5 on CurseForge & Modrinth. Could you try that out and tell me if it works correctly? I only have limited testing capabilities. From my local tests it all seemed to work great, but I would not be surprised if some server software would send packets weirdly to break it.

commented

Works better than before, now the only problem is that while it does its job, it doesn't seem to detect any changes in the scoreboard other than how many "players" there are. I might consider making a pull request for fixing this alone.

commented

I tried all of the three new options for scoreboard separately and so far Reveal Scoreboard when objective gets modified is the only one that works properly. This one seems to me that it's actually the scoreboard title, so the "objective" should be renamed to "title".

This is what I got by Reveal scoreboard when score changes enabled alone: this prevents showing the scoreboard because it's throwing an exception and as a result doesn't work. This is the stacktrace I got (with the exception of non-scoreboard related toggle options), do note that they were run under non-dev environment so you probably have to remap to get an unobfuscated code:

Error executing task on Client
java.lang.NullPointerException: Cannot invoke "Object.equals(Object)" because "this.oldValue" is null
	at mod.crend.autohud.component.ScoreboardComponentState.updateScore(ScoreboardComponentState.java:58)
	at mod.crend.autohud.component.ScoreboardHelper.updateScore(ScoreboardHelper.java:17)
	at net.minecraft.class_269.handler$zzi000$updateScore(class_269.java:525)
	at net.minecraft.class_269.method_1176(class_269.java)
	at net.minecraft.class_267.method_1128(class_267.java:57)
	at net.minecraft.class_269.method_1187(class_269.java:83)
	at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1220)
	at net.minecraft.class_269.method_1180(class_269.java:81)
	at net.minecraft.class_634.method_11118(class_634.java:2031)
	at net.minecraft.class_2757.method_11866(class_2757.java:53)
	at net.minecraft.class_2757.method_11054(class_2757.java:10)
	at net.minecraft.class_2600.method_11072(class_2600.java:22)
	at net.minecraft.class_1255.method_18859(class_1255.java:157)
	at net.minecraft.class_4093.method_18859(class_4093.java:23)
	at net.minecraft.class_1255.method_16075(class_1255.java:131)
	at net.minecraft.class_1255.method_5383(class_1255.java:116)
	at net.minecraft.class_310.method_1523(class_310.java:1085)
	at net.minecraft.class_310.method_1514(class_310.java:737)
	at net.minecraft.client.main.Main.main(Main.java:236)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:416)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:77)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)

Having Reveal scoreboard when team gets modified enabled alone: The scoreboard shows but no players / teams show do due to this error (which in the server I am playing seems to be using Teams), which is just useless on its own:

Error executing task on Client
java.lang.NullPointerException

Also forgot to mention one more thing: Having the last option enabled also does not apply teams to actual players client-sided. I didn't test this any further on the team side, but it is not that much of a problem provided that I didn't do anything that would require interaction.

commented

Oh, oops, that was silly. Fixed the NPE in 1.5.1, hopefully it makes the other parts work as well.

commented

Decided to work on a fork since I read the code and I know why it doesn't work well in detecting team changes; at the moment I made some codebase changes to help detect team changes which will be posted on the forked project once I think it's working as expected then do a pull request.

commented

Small update: So far it's working but it still doesn't detect every change but at least it does detect certain of them now.

Anyways, I realized that it still has some bugs regarding the lack of objective changes, especially with some mods like ReplayMod that ends up changing the sidebar objectives quite a lot and right now I am working to avoid this problem.

commented

Cool! Looking forward to it!

commented

I will see if I can do that tomorrow since I don't have enough time for today.

commented

So, I have done some progress but the only problem is that the title detection does not work and when I tried doing objective changes, it only caused more problems so that too was removed from the code.

I also renamed "when objective changes" to "when title, team or score changes" and introduced "when title changes" as a new option (even though the title is not being detected). While talking about the config, I also made a sub-category to both Hotbar and Scoreboard to cut down on unnecessary text, though both are not collapsed by default.

commented

That sounds great! Want to create a pull request? :)

commented

All right, made a pull request! If you have to remove some unused things, you can do so! ๐Ÿ˜„