Skip to content

Commit

Permalink
Move to docusaurus
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Jul 10, 2023
1 parent 3be4c0a commit 8dbb7fe
Show file tree
Hide file tree
Showing 60 changed files with 22,338 additions and 557 deletions.
8 changes: 0 additions & 8 deletions .gitattributes

This file was deleted.

23 changes: 20 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
site/
.idea/
.vscode/
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
5 changes: 0 additions & 5 deletions CONTRIBUTING.md

This file was deleted.

43 changes: 37 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,41 @@
# Documentation
This is the official MinecraftForge documentation, located at https://docs.minecraftforge.net.
# Website

It is intended to provide detailed documentation of Forge development concepts. This does not include javadocs.
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

The intent with this is to create a curated *definitive* source of documentation for developing mods with Forge. It is not a Java language tutorial, and basic concepts of Java should not be part of this documentation. Excessive example code will be avoided in lieu of more thorough explanations.
### Installation

Feel free to submit pull requests related to documentation of Forge development here. See [CONTRIBUTING.md](/CONTRIBUTING.md)
```
$ yarn
```

Don't expect this to be constantly being updated, though we will try and remedy egregious errors more quickly.
### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
2 changes: 1 addition & 1 deletion docs/blockentities/ber.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This method is called every frame in order to render the block entity.

#### Parameters
* `blockEntity`: This is the instance of the block entity being rendered.
* `partialTick`: The amount of time, in fractions of a tick, that has passed since the last full tick.
* `partialTicks`: The amount of time, in fractions of a tick, that has passed since the last full tick.
* `poseStack`: A stack holding four-dimensional matrix entries offset to the current position of the block entity.
* `bufferSource`: A rendering buffer able to access a vertex consumer.
* `combinedLight`: An integer of the current light value on the block entity.
Expand Down
6 changes: 3 additions & 3 deletions docs/blocks/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For simple blocks, which need no special functionality (think cobblestone, woode
All these methods are *chainable* which means you can call them in series. See the `Blocks` class for examples of this.

!!! note
Blocks have no setter for their `CreativeModeTab`. This is handled by the [`BuildCreativeModeTabContentsEvent`][creativetabs] if the block has an associated item (e.g. `BlockItem`). Furthermore, there is no setter for translation key of the block as it is generated from the registry name via `Block#getDescriptionId`.
Blocks have no setter for their `CreativeModeTab`. This is now handled by the [`CreativeModeTabEvent$BuildContents`][creativetabs] if the block has an associated item (e.g. `BlockItem`). Furthermore, there is no setter for translation key as it is now generated from the registry name.

### Advanced Blocks

Expand All @@ -36,14 +36,14 @@ Blocks must be [registered][registering] to function.

#### Optionally Registering Blocks

In the past there have been several mods that have allowed users to disable blocks/items in a configuration file. However, you shouldn't do this. There is no limit on the amount of blocks that can be register, so register all blocks in your mod! If you want a block to be disabled through a configuration file, you should disable the crafting recipe. If you would like to disable the block in the creative tab, use a `FeatureFlag` when building the contents within [`BuildCreativeModeTabContentsEvent`][creativetabs].
In the past there have been several mods that have allowed users to disable blocks/items in a configuration file. However, you shouldn't do this. There is no limit on the amount of blocks that can be register, so register all blocks in your mod! If you want a block to be disabled through a configuration file, you should disable the crafting recipe. If you would like to disable the block in the creative tab, use a `FeatureFlag` when building the contents within [`CreativeModeTabEvent$BuildContents`][creativetabs].

Further Reading
---------------

For information about block properties, such as those used for vanilla blocks like fences, walls, and many more, see the section on [blockstates].

[sounds]: ../gameeffects/sounds.md
[creativetabs]: ../items/index.md#creative-tabs
[creativetabs]: ../items/index.md#creativemodetabevent
[registering]: ../concepts/registries.md#methods-for-registering
[blockstates]: states.md
6 changes: 2 additions & 4 deletions docs/concepts/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ During the mod loading process, the various lifecycle events are fired on the mo

Event listeners should be registered either using `@EventBusSubscriber(bus = Bus.MOD)` or in the mod constructor:

```Java
```java
@Mod.EventBusSubscriber(modid = "mymod", bus = Mod.EventBusSubscriber.Bus.MOD)
public class MyModEventSubscriber {
@SubscribeEvent
Expand All @@ -30,12 +30,10 @@ public class MyMod {
Registry Events
---------------

The registry events are fired after the mod instance construction. There are two: `NewRegistryEvent`, `DataPackRegistryEvent$NewRegistry` and `RegisterEvent`. These events are fired synchronously during mod loading.
The registry events are fired after the mod instance construction. There are two: `NewRegistryEvent` and `RegisterEvent`. These events are fired synchronously during mod loading.

`NewRegistryEvent` allows modders to register their own custom registries, using the `RegistryBuilder` class.

`DataPackRegistryEvent$NewRegistry` allows modders to register custom datapack registries by providing a `Codec` to encode and decode the object from JSON.

`RegisterEvent` is for [registering objects][registering] into the registries. The event is fired for each registry.

Data Generation
Expand Down
9 changes: 1 addition & 8 deletions docs/concepts/registries.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ An example of a mod registering a custom block:
```java
private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);

public static final RegistryObject<Block> ROCK_BLOCK = BLOCKS.register("rock", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE)));
public static final RegistryObject<Block> ROCK_BLOCK = BLOCKS.register("rock", () -> new Block(BlockBehaviour.Properties.of(Material.STONE)));

public ExampleMod() {
BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());
Expand Down Expand Up @@ -155,13 +155,6 @@ Any newly created registry should use its associated [registration method][regis

When using `NewRegistryEvent`, calling `#create` with a `RegistryBuilder` will return a supplier-wrapped registry. The supplied registry can be accessed after `NewRegistryEvent` has finished posting to the mod event bus. Getting the custom registry from the supplier before `NewRegistryEvent` finishes firing will result in a `null` value.

#### New Datapack Registries

New datapack registries can be added using the `DataPackRegistryEvent$NewRegistry` event on the mod event bus. The registry is created via `#dataPackRegistry` by passing in the `ResourceKey` representing the registry name and the `Codec` used to encode and decode the data from JSON. An optional `Codec` can be provided to sync the datapack registry to the client.

!!! important
Datapack Registries cannot be created with `DeferredRegister`. They can only be created through the event.

### With DeferredRegister

The `DeferredRegister` method is once again another wrapper around the above event. Once a `DeferredRegister` is created in a constant field using the `#create` overload which takes in the registry name and the mod id, the registry can be constructed via `DeferredRegister#makeRegistry`. This takes in a supplied `RegistryBuilder` containing any additional configurations. The method already populates `#setName` by default. Since this method can be returned at any time, a supplied version of an `IForgeRegistry` is returned instead. Getting the custom registry from the supplier before `NewRegistryEvent` is fired will result in a `null` value.
Expand Down
18 changes: 18 additions & 0 deletions docs/datastorage/capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,24 @@ By default, the capability data does not persist on death. In order to change th

This can be done via `PlayerEvent$Clone` by reading the data from the original entity and assigning it to the new entity. In this event, the `#isWasDeath` method can be used to distinguish between respawning after death and returning from the End. This is important because the data will already exist when returning from the End, so care has to be taken to not duplicate values in this case.

Migrating from IExtendedEntityProperties
---------------------------

Although the Capability system can do everything IEEPs (IExtendedEntityProperties) did and more, the two concepts don't fully match 1:1. This section will explain how to convert existing IEEPs into Capabilities.
This is a quick list of IEEP concepts and their Capability equivalent:
* Property name/id (`String`): Capability key (`ResourceLocation`)
* Registration (`EntityConstructing`): Attaching (`AttachCapabilitiesEvent<Entity>`), the real registration of the `Capability` happens during `FMLCommonSetupEvent`.
* Tag read/write methods: Does not happen automatically. Attach an `ICapabilitySerializable` in the event and run the read/write methods from the `serializeNBT`/`deserializeNBT`.
Quick conversion guide:
1. Convert the IEEP key/id string into a `ResourceLocation` (which will use your MODID as a namespace).
2. In your handler class (not the class that implements your capability interface), create a field that will hold the Capability instance.
3. Change the `EntityConstructing` event to `AttachCapabilitiesEvent`, and instead of querying the IEEP, you will want to attach an `ICapabilityProvider` (probably `ICapabilitySerializable`, which allows saving/loading from a tag).
4. Create a registration method if you don't have one (you may have one where you registered your IEEP's event handlers) and in it, run the capability registration function.
[expose]: #exposing-a-capability
[handled]: ../concepts/events.md#creating-an-event-handler
[network]: ../networking/index.md
4 changes: 4 additions & 0 deletions docs/gettingstarted/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Getting Started with Neo",
"position": 1
}
Loading

0 comments on commit 8dbb7fe

Please sign in to comment.