RFTools

RFTools

74M Downloads

onPlayerInteractEvent should not be cancelling event during sneaking

bloodmc opened this issue ยท 1 comments

commented

https://github.com/McJty/RFTools/blob/1.11/src/main/java/mcjty/rftools/ForgeEventHandlers.java#L102-L120

As discussed on IRC, cancelling the PlayerInteractEvent.RightClickBlock to avoid item activation is violating the event contract. The proper way to prevent a player from using the item in hand is to simply use the following code in your event handler

event.setItemResult(Result.DENY)

Javadocs explain it here
https://github.com/MinecraftForge/MinecraftForge/blob/1.11.x/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java#L189

Once this fix is added, SpongeForge should work properly with RFTools latest builds.

commented

Implemented next version