Interface UseEntityCallback


public interface UseEntityCallback
Callback for right-clicking ("using") an entity. Is hooked in before the spectator check, so make sure to check for the player's game mode as well!

On the logical client, the return values have the following meaning:

  • SUCCESS cancels further processing, causes a hand swing, and sends a packet to the server.
  • CONSUME cancels further processing, and sends a packet to the server. It does NOT cause a hand swing.
  • PASS falls back to further processing.
  • FAIL cancels further processing and does not send a packet to the server.

On the logical server, the return values have the following meaning:

  • PASS falls back to further processing.
  • Any other value cancels further processing.

Note that on the server, the EntityHitResult may be null if the client successfully interacted using the Player.interactOn(Entity, InteractionHand, Vec3) position-less overload}. On the client, the EntityHitResult will never be null.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Event<UseEntityCallback>
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.InteractionResult
    interact(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level level, net.minecraft.world.InteractionHand hand, net.minecraft.world.entity.Entity entity, @Nullable net.minecraft.world.phys.EntityHitResult hitResult)
     
  • Field Details

  • Method Details

    • interact

      net.minecraft.world.InteractionResult interact(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level level, net.minecraft.world.InteractionHand hand, net.minecraft.world.entity.Entity entity, @Nullable net.minecraft.world.phys.EntityHitResult hitResult)