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.

[1.15.2] How to spawn a dropped item?

Featured Replies

Posted

I want to be able to spawn an item as a drop,

I think I need to use this.world.addEntity(); but I don't know how to get my item as an entity.

 

Thanks for your help!

  • Author
4 minutes ago, diesieben07 said:

Please use loot tables for drops.

 

Item entities use the ItemEntity class.

Thank you for your reply.

 

I want a thrown Item to have a chance to drop itself when it hits the ground, would I still use Loot Tables for this?

  • Author
26 minutes ago, diesieben07 said:

Thats not really a "drop", so no.

Thank you, how would I use ItemEntity to get my specific item?

Scan vanilla code for something to drops an item. You should try looking a little more in the vanilla code, it's really useful and has lots of stuff to learn from/give ideas, I notice that you ask a lot of things without trying/looking first. You'd be surprised what you can accomplish if you check out existing code that does things similar to what you want :)

 

I did a quick search in my IDE for something that calls ItemEntity and the LecternBlock popped up.

  • Author
21 minutes ago, Ugdhar said:

Scan vanilla code for something to drops an item. You should try looking a little more in the vanilla code, it's really useful and has lots of stuff to learn from/give ideas, I notice that you ask a lot of things without trying/looking first. You'd be surprised what you can accomplish if you check out existing code that does things similar to what you want :)

 

I did a quick search in my IDE for something that calls ItemEntity and the LecternBlock popped up.

Thanks for the advice!

I feel bad for taking up all the team's time with basic questions so I'll start looking into the code myself,

 

Thanks for all your help :)

6 minutes ago, ultra_reemun said:

Thanks for the advice!

I feel bad for taking up all the team's time with basic questions so I'll start looking into the code myself,

 

Thanks for all your help :)

No problem, and don't think if you get stuck you can't come ask for help, because of course you can! But dig through some vanilla code first, see if you can find examples, also searching the forums often yields great results. I was messing with custom shields for fun, and couldn't figure out why the texture wasn't working, and searching on here led me to the answer without having to make my own topic and ask :)

  • Author
6 minutes ago, Ugdhar said:

No problem, and don't think if you get stuck you can't come ask for help, because of course you can! But dig through some vanilla code first, see if you can find examples, also searching the forums often yields great results. I was messing with custom shields for fun, and couldn't figure out why the texture wasn't working, and searching on here led me to the answer without having to make my own topic and ask :)

Thank you,

You've been very helpful with all my enquiries :)

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.