diff --git a/docs/concepts/events.md b/docs/concepts/events.md index d3982b36e..6f9038739 100644 --- a/docs/concepts/events.md +++ b/docs/concepts/events.md @@ -3,9 +3,9 @@ Events Forge uses an event bus that allows mods to intercept events from various Vanilla and mod behaviors. -Example: An event can be used to perform an action when a Vanilla stick is right clicked. +Example: An event can be used to perform an action when a Vanilla stick is right-clicked. -The main event bus used for most events is located at `MinecraftForge#EVENT_BUS`. There is another event bus for mod specific events located at `FMLJavaModLoadingContext#getModEventBus` that you should only use in specific cases. More information about this bus can be found below. +The main event bus used for most events is located at `NeoForge#EVENT_BUS`. There is another event bus for mod specific events that you should only use in specific cases. More information about this bus can be [found below](#mod-event-bus). Every event is fired on one of these busses: most events are fired on the main forge event bus, but some are fired on the mod specific event buses. @@ -49,7 +49,7 @@ public class MyForgeEventHandler { } ``` -To register this event handler, use `MinecraftForge.EVENT_BUS.register(...)` and pass it an instance of the class the event handler is within. If you want to register this handler to the mod specific event bus, you should use `FMLJavaModLoadingContext.get().getModEventBus().register(...)` instead. +To register this event handler, use `NeoForge.EVENT_BUS.register(...)` and pass it an instance of the class the event handler is within. If you want to register this handler to the mod specific event bus, you should use `FMLJavaModLoadingContext.get().getModEventBus().register(...)` instead. ### Static Annotated Event Handlers @@ -64,11 +64,11 @@ public class MyStaticForgeEventHandler { } ``` -which must be registered like this: `MinecraftForge.EVENT_BUS.register(MyStaticForgeEventHandler.class)`. +which must be registered like this: `NeoForge.EVENT_BUS.register(MyStaticForgeEventHandler.class)`. ### Automatically Registering Static Event Handlers -A class may be annotated with the `@Mod$EventBusSubscriber` annotation. Such a class is automatically registered to `MinecraftForge#EVENT_BUS` when the `@Mod` class itself is constructed. This is essentially equivalent to adding `MinecraftForge.EVENT_BUS.register(AnnotatedClass.class);` at the end of the `@Mod` class's constructor. +A class may be annotated with the `@Mod$EventBusSubscriber` annotation. Such a class is automatically registered to `NeoForge#EVENT_BUS` when the `@Mod` class itself is constructed. This is essentially equivalent to adding `NeoForge.EVENT_BUS.register(AnnotatedClass.class);` at the end of the `@Mod` class's constructor. You can pass the bus you want to listen to the `@Mod$EventBusSubscriber` annotation. It is recommended you also specify the mod id, since the annotation process may not be able to figure it out, and the bus you are registering to, since it serves as a reminder to make sure you are on the correct one. You can also specify the `Dist`s or physical sides to load this event subscriber on. This can be used to not load client specific event subscribers on the dedicated server. @@ -119,6 +119,8 @@ Many events have different variations of themselves. These can be different but Mod Event Bus ------------- +To get access to the mod event bus for your own mod, declare a constructor parameter of type `IModEventBus` in your [mod entrypoint][ctor-injection]. + The mod event bus is primarily used for listening to lifecycle events in which mods should initialize. Each event on the mod bus is required to implement `IModBusEvent`. Many of these events are also ran in parallel so mods can be initialized at the same time. This does mean you can't directly execute code from other mods in these events. Use the `InterModComms` system for that. These are the four most commonly used lifecycle events that are called during mod initialization on the mod event bus: @@ -132,7 +134,7 @@ These are the four most commonly used lifecycle events that are called during mo The `FMLClientSetupEvent` and `FMLDedicatedServerSetupEvent` are only called on their respective distribution. ::: -These four lifecycle events are all ran in parallel since they all are a subclass of `ParallelDispatchEvent`. If you want to run run code on the main thread during any `ParallelDispatchEvent`, you can use the `#enqueueWork` to do so. +These four lifecycle events are all ran in parallel since they all are a subclass of `ParallelDispatchEvent`. If you want to run code on the main thread during any `ParallelDispatchEvent`, you can use the `#enqueueWork` to do so. Next to the lifecycle events, there are a few miscellaneous events that are fired on the mod event bus where you can register, set up, or initialize various things. Most of these events are not ran in parallel in contrast to the lifecycle events. A few examples: @@ -142,3 +144,5 @@ Next to the lifecycle events, there are a few miscellaneous events that are fire * `RegisterEvent` A good rule of thumb: events are fired on the mod event bus when they should be handled during initialization of a mod. + +[ctor-injection]: ../gettingstarted/modfiles.md#javafml-and-mod diff --git a/docs/concepts/sides.md b/docs/concepts/sides.md index f3e66ae15..c0cd4e797 100644 --- a/docs/concepts/sides.md +++ b/docs/concepts/sides.md @@ -15,7 +15,7 @@ As it turns out, there can be some ambiguity even with two such terms. Here we d * Logical server - The *logical server* is what runs game logic: mob spawning, weather, updating inventories, health, AI, and all other game mechanics. The logical server is present within a physical server, but it also can run inside a physical client together with a logical client, as a single player world. The logical server always runs in a thread named the `Server Thread`. * Logical client - The *logical client* is what accepts input from the player and relays it to the logical server. In addition, it also receives information from the logical server and makes it available graphically to the player. The logical client runs in the `Render Thread`, though often several other threads are spawned to handle things like audio and chunk render batching. -In the MinecraftForge codebase, the physical side is represented by an enum called `Dist`, while the logical side is represented by an enum called `LogicalSide`. +In the NeoForge codebase, the physical side is represented by an enum called `Dist`, while the logical side is represented by an enum called `LogicalSide`. Performing Side-Specific Operations ----------------------------------- diff --git a/docs/datagen/index.md b/docs/datagen/index.md index eaf6e05ba..983a2eb57 100644 --- a/docs/datagen/index.md +++ b/docs/datagen/index.md @@ -43,19 +43,19 @@ Data providers are the classes that actually define what data will be generated The `GatherDataEvent` is fired on the mod event bus when the data generator is being created, and the `DataGenerator` can be obtained from the event. Create and register data providers using `DataGenerator#addProvider`. ### Client Assets -* [`net.minecraftforge.common.data.LanguageProvider`][langgen] - for [language strings][lang]; implement `#addTranslations` -* [`net.minecraftforge.common.data.SoundDefinitionsProvider`][soundgen] - for [`sounds.json`][sounds]; implement `#registerSounds` -* [`net.minecraftforge.client.model.generators.ModelProvider`][modelgen] - for [models]; implement `#registerModels` +* [`net.neoforged.neoforge.common.data.LanguageProvider`][langgen] - for [language strings][lang]; implement `#addTranslations` +* [`net.neoforged.neoforge.common.data.SoundDefinitionsProvider`][soundgen] - for [`sounds.json`][sounds]; implement `#registerSounds` +* [`net.neoforged.neoforge.client.model.generators.ModelProvider`][modelgen] - for [models]; implement `#registerModels` * [`ItemModelProvider`][itemmodelgen] - for item models * [`BlockModelProvider`][blockmodelgen] - for block models -* [`net.minecraftforge.client.model.generators.BlockStateProvider`][blockstategen] - for blockstate JSONs and their block and item models; implement `#registerStatesAndModels` +* [`net.neoforged.neoforge.client.model.generators.BlockStateProvider`][blockstategen] - for blockstate JSONs and their block and item models; implement `#registerStatesAndModels` ### Server Data -**These classes are under the `net.minecraftforge.common.data` package**: +**These classes are under the `net.neoforged.neoforge.common.data` package**: * [`GlobalLootModifierProvider`][glmgen] - for [global loot modifiers][glm]; implement `#start` -* [`DatapackBuiltinEntriesProvider`][datapackregistriesgen] for datapack registry objects; pass in `RegistrySetBuilder` to the constructor +* [`DatapackBuiltinEntriesProvider`][datapackregistriesgen] for datapack registry objects (i.e. world generation features, biomes, and more); pass in `RegistrySetBuilder` to the constructor **These classes are under the `net.minecraft.data` package**: diff --git a/docs/datagen/server/tags.md b/docs/datagen/server/tags.md index ce3db346b..5603a548e 100644 --- a/docs/datagen/server/tags.md +++ b/docs/datagen/server/tags.md @@ -10,7 +10,7 @@ public void gatherData(GatherDataEvent event) { event.getGenerator().addProvider( // Tell generator to run only when server data are generating event.includeServer(), - // Extends net.minecraftforge.common.data.BlockTagsProvider + // Extends net.neoforged.neoforge.common.data.BlockTagsProvider output -> new MyBlockTagsProvider( output, event.getLookupProvider(), diff --git a/docs/gettingstarted/modfiles.md b/docs/gettingstarted/modfiles.md index 16a46d38f..9dcb09617 100644 --- a/docs/gettingstarted/modfiles.md +++ b/docs/gettingstarted/modfiles.md @@ -67,7 +67,7 @@ Non-mod-specific properties are properties associated with the JAR itself, indic | `loaderVersion` | string | **mandatory** | The acceptable version range of the language loader, expressed as a [Maven Version Range][mvr]. For `javafml` and `lowcodefml`, this is currently version `1`. | `loaderVersion="[1,)"` | | `license` | string | **mandatory** | The license the mod(s) in this JAR are provided under. It is suggested that this is set to the [SPDX identifier][spdx] you are using and/or a link to the license. You can visit https://choosealicense.com/ to help pick the license you want to use. | `license="MIT"` | | `showAsResourcePack` | boolean | `false` | When `true`, the mod(s)'s resources will be displayed as a separate resource pack on the 'Resource Packs' menu, rather than being combined with the 'Mod resources' pack. | `showAsResourcePack=true` | -| `services` | array | `[]` | An array of services your mod uses. This is consumed as part of the created module for the mod from NeoForge's implementation of the Java Platform Module System. | `services=["net.minecraftforge.forgespi.language.IModLanguageProvider"]` | +| `services` | array | `[]` | An array of services your mod uses. This is consumed as part of the created module for the mod from NeoForge's implementation of the Java Platform Module System. | `services=["net.neoforged.neoforgespi.language.IModLanguageProvider"]` | | `properties` | table | `{}` | A table of substitution properties. This is used by `StringSubstitutor` to replace `${file.}` with its corresponding value. | `properties={"example"="1.2.3"}` (can then be referenced by `${file.example}`) | | `issueTrackerURL` | string | *nothing* | A URL representing the place to report and track issues with the mod(s). | `"https://github.com/neoforged/NeoForge/issues"` | @@ -106,7 +106,7 @@ modId = "examplemod2" | `modUrl` | string | *nothing* | A URL to the download page of the mod. Currently unused. | `modUrl="https://neoforged.net/"` | | `credits` | string | *nothing* | Credits and acknowledges for the mod shown on the mod list screen. | `credits="The person over here and there."` | | `authors` | string | *nothing* | The authors of the mod shown on the mod list screen. | `authors="Example Person"` | -| `displayURL` | string | *nothing* | A URL to the display page of the mod shown on the mod list screen. | `displayURL="https://minecraftforge.net/"` | +| `displayURL` | string | *nothing* | A URL to the display page of the mod shown on the mod list screen. | `displayURL="https://neoforged.net/"` | | `displayTest` | string | `"MATCH_VERSION"` | See [sides]. | `displayTest="NONE"` | #### Features diff --git a/docs/misc/config.md b/docs/misc/config.md index e940fdb93..4d51af03f 100644 --- a/docs/misc/config.md +++ b/docs/misc/config.md @@ -1,30 +1,30 @@ Configuration ============= -Configurations define settings and consumer preferences that can be applied to a mod instance. Forge uses a configuration system using [TOML][toml] files and read with [NightConfig][nightconfig]. +Configurations define settings and consumer preferences that can be applied to a mod instance. NeoForge uses a configuration system using [TOML][toml] files and read with [NightConfig][nightconfig]. Creating a Configuration ------------------------ -A configuration can be created using a subtype of `IConfigSpec`. Forge implements the type via `ForgeConfigSpec` and enables its construction through `ForgeConfigSpec$Builder`. The builder can separate the config values into sections via `Builder#push` to create a section and `Builder#pop` to leave a section. Afterwards, the configuration can be built using one of two methods: +A configuration can be created using a subtype of `IConfigSpec`. NeoForge implements the type via `ModConfigSpec` and enables its construction through `ModConfigSpec.Builder`. The builder can separate the config values into sections via `Builder#push` to create a section and `Builder#pop` to leave a section. Afterwards, the configuration can be built using one of two methods: Method | Description :--- | :--- -`build` | Creates the `ForgeConfigSpec`. -`configure` | Creates a pair of the class holding the config values and the `ForgeConfigSpec`. +`build` | Creates the `ModConfigSpec`. +`configure` | Creates a pair of the class holding the config values and the `ModConfigSpec`. :::note -`ForgeConfigSpec$Builder#configure` is typically used with a `static` block and a class that takes in `ForgeConfigSpec$Builder` as part of its constructor to attach and hold the values: +`ModConfigSpec.Builder#configure` is typically used with a `static` block and a class that takes in `ModConfigSpec.Builder` as part of its constructor to attach and hold the values: ```java // In some config class -ExampleConfig(ForgeConfigSpec.Builder builder) { +ExampleConfig(ModConfigSpec.Builder builder) { // Define values here in final fields } // Somewhere the constructor is accessible static { - Pair pair = new ForgeConfigSpec.Builder() + Pair pair = new ModConfigSpec.Builder() .configure(ExampleConfig::new); // Store pair values in some constant field } @@ -33,11 +33,11 @@ static { Each config value can be supplied with additional context to provide additional behavior. Contexts must be defined before the config value is fully built: -Method | Description -:--- | :--- -`comment` | Provides a description of what the config value does. Can provide multiple strings for a multiline comment. -`translation` | Provides a translation key for the name of the config value. -`worldRestart` | The world must be restarted before the config value can be changed. +| Method | Description | +|:---------------|:------------------------------------------------------------------------------------------------------------| +| `comment` | Provides a description of what the config value does. Can provide multiple strings for a multiline comment. | +| `translation` | Provides a translation key for the name of the config value. | +| `worldRestart` | The world must be restarted before the config value can be changed. | ### ConfigValue @@ -54,7 +54,7 @@ The `ConfigValue` specific methods take in two additional components: * A class representing the data type of the config value ```java -// For some ForgeConfigSpec$Builder builder +// For some ModConfigSpec.Builder builder ConfigValue value = builder.comment("Comment") .define("config_value_name", defaultValue); ``` @@ -105,23 +105,23 @@ The values themselves can be obtained using `ConfigValue#get`. The values are ad Registering a Configuration --------------------------- -Once a `ForgeConfigSpec` has been built, it must be registered to allow Forge to load, track, and sync the configuration settings as required. Configurations should be registered in the mod constructor via `ModLoadingContext#registerConfig`. A configuration can be registered with a given type representing the side the config belongs to, the `ForgeConfigSpec`, and optionally a specific file name for the configuration. +Once a `ModConfigSpec` has been built, it must be registered to allow NeoForge to load, track, and sync the configuration settings as required. Configurations should be registered in the mod constructor via `ModLoadingContext#registerConfig`. A configuration can be registered with a given type representing the side the config belongs to, the `ModConfigSpec`, and optionally a specific file name for the configuration. ```java -// In the mod constructor with a ForgeConfigSpec CONFIG +// In the mod constructor with a ModConfigSpec CONFIG ModLoadingContext.get().registerConfig(Type.COMMON, CONFIG); ``` Here is a list of the available configuration types: -Type | Loaded | Synced to Client | Client Location | Server Location | Default File Suffix -:---: | :---: | :---: | :---: | :---: | :--- -CLIENT | Client Side Only | No | `.minecraft/config` | N/A | `-client` -COMMON | On Both Sides | No | `.minecraft/config` | `/config` | `-common` -SERVER | Server Side Only | Yes | `.minecraft/saves//serverconfig` | `/world/serverconfig` | `-server` +| Type | Loaded | Synced to Client | Client Location | Server Location | Default File Suffix | +|:------:|:----------------:|:----------------:|:--------------------------------------------:|:------------------------------------:|:--------------------| +| CLIENT | Client Side Only | No | `.minecraft/config` | N/A | `-client` | +| COMMON | On Both Sides | No | `.minecraft/config` | `/config` | `-common` | +| SERVER | Server Side Only | Yes | `.minecraft/saves//serverconfig` | `/world/serverconfig` | `-server` | :::tip -Forge documents the [config types][type] within their codebase. +NeoForge documents the [config types][type] within their codebase. ::: Configuration Events @@ -135,5 +135,5 @@ These events are called for all configurations for the mod; the `ModConfig` obje [toml]: https://toml.io/ [nightconfig]: https://github.com/TheElectronWill/night-config -[type]: https://github.com/MinecraftForge/MinecraftForge/blob/c3e0b071a268b02537f9d79ef8e7cd9b100db416/fmlcore/src/main/java/net/minecraftforge/fml/config/ModConfig.java#L108-L136 +[type]: https://github.com/neoforged/FancyModLoader/blob/19d6326b810233e683f1beb3d28e41372e1e89d1/core/src/main/java/net/neoforged/fml/config/ModConfig.java#L83-L111 [events]: ../concepts/events.md#creating-an-event-handler diff --git a/docs/resources/server/glm.md b/docs/resources/server/glm.md index 71fae565a..8676f1f12 100644 --- a/docs/resources/server/glm.md +++ b/docs/resources/server/glm.md @@ -145,4 +145,4 @@ public static final RegistryObject> = REGISTRAR.register( [registered]: ../../concepts/registries.md#methods-for-registering [codecdef]: ../../datastorage/codecs.md [datagen]: ../../datagen/server/glm.md -[examples]: https://github.com/MinecraftForge/MinecraftForge/blob/1.20.x/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java +[examples]: https://github.com/neoforged/NeoForge/blob/1.20.x/tests/src/main/java/net/neoforged/neoforge/debug/loot/GlobalLootModifiersTest.java diff --git a/docs/resources/server/tags.md b/docs/resources/server/tags.md index 4a5883d9a..e5a7855de 100644 --- a/docs/resources/server/tags.md +++ b/docs/resources/server/tags.md @@ -116,6 +116,6 @@ Tags are directly supported by Vanilla. See the respective Vanilla wiki pages fo [datapack]: ./index.md [tags]: https://minecraft.wiki/w/Tag#JSON_format [taglist]: https://minecraft.wiki/w/Tag#List_of_tags -[forgetags]: https://github.com/MinecraftForge/MinecraftForge/tree/1.19.x/src/generated/resources/data/forge/tags +[forgetags]: https://github.com/neoforged/NeoForge/tree/1.20.x/src/generated/resources/data/forge/tags [recipes]: https://minecraft.wiki/w/Recipe#JSON_format [advancements]: https://minecraft.wiki/w/Advancement