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

IIRC, onRightClick is only run client side. In order to damage an item, you need to do it server side. Ergo packets.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

In 1.8 and earlier, interacting with a block via right-click fired an event on both sides, so you should be okay unless it's changed as Draco suggests it may have.

 

In either case, you want to only change inventory items on the server, so removing a 'sugar,' adding a 'swift_item', and damaging a stack (which I don't see you trying to do anywhere?) need to all happen when the world object is NOT remote.

 

ItemStack should have a method e.g. #damageItem that is used to increment the amount of damage done on the stack:

ItemStack stack = whateverStackYouWantToDamage;
stack.damageItem(1, player); // this is pre-1.8.9 code; may have changed

IIRC, onRightClick is only run client side. In order to damage an item, you need to do it server side. Ergo packets.

 

You're thinking of right-clicking air. Right clicking items/blocks definitely occurs on both client and server.

  • Author

so this

 

ItemStack stack = new ItemStack(BetterItems.TOME);

stack.damageItem(1, event.getEntityLiving());

 

Should work? Cause it does not work

  • Author

Ok im probably just being really dense here butt can you show me in code?

  • Author

Wow im so stupid sorry. I want the BetterItems.Tome that is already in your inventory to take 1 point of damage.

  • Author

Ok so i know what that means but how would i implement something like that?

  • Author

Ok but since i am new do you think you could show me In code? Or send me a link to a mod that does something like this do i can see it there

  • Author

You know what im gonna close this. I know java i wish people could be actually helpful instead of always just questioning if they know java.

Guest
This topic is now closed to further replies.

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.