[SPIGOT-3075] Shulker teleport does not create an EntityTeleportEvent Created: 19/Feb/17  Updated: 19/Feb/17  Resolved: 19/Feb/17

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Chris Fehling Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: shulker, teleport


 Description   

When a shulker is damaged, and in some other places, it calls a method of the name:

`protected boolean o()`

This then calculates a new BlockPosition and places the Entity there. Because of this, it bypasses the Entity Teleport events, as it is a special case.

Can you add a teleport event call and cancel check in this method?

 

```

protected boolean o()
  {
    if ((hasAI()) || (!isAlive())) {
      return true;
    }
    BlockPosition localBlockPosition1 = new BlockPosition(this);
    for (int i = 0; i < 5; i++)
    {
      BlockPosition localBlockPosition2 = localBlockPosition1.a(8 - this.random.nextInt(17), 8 - this.random.nextInt(17), 8 - this.random.nextInt(17));
      if ((localBlockPosition2.getY() > 0) && (this.world.isEmpty(localBlockPosition2)) && (this.world.g(this)) && (this.world.getCubes(this, new AxisAlignedBB(localBlockPosition2)).isEmpty()))
      {
        int j = 0;
        for (EnumDirection localEnumDirection : EnumDirection.values()) {
          if (this.world.d(localBlockPosition2.shift(localEnumDirection), false))
          {
            this.datawatcher.set(a, localEnumDirection);
            j = 1;
            break;
          }
        }
        if (j != 0) // fixing check goes here, I suppose
        {
          a(SoundEffects.fK, 1.0F, 1.0F);
          this.datawatcher.set(b, Optional.of(localBlockPosition2));
          this.datawatcher.set(c, Byte.valueOf((byte)0));
          setGoalTarget(null);
          return true;
        }
      }
    }
    return false;
  }

```


Generated at Sat Dec 13 15:22:56 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.