# Breaking changes
- `VillagerPlantableRegistry` replaced with `ItemTags.VILLAGER_PLANTABLE_SEEDS`
- `FabricItemGroup.builder()` no longer takes an `Identifier`
- `FabricItemGroup.build()` no longer registers the ItemGroup, this now needs to go in the vanilla registry.
- `ItemGroupEvents.modifyEntriesEvent` now takes a `RegistryKey<ItemGroup>` in place of an `Identifier`
- `FabricLanguageProvider` now takes a `RegistryKey<ItemGroup>` in place of an `ItemGroup`
- `IdentifiableItemGroup` removed, replaced with vanilla registries.
- `FabricMaterialBuilder` removed, no replacement.
- `HudRenderCallback.onHudRender` now passed a `DrawableHelper` in place of `MatrixStack`
- `ScreenEvents.beforeRender` now passed a `DrawableHelper` in place of `MatrixStack`
- `ScreenEvents.afterRender` now passed a `DrawableHelper` in place of `MatrixStack`
- `Screens.getItemRenderer()` removed. Replace with `MinecraftClient.getItemRenderer()`

`DrawableHelper` is likely to be renamed soon, see: https://github.com/FabricMC/yarn/pull/3548/
This commit is contained in:
modmuss50
2023-04-20 20:03:32 +01:00
committed by GitHub
parent 451493807b
commit eff26386be
60 changed files with 305 additions and 921 deletions

View File

@@ -17,9 +17,9 @@
package net.fabricmc.fabric.test.networking.channeltest;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.widget.EntryListWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
@@ -51,8 +51,8 @@ final class ChannelList extends EntryListWidget<ChannelList.Entry> {
}
@Override
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
ChannelList.this.client.textRenderer.draw(matrices, Text.literal(this.channel.toString()), x, y, Formatting.WHITE.getColorValue());
public void render(DrawableHelper drawableHelper, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
drawableHelper.method_51438(ChannelList.this.client.textRenderer, Text.literal(this.channel.toString()).formatted(Formatting.WHITE), x, y);
}
}
}

View File

@@ -16,10 +16,10 @@
package net.fabricmc.fabric.test.networking.channeltest;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.tooltip.Tooltip;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
@@ -58,22 +58,20 @@ final class ChannelScreen extends Screen {
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.renderBackgroundTexture(matrices);
this.channelList.render(matrices, mouseX, mouseY, delta);
super.render(matrices, mouseX, mouseY, delta);
public void render(DrawableHelper drawableHelper, int mouseX, int mouseY, float delta) {
this.renderBackgroundTexture(drawableHelper);
this.channelList.render(drawableHelper, mouseX, mouseY, delta);
super.render(drawableHelper, mouseX, mouseY, delta);
if (this.s2cButton.active && this.c2sButton.active) {
final Text clickMe = Text.literal("Click S2C or C2S to view supported channels");
final Text clickMe = Text.literal("Click S2C or C2S to view supported channels").formatted(Formatting.YELLOW);
final int textWidth = this.textRenderer.getWidth(clickMe);
//noinspection ConstantConditions
this.textRenderer.draw(
matrices,
drawableHelper.method_51438(
this.textRenderer,
clickMe,
this.width / 2.0F - (textWidth / 2.0F),
60,
Formatting.YELLOW.getColorValue()
(int) (this.width / 2.0F - (textWidth / 2.0F)),
60
);
}
}