Jump to content

[SOLVED][1.19.4] Add biome to overworld


JimiIT92

Recommended Posts

I'm struggling on biome generation in 1.19.4. I've tried to add a basic biome, just a regular snowy plain, however I'm struggling to make it spawn inside the overworld.

You can find all the implementation I tried here: https://github.com/JimiIT92/MineWorld/blob/master/src/main/java/org/mineworld/core/MWBiomes.java

I'll simplify the code here just to avoid an extra long post. So, what I did is create a biome resource key and use the bootstrap method (similar to placed features) to register the key and the biome

public static final ResourceKey<Biome> FROZEN_PLAINS = ResourceKey.create(Registries.BIOME, new ResourceLocation(modid, "frozen_plains"));

public static void bootstrap(final BootstapContext<Biome> context) {
  final HolderGetter<PlacedFeature> placedFeatureHolder = context.lookup(Registries.PLACED_FEATURE);
  final HolderGetter<ConfiguredWorldCarver<?>> carver = context.lookup(Registries.CONFIGURED_CARVER);
  context.register(FROZEN_PLAINS, BiomeHelper.frozenPlains(placedFeatureHolder, carver));
}

The BiomeHelper.frozePlains method is just a method that returns a Biome object, similar to how vanilla creates the plains biome
 

public static Biome frozenPlains(final HolderGetter<PlacedFeature> placedFeatureHolder, final HolderGetter<ConfiguredWorldCarver<?>> carver) {
        final MobSpawnSettings.Builder mobSpawnSettings = new MobSpawnSettings.Builder();
        final BiomeGenerationSettings.Builder biomeGenerationSettings = new BiomeGenerationSettings.Builder(placedFeatureHolder, carver);
        OverworldBiomes.globalOverworldGeneration(biomeGenerationSettings);
        mobSpawnSettings.creatureGenerationProbability(0.07F);
        BiomeDefaultFeatures.snowySpawns(mobSpawnSettings);
        biomeGenerationSettings.addFeature(GenerationStep.Decoration.SURFACE_STRUCTURES, MiscOverworldPlacements.ICE_SPIKE);
        biomeGenerationSettings.addFeature(GenerationStep.Decoration.SURFACE_STRUCTURES, MiscOverworldPlacements.ICE_PATCH);
        BiomeDefaultFeatures.addDefaultOres(biomeGenerationSettings);
        BiomeDefaultFeatures.addDefaultSoftDisks(biomeGenerationSettings);

        return new Biome.BiomeBuilder()
                .hasPrecipitation(false)
                .temperature(-5.0F)
                .temperatureAdjustment(Biome.TemperatureModifier.FROZEN)
                .downfall(0.5F)
                .specialEffects(new BiomeSpecialEffects.Builder()
                        .waterColor(10468857)
                        .waterFogColor(14079743)
                        .fogColor(14408667)
                        .skyColor(13092807)
                        .foliageColorOverride(16777215)
                        .grassColorOverride(16777215)
                        .ambientParticle(new AmbientParticleSettings(ParticleTypes.SNOWFLAKE, 0.0118093334F))
                        .ambientMoodSound(AmbientMoodSettings.LEGACY_CAVE_SETTINGS).build()
                )
                .mobSpawnSettings(mobSpawnSettings.build())
                .generationSettings(biomeGenerationSettings.build())
        .build();
    }

Then, in the FMLCommonSetupEvent, I add the biome to the overworld biomes using BiomeManager.addBiome (I've also tried addAdditionalOverworldBiomes but got no luck)
 

private void commonSetup(final FMLCommonSetupEvent event) {
  event.enqueueWork(() -> {
		BiomeManager.addBiome(BiomeManager.BiomeType.ICY, new BiomeManager.BiomeEntry(FROZEN_PLAINS, 3000))
  });
}

I'm using a really high weight value for testing.

Finally I've added the biome json file inside data/modid/worldgen/biome/frozen_plains.json

 

{
  "carvers": {
    "air": [
      "minecraft:cave",
      "minecraft:cave_extra_underground",
      "minecraft:canyon"
    ]
  },
  "downfall": 0.5,
  "has_precipitation": false,
  "creature_spawn_probability": 0.07,
  "temperature_modifier": "frozen",
  "effects": {
    "mood_sound": {
      "block_search_extent": 8,
      "offset": 2.0,
      "sound": "minecraft:ambient.cave",
      "tick_delay": 6000
    },
    "particle": {
      "options": {
        "type": "snowflake"
      },
      "probability": 0.0118093334
    },
    "fog_color": 14408667,
    "sky_color": 13092807,
    "water_color": 10468857,
    "water_fog_color": 14079743,
    "foliage_color": 16777215,
    "grass_color": 16777215
  },
  "features": [
    [],
    [
      "minecraft:lake_lava_underground"
    ],
    [
      "minecraft:amethyst_geode"
    ],
    [
      "minecraft:monster_room",
      "minecraft:monster_room_deep"
    ],
    [
      "minecraft:ice_spike",
      "minecraft:ice_patch"
    ],
    [],
    [
      "minecraft:ore_dirt",
      "minecraft:ore_gravel",
      "minecraft:ore_granite_upper",
      "minecraft:ore_granite_lower",
      "minecraft:ore_diorite_upper",
      "minecraft:ore_diorite_lower",
      "minecraft:ore_andesite_upper",
      "minecraft:ore_andesite_lower",
      "minecraft:ore_tuff",
      "minecraft:ore_coal_upper",
      "minecraft:ore_coal_lower",
      "minecraft:ore_iron_upper",
      "minecraft:ore_iron_middle",
      "minecraft:ore_iron_small",
      "minecraft:ore_gold",
      "minecraft:ore_gold_lower",
      "minecraft:ore_redstone",
      "minecraft:ore_redstone_lower",
      "minecraft:ore_diamond",
      "minecraft:ore_diamond_large",
      "minecraft:ore_diamond_buried",
      "minecraft:ore_lapis",
      "minecraft:ore_lapis_buried",
      "minecraft:ore_copper",
      "minecraft:underwater_magma",
      "minecraft:disk_sand",
      "minecraft:disk_clay",
      "minecraft:disk_gravel"
    ],
    [],
    [
      "minecraft:spring_water"
    ],
    [
      "minecraft:glow_lichen"
    ],
    [
      "minecraft:freeze_top_layer"
    ]
  ],
  "spawn_costs": {},
  "spawners": {
    "ambient": [
      {
        "type": "minecraft:bat",
        "maxCount": 8,
        "minCount": 8,
        "weight": 10
      }
    ],
    "axolotls": [],
    "creature": [
      {
        "type": "minecraft:rabbit",
        "maxCount": 3,
        "minCount": 2,
        "weight": 10
      },
      {
        "type": "minecraft:polar_bear",
        "maxCount": 2,
        "minCount": 1,
        "weight": 1
      }
    ],
    "misc": [],
    "monster": [
      {
        "type": "minecraft:spider",
        "maxCount": 4,
        "minCount": 4,
        "weight": 100
      },
      {
        "type": "minecraft:zombie",
        "maxCount": 4,
        "minCount": 4,
        "weight": 95
      },
      {
        "type": "minecraft:zombie_villager",
        "maxCount": 1,
        "minCount": 1,
        "weight": 5
      },
      {
        "type": "minecraft:skeleton",
        "maxCount": 4,
        "minCount": 4,
        "weight": 20
      },
      {
        "type": "minecraft:creeper",
        "maxCount": 4,
        "minCount": 4,
        "weight": 100
      },
      {
        "type": "minecraft:slime",
        "maxCount": 4,
        "minCount": 4,
        "weight": 100
      },
      {
        "type": "minecraft:enderman",
        "maxCount": 4,
        "minCount": 1,
        "weight": 10
      },
      {
        "type": "minecraft:witch",
        "maxCount": 1,
        "minCount": 1,
        "weight": 5
      },
      {
        "type": "minecraft:stray",
        "maxCount": 4,
        "minCount": 4,
        "weight": 80
      }
    ],
    "underground_water_creature": [
      {
        "type": "minecraft:glow_squid",
        "maxCount": 6,
        "minCount": 4,
        "weight": 10
      }
    ],
    "water_ambient": [],
    "water_creature": []
  },
  "temperature": -5.0
}


But, if I launch the game and try to locate the biome, this cannot be found inside the world. However if I generate a single biome world the custom biome generates without any issues. Also if I place a breakpoint inside the bootstrap method I see that it never gets hit, but I dont' understand why since it does for other bootstrap contexts like placed features.

So what do I need to make the biome actually generate inside the overworld? Also, since surface builders seems gone, how can I change the terrain generation, so that I can generate something else instead of grass blocks for my surface?

Edited by JimiIT92
Fixed typos and solved the tags issue

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

You can't add biomes to the vanilla dimensions unless you replace the whole dimension (don't do that).

Use a mod like terrablender or create your own world preset.

And the idea that any live worldgen config is available during CommonSetup is just wrong. Worldgen comes from datapacks which are not loaded until the save is loaded.

 

Also please don't post code snippets out of context in the forum. Put all the relevant details to reproduce the problem on github.

If you just post code in the forums, the most likely outcome is you don't post the relevant information to understand the problem and your question just gets ignored.

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

21 minutes ago, warjort said:

You can't add biomes to the vanilla dimensions unless you replace the whole dimension

That's really unfortunate to hear

 

22 minutes ago, warjort said:

the idea that any live worldgen config is available during CommonSetup is just wrong

I've read that here: 

 

1 hour ago, JimiIT92 said:

Which I did right here:

23 minutes ago, warjort said:

Put all the relevant details to reproduce the problem on github

I just posted some snippets in case someone would quickly identify what's wrong, without browsing the entire repo 🤷🏼‍♂️

Anyway, I guess I'll stick to terrablender since it seems what most mods is using now (event Biomes Oì Plenty from what I've seen)

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

I wasn't even aware of that feature existed.

So you know more about it than me. 🙂

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

  • JimiIT92 changed the title to [SOLVED][1.19.4] Add biome to overworld

From what I can tell, that BiomeManager class isn't used by anything, unless I missed something?

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.