Jump to content

Recommended Posts

Posted

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.

Posted

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

Posted

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.

Posted

so this

 

ItemStack stack = new ItemStack(BetterItems.TOME);

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

 

Should work? Cause it does not work

Posted

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

Posted

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.

  • Thanks 1
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.