Skip to content

Bee TargetReason #14230

Description

@JustJabka

Expected behavior

When entity attacks bee it should call the EntityTargetEvent/EntityTargetLivingEntityEvent with the TARGET_ATTACKED_ENTITY reason and other bees in radius should call the same event, but with the TARGET_ATTACKED_NEARBY_ENTITY reason.

Observed/Actual behavior

When entity attacks bee all swarm calls the EntityTargetEvent with the TARGET_ATTACKED_ENTITY reason, even if only one bee was attacked.

Steps/models to reproduce

  1. Create event handler that listens to the EntityTargetEvent or the EntityTargetLivingEntityEvent and cancel it if the reason is TARGET_ATTACKED_NEARBY_ENTITY.
  2. Spawn at least two bees.
  3. Attack one of them.
  4. See that nothing was canceled because every bee in the swarm thinks that reason is the TARGET_ATTACKED_ENTITY.

Plugin and Datapack List

Image

Paper version

This server is running Paper version 26.2-121-main@a2a42c5 (2026-08-29T11:32:25Z) (Implementing API version 26.2.build.121-stable)
You are running the latest version

Other

Example of an event handler:

@EventHandler(ignoreCancelled = true)
public void onEntityTarget(EntityTargetLivingEntityEvent event) {
    if (!(event.getTarget() instanceof Player player)) return;
    if (!(event.getEntity() instanceof Bee)) return;

    player.sendMessage("Target Reason: %s".formatted(event.getReason().name()));
    
    event.setCancelled(true);
}

Bug showcase video
https://www.youtube.com/watch?v=NpkIayQz1hE

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions