
Use the dedicated gui and container events instead of PlayerInteractEvent.RightClickBlock
Daomephsta opened this issue ยท 2 comments
There are dedicated events for opening GUIs and Containers, net.minecraftforge.client.event.GuiOpenEvent & net.minecraftforge.event.entity.player.PlayerOpenContainerEvent respectively. Unless you have another reason for using PlayerInteractEvent.RightClickBlock, I recommend switching to them as they cover all GUIs and containers.
Good luck!
Oh, thanks, I'll be sure to check it out! I dug the code before and found the GuiOpenEvent, but I didn't know about PlayerOpenContainerEvent.
This should help making the project more versatile and compatible with other mods.
I finally found some time to do a few tests, after some hours of trial-and-error I found out that the "PlayerOpenContainerEvent" doesn't work.
You would imagine that it's an event fired when a player opens a container, but no, that event fires constantly and serves only to extend the "canInteractWith" check.
I'll try to find another solution tomorrow, after some rest.