Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.3] Remove then add another item to inventory


ehbean
 Share

Recommended Posts

I can't seem to find anything about this on the form for 1.16.3 nor can I find anything about it on the documentation. I've got an item once the player uses I need to behave in a similar way to potions, where once its used it is removed from the inventory, then gives you an empty glass bottle for that item. How would I go about doing that?

 

Thank you

 

I was able to find a solution a few days ago. Figured I should update that here.

Edited by ehbean
Link to comment
Share on other sites

9 hours ago, diesieben07 said:

If it needs to work like a potion, have you tried looking at how potions work? :D

I've looked around for something like that, but I've not been able to find anything that would work like that. Where would I find something like that?

Edited by ehbean
typo
Link to comment
Share on other sites

14 minutes ago, Beethoven92 said:

The code is pretty short and straightforward...What don't you understand of the code inside the PotionItem#onItemUseFinish method?

I see the method there, I just don't know who to have to item that is used back to the player as an empty version. It's not something in a glass bottle as potions are in vanilla. Is there some way to specify that after the use of the item it then takes the item that was used away, then gives its empty counterpart? Sorry if this is vauge.

Link to comment
Share on other sites

21 minutes ago, Beethoven92 said:

Well, you have to create an item for that empty counterpart then

I've done that. I've got an empty syringe, and a full syringe. I just don't know how to, after invoking the method, remove the full syringe and replace it with an empty syringe.

Link to comment
Share on other sites

1 hour ago, diesieben07 said:

I did. It's PotionItem#onItemUseFinish. It does exactly what you want to do (change item after its has been used).

onItemUseFinish's job is to change what item the player ends up with when the item is used. That's literally all it does.

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

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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.