So I have been trying to make a mod where I just put in random ideas I had. While making a biome I noticed that it just does not want to generate naturally! I do not know what is wrong with my code.
This is the code in CatIsland.java; This class is located in com.davide_24.uselessmod.world.biome
package com.davide_24.uselessmod.world.biome;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.DefaultBiomeFeatures;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;
public class CatIsland extends Biome
{
public CatIsland() {
super((new Biome.Builder()).surfaceBuilder(SurfaceBuilder.DEFAULT, SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG).precipitation(Biome.RainType.RAIN).category(Biome.Category.PLAINS).depth(0.125F).scale(0.05F).temperature(0.8F).downfall(0.4F).waterColor(4159204).waterFogColor(329011).parent((String)null));
DefaultBiomeFeatures.addLakes(this);
DefaultBiomeFeatures.addStoneVariants(this);
DefaultBiomeFeatures.addScatteredOakTrees(this);
DefaultBiomeFeatures.addOres(this);
DefaultBiomeFeatures.addDoubleFlowers(this);
DefaultBiomeFeatures.addGrass(this);
DefaultBiomeFeatures.addDefaultFlowers(this);
DefaultBiomeFeatures.addTallGrass(this);
this.addSpawn(EntityClassification.AMBIENT, new Biome.SpawnListEntry(EntityType.BAT, 150, 8, 8));
this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.CAT, 10, 10, 15));
this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.CREEPER, 5, 1, 3));
}
}
I have a feeling that this is class is the cause of the problem. The biome does register but it won't generate naturally. It only generates in flat/buffet worlds.
The error could also be in my BiomeList Class. Here is the BiomeList class:
package com.davide_24.uselessmod.lists;
import com.davide_24.uselessmod.Main;
import com.davide_24.uselessmod.world.biome.CatIsland;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.BiomeDictionary.Type;
import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
public class BiomeList
{
public static final DeferredRegister<Biome> BIOMES = new DeferredRegister<Biome>(ForgeRegistries.BIOMES, Main.MOD_ID);
public static final RegistryObject<Biome> CAT_ISLAND = BIOMES.register("cat_island", () -> new CatIsland());
public static void registerBiomes()
{
registerBiome(CAT_ISLAND.get(), Type.PLAINS);
}
public static void registerBiome(Biome biome, Type... type)
{
BiomeDictionary.addTypes(biome, type);
BiomeManager.addSpawnBiome(biome);
}
}
It would be very helpful if anyone could help me with this.
Have you looked at the biome classes in minecraft to see what is different from your biome class?
You should define the type of biome (hieght, rainfall, etc) in your Biome initialization class (in your case BiomeList). Then in your Biome class, customize it with formation, features, entities, etc.
For example:
public static final RegistryObject<Biome> CatIslandBiome = BIOMES.register("cat_island", () ->
new CatIslandBiome(new Biome.Builder().precipitation(RainType.RAIN).scale(0.05F).temperature(0.8F).waterColor(4159204).waterFogColor(329011)
.surfaceBuilder(SurfaceBuilder.DEFAULT,
new SurfaceBuilderConfig(Blocks.GRASS_BLOCK.getDefaultState(),
.category(Category.PLAINS)
.downfall(0.3F)
.depth(0.125F)
.parent(null)));
Then in your Cat Island Biome Class
public CatIslandBiome(Builder biomeBuilder)
{
super(biomeBuilder);
//add stuff here. Features, ores, carvers, enitites, etc.
}
Dont forget to Register your BiomeList in your main mod class
//In your main method
BiomeList.BIOMES.register(modEventBus);
//Just before setup method
@SubscribeEvent
public static void onRegisterBiomes(final RegistryEvent.Register<Biome> event)
{
BiomeList.registerBiomes();
}
So I have been trying to make a mod where I just put in random ideas I had. While making a biome I noticed that it just does not want to generate naturally! I do not know what is wrong with my code.
This is the code in CatIsland.java; This class is located in com.davide_24.uselessmod.world.biome
I have a feeling that this is class is the cause of the problem. The biome does register but it won't generate naturally. It only generates in flat/buffet worlds.
The error could also be in my BiomeList Class. Here is the BiomeList class:
It would be very helpful if anyone could help me with this.
Have you looked at the biome classes in minecraft to see what is different from your biome class?
You should define the type of biome (hieght, rainfall, etc) in your Biome initialization class (in your case BiomeList). Then in your Biome class, customize it with formation, features, entities, etc.
For example:
Then in your Cat Island Biome Class
Dont forget to Register your BiomeList in your main mod class