### Setting owo-config Annotation Processor Dependency (Groovy) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/config/getting-started.md Adds the required `owo-lib` dependency as an `annotationProcessor` in the Gradle build script. This enables the annotation processor responsible for generating the config wrapper class during the build process. ```groovy dependencies { annotationProcessor modImplementation("io.wispforest:owo-lib:${project.owo_version}") } ``` -------------------------------- ### Applying a Surface (Background) to Root Component - Java Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/getting-started.md This snippet shows how to use the `build()` method to configure the root component. It applies `Surface.VANILLA_TRANSLUCENT` as the background, giving the screen the standard dark, translucent look common in vanilla Minecraft UIs. ```java @Override protected void build(FlowLayout rootComponent) { rootComponent.surface(Surface.VANILLA_TRANSLUCENT); } ``` -------------------------------- ### Integrating owo-config with ModMenu (Java) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/config/getting-started.md Demonstrates how to make the generated config screen accessible via the ModMenu mod. This is achieved by applying the `@Modmenu` annotation to the config model class and providing your mod's identifier. ```java @Modmenu(modId = "mymodid") @Config(name = "my-config", wrapperName = "MyConfig") public class MyConfigModel { ... } ``` -------------------------------- ### Loading Generated owo-config Wrapper (Java) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/config/getting-started.md Shows how to load the generated config wrapper class (e.g., `MyConfig`) within your mod's main initializer. The static method `createAndLoad()` instantiates the wrapper and loads the configuration from its file, making the config values accessible. ```java public class MyModInitializer implements ModInitializer { ... public static final MyConfig CONFIG = MyConfig.createAndLoad(); ... } ``` -------------------------------- ### Creating Config Sections with SectionHeader (Java) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/config/getting-started.md Shows how to organize config options into visual sections within the generated UI. Applying the `@SectionHeader` annotation to a field in the model class creates a header before that option and allows navigation via a sidebar. ```java @Config(name = "my-config", wrapperName = "MyConfig") public class MyConfigModel { public String firstOption = "1"; ... // many more options @SectionHeader("someSection") public String someLaterOption = "42"; } ``` -------------------------------- ### Initializing OwoUIAdapter in createAdapter - Java Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/getting-started.md This code demonstrates how to initialize the OwoUIAdapter within the `createAdapter()` method. It uses `OwoUIAdapter.create()` and specifies the screen instance (`this`) and a root component factory, in this case, `Containers::verticalFlow` for a vertical FlowLayout. ```java @Override protected @NotNull OwoUIAdapter createAdapter() { return OwoUIAdapter.create(this, Containers::verticalFlow); } ``` -------------------------------- ### Extending BaseOwoScreen and Implementing Methods - Java Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/getting-started.md This snippet shows the initial structure of a screen class using the code-driven approach with owo-ui. It extends `BaseOwoScreen` with a `FlowLayout` root component and implements the required `createAdapter()` and `build(...)` methods. This sets up the basic framework for building the UI. ```java public class MyFirstScreen extends BaseOwoScreen { @Override protected @NotNull OwoUIAdapter createAdapter() { // TODO } @Override protected void build(FlowLayout rootComponent) { // TODO } } ``` -------------------------------- ### Configuring Generated Sources for Eclipse (Groovy) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/config/getting-started.md Provides specific Gradle build configuration required for Eclipse IDE users. These lines add the annotation processor's output directory (`src/main/generatedJava`) to the main source set and configure the compiler to place generated sources there, ensuring Eclipse recognizes them. ```groovy sourceSets.main.java.srcDirs += [ 'src/main/generatedJava' ] compileJava.options.generatedSourceOutputDirectory = file("${projectDir}/src/main/generatedJava/") ``` -------------------------------- ### Adding a Styled Container with Button to Root Component - Java Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/getting-started.md This advanced example within the `build()` method demonstrates nesting. It adds a `Containers.verticalFlow` with content-based sizing as a child to the root component. This nested container is then styled with padding, a dark panel surface, and centered alignment, before adding the button component inside it. ```java @Override protected void build(FlowLayout rootComponent) { rootComponent .surface(Surface.VANILLA_TRANSLUCENT) .horizontalAlignment(HorizontalAlignment.CENTER) .verticalAlignment(VerticalAlignment.CENTER); rootComponent.child( Containers.verticalFlow(Sizing.content() /*(1)*/, Sizing.content()) .child(Components.button(Text.literal("A Button"), button -> { System.out.println("click"); })) .padding(Insets.of(10)) // (2) .surface(Surface.DARK_PANEL) .verticalAlignment(VerticalAlignment.CENTER) .horizontalAlignment(HorizontalAlignment.CENTER) ); } ``` -------------------------------- ### Adding Options to owo-config Model (Java) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/config/getting-started.md Demonstrates how to add configuration options by declaring public fields within the `@Config`-annotated model class. Fields can be primitive types, enums, or other supported types, and their default values are set directly in the declaration. ```java @Config(name = "my-config", wrapperName = "MyConfig") public class MyConfigModel { public int anIntOption = 16; public boolean aBooleanToggle = false; public Choices anEnumOption = Choices.ANOTHER_CHOICE; public enum Choices { A_CHOICE, ANOTHER_CHOICE; } } ``` -------------------------------- ### Creating Basic owo-ui XML Model Structure (XML) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/getting-started.md Sets up the initial XML file structure for an owo-ui model. It includes the root `` element, XML schema instance namespace (`xsi`), schema location for IDE validation, and the empty `` container where the UI hierarchy will be defined. ```xml ``` -------------------------------- ### Defining Basic owo-config Model Class (Java) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/config/getting-started.md Defines the initial config model class, which describes the structure of your configuration. The `@Config` annotation is applied, specifying the config filename (`name`) and the name of the generated wrapper class (`wrapperName`). This class is not used directly after generation. ```java @Config(name = "my-config", wrapperName = "MyConfig") public class MyConfigModel { ... } ``` -------------------------------- ### Defining Base Data-Driven UI Screen Class (Java) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/getting-started.md Defines a basic Java class `MyScreen` that extends `BaseUIModelScreen` with a `FlowLayout` root. This serves as the entry point for a data-driven UI screen, providing methods to specify the data source and interact with components after the model is built. ```java public class MyScreen extends BaseUIModelScreen { public MyScreen() { super(FlowLayout.class, /* TODO */); } @Override protected void build(FlowLayout rootComponent) { // TODO } } ``` -------------------------------- ### Adding Maven Repositories Groovy Gradle Source: https://github.com/wisp-forest/docs/blob/main/docs/accessories/developer/dev_setup.md Adds the necessary Maven repositories to your `build.gradle` file (Groovy syntax). These repositories are required to resolve the Accessories mod artifacts and other dependencies. ```Groovy maven { url 'https://maven.wispforest.io/releases' } maven { url 'https://maven.su5ed.dev/releases' } maven { url 'https://maven.fabricmc.net' } ``` -------------------------------- ### Defining UI Structure with Nested Components (XML) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/getting-started.md Specifies a UI layout in XML using nested `` elements and a ` center center 10 center center ``` -------------------------------- ### Centering and Adding a Button to Root Component - Java Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/getting-started.md This code extends the `build()` method by adding alignment properties (`CENTER` horizontally and vertically) to the root component and then adding a simple button (`Components.button`) as a child. The button is configured with text and a click action that prints to the console. ```java @Override protected void build(FlowLayout rootComponent) { rootComponent .surface(Surface.VANILLA_TRANSLUCENT) .horizontalAlignment(HorizontalAlignment.CENTER) .verticalAlignment(VerticalAlignment.CENTER); rootComponent.child( Components.button( Text.literal("A Button"), button -> { System.out.println("click"); } // (1) ) ); } ``` -------------------------------- ### Adding Maven Repositories Kotlin Gradle Source: https://github.com/wisp-forest/docs/blob/main/docs/accessories/developer/dev_setup.md Adds the necessary Maven repositories to your `build.gradle.kts` file (Kotlin syntax). These repositories are required to resolve the Accessories mod artifacts and other dependencies. ```Kotlin maven("https://maven.wispforest.io/releases") maven("https://maven.su5ed.dev/releases") maven("https://maven.fabricmc.net") ``` -------------------------------- ### Defining Nested Config Objects (Java) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/config/getting-started.md Explains how to create nested, collapsable sections in the config UI. This is done by defining an inner static class for the nested options and applying the `@Nest` annotation to a field of that inner class type within the main config model. ```java @Config(name = "my-config", wrapperName = "MyConfig") public class MyConfigModel { ... @Nest public ThisIsNested nestedObject = new ThisIsNested(); public static class ThisIsNested { public boolean aNestedValue = false; public int anotherNestedValue = 42; } } ``` -------------------------------- ### Implementing Limelight Entrypoint - Java Source: https://github.com/wisp-forest/docs/blob/main/docs/limelight/extending/setup.md Provides an example implementation of the LimelightEntrypoint interface. The registerExtensions method is where custom Limelight extensions should be registered using the provided extensionRegistry, and this class is referenced in fabric.mod.json. ```java package com.example.exampleextension; import io.wispforest.limelight.api.LimelightEntrypoint; import io.wispforest.limelight.api.extension.LimelightExtension; import java.util.function.Consumer; public class ExampleLimelightCompat implements LimelightEntrypoint { @Override public void registerExtensions(Consumer extensionRegistry) { // Register extensions here! } } ``` -------------------------------- ### Setting Asset Data Source for UI Model (Java) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/getting-started.md Updates the `MyScreen` constructor to load the UI model from a resource pack asset. It uses `DataSource.asset` with an `Identifier` specifying the mod namespace and the path within the `assets//owo_ui/` directory, enabling resource pack overrides. ```java public MyScreen() { super(FlowLayout.class, DataSource.asset(new Identifier("mymod", "my_ui_model"))); } ``` -------------------------------- ### Querying XML Component and Attaching Handler (Java) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/getting-started.md Implements the `build` method to access a component defined in the XML model by its ID. It uses `rootComponent.childById()` with the target component type and ID to retrieve the button and attaches an event handler (`onPress`) to perform an action when the button is clicked. ```java @Override protected void build(FlowLayout rootComponent) { rootComponent.childById(ButtonComponent.class, "the-button").onPress(button -> { System.out.println("click"); }); } ``` -------------------------------- ### Adding Neoforge Dependency Kotlin Gradle Source: https://github.com/wisp-forest/docs/blob/main/docs/accessories/developer/dev_setup.md Adds the Neoforge-specific version of the Accessories mod as an `implementation` dependency in your Kotlin Gradle build script (`build.gradle.kts`). Retrieves the version from project properties. ```Kotlin dependencies { implementation("io.wispforest:accessories-neoforge:${properties["accessories_version"]}") } ``` -------------------------------- ### Creating Basic Owo Item Group (Java) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/item-groups.md Demonstrates the basic creation and registration of an Owo Item Group using the builder pattern. It shows how to start building an Owo Item Group using OwoItemGroup.builder(), requiring an identifier for registration and a supplier function for the icon, followed by the final .build() call. This is the fundamental step before adding tabs or buttons. ```Java public static final OwoItemGroup GROUP = OwoItemGroup .builder(new Identifier("mod-id", "item_group"), () => Icon.of(Mod.ITEM)) // additional builder configuration goes between these lines .build(); ``` -------------------------------- ### Adding Neoforge Dependency Groovy Gradle Source: https://github.com/wisp-forest/docs/blob/main/docs/accessories/developer/dev_setup.md Adds the Neoforge-specific version of the Accessories mod as an `implementation` dependency in your Groovy Gradle build file. This requires defining the `accessories_version` property in your `gradle.properties`. ```Groovy dependencies { implementation("io.wispforest:accessories-neoforge:${project.accessories_version}") } ``` -------------------------------- ### Adding Common Vanilla Dependency Groovy Gradle Source: https://github.com/wisp-forest/docs/blob/main/docs/accessories/developer/dev_setup.md Adds the common version of the Accessories mod as `compileOnly` dependencies for Vanilla Gradle builds, supporting both Yarn Intermediary and Mojang mappings. This requires the `accessories_version` property. ```Groovy dependencies { // Yarn Intermediary compileOnly("io.wispforest:accessories-common:${project.accessories_version}") // Mojang Mappings compileOnly("io.wispforest:accessories-common:${project.accessories_version}-mojmap") } ``` -------------------------------- ### Cloning Wisp Forest Docs Repository (Recursive) Source: https://github.com/wisp-forest/docs/blob/main/README.md This command clones the Wisp Forest documentation repository and also initializes and updates all submodules, specifically including the theme submodule. This is necessary if you plan to build the documentation site locally. ```Shell git clone https://github.com/wisp-forest/docs --recursive ``` -------------------------------- ### Adding Neoforge Arch Dependency Groovy Gradle Source: https://github.com/wisp-forest/docs/blob/main/docs/accessories/developer/dev_setup.md Adds the Neoforge version of the Accessories mod along with specific runtime libraries required for a multiloader Arch build in your Groovy Gradle file. This configuration addresses potential dependency resolution issues. ```Groovy dependencies { modImplementation("io.wispforest:accessories-neoforge:${project.accessories_version}") // Required due to issues with JIJ dependency resolving in arch or something forgeRuntimeLibrary("blue.endless:jankson:1.2.2") forgeRuntimeLibrary("io.wispforest:endec:0.1.9") forgeRuntimeLibrary("io.wispforest.endec:gson:0.1.5") forgeRuntimeLibrary("io.wispforest.endec:jankson:0.1.6") forgeRuntimeLibrary("io.wispforest.endec:netty:0.1.6") } ``` -------------------------------- ### Example Limelight MkDocs Wiki Resource (JSON) Source: https://github.com/wisp-forest/docs/blob/main/docs/limelight/configuring/adding_wikis.md Provides a concrete example of a JSON resource file (`wisp_forest.json`) for defining a custom wiki in Limelight. It sets the wiki type to `limelight:mkdocs`, provides a title, a `bang_key` for quick searching (`wispforest`), and specifies the `source` URL and includes a flag to disable paragraph inclusion. This file would be placed in a resource pack to add the 'Wisp Forest' wiki. ```json { "type": "limelight:mkdocs", "title": "Wisp Forest", "bang_key": "wispforest", "source": { "url": "https://docs.wispforest.io", "includeParagraphs": false } } ``` -------------------------------- ### Adding Neoforge Arch Dependency Kotlin Gradle Source: https://github.com/wisp-forest/docs/blob/main/docs/accessories/developer/dev_setup.md Adds the Neoforge version of the Accessories mod along with specific runtime libraries required for a multiloader Arch build in your Kotlin Gradle file. This configuration addresses potential dependency resolution issues. ```Kotlin dependencies { modImplementation("io.wispforest:accessories-neoforge:${properties["accessories_version"]}") // Required due to issues with JIJ dependency resolving in arch or something forgeRuntimeLibrary("blue.endless:jankson:1.2.2") forgeRuntimeLibrary("io.wispforest:endec:0.1.9") forgeRuntimeLibrary("io.wispforest.endec:gson:0.1.5") forgeRuntimeLibrary("io.wispforest.endec:jankson:0.1.6") forgeRuntimeLibrary("io.wispforest.endec:netty:0.1.6") } ``` -------------------------------- ### Adding Common Arch Dependency Groovy Gradle Source: https://github.com/wisp-forest/docs/blob/main/docs/accessories/developer/dev_setup.md Adds the common, architecture-independent version of the Accessories mod as a `modImplementation` dependency for a multiloader Arch build in your Groovy Gradle file. This requires defining the `accessories_version` property. ```Groovy dependencies { modImplementation("io.wispforest:accessories-common:${project.accessories_version}") } ``` -------------------------------- ### Adding Common Vanilla Dependency Kotlin Gradle Source: https://github.com/wisp-forest/docs/blob/main/docs/accessories/developer/dev_setup.md Adds the common version of the Accessories mod as `compileOnly` dependencies for Vanilla Gradle builds using either Yarn Intermediary or Mojang mappings. Retrieves the version from project properties. ```Kotlin dependencies { // Yarn Intermediary compileOnly("io.wispforest:accessories-common:${properties["accessories_version"]}") // Mojang Mappings compileOnly("io.wispforest:accessories-common:${properties["accessories_version"]}-mojmap") } ``` -------------------------------- ### Adding Common Arch Dependency Kotlin Gradle Source: https://github.com/wisp-forest/docs/blob/main/docs/accessories/developer/dev_setup.md Adds the common, architecture-independent version of the Accessories mod as a `modImplementation` dependency for a multiloader Arch build in your Kotlin Gradle file. Retrieves the version from project properties. ```Kotlin dependencies { modImplementation("io.wispforest:accessories-common:${properties["accessories_version"]}") } ``` -------------------------------- ### Adding Fabric Dependency Kotlin Gradle Source: https://github.com/wisp-forest/docs/blob/main/docs/accessories/developer/dev_setup.md Adds the Fabric-specific version of the Accessories mod as a `modImplementation` dependency in your Kotlin Gradle build script (`build.gradle.kts`). Retrieves the version from project properties. ```Kotlin dependencies { modImplementation("io.wispforest:accessories-fabric:${properties["accessories_version"]}") } ``` -------------------------------- ### Adding Maven Repository - Gradle Groovy Source: https://github.com/wisp-forest/docs/blob/main/docs/lavender/setup.md This Gradle Groovy snippet adds the Wisp Forest Maven repository to the repositories block in your build.gradle file. This step is required for Gradle to locate and download the Lavender library. ```Groovy repositories { maven { url 'https://maven.wispforest.io' } } ``` -------------------------------- ### Adding Fabric Dependency Groovy Gradle Source: https://github.com/wisp-forest/docs/blob/main/docs/accessories/developer/dev_setup.md Adds the Fabric-specific version of the Accessories mod as a `modImplementation` dependency in your Groovy Gradle build file. This requires defining the `accessories_version` property in your `gradle.properties`. ```Groovy dependencies { modImplementation("io.wispforest:accessories-fabric:${project.accessories_version}") } ``` -------------------------------- ### Declaring Library Dependencies - Gradle Groovy Source: https://github.com/wisp-forest/docs/blob/main/docs/lavender/setup.md This snippet for the dependencies block in build.gradle declares the Lavender library as a mod implementation dependency. It also optionally includes owo-sentinel, which helps players easily acquire the owo-lib dependency. Versions are referenced from project properties. ```Groovy dependencies { modImplementation "io.wispforest:lavender:${project.lavender_version}" include "io.wispforest:owo-sentinel:${project.owo_version}" // check owo's page for this version } ``` -------------------------------- ### Cloning Wisp Forest Docs Repository (Standard) Source: https://github.com/wisp-forest/docs/blob/main/README.md This command clones the main Wisp Forest documentation repository from GitHub. It is suitable if you only need to make minor text modifications and do not require building the site locally or accessing the theme submodule. ```Shell git clone https://github.com/wisp-forest/docs ``` -------------------------------- ### Updating Version String in Docs - JavaScript Source: https://github.com/wisp-forest/docs/blob/main/docs/lavender/setup.md This client-side script listens for a custom 'version-available' event and updates a placeholder ('...') within an HTML element with the class 'lavender-version-container'. It dynamically displays the actual version number provided by the event. ```JavaScript window.addEventListener('version-available', event => { const code = document.querySelector(".lavender-version-container").firstChild; code.innerHTML = code.innerHTML.replaceAll("...", event.detail); }) ``` -------------------------------- ### Defining Limelight Version - Gradle Properties Source: https://github.com/wisp-forest/docs/blob/main/docs/limelight/extending/setup.md Specifies the Limelight version to be used in the project's build configuration. This variable is typically referenced in build.gradle to manage dependencies and requires a Gradle build setup. ```properties limelight_version=... ``` -------------------------------- ### Defining Lavender Version Property - Gradle Properties Source: https://github.com/wisp-forest/docs/blob/main/docs/lavender/setup.md This .properties snippet defines the 'lavender_version' property in your gradle.properties file. This property is used in build.gradle to specify which version of the Lavender library to use. The '...' is a placeholder for the actual version number. ```Properties # https://maven.wispforest.io/io/wispforest/lavender/ lavender_version=... ``` -------------------------------- ### Declaring owo-lib Dependency (Gradle Neoforge) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/setup.md This Groovy snippet provides dependency declarations for integrating the owo-lib library into a Neoforge mod project's `build.gradle`. It shows different configurations (`implementation`, `accessTransformer`, `interfaceInjectionData`, `modImplementation`) required depending on the project setup (Moddev Projects vs. Arch Loom Projects), all using the `owo_version` property. ```Groovy dependencies { // Moddev Projects - Neoforge implementation "io.wispforest:owo-lib-neoforge:${project.owo_version}" accessTransformer "io.wispforest:owo-lib-neoforge:${project.owo_version}" interfaceInjectionData "io.wispforest:owo-lib-neoforge:${project.owo_version}" // Arch Loom Projects - Neoforge modImplementation "io.wispforest:owo-lib-neoforge:${project.owo_version}" } ``` -------------------------------- ### Creating Basic Checkbox Java Example Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/components/checkbox.md Demonstrates how to create a checkbox programmatically using the Components.checkbox method with a literal text label and explicitly setting its initial state to unchecked (false). Requires the Components and Text classes. ```java Components.checkbox(Text.literal("Option")) .checked(false) ``` -------------------------------- ### Defining Checkbox Component XML Example Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/components/checkbox.md Shows how to define a checkbox using XML tags, specifying the text label, checked state (true), and active state (false) using nested elements. This represents the data-driven configuration approach. ```xml Option true false ``` -------------------------------- ### Defining Alloy Forge Fuels - Alloy Forgery - JSON Source: https://github.com/wisp-forest/docs/blob/main/docs/alloy-forgery/adding-recipes-and-fuels.md This JSON snippet provides an example of a file defining fuels for the Alloy Forge. It contains a list of fuel entries, each specifying the item that acts as fuel, the amount of fuel it provides, and an optional 'return_item' field for items like buckets. ```JSON { "fuels": [ { "item": "minecraft:lava_bucket", "return_item": "minecraft:bucket", "fuel": 24000 }, { "item": "minecraft:coal", "fuel": 1000 }, { "item": "minecraft:charcoal", "fuel": 1000 }, { "item": "minecraft:blaze_rod", "fuel": 2000 }, { "item": "minecraft:coal_block", "fuel": 9000 } ] } ``` -------------------------------- ### Performing Post-Registration Work with afterFieldProcessing Java Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/registration.md This snippet shows how to execute custom logic after oωo's `FieldRegistrationHandler` has finished processing the fields of a container class. By implementing the `afterFieldProcessing()` method, you can perform any necessary setup or tasks dependent on the registered objects. ```Java public class BlockInit implements BlockRegistryContainer { ... @Override public void afterFieldProcessing() { // do extra work here } } ``` -------------------------------- ### Set Changelog Mode with scatter upload (Shell) Source: https://github.com/wisp-forest/docs/blob/main/docs/scatter/upload.md This command shows how to use the `-l` or `--changelog-mode` flag to specify how the changelog for the upload should be handled. The mode can be `editor`, `file`, or `prompt`. In this specific example, it sets the mode to `file`, indicating the changelog should be read from a file. It requires the desired mode as an argument. ```shell scatter upload -l file ``` -------------------------------- ### Binding Default Slots to Entities JSON Configuration Source: https://github.com/wisp-forest/docs/blob/main/docs/accessories/general/binding_slots_to_entities.md This JSON snippet provides an example configuration file used within a data pack to define which entity types or tags are bound to a specific list of accessory slots. The `entities` field lists entity resource locations or tags (prefixed with `#`), and the `slots` field lists the names of the slots. This specific example binds a set of default slots to entities tagged with `#accessories:defaulted_targets`. ```json { "replace": false, "entities": [ "#accessories:defaulted_targets" ], "slots": [ "hat", "face", "necklace", "cape", "back", "hand", "ring", "wrist", "belt", "anklet", "shoes", "charm" ] } ``` -------------------------------- ### Updating owo Version Placeholder (Javascript) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/setup.md This Javascript snippet is designed for documentation pages. It listens for a custom `version-available` event on the window object and replaces a placeholder string ('...') within the first child of an element with the class 'owo-version-container' with the version provided in the event detail. ```Javascript window.addEventListener('version-available', event => { const code = document.querySelector(".owo-version-container").firstChild; code.innerHTML = code.innerHTML.replaceAll("...", event.detail); }) ``` -------------------------------- ### Registering Gadget Initialization Entrypoint (JSON) Source: https://github.com/wisp-forest/docs/blob/main/docs/gadget/packet-dumps/custom_packets.md Defines an entrypoint in the fabric.mod.json file under gadget:init. This entrypoint specifies a class (com.example.examplemod.ExampleGadgetEntrypoint) that will be executed when the gadget mod finishes its main initialization process. This is useful for setting up custom packet handlers or other gadget-specific logic. ```json { // ... "entrypoints": { "gadget:init": [ "com.example.examplemod.ExampleGadgetEntrypoint" ] }, // ... } ``` -------------------------------- ### Implementing Gadget Entrypoint (Java) Source: https://github.com/wisp-forest/docs/blob/main/docs/gadget/packet-dumps/custom_packets.md Defines a Java class that implements the io.wispforest.gadget.GadgetEntrypoint interface. The onGadgetInit() method within this class is the entrypoint specified in the fabric.mod.json. This method is the designated place to register custom packet unwrappers, renderers, or other gadget-related handlers when the mod is initialized. ```java package com.example.examplemod; import io.wispforest.gadget.GadgetEntrypoint; public class ExampleGadgetEntrypoint implements GadgetEntrypoint { @Override public void onGadgetInit() { // Register all your stuff here... } } ``` -------------------------------- ### Registering Limelight Entrypoint - JSON/Fabric Source: https://github.com/wisp-forest/docs/blob/main/docs/limelight/extending/setup.md Adds a "limelight" entrypoint to the fabric.mod.json file, specifying the fully qualified name of the class that implements LimelightEntrypoint. This allows Limelight to discover and load the compatibility class in a Fabric mod project. ```json { // ... "entrypoints": { "limelight": [ "com.example.exampleextension.ExampleLimelightCompat" ] }, // ... } ``` -------------------------------- ### Defining a Sell Dyed Armor Trade in JSON Source: https://github.com/wisp-forest/docs/blob/main/docs/numismatic-overhaul/trades.md This example shows the 'sell_dyed_armor' trade. The villager sells a piece of leather armor specified by 'item' with a random dye color for the given 'price'. ```json { "type": "numismatic-overhaul:sell_dyed_armor", "item": "minecraft:leather_boots", "price": 200730 } ``` -------------------------------- ### Defining a Sell Single Enchantment Trade in JSON Source: https://github.com/wisp-forest/docs/blob/main/docs/numismatic-overhaul/trades.md This example shows the 'sell_single_enchantment' trade. The villager sells an item enchanted with a single random enchantment. The price is calculated, optionally modified by 'price_multiplier'. ```json { "type": "numismatic-overhaul:sell_single_enchantment", "price_multiplier": 0.75 } ``` -------------------------------- ### Adding owo Maven Repository (Groovy) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/setup.md This Groovy code block demonstrates how to add the Wisp Forest Maven repository to the `repositories` section of your `build.gradle` file. Including this repository is essential for Gradle to locate and download the owo-lib dependency. ```Groovy repositories { maven { url 'https://maven.wispforest.io/releases/' } } ``` -------------------------------- ### Initializing Slider Component Java Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/components/slider.md This Java code snippet demonstrates how to create a slider component programmatically. It uses the builder pattern to set properties like size (filling 50% of available space), the text label "Volume", and enables the slider. It requires access to the framework's `Components`, `Sizing`, and `Text` utilities. ```Java Components.slider(Sizing.fill(50))\n .message(s -> Text.literal("Volume"))\n .active(true) ``` -------------------------------- ### Declaring owo-lib Dependency (Gradle Fabric) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/setup.md This Groovy snippet shows the necessary declarations within the `dependencies` block of a `build.gradle` file for integrating owo-lib into a Fabric mod project. It includes `owo-lib` using `modImplementation` and the `owo-sentinel` library using the `include` configuration, both referencing the `owo_version` property. ```Groovy dependencies { modImplementation "io.wispforest:owo-lib:${project.owo_version}" include "io.wispforest:owo-sentinel:${project.owo_version}" } ``` -------------------------------- ### Defining a Sell Map Trade in JSON Source: https://github.com/wisp-forest/docs/blob/main/docs/numismatic-overhaul/trades.md This example shows how to define a 'sell_map' trade. The villager sells a map that points to a specific structure ID ('structure') for a given price ('price'), awarding experience ('villager_experience'). ```json { "type": "numismatic-overhaul:sell_map", "structure": "minecraft:endcity", "price": 5, "villager_experience": 20 } ``` -------------------------------- ### Configuring Tokens scatter Shell Source: https://github.com/wisp-forest/docs/blob/main/docs/scatter/home.md This snippet demonstrates how to configure API tokens for different hosting platforms (Modrinth, CurseForge, GitHub) using the `scatter config --tokens` command. The user is prompted to select the platform and enter the token. ```Shell → scatter config --tokens Platform: Modrinth CurseForge GitHub ↑ Token (empty to remove): info: Token for platform 'github' updated ``` -------------------------------- ### Defining a Sell Stack Trade in JSON Source: https://github.com/wisp-forest/docs/blob/main/docs/numismatic-overhaul/trades.md This example shows the JSON format for a 'sell_stack' trade. The villager will sell the specified item stack ('sell') for the given price ('price'), with an optional limit on uses ('max_uses'). ```json { "type": "numismatic-overhaul:sell_stack", "sell": { "item": "minecraft:cookie", "count": 2 }, "price": 65, "max_uses": 2 } ``` -------------------------------- ### Formatting ItemStack Data in JSON Source: https://github.com/wisp-forest/docs/blob/main/docs/numismatic-overhaul/trades.md This example illustrates the JSON format used to define an ItemStack within trade definitions. It includes the item ID, an optional count, and an optional NBT tag as a nested object. ```json { "id": "minecraft:diamond_pickaxe", "count": 1 "tag": { "Damage": 75 } } ``` -------------------------------- ### Defining owo Version Property (gradle.properties) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/setup.md This properties snippet defines the `owo_version` variable in your `gradle.properties` file. This property is referenced in your `build.gradle` to manage the version of the owo-lib dependency, allowing for easier version updates across your project. ```Properties # https://maven.wispforest.io/io/wispforest/owo-lib/ owo_version=... ``` -------------------------------- ### Importing Scatter Configuration via Command Line (Shell) Source: https://github.com/wisp-forest/docs/blob/main/docs/scatter/config.md This snippet illustrates using the `scatter config --import ` command to import a previously exported configuration bundle from a specified file. This action replaces the current configuration and database. ```Shell → scatter config --import scatter_config_export.json info: Config imported ``` -------------------------------- ### Defining Label Component in XML Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/components/label.md This XML snippet shows a data-driven approach to defining a label component. It uses an XML structure with child elements to specify the label's text content, color, shadow status, and horizontal and vertical text alignment, mirroring the Java example. ```XML ``` -------------------------------- ### Creating Dropdown Component using Builder (Java) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/components/dropdown.md This Java snippet demonstrates how to programmatically create a dropdown component using a builder pattern provided by the `Components` utility. It shows how to add different types of entries like simple buttons, checkboxes, and nested submenus. It also illustrates setting basic parameters such as the closing behavior, padding, and the component's background surface. ```java Components.dropdown(Sizing.content()) .button(Text.literal("Option 1"), button -> { // Handle button click event }) .checkbox(Text.literal("Option 2"), false, ignored -> {}) .nested(Text.literal("Submenu"), Sizing.content(), submenu -> { submenu.button(Text.literal("Submenu Option"), button -> { // Handle submenu button click event }); }) .closeWhenNotHovered(false) .padding(Insets.of(5)) .surface(Surface.TOOLTIP) ``` -------------------------------- ### Configuring Scatter Tokens via Command Line (Shell) Source: https://github.com/wisp-forest/docs/blob/main/docs/scatter/config.md This snippet demonstrates using the `scatter config --tokens` command to interactively configure authentication tokens for different platforms. The command prompts the user to select a platform and then enter the token, which is saved securely. ```Shell → scatter config --tokens Platform: Modrinth CurseForge GitHub ↑ Token (empty to remove): info: Token for platform 'github' updated ``` -------------------------------- ### Embedding Owo-ui XML Models in Lavender Markdown Source: https://github.com/wisp-forest/docs/blob/main/docs/lavender/markdown-syntax.md Shows how to directly embed an owo-ui XML model definition within a Lavender markdown entry using a fenced code block with the `xml owo-ui` annotation. The example displays a diamond item stack on a dark panel. ```xml minecraft:diamond true 5 ``` -------------------------------- ### Block Registration with BlockRegistryContainer and BlockItem Customization Java Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/registration.md This snippet illustrates block registration using oωo's `BlockRegistryContainer`. It defines block fields and shows how to implement the `createBlockItem` method to customize the settings for the automatically generated `BlockItem`. The `@NoBlockItem` annotation is shown for excluding specific blocks from getting an item. ```Java public class BlockInit implements BlockRegistryContainer { public static final Block CLEAR_GLASS = new Block(...); @NoBlockItem // available since 0.3.13+1.18 public static final Block DEBUG_BLOCK = new Block(...); @Override public BlockItem createBlockItem(Block block, String identifier) { return new BlockItem(block, new Item.Settings().group(Mod.MOD_GROUP)); } } ``` -------------------------------- ### Defining Minecraft Datapack Metadata (pack.mcmeta) - JSON Source: https://github.com/wisp-forest/docs/blob/main/docs/datapack-tutorial.md This JSON snippet defines the required `pack.mcmeta` file for a Minecraft datapack. It specifies the `pack_format` version, which determines compatibility with different Minecraft versions, and a `description` string displayed in the game's datapack list. This file must be located in the root directory of the datapack. ```JSON { "pack": { "pack_format": 7, "description": "Put your description here" } } ``` -------------------------------- ### Using oωo's Global RenderDoc API - Java Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/renderdoc.md Provides methods within the global `RenderDoc` API class to programmatically control RenderDoc functionality, such as starting/ending frame captures, retrieving capture information, launching the replay UI, and checking availability. Requires the RenderDoc dynamic library to be successfully loaded. ```Java startFrameCapture() endFrameCapture() getCapture(int index) launchReplayUI(boolean connect) showReplayUI() isAvailable() ``` -------------------------------- ### Defining a Minecraft Smelting Recipe JSON Source: https://github.com/wisp-forest/docs/blob/main/docs/datapack-tutorial.md This JSON snippet defines a standard Minecraft smelting recipe. It specifies the recipe type, uses a tag as the input ingredient, defines the output item, sets the experience gained, and determines the cooking time. ```JSON { "type": "minecraft:smelting", "ingredient": { "tag": "based_tutorial:rocks_and_stones" }, "result": "minecraft:deepslate", "experience": 0.2, "cookingtime": 200 } ``` -------------------------------- ### Embedding Translations and Using Named Colors in Minecraft JSON Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/rich-translations.md Shows how to create a rich translation that embeds another translation (`item.minecraft.echo_shard`) using the `translate` text component property. It also demonstrates using a named color ("yellow") for styling and starting with an empty string to prevent style inheritance from the first component. This is applied to the `item.minecraft.recovery_compass` translation. ```JSON { ... "item.minecraft.echo_shard": [ "Echo ", { "text": "Shard", "color": "#0096FF" } ], "item.minecraft.recovery_compass": [ "", // (1) { "text": "Recovery Compass", "color": "yellow" }, // (2) " made of ", { "translate": "item.minecraft.echo_shard" } ] ... } ``` -------------------------------- ### Configure Fill Sizing - owo XML/Java Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/component-basics.md Configures a component to fill a specified percentage of the available space provided by its parent. The available space is determined by the nearest non-content-sized ancestor or the screen itself. ```XML method="fill" ``` ```Java Sizing.fill(...) ``` -------------------------------- ### Updating Version Placeholders - JavaScript Source: https://github.com/wisp-forest/docs/blob/main/docs/gadget/home.md This JavaScript snippet listens for a custom 'version-available' event dispatched on the window object. When the event occurs, it finds all HTML elements with the class 'gadget-version' and replaces the placeholder '...' within their `outerHTML` with the version string provided in the event's `detail` property. This dynamically updates version links and text on the page. ```JavaScript window.addEventListener('version-available', event => { [].forEach.call(document.querySelectorAll(".gadget-version"), v => { v.outerHTML = v.outerHTML.replaceAll("...", event.detail); }); }) ``` -------------------------------- ### Defining Tagged Output Recipe - Alloy Forgery - JSON Source: https://github.com/wisp-forest/docs/blob/main/docs/alloy-forgery/adding-recipes-and-fuels.md This JSON snippet demonstrates an Alloy Forgery recipe using a tagged output. It includes Fabric load conditions to check for required tags, defines inputs, specifies a priority list of possible item outputs, a default tag to select from, and also includes overrides and fuel settings. ```JSON { "fabric:load_conditions": [ { "condition": "fabric:item_tags_populated", "values": [ "c:raw_lead_ores", "c:lead_ingots" ] } ], "type": "alloy_forgery:forging", "inputs": [ { "tag": "c:raw_lead_ores", "count": 2 } ], "output": { "priority": [ "techreborn:lead_ingot", "indrev:lead_ingot", "modern_industrialization:lead_ingot" ], "default": "c:lead_ingots", "count": 3 }, "overrides": { "2+": { "count": 4 } }, "min_forge_tier": 1, "fuel_per_tick": 5 } ``` -------------------------------- ### Creating Checkbox Component Java Method Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/components/checkbox.md Shows the main Java method call used to programmatically create a checkbox component. This method is the entry point for building a checkbox using the code-driven approach. ```java Components.checkbox(...) ``` -------------------------------- ### Creating Label Component in Java Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/components/label.md This Java snippet demonstrates how to programmatically create and configure a label component. It sets the label text, color, enables shadow, and centers the text both horizontally and vertically using builder-like methods. ```Java Components.label(Text.literal("Hello, World!")) .color(Color.ofRgb(0xffffff)) .shadow(true) .horizontalTextAlignment(HorizontalAlignment.CENTER) .verticalTextAlignment(VerticalAlignment.CENTER) ``` -------------------------------- ### Generated Config Wrapper with Hook Subscriber (Java) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/config/annotations.md This snippet shows the structure of the Java configuration wrapper generated by owo-config based on the model. It demonstrates getter and setter methods for fields, and includes a `subscribeTo...` method specifically generated for the field annotated with @Hook, allowing subscription to changes. ```java public class MyConfig extends ConfigWrapper { ... public int withoutHook() {...} public void withoutHook(int value) {...} public int withHook() {...} public void withHook(int value) {...} public subscribeToWithHook(Consumer subscriber) {...} } ``` -------------------------------- ### Implementing WikiSource with Endec in Java Source: https://github.com/wisp-forest/docs/blob/main/docs/limelight/extending/adding_wiki_sources.md This Java code defines a `FunnyWikiSource` record implementing the `WikiSource` interface. It uses oωo's Endec for serialization, provides methods to generate the search URL and parse API results, and includes an initialization method to register the source type with the game registry. ```Java public record FunnyWikiSource(String apiUrl) implements WikiSource { // (1) public static final Endec ENDEC = StructEndecBuilder.of( Endec.STRING.fieldOf("api_url", FunnyWikiSource::apiUrl), FunnyWikiSource::new ); public static final WikiSourceType TYPE = new WikiSourceType<>(ENDEC); public static void init() { Registry.register(WikiSourceType.REGISTRY, Identifier.of("example-extension", "funny"), TYPE); } @Override public String createSearchUrl(String searchText) { // (2) return apiUrl + "/search?query=" + URLEncoder.encode(searchText, StandardCharsets.UTF_8); } @Override public void gatherEntriesFromSearch(String queryBody, String searchText, Consumer entryConsumer) { JsonArray json = JsonParser.parseString(queryBody).getAsJsonArray(); for (var resultEl : json) { JsonArray result = resultEl.getAsJsonArray(); entryConsumer.accept(new EntryData(result.get(0).getAsString(), result.get(1).getAsString())); } } @Override public WikiSourceType type() { return TYPE; } } ``` -------------------------------- ### Providing Results Asynchronously from Extension - Limelight - Java Source: https://github.com/wisp-forest/docs/blob/main/docs/limelight/extending/providing_results.md Demonstrates asynchronous result gathering using `CompletableFuture`. It shows how to use `CancellationToken` to manage the future's lifecycle based on the search context and `ctx.trackFuture` to inform Limelight about the ongoing asynchronous operation for progress indication. ```java public class MyFunExtension implements LimelightExtension { @Override public void gatherEntries(ResultGatherContext ctx, Consumer entryConsumer) { var future = ctx.cancellationToken().wrapFuture(doWork()) // (1) .thenAccept(value -> { if (value > 10) return; entryConsumer.accept(new MeowResultEntry()); }); ctx.trackFuture(future); // (2) } private CompletableFuture doWork() { return new CompletableFuture() .completeOnTimeout(4, 5, TimeUnit.SECONDS); } } ``` -------------------------------- ### Expanding Owo-UI Template with Value Replacement Java Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/components/templates.md Shows how to expand a template containing placeholders and provide a map of key-value pairs to the `expandTemplate` method. This replaces the placeholders (e.g., `{{custom-text}}`) with the corresponding values from the map during expansion. ```Java @Override protected void init() { super.init(); if (this.uiAdapter == null) return; this.uiAdapter.rootComponent.child( this.model.expandTemplate( FlowLayout.class, "my-template@examples:example_ui", Map.of("custom-text", "Hello, World!") ) ); } ``` -------------------------------- ### Defining Slot Group JSON Configuration Source: https://github.com/wisp-forest/docs/blob/main/docs/accessories/general/slot_groups.md Explains the JSON structure used in data packs to define a custom slot group for the accessories screen. It shows how to set the display order, list the member slots, and specify the resource location for the group's icon. This file should be placed in `data/{pack_namespace}/accessories/group/` with the group's name as the filename. ```json { "replace": false, "order": 120, "slots": [ "charm" ], "icon": "accessories:gui/group/any" } ``` -------------------------------- ### Creating Dropdown Component (Java) Source: https://github.com/wisp-forest/docs/blob/main/docs/owo/ui/utility-components.md Shows the Java API method `Components.dropdown()` used to programmatically create a generic dropdown component in owo-ui. It provides methods like `.divider()` and `.checkbox(...)` to add entries and includes a static utility function `openContextMenu(..)` for common use cases. ```Java Components.dropdown(...) ``` ```Java openContextMenu(..) ```