Posted March 17, 20187 yr I'm pretty new to Minecraft Modding, but I've been doing well so far (I've got blocks, items, creative tabs, foods, recipes, down pat). I'm at the stage where I want to start doing some more advanced stuff, starting with a custom tool. My question is: How can I make a tool (called whatever, let's say a sickle), that upon breaking grass, increases the chance of seeds dropping. Edited March 17, 20187 yr by intipablo
March 17, 20187 yr Add this to your class that has @Mod.EventBusSubscriber @SubscribeEvent public static void onHarvest(BlockEvent.HarvestDropsEvent event) { if (event.getHarvester() != null) { List<ItemStack> drops = event.getDrops(); if(drops!=null && drops.size()>0) { BlockPos pos = event.getPos(); IBlockState blockstate = event.getWorld().getBlockState(pos); Block block = blockstate.getBlock(); if(block instanceof BlockGrass) { drops.add(new ItemStack(Item.REGISTRY.getObject(new ResourceLocation("minecraft", "wheat_seeds")))); } } } } About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
March 18, 20187 yr Author 14 hours ago, diesieben07 said: Please don't just vomit code into your post saying "just copy this". This helps nobody, especially someone who explicitly said they are new to modding. Also, your code is terrible. @intipablo Read the documentation on events. Then you can use HarvestDropsEvent to change the drops of a block. Thanks for the help. Much appreciated!
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.