Jump to content

[1.6.4] Tool drop a different item from common block?


Recommended Posts

Posted

Lets say i have a pickaxe i am making, and i would like it to drop a diamond block when mined cobblestone, or an axe drop charcoal when mined logs. Is there some sort of event on harvested, or would i override the block method dropped? Thankyou!

 

Also i am new to the McForge forums, so if i posted in the wrong place or diddnt title it correctly, please kindly let me know!

Posted

You can use the HarvestDropsEvent to change drops:

@SubscribeEvent
public void onBlockHarvest(HarvestDropsEvent event) {
event.block // the block broken
event.drops // the list of itemstacks that may drop; event.drops.clear() will remove all the items in there already
event.harvester // the player, may be null so check for that as well as if the held item is correct
}

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.

×
×
  • Create New...

Important Information

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