37 lines
1 KiB
Java
37 lines
1 KiB
Java
package net.minecraft.client.resources.model;
|
|
|
|
import java.util.Locale;
|
|
import net.fabricmc.api.EnvType;
|
|
import net.fabricmc.api.Environment;
|
|
import net.minecraft.resources.ResourceLocation;
|
|
|
|
@Environment(EnvType.CLIENT)
|
|
public record ModelResourceLocation(ResourceLocation id, String variant) {
|
|
public static final String INVENTORY_VARIANT = "inventory";
|
|
|
|
public ModelResourceLocation(ResourceLocation id, String variant) {
|
|
variant = lowercaseVariant(variant);
|
|
this.id = id;
|
|
this.variant = variant;
|
|
}
|
|
|
|
public static ModelResourceLocation vanilla(String path, String variant) {
|
|
return new ModelResourceLocation(ResourceLocation.withDefaultNamespace(path), variant);
|
|
}
|
|
|
|
public static ModelResourceLocation inventory(ResourceLocation id) {
|
|
return new ModelResourceLocation(id, "inventory");
|
|
}
|
|
|
|
private static String lowercaseVariant(String variant) {
|
|
return variant.toLowerCase(Locale.ROOT);
|
|
}
|
|
|
|
public String getVariant() {
|
|
return this.variant;
|
|
}
|
|
|
|
public String toString() {
|
|
return this.id + "#" + this.variant;
|
|
}
|
|
}
|