mojira.dev
MC-170028

The ravager's roar can knockback players in spectator mode and Creative mode players that are flying

The bug

After stunning a ravager, and quickly go to spectator mode, the roar will still knockback players in spectator mode.

To reproduce

  1. Summon a ravager

  2. Get a shield

  3. Switch to survival mode

  4. Let the ravager bite the shield your holding and wait for the ravager to get stunned

  5. Hold F3 and press F4 to open the game mode switcher and choose spectator mode

  6. Go near the stunned ravager
    → ❌ The spectating player gets knocked back

Code analysis

Code analysis by @unknown can be found in this comment.

Linked issues

Attachments

Comments 13

Can confirm for 1.16.1

Can confirm in 20w51a.

Can confirm in 21w03a.

Can confirm in 21w07a.

Can confirm in 21w14a.

3 more comments

Can confirm in 1.18.2 and 22w11a.

I can confirm this behavior in 1.19 and 1.19.1 Release Candidate 1. This issue can also be seen with creative players that are currently flying and isn't exclusive to those in spectator mode. My reasoning for believing that the ravager's roar shouldn't knockback players that are flying in creative mode is because players (that are in creative mode and are flying) do not receive knockback from TNT explosions and aren't able to be pushed by flowing water.

Here's a code analysis regarding this issue.

Code Analysis:

The following is based on a decompiled version of Minecraft 1.19.1 Release Candidate 1 using Mojang mappings.

net.minecraft.world.entity.monster.Ravager.java

public class Ravager extends Raider {
   ...
   private void roar() {
      if (this.isAlive()) {
         List<Entity> list = this.level.getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(4.0), NO_RAVAGER_AND_ALIVE);
         for (LivingEntity livingEntity : list) {
            if (!(livingEntity instanceof AbstractIllager)) {
               livingEntity.hurt(DamageSource.mobAttack(this), 6.0f);
            }
            this.strongKnockback(livingEntity);
         }
         ...

If we look at the above class, we can see all living entities that are alive and are not considered illagers will receive knockback from the roars of ravagers. Since players in spectator mode are considered alive and living entities, this allows them to receive knockback from this source.

Can confirm in 1.19.2.

in 1.19.2 i was in spectator while having another player in adventure mode, the player triggered the ravager roar and i got knocked back, defo a bug that should be fixed cus it kinda feels dumb to keep bugs in the game for what feels like it should be a relatively easy fix? 

This issue still exists in Minecraft 1.21.

DrownedZombie

(Unassigned)

Confirmed

Gameplay

Low

Mob behaviour

1.15.1, 1.15.2 Pre-release 2, 1.15.2, 20w06a, 20w07a, ..., 1.19.4, 1.20 Release Candidate 1, 1.20, 1.21, 1.21.4

Retrieved