Jump to content

[Solved] [1.13.2] How to modify vanilla blocks drops?


Tameet

Recommended Posts

4 hours ago, V0idWa1k3r said:

Subscribe to a HarvestDropsEvent, then add/remove the drops from the drops list provided to you by HarvestDropsEvent#getDrops.

Should i type HarvesDropsEvent#getDrops into void HarvestDropsEvent event? (Sorry if i look like a stupid noob)

Link to comment
Share on other sites

20 hours ago, diesieben07 said:

No idea what this is supposed to mean. It highly suggests you lack the necessary basic Java knowledge required for modding.

i did it, but i don't know how to change the drop chance
 

@SubscribeEvent
	public void HarvestDropsEvent(HarvestDropsEvent event) {
		if ((event.getState().getBlock() == Blocks.GRASS)) {
			event.getDrops().add(new ItemStack(ItemList.fiber, 1));
		}
	}

 

Link to comment
Share on other sites

4 minutes ago, diesieben07 said:

Use random numbers to add more or less of the drops.

It's working, thanks for help :)

@SubscribeEvent
	public void HarvestDropsEvent(HarvestDropsEvent event) {
		if ((event.getState().getBlock() == Blocks.GRASS && event.getWorld().getRandom().nextInt(2) == 0)) {
			event.getDrops().add(new ItemStack(ItemList.fiber, 1));
		}
	}

 

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.