Skip to content

Commit

Permalink
Replace a handful of references to MinecraftForge that were left over (
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte authored Dec 14, 2023
1 parent deb4ddc commit 56569a0
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 40 deletions.
16 changes: 10 additions & 6 deletions docs/concepts/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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

Expand All @@ -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.

Expand Down Expand Up @@ -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:
Expand All @@ -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:

Expand All @@ -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
2 changes: 1 addition & 1 deletion docs/concepts/sides.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------------------------------
Expand Down
12 changes: 6 additions & 6 deletions docs/datagen/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**:

Expand Down
2 changes: 1 addition & 1 deletion docs/datagen/server/tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions docs/gettingstarted/modfiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<key>}` 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"` |

Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 56569a0

Please sign in to comment.