mojira.dev
MC-94481

Enderman teleport sound only plays at position it teleports to

The Bug

The minecraft:entity.enderman.teleport sound plays at the position the enderman teleports to, which is not the case in 1.8.9, where it also plays at position it teleported from.

Steps to Reproduce

  • Place down a bucket of water and obtain some enderman spawn eggs.

  • Summon some endermen in the water by using the spawn eggs and listen closely as you do this.

Observed Behavior

The minecraft:entity.enderman.teleport sound ("Enderman teleports") plays at the position the enderman teleports to.

Expected Behavior

The minecraft:entity.enderman.teleport sound would play at the position the enderman teleports from.

Videos demonstrating the issue

16w03a: https://www.youtube.com/watch?v=m1SPOTMgFGA
1.8.9: https://www.youtube.com/watch?v=W6bX58WABH4

Code Analysis

By @unknown using MCP Reborn 1.16.5 mappings

At net.minecraft.entity.monster.EndermanEntity.teleportTo() the game simply only tries to play the sound after the enderman teleports:

if (flag && !flag1) {
         boolean flag2 = this.attemptTeleport(x, y, z, true);
         if (flag2 && !this.isSilent()) {
            this.world.playSound((PlayerEntity)null, this.prevPosX, this.prevPosY, this.prevPosZ, SoundEvents.ENTITY_ENDERMAN_TELEPORT, this.getSoundCategory(), 1.0F, 1.0F);
            this.playSound(SoundEvents.ENTITY_ENDERMAN_TELEPORT, 1.0F, 1.0F);
         }

         return flag2;
      }

Which could be fixed by duplicating the if statement above the teleport attempt as well

if (flag && !flag1) {
         if (!this.isSilent()) {
            this.world.playSound((PlayerEntity)null, this.prevPosX, this.prevPosY, this.prevPosZ, SoundEvents.ENTITY_ENDERMAN_TELEPORT, this.getSoundCategory(), 1.0F, 1.0F);
            this.playSound(SoundEvents.ENTITY_ENDERMAN_TELEPORT, 1.0F, 1.0F);
         }
         boolean flag2 = this.attemptTeleport(x, y, z, true);
         if (flag2 && !this.isSilent()) {
            this.world.playSound((PlayerEntity)null, this.prevPosX, this.prevPosY, this.prevPosZ, SoundEvents.ENTITY_ENDERMAN_TELEPORT, this.getSoundCategory(), 1.0F, 1.0F);
            this.playSound(SoundEvents.ENTITY_ENDERMAN_TELEPORT, 1.0F, 1.0F);
         }

         return flag2;
      }

Linked issues

Attachments

Comments 37

Confirmed for 1.9.2 ~ 1.9.3-pre3.

Confirmed for 16w21a.

Confirmed for 16w21b.

Reporter can be changed to Les3awe.

27 more comments

can confirm in 1.18.2

@unknown Again, please stop going through tickets and adding confirmation messages for outdated versions.

@unknown Adding this is not helpful for us, please stop immediately. We are more concerned with knowing if it is an issue in the latest full release of the game.

Still an issue in 1.21.4...

Swekob

[Mod]Les3awe

(Unassigned)

Confirmed

Gameplay

Low

Sound

enderman, sound, soundEvent, teleport

Minecraft 15w51b, Minecraft 16w06a, Minecraft 1.9 Pre-Release 1, Minecraft 1.9, Minecraft 1.9.2, ..., 1.21.5, 25w17a, 1.21.6 Pre-Release 3, 1.21.8, 25w34b

Retrieved