### Create Page (Getting Started Category) Source: https://forge.gemwire.uk/wiki/Special%3ALog/Curle Logs the creation of a category page for beginners. ```text For absolute beginners who need an introduction to the whole system. Important information is split up across the subcategories for those who need help with the less commonly... ``` -------------------------------- ### Example mods.toml Configuration Source: https://forge.gemwire.uk/wiki/Mods.toml This is a complete example of a mods.toml file, demonstrating the structure for mod-specific properties and dependencies. ```toml modLoader="javafml" # Forge for 1.19 is version 41 loaderVersion="[41,)" license="All rights reserved" issueTrackerURL="github.com/MinecraftForge/MinecraftForge/issues" showAsResourcePack=false [[mods]] modId="examplemod" version="1.0.0.0" displayName="Example Mod" updateJSONURL="minecraftforge.net/versions.json" displayURL="minecraftforge.net" logoFile="logo.png" credits="I'd like to thank my mother and father." authors="Author" description=''' Lets you craft dirt into diamonds. This is a traditional mod that has existed for eons. It is ancient. The holy Notch created it. Jeb rainbowfied it. Dinnerbone made it upside down. Etc. ''' displayTest="MATCH_VERSION" [[dependencies.examplemod]] modId="forge" mandatory=true versionRange="[41,)" ordering="NONE" side="BOTH" [[dependencies.examplemod]] modId="minecraft" mandatory=true versionRange="[1.19,1.20)" ordering="NONE" side="BOTH" ``` -------------------------------- ### Comprehensive Config Entry Example Source: https://forge.gemwire.uk/wiki/Config/1.18 This extensive example showcases various config entry types including integers, doubles, longs, booleans, strings, and lists. It also demonstrates using comments and nested categories for organization. ```java public static ForgeConfigSpec.IntValue exampleIntConfigEntry; public static ForgeConfigSpec.DoubleValue exampleDoubleConfigEntry; public static ForgeConfigSpec.ConfigValue exampleUnboundedDoubleConfigEntry; public static ForgeConfigSpec.LongValue exampleLongConfigEntry; public static ForgeConfigSpec.BooleanValue exampleBooleanConfigEntry; public static ForgeConfigSpec.ConfigValue exampleStringConfigEntry; public static ForgeConfigSpec.ConfigValue> exampleStringListConfigEntry; private static void setupConfig(ForgeConfigSpec.Builder builder) { builder.comment(" This category holds configs that uses numbers.") builder.push("Numeric Config Options"); exampleIntConfigEntry = builder.defineInRange("example_int_config_entry", 5, 2, 50); exampleDoubleConfigEntry = builder.defineInRange("example_double_config_entry", 10D, 0D, 100D); exampleUnboundedDoubleConfigEntry = builder .comment("This comment will be attached to example_unbounded_double_config_entry in the config file.") .define("example_unbounded_double_config_entry", 1000D); exampleLongConfigEntry = builder.defineInRange("example_long_config_entry", 4L, -900L, 900L); builder.pop(); builder.comment(" This category holds configs that uses numbers.") builder.push("String Config Options"); exampleStringConfigEntry = builder .comment("This config holds a single string.") .define("example_string_config_entry", "player444"); builder.comment(" This category will be nested inside the String Config Options category.") builder.push("Nested Category"); exampleStringListConfigEntry = builder .comment("This config entry will hold a list of strings.") ``` -------------------------------- ### MCPConfig Mergetool Step Example Source: https://forge.gemwire.uk/wiki/Toolchain/1.18 Example configuration for the Mergetool step within MCPConfig. It defines the version and arguments required to merge client and server JARs. ```json { "merge": { "version": "net.minecraftforge:mergetool:1.1.3:fatjar", "args": "--client {client} --server {server} --ann {version} --output {output} --inject false" } } ``` -------------------------------- ### Build Project for Visual Studio Code Setup Source: https://forge.gemwire.uk/wiki/Getting_Started This command is part of the Visual Studio Code setup process. It should be run before generating VS Code-specific run configurations. ```bash ./gradlew buildNeeded ``` -------------------------------- ### Declare Public Method Access (Partial Example) Source: https://forge.gemwire.uk/wiki/Access_Transformer Partial example for declaring public method access. The full signature is not provided in the source. ```java # Makes public the 'leastMostToIntArray' method in UUIDUtil, ``` -------------------------------- ### Example First-Person Item Animation Implementation Source: https://forge.gemwire.uk/wiki/Custom_Item_Animations A practical example of implementing first-person item animation using `#applyForgeHandTransform`. This snippet demonstrates translation based on the player's arm and item usage. ```java @Override public void initializeClient(Consumer consumer) { consumer.accept(new IClientItemExtensions() { @Override public boolean applyForgeHandTransform(PoseStack poseStack, LocalPlayer player, HumanoidArm arm, ItemStack itemInHand, float partialTick, float equipProcess, float swingProcess) { int i = arm == HumanoidArm.RIGHT ? 1 : -1; poseStack.translate(i * 0.56F, -0.52F, -0.72F); if (player.getUseItem() == itemInHand && player.isUsingItem()) { poseStack.translate(0.0, -0.05, 0.0); } return true; } }); } ``` -------------------------------- ### MCPConfig Rename Step Example Source: https://forge.gemwire.uk/wiki/Toolchain/1.18 Example configuration for the Rename step within MCPConfig. This snippet details the arguments for processing JAR files with specific mapping formats and decompiler configurations. ```json { "rename": { "version": "net.minecraftforge.lex:vignette:0.2.0.10", "args": "--jar-in {input} --jar-out {output} --mapping-format tsrg2 --mappings {mappings} --fernflower-meta --cfg {libraries} --create-inits --fix-param-annotations" } } ``` -------------------------------- ### Example mods.toml Configuration Source: https://forge.gemwire.uk/wiki/User%3ASciWhiz12/sandbox/structure This is a basic configuration for a mods.toml file, essential for mod identification and loader information. ```toml modLoader="javafml" ``` -------------------------------- ### Batch Setup and Teardown Methods Source: https://forge.gemwire.uk/wiki/Game_Tests/1.18 Methods annotated with @BeforeBatch or @AfterBatch to perform setup or teardown for a specific test batch. The batch name must match the GameTest's batch attribute. ```java public class ExampleGameTests { @BeforeBatch(batch = "firstBatch") public static void beforeTest(ServerLevel level) { // Perform setup } @GameTest(batch = "firstBatch") public static void exampleTest2(GameTestHelper helper) { // Do stuff } } ``` -------------------------------- ### Exclude Dependency Example Source: https://forge.gemwire.uk/wiki/Jar-in-Jar Excludes dependencies based on a pattern. This example excludes any dependency whose group name starts with 'com.google.gson.'. ```gradle dependencies { exclude(dependency('com.google.gson.*')) } ``` -------------------------------- ### Executing MCPConfig Steps Source: https://forge.gemwire.uk/wiki/Toolchain/Retro/2.1 Example command for executing a step within MCPConfig. This demonstrates the general format for running tools with their arguments and JVM options. ```bash java -jar ``` -------------------------------- ### Declare Public Method (Partial Example) Source: https://forge.gemwire.uk/wiki/ATs Partial example of declaring a public method. The '#' character denotes comments. ```java # Makes public the 'leastMostToIntArray' method in UUIDUtil, ``` -------------------------------- ### Example Log Entry: User Account Creation Source: https://forge.gemwire.uk/wiki/Special%3ALog/KnightMiner Shows a log entry detailing the creation of a user account, including the username and the date of creation. ```text 03:54, 23 February 2021 User account KnightMiner talk contribs was created ``` -------------------------------- ### Fence Connection Variant Example Source: https://forge.gemwire.uk/wiki/BlockState_JSONs An example of a single variant string for a fence connection, specifying model and rotation. ```json "east=true,north=false,south=false,west=false": { "model": "oak_fence_n", "y": 90, "uvlock": true } ``` -------------------------------- ### Kotlin Hello World Source: https://forge.gemwire.uk/wiki/User%3AChampionAsh5357/Test Standard Kotlin entry point for a console application. ```kotlin fun main(args : Array) { println("Hello world!") } ``` -------------------------------- ### New Page Creation Example Source: https://forge.gemwire.uk/wiki/Special%3AContributions/CrynesSs This snippet shows the initial HTML content for a newly created page titled 'Saplings', including a header and introductory text for a tutorial. ```html

Saplings

How to create Saplings in Forge 1.16.4

Let's start with a basic example by extending SaplingBlock.First create a class... ``` -------------------------------- ### MCPConfig Fernflower Step Example Source: https://forge.gemwire.uk/wiki/Toolchain/1.18 Example configuration for the Fernflower decompiler step within MCPConfig. It specifies the version, arguments, and JVM arguments for the decompiler. ```json { "fernflower": { "version": "net.minecraftforge:forgeflower:1.5.498.12", "args": "-din=1 -rbr=1 -dgs=1 -asc=1 -rsy=1 -iec=1 -jvn=1 -isl=0 -iib=1 -log=TRACE -cfg {libraries} {input} {output}", "jvmargs": "-Xmx4G" } } ``` -------------------------------- ### Scala Hello World Source: https://forge.gemwire.uk/wiki/User%3AChampionAsh5357/Test Standard Scala entry point for a console application. ```scala def main(args: Array[String]): Unit = { println("Hello, world!") } ``` -------------------------------- ### Executing the Extract Action Source: https://forge.gemwire.uk/wiki/User_talk%3APaint_Ninja/Installer This demonstrates how to execute the action obtained from the Actions enum, passing the install profile and monitor. The result indicates success or failure. ```java action.getAction(installProfile, monitor).run(target, a -> true) ``` -------------------------------- ### Custom Biome Modifier JSON Example Source: https://forge.gemwire.uk/wiki/Biome_Modifiers Example of a custom biome modifier JSON that adds a feature to badlands biomes. Ensure the 'type' matches your registered codec. ```json { "type": "yourmodid:example", "biomes": "#minecraft:is_badlands", "feature": "yourmod:some_feature" } ``` -------------------------------- ### Building a Loot Pool and Loot Table Source: https://forge.gemwire.uk/wiki/Datageneration/Loot_Tables Example demonstrating how to construct a LootPool with multiple entries and functions, and then incorporate it into a LootTable. ```java LootPool.Builder poolBuilder = LootPool.lootPool() .name(...) .setRolls(...) .add(LootItem.lootTableItem(...) .apply(function1) .apply(function2) .when(condition1) .when(condition2)) ); LootTable.Builder tableBuilder = LootTable.lootTable().withPool(poolBuilder); ``` -------------------------------- ### Serialize and Deserialize with Codecs Source: https://forge.gemwire.uk/wiki/Codecs/1.18 Demonstrates how to use Codec#encodeStart to serialize Java objects to Tag or JsonElement, and Codec#parse to deserialize them back. Requires a Codec instance and a DynamicOps instance. ```java DataResult result = someCodec.encodeStart(NBTOps.INSTANCE, someJavaObject); DataResult result = someCodec.parse(NBTOps.INSTANCE, someTag ); DataResult result = someCodec.encodeStart(JsonOps.INSTANCE, someJavaObject); DataResult result = someCodec.parse(JsonOps.INSTANCE, someJsonElement); ``` -------------------------------- ### Example JSON for Registry Dispatch Source: https://forge.gemwire.uk/wiki/Codecs/1.18 This JSON structure demonstrates how a 'type' field is used to identify the specific codec for a 'Thing' object within a registry dispatch system. It shows an example of an 'ExampleCodecClass' instance. ```json "some_thing": { "type": "ourmod:exampleclass", "some_int": 42, "item": "minecraft:gold_ingot", "block_positions": [ [0,0,0], [10,20,-100] ] } ``` -------------------------------- ### Java Hello World Source: https://forge.gemwire.uk/wiki/User%3AChampionAsh5357/Test Standard Java entry point for a console application. ```java public static void main(String[] args) { System.out.println("Hello World"); } ``` -------------------------------- ### Example mods.toml File Structure Source: https://forge.gemwire.uk/wiki/Mods.toml/1.18 This TOML file configures mod loader, versioning, license, and displays mod information. It includes sections for mod-specific properties and dependencies. ```toml modLoader="javafml" # Forge for 1.18.2 is version 40 loaderVersion="[40,)" license="All rights reserved" issueTrackerURL="github.com/MinecraftForge/MinecraftForge/issues" showAsResourcePack=false [[mods/1.18|mods]] modId="examplemod" version="1.0.0.0" displayName="Example Mod" updateJSONURL="minecraftforge.net/versions.json" displayURL="minecraftforge.net" logoFile="logo.png" credits="I'd like to thank my mother and father." authors="Author" description=''' Lets you craft dirt into diamonds. This is a traditional mod that has existed for eons. It is ancient. The holy Notch created it. Jeb rainbowfied it. Dinnerbone made it upside down. Etc. ''' [[dependencies.examplemod/1.18|dependencies.examplemod]] modId="forge" mandatory=true versionRange="[40,)" ordering="NONE" side="BOTH" [[dependencies.examplemod/1.18|dependencies.examplemod]] modId="minecraft" mandatory=true versionRange="[1.18.2,1.19)" ordering="NONE" side="BOTH" ``` -------------------------------- ### Instantiating ExtractAction Source: https://forge.gemwire.uk/wiki/User_talk%3APaint_Ninja/Installer This shows how to get an instance of the EXTRACT action from the Actions enum. ```java final Actions action = Actions.EXTRACT; ``` -------------------------------- ### Groovy Tab Example Source: https://forge.gemwire.uk/wiki/User%3ASciWhiz12/sandbox/codetabs/test This is a placeholder comment for a Groovy code snippet within a tab. ```groovy // Testing the Groovy tab ``` -------------------------------- ### MergeTool Command Example Source: https://forge.gemwire.uk/wiki/Toolchain/Retro/2.1/1.17 This command illustrates the usage of MergeTool to combine client and server code with version annotations, specifying the output path and injection behavior. ```bash java -jar net.minecraftforge:mergetool:1.1.1:fatjar --client {client} --server {server} --ann {version} --output {output} --inject false ```