Jump to content

[1.8] onEntityItemUpdate or onUpdate Question


Ryat

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.