Jump to content

(solved)Damage item in an event[1.10]


void6425

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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