Jump to content

Overriding Vanilla Structure Generation


arkangyl

Recommended Posts

I've tried to figure this out on my own, but I'm stuck. No tutorials really exist on Forge's terrain generation capabilities.  :-\

 

I'm currently working on a mod that is based around changing the way Villages generate. I know mods like Millenaire currently do this, so I'm guessing it's possible. I see the TerrainGen getModdedMapGen() hook, but I'm not getting how to make use of it. Do I have to make my own MapGenerator from scratch? I don't need to change everything about how the overworld generates. How would I tell the TerrainGen code to use my MapGen, anyway?

 

My ultimate goal: I do not want Vanilla Villages spawning at all, but rather, my own improved Villages. They will have modified conditions for spawning, as well. Aside from that, no changes need to be made to the Vanilla generation. How would I best go about accomplishing this, preferably without making base class edits?

 

 

Link to comment
Share on other sites

easiest way is to declare a new worldtype in post init you can also override default, when you declare the worldtype you link to a custom worldtype.class where you can specify a custom ChunkProviderGenerate which is the file you want to look at for most generation

 

	@PostInit
public void postinitConfig(FMLPostInitializationEvent fmlpostinitializationevent)
{
	WorldType DEFAULT = new WorldTypeCustom(0, "Default");	

}

 

then have WorldTypeCustom extend WorldType and add this

 

  @Override
    public IChunkProvider getChunkGenerator(World world, String generatorOptions)
    {
        return (this == FLAT ? new ChunkProviderFlat(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions) : new ChunkProviderCustom(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled()));
    }
  

 

Copy the vanilla ChunkProviderGenerate into new classs ChunkProviderCustom and start tweaking

Link to comment
Share on other sites

That may work to accomplish what I want to do, but wouldn't that potentially cause problems with other mods that change parts of terrain gen? There may be something behind the scenes that would fix that, but if so, I'm not seeing it. I'd like this mod to be as compatible with other mods as possible. I realize it won't be compatible with mods like Millenaire for obvious reasons, but I'd like it to work with RedPower or Thaumcraft. Mods that do their own world gen, but not Village generation.

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