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

Can anyone tell me which of the following is best for an item on the creation of it?

For example, if I want a method to call when my custom item is dropped from a block break.

 

Will either Overridden onEntityItemUpdate or onUpdate be called while the item is in a vanilla chest?

For example, I'd like to have items lose durability while in a chest.

 

Unless I'm doing something wrong or read the documentation wrong, onCreated is being called when the item spawns from a block break, like mining an ore.

 

Thanks in advance

Items as objects in any inventory won't get any updates. For that you'd need custom tileEntity container (which chest is not) that will scan and update items for you.

 

The only inventory that updates items per-tick is player's Item#onUpdate() is called always when item is inside player's inventory.

 

Item#onCreated is called when you create item in crafting process (and only), so pulling it out of e.g creative inventory won't call it.

 

To execute some code on block break you can use: HarvestDropsEvent

 

Share what you want to do, and we will help in better manner.

1.7.10 is no longer supported by forge, you are on your own.

  • Author

Will do Enio and thanks.

 

I'm trying to write the pseudo code first before I jump straight into it and just needed to make sure I can do what I want.

 

Thanks! I'll post here when I have something in code.

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.