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

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

  • Author
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

  • Author
4 hours ago, diesieben07 said:

Look at PotionItem#onItemUseFinish.

I still can't tell how to remove items from a players inventory on its use. Could you possibly show me an example?

  • Author
18 minutes ago, diesieben07 said:

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

I guess I'm not understanding something in there. 

  • Author
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.

  • Author
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.

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.

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.