Skip to content

Surface Generation

gniftygnome edited this page Oct 2, 2024 · 3 revisions

API Options

Surface generation can be configured in code by calling the static methods of com.terraformersmc.biolith.api.surface.SurfaceGeneration during the mod initialization phase. Surface material rules can also be configured via datapack JSON in data/{name}/biolith/surface_generation/*.json ( ⚠️ v3.1+; see here for the pre-3.1 version ).

The JSON file's top level contains a list of surface rules; see Example below for a complete example.

API methods

  • Surface rules can be added to any dimension with Biolith generation.
  • Surface builders can be added to worlds using the standard chunk generator.

Example

{
  "surface_rules": [
    {
      "dimension": "minecraft:overworld",
      "rules_owner": "biolith_examples:breaks_with_terrablender",
      "material_rules": [
        {
          "type": "minecraft:condition",
          "if_true": {
            "type": "minecraft:biome",
            "biome_is": [
              "minecraft:birch_forest"
            ]
          },
          "then_run": {
            "type": "minecraft:block",
            "result_state": {
              "Name": "minecraft:calcite"
            }
          }
        }
      ]
    },
    {
      "dimension": "minecraft:overworld",
      "rules_owner": "minecraft:rules/overworld",
      "material_rules": [
        {
          "type": "minecraft:condition",
          "if_true": {
            "type": "minecraft:above_preliminary_surface"
          },
          "then_run": {
            "type": "minecraft:sequence",
            "sequence": [
              {
                "type": "minecraft:condition",
                "if_true": {
                  "type": "minecraft:biome",
                  "biome_is": [
                    "minecraft:crimson_forest"
                  ]
                },
                "then_run": {
                  "type": "minecraft:sequence",
                  "sequence": [
                    {
                      "type": "minecraft:condition",
                      "if_true": {
                        "type": "minecraft:stone_depth",
                        "surface_type": "floor",
                        "add_surface_depth": false,
                        "secondary_depth_range": 0,
                        "offset": 0
                      },
                      "then_run": {
                        "type": "minecraft:sequence",
                        "sequence": [
                          {
                            "type": "minecraft:condition",
                            "if_true": {
                              "type": "minecraft:noise_threshold",
                              "noise": "minecraft:nether_wart",
                              "min_threshold": 1.17,
                              "max_threshold": 1E308
                            },
                            "then_run": {
                              "type": "minecraft:block",
                              "result_state": {
                                "Name": "minecraft:nether_wart_block"
                              }
                            }
                          },
                          {
                            "type": "minecraft:block",
                            "result_state": {
                              "Name": "minecraft:crimson_nylium"
                            }
                          }
                        ]
                      }
                    },
                    {
                      "type": "minecraft:block",
                      "result_state": {
                        "Name": "minecraft:netherrack"
                      }
                    }
                  ]
                }
              },
              {
                "type": "minecraft:condition",
                "if_true": {
                  "type": "minecraft:biome",
                  "biome_is": [
                    "minecraft:warped_forest"
                  ]
                },
                "then_run": {
                  "type": "minecraft:sequence",
                  "sequence": [
                    {
                      "type": "minecraft:condition",
                      "if_true": {
                        "type": "minecraft:stone_depth",
                        "surface_type": "floor",
                        "add_surface_depth": false,
                        "secondary_depth_range": 0,
                        "offset": 0
                      },
                      "then_run": {
                        "type": "minecraft:sequence",
                        "sequence": [
                          {
                            "type": "minecraft:condition",
                            "if_true": {
                              "type": "minecraft:noise_threshold",
                              "noise": "minecraft:nether_wart",
                              "min_threshold": 1.17,
                              "max_threshold": 1E308
                            },
                            "then_run": {
                              "type": "minecraft:block",
                              "result_state": {
                                "Name": "minecraft:warped_wart_block"
                              }
                            }
                          },
                          {
                            "type": "minecraft:block",
                            "result_state": {
                              "Name": "minecraft:warped_nylium"
                            }
                          }
                        ]
                      }
                    },
                    {
                      "type": "minecraft:block",
                      "result_state": {
                        "Name": "minecraft:netherrack"
                      }
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    },
    {
      "dimension": "minecraft:the_nether",
      "rules_owner": "minecraft:rules/nether",
      "material_rules": [
        {
          "type": "minecraft:condition",
          "if_true": {
            "type": "minecraft:vertical_gradient",
            "random_name": "bedrock_floor",
            "true_at_and_below": {
              "above_bottom": 0
            },
            "false_at_and_above": {
              "above_bottom": 5
            }
          },
          "then_run": {
            "type": "minecraft:block",
            "result_state": {
              "Name": "minecraft:bedrock"
            }
          }
        },
        {
          "type": "minecraft:condition",
          "if_true": {
            "type": "minecraft:not",
            "invert": {
              "type": "minecraft:vertical_gradient",
              "random_name": "bedrock_roof",
              "true_at_and_below": {
                "below_top": 5
              },
              "false_at_and_above": {
                "below_top": 0
              }
            }
          },
          "then_run": {
            "type": "minecraft:block",
            "result_state": {
              "Name": "minecraft:bedrock"
            }
          }
        },
        {
          "type": "minecraft:condition",
          "if_true": {
            "type": "minecraft:biome",
            "biome_is": [
              "minecraft:end_highlands"
            ]
          },
          "then_run": {
            "type": "minecraft:block",
            "result_state": {
              "Name": "minecraft:end_stone"
            }
          }
        }
      ]
    },
    {
      "dimension": "minecraft:the_end",
      "rules_owner": "minecraft:rules/end",
      "material_rules": [
        {
          "type": "minecraft:condition",
          "if_true": {
            "type": "minecraft:biome",
            "biome_is": [
              "minecraft:plains"
            ]
          },
          "then_run": {
            "type": "minecraft:sequence",
            "sequence": [
              {
                "type": "minecraft:condition",
                "if_true": {
                  "type": "minecraft:stone_depth",
                  "surface_type": "floor",
                  "add_surface_depth": false,
                  "secondary_depth_range": 0,
                  "offset": 0
                },
                "then_run": {
                  "type": "minecraft:block",
                  "result_state": {
                    "Name": "minecraft:grass_block",
                    "Properties": {
                      "snowy": "false"
                    }
                  }
                }
              },
              {
                "type": "minecraft:condition",
                "if_true": {
                  "type": "minecraft:stone_depth",
                  "surface_type": "floor",
                  "add_surface_depth": true,
                  "secondary_depth_range": 0,
                  "offset": 0
                },
                "then_run": {
                  "type": "minecraft:block",
                  "result_state": {
                    "Name": "minecraft:dirt"
                  }
                }
              }
            ]
          }
        }
      ]
    }
  ]
}
Clone this wiki locally