Jump to content

[1.12.2] Create custom Ocean Biome


Meldexun

Recommended Posts

I have created a new Biome and now I want to make it spawn with a ocean biome around it. Or at least next to my biome should be a ocean biome.

So this is what I'm doing when registering my biome:

	@SubscribeEvent
	public static void registerBiome(RegistryEvent.Register<Biome> event) {
		event.getRegistry().register(kelpForest);
		BiomeDictionary.addTypes(kelpForest, Type.OCEAN);
		BiomeManager.addBiome(BiomeType.WARM, new BiomeEntry(kelpForest, 20));
		BiomeManager.addSpawnBiome(kelpForest);
	}

But it seems that it just randomly spawns.

Edited by Meldexun
Link to comment
Share on other sites

Ok i found out that minecraft spawns Biome Types (Warm, Cold, Icy or Desert).

So with this when minecraft is spawning a Warm biome my biome has a chance to be generated.

BiomeManager.addBiome(BiomeType.WARM, new BiomeEntry(kelpForest, 20));

But there is no Biome Type Ocean. Does nobody know how I can register and generate it as a Ocean biome?

Link to comment
Share on other sites

Here's how the deep ocean (an ocean sub-biome) gets registered:
 

registerBiome(24, "deep_ocean", new BiomeOcean((new Biome.BiomeProperties("Deep Ocean")).setBaseHeight(-1.8F).setHeightVariation(0.1F)));

 

I actually haven't done anything with biomes so far, but I'm pretty sure you can apply part of this.  If I had to guess, I'd say any height less than 0 is underwater.

Link to comment
Share on other sites

2 minutes ago, Laike_Endaril said:

Here's how the deep ocean (an ocean sub-biome) gets registered:
 


registerBiome(24, "deep_ocean", new BiomeOcean((new Biome.BiomeProperties("Deep Ocean")).setBaseHeight(-1.8F).setHeightVariation(0.1F)));

 

I actually haven't done anything with biomes so far, but I'm pretty sure you can apply part of this.  If I had to guess, I'd say any height less than 0 is underwater.

I'm registering my biome correctly. So it is spawning as a ocean biome with water and so on. But Minecraft generates Biome Types (warm,...) and if i use this:

BiomeManager.addBiome(BiomeType.WARM, new BiomeEntry(kelpForest, 20));

When a warm biome type generates my biome has a chance to appear. But I want my biome to spawn when a ocean biome is generated and not when a warm biome is generated.

Link to comment
Share on other sites

Just now, Laike_Endaril said:

Does your biome class extend BiomeOcean?  Does your biome set its height?

You should post your class code and the code where you declare/initialize the field "kelpForest" so ppl can get a better idea of what may be wrong.

Ok. I will post my code tomorrow. It's to late for me now.

Link to comment
Share on other sites

19 hours ago, Laike_Endaril said:

Does your biome class extend BiomeOcean?  Does your biome set its height?

You should post your class code and the code where you declare/initialize the field "kelpForest" so ppl can get a better idea of what may be wrong.

So here are my full classes.

@EventBusSubscriber
public class InitBiome {

	public static Biome kelpForest;
	
	@SubscribeEvent
	public static void registerBiome(RegistryEvent.Register<Biome> event) {
		kelpForest = new KelpForest().setRegistryName(BetterDiving.modid, "Kelp Forest");
		event.getRegistry().register(kelpForest);
		BiomeDictionary.addTypes(kelpForest, Type.OCEAN, Type.WATER);
		BiomeManager.addBiome(BiomeType.WARM, new BiomeEntry(kelpForest, 10));
	}

}

 

And my Biome class

public class KelpForest extends Biome {

	public KelpForest() {
		super(new BiomeProperties("Kelp Forest").setBaseHeight(-1.5f).setHeightVariation(0.05f).setWaterColor(8257405).setBaseBiome("ocean"));
		this.spawnableCreatureList.clear();
		
		topBlock = Blocks.SAND.getStateFromMeta(0);
		fillerBlock = Blocks.SAND.getStateFromMeta(0);
		
		this.decorator.clayGen = null;
		this.decorator.sandGen = null;
		this.decorator.gravelGen = null;
		this.decorator.dirtGen = null;
		this.decorator.gravelOreGen = null;
		this.decorator.graniteGen = null;
		this.decorator.dioriteGen = null;
		this.decorator.andesiteGen = null;
		this.decorator.flowerGen = null;
		this.decorator.mushroomBrownGen = null;
		this.decorator.mushroomRedGen = null;
		this.decorator.bigMushroomGen = null;
		this.decorator.reedGen = null;
		this.decorator.cactusGen = null;
		this.decorator.waterlilyGen = null;
		this.decorator.waterlilyPerChunk = 0;
		this.decorator.treesPerChunk = 0;
		this.decorator.extraTreeChance = 0;
		this.decorator.flowersPerChunk = 0;
		this.decorator.grassPerChunk = 0;
		this.decorator.deadBushPerChunk = 0;
		this.decorator.mushroomsPerChunk = 0;
		this.decorator.reedsPerChunk = 0;
		this.decorator.cactiPerChunk = 0;
		this.decorator.gravelPatchesPerChunk = 0;
		this.decorator.sandPatchesPerChunk = 0;
		this.decorator.clayPerChunk = 0;
		this.decorator.bigMushroomsPerChunk = 0;
		this.decorator.generateFalls = false;
		
	}

	@Override
	public Biome.TempCategory getTempCategory() {
		return Biome.TempCategory.OCEAN;
	}
	
	@Override
	public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) {
		return new DecoratorKelpForest();
	}
}

 

Link to comment
Share on other sites

It may not be extending OceanBiome directly, but the only reason I mentioned that was for getTempCategory(), which you're already overriding with the same return, so I don't think that's the issue (unless MC is checking class inheritance for biomes somewhere, but I doubt it).


I'll try tinkering with it a bit and see if I learn anything.

Link to comment
Share on other sites

Unfortunately I have had no luck.  I've been using the Nature's Compass mod to help debug, and by default I get the same behavior you do.

 

If I add the kelp forest biome to BiomeManage.oceanBiomes then it does not generate at all afaik.  I feel like this step is necessary but something is missing; probably something difficult to figure out.

 

I don't think I can be of much help here, but if you can do this using structure gen instead of biome gen, you may want to look into that approach as it may be more workable (after all, structures generate inside specified biomes; you could use the ocean monument as reference if you did it this way)

Link to comment
Share on other sites

Hey, could you post your kelp decorator please? I've been seeing the modded decorator for awhile and not been sure how to correctly implement one, as well as not really seen anyone show how to correctly use it and would love to get an idea!

Also i've been looking into Sub-Biomes and ocean biomes too because my mod that i'm updating has a coral reef biome, i'd love to have as a sub biome instead of a random biome that spawns in general! So if you get it working i'd love to know and i'll do likewise for you! :)

Link to comment
Share on other sites

3 hours ago, Zathrox said:

Hey, could you post your kelp decorator please? I've been seeing the modded decorator for awhile and not been sure how to correctly implement one, as well as not really seen anyone show how to correctly use it and would love to get an idea!

Also i've been looking into Sub-Biomes and ocean biomes too because my mod that i'm updating has a coral reef biome, i'd love to have as a sub biome instead of a random biome that spawns in general! So if you get it working i'd love to know and i'll do likewise for you! :)

I'm sorry but I lost some files. So I can't send you any example.

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.