Mojira Archive
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 [Mod] Anthony Cicinelli

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();
   }

Invalid

[Mod] Anthony Cicinelli

2023-05-03, 02:12 PM

2023-10-05, 07:08 AM

2023-05-04, 07:22 AM

4

2

Confirmed

Mob behaviour

1.19.4, 23w18a

-