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 there a reason EntityPlayer.getItemInUse() is flagged @SideOnly(Side.CLIENT) ?

 

Removing @SideOnly(Side.CLIENT) doesn't appear to cause any problems (very limited testing)

Testing on both the built-in LAN server and stand alone dedicated server (through Eclipse) returned the correct item every time.

 

If it has to stay client side only, does anyone know of a server side equivalent?

Why do you need to have getItemInUse? There may be an alternate solution.

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

  • Author

I'm checking if the item is a food, and stopping the player from eating.

 

 

EDIT:

Found a workaround  :)

 

Using PlayerInteractEvent, I check for right click events, get the current item, see if its a food, cancel the event accordingly.

It also solves the problem of the cake blocks avoiding my previous checks. stops the block from being used but players still get the food value.

Also think about this, what item would a server be holding???

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

  • Author

I was using the server side instance of the player (checking in LivingUpdateEvent)

but getItemInUse is locked to the client (even though unlocked it works on the server)

 

PlayerInteractEvent works better, it doesn't need getItemInUse and the check doesn't happen as often.

 

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.