### Directory Structure Example Source: https://terra.polydev.org/config/development/modifying-existing-pack.html Illustrates the correct directory structure for a new custom pack within the Terra installation. ```text Terra/ ├── packs/ ┆ ├── default.zip └── custom-pack/ <- New folder you've just created ``` -------------------------------- ### Equivalent Pack Manifest Examples Source: https://terra.polydev.org/config/development/pack-from-scratch/introduction.html Demonstrates that the order of parameters and extra blank lines in the pack.yml file do not affect its validity. All provided examples are equivalent and correctly define the pack ID and version. ```yaml id: YOUR_PACK_ID version: 0.1.0 ``` ```yaml id: YOUR_PACK_ID version: 0.1.0 ``` ```yaml version: 0.1.0 id: YOUR_PACK_ID ``` -------------------------------- ### YAML Nesting Examples Source: https://terra.polydev.org/config/development/config-data.html Examples of nesting maps and lists using indentation. ```YAML key: 42 ``` ```YAML foo: a bar: b ``` ```YAML baz: foo: a bar: b ``` ```YAML my-list: - item 1 - item 2 ``` ```YAML qux: baz: foo: a bar: b ``` -------------------------------- ### Example Addon Manifest Source: https://terra.polydev.org/api/concepts/manifest-addons.html This is an example of a terra.addon.yml file, which is required for the Manifest Addon Loader. It includes essential information about the addon. ```yaml schema-version: 1 contributors: - Terra contributors id: super-cool-addon version: 1.0.3 entrypoints: - "com.example.cool.MySuperCoolEntryPoint" depends: cool-addon: "1.2.ட்டான" website: issues: https://example.com/issues source: https://example.com/ docs: https://example.com/wiki license: MIT License ``` -------------------------------- ### Example Domain Warp Configuration Source: https://terra.polydev.org/config/development/noise/configuring.html A practical example of domain warping using two simplex samplers and an amplitude setting. ```yaml type: DOMAIN_WARP sampler: type: OPEN_SIMPLEX_2 frequency: 0.005 warp: type: OPEN_SIMPLEX_2 amplitude: 20 ``` -------------------------------- ### Palette Reference Example Source: https://terra.polydev.org/config/documentation/objects/Palette.html Demonstrates how to reference a PALETTE configuration by its ID. ```APIDOC ## Palette Reference ### Description Represents a reference to a PALETTE config. `Palette`s are defined as the referenced palette’s ID. ### Example For example a `PALETTE` config with an id of `GRASS_MIX` would be referenced in a `palette` parameter like so: ```yaml palette: GRASS_MIX ``` ### Uses Used by 3 parameters: * In base in BIOME: * `ocean.palette` Palette * In map in SlantLayer: * `palette` List> * In base in BIOME: * `palette` List> ``` -------------------------------- ### Define Config Specific Object Example Source: https://terra.polydev.org/config/documentation/index.html Example structure for a configuration that utilizes a custom object type. ```yaml example-object: object-parameter: A string. ``` -------------------------------- ### Console Output Example Source: https://terra.polydev.org/config/documentation/terrascript/syntax.html Expected output from the counter while loop. ```text Number: 0 Number: 1 Number: 2 Number: 3 Number: 4 ``` -------------------------------- ### Complex Data Structure Example Source: https://terra.polydev.org/config/development/config-data.html A combined example representing a shopping list and appointments. ```YAML shopping-list: - item: 1L Milk amount: 2 cost-per-item: 2.0 - item: Carton of Eggs amount: 1 cost-per-item: 4.5 appointments: - name: Haircut Appointment date: 24.04.22 start-time: 9:45 end-time: 10:15 - name: Doctor Appointment date: 13.05.22 start-time: 3:15 end-time: 4:15 ``` ```JSON { "shopping-list": [ { "item": "1L Milk", "amount": 2, "cost-per-item": 2 }, { "item": "Carton of Eggs", "amount": 1, "cost-per-item": 4.5 } ], "appointments": [ { "name": "Haircut Appointment", "date": "24.04.22", "start-time": 585, "end-time": 615 }, { "name": "Doctor Appointment", "date": "13.05.22", "start-time": 195, "end-time": 255 } ] } ``` -------------------------------- ### Define Abstract Base Configuration Source: https://terra.polydev.org/config/development/pack-from-scratch/oceans.html Initial setup for a base configuration file using YAML. ```yaml id: BASE type: BIOME ``` ```yaml id: BASE type: BIOME abstract: true ocean: palette: BLOCK:minecraft:water level: 62 ``` -------------------------------- ### Example FBM Fractalizer Configuration Source: https://terra.polydev.org/config/development/noise/configuring.html A basic implementation of the FBM fractalizer using OPEN_SIMPLEX_2 as the input sampler. ```yaml type: FBM sampler: type: OPEN_SIMPLEX_2 ``` -------------------------------- ### Define AnimalTemplate Configuration Source: https://terra.polydev.org/config/development/config-system.html Valid configuration examples for the AnimalTemplate requiring color and legs parameters. ```YAML color: grey legs: 4 ``` ```JSON { "color": "grey" "legs": 4 } ``` -------------------------------- ### Implement Sampler in Palette Configuration Source: https://terra.polydev.org/config/development/noise/configuring.html Example of integrating a noise sampler with a specific frequency into a palette configuration for material distribution. ```yaml id: DIRTY_GRASS layers: - # Single layer of grass and dirt blocks layers: 1 materials: - "minecraft:grass_block": 1 - "minecraft:coarse_dirt": 1 sampler: type: OPEN_SIMPLEX_2 frequency: 0.05 - # Two layers of dirt below the top layer layers: 2 materials: "minecraft:dirt" - # Then finally stone layers: 1 materials: "minecraft:stone" ``` -------------------------------- ### Define Nested Configuration Parameters Source: https://terra.polydev.org/config/development/config-system.html Example of nested parameter structure within a configuration file. ```YAML a: nested: parameter: a parameter value ``` ```JSON { "a": { "nested": { "parameter": "a parameter value" } } } ``` -------------------------------- ### Define Config Documentation Template Source: https://terra.polydev.org/config/documentation/index.html Standard template for documenting configuration parameters and providing a usage example. ```yaml : ... # Object matching the parameter type : ... ``` -------------------------------- ### EXPRESSION Sampler Example Source: https://terra.polydev.org/config/documentation/objects/NoiseSampler.html Evaluates a mathematical expression using noise functions. Requires the 'config-noise-function' addon. ```yaml type: EXPRESSION expression: (noise(x, z) + 3) / 2 samplers: noise: dimensions: 2 type: WHITE_NOISE ``` -------------------------------- ### Define Pipeline Biome Placeholders Source: https://terra.polydev.org/config/documentation/objects/PipelineBiome.html Example configuration using general 'land' and 'ocean' placeholders within a SAMPLER source. ```yaml source: type: SAMPLER biomes: - land: 1 - ocean: 1 sampler: type: OPEN_SIMPLEX_2 ``` -------------------------------- ### Extend Abstract Configuration in Biomes Source: https://terra.polydev.org/config/development/pack-from-scratch/oceans.html Examples of extending the base configuration within specific biome files. ```yaml id: OCEAN_BIOME type: BIOME extends: BASE vanilla: minecraft:ocean ... palette: - SAND_PALETTE: 319 - BLOCK:minecraft:bedrock: -61 ``` ```yaml id: FIRST_BIOME type: BIOME extends: BASE ... ``` ```yaml id: SECOND_BIOME type: BIOME extends: BASE ... ``` -------------------------------- ### Get Block State and Generate Blocks Source: https://terra.polydev.org/api/intro/adding-structure.html Implement the generate method to obtain BlockStates using the Platform's WorldHandle and set them in the world. It's recommended to get BlockStates once on initialization rather than within the generate method for performance. ```java public class ExampleStructure implements Structure { private final Platform platform; public ExampleStructure(Platform platform) { this.platform = platform; } @Override public boolean generate(Vector3Int location, WritableWorld world, Random random, Rotation rotation) { BlockState oakLog = platform.getWorldHandle().createBlockState("minecraft:oak_log[axis=y]"); BlockState oakLeaves = platform.getWorldHandle().createBlockState("minecraft:oak_leaves[persistent=true]"); return false; } } ``` -------------------------------- ### Apply Noise Sampler to a Parameter Source: https://terra.polydev.org/config/development/noise/configuring.html Example of assigning a white noise sampler configuration to a specific parameter. ```yaml example-noise-sampler-parameter: type: WHITE_NOISE ``` -------------------------------- ### Valid Pack ID Configuration Source: https://terra.polydev.org/config/development/modifying-existing-pack.html Example of a correctly formatted pack.yml file with a valid pack ID. ```yaml id: CUSTOM ``` -------------------------------- ### While Loop Iteration Source: https://terra.polydev.org/config/documentation/terrascript/syntax.html Examples of while loops, including an infinite loop and a controlled counter loop. ```TerraScript while(true) { // Since the condition is always true, the block will run infinitely. You generally want to avoid situations like this. print("this runs forever!"); } ``` ```TerraScript num aNumber = 0; while(number < 5) { // This will run the block until aNumber is NOT less than 5 (until A is greater than or equal to 5). print("Number: " + aNumber); aNumber = aNumber + 1; // Add one to aNumber each time the loop runs. } ``` -------------------------------- ### EXPRESSION_NORMALIZER Sampler Example Source: https://terra.polydev.org/config/documentation/objects/NoiseSampler.html Simplifies an EXPRESSION sampler by using 'in' for input coordinates. Requires the 'config-noise-function' addon. ```yaml type: EXPRESSION_NORMALIZER expression: (in + 3) / 2 sampler: type: WHITE_NOISE ``` -------------------------------- ### Logging a Message on Addon Initialization Source: https://terra.polydev.org/api/intro/creating-simple-addon.html Utilize the injected `Logger` within the `initialize` method to log informational messages to the console when the addon starts. ```java package com.example.addon; import com.dfsek.terra.addons.manifest.api.AddonInitializer; import com.dfsek.terra.api.inject.annotations.Inject; import org.slf4j.Logger; public class ExampleEntryPoint implements AddonInitializer { @Inject private Logger logger; @Override public void initialize() { logger.info("Hello, World!"); } } ``` -------------------------------- ### MetaMap Priority Example Source: https://terra.polydev.org/config/development/meta-configuration.html Illustrates MetaMap priority where values from later referenced maps take precedence. Keys not present in later maps are still merged. ```yaml map: "<<": - config.yml:first - config.yml:second - config.yml:third key: Base ``` ```yaml first: key: First second: key: Second extra: Extra value third: key: Third ``` -------------------------------- ### Image Sampler Configuration Source: https://terra.polydev.org/config/documentation/objects/NoiseSampler.html Configures an image sampler to output a specific channel of an image, scaled by frequency. Ensure the 'config-noise-function' addon is installed. Frequencies below 1.0 are not recommended due to potential pixelation. ```yaml type: LINEAR_HEIGHTMAP base: 128 scale: 64 sampler: type: IMAGE image: mountain_heightmap.png channel: GRAYSCALE frequency: 1 ``` ```yaml type: IMAGE image: grayscale_circles.png channel: GRAYSCALE frequency: 1 ``` -------------------------------- ### Initialize Addon and Register Structure Source: https://terra.polydev.org/api/intro/adding-structure.html Initializes the addon, creates a structure instance with a platform and registry key, and registers a listener for the ConfigPackPreLoadEvent. ```java public class ExampleEntryPoint implements AddonInitializer { @Inject private Logger logger; @Inject private Platform platform; @Inject private BaseAddon addon; @Override public void initialize() { logger.info("Hello, World!"); RegistryKey key = addon.key("EXAMPLE_STRUCTURE"); ExampleStructure theStructure = new ExampleStructure(platform, key); platform.getEventManager() .getHandler(FunctionalEventHandler.class) .register(addon, ConfigPackPreLoadEvent.class) .then(event -> { logger.info("We're loading a config pack!"); }); } } ``` -------------------------------- ### Initialize Palette Configuration Source: https://terra.polydev.org/config/development/pack-from-scratch/palette.html Set the basic identity and type for a new palette configuration file. ```yaml 1id: GRASS_PALETTE 2type: PALETTE ``` -------------------------------- ### Numeric Constant Expressions Source: https://terra.polydev.org/config/documentation/terrascript/syntax.html Examples of numeric constant expressions, which can be integers or decimals. ```TerraScript 0 ``` ```TerraScript 1 ``` ```TerraScript 20.3 ``` ```TerraScript 42.0 ``` -------------------------------- ### JSON Nested Structures Source: https://terra.polydev.org/config/development/config-data.html Examples of maps and lists nested within other structures. ```JSON { "parent-key": { "child-key": "value", "sibling-key": "another value" } } ``` ```JSON { "my-list": [ "item 1", "item 2" ] } ``` -------------------------------- ### Reference a configuration value Source: https://terra.polydev.org/config/development/meta-configuration.html Demonstrates how to reference a value from another configuration file using its path and parent keys. This is the basic syntax for meta configuration. ```yaml path: to: config: value: example ``` -------------------------------- ### Comparison Operators Source: https://terra.polydev.org/config/documentation/terrascript/syntax.html Examples of comparison operators used for comparing numbers and other data types. ```TerraScript > ``` ```TerraScript < ``` ```TerraScript >= ``` ```TerraScript <= ``` ```TerraScript == ``` ```TerraScript != ``` -------------------------------- ### Boolean Constant Expressions Source: https://terra.polydev.org/config/documentation/terrascript/syntax.html Examples of boolean constant expressions, which are the keywords 'true' or 'false'. ```TerraScript true ``` ```TerraScript false ``` -------------------------------- ### String Constant Expression Source: https://terra.polydev.org/config/documentation/terrascript/syntax.html Example of a string constant expression, which is enclosed in double quotes. ```TerraScript "This is a constant string" ``` -------------------------------- ### Calling Functions in Terra Source: https://terra.polydev.org/config/documentation/objects/Expression.html Demonstrates how to call functions with zero, one, or multiple arguments. Arguments can be simple values or complex expressions. ```terra exampleFunction() ``` ```terra exampleFunction(3) ``` ```terra exampleFunction(3, 2) ``` ```terra exampleFunction(3 + 2 / exampleFunction(9 * 5)) ``` -------------------------------- ### Initialize feature config Source: https://terra.polydev.org/config/development/pack-from-scratch/grass.html Define the basic structure of a new feature configuration file. ```yaml 1id: GRASS_FEATURE 2type: FEATURE ``` -------------------------------- ### Define STITCHED_BITMAP path format Source: https://terra.polydev.org/config/documentation/objects/Image.html Example configuration for the path-format parameter when using the STITCHED_BITMAP image type. ```text my-config-pack/ ├── pack.yml ├── images ┆ └── stitched-image/ ├ my-image-0-0.png ├ my-image-0-1.png ├ my-image-1-0.png └ my-image-1-1.png ``` ```yaml path-format: images/stitched-image/my-image-{row}-{column}.png ``` -------------------------------- ### Equivalent YAML Map Configurations Source: https://terra.polydev.org/config/development/config-data.html Demonstrates that key-value pair ordering in maps is insignificant. ```YAML a: 1234 b: Some text c: true ``` ```YAML b: Some text c: true a: 1234 ``` -------------------------------- ### Define Pack Manifest Parameters Source: https://terra.polydev.org/config/development/config-system.html Basic configuration pack manifest defining identity, version, and author. ```YAML id: COOL_CONFIG_PACK version: 1.0.0 author: Anon Y. Mous ``` ```JSON { "id": "COOL_CONFIG_PACK", "version": "1.0.0", "author": "Anon Y. Mous" } ``` -------------------------------- ### Config Documentation Format Source: https://terra.polydev.org/config/documentation/index.html Explains the standard format for documenting configuration parameters and objects within Terra. ```APIDOC ## Config Documentation Format Configs are documented in the following format: **** - A parameter that must be defined for the config to be valid. - Default: `Default value` A parameter that may optionally be defined but is not essential. Example ``` : ... # Object matching the parameter type : ... ``` *Some documented configs may not contain any optional parameters and or an example config. ### Config Specific Objects Some parameters may require a type specific to that particular config. In these cases, the documentation of that contained type will be included in the main config’s documentation: **ExampleConfig** A config containing a parameter that requires an object specific to the config. example-object `ConfigSpecificObject` **ConfigSpecificObject** An object specific to ExampleConfig. object-parameter `String` ExampleConfig Example ``` example-object: object-parameter: A string. ``` ``` -------------------------------- ### Invalid AnimalTemplate Configuration Source: https://terra.polydev.org/config/development/config-system.html Examples of configurations that fail validation due to missing or incorrectly typed parameters. ```YAML legs: two ``` ```JSON { "legs": "two" } ``` -------------------------------- ### Configure ocean palette and water level Source: https://terra.polydev.org/config/development/pack-from-scratch/oceans.html Add the ocean block palette and water level settings to the existing ocean_biome.yml file. ```yaml 1id: OCEAN_BIOME 2type: BIOME 3 4vanilla: minecraft:ocean 5 6... 7 8palette: 9 - SAND_PALETTE: 319 10 - BLOCK:minecraft:bedrock: -61 11 12ocean: 13 palette: BLOCK:minecraft:water 14 level: 62 ``` -------------------------------- ### Equivalent JSON Map Configurations Source: https://terra.polydev.org/config/development/config-data.html Demonstrates that key-value pair ordering in maps is insignificant. ```JSON { "a": 1234, "b": "Some text", "c": true } ``` ```JSON { "b": "Some text", "c": true, "a": 1234 } ``` -------------------------------- ### Basic Function Declaration Source: https://terra.polydev.org/config/documentation/terrascript/syntax.html Illustrates the basic syntax for declaring a function with arguments. ```TerraScript function(arg1, arg2); ``` -------------------------------- ### Referencing a Biome ID Source: https://terra.polydev.org/config/documentation/objects/Biome.html Biomes are referenced by their ID. This example shows how a BIOME config with an ID of FOREST is referenced. ```plaintext biome: FOREST ``` -------------------------------- ### Gradle Build File (Kotlin DSL) Source: https://terra.polydev.org/api/intro/development-environment.html Configure project dependencies and repositories using Gradle with Kotlin DSL. Ensure API_VERSION and LOADER_VERSION are defined. ```gradle plugins { java } group = "com.dfsek" version = "0.1.0" repositories { mavenCentral() maven { url = uri("https://repo.codemc.io/repository/maven-public/") } } dependencies { testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") compileOnly("com.dfsek.terra:api:API_VERSION") compileOnly("com.dfsek.terra:manifest-addon-loader:LOADER_VERSION") } tasks.getByName("test") { useJUnitPlatform() } ``` -------------------------------- ### Invalid YAML Key Assignment Source: https://terra.polydev.org/config/development/config-data.html Examples of invalid YAML due to multiple values assigned to a single key. ```YAML key: foo baz: bar ``` ```YAML key: baz: bar ``` ```YAML key: foo ``` ```YAML key: foo missing: baz: bar ``` ```YAML key: foo baz: bar ``` -------------------------------- ### Gradle Build File (Groovy DSL) Source: https://terra.polydev.org/api/intro/development-environment.html Configure project dependencies and repositories using Gradle with Groovy DSL. Ensure API_VERSION and LOADER_VERSION are defined. ```gradle plugins { id 'java' } group 'com.dfsek' version '0.1.0' repositories { mavenCentral() maven { url "https://repo.codemc.io/repository/maven-public/" } } dependencies { testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' compileOnly 'com.dfsek.terra:api:API_VERSION' compileOnly 'com.dfsek.terra:manifest-addon-loader:LOADER_VERSION' } test { useJUnitPlatform() } ``` -------------------------------- ### Java Addon Entry Point Implementation Source: https://terra.polydev.org/api/intro/creating-simple-addon.html Implement the `AddonInitializer` interface in your Java class to define the addon's entry point. The class name must match the `entrypoints` value in your `terra.addon.yml` manifest. ```java package com.example.addon; import com.dfsek.terra.addons.manifest.api.AddonInitializer; public class ExampleEntryPoint implements AddonInitializer { @Override public void initialize() { } } ``` -------------------------------- ### Invalid Pack ID Configuration Source: https://terra.polydev.org/config/development/modifying-existing-pack.html Example of an incorrectly formatted pack.yml file with an invalid pack ID containing spaces. ```yaml id: custom id ``` -------------------------------- ### Define the pipeline source Source: https://terra.polydev.org/config/development/pack-from-scratch/pipeline.html Set the initial biome layout source using a sampler and a weighted list of biomes. ```yaml 1id: YOUR_PACK_ID 2 3... 4 5biomes: 6 type: PIPELINE 7 resolution: 4 8 blend: 9 amplitude: 2 10 sampler: 11 type: OPEN_SIMPLEX_2 12 frequency: 0.1 13 pipeline: 14 source: 15 type: SAMPLER 16 sampler: 17 dimensions: 2 18 type: CONSTANT 19 biomes: 20 - land: 1 ``` -------------------------------- ### recursions Function Source: https://terra.polydev.org/config/documentation/terrascript/functions.html Gets the number of recursions that have occurred prior to the generation of the current structure, useful for preventing infinite recursion. ```APIDOC ## recursions Function ### Description Gets the number of recursions that have occurred prior to the generation of the structure. Useful for preventing infinite recursion. ### Method N/A (TerraScript Function) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Arguments None ### Request Example ``` recursions() ``` ### Response #### Success Response (NUMBER) Returns the number of recursions that have occurred. #### Response Example ``` 1 ``` ``` -------------------------------- ### Get Structure Registry from ConfigPack Source: https://terra.polydev.org/api/concepts/registries.html Retrieves the unique registry holding instances of Structure from a config pack. Use this when you need to read from a registry. ```java pack.getRegistry(Structure.class); ``` -------------------------------- ### Maven Build File (pom.xml) Source: https://terra.polydev.org/api/intro/development-environment.html Configure project dependencies and repositories using Maven. Ensure API_VERSION and LOADER_VERSION are defined and the Java compiler source/target are set to 17. ```xml 4.0.0 com.dfsek ExampleAddonMaven 0.1.0 17 17 CodeMC CodeMC Maven Repository https://repo.codemc.io/repository/maven-public/ com.dfsek.terra api API_VERSION provided com.dfsek.terra manifest-addon-loader LOADER_VERSION provided ``` -------------------------------- ### Accessing the Functional Event Handler Source: https://terra.polydev.org/api/concepts/events.html Get the default FunctionalEventHandler instance from the Event Manager. This handler is used for registering event listeners with a functional style. ```java platform.getEventManager() .getHandler(FunctionalEventHandler.class); ``` -------------------------------- ### POSTERIZATION Sampler Source: https://terra.polydev.org/config/documentation/objects/NoiseSampler.html Applies a step function to sampler output. Requires the 'config-noise-function' addon. ```yaml type: POSTERIZATION steps: 5 sampler: { ... } # Replace with a noise sampler ``` -------------------------------- ### Get TypeKey from Class Instance Source: https://terra.polydev.org/api/concepts/type-key.html Use TypeKey.of(Class) to obtain a TypeKey for non-generic types, reducing boilerplate compared to manual anonymous class creation. ```java TypeKey = TypeKey.of(Something.class); ``` -------------------------------- ### List Configuration Source: https://terra.polydev.org/config/development/config-data.html Defines a collection where item order is significant. ```YAML - A string - Another string - The final string ``` ```JSON [ "A string", "Another string", "The final string" ] ``` -------------------------------- ### Basic Ore Feature Configuration Source: https://terra.polydev.org/config/development/pack-from-scratch/ores.html Defines the basic properties for an ore feature, including its ID and type. This is the initial setup before adding distribution and locator details. ```yaml 1id: COAL_ORE_FEATURE 2type: FEATURE ``` -------------------------------- ### Configure Weighted Block Structures Source: https://terra.polydev.org/config/development/pack-from-scratch/grass.html Create a weighted list of blocks for feature generation using a noise sampler to guide selection. Each block entry can be assigned a weight. ```yaml structures: distribution: type: WHITE_NOISE salt: 4357 structures: - BLOCK:minecraft:poppy: 1 - BLOCK:minecraft:blue_orchid: 1 - BLOCK:minecraft:dandelion: 1 ``` -------------------------------- ### Log Messages at Different Levels Source: https://terra.polydev.org/api/concepts/logging.html Demonstrates how to log messages using a Logger instance at four different severity levels: DEBUG, INFO, WARN, and ERROR. ```java logger.debug("This is a message!") logger.info("This is a message!") logger.warn("This is a message!") logger.error("This is a message!") ``` -------------------------------- ### POSTERIZATION Source: https://terra.polydev.org/config/documentation/objects/NoiseSampler.html Applies a step function to the sampler. ```APIDOC ## POSTERIZATION ### Description Applies a step function to the sampler, where 'steps' determines how many steps will be within the range [-1, 1]. ### Request Body - **sampler** (NoiseSampler) - Required - The input sampler. - **steps** (Integer) - Required - Number of steps. ``` -------------------------------- ### Reference Variables in TerraScript Source: https://terra.polydev.org/config/documentation/terrascript/syntax.html Use a variable's identifier within an expression to access its current value. This example demonstrates printing a variable's value concatenated with a string. ```TerraScript num number = 3; print("Number: " + number); ``` -------------------------------- ### String Concatenation for Log Messages Source: https://terra.polydev.org/api/concepts/logging.html An example of logging a message using string concatenation, which can lead to performance overhead. This method is less efficient than SLF4J's string formatting. ```java logger.info("Got " + amount + " " + food + " from grocery store."); ``` -------------------------------- ### Add pipeline blending configuration Source: https://terra.polydev.org/config/development/pack-from-scratch/pipeline.html Configure blending using OPEN_SIMPLEX_2 to warp biome edges and reduce blockiness. ```yaml 1id: YOUR_PACK_ID 2 3... 4 5biomes: 6 type: PIPELINE 7 resolution: 4 8 blend: 9 amplitude: 2 10 sampler: 11 type: OPEN_SIMPLEX_2 12 frequency: 0.1 ``` -------------------------------- ### Create Registry Key Source: https://terra.polydev.org/api/intro/adding-structure.html Creates a unique registry key for a structure using the addon's namespace. This key is essential for registering the structure. ```java RegistryKey key = addon.key("EXAMPLE_STRUCTURE"); // Create our registry key ``` -------------------------------- ### Include Feature in Biome Configuration Source: https://terra.polydev.org/api/intro/adding-structure.html Includes the custom structure feature in a biome configuration by adding its ID to the 'features' list within the biome's definition. This example shows adding it to the PLAINS biome. ```yaml id: PLAINS type: BIOME extends: [ EQ_PLAIN, CARVING_LAND, BASE ] vanilla: minecraft:plains color: $biomes/colors.yml:PLAINS tags: - USE_RIVER colors: grass: 0x91bd59 foliage: 0x77ab2f water: 0x44aff5 water-fog: 0x44aff5 palette: - GRASS: 255 - << meta.yml:palette-bottom features: flora: - GRASS - FLOWER_PATCHES trees: - SPARSE_OAK_TREES - EXAMPLE_FEATURE # Our feature! ``` -------------------------------- ### Configure Pack Manifest Generation Stages Source: https://terra.polydev.org/config/development/pack-from-scratch/carving.html Add a preprocessors stage to the pack manifest to handle the floating water feature. ```yaml 1id: YOUR_PACK_ID 2 3... 4 5stages: 6 - id: preprocessors 7 type: FEATURE 8 9 - id: trees 10 type: FEATURE 11 12 - id: flora 13 type: FEATURE ``` -------------------------------- ### Successful Pack Loading Confirmation Source: https://terra.polydev.org/config/development/modifying-existing-pack.html Console output indicating that a custom pack has been successfully loaded by Terra. ```log [XX:XX:XX INFO]: [Terra] Loading config pack "CUSTOM" [XX:XX:XX INFO]: [Terra] CUSTOM by loaded in XXXX.XXXXms. ``` -------------------------------- ### Obtain Class-Specific Logger with LoggerFactory Source: https://terra.polydev.org/api/concepts/logging.html Use SLF4J's LoggerFactory to get a Logger instance specific to your class when not in a Manifest Addon Loader entry point. The logger field should be private static final. ```java private static final Logger logger = LoggerFactory.getLogger(MyClass.class); // MyClass should be the class you're getting a logger for. ``` -------------------------------- ### Define Biome Configuration Source: https://terra.polydev.org/config/development/pack-from-scratch/introduction.html Configures a new biome with an ID, type, and vanilla reference. ```yaml 1id: FIRST_BIOME 2 3type: BIOME ``` ```yaml 1id: FIRST_BIOME 2type: BIOME 3 4vanilla: minecraft:plains ``` -------------------------------- ### Define Abstract Carving Config Source: https://terra.polydev.org/config/development/pack-from-scratch/carving.html Create a blank config file to define an abstract carving configuration that biomes can extend. Set the config type, ID, and mark it as abstract. This setup allows for easy inheritance of carving properties. ```yaml id: CARVING_LAND type: BIOME abstract: true ``` -------------------------------- ### Multi-line Expressions in YAML Source: https://terra.polydev.org/config/documentation/objects/Expression.html Illustrates the recommended YAML block style syntax using the `|` character for defining multi-line expressions, ensuring proper parsing. ```yaml expression: | atan2( 1 + 45, 4 / 8 ) ``` -------------------------------- ### Correct Pack Manifest Location Source: https://terra.polydev.org/config/development/modifying-existing-pack.html Shows the correct placement of the pack.yml file directly within the custom pack directory. ```text Terra/ ├── packs/ ┆ ├── default.zip └── custom-pack/ ├── pack.yml ┆ ``` -------------------------------- ### Configure Palette Layers Source: https://terra.polydev.org/config/development/pack-from-scratch/palette.html Define the material composition and vertical thickness for each layer in the palette. ```yaml 1id: GRASS_PALETTE 2type: PALETTE 3 4layers: 5 # Top palette layer 6 - materials: minecraft:grass_block 7 layers: 1 8 9 # Second palette layer that will be 2 layers thick 10 - materials: minecraft:dirt 11 layers: 2 12 13 # Last palette layer. Also will make up the rest of the palette 14 - materials: minecraft:stone 15 layers: 1 # ``` -------------------------------- ### NoiseSampler Configuration Source: https://terra.polydev.org/config/documentation/objects/NoiseSampler.html General information about Noise Samplers and how to specify their types. ```APIDOC ## NoiseSampler Configuration A sampler is a config defined function that provides a value when given a position and seed. A ‘sample’ is defined as the value produced by a single calculation provided by a sampler. A collective set of samples is regarded as ‘noise’. Noise produced by noise samplers determine some kind of behaviour for each block or column. This behaviour is dependent on the context of the sampler definition. ### Specifying Noise Sampler Type Different types of `NoiseSampler` provide different behaviours and may have additional parameters for configuring that behavior. The type is specified by setting the `type` parameter to the name of the type. If the same name is used by two different addons, you can prefix the name with `ADDON_NAME:` to specify which one to use. A list of available types for `NoiseSampler` are listed below. ``` -------------------------------- ### Advanced FBM Fractalizer Configuration Source: https://terra.polydev.org/config/development/noise/configuring.html An FBM fractalizer configuration including optional parameters for octaves, lacunarity, and gain. ```yaml type: FBM sampler: type: OPEN_SIMPLEX_2 octaves: 3 lacunarity: 2 gain: 0.75 ``` -------------------------------- ### Multi-line Function Arguments Source: https://terra.polydev.org/config/documentation/objects/Expression.html Shows how to use whitespace to split function arguments across multiple lines for improved readability. This is particularly useful for complex expressions. ```terra atan2( 1 + 45, 4 / 8 ) ``` -------------------------------- ### For Loop Iteration Source: https://terra.polydev.org/config/documentation/terrascript/syntax.html Demonstrates a for loop with initializer, conditional, and incrementer expressions. ```TerraScript for(num x = 0; x < 5; x = x + 1) { print("Number: " + aNumber); } ``` -------------------------------- ### Create Terra World with Multiverse Core Source: https://terra.polydev.org/install/worldmanager-bukkit-world-creation.html Use this command to create a new world with a specified Terra generator pack. Replace `` with the ID of your desired Terra pack, such as `OVERWORLD`. ```bash /mv create example_world NORMAL -g Terra:OVERWORLD ``` -------------------------------- ### Configure feature distributor Source: https://terra.polydev.org/config/development/pack-from-scratch/grass.html Set the x and z axis placement logic using the POSITIVE_WHITE_NOISE distributor. ```yaml 1id: GRASS_FEATURE 2type: FEATURE 3 4distributor: 5 type: SAMPLER 6 sampler: 7 type: POSITIVE_WHITE_NOISE 8 threshold: 0.25 ``` -------------------------------- ### Configure White Noise with Salt Source: https://terra.polydev.org/config/development/noise/configuring.html Adding the optional salt parameter to a white noise sampler configuration. ```yaml type: WHITE_NOISE salt: 2321 ```