Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello, I would like to know where in the code of the minecraft is that when you use an item so I can override to use in a custom item, I was looking on the treatment of user input of the game http://greyminecraftcoder.blogspot.com.au/2013/10/user-input.html, however is not quite exactly what I want to do (I do not want to detect when the user clicks the right mouse button but when it activates an item, because that must be considered configuration command 'use item' can be changed to another type of input type a key keyboard).

Appreciate everyone's attention for any clarification.

Hi

 

Although the Minecraft.clickMouse(button) says "left and right buttons", exactly the same code is called for keyboard keys which have been mapped to the attack or use actions.  In fact, if the right mouse button is clicked, it is converted to a "keyboard press" as the very first thing.

 

For "eating" an item (or blocking a sword or similar) you might be interested in PlayerControllerMP.sendUseItem and Item.useItemRightClick

 

For right clicks on blocks

ForgeEventFactory.onPlayerInteract(RIGHT_CLICK_BLOCK)

or

Item.onItemFirstUse

or

Item.tryPlaceItemIntoWorld

 

For right clicks on air

ForgeEventFactory.onPlayerInteract(RIGHT_CLICK_AIR)

 

You can see all these options and how they are called from Minecraft.clickMouse.

 

-TGG

  • Author

I was confusing a class that believed it was represented that the items in the game, such net.minecraft.entity.item.Entityitem, had not noticed that there is a class net.minecraft.item.Item.

Noting she noticed the existence of the method Item.onItemUse (), I believe that is exactly what I was looking for, I will perform some tests to find out if I can use it for what I plan.

ty for replys = b

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.