Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.14.4] Event not getting registered
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
cinsiian

[1.14.4] Event not getting registered

By cinsiian, October 19 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

cinsiian    1

cinsiian

cinsiian    1

  • Creeper Killer
  • cinsiian
  • Members
  • 1
  • 110 posts
Posted October 19
@EventBusSubscriber
public class Handler 
{
	@SubscribeEvent()
	public static void drop(HarvestDropsEvent event)
	{
		Block block = event.getState().getBlock();
		Random rand = new Random();
		
		if(block instanceof TallGrassBlock && !event.isSilkTouching())
		{
			int gen = 1 + rand.nextInt(100);
			int extra = 1 + rand.nextInt(50);
			if(gen < 51) {event.getDrops().add(new ItemStack(Items.PLANT_FIBER));}
			if(extra < 14) {event.getDrops().add(new ItemStack(Items.PLANT_FIBER));}
		}
		
		if((block == Blocks.GRASS || block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL || block == Blocks.MYCELIUM) && !event.isSilkTouching())
		{
			int gen = 1 + rand.nextInt(100);
			int extra = 1 + rand.nextInt(50);
			if(gen < 21) {event.getDrops().add(new ItemStack(Items.PLANT_FIBER));}
			if(extra < 14) {event.getDrops().add(new ItemStack(Items.PLANT_FIBER));}
		}
	}
}

Okay basically this event is not getting registered, whats the problem?

  • Quote

Share this post


Link to post
Share on other sites

cinsiian    1

cinsiian

cinsiian    1

  • Creeper Killer
  • cinsiian
  • Members
  • 1
  • 110 posts
Posted October 19

Do I have to register it via MinecraftForge.EVENT_BUS ?

  • Quote

Share this post


Link to post
Share on other sites

JimiIT92    19

JimiIT92

JimiIT92    19

  • Dragon Slayer
  • JimiIT92
  • Members
  • 19
  • 723 posts
Posted October 19

Look strange, the code for handling the event seems ok, it could be a bug with the latest mdk version

  • Quote

Share this post


Link to post
Share on other sites

cinsiian    1

cinsiian

cinsiian    1

  • Creeper Killer
  • cinsiian
  • Members
  • 1
  • 110 posts
Posted October 19

I am using the version 28.1.10

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2090

Draco18s

Draco18s    2090

  • Reality Controller
  • Draco18s
  • Members
  • 2090
  • 14005 posts
Posted October 19
5 hours ago, cinsiian said:

HarvestDropsEvent

That event does not exist on 1.14.

Well, the class does, but it isn't fired. 

https://github.com/MinecraftForge/MinecraftForge/pull/5871

  • Quote

Share this post


Link to post
Share on other sites

cinsiian    1

cinsiian

cinsiian    1

  • Creeper Killer
  • cinsiian
  • Members
  • 1
  • 110 posts
Posted October 20
20 hours ago, Draco18s said:

https://github.com/MinecraftForge/MinecraftForge/pull/5871

I cannot find any of these events in my forge

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2090

Draco18s

Draco18s    2090

  • Reality Controller
  • Draco18s
  • Members
  • 2090
  • 14005 posts
Posted October 20
8 minutes ago, cinsiian said:

I cannot find any of these events in my forge

No shit, Sherlock, that pull request is still open. The entire reason I linked it is because the problem you're having is because that event does not exist and there's why.

  • Quote

Share this post


Link to post
Share on other sites

cinsiian    1

cinsiian

cinsiian    1

  • Creeper Killer
  • cinsiian
  • Members
  • 1
  • 110 posts
Posted October 20

oh

  • Quote

Share this post


Link to post
Share on other sites

cinsiian    1

cinsiian

cinsiian    1

  • Creeper Killer
  • cinsiian
  • Members
  • 1
  • 110 posts
Posted October 20

So at the moment there is not an event similiar to HarvestDropsEvent?

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2090

Draco18s

Draco18s    2090

  • Reality Controller
  • Draco18s
  • Members
  • 2090
  • 14005 posts
Posted October 20

No, because it bypasses the loot table system.

That's why that PR exists and isn't merged, see Lex's comment.

  • Quote

Share this post


Link to post
Share on other sites

cinsiian    1

cinsiian

cinsiian    1

  • Creeper Killer
  • cinsiian
  • Members
  • 1
  • 110 posts
Posted October 21

Is it possible to replace the loottable file replacing it in data/minecraft/loot_tables?

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2090

Draco18s

Draco18s    2090

  • Reality Controller
  • Draco18s
  • Members
  • 2090
  • 14005 posts
Posted October 21

Yes, but keep in mind that replacement is "whichever mod loads last."

  • Quote

Share this post


Link to post
Share on other sites

cinsiian    1

cinsiian

cinsiian    1

  • Creeper Killer
  • cinsiian
  • Members
  • 1
  • 110 posts
Posted October 21

Okay, I will do that for now. In the future if they will add the events i will use them.

  • Quote

Share this post


Link to post
Share on other sites

cinsiian    1

cinsiian

cinsiian    1

  • Creeper Killer
  • cinsiian
  • Members
  • 1
  • 110 posts
Posted October 21

otherwise does a MinecraftForge.addGrassSeed void exists in 1.14.4?

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2090

Draco18s

Draco18s    2090

  • Reality Controller
  • Draco18s
  • Members
  • 2090
  • 14005 posts
Posted October 21 (edited)

No. Use loot tables.

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderfarming/EventHandlers.java#L52

Edited October 21 by Draco18s
  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • plugsmustard
      on/off button for custom furnace

      By plugsmustard · Posted 10 minutes ago

    • anothertime
      1.14 - hot swap fails in IDEA

      By anothertime · Posted 11 minutes ago

      I usually rebuild the module with build\build module but I've also tried run\reload changes after looking for a solution on the web but the result is the same
    • DaemonUmbra
      1.14 - hot swap fails in IDEA

      By DaemonUmbra · Posted 13 minutes ago

      Are you running the build manually with a gradle task or are you clicking run -> reload changed classes?
    • Draco18s
      on/off button for custom furnace

      By Draco18s · Posted 13 minutes ago

      You linked to a specific commit, so when I looked at it, it was the old commit where it wasn't changed. As far as I can tell, it should work. Can you post a screenshot of the error?   As for what you put here, you put the code that does whatever you want the button to do.
    • anothertime
      1.14 - hot swap fails in IDEA

      By anothertime · Posted 15 minutes ago

      Changes to the body of an existing method
  • Topics

    • plugsmustard
      55
      on/off button for custom furnace

      By plugsmustard
      Started Wednesday at 03:11 PM

    • anothertime
      4
      1.14 - hot swap fails in IDEA

      By anothertime
      Started 9 hours ago

    • matt1999rd
      4
      [1.14-newer] how to keep value when closing minecraft

      By matt1999rd
      Started 2 hours ago

    • matt1999rd
      15
      [1.14-newer] deprecated method onBlockActivated

      By matt1999rd
      Started November 1

    • JetCobblestone
      9
      [1.14] moving item assignment to a separate function

      By JetCobblestone
      Started 2 hours ago

  • Who's Online (See full list)

    • LTNightshade
    • anothertime
    • plugsmustard
    • loordgek
    • kuririn
    • diesieben07
    • Lea9ue
    • Nuparu00
    • Cerandior
    • Ommina
    • Simon_kungen
    • CactusCoffee
    • DaemonUmbra
    • Iterator
    • matt1999rd
    • vaartis
    • DragonITA
    • Draco18s
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.14.4] Event not getting registered
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community