Skip to content

Worldgen 1.19

desht edited this page Jan 17, 2023 · 19 revisions

Oil Lake Generation in PNC:R 4.x (for Minecraft 1.19)

In Minecraft 1.19, world generation is very much data-driven, with nearly everything defined in JSON files. PneumaticCraft oil lake generation is no exception to this, and is almost completely controlled by datapack and JSON files. This page explains how oil lake generation can be configured and modified.

JSON files

Configured Oil Lake Feature

See https://minecraft.fandom.com/wiki/Configured_feature for more information on configured features.

This file defines Oil lakes as a configured feature, using the generation code from minecraft:lake, and can be found in data/pneumaticcraft/worldgen/configured_feature/oil_lake.json:

Click to show JSON
{
  "type": "minecraft:lake",
  "config": {
    "barrier": {
      "type": "minecraft:simple_state_provider",
      "state": {
        "Name": "minecraft:air"
      }
    },
    "fluid": {
      "type": "minecraft:simple_state_provider",
      "state": {
        "Name": "pneumaticcraft:oil",
        "Properties": {
          "level": "0"
        }
      }
    }
  }
}
You probably won't want to make any changes here, although you could give oil lakes a custom barrier block if you wanted to (vanilla water lakes have no barrier block, while vanilla lava lakes use Stone as a barrier).

Placed Oil Lake Features

See https://minecraft.fandom.com/wiki/Placed_feature for more information on placed features.

PneumaticCraft adds two separate placed features for oil lakes: one for surface generation, and one for underground generation. The purpose of this is to allow separate configuration of the frequency of surface and underground oil lakes. Default frequencies are the same as for vanilla surface and underground lava lakes (attempt once every 6 chunks to generate an underground lake, and once every 25 chunks to generate a surface lake)

Default surface placed feature (data/pneumaticcraft/worldgen/placed_feature/oil_lake_surface.json):

Click to show JSON
{
  "feature": "pneumaticcraft:oil_lake",
  "placement": [
    {
      "type": "minecraft:rarity_filter",
      "chance": 25
    },
    {
      "type": "minecraft:in_square"
    },
    {
      "type": "minecraft:heightmap",
      "heightmap": "WORLD_SURFACE_WG"
    },
    {
      "type": "minecraft:biome"
    },
    {
      "type": "pneumaticcraft:oil_lake_filter"
    }
  ]
}

Default underground placed feature (data/pneumaticcraft/worldgen/placed_feature/oil_lake_underground.json):

Click to show JSON
{
  "feature": "pneumaticcraft:oil_lake",
  "placement": [
    {
      "type": "minecraft:rarity_filter",
      "chance": 6
    },
    {
      "type": "minecraft:in_square"
    },
    {
      "type": "minecraft:height_range",
      "height": {
        "type": "minecraft:uniform",
        "max_inclusive": {
          "below_top": 0
        },
        "min_inclusive": {
          "absolute": 0
        }
      }
    },
    {
      "type": "minecraft:environment_scan",
      "direction_of_search": "down",
      "max_steps": 32,
      "target_condition": {
        "type": "minecraft:all_of",
        "predicates": [
          {
            "type": "minecraft:not",
            "predicate": {
              "type": "minecraft:matching_blocks",
              "blocks": "minecraft:air"
            }
          },
          {
            "type": "minecraft:inside_world_bounds",
            "offset": [
              0,
              -5,
              0
            ]
          }
        ]
      }
    },
    {
      "type": "minecraft:surface_relative_threshold_filter",
      "heightmap": "OCEAN_FLOOR_WG",
      "max_inclusive": -5
    },
    {
      "type": "minecraft:biome"
    },
    {
      "type": "pneumaticcraft:oil_lake_filter"
    }
  ]
}

The most likely change you would want to make here is to edit the rarity of oil lakes, via the minecraft:rarity_filter field.

Custom placement filter

You may have noticed in the placed feature JSONs above that a custom placement filter is used: pneumaticcraft:oil_lake_filter. This filter serves two purposes:

  1. Config-driven whitelisting/blacklisting of oil lakes by dimension
  2. Prevention of placement of oil lakes within certain structures (by default, any village).

There are two config settings in pneumaticcraft-common.toml (Worldgen section) which control which dimensions may include oil lakes. Both are empty by default, allowing oil lake gen to occur in any dimension (although generation by default is limited to overworld biomes - see next section for more information on that).

Dimension whitelisting/blacklisting

[Worldgen]
        #Oil worldgen blacklist by dimension ID: add dimension ID's to this list if you don't want oil lake worldgen to happen there. You can wildcard this; e.g 'modid:*' blacklists ALL dimensions of namespace 'modid'.
        oil_world_gen_dimension_blacklist = []
        #Oil worldgen whitelist by dimension ID: add dimension ID's to this list if you want oil lake worldgen to happen ONLY in those dimensions. You can wildcard the path; e.g 'modid:*' whitelists ALL dimensions of namespace 'modid'. If this is empty, it is ignored, and 'oil_world_gen_dimension_blacklist' will be checked instead.
        oil_world_gen_dimension_whitelist = []

Note that a non-empty whitelist will cause the blacklist setting to be ignored; lake generation will only happen in whitelisted dimensions in that case.

Structure filtering

Oil lakes will not generate within villages by default. This is controlled by the structure tag pneumaticcraft:no_oil_lakes - which is modifiable in data/pneumaticcraft/tags/worldgen/structure/no_oil_lakes.json:

Click to show JSON
{
  "values": [
    "#minecraft:village"
  ]
}

The default value prevents lake generation in any structure in the vanilla #minecraft:village tag, which is the five biome-specific villages (plains, desert, taiga, savanna and snowy). Other vanilla structure ID's and tags are available, e.g. #minecraft:mineshaft, #minecraft:shipwreck, etc., and mods may add further structure ID's and tags if they add custom structures.

Biome Modifier

Biome Modifiers are a new Forge mechanism (added in 1.19) to allow mods to add features to biomes, remove features from biomes, and more. They are the standard data-driven way to add modded features to worlds as of 1.19. See https://forge.gemwire.uk/wiki/Biome_Modifiers for more information.

PneumaticCraft adds two biome modifiers: data/pneumaticcraft/forge/biome_modifier/oil_lake_surface.json and data/pneumaticcraft/forge/biome_modifier/oil_lake_underground.json:

Click to show oil_lake_surface.json
{
  "type": "forge:add_features",
  "biomes": "#pneumaticcraft:has_surface_oil_lakes",
  "features": "pneumaticcraft:oil_lake_surface",
  "step": "lakes"
}
Click to show oil_lake_underground.json
{
  "type": "forge:add_features",
  "biomes": "#pneumaticcraft:has_underground_oil_lakes",
  "features": "pneumaticcraft:oil_lake_underground",
  "step": "lakes"
}

There are two likely reasons to override either of these files:

  1. To disable oil lake generation entirely; override the biome modifier with "type": "forge:none".
  2. To change the biomes in which oil lakes can appear; see following section...

Filtering by Biome

In the above two biome modifier JSONs, you will notice use of the #pneumaticcraft:has_surface_oil_lakes and #pneumaticcraft:has_underground_oil_lakes biome tags. By default, these biome tags (data/pneumaticcraft/tags/worldgen/biome/has_surface_oil_lakes.json and .../has_underground_oil_lakes.json) look like this:

{
  "values": [
    "#minecraft:is_overworld"
  ]
}

in other worlds, any overworld biome allows oil lakes. You can override this with either specific biomes, or any other biome tag.

See:

Mods may of course add many more biomes and tags.