TheCrudNation Posted May 12, 2020 Posted May 12, 2020 I'm trying to add an item to be dropped by grass. How would I go about this? 1.14 Quote
Ugdhar Posted May 12, 2020 Posted May 12, 2020 Sounds like you probably want global loot modifiers https://github.com/MinecraftForge/MinecraftForge/blob/1.14.x/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java Quote
TheCrudNation Posted May 12, 2020 Author Posted May 12, 2020 That seems overly complicated just to make an already existing block drop a second item. Quote
TheCrudNation Posted May 12, 2020 Author Posted May 12, 2020 I found something on another post from Forge 1.11.2 @SubscribeEvent public void yourPlayerHarvestEvent(HarvestDropsEvent event) { if (event.getHarvester() != null) { if (event.getState() == Blocks.QUARTZ_ORE.getDefaultState()) { event.setDropChance(0.1f); event.getDrops().add(new ItemStack(ItemRegistry.herkimer_diamond, 1)); } } } Has it really changed that much in so little versions or is there a simpler way of doing it? Quote
Draco18s Posted May 12, 2020 Posted May 12, 2020 (edited) Just now, TheCrudNation said: HarvestDropsEvent event Doesn't exist any more. Has been replaced by Global Loot Modifiers If you don't want to use them then do it this way: https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderfarming/EventHandlers.java#L49-L53 https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/resources/data/harderfarming/loot_tables/blocks/grass.json Edited May 12, 2020 by Draco18s Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
TheCrudNation Posted May 12, 2020 Author Posted May 12, 2020 I'm quite new to java, how does one make sure the event is fired? I created a class called EventHandler inside of my handlers package and it contains literally just this. @EventBusSubscriber public class EventHandler { } so anything I put in here will be fired? Quote
Ugdhar Posted May 12, 2020 Posted May 12, 2020 More or less. Info on events here: https://mcforge.readthedocs.io/en/latest/events/intro/ Quote
TheCrudNation Posted May 12, 2020 Author Posted May 12, 2020 So I don't need to reference my EventHandler class anywhere else? Quote
Ugdhar Posted May 12, 2020 Posted May 12, 2020 1 minute ago, TheCrudNation said: So I don't need to reference my EventHandler class anywhere else? As long as it's got the EventBusSubscriber annotation and the event handler methods are static, and have the SubscribeEvent annotation, you should be good to go. Quote
Draco18s Posted May 13, 2020 Posted May 13, 2020 6 hours ago, diesieben07 said: Can you stop recommending this crappy way to people? Sure can. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.