Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.21.4 #211

Merged
merged 30 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
840a612
fix(docs): Bug fixes in 1.21.2 docs before update
ChampionAsh5357 Dec 3, 2024
57563ac
feat(docs): Create 1.21.3 version
ChampionAsh5357 Dec 3, 2024
69caab1
feat(docs): Update getting started
ChampionAsh5357 Dec 14, 2024
eb9193e
feat(docs): Update legacy section
ChampionAsh5357 Dec 14, 2024
3d40dea
feat(docs): Update misc section
ChampionAsh5357 Dec 14, 2024
c7df8e7
feat(docs): Update server section
ChampionAsh5357 Dec 14, 2024
7630264
feat(docs): Update recipe section
ChampionAsh5357 Dec 14, 2024
63f1b7a
feat(docs): Update data maps section
ChampionAsh5357 Dec 14, 2024
3d084fd
feat(docs): Update concepts section
ChampionAsh5357 Dec 14, 2024
3c0f7f9
feat(docs): Update loot table section
ChampionAsh5357 Dec 14, 2024
c31427b
feat(docs): Update block section
ChampionAsh5357 Dec 14, 2024
c32c48f
fix(docs): Add mention for levels in attachment docs
ChampionAsh5357 Dec 16, 2024
a973c39
feat(docs): Update client section
ChampionAsh5357 Dec 16, 2024
8746736
feat(docs): Update resources section
ChampionAsh5357 Dec 16, 2024
d6f0bab
feat(docs): Update items section
ChampionAsh5357 Dec 16, 2024
764a281
feat(docs): Update models section
ChampionAsh5357 Dec 16, 2024
5f908d6
fix(docs): Fix layering for extra face data
ChampionAsh5357 Dec 16, 2024
65288ba
Apply IHH's suggestions
ChampionAsh5357 Dec 20, 2024
8fcfcc2
feat(docs): Add client item documentation
ChampionAsh5357 Dec 27, 2024
cb9b6df
feat(docs): Update model datagen
ChampionAsh5357 Dec 27, 2024
075838f
fix(docs): Add end tabs tags
ChampionAsh5357 Dec 27, 2024
92d4362
fix(docs): Apply Xfact's suggestions
ChampionAsh5357 Dec 29, 2024
e12b53d
fix(docs): Provide better clarity on model usage
ChampionAsh5357 Dec 29, 2024
2fef34e
feat(docs): Remove all references to EFH
ChampionAsh5357 Dec 29, 2024
96ed2f7
fix(docs): Add commas to registrar examples
ChampionAsh5357 Dec 29, 2024
bb7bae6
fix(docs): Apply IHH's language fixes
ChampionAsh5357 Jan 7, 2025
8bb670b
fix(docs): Add missing information as requested by IHH
ChampionAsh5357 Jan 7, 2025
cfd4992
fix(docs): Unindent line
ChampionAsh5357 Jan 7, 2025
daab973
chore(docs): More datagen indent changes
ChampionAsh5357 Jan 7, 2025
a68876e
chore(docs): Word change!
ChampionAsh5357 Jan 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/advanced/featureflags.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ This file differs from the one in your mod's `resources/` directory. This file d
"examplemod:experimental"
]
},
"pack": { ... }
"pack": { /*...*/ }
}
```

Expand Down
66 changes: 4 additions & 62 deletions docs/blockentities/ber.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,74 +60,16 @@ public static void registerEntityRenderers(EntityRenderersEvent.RegisterRenderer
}
```

## `BlockEntityWithoutLevelRenderer`
## Item Block Rendering

`BlockEntityWithoutLevelRenderer`, colloquially known as BEWLR, is an adaptation of the regular `BlockEntityRenderer` for special [item] rendering (hence "without level", as items do not have level context). Its overall purpose is the same: do special rendering for cases where static models aren't enough.
As not all block entities with renderers can be rendered using static models, you can create a special renderer to customize the item rendering process. This is done using [`SpecialModelRenderer`s][special]. In these cases, both a special model renderer must be created to render the item correctly, and a corresponding registered special block model renderer for scenarios when a block is being rendered as an item (e.g., enderman carrying a block).

To add a BEWLR, create a class that extends `BlockEntityWithoutLevelRenderer` and overrides `#renderByItem`. It also requires some additional constructor setup:

```java
public class MyBlockEntityWithoutLevelRenderer extends BlockEntityWithoutLevelRenderer {
// We need some boilerplate in the constructor, telling the superclass where to find the central block entity and entity renderers.
public MyBlockEntityWithoutLevelRenderer() {
super(Minecraft.getInstance().getBlockEntityRenderDispatcher(), Minecraft.getInstance().getEntityModels());
}

@Override
public void renderByItem(ItemStack stack, ItemDisplayContext transform, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, int packedOverlay) {
// Do the rendering here.
}
}
```

Keep in mind that, like with BERs, there is only one instance of your BEWLR. Stack-specific properties should therefore be stored in the stack, not the BEWLR.

Unlike BERs, we do not register BEWLRs directly. Instead, we register an instance of `IClientItemExtensions` to the `RegisterClientExtensionsEvent`. `IClientItemExtensions` is an interface that allows us to specify a number of rendering-related behaviors on items, such as (but not limited to) a BEWLR. As such, our implementation of that interface could look like so:

```java
public class MyClientItemExtensions implements IClientItemExtensions {
// Cache our BEWLR in a field.
private final MyBlockEntityWithoutLevelRenderer myBEWLR = new MyBlockEntityWithoutLevelRenderer();

// Return our BEWLR here.
@Override
public BlockEntityWithoutLevelRenderer getCustomRenderer() {
return myBEWLR;
}
}
```

And then, we can register our `IClientItemExtensions` to the event:

```java
@SubscribeEvent
public static void registerClientExtensions(RegisterClientExtensionsEvent event) {
event.registerItem(
// The only instance of our IClientItemExtensions, and as such, the only instance of our BEWLR.
new MyClientItemExtensions(),
// A vararg list of items that use this BEWLR.
MyItems.ITEM_1, MyItems.ITEM_2
);
}
```

:::info
`IClientItemExtensions` are generally expected to be treated as singletons. Do not construct them outside `RegisterClientExtensionsEvent`!
:::

Finally, the item has to know that it should use the BEWLR for its rendering. This is done by having the final [`BakedModel`][bakedmodel] return true for `#isCustomRenderer`. The easiest way to do this is to have the [item model JSON][model] with a `parent` of `minecraft:builtin/entity`:

```json5
// In some item model file assets/<mod_id>/models/item/<registry_name>.json
{
"parent": "minecraft: builtin/entity",
// ...
}
```
How to do so can be found within the [client item documentation][special].

[block]: ../blocks/index.md
[blockentity]: index.md
[event]: ../concepts/events.md#registering-an-event-handler
[eventbus]: ../concepts/events.md#event-buses
[item]: ../items/index.md
[model]: ../resources/client/models/index.md
[special]: ../resources/client/models/items.md#special-models
2 changes: 1 addition & 1 deletion docs/blocks/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static final DeferredRegister<MapCodec<? extends Block>> REGISTRAR = Defe

public static final Supplier<MapCodec<SimpleBlock>> SIMPLE_CODEC = REGISTRAR.register(
"simple",
() -> simpleCodec(SimpleBlock::new)
() -> BlockBehaviour.simpleCodec(SimpleBlock::new)
);
```

Expand Down
4 changes: 2 additions & 2 deletions docs/concepts/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ Then, during `InterModProcessEvent`, you can use `InterModComms#getMessages` to

Next to the lifecycle events, there are a few miscellaneous events that are fired on the mod event bus, mostly for legacy reasons. These are generally events 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:

- `RegisterColorHandlersEvent.Block`, `.Item`, `.ColorResolvers`
- `RegisterColorHandlersEvent.Block`, `.ItemTintSources`, `.ColorResolvers`
- `ModelEvent.BakingCompleted`
- `TextureAtlasStitchedEvent`

:::warning
Most of these events are planned to be moved to the main event bus in a future version.
Most of these events are planned to be moved to the game event bus in a future version.
:::

[modbus]: #event-buses
Expand Down
13 changes: 8 additions & 5 deletions docs/concepts/registries.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ We can then add our registry entries as static final fields using one of the fol
```java
public static final DeferredHolder<Block, Block> EXAMPLE_BLOCK_1 = BLOCKS.register(
// Our registry name.
"example_block"
"example_block",
// A supplier of the object we want to register.
() -> new Block(...)
);

public static final DeferredHolder<Block, SlabBlock> EXAMPLE_BLOCK_2 = BLOCKS.register(
// Our registry name.
"example_block"
"example_block",
// A function creating the object we want to register
// given its registry name as a ResourceLocation.
registryName -> new SlabBlock(...)
Expand All @@ -64,14 +64,14 @@ The class `DeferredHolder<R, T extends R>` holds our object. The type parameter
```java
public static final Supplier<Block> EXAMPLE_BLOCK_1 = BLOCKS.register(
// Our registry name.
"example_block"
"example_block",
// A supplier of the object we want to register.
() -> new Block(...)
);

public static final Supplier<SlabBlock> EXAMPLE_BLOCK_2 = BLOCKS.register(
// Our registry name.
"example_block"
"example_block",
// A function creating the object we want to register
// given its registry name as a ResourceLocation.
registryName -> new SlabBlock(...)
Expand Down Expand Up @@ -236,7 +236,10 @@ public static void registerDatapackRegistries(DataPackRegistryEvent.NewRegistry
// May be null. If null, registry entries will not be synced to the client at all.
// May be omitted, which is functionally identical to passing null (a method overload
// with two parameters is called that passes null to the normal three parameter method).
Spell.CODEC
Spell.CODEC,
// A consumer which configures the constructed registry via the RegistryBuilder.
// May be omitted, which is functionally identical to passing builder -> {}.
builder -> builder.maxId(256)
);
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/datastorage/attachments.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sidebar_position: 3
---
# Data Attachments

The data attachment system allows mods to attach and store additional data on block entities, chunks, and entities.
The data attachment system allows mods to attach and store additional data on block entities, chunks, entities, and levels.

_To store additional level data, you can use [SavedData][saveddata]._

Expand Down
4 changes: 2 additions & 2 deletions docs/gettingstarted/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ You should always test your mod in a dedicated server environment. This includes
[github]: https://github.com/
[intellij]: https://www.jetbrains.com/idea/
[jdk]: https://learn.microsoft.com/en-us/java/openjdk/download#openjdk-21
[mdgmdk]: https://github.com/NeoForgeMDKs/MDK-1.21-ModDevGradle
[ngmdk]: https://github.com/NeoForgeMDKs/MDK-1.21-NeoGradle
[mdgmdk]: https://github.com/NeoForgeMDKs/MDK-1.21.4-ModDevGradle
[ngmdk]: https://github.com/NeoForgeMDKs/MDK-1.21.4-NeoGradle
[neogradle]: https://docs.neoforged.net/neogradle/docs/
[properties]: modfiles.md#gradleproperties
3 changes: 3 additions & 0 deletions docs/gettingstarted/modfiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Most values are also explained as comments in [the MDK's `gradle.properties` fil
|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
| `org.gradle.jvmargs` | Allows you to pass extra JVM arguments to Gradle. Most commonly, this is used to assign more/less memory to Gradle. Note that this is for Gradle itself, not Minecraft. | `org.gradle.jvmargs=-Xmx3G` |
| `org.gradle.daemon` | Whether Gradle should use the daemon when building. | `org.gradle.daemon=false` |
| `org.gradle.parallel` | Whether Gradle should fork JVMs to execute projects in parallel. | `org.gradle.parallel=false` |
| `org.gradle.caching` | Whether Gradle should reuse task outputs from previous builds. | `org.gradle.caching=false` |
| `org.gradle.configuration-cache` | Whether Gradle should reuse the build configuration from previous builds. | `org.gradle.configuration-cache=false` |
| `org.gradle.debug` | Whether Gradle is set to debug mode. Debug mode mainly means more Gradle log output. Note that this is for Gradle itself, not Minecraft. | `org.gradle.debug=false` |
| `minecraft_version` | The Minecraft version you are modding on. Must match with `neo_version`. | `minecraft_version=1.20.6` |
| `minecraft_version_range` | The Minecraft version range this mod can use, as a [Maven Version Range][mvr]. Note that [snapshots, pre-releases and release candidates][mcversioning] are not guaranteed to sort properly, as they do not follow maven versioning. | `minecraft_version_range=[1.20.6,1.21)` |
Expand Down
Loading
Loading