Skip to content

Commit

Permalink
fix(docs): Apply IHH's language fixes
Browse files Browse the repository at this point in the history
Co-authored-by: IchHabeHunger54 <[email protected]>
  • Loading branch information
ChampionAsh5357 and IchHabeHunger54 authored Jan 7, 2025
1 parent 96ed2f7 commit bb7bae6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/resources/client/models/datagen.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ While elaborate and complex models can be created through datagen, it is recomme

### Creating the Model Instance

Now that we have a `ModelTemplate`, how do we generate the model itself? Well, this is done by calling one of the `ModelTemplate#create*` methods. Although each create method takes in different parameters, at its core, it takes in the `ResourceLocation` representing the name of the file, a `TextureMapping` which maps a `TextureSlot` to some `ResourceLocation` relative to the `textures` directory, and the model output as a `BiConsumer<ResourceLocation, ModelInstance>`. This method create essentially creates the `JsonObject` used to generate the model, throwing an error if any duplicates are provided.
Now that we have a `ModelTemplate`, we can generate the model itself by calling one of the `ModelTemplate#create*` methods. Although each create method takes in different parameters, at their core, they all take in the `ResourceLocation` representing the name of the file, a `TextureMapping` which maps a `TextureSlot` to some `ResourceLocation` relative to the `textures` directory, and the model output as a `BiConsumer<ResourceLocation, ModelInstance>`. Then, the method essentially creates the `JsonObject` used to generate the model, throwing an error if any duplicates are provided.

:::note
Calling the base `create` method does not apply the stored suffix. Only `create*` methods that takes in the block or item do so.
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/client/models/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Using the optional NeoForge-added `render_type` field, you can set a render type
- `minecraft:cutout_mipped_all`: Variant of `minecraft:cutout_mipped` which applies mipmapping to item models as well.
- `minecraft:translucent`: Used for blocks where any pixel may be partially transparent, for example stained glass.
- `minecraft:tripwire`: Used by blocks with the special requirement of being rendered to the weather target, i.e. tripwire.
- `neoforge:item_unlit`: NeoForge-added. Should be used by blocks that, when rendered from an item, does not take into account the light directions.
- `neoforge:item_unlit`: NeoForge-added. Should be used by blocks that, when rendered from an item, do not take the light directions into account.

Selecting the correct render type is a question of performance to some degree. Solid rendering is faster than cutout rendering, and cutout rendering is faster than translucent rendering. Because of this, you should specify the "strictest" render type applicable for your use case, as it will also be the fastest.

Expand Down
18 changes: 9 additions & 9 deletions docs/resources/client/models/items.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import TabItem from '@theme/TabItem';

# Client Items

Client Items are the in-code representation of how an `ItemStack` should be rendered within the game, specifying what models to use given what state. The client items rea located within the `items` subdirectory within the [`assets` folder][assets], specified by the relative location within `DataComponents#ITEM_MODEL`. By default, this is the registry name of the object (e.g. `minecraft:apple` would be located at `assets/minecraft/items/apple.json` by default).
Client Items are the in-code representation of how an `ItemStack` should be rendered within the game, specifying what models to use given what state. The client items are located within the `items` subdirectory within the [`assets` folder][assets], specified by the relative location within `DataComponents#ITEM_MODEL`. By default, this is the registry name of the object (e.g. `minecraft:apple` would be located at `assets/minecraft/items/apple.json` by default).

The client items are stored within the `ModelManager`, which can be accessed through `Minecraft.getInstance().modelManager`. Then, you can call `ModelManager#getItemModel` or `getItemProperties` to get the client item information by its [`ResourceLocation`][rl].

Expand All @@ -25,7 +25,7 @@ The JSON of a client item can be broken into two parts: the model, defined by `m
// Defines the model to render
"model": {
"type": "minecraft:model",
// Points to model JSON relative to the 'models' directory
// Points to a model JSON relative to the 'models' directory
// Located at 'assets/examplemod/models/item/example_item.json'
"model": "examplemod:item/example_item"
},
Expand All @@ -52,7 +52,7 @@ protected void registerModels(BlockModelGenerators blockModels, ItemModelGenerat
new ClientItem(
// Defines the model to render
new BlockModelWrapper.Unbaked(
// Points to model JSON relative to the 'models' directory
// Points to a model JSON relative to the 'models' directory
// Located at 'assets/examplemod/models/item/example_item.json'
ModelUtils.getModelLocation(EXAMPLE_ITEM.get()),
Collections.emptyList()
Expand Down Expand Up @@ -86,7 +86,7 @@ The `type` field within `model` determines how to choose the model to render for
{
"model": {
"type": "minecraft:model",
// Points to model JSON relative to the 'models' directory
// Points to a model JSON relative to the 'models' directory
// Located at 'assets/examplemod/models/item/example_item.json'
"model": "examplemod:item/example_item"
}
Expand All @@ -105,7 +105,7 @@ protected void registerModels(BlockModelGenerators blockModels, ItemModelGenerat
itemModels.itemModelOutput.accept(
EXAMPLE_ITEM.get(),
new BlockModelWrapper.Unbaked(
// Points to model JSON relative to the 'models' directory
// Points to a model JSON relative to the 'models' directory
// Located at 'assets/examplemod/models/item/example_item.json'
ModelUtils.getModelLocation(EXAMPLE_ITEM.get()),
Collections.emptyList()
Expand All @@ -119,7 +119,7 @@ protected void registerModels(BlockModelGenerators blockModels, ItemModelGenerat

### Tinting

Like most models, they can change the color of the specified texture based on the properties of the stack. As such, the `minecraft:model` type has the `tints` field to define the opaque colors to apply. These are known as `ItemTintSource`s, which are defined in `ItemTintSources`. They also have a `type` field to define which source to use. The `tintindex` they are applied to is specified by its index into the list.
Like most models, client items can change the color of the specified texture based on the properties of the stack. As such, the `minecraft:model` type has the `tints` field to define the opaque colors to apply. These are known as `ItemTintSource`s, which are defined in `ItemTintSources`. They also have a `type` field to define which source to use. The `tintindex` they are applied to is specified by their index within the list.

<Tabs>
<TabItem value="json" label="JSON" default>
Expand Down Expand Up @@ -248,7 +248,7 @@ public static void registerItemTintSources(RegisterColorHandlersEvent.ItemTintSo

## Composite Models

SSometimes, you may want to register multiple models for a single item. While this can be done directly with the [composite model loader][composite], for item models, there is a custom `minecraft:composite` type, which takes a list of models to render.
Sometimes, you may want to register multiple models for a single item. While this can be done directly with the [composite model loader][composite], for item models, there is a custom `minecraft:composite` type which takes a list of models to render.

<Tabs>
<TabItem value="json" label="JSON" default>
Expand Down Expand Up @@ -320,7 +320,7 @@ Some items change their state depending on the data stored in their stack (e.g.,

### Range Dispatch Models

Range dispatch models are the most similar to the item override some pre-1.21.4. Effectively, the type defines some `RangeSelectItemModelProperty` to get some float to switch the model on. Each entry then has some threshold value which the float must be greater than to render. The model chosen is the one with the closest threshold value that is not over the property value (e.g., if the property values is `4` with thresholds `3` and `5`, then the model associated with `3` will be rendered). The available `RangeSelectItemModelProperty`s to use can be found in `RangeSelectItemModelProperties`.
Range dispatch models have the type define some `RangeSelectItemModelProperty` to get some float to switch the model on. Each entry then has some threshold value which the float must be greater than to render. The model chosen is the one with the closest threshold value that is not over the property value (e.g., if the property values is `4` with thresholds `3` and `5`, then the model associated with `3` will be rendered, and if the value was `6`, then the model associated with `5` would be rendered). The available `RangeSelectItemModelProperty`s to use can be found in `RangeSelectItemModelProperties`.

<Tabs>
<TabItem value="json" label="JSON" default>
Expand Down Expand Up @@ -1073,7 +1073,7 @@ public record RenderTypeModelWrapper(BakedModel model, RenderType type) implemen
}
```
Finally, we register the map codec via `RegisterItemModelsEvent` on the [mod event bus][modbus].
Then, we register the map codec via `RegisterItemModelsEvent` on the [mod event bus][modbus].
```java
// In some class where the event is registered to the mod event bus
Expand Down
12 changes: 6 additions & 6 deletions docs/resources/client/models/modelloaders.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ To create your own model loader, you need three classes, plus an event handler:
To illustrate how these classes are connected, we will follow a model being loaded:

- During model loading, a model JSON with the `loader` property set to your loader is passed to your unbaked model loader. The loader then reads the model JSON and returns an unbaked object using the model JSON's properties.
- During model baking, the ojbect is baked, returning a baked model.
- During model baking, the object is baked, returning a baked model.
- During model rendering, the baked model is used for rendering.

:::note
Expand Down Expand Up @@ -151,9 +151,9 @@ public class MyUnbakedModel extends AbstractUnbakedModel {
// - The model baker. Can be used for baking sub-models and getting sprites from the texture slots.
// - The model state. This holds the properties from the blockstate file, e.g. rotations and the uvlock boolean.
// - A boolean of whether to use ambient occlusion when rendering the model.
// - A boolean of whether the use the block light when rendering a model.
// - A boolean of whether to use the block light when rendering a model.
// - The item transforms associated with how this model should be displayed in a given ItemDisplayContext.
// - A ContextMap of settings provided by NeoForge. See NeoForgeModelProperties for all available properties.
// - A ContextMap of settings provided by NeoForge. See the NeoForgeModelProperties class for all available properties.
@Override
public BakedModel bake(TextureSlots textures, ModelBaker baker, ModelState modelState, boolean useAmbientOcclusion, boolean usesBlockLight, ItemTransforms itemTransforms, ContextMap additionalProperties) {
// The true boolean represents if the model is in 3D within the GUI
Expand Down Expand Up @@ -266,7 +266,7 @@ protected void registerModels(BlockModelGenerators blockModels, ItemModelGenerat

#### Visibility

The default implementation of `CustomLoaderBuilder` holds methods for applying visibility. You may choose to use or ignore the `visibility` property in your model loader. Currently, only the [composite model loader][composite] and [OBJ loader][obj] makes use of this property.
The default implementation of `CustomLoaderBuilder` holds methods for applying visibility. You may choose to use or ignore the `visibility` property in your model loader. Currently, only the [composite model loader][composite] and [OBJ loader][obj] make use of this property.

### Reusing the Default Model Loader

Expand Down Expand Up @@ -297,14 +297,14 @@ public class MyUnbakedModelLoader implements UnbakedModelLoader<MyUnbakedModel>
public class MyUnbakedModel extends DelegateUnbakedModel {

// Store the model for use below
public MyUnbakedModel(UnbakedModel model, /* other parameters here */) {
public MyUnbakedModel(UnbakedModel model, /* other parameters here */) {
super(model);
}

@Override
public BakedModel bake(TextureSlots textures, ModelBaker baker, ModelState modelState, boolean useAmbientOcclusion, boolean usesBlockLight, ItemTransforms itemTransforms, ContextMap additionalProperties) {
BakedModel base = super.bake(textures, baker, modelState, useAmbientOcclusion, usesBlockLight, itemTransforms, additionalProperties);
return new MyBakedModel(base, /* other parameters here */);
return new MyBakedModel(base, /* other parameters here */);
}
}

Expand Down

1 comment on commit bb7bae6

@neoforged-pages-deployments
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploying with Cloudflare Pages

Name Result
Last commit: bb7bae63b32613befd1084b04c3e8928a8fc1e7f
Status: ✅ Deploy successful!
Preview URL: https://dbb569c0.neoforged-docs-previews.pages.dev
PR Preview URL: https://pr-211.neoforged-docs-previews.pages.dev

Please sign in to comment.