mojira.dev
MC-262298

Fishes and Tadpoles aren't affected by jump boost when flopping around

The Bug

Fishes and Tadpoles aren't affected by jump boost when flopping around despite them jumping

Reproduce

/summon cod ~ ~1 ~ {PersistenceRequired:1,ActiveEffects:[{Id:8,Amplifier:1,Duration:999999}]}

Observed Result

Fishes and Tadpoles weren't jumping higher with jump boost

Expected Result

Fishes and Tadpoles would be affected by jump boost

Code Analysis

Code analysis provided by @unknown

The reason this occurs is because the flop is set to a static 4.0 on the y axis in the abstract fish class and isn't adding the jump boost modifier

Current Code

net/minecraft/world/entity/animal/AbstractFish.java

public void aiStep() {
      if (!this.isInWater() && this.onGround && this.verticalCollision) {
         this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)));
         this.onGround = false;
         this.hasImpulse = true;
         this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch());
      }

      super.aiStep();
   }

Fixed Code

net/minecraft/world/entity/animal/AbstractFish.java

public void aiStep() {
      if (!this.isInWater() && this.onGround && this.verticalCollision) {
         //Adding the jump boost modifyer on the setDeltaMovement fixes the bug
         this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F + this.getJumpBoostPower(), (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)));
         this.onGround = false;
         this.hasImpulse = true;
         this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch());
      }

      super.aiStep();
   }

Linked issues

Comments

migrated

This is feedback, please send it in the feedback.minecraft.net

[Mod] Jingy

Requesting review of this issue.

MC-163853 has been triaged by Mojang, and the issue specifically relates to an aquatic mob's abiltiy to jump when on honey, and how that should be prevented. If aquatic mobs bouncing around is seen as jumping in relation to honey blocks, this behavior should remain consistent across other features that modify jumping (in this example, jump boost).

Additionally; jumping is not specifically exclusive to mobs with legs, as in the case with the slime entity it is affected by jump boost.

anthony cicinelli

(Unassigned)

Confirmed

Mob behaviour

1.19.4, 23w18a

Retrieved