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

If you return true to cancel a block's activation, it also prevents onItemUseFirst from running on the server entirely, you can reproduce this like this. Make a generic item and override onItemUseFirst, do a System.out.println(FMLCommonHandler.instance().getEffectiveSide()) then return true. It will only say client.

 

Do it again only returning false and it will return client and server, but then the blocks menu will activate.

 

Surely this is not intended, The server SHOULD cancel the activating block, but it shouldn't cancel the items onItemUseFirst as well(or maybe the client is prevented from sending the packet)...

 

I understand that System.out.println() could be reporting wrong, BUT I have other methods called from it, and those also do not run server side. When I call functions before returning true that should run both sides, it seems those are also only working client side, like playing sounds. When I call the exact same function from OnItemUse, the sounds work, but from OnItemUseFirst, they do not.

 

Edit: OH i see the problem, the function is triggered by theItemInWorldManager.activateBlockOrUseItem, and returning true prevents the server from going into any item use calls... God knows why OnItemUseFirst isn't simply ran on both server and client, and it can see for itself whether or not to activate the block... It's not a problem to force it to client side unless it is returning false from the method itself -_-

 

I solved it by just sending a packet and doing the server stuff from my packet handler.

Its working as intended, you need to undertstand that it compleetly prevents any further processing, which means the server doesnt event get told the user did anything if you cancel it on the client.

So, just work with it.

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.