Class InteractBlockEmptyHandEvent

java.lang.Object
net.neoforged.bus.api.Event
org.moddingx.libx.event.InteractBlockEmptyHandEvent
All Implemented Interfaces:
ICancellableEvent

public class InteractBlockEmptyHandEvent extends Event implements ICancellableEvent
Fired on right click with an empty hand but after the block action was processed. If this is not canceled, InteractionResult.PASS is returned from the click. If this is canceled, the value of cancellationResult is returned. This is only fired on the server. IMPORTANT: Canceling this with InteractionResult.CONSUME for the main hand does not mean it won't be posted for the offhand. For this cancel PlayerInteractEvent.RightClickBlock on the client. Returning InteractionResult.SUCCESS will swing the arm. However, it will first try to propagate to the offhand. So in order to swing the main hand, the event for the main hand has to return InteractionResult.SUCCESS and for the offhand InteractionResult.PASS.
  • Constructor Details

    • InteractBlockEmptyHandEvent

      public InteractBlockEmptyHandEvent(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.level.Level level, net.minecraft.world.InteractionHand hand, net.minecraft.world.phys.BlockHitResult hit)
  • Method Details

    • getPlayer

      public net.minecraft.server.level.ServerPlayer getPlayer()
    • getLevel

      public net.minecraft.world.level.Level getLevel()
    • getHand

      public net.minecraft.world.InteractionHand getHand()
    • getHit

      public net.minecraft.world.phys.BlockHitResult getHit()
    • getCancellationResult

      public net.minecraft.world.InteractionResult getCancellationResult()
    • setCancellationResult

      public void setCancellationResult(net.minecraft.world.InteractionResult cancellationResult)