Jump to content

[1.13.2] How to check right click on the block by item in mainhand?


Recommended Posts

Posted

To get the block activation from the block side (as opposed to the item side), for example if you're making a new block, then use onBlockActivated. See here.

 

If you want to do it from the item side, use onItemRightClick. To get the block you're looking at you can use the client's (Minecraft.getInstance()) objectMouseOver field. If that doesn't have the block, you might have to get another field from objectMouseOver, probably a RayTraceResult (if I recall correctly). If you take this route you'll probably have to send the result from the client to the server using packets.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.