diff --git a/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/api/client/model/loading/v1/PreparableModelLoadingPlugin.java b/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/api/client/model/loading/v1/PreparableModelLoadingPlugin.java index 943c8145c1..983c59a626 100644 --- a/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/api/client/model/loading/v1/PreparableModelLoadingPlugin.java +++ b/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/api/client/model/loading/v1/PreparableModelLoadingPlugin.java @@ -21,6 +21,7 @@ import java.util.concurrent.Executor; import java.util.function.Supplier; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.UnmodifiableView; import net.minecraft.resource.ResourceManager; @@ -79,6 +80,10 @@ interface DataLoader { * Bundles a {@link PreparableModelLoadingPlugin} with its corresponding {@link DataLoader} * for retrieval through {@link #getAll()}. */ - record Holder(DataLoader loader, PreparableModelLoadingPlugin plugin) { + @ApiStatus.NonExtendable + interface Holder { + DataLoader loader(); + + PreparableModelLoadingPlugin plugin(); } } diff --git a/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/impl/client/model/loading/ModelLoadingPluginManager.java b/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/impl/client/model/loading/ModelLoadingPluginManager.java index fd878fdd40..99da93de39 100644 --- a/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/impl/client/model/loading/ModelLoadingPluginManager.java +++ b/fabric-model-loading-api-v1/src/client/java/net/fabricmc/fabric/impl/client/model/loading/ModelLoadingPluginManager.java @@ -33,7 +33,7 @@ public final class ModelLoadingPluginManager { private static final List PLUGINS = new ArrayList<>(); - private static final List> PREPARABLE_PLUGINS = new ArrayList<>(); + private static final List> PREPARABLE_PLUGINS = new ArrayList<>(); @UnmodifiableView public static final List PLUGINS_VIEW = Collections.unmodifiableList(PLUGINS); @@ -50,7 +50,7 @@ public static void registerPlugin(PreparableModelLoadingPlugin.DataLoader Objects.requireNonNull(loader, "data loader must not be null"); Objects.requireNonNull(plugin, "plugin must not be null"); - PREPARABLE_PLUGINS.add(new PreparableModelLoadingPlugin.Holder<>(loader, plugin)); + PREPARABLE_PLUGINS.add(new HolderImpl<>(loader, plugin)); } public static CompletableFuture> preparePlugins(ResourceManager resourceManager, Executor executor) { @@ -60,17 +60,20 @@ public static CompletableFuture> preparePlugins(Resourc futures.add(CompletableFuture.completedFuture(plugin)); } - for (PreparableModelLoadingPlugin.Holder holder : PREPARABLE_PLUGINS) { + for (HolderImpl holder : PREPARABLE_PLUGINS) { futures.add(preparePlugin(holder, resourceManager, executor)); } return Util.combineSafe(futures); } - private static CompletableFuture preparePlugin(PreparableModelLoadingPlugin.Holder holder, ResourceManager resourceManager, Executor executor) { - CompletableFuture dataFuture = holder.loader().load(resourceManager, executor); - return dataFuture.thenApply(data -> pluginContext -> holder.plugin().initialize(data, pluginContext)); + private static CompletableFuture preparePlugin(HolderImpl holder, ResourceManager resourceManager, Executor executor) { + CompletableFuture dataFuture = holder.loader.load(resourceManager, executor); + return dataFuture.thenApply(data -> pluginContext -> holder.plugin.initialize(data, pluginContext)); } private ModelLoadingPluginManager() { } + + private record HolderImpl(PreparableModelLoadingPlugin.DataLoader loader, PreparableModelLoadingPlugin plugin) implements PreparableModelLoadingPlugin.Holder { + } }