Jump to content

(Solved)[1.15.2]How do I add custom biome?


kyazuki

Recommended Posts

I want to add a custom biome which is made by 1 block.

However I can't change stone layer.

How do I do it?

@SubscribeEvent
  public static void onRegisterBiome(RegistryEvent.Register<Biome> event) {
    TEST_BIOME.setRegistryName("test_biome");
    ForgeRegistries.BIOMES.register(TEST_BIOME);
    BiomeDictionary.addTypes(TEST_BIOME, BiomeDictionary.Type.PLAINS);
    BiomeManager.addSpawnBiome(TEST_BIOME);
  }
public class TestBiome extends Biome {
  public TestBiome() {
    super((new Builder()).surfaceBuilder(SurfaceBuilder.DEFAULT, new SurfaceBuilderConfig(TestMod.TEST_BLOCK.getDefaultState(), TestMod.TEST_BLOCK.getDefaultState(), TestMod.TEST_BLOCK.getDefaultState())).precipitation(RainType.RAIN).category(Category.PLAINS).depth(0.125F).scale(0.05F).temperature(0.8F).downfall(0.4F).waterColor(4159204).waterFogColor(329011).parent((String) null));
    
    DefaultBiomeFeatures.addCarvers(this);
    DefaultBiomeFeatures.addLakes(this);

    this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.SHEEP, 12, 4, 4));
    this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.PIG, 10, 4, 4));
    this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.CHICKEN, 10, 4, 4));
    this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.COW, 8, 4, 4));
    this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.HORSE, 5, 2, 6));
    this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.DONKEY, 1, 1, 3));
    this.addSpawn(EntityClassification.AMBIENT, new SpawnListEntry(EntityType.BAT, 10, 8, 8));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SPIDER, 100, 4, 4));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ZOMBIE, 95, 4, 4));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ZOMBIE_VILLAGER, 5, 1, 1));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SKELETON, 100, 4, 4));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.CREEPER, 100, 4, 4));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SLIME, 100, 4, 4));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ENDERMAN, 10, 1, 4));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.WITCH, 5, 1, 1));
  }
}

 

It's solved by using OverworldGenSettings#setDefaultBlock.

Edited by kyazuki
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

My mod add a new world type which generates only my biome.

My biome is made by 1 block and fluids.

 

WorldType:

public class TestWorldType extends WorldType {
  public TestWorldType() {
    super("testworld");
  }

  @Override
  public ChunkGenerator<?> createChunkGenerator(World world) {
    if (world.getDimension().getType() == DimensionType.OVERWORLD) {
      OverworldGenSettings overworldGenSettings = new OverworldGenSettings();
      SingleBiomeProviderSettings biomeProviderSettings = new SingleBiomeProviderSettings(world.getWorldInfo());
      biomeProviderSettings.setBiome(TestWorld.TEST_BIOME);
      overworldGenSettings.setDefaultBlock(TestWorld.TEST_BLOCK.getDefaultState());
      return new OverworldChunkGenerator(world, new SingleBiomeProvider(biomeProviderSettings), overworldGenSettings);
    } else
      return super.createChunkGenerator(world);
  }
}

 

 

Biome(I refered to PlainsBiome):

public class TestBiome extends Biome {
  private static final BlockState WATER = Blocks.WATER.getDefaultState();
  private static final BlockState LAVA = Blocks.LAVA.getDefaultState();
  public static final BlockState TEST_BLOCK_STATE = TestWorld.TEST_BLOCK.getDefaultState();
  public static final TreeFeatureConfig TEST_TREE_CONFIG = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(TEST_BLOCK_STATE), new SimpleBlockStateProvider(TEST_BLOCK_STATE), new BlobFoliagePlacer(2, 0))).baseHeight(4).heightRandA(2).foliageHeight(3).ignoreVines().setSapling((IPlantable) TestWorld.TEST_BLOCK).build();
  public static final BlockStateProvidingFeatureConfig HAY_PILE_CONFIG = new BlockStateProvidingFeatureConfig(new SimpleBlockStateProvider(TestWorld.TEST_BLOCK.getDefaultState()));

  public TestBiome() {
    super((new Builder()).surfaceBuilder(SurfaceBuilder.DEFAULT, new SurfaceBuilderConfig(TEST_BLOCK_STATE, TEST_BLOCK_STATE, TEST_BLOCK_STATE)).precipitation(RainType.RAIN).category(Category.PLAINS).depth(0.125F).scale(0.05F).temperature(0.8F).downfall(0.4F).waterColor(4159204).waterFogColor(329011).parent((String) null));

    TestVillagePools.init();
    this.addStructure(Feature.VILLAGE.withConfiguration(new VillageConfig("village/test/town_centers", 6)));

    this.addCarver(GenerationStage.Carving.AIR, Biome.createCarver(new TestCaveWorldCarver(ProbabilityConfig::deserialize, 256), new ProbabilityConfig(0.14285715F)));
    this.addCarver(GenerationStage.Carving.AIR, Biome.createCarver(new TestCanyonWorldCarver(ProbabilityConfig::deserialize), new ProbabilityConfig(0.02F)));
    this.addFeature(GenerationStage.Decoration.LOCAL_MODIFICATIONS, new TestLakesFeature(BlockStateFeatureConfig::func_227271_a_).withConfiguration(new BlockStateFeatureConfig(WATER)).withPlacement(Placement.WATER_LAKE.func_227446_a_(new ChanceConfig(4))));
    this.addFeature(GenerationStage.Decoration.LOCAL_MODIFICATIONS, new TestLakesFeature(BlockStateFeatureConfig::func_227271_a_).withConfiguration(new BlockStateFeatureConfig(LAVA)).withPlacement(Placement.LAVA_LAKE.func_227446_a_(new ChanceConfig(80))));
    this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.NORMAL_TREE.withConfiguration(TEST_TREE_CONFIG).withPlacement(Placement.COUNT_EXTRA_HEIGHTMAP.func_227446_a_(new AtSurfaceWithExtraConfig(0, 0.05F, 1))));
    this.addFeature(GenerationStage.Decoration.SURFACE_STRUCTURES, Feature.VILLAGE.withConfiguration(new VillageConfig("village/plains/town_centers", 6)).withPlacement(Placement.NOPE.func_227446_a_(IPlacementConfig.NO_PLACEMENT_CONFIG)));

    this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.SHEEP, 12, 4, 4));
    this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.PIG, 10, 4, 4));
    this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.CHICKEN, 10, 4, 4));
    this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.COW, 8, 4, 4));
    this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.HORSE, 5, 2, 6));
    this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.DONKEY, 1, 1, 3));
    this.addSpawn(EntityClassification.AMBIENT, new SpawnListEntry(EntityType.BAT, 10, 8, 8));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SPIDER, 100, 4, 4));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ZOMBIE, 95, 4, 4));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ZOMBIE_VILLAGER, 5, 1, 1));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SKELETON, 100, 4, 4));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.CREEPER, 100, 4, 4));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SLIME, 100, 4, 4));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ENDERMAN, 10, 1, 4));
    this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.WITCH, 5, 1, 1));
  }
}

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...

@kyazuki did you have to register anything related to your new world type? Or since you overrided the method did it just work from there? I am having trouble not only finding my biome but being able to create a world with just my biome.

 

I am able to see my biome using the buffet world when creating a world. I assume that means my biome is registered correctly but I haven't seen it in the overworld or been able to create just a world with the biome itself.

 

I would love to see your main class and where you registered your biome using the Forge DeferredRegister. Thanks!

 

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.