Jump to content

[Solved]PopulateChunkEvent.Populate Never Fires In Overworld


Recommended Posts

Posted (edited)
@SubscribeEvent
    public void populate(PopulateChunkEvent.Populate event){
		System.out.println("hie");
	}
@Mod.EventHandler
	public void init(FMLInitializationEvent e)
	{
		 MinecraftForge.EVENT_BUS.register(this);
	}

What am I doing wrong I read the code in the chunk provider it occurs 100 times but, I do not see any output if I remove the .populate it then works but, I need it to only fire for the populate for spawners there is a dungeon right next to my spawn with the seed of 2 and it's not printing.

 

Ok this was solved by changeing the event buss to terrain

Edited by jredfox
Posted
19 minutes ago, jabelar said:

Event handler methods need to be static.

This is not true. This is only true if you register the class or use the annotation. If you register a class instance (such as jredfox has done) then making the methods static is wrong.

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
1 hour ago, jabelar said:

Maybe it's because I'm viewing this on the phone, but it is not clear what instance his "this" refers to. Jredfox can you post your whole code?

The class instance that the code is in. Which considering he is getting logging messages when using the PopulateChunkEvent super-class, that part's fine.

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 (edited)
5 hours ago, Draco18s said:

The class instance that the code is in. Which considering he is getting logging messages when using the PopulateChunkEvent super-class, that part's fine.

Then why does this method never fire the chunks fired several dozen dungeons If I revert to just pupulate it works but, populate populate what I actually need it's never firing 

 

is it in the wrong bus or is this a bug?

Edited by jredfox
Posted (edited)

Well it should be the terraingen bus that you register your handler too.

 

However, I just tried it out and you are right. I can get the PopulateChunkEvent to fire (a lot) but can't get the PopulateChunkEvent.Populate to fire at all -- I tested this simply by printing out a console statement in each case.

 

Weird. I think you can agree that the event is supposed to be fired according to the chunk generator code...

 

If I simply handle the PopulateChunkEvent and print out the event (toString) I get Pre and Post but no populate:

[20:07:43] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.TerrainGenEventHandler:onEvent:30]: Populate Eventnet.minecraftforge.event.terraingen.PopulateChunkEvent$Pre@70579ed5
[20:07:43] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.TerrainGenEventHandler:onEvent:30]: Populate Eventnet.minecraftforge.event.terraingen.PopulateChunkEvent$Post@3d9125df
[20:07:43] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.TerrainGenEventHandler:onEvent:30]: Populate Eventnet.minecraftforge.event.terraingen.PopulateChunkEvent$Pre@499013c9
[20:07:43] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.TerrainGenEventHandler:onEvent:30]: Populate Eventnet.minecraftforge.event.terraingen.PopulateChunkEvent$Post@7bb934e4
[20:07:43] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.TerrainGenEventHandler:onEvent:30]: Populate Eventnet.minecraftforge.event.terraingen.PopulateChunkEvent$Pre@37d4bc70
[20:07:43] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.TerrainGenEventHandler:onEvent:30]: Populate Eventnet.minecraftforge.event.terraingen.PopulateChunkEvent$Post@3dfd888
[20:07:43] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.TerrainGenEventHandler:onEvent:30]: Populate Eventnet.minecraftforge.event.terraingen.PopulateChunkEvent$Pre@4a989d61
[20:07:43] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.TerrainGenEventHandler:onEvent:30]: Populate Eventnet.minecraftforge.event.terraingen.PopulateChunkEvent$Post@78b48ec2
[20:07:43] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.TerrainGenEventHandler:onEvent:30]: Populate Eventnet.minecraftforge.event.terraingen.PopulateChunkEvent$Pre@6a119a98
[20:07:43] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.TerrainGenEventHandler:onEvent:30]: Populate Eventnet.minecraftforge.event.terraingen.PopulateChunkEvent$Post@177714ca

 

Edited by jabelar

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
4 minutes ago, jabelar said:

Well it should be the terraingen bus that you register your handler too.

 

However, I just tried it out and you are right. I can get the PopulateChunkEvent to fire (a lot) but can't get the PopulateChunkEvent.Populate to fire at all -- I tested this simply by printing out a console statement in each case.

 

Weird. I think you can agree that the event is supposed to be fired according to the chunk generator code...

What happens when you switched to terrain bus did it work?

Posted
3 minutes ago, jredfox said:

What happens when you switched to terrain bus did it work?

By the way I just edited above post to show my console output -- shows that pre and post events are getting handled, but not populate.

 

I just realized that Pre and Post are posted to the main event bus, but Populate is on terrain gen bus. Give me a second, but you can try too, I think that is the problem -- register on the terraingen bus.

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
4 minutes ago, jabelar said:

By the way I just edited above post to show my console output -- shows that pre and post events are getting handled, but not populate.

 

I just realized that Pre and Post are posted to the main event bus, but Populate is on terrain gen bus. Give me a second, but you can try too, I think that is the problem -- register on the terraingen bus.

 

I got this part working could you help me on the other forum again the wither skeletons are not spawner just blank spawners with that code

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.