Wolves stop attacking monster after entering a portal leashed

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Minor
    • None
    • Affects Version/s: None
    • Spigot version 4621-Spigot-566f972-3347052 (MC: 26.1.2) (Implementing API version 26.1.2-R0.1-SNAPSHOT)
    • Yes

      This is a logic bug that affects also vanilla Minecraft 21.1.2, but whose fix is fairly trivial and could be added here I guess until Mojang fixes it upstream.

      When a leashed wolf is passed through a portal, in Entity.teleportCrossDimension a new entity is created and the `home_pos` and `home_radius` NBT properties which define the leash holder position are incorrectly copied. Then the this.mob.isWithinHome(target) check in TargetGoal.canAttack fails, so wolves simply stop attacking entirely.

      There's a more complete explanation at https://report.bugs.mojang.com/servicedesk/customer/portal/2/MC-307839?created=true

      The fix is trivial: move the chunk of code that unleashes entities in removeAfterChangingDimensions() BEFORE copy.restoreFrom(this) in Entity.teleportCrossDimension is called. Thus the NBT home_pos and home_radius fields are (properly) unset when copy.restoreFrom is called, so the cloned entity does not have them.

            Assignee:
            Unassigned
            Reporter:
            Marcos
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: