Tameet Posted May 30, 2019 Posted May 30, 2019 (edited) I want to change grass drops, but i'm absolutely noob in minecraft modding. I can just create new custom items using different tutorials. How i can do it? Edited May 31, 2019 by Tameet Quote
V0idWa1k3r Posted May 30, 2019 Posted May 30, 2019 Subscribe to a HarvestDropsEvent, then add/remove the drops from the drops list provided to you by HarvestDropsEvent#getDrops. Quote
Tameet Posted May 30, 2019 Author Posted May 30, 2019 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) Quote
Tameet Posted May 31, 2019 Author Posted May 31, 2019 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)); } } Quote
Tameet Posted May 31, 2019 Author Posted May 31, 2019 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)); } } Quote
Recommended Posts
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.