diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-11-17 19:55:02 +0100 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-11-17 19:55:02 +0100 |
| commit | c93a04a001b0f66b2724d46b04b6d1ed49a08d07 (patch) | |
| tree | 5869ca70acc482ef0362f27785c3d3f1cbb9ffae /src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts | |
| parent | af9893b59407c69d31ebd2ed513f0396ab4d2dc9 (diff) | |
| download | Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.gz Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.bz2 Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.zip | |
refactor: port to mojmaps
Diffstat (limited to 'src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts')
8 files changed, 103 insertions, 103 deletions
diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ExpandScreenBoundaries.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ExpandScreenBoundaries.java index d5b06ad..3598d37 100644 --- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ExpandScreenBoundaries.java +++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ExpandScreenBoundaries.java @@ -1,16 +1,16 @@ package moe.nea.firmament.mixins.custommodels.screenlayouts; import moe.nea.firmament.features.texturepack.CustomScreenLayouts; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.gui.screen.ingame.RecipeBookScreen; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.gui.screens.inventory.AbstractRecipeBookScreen; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -@Mixin({HandledScreen.class, RecipeBookScreen.class}) +@Mixin({AbstractContainerScreen.class, AbstractRecipeBookScreen.class}) public class ExpandScreenBoundaries { - @Inject(method = "isClickOutsideBounds", at = @At("HEAD"), cancellable = true) + @Inject(method = "hasClickedOutside", at = @At("HEAD"), cancellable = true) private void onClickOutsideBounds(double mouseX, double mouseY, int left, int top, CallbackInfoReturnable<Boolean> cir) { var background = CustomScreenLayouts.getMover(CustomScreenLayouts.CustomScreenLayout::getBackground); if (background == null) return; diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/MoveSignElements.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/MoveSignElements.java index 916a877..0475a8b 100644 --- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/MoveSignElements.java +++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/MoveSignElements.java @@ -8,9 +8,9 @@ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.llamalad7.mixinextras.sugar.Local; import com.llamalad7.mixinextras.sugar.Share; import moe.nea.firmament.features.texturepack.CustomScreenLayouts; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ingame.AbstractSignEditScreen; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.inventory.AbstractSignEditScreen; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -18,8 +18,8 @@ import org.spongepowered.asm.mixin.injection.At; public class MoveSignElements { @WrapWithCondition( method = "renderSign", - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/AbstractSignEditScreen;renderSignBackground(Lnet/minecraft/client/gui/DrawContext;)V")) - private boolean onDrawBackgroundSign(AbstractSignEditScreen instance, DrawContext drawContext) { + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/AbstractSignEditScreen;renderSignBackground(Lnet/minecraft/client/gui/GuiGraphics;)V")) + private boolean onDrawBackgroundSign(AbstractSignEditScreen instance, GuiGraphics drawContext) { final var override = CustomScreenLayouts.getActiveScreenOverride(); if (override == null || override.getBackground() == null) return true; override.getBackground().renderDirect(drawContext); @@ -27,44 +27,44 @@ public class MoveSignElements { } @WrapOperation(method = "renderSignText", at = { - @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawSelection(IIII)V")} + @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;textHighlight(IIII)V")} ) private void onRenderSignTextSelection( - DrawContext instance, int x1, int y1, int x2, int y2, Operation<Void> original, - @Local(index = 9) int messageIndex) { - instance.getMatrices().pushMatrix(); + GuiGraphics instance, int x1, int y1, int x2, int y2, Operation<Void> original, + @Local(index = 9) int messageIndex) { + instance.pose().pushMatrix(); final var override = CustomScreenLayouts.getSignTextMover(messageIndex); if (override != null) { - instance.getMatrices().translate(override.getX(), override.getY()); + instance.pose().translate(override.getX(), override.getY()); } original.call(instance, x1, y1, x2, y2); - instance.getMatrices().popMatrix(); + instance.pose().popMatrix(); } @WrapOperation(method = "renderSignText", at = { - @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;fill(IIIII)V")} + @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;fill(IIIII)V")} ) private void onRenderSignTextFill( - DrawContext instance, int x1, int y1, int x2, int y2, int color, Operation<Void> original, @Local(index = 9) int messageIndex) { - instance.getMatrices().pushMatrix(); + GuiGraphics instance, int x1, int y1, int x2, int y2, int color, Operation<Void> original, @Local(index = 9) int messageIndex) { + instance.pose().pushMatrix(); final var override = CustomScreenLayouts.getSignTextMover(messageIndex); if (override != null) { - instance.getMatrices().translate(override.getX(), override.getY()); + instance.pose().translate(override.getX(), override.getY()); } original.call(instance, x1, y1, x2, y2, color); - instance.getMatrices().popMatrix(); + instance.pose().popMatrix(); } @WrapOperation(method = "renderSignText", at = { - @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Ljava/lang/String;IIIZ)V")}, + @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;drawString(Lnet/minecraft/client/gui/Font;Ljava/lang/String;IIIZ)V")}, expect = 2) - private void onRenderSignTextRendering(DrawContext instance, TextRenderer textRenderer, String text, int x, int y, int color, boolean shadow, Operation<Void> original, @Local(index = 9) int messageIndex) { - instance.getMatrices().pushMatrix(); + private void onRenderSignTextRendering(GuiGraphics instance, Font textRenderer, String text, int x, int y, int color, boolean shadow, Operation<Void> original, @Local(index = 9) int messageIndex) { + instance.pose().pushMatrix(); final var override = CustomScreenLayouts.getSignTextMover(messageIndex); if (override != null) { - instance.getMatrices().translate(override.getX(), override.getY()); + instance.pose().translate(override.getX(), override.getY()); } original.call(instance, textRenderer, text, x, y, color, shadow); - instance.getMatrices().popMatrix(); + instance.pose().popMatrix(); } } diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceAnvilScreen.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceAnvilScreen.java index 5dbdc8e..691c692 100644 --- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceAnvilScreen.java +++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceAnvilScreen.java @@ -3,15 +3,15 @@ package moe.nea.firmament.mixins.custommodels.screenlayouts; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import moe.nea.firmament.features.texturepack.CustomScreenLayouts; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ingame.AnvilScreen; -import net.minecraft.client.gui.screen.ingame.ForgingScreen; -import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.AnvilScreenHandler; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.inventory.AnvilScreen; +import net.minecraft.client.gui.screens.inventory.ItemCombinerScreen; +import net.minecraft.client.gui.components.EditBox; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AnvilMenu; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -19,32 +19,32 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(AnvilScreen.class) -public abstract class ReplaceAnvilScreen extends ForgingScreen<AnvilScreenHandler> { +public abstract class ReplaceAnvilScreen extends ItemCombinerScreen<AnvilMenu> { @Shadow - private TextFieldWidget nameField; + private EditBox name; - public ReplaceAnvilScreen(AnvilScreenHandler handler, PlayerInventory playerInventory, Text title, Identifier texture) { + public ReplaceAnvilScreen(AnvilMenu handler, Inventory playerInventory, Component title, ResourceLocation texture) { super(handler, playerInventory, title, texture); } - @Inject(method = "setup", at = @At("TAIL")) + @Inject(method = "subInit", at = @At("TAIL")) private void moveNameField(CallbackInfo ci) { var override = CustomScreenLayouts.getMover(CustomScreenLayouts.CustomScreenLayout::getNameField); if (override == null) return; - int baseX = (this.width - this.backgroundWidth) / 2; - int baseY = (this.height - this.backgroundHeight) / 2; - nameField.setX(baseX + override.getX()); - nameField.setY(baseY + override.getY()); + int baseX = (this.width - this.imageWidth) / 2; + int baseY = (this.height - this.imageHeight) / 2; + name.setX(baseX + override.getX()); + name.setY(baseY + override.getY()); if (override.getWidth() != null) - nameField.setWidth(override.getWidth()); + name.setWidth(override.getWidth()); if (override.getHeight() != null) - nameField.setHeight(override.getHeight()); + name.setHeight(override.getHeight()); } - @WrapOperation(method = "drawForeground", - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTextWithShadow(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;III)V"), + @WrapOperation(method = "renderLabels", + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;drawString(Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Component;III)V"), allow = 1) - private void onDrawRepairCost(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color, Operation<Void> original) { + private void onDrawRepairCost(GuiGraphics instance, Font textRenderer, Component text, int x, int y, int color, Operation<Void> original) { var textOverride = CustomScreenLayouts.getTextMover(CustomScreenLayouts.CustomScreenLayout::getRepairCostTitle); original.call(instance, textRenderer, textOverride.replaceText(text), diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceForgingScreen.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceForgingScreen.java index 6e9023d..8b07fec 100644 --- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceForgingScreen.java +++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceForgingScreen.java @@ -1,9 +1,9 @@ package moe.nea.firmament.mixins.custommodels.screenlayouts; -import net.minecraft.client.gui.screen.ingame.ForgingScreen; +import net.minecraft.client.gui.screens.inventory.ItemCombinerScreen; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.Inject; -@Mixin(ForgingScreen.class) +@Mixin(ItemCombinerScreen.class) public class ReplaceForgingScreen { } diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceFurnaceBackgrounds.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceFurnaceBackgrounds.java index 4c84143..d02085a 100644 --- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceFurnaceBackgrounds.java +++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceFurnaceBackgrounds.java @@ -3,27 +3,27 @@ package moe.nea.firmament.mixins.custommodels.screenlayouts; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import com.mojang.blaze3d.pipeline.RenderPipeline; import moe.nea.firmament.features.texturepack.CustomScreenLayouts; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ingame.AbstractFurnaceScreen; -import net.minecraft.client.gui.screen.ingame.RecipeBookScreen; -import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.AbstractFurnaceScreenHandler; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.inventory.AbstractFurnaceScreen; +import net.minecraft.client.gui.screens.inventory.AbstractRecipeBookScreen; +import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractFurnaceMenu; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import java.util.function.Function; @Mixin(AbstractFurnaceScreen.class) -public abstract class ReplaceFurnaceBackgrounds<T extends AbstractFurnaceScreenHandler> extends RecipeBookScreen<T> { - public ReplaceFurnaceBackgrounds(T handler, RecipeBookWidget<?> recipeBook, PlayerInventory inventory, Text title) { +public abstract class ReplaceFurnaceBackgrounds<T extends AbstractFurnaceMenu> extends AbstractRecipeBookScreen<T> { + public ReplaceFurnaceBackgrounds(T handler, RecipeBookComponent<?> recipeBook, Inventory inventory, Component title) { super(handler, recipeBook, inventory, title); } - @WrapWithCondition(method = "drawBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/util/Identifier;IIFFIIII)V"), allow = 1) - private boolean onDrawBackground(DrawContext instance, RenderPipeline pipeline, Identifier sprite, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { + @WrapWithCondition(method = "renderBg", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/resources/ResourceLocation;IIFFIIII)V"), allow = 1) + private boolean onDrawBackground(GuiGraphics instance, RenderPipeline pipeline, ResourceLocation sprite, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { final var override = CustomScreenLayouts.getActiveScreenOverride(); if (override == null || override.getBackground() == null) return true; override.getBackground().renderGeneric(instance, this); diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceGenericBackgrounds.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceGenericBackgrounds.java index bd12177..ec6cfc6 100644 --- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceGenericBackgrounds.java +++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceGenericBackgrounds.java @@ -1,25 +1,25 @@ package moe.nea.firmament.mixins.custommodels.screenlayouts; import moe.nea.firmament.features.texturepack.CustomScreenLayouts; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ingame.*; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.inventory.*; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.network.chat.Component; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin({CraftingScreen.class, CrafterScreen.class, Generic3x3ContainerScreen.class, GenericContainerScreen.class, HopperScreen.class, ShulkerBoxScreen.class,}) -public abstract class ReplaceGenericBackgrounds extends HandledScreen<ScreenHandler> { +@Mixin({CraftingScreen.class, CrafterScreen.class, DispenserScreen.class, ContainerScreen.class, HopperScreen.class, ShulkerBoxScreen.class,}) +public abstract class ReplaceGenericBackgrounds extends AbstractContainerScreen<AbstractContainerMenu> { // TODO: split out screens with special background components like flames, arrows, etc. (maybe arrows deserve generic handling tho) - public ReplaceGenericBackgrounds(ScreenHandler handler, PlayerInventory inventory, Text title) { + public ReplaceGenericBackgrounds(AbstractContainerMenu handler, Inventory inventory, Component title) { super(handler, inventory, title); } - @Inject(method = "drawBackground", at = @At("HEAD"), cancellable = true) - private void replaceDrawBackground(DrawContext context, float deltaTicks, int mouseX, int mouseY, CallbackInfo ci) { + @Inject(method = "renderBg", at = @At("HEAD"), cancellable = true) + private void replaceDrawBackground(GuiGraphics context, float deltaTicks, int mouseX, int mouseY, CallbackInfo ci) { final var override = CustomScreenLayouts.getActiveScreenOverride(); if (override == null || override.getBackground() == null) return; override.getBackground().renderGeneric(context, this); diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplacePlayerBackgrounds.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplacePlayerBackgrounds.java index 9ae2e2f..d089d6d 100644 --- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplacePlayerBackgrounds.java +++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplacePlayerBackgrounds.java @@ -5,32 +5,32 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.mojang.blaze3d.pipeline.RenderPipeline; import moe.nea.firmament.features.texturepack.CustomScreenLayouts; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ingame.InventoryScreen; -import net.minecraft.client.gui.screen.ingame.RecipeBookScreen; -import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.PlayerScreenHandler; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.inventory.InventoryScreen; +import net.minecraft.client.gui.screens.inventory.AbstractRecipeBookScreen; +import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.InventoryMenu; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import java.util.function.Function; @Mixin(InventoryScreen.class) -public abstract class ReplacePlayerBackgrounds extends RecipeBookScreen<PlayerScreenHandler> { - public ReplacePlayerBackgrounds(PlayerScreenHandler handler, RecipeBookWidget<?> recipeBook, PlayerInventory inventory, Text title) { +public abstract class ReplacePlayerBackgrounds extends AbstractRecipeBookScreen<InventoryMenu> { + public ReplacePlayerBackgrounds(InventoryMenu handler, RecipeBookComponent<?> recipeBook, Inventory inventory, Component title) { super(handler, recipeBook, inventory, title); } - @WrapOperation(method = "drawForeground", + @WrapOperation(method = "renderLabels", allow = 1, - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;IIIZ)V")) - private void onDrawForegroundText(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color, boolean shadow, Operation<Void> original) { + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;drawString(Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Component;IIIZ)V")) + private void onDrawForegroundText(GuiGraphics instance, Font textRenderer, Component text, int x, int y, int color, boolean shadow, Operation<Void> original) { var textOverride = CustomScreenLayouts.getTextMover(CustomScreenLayouts.CustomScreenLayout::getContainerTitle); original.call(instance, textRenderer, textOverride.replaceText(text), @@ -40,8 +40,8 @@ public abstract class ReplacePlayerBackgrounds extends RecipeBookScreen<PlayerSc shadow); } - @WrapWithCondition(method = "drawBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/util/Identifier;IIFFIIII)V")) - private boolean onDrawBackground(DrawContext instance, RenderPipeline pipeline, Identifier sprite, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { + @WrapWithCondition(method = "renderBg", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/resources/ResourceLocation;IIFFIIII)V")) + private boolean onDrawBackground(GuiGraphics instance, RenderPipeline pipeline, ResourceLocation sprite, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { final var override = CustomScreenLayouts.getActiveScreenOverride(); if (override == null || override.getBackground() == null) return true; override.getBackground().renderGeneric(instance, this); diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceTextColorInHandledScreen.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceTextColorInHandledScreen.java index 392d532..6dbbbbe 100644 --- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceTextColorInHandledScreen.java +++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceTextColorInHandledScreen.java @@ -3,31 +3,31 @@ package moe.nea.firmament.mixins.custommodels.screenlayouts; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import moe.nea.firmament.features.texturepack.CustomScreenLayouts; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.text.Text; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.network.chat.Component; import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Slice; -@Mixin(HandledScreen.class) +@Mixin(AbstractContainerScreen.class) // TODO: MerchantScreen.class, BeaconScreen.class public class ReplaceTextColorInHandledScreen { @WrapOperation( - method = "drawForeground", + method = "renderLabels", at = @At( value = "INVOKE", - target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;IIIZ)V"), + target = "Lnet/minecraft/client/gui/GuiGraphics;drawString(Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Component;IIIZ)V"), slice = @Slice( - from = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;title:Lnet/minecraft/text/Text;", opcode = Opcodes.GETFIELD), - to = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;playerInventoryTitle:Lnet/minecraft/text/Text;", opcode = Opcodes.GETFIELD) + from = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screens/inventory/AbstractContainerScreen;title:Lnet/minecraft/network/chat/Component;", opcode = Opcodes.GETFIELD), + to = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screens/inventory/AbstractContainerScreen;playerInventoryTitle:Lnet/minecraft/network/chat/Component;", opcode = Opcodes.GETFIELD) ), allow = 1, require = 1) - private void replaceContainerTitle(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color, boolean shadow, Operation<Void> original) { + private void replaceContainerTitle(GuiGraphics instance, Font textRenderer, Component text, int x, int y, int color, boolean shadow, Operation<Void> original) { var textOverride = CustomScreenLayouts.getTextMover(CustomScreenLayouts.CustomScreenLayout::getContainerTitle); original.call(instance, textRenderer, textOverride.replaceText(text), @@ -38,17 +38,17 @@ public class ReplaceTextColorInHandledScreen { } @WrapOperation( - method = "drawForeground", + method = "renderLabels", at = @At( value = "INVOKE", - target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;IIIZ)V"), + target = "Lnet/minecraft/client/gui/GuiGraphics;drawString(Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Component;IIIZ)V"), slice = @Slice( - from = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;playerInventoryTitle:Lnet/minecraft/text/Text;", opcode = Opcodes.GETFIELD), + from = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screens/inventory/AbstractContainerScreen;playerInventoryTitle:Lnet/minecraft/network/chat/Component;", opcode = Opcodes.GETFIELD), to = @At(value = "TAIL") ), allow = 1, require = 1) - private void replacePlayerTitle(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color, boolean shadow, Operation<Void> original) { + private void replacePlayerTitle(GuiGraphics instance, Font textRenderer, Component text, int x, int y, int color, boolean shadow, Operation<Void> original) { var textOverride = CustomScreenLayouts.getTextMover(CustomScreenLayouts.CustomScreenLayout::getPlayerTitle); original.call(instance, textRenderer, textOverride.replaceText(text), |
