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

Is this part still being developed? As I see the comment

 

//TODO: Hook interact event here...

 

in NetHandlerPlayServer#processPlayerBlockPlacement.

 

Was needing it, onItemUseFirst, for a mod I wanted to modify to be able to work with 1.9 when I came across the comment. So wasn't sure if there was a change of events or if it just hadn't been implemented yet.

 

 

may the forge version ?

 

i make some test coz also am updating items from 1.8 and has some trouble replacing the item

 

and test

[09:02:08] [Client thread/INFO] [sTDOUT]: [mercenarymod.items.materiales.materialesHierroAlrojo:onItemUse:67]: 
onItemUse hand=OFF_HAND mundo=true
[09:02:08] [server thread/INFO] [sTDOUT]: [mercenarymod.items.materiales.materialesHierroAlrojo:onItemUse:67]:
onItemUse hand=OFF_HAND mundo=false
[09:02:12] [Client thread/INFO] [sTDOUT]: [mercenarymod.items.materiales.materialesHierroAlrojo:onItemUse:67]:
onItemUse hand=MAIN_HAND mundo=true
[09:02:12] [server thread/INFO] [sTDOUT]: [mercenarymod.items.materiales.materialesHierroAlrojo:onItemUse:67]: 
onItemUse hand=MAIN_HAND mundo=false

 

 

   @Override
    public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
    {
	//chat.chatm(playerIn, "onItemUse hand="+hand+" mundo="+worldIn.isRemote);
	System.out.println("onItemUse hand="+hand+" mundo="+worldIn.isRemote);
        return EnumActionResult.PASS;
    }

 

 

or may you still use the method as declared in 1.8,

  • Author

Using the latest forge: 12.16.0.1802.

 

While onItemUse is called on both sides, I need onItemUseFirst as it is called before the block being right clicked is activated, allowing me to prevent any action it might initiate.

mi error

 

now i second it

 

[11:37:35] [main/INFO] [FML]: Forge Mod Loader version 12.16.0.1802 for Minecraft 1.9 loading

[11:37:35] [main/INFO] [FML]: Java is Java HotSpot 64-Bit Server VM, version 1.8.0_65, running on Linux:amd64:3.16.0-4-amd64, installed at /opt/jdk1.8.0_65/jre

 

[11:40:20] [Client thread/INFO] [sTDOUT]: [mercenarymod.items.materiales.materialesHierroAlrojo:onItemUseFirst:71]: onItemUseFirst hand=OFF_HAND mundo=true
[11:40:22] [Client thread/INFO] [sTDOUT]: [mercenarymod.items.materiales.materialesHierroAlrojo:onItemUseFirst:71]: onItemUseFirst hand=OFF_HAND mundo=true
[11:40:25] [Client thread/INFO] [sTDOUT]: [mercenarymod.items.materiales.materialesHierroAlrojo:onItemUseFirst:71]: onItemUseFirst hand=MAIN_HAND mundo=true
[11:40:26] [Client thread/INFO] [sTDOUT]: [mercenarymod.items.materiales.materialesHierroAlrojo:onItemUseFirst:71]: onItemUseFirst hand=MAIN_HAND mundo=true

 

forge

 

it only works local side

We are actually debating on removing onFirstUse as the new mechanics in place make it redundant and the common practice being SHIFT click being the same effect as onFirstUse.

I'd like to see your argumetns for keeping it so that we can be better informed of how the community is using this hook and better decide if it's needed anymore of not.

 

On the other side of that, Interact events are being re-worked as the entire interaction system changed in 1.9.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

  • Author

The only argument I can think of is that since onItemUseFirst is called before the block's onRightClick, or whatever the actual event name is, I can return EnumActionResult.SUCCESS and the block's event will not be triggered. Not sure if the new mechanics you mention can do this, if so could you point me in the direction of them?

 

The only reason for wanting to prevent the block's event is in the case of mods like StorageDrawers. The item will get stored on normal right click, and I was wanting to prevent storing of the item all together in those types of mod.

Then sneak click and have your item return true for 'doesSneakBypassBlock' or whatever the hook is named.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

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.