Jump to content

Recommended Posts

Posted

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?

Posted (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 by Draco18s

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.

Posted

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?

Posted
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.

Posted
6 hours ago, diesieben07 said:

Can you stop recommending this crappy way to people?

Sure can.

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.

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.