From d1321076fe1700ac02cadfbf2d60baa12c6f23a0 Mon Sep 17 00:00:00 2001 From: haykam821 <24855774+haykam821@users.noreply.github.com> Date: Sat, 8 Jun 2024 09:02:41 -0400 Subject: [PATCH] Use identifier path composition methods (#3820) --- .../mixin/object/builder/client/EntityModelLayersMixin.java | 4 ++-- .../object/builder/client/HangingSignEditScreenMixin.java | 2 +- .../fabric/impl/client/rendering/FabricShaderProgram.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fabric-object-builder-api-v1/src/client/java/net/fabricmc/fabric/mixin/object/builder/client/EntityModelLayersMixin.java b/fabric-object-builder-api-v1/src/client/java/net/fabricmc/fabric/mixin/object/builder/client/EntityModelLayersMixin.java index 295ccb2e5..8b10b92fa 100644 --- a/fabric-object-builder-api-v1/src/client/java/net/fabricmc/fabric/mixin/object/builder/client/EntityModelLayersMixin.java +++ b/fabric-object-builder-api-v1/src/client/java/net/fabricmc/fabric/mixin/object/builder/client/EntityModelLayersMixin.java @@ -32,7 +32,7 @@ public class EntityModelLayersMixin { private static void createSign(WoodType type, CallbackInfoReturnable cir) { if (type.name().indexOf(Identifier.NAMESPACE_SEPARATOR) != -1) { Identifier identifier = Identifier.of(type.name()); - cir.setReturnValue(new EntityModelLayer(Identifier.of(identifier.getNamespace(), "sign/" + identifier.getPath()), "main")); + cir.setReturnValue(new EntityModelLayer(identifier.withPrefixedPath("sign/"), "main")); } } @@ -40,7 +40,7 @@ public class EntityModelLayersMixin { private static void createHangingSign(WoodType type, CallbackInfoReturnable cir) { if (type.name().indexOf(Identifier.NAMESPACE_SEPARATOR) != -1) { Identifier identifier = Identifier.of(type.name()); - cir.setReturnValue(new EntityModelLayer(Identifier.of(identifier.getNamespace(), "hanging_sign/" + identifier.getPath()), "main")); + cir.setReturnValue(new EntityModelLayer(identifier.withPrefixedPath("hanging_sign/"), "main")); } } } diff --git a/fabric-object-builder-api-v1/src/client/java/net/fabricmc/fabric/mixin/object/builder/client/HangingSignEditScreenMixin.java b/fabric-object-builder-api-v1/src/client/java/net/fabricmc/fabric/mixin/object/builder/client/HangingSignEditScreenMixin.java index 78e6daa19..daf7fd74a 100644 --- a/fabric-object-builder-api-v1/src/client/java/net/fabricmc/fabric/mixin/object/builder/client/HangingSignEditScreenMixin.java +++ b/fabric-object-builder-api-v1/src/client/java/net/fabricmc/fabric/mixin/object/builder/client/HangingSignEditScreenMixin.java @@ -36,7 +36,7 @@ public abstract class HangingSignEditScreenMixin extends AbstractSignEditScreen private Identifier init(String id, Operation original) { if (signType.name().indexOf(Identifier.NAMESPACE_SEPARATOR) != -1) { Identifier identifier = Identifier.of(signType.name()); - return Identifier.of(identifier.getNamespace(), "textures/gui/hanging_signs/" + identifier.getPath() + ".png"); + return identifier.withPath(path -> "textures/gui/hanging_signs/" + path + ".png"); } return original.call(id); diff --git a/fabric-rendering-v1/src/client/java/net/fabricmc/fabric/impl/client/rendering/FabricShaderProgram.java b/fabric-rendering-v1/src/client/java/net/fabricmc/fabric/impl/client/rendering/FabricShaderProgram.java index 86d44498b..5ee289648 100644 --- a/fabric-rendering-v1/src/client/java/net/fabricmc/fabric/impl/client/rendering/FabricShaderProgram.java +++ b/fabric-rendering-v1/src/client/java/net/fabricmc/fabric/impl/client/rendering/FabricShaderProgram.java @@ -40,6 +40,6 @@ public final class FabricShaderProgram extends ShaderProgram { */ public static Identifier rewriteAsId(String input, String containedId) { Identifier contained = Identifier.of(containedId); - return Identifier.of(contained.getNamespace(), input.replace(containedId, contained.getPath())); + return contained.withPath(path -> input.replace(containedId, path)); } }