Use identifier path composition methods (#3820)

This commit is contained in:
haykam821 2024-06-08 09:02:41 -04:00 committed by GitHub
parent 18dd60fee4
commit d1321076fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View file

@ -32,7 +32,7 @@ public class EntityModelLayersMixin {
private static void createSign(WoodType type, CallbackInfoReturnable<EntityModelLayer> 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<EntityModelLayer> 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"));
}
}
}

View file

@ -36,7 +36,7 @@ public abstract class HangingSignEditScreenMixin extends AbstractSignEditScreen
private Identifier init(String id, Operation<Identifier> 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);

View file

@ -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));
}
}