The Aether

The Aether

38M Downloads

Bug: Slider can have negative velocity when it has too much health.

XezolesS opened this issue ยท 0 comments

commented

What Feature Types Apply to This Bug?

Entity

Other Type

No response

What Type of Bug Is This?

Unexpected Behavior

Mod Loader

NeoForge

Mod Loader Version

21.8.83

The Aether Version

1.5.1-beta.3

Is This Bug a Conflict With Another Mod?

Can be produce with any mods that modify entity's max health.

Client Log

No response

Crash Report (if applicable)

No response

Steps to Reproduce

Make sure you have AttributeFix mod installed.

Set the Slider's max health attribute to over 1050, then it will start to move in the opposite direction to the player. Its velocity will be set to 0 if its health is exactly at 1050.

What You Expect To Happen

Move towards the player.

What Actually Happened

Move in the opposite direction to the player.

Additional Details

I found the bug while playing Minecraft 1.19.2, Forge 43.4.4, Aether 1.5.1, with bunch of other mods. The mod that broke the Slider was AutoLeveling, which modifies entity's max health. I found that it starts to move when its health is under 1050.

And I found the code that cause the bug.

return this.isCritical() ? 0.045F - (this.getHealth() / 10000) : 0.035F - (this.getHealth() / 30000);

If this.getHealth() returns over 1050, then the velocity will be set under 0. (1050 / 30000 = 0.035)

I suggest setting a minimum value for the Slider, or use linear function.

// Set a minimum value.
// 0.013 in this code, because 400 / 30000 = 0.013333...
return Math.min(this.isCritical() ? 0.045F - (this.getHealth() / 10000) : 0.035F - (this.getHealth() / 30000), 0.013F);

// or use linear function
// It gradually increases the velocity
float velocityFactor = this.isCritical() ? 0.045F : 0.035F;
return -velocityFactor * (this.getHealth() / this.getMaxHealth()) + velocityFactor;

Also, consider checking isCritical() based on health ratio in the same context.

to

return (this.getHealth() / this.getMaxHealth()) <= 0.25F;

The video below demonstrates how to reproduce the bug in NeoForge 21.8.83, Aether 1.5.1-beta.3

seq1_1.mp4

Please Read and Confirm The Following

  • I have confirmed this bug can be replicated without the use of Optifine.
  • I have confirmed this bug is on the most recently supported version of Minecraft.
  • I have confirmed the details provided in this report are concise as possible and does not contain vague information (ie. Versions are properly recorded, answers to questions are clear).
  • I have confirmed this bug is unique and has not been reported already.
  • If playing on a modpack, I have reported this bug to their issue tracker already.
  • I have confirmed that I'm reporting a bug in The Aether I, not The Aether II.