Interface PlayerEvent.AttackEntity
- Enclosing interface:
- PlayerEvent
public static interface PlayerEvent.AttackEntity
-
Method Summary
Modifier and TypeMethodDescriptionattack(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level level, net.minecraft.world.entity.Entity target, net.minecraft.world.InteractionHand hand, @Nullable net.minecraft.world.phys.EntityHitResult result) Invoked when a player is about to attack an entity using left-click.
-
Method Details
-
attack
EventResult attack(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level level, net.minecraft.world.entity.Entity target, net.minecraft.world.InteractionHand hand, @Nullable @Nullable net.minecraft.world.phys.EntityHitResult result) Invoked when a player is about to attack an entity using left-click. Equivalent to Forge'sAttackEntityEventand Fabric API'sAttackEntityCallbackevents.- Parameters:
player- The player attacking the entity.level- The level the player is in.target- The entity about to be attacked.hand- The hand the player is using.result- The entity hit result.- Returns:
- An
EventResultdetermining the outcome of the event, the attack may be cancelled by the result.
-