Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-3075

Shulker teleport does not create an EntityTeleportEvent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None

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

      ```

            Unassigned Unassigned
            SLiPCoR Chris Fehling
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: