Skip to content

Commit 7f69a1c

Browse files
authored
Proofread 2025-06-15-1216.md (#132)
1 parent e4887a4 commit 7f69a1c

File tree

1 file changed

+76
-76
lines changed

1 file changed

+76
-76
lines changed

_posts/2025-06-15-1216.md

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ The following modules have been merged into other modules for simplicity:
2222
* `fabric-client-tags-api-v1` was merged into `fabric-tag-api-v1` ([#4647](https://github.com/FabricMC/fabric/pull/4647))
2323
* `fabric-blockrenderlayer-v1` was merged into `fabric-rendering-v1` ([#4675](https://github.com/FabricMC/fabric/pull/4675))
2424

25-
The tag api changes are technically breaking for some developers who explicitly depend on these modules. The removal and merging of these modules has been done to help improve peformance when setting up a new development environment.
25+
The tag API changes are technically breaking for some developers who explicitly depend on these modules. The removal and merging of these modules has been done to help improve peformance when setting up a new development environment.
2626

2727
The Fabric Rendering API previously provided a Material API, to allow modders more control of the way their models rendered. This has been removed.
2828
> Materials were removed ... because they were deemed to be an unnecessary part of the API design, and the breaking change induced by changes in 1.21.6 was related to materials, which made this the perfect time to remove them - PepperCode1
2929
30-
See [#4675](https://github.com/FabricMC/fabric/pull/4675) for more info.
30+
See ([#4675](https://github.com/FabricMC/fabric/pull/4675)) for more info.
3131

32-
In addition to being relocated, the `BlockRenderLayerMap` API was also updated to be more consistent out current api style:
32+
In addition to being relocated, the `BlockRenderLayerMap` API was also updated to be more consistent out current API style:
3333
```diff
3434
- import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
3535
+ import net.fabricmc.fabric.api.client.rendering.v1.BlockRenderLayerMap;
@@ -40,7 +40,7 @@ In addition to being relocated, the `BlockRenderLayerMap` API was also updated t
4040
See ([#4664](https://github.com/FabricMC/fabric/pull/4664)) for more info.
4141
### Breaking changes
4242

43-
Fabric's brand new HUD api had to be tottaly rewritten in 1.21.6. The new `HudElementRegistry` provides all of the functionality provided by the old API. The following basic example shows how you can draw text after all of the vanilla HUD layers.
43+
Fabric's brand new HUD API had to be totally rewritten in 1.21.6. The new `HudElementRegistry` provides all of the functionality provided by the old API. The following basic example shows how you can draw text after all of the vanilla HUD layers:
4444

4545
```java
4646
HudElementRegistry.addLast(Identifier.of("example", "hud"), (context, tickCounter) -> {
@@ -51,30 +51,30 @@ HudElementRegistry.addLast(Identifier.of("example", "hud"), (context, tickCounte
5151
If you wish to render your custom hud element before the vanilla chat you can do the following:
5252
```java
5353
HudElementRegistry.attachElementBefore(VanillaHudElements.CHAT, Identifier.of("example", "ud"), (context, tickCounter) -> {
54-
/* Render here */
54+
// ...
5555
});
5656
```
5757

5858

5959
### New Fabric API features
6060

61-
Since `Item#appendTooltip` has become deprecated, Fabric API now provides the `ComponentTooltipAppenderRegistry`. This registry provides `addAfter`, `addBefore`, `addFirst`, and `addLast` to allow you to position your tooltips relative to vanilla and other mods.
61+
Since `Item#appendTooltip` has become deprecated, Fabric API now provides the `ComponentTooltipAppenderRegistry`. This registry provides `addAfter`, `addBefore`, `addFirst`, and `addLast` to allow you to position your tooltips relative to vanilla and other mods.
6262
```java
63-
record MyAmazingComponent() implements TooltipAppender {
64-
@Override
65-
public void appendTooltip(Item.TooltipContext context, Consumer<Text> textConsumer, TooltipType type, ComponentsAccess components) {
66-
textConsumer.accept(Text.literal("Amazingness Awaits!"));
67-
}
63+
record MyAmazingComponent() implements TooltipAppender {
64+
@Override
65+
public void appendTooltip(Item.TooltipContext context, Consumer<Text> textConsumer, TooltipType type, ComponentsAccess components) {
66+
textConsumer.accept(Text.literal("Amazingness Awaits!"));
67+
}
6868
}
69-
ComponentType<MyAmazingComponent> myAmazingComponentComponentType = /*omitted for brevity*/;
69+
ComponentType<MyAmazingComponent> myAmazingComponentComponentType = /*...*/;
7070
ComponentTooltipAppenderRegistry.addAfter(
71-
DataComponentTypes.DAMAGE,
71+
DataComponentTypes.DAMAGE,
7272
myAmazingComponentComponentType
7373
);
7474
```
75-
Any `ItemStack` that has your component applied will call your components appendTooltip method, allowing you to append as you wish. ([#4587](https://github.com/FabricMC/fabric/pull/4587))
75+
Any `ItemStack` that has your component applied will call your component's `appendTooltip` method, allowing you to append as you wish. ([#4587](https://github.com/FabricMC/fabric/pull/4587))
7676

77-
The LootTable API has been expanded to make certain extreme usages more convenient. The `LootTableEvents.MODIFY_DROPS` event allows modders to customize the collective output of `LootTable`s. The `LootTableEvents.MODIFY` event should still be preferred when possible, for mod compatibility reasons. This event may also recurse if you generate loot from within a listener. ([#4643](https://github.com/FabricMC/fabric/pull/4643))
77+
The LootTable API has been expanded to make certain extreme usages more convenient. The `LootTableEvents.MODIFY_DROPS` event allows modders to customize the collective output of `LootTable`s. The `LootTableEvents.MODIFY` event should still be preferred when possible, for mod compatibility reasons. This event may also recurse if you generate loot from within a listener. ([#4643](https://github.com/FabricMC/fabric/pull/4643))
7878
```java
7979
var matchGetter = ServerRecipeManager.createCachedMatchGetter(RecipeType.SMELTING);
8080

@@ -86,32 +86,31 @@ LootTableEvents.MODIFY_DROPS.register((entry, context, drops) -> {
8686
if (!tool.isOf(Items.DIAMOND_PICKAXE)) return;
8787
var world = context.getWorld();
8888
var lookup = world.getRegistryManager();
89-
drops.replaceAll(drop -> {
90-
return matchGetter
91-
.getFirstMatch(new SingleStackRecipeInput(drop), world)
92-
.map(RecipeEntry::value)
93-
.map(recipe -> recipe.craft(input, lookup))
94-
.orElse(drop);
95-
});
89+
drops.replaceAll(drop ->
90+
matchGetter.getFirstMatch(new SingleStackRecipeInput(drop), world)
91+
.map(RecipeEntry::value)
92+
.map(recipe -> recipe.craft(input, lookup))
93+
.orElse(drop)
94+
);
9695
});
97-
```
98-
Continuing with our conventional tag api, We added new biome tags, allowing modders to differentiate biomes based on their primary wood type.
99-
The `ServerChunkEvents.CHUNK_LEVEL_TYPE_CHANGE` was added to allow more control over the timing of chunk events. This event fires for changes in chunk loading level, to react to changes not previously possible without mixins. ([#4541](https://github.com/FabricMC/fabric/pull/4541))
96+
```
97+
Continuing with our conventional tag API, we added new biome tags, allowing modders to differentiate biomes based on their primary wood type.
98+
The `ServerChunkEvents.CHUNK_LEVEL_TYPE_CHANGE` event was added to allow more control over the timing of chunk events. This event fires for changes in chunk loading level, to react to changes not previously possible without mixins. ([#4541](https://github.com/FabricMC/fabric/pull/4541))
10099

101100
An event was added for attachment changes, allowing reaction to an attachment value changing. This event can be recursive in nature, as if you set an attachment value from within a listener, the event will be invoked again. Modders should use proper recursion techniques to prevent infinite recursion. ([#4606](https://github.com/FabricMC/fabric/pull/4606))
102101

103102

104-
Still more events were added for Players leaving and joining the game:
103+
Two more events were added for players joining and leaving the game:
105104
```java
106-
AttachmentType<Instant> JOINED_TIME = /**/;
105+
AttachmentType<Instant> JOINED_TIME = /*...*/;
107106
ServerPlayerEvents.JOIN.register(player -> {
108-
// runs on the main thread, no need to use player.getServer().execute(() -> ...);
109-
player.setAttached(JOINED_TIME, Instant.now());
107+
// runs on the main thread, no need to use player.getServer().execute(() -> ...);
108+
player.setAttached(JOINED_TIME, Instant.now());
110109
});
111110
```
112111
```java
113-
List<ServerPlayerEntity> activePlayers = /**/;
114-
ServerPlayerEvents.LEAVE.register(activePlayers::remove);
112+
List<ServerPlayerEntity> activePlayers = /*...*/;
113+
ServerPlayerEvents.LEAVE.register(activePlayers::remove);
115114
```
116115
These events are designed for initializing and de-initializing state related to players, and run along vanilla code with the same purpose on the main thread, unlike the current events. ([#4642](https://github.com/FabricMC/fabric/pull/4642))
117116

@@ -126,78 +125,79 @@ public static final ModelKey<BlockStateModel> HALF_RED_SAND_MODEL_KEY = ModelKey
126125
public static final Identifier HALF_RED_SAND_MODEL_ID = id("half_red_sand");
127126

128127
public static void init() {
129-
ModelLoadingPlugin.register(pluginContext -> {
130-
pluginContext.addModel(HALF_RED_SAND_MODEL_KEY, HALF_RED_SAND_MODEL_ID, (model, baker) -> {
131-
ModelTextures textures = model.getTextures();
132-
return new SimpleBlockStateModel(new GeometryBakedModel(
133-
model.bakeGeometry(textures, baker, ModelRotation.X0_Y0),
134-
model.getAmbientOcclusion(),
135-
model.getParticleTexture(textures, baker)
136-
));
137-
});
128+
ModelLoadingPlugin.register(pluginContext -> {
129+
pluginContext.addModel(HALF_RED_SAND_MODEL_KEY, HALF_RED_SAND_MODEL_ID, (model, baker) -> {
130+
ModelTextures textures = model.getTextures();
131+
return new SimpleBlockStateModel(new GeometryBakedModel(
132+
model.bakeGeometry(textures, baker, ModelRotation.X0_Y0),
133+
model.getAmbientOcclusion(),
134+
model.getParticleTexture(textures, baker)
135+
));
136+
});
137+
})
138138
}
139139

140140
public static BlockStateModel getModel() {
141-
return MinecraftClient.getInstance().getBakedModelManager().getModel(HALF_RED_SAND_MODEL_KEY);
141+
return MinecraftClient.getInstance().getBakedModelManager().getModel(HALF_RED_SAND_MODEL_KEY);
142142
}
143143
```
144144

145-
`FabricTrackedDataRegistry` has been added to allow registering of tracked data handlers for entities. This removes conflicts between mods registering tracked data handlers and ensures that the order is consistent between the client and server. If you previouly used the vanilla API the following 1 line change is all you need to take advantage of this new API:
145+
`FabricTrackedDataRegistry` has been added to allow registering tracked data handlers for entities. This removes conflicts between mods registering tracked data handlers and ensures that the order is consistent between the client and server. If you previously used the vanilla API the following 1 line change is all you need to take advantage of this new API:
146146

147147
```diff
148148
- TrackedDataHandlerRegistry.register(TRACKED_DATA_HANDLER);
149149
+ FabricTrackedDataRegistry.registerHandler(TRACKED_DATA_HANDLER_ID, TRACKED_DATA_HANDLER);
150150
```
151151

152152
### Bug Fixes
153-
Due to diligent developers and players, Many bugs in Fabric API were reported and patched during this update cycle. See [The Fabric Github](https://github.com/FabricMC/fabric/pulls?q=is%3Apr+is%3Aclosed+label%3Abug) for more info.
153+
Thanks to the diligent developers and players, many bugs in Fabric API were reported and patched during this update cycle. See [The Fabric Github](https://github.com/FabricMC/fabric/pulls?q=is%3Apr+is%3Aclosed+label%3Abug) for more info.
154154
## Minecraft changes
155155
### Rendering
156156
Mojang is currently working on separating Minecraft's rendering pipeline into two stages:
157157
1. The extraction stage, where all renderable data is seperated from the game
158158
2. The render phase, where the previously extracted data is rendered.
159159

160-
This process began in 1.21.2, and is still incomplete as of this update. Chunk rendering, GUI rendering and HUD rendering have all been converted to use the new separate rendering style. The ultimate goal of this separation is to enable the game to render one frame while the next is being extracted.
160+
This process began in 1.21.2, and is still incomplete as of this update. Chunk, GUI and HUD rendering have all been converted to use the new separate rendering style. The ultimate goal of this separation is to enable the game to render one frame while the next is being extracted.
161161

162-
Many methods in `RenderSystem` have been removed without direct replacement. In most cases, there isn't a one-to-one translation from the old code to the new, but the same capabilities exist by combining the new `RenderPipline`s with `RenderLayer`s
162+
Many methods in `RenderSystem` have been removed without direct replacement. In most cases, there isn't a one-to-one translation from the old code to the new, but the same capabilities exist by combining the new `RenderPipeline`s with `RenderLayer`s.
163163

164164
### NBT
165165

166-
`BlockEntity`s now abstract saving to NBT through `(Read|Write)View`s. These views are responsible for storing errors from encoding / decoding, and keeping track of registries throughout the serialization process. You can read from a `ReadView` using the `read` method, passing in a `Codec` for the desired type. Likewise, you can write to a `WriteView` by using the `put` method, passing in a `Codec` for the type, and the value in question. there are also methods for primitives, under `get(Int, Short, Boolean, ...)` and `put(Int, Short, Boolean, ...)`. The View also provides methods for working with lists, nullable types, and nested objects.
166+
`BlockEntity`s now abstract saving to NBT through `ReadView`s and `WriteView`s. These views are responsible for storing errors from encoding / decoding, and keeping track of registries throughout the serialization process. You can read from a `ReadView` using the `read` method, passing in a `Codec` for the desired type. Likewise, you can write to a `WriteView` by using the `put` method, passing in a `Codec` for the type, and the value in question. there are also methods for primitives, under `get(Int, Short, Boolean, ...)` and `put(Int, Short, Boolean, ...)`. The View also provides methods for working with lists, nullable types, and nested objects.
167167
```java
168168
class BE extends BlockEntity {
169-
private int anInt;
170-
private String aString;
171-
private Extra extra;
172-
// ctor excluded for brevity
173-
@Override
174-
public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registries) {
175-
return createNbt(registries); // createNbt takes care of adapting to / from WriteView
176-
}
177-
178-
@Override
179-
protected void writeData(WriteView view) {
180-
super.writeData(view);
181-
view.putNullable("extra", Extra.CODEC, this.extra);
182-
if (aString != null) // putString will eventually throw if we pass null
183-
view.putString("aString", aString);
184-
view.putInt("anInt", anInt);
185-
}
186-
187-
@Override
188-
protected void readData(ReadView view) {
189-
super.readData(view);
190-
view.read("extra", Extra.CODEC).ifPresent(extra -> this.extra = extra);
191-
view.getOptionalString("aString").ifPresent(aString -> this.aString = aString);
192-
view.getOptionalInt("anInt").ifPresent(anInt -> this.anInt = anInt);
193-
}
194-
195-
record Extra(int i, int j) {
196-
public static final Codec<Extra> CODEC = RecordCodecBuilder.create(instance -> instance.group(Codec.INT.fieldOf("i").forGetter(extra -> extra.i), Codec.INT.fieldOf("j").forGetter(extra -> extra.j)).apply(instance, Extra::new));
197-
}
169+
private int anInt;
170+
private String aString;
171+
private Extra extra;
172+
// Ctor excluded for brevity
173+
@Override
174+
public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registries) {
175+
return createNbt(registries); // createNbt takes care of adapting to / from WriteView
176+
}
177+
178+
@Override
179+
protected void writeData(WriteView view) {
180+
super.writeData(view);
181+
view.putNullable("extra", Extra.CODEC, this.extra);
182+
if (aString != null) // putString will eventually throw if we pass null
183+
view.putString("aString", aString);
184+
view.putInt("anInt", anInt);
185+
}
186+
187+
@Override
188+
protected void readData(ReadView view) {
189+
super.readData(view);
190+
view.read("extra", Extra.CODEC).ifPresent(extra -> this.extra = extra);
191+
view.getOptionalString("aString").ifPresent(aString -> this.aString = aString);
192+
view.getOptionalInt("anInt").ifPresent(anInt -> this.anInt = anInt);
193+
}
194+
195+
record Extra(int i, int j) {
196+
public static final Codec<Extra> CODEC = RecordCodecBuilder.create(instance -> instance.group(Codec.INT.fieldOf("i").forGetter(extra -> extra.i), Codec.INT.fieldOf("j").forGetter(extra -> extra.j)).apply(instance, Extra::new));
197+
}
198198
}
199199
```
200200

201201
### Data Generation
202202

203-
* `getOrCreateTagBuilder` should be replaced with the new `valueLookupBuilder`
203+
* `getOrCreateTagBuilder` should be replaced with the new `valueLookupBuilder`.

0 commit comments

Comments
 (0)