Skip to content

Commit

Permalink
Update special variant
Browse files Browse the repository at this point in the history
  • Loading branch information
XFactHD committed Jun 10, 2024
1 parent d684d7c commit d868475
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@OnlyIn(Dist.CLIENT)
public record ModelResourceLocation(ResourceLocation id, String variant) {
public static final String INVENTORY_VARIANT = "inventory";
+ public static final String NEOFORGE_STANDALONE_VARIANT = "neoforge_standalone";
+ public static final String STANDALONE_VARIANT = "standalone";

public ModelResourceLocation(ResourceLocation id, String variant) {
variant = lowercaseVariant(variant);
Expand All @@ -17,8 +17,8 @@
+ /**
+ * Construct a {@code ModelResourceLocation} for use in the {@link net.neoforged.neoforge.client.event.ModelEvent.RegisterAdditional}
+ */
+ public static ModelResourceLocation neoForgeStandalone(ResourceLocation id) {
+ return new ModelResourceLocation(id, NEOFORGE_STANDALONE_VARIANT);
+ public static ModelResourceLocation standalone(ResourceLocation id) {
+ return new ModelResourceLocation(id, STANDALONE_VARIANT);
}

private static String lowercaseVariant(String p_248567_) {
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public ModelBakery getModelBakery() {
/**
* Fired when the {@link net.minecraft.client.resources.model.ModelBakery} is notified of the resource manager reloading.
* Allows developers to register models to be loaded, along with their dependencies. Models registered through this
* event must use the {@link ModelResourceLocation#NEOFORGE_STANDALONE_VARIANT} variant
* event must use the {@link ModelResourceLocation#STANDALONE_VARIANT} variant
*
* <p>This event is not {@linkplain ICancellableEvent cancellable}, and does not {@linkplain HasResult have a result}.</p>
*
Expand All @@ -149,8 +149,8 @@ public RegisterAdditional(Set<ModelResourceLocation> models) {
*/
public void register(ModelResourceLocation model) {
Preconditions.checkArgument(
model.getVariant().equals(ModelResourceLocation.NEOFORGE_STANDALONE_VARIANT),
"Side-loaded models must use the '" + ModelResourceLocation.NEOFORGE_STANDALONE_VARIANT + "' variant");
model.getVariant().equals(ModelResourceLocation.STANDALONE_VARIANT),
"Side-loaded models must use the '" + ModelResourceLocation.STANDALONE_VARIANT + "' variant");
models.add(model);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public RenderableTest(IEventBus modEventBus) {
}

private static class Client {
private static ModelResourceLocation MODEL_LOC = ModelResourceLocation.neoForgeStandalone(
private static ModelResourceLocation MODEL_LOC = ModelResourceLocation.standalone(
ResourceLocation.fromNamespaceAndPath("minecraft", "block/blue_stained_glass"));

private static IRenderable<CompositeRenderable.Transforms> renderable;
Expand Down

0 comments on commit d868475

Please sign in to comment.