Hey, I'm working on a mod based on Dark Souls, just as a little project for fun and to teach myself a little about Java. I'm trying to make a Humanity counter and I've looked all over different tutorials and the documentation, but I can't figure out for the life of me what the problem might be. It could be a quirk I'm missing about Java, or it could just be I've implemented my capabilities bad. I honestly have no clue.
Anyhow, here's the code that I'm using for my HUD element renderer: (apologies for the sloppy and silly code quirks of mine lmao. i'll rewrite it if i wanna get serious with it)
As you can see in the code, I've added a test line to swap out with the Humanity variable get with the player health, and that works just fine. I run the debugger, swap it to that and it goes to twenty and counts down when damaged, and goes back up when regen'd. But swapping the Humanity variable back in pops it back down to 0. (I just tried it while on a server too and Humanity didn't work on that either...)
If the Humanity scripts need to be seen, let me know, but just know that it's largely based off of the MCHorse code here. (I should mention my event handler doesn't work either, but the methods I have for adding and reducing Humanity work just fine and send my test messages and saves the Humanity to the playerdata NBT (or world data in the case of single player which may be its own problem but I wont worry about it for now.))
Anyway, knowing me I've probably missed something, but hopefully you've got enough to help me troubleshoot my way out of this. Thanks in advance!