Class InteractBlockEmptyHandEvent

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

public class InteractBlockEmptyHandEvent extends net.neoforged.bus.api.Event implements net.neoforged.bus.api.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 getCancellationResult() 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 Summary

    Constructors
    Constructor
    Description
    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 Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.InteractionResult
     
    net.minecraft.world.InteractionHand
     
    net.minecraft.world.phys.BlockHitResult
     
    net.minecraft.world.level.Level
     
    net.minecraft.server.level.ServerPlayer
     
    void
    setCancellationResult(net.minecraft.world.InteractionResult cancellationResult)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.neoforged.bus.api.ICancellableEvent

    isCanceled, setCanceled
  • 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)