RegistryDataLoader.java

net.minecraft.resources.RegistryDataLoader

信息

  • 全限定名:net.minecraft.resources.RegistryDataLoader
  • 类型:public class
  • 包:net.minecraft.resources
  • 源码路径:src/main/java/net/minecraft/resources/RegistryDataLoader.java
  • 起始行号:L80
  • 职责:

    TODO

字段/常量

  • LOGGER

    • 类型: Logger
    • 修饰符: private static final
    • 源码定位: L81
    • 说明:

      TODO

  • ERROR_KEY_COMPARATOR

    • 类型: Comparator<ResourceKey<?>>
    • 修饰符: private static final
    • 源码定位: L82
    • 说明:

      TODO

  • WORLDGEN_REGISTRIES

    • 类型: List<RegistryDataLoader.RegistryData<?>>
    • 修饰符: public static final
    • 源码定位: L83
    • 说明:

      TODO

  • DIMENSION_REGISTRIES

    • 类型: List<RegistryDataLoader.RegistryData<?>>
    • 修饰符: public static final
    • 源码定位: L130
    • 说明:

      TODO

  • SYNCHRONIZED_REGISTRIES

    • 类型: List<RegistryDataLoader.RegistryData<?>>
    • 修饰符: public static final
    • 源码定位: L133
    • 说明:

      TODO

内部类/嵌套类型

  • net.minecraft.resources.RegistryDataLoader.LoaderFactory

    • 类型: interface
    • 修饰符: private
    • 源码定位: L305
    • 说明:

      TODO

  • net.minecraft.resources.RegistryDataLoader.NetworkedRegistryData

    • 类型: record
    • 修饰符: public
    • 源码定位: L309
    • 说明:

      TODO

  • net.minecraft.resources.RegistryDataLoader.RegistryData

    • 类型: record
    • 修饰符: public
    • 源码定位: L312
    • 说明:

      TODO

构造器

方法

下面的方法块按源码顺序生成。

public static CompletableFuture<RegistryAccess.Frozen> load(ResourceManager resourceManager, List<HolderLookup.RegistryLookup<?>> contextRegistries, List<RegistryDataLoader.RegistryData<?>> registriesToLoad, Executor executor) @ L164

  • 方法名:load
  • 源码定位:L164
  • 返回类型:CompletableFuture<RegistryAccess.Frozen>
  • 修饰符:public static

参数:

  • resourceManager: ResourceManager
  • contextRegistries: List<HolderLookup.RegistryLookup<?>>
  • registriesToLoad: List<RegistryDataLoader.RegistryData<?>>
  • executor: Executor

说明:

TODO

public static CompletableFuture<RegistryAccess.Frozen> load(Map<ResourceKey<?extends Registry<?>>,RegistryDataLoader.NetworkedRegistryData> entries, ResourceProvider knownDataSource, List<HolderLookup.RegistryLookup<?>> contextRegistries, List<RegistryDataLoader.RegistryData<?>> registriesToLoad, Executor executor) @ L179

  • 方法名:load
  • 源码定位:L179
  • 返回类型:CompletableFuture<RegistryAccess.Frozen>
  • 修饰符:public static

参数:

  • entries: Map<ResourceKey>,RegistryDataLoader.NetworkedRegistryData>
  • knownDataSource: ResourceProvider
  • contextRegistries: List<HolderLookup.RegistryLookup<?>>
  • registriesToLoad: List<RegistryDataLoader.RegistryData<?>>
  • executor: Executor

说明:

TODO

private static CompletableFuture<RegistryAccess.Frozen> load(RegistryDataLoader.LoaderFactory loaderFactory, List<HolderLookup.RegistryLookup<?>> contextRegistries, List<RegistryDataLoader.RegistryData<?>> registriesToLoad, Executor executor) @ L195

  • 方法名:load
  • 源码定位:L195
  • 返回类型:CompletableFuture<RegistryAccess.Frozen>
  • 修饰符:private static

参数:

  • loaderFactory: RegistryDataLoader.LoaderFactory
  • contextRegistries: List<HolderLookup.RegistryLookup<?>>
  • registriesToLoad: List<RegistryDataLoader.RegistryData<?>>
  • executor: Executor

说明:

TODO

private static RegistryOps.RegistryInfoLookup createContext(List<HolderLookup.RegistryLookup<?>> contextRegistries, List<RegistryLoadTask<?>> newRegistriesAndLoaders) @ L240

  • 方法名:createContext
  • 源码定位:L240
  • 返回类型:RegistryOps.RegistryInfoLookup
  • 修饰符:private static

参数:

  • contextRegistries: List<HolderLookup.RegistryLookup<?>>
  • newRegistriesAndLoaders: List<RegistryLoadTask<?>>

说明:

TODO

private static <T> RegistryOps.RegistryInfo<T> createInfoForContextRegistry(HolderLookup.RegistryLookup<T> lookup) @ L254

  • 方法名:createInfoForContextRegistry
  • 源码定位:L254
  • 返回类型: RegistryOps.RegistryInfo
  • 修饰符:private static

参数:

  • lookup: HolderLookup.RegistryLookup

说明:

TODO

private static ReportedException logErrors(Map<ResourceKey<?>,Exception> loadingErrors) @ L258

  • 方法名:logErrors
  • 源码定位:L258
  • 返回类型:ReportedException
  • 修饰符:private static

参数:

  • loadingErrors: Map<ResourceKey<?>,Exception>

说明:

TODO

private static void printFullDetailsToLog(Map<ResourceKey<?>,Exception> loadingErrors) @ L263

  • 方法名:printFullDetailsToLog
  • 源码定位:L263
  • 返回类型:void
  • 修饰符:private static

参数:

  • loadingErrors: Map<ResourceKey<?>,Exception>

说明:

TODO

private static ReportedException createReportWithBriefInfo(Map<ResourceKey<?>,Exception> loadingErrors) @ L280

  • 方法名:createReportWithBriefInfo
  • 源码定位:L280
  • 返回类型:ReportedException
  • 修饰符:private static

参数:

  • loadingErrors: Map<ResourceKey<?>,Exception>

说明:

TODO

代码

public class RegistryDataLoader {
    private static final Logger LOGGER = LogUtils.getLogger();
    private static final Comparator<ResourceKey<?>> ERROR_KEY_COMPARATOR = Comparator.<ResourceKey<?>, Identifier>comparing(ResourceKey::registry).thenComparing(ResourceKey::identifier);
    public static final List<RegistryDataLoader.RegistryData<?>> WORLDGEN_REGISTRIES = List.of(
        new RegistryDataLoader.RegistryData<>(Registries.DIMENSION_TYPE, DimensionType.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.BIOME, Biome.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.CHAT_TYPE, ChatType.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.CONFIGURED_CARVER, ConfiguredWorldCarver.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.CONFIGURED_FEATURE, ConfiguredFeature.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.PLACED_FEATURE, PlacedFeature.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.STRUCTURE, Structure.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.STRUCTURE_SET, StructureSet.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.PROCESSOR_LIST, StructureProcessorType.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.TEMPLATE_POOL, StructureTemplatePool.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.NOISE_SETTINGS, NoiseGeneratorSettings.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.NOISE, NormalNoise.NoiseParameters.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.DENSITY_FUNCTION, DensityFunction.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.WORLD_PRESET, WorldPreset.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.FLAT_LEVEL_GENERATOR_PRESET, FlatLevelGeneratorPreset.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.TRIM_PATTERN, TrimPattern.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.TRIM_MATERIAL, TrimMaterial.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.TRIAL_SPAWNER_CONFIG, TrialSpawnerConfig.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.WOLF_VARIANT, WolfVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.WOLF_SOUND_VARIANT, WolfSoundVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.PIG_VARIANT, PigVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.PIG_SOUND_VARIANT, PigSoundVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.FROG_VARIANT, FrogVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.CAT_VARIANT, CatVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.CAT_SOUND_VARIANT, CatSoundVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.COW_VARIANT, CowVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.COW_SOUND_VARIANT, CowSoundVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.CHICKEN_VARIANT, ChickenVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.CHICKEN_SOUND_VARIANT, ChickenSoundVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.ZOMBIE_NAUTILUS_VARIANT, ZombieNautilusVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.PAINTING_VARIANT, PaintingVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.DAMAGE_TYPE, DamageType.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST, MultiNoiseBiomeSourceParameterList.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.BANNER_PATTERN, BannerPattern.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.ENCHANTMENT, Enchantment.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.ENCHANTMENT_PROVIDER, EnchantmentProvider.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.JUKEBOX_SONG, JukeboxSong.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.INSTRUMENT, Instrument.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.TEST_ENVIRONMENT, TestEnvironmentDefinition.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.TEST_INSTANCE, GameTestInstance.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.DIALOG, Dialog.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.WORLD_CLOCK, WorldClock.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.TIMELINE, Timeline.DIRECT_CODEC, Timeline::validateRegistry),
        new RegistryDataLoader.RegistryData<>(Registries.VILLAGER_TRADE, VillagerTrade.CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.TRADE_SET, TradeSet.CODEC)
    );
    public static final List<RegistryDataLoader.RegistryData<?>> DIMENSION_REGISTRIES = List.of(
        new RegistryDataLoader.RegistryData<>(Registries.LEVEL_STEM, LevelStem.CODEC)
    );
    public static final List<RegistryDataLoader.RegistryData<?>> SYNCHRONIZED_REGISTRIES = List.of(
        new RegistryDataLoader.RegistryData<>(Registries.BIOME, Biome.NETWORK_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.CHAT_TYPE, ChatType.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.TRIM_PATTERN, TrimPattern.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.TRIM_MATERIAL, TrimMaterial.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.WOLF_VARIANT, WolfVariant.NETWORK_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.WOLF_SOUND_VARIANT, WolfSoundVariant.NETWORK_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.PIG_VARIANT, PigVariant.NETWORK_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.PIG_SOUND_VARIANT, PigSoundVariant.NETWORK_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.FROG_VARIANT, FrogVariant.NETWORK_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.CAT_VARIANT, CatVariant.NETWORK_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.CAT_SOUND_VARIANT, CatSoundVariant.NETWORK_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.COW_SOUND_VARIANT, CowSoundVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.COW_VARIANT, CowVariant.NETWORK_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.CHICKEN_SOUND_VARIANT, ChickenSoundVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.CHICKEN_VARIANT, ChickenVariant.NETWORK_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.ZOMBIE_NAUTILUS_VARIANT, ZombieNautilusVariant.NETWORK_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.PAINTING_VARIANT, PaintingVariant.DIRECT_CODEC, RegistryValidator.nonEmpty()),
        new RegistryDataLoader.RegistryData<>(Registries.DIMENSION_TYPE, DimensionType.NETWORK_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.DAMAGE_TYPE, DamageType.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.BANNER_PATTERN, BannerPattern.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.ENCHANTMENT, Enchantment.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.JUKEBOX_SONG, JukeboxSong.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.INSTRUMENT, Instrument.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.TEST_ENVIRONMENT, TestEnvironmentDefinition.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.TEST_INSTANCE, GameTestInstance.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.DIALOG, Dialog.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.WORLD_CLOCK, WorldClock.DIRECT_CODEC),
        new RegistryDataLoader.RegistryData<>(Registries.TIMELINE, Timeline.NETWORK_CODEC)
    );
 
    public static CompletableFuture<RegistryAccess.Frozen> load(
        ResourceManager resourceManager,
        List<HolderLookup.RegistryLookup<?>> contextRegistries,
        List<RegistryDataLoader.RegistryData<?>> registriesToLoad,
        Executor executor
    ) {
        RegistryDataLoader.LoaderFactory loaderFactory = new RegistryDataLoader.LoaderFactory() {
            @Override
            public <T> RegistryLoadTask<T> create(RegistryDataLoader.RegistryData<T> data, Map<ResourceKey<?>, Exception> loadingErrors) {
                return new ResourceManagerRegistryLoadTask<>(data, Lifecycle.stable(), loadingErrors, resourceManager);
            }
        };
        return load(loaderFactory, contextRegistries, registriesToLoad, executor);
    }
 
    public static CompletableFuture<RegistryAccess.Frozen> load(
        Map<ResourceKey<? extends Registry<?>>, RegistryDataLoader.NetworkedRegistryData> entries,
        ResourceProvider knownDataSource,
        List<HolderLookup.RegistryLookup<?>> contextRegistries,
        List<RegistryDataLoader.RegistryData<?>> registriesToLoad,
        Executor executor
    ) {
        RegistryDataLoader.LoaderFactory loaderFactory = new RegistryDataLoader.LoaderFactory() {
            @Override
            public <T> RegistryLoadTask<T> create(RegistryDataLoader.RegistryData<T> data, Map<ResourceKey<?>, Exception> loadingErrors) {
                return new NetworkRegistryLoadTask<>(data, Lifecycle.stable(), loadingErrors, entries, knownDataSource);
            }
        };
        return load(loaderFactory, contextRegistries, registriesToLoad, executor);
    }
 
    private static CompletableFuture<RegistryAccess.Frozen> load(
        RegistryDataLoader.LoaderFactory loaderFactory,
        List<HolderLookup.RegistryLookup<?>> contextRegistries,
        List<RegistryDataLoader.RegistryData<?>> registriesToLoad,
        Executor executor
    ) {
        return CompletableFuture.<CompletableFuture<RegistryAccess.Frozen>>supplyAsync(
                () -> {
                    Map<ResourceKey<?>, Exception> loadingErrors = new ConcurrentHashMap<>();
                    List<RegistryLoadTask<?>> loadTasks = registriesToLoad.stream()
                        .map(r -> loaderFactory.create((RegistryDataLoader.RegistryData<?>)r, loadingErrors))
                        .collect(Collectors.toUnmodifiableList());
                    RegistryOps.RegistryInfoLookup contextAndNewRegistries = createContext(contextRegistries, loadTasks);
                    int taskCount = loadTasks.size();
                    CompletableFuture<?>[] loadCompletions = new CompletableFuture[taskCount];
 
                    for (int i = 0; i < taskCount; i++) {
                        loadCompletions[i] = loadTasks.get(i).load(contextAndNewRegistries, executor);
                    }
 
                    return CompletableFuture.allOf(loadCompletions)
                        .thenApplyAsync(
                            ignored -> {
                                List<RegistryLoadTask<?>> frozenRegistries = loadTasks.stream().filter(task -> task.freezeRegistry(loadingErrors)).toList();
                                if (!loadingErrors.isEmpty()) {
                                    throw logErrors(loadingErrors);
                                } else {
                                    List<? extends Registry<?>> registries = frozenRegistries.stream()
                                        .flatMap(task -> task.validateRegistry(loadingErrors).stream())
                                        .toList();
                                    if (!loadingErrors.isEmpty()) {
                                        throw logErrors(loadingErrors);
                                    } else {
                                        return new RegistryAccess.ImmutableRegistryAccess(registries).freeze();
                                    }
                                }
                            },
                            executor
                        );
                },
                executor
            )
            .thenCompose(c -> (CompletionStage<RegistryAccess.Frozen>)c);
    }
 
    private static RegistryOps.RegistryInfoLookup createContext(
        List<HolderLookup.RegistryLookup<?>> contextRegistries, List<RegistryLoadTask<?>> newRegistriesAndLoaders
    ) {
        final Map<ResourceKey<? extends Registry<?>>, RegistryOps.RegistryInfo<?>> result = new HashMap<>();
        contextRegistries.forEach(e -> result.put(e.key(), createInfoForContextRegistry((HolderLookup.RegistryLookup<?>)e)));
        newRegistriesAndLoaders.forEach(e -> result.put(e.registryKey(), e.createRegistryInfo()));
        return new RegistryOps.RegistryInfoLookup() {
            @Override
            public <T> Optional<RegistryOps.RegistryInfo<T>> lookup(ResourceKey<? extends Registry<? extends T>> key) {
                return Optional.ofNullable((RegistryOps.RegistryInfo<T>)result.get(key));
            }
        };
    }
 
    private static <T> RegistryOps.RegistryInfo<T> createInfoForContextRegistry(HolderLookup.RegistryLookup<T> lookup) {
        return new RegistryOps.RegistryInfo<>(lookup, lookup, lookup.registryLifecycle());
    }
 
    private static ReportedException logErrors(Map<ResourceKey<?>, Exception> loadingErrors) {
        printFullDetailsToLog(loadingErrors);
        return createReportWithBriefInfo(loadingErrors);
    }
 
    private static void printFullDetailsToLog(Map<ResourceKey<?>, Exception> loadingErrors) {
        StringWriter collectedErrors = new StringWriter();
        PrintWriter errorPrinter = new PrintWriter(collectedErrors);
        Map<Identifier, Map<Identifier, Exception>> errorsByRegistry = loadingErrors.entrySet()
            .stream()
            .collect(Collectors.groupingBy(e -> e.getKey().registry(), Collectors.toMap(e -> e.getKey().identifier(), Entry::getValue)));
        errorsByRegistry.entrySet().stream().sorted(Entry.comparingByKey()).forEach(registryEntry -> {
            errorPrinter.printf(Locale.ROOT, "> Errors in registry %s:%n", registryEntry.getKey());
            registryEntry.getValue().entrySet().stream().sorted(Entry.comparingByKey()).forEach(elementError -> {
                errorPrinter.printf(Locale.ROOT, ">> Errors in element %s:%n", elementError.getKey());
                elementError.getValue().printStackTrace(errorPrinter);
            });
        });
        errorPrinter.flush();
        LOGGER.error("Registry loading errors:\n{}", collectedErrors);
    }
 
    private static ReportedException createReportWithBriefInfo(Map<ResourceKey<?>, Exception> loadingErrors) {
        CrashReport report = CrashReport.forThrowable(new IllegalStateException("Failed to load registries due to errors"), "Registry Loading");
        CrashReportCategory errors = report.addCategory("Loading info");
        errors.setDetail(
            "Errors",
            () -> {
                StringBuilder briefDetails = new StringBuilder();
                loadingErrors.entrySet()
                    .stream()
                    .sorted(Entry.comparingByKey(ERROR_KEY_COMPARATOR))
                    .forEach(
                        e -> briefDetails.append("\n\t\t")
                            .append(e.getKey().registry())
                            .append("/")
                            .append(e.getKey().identifier())
                            .append(": ")
                            .append(e.getValue().getMessage())
                    );
                return briefDetails.toString();
            }
        );
        return new ReportedException(report);
    }
 
    @FunctionalInterface
    private interface LoaderFactory {
        <T> RegistryLoadTask<T> create(RegistryDataLoader.RegistryData<T> data, Map<ResourceKey<?>, Exception> loadingErrors);
    }
 
    public record NetworkedRegistryData(List<RegistrySynchronization.PackedRegistryEntry> elements, TagNetworkSerialization.NetworkPayload tags) {
    }
 
    public record RegistryData<T>(ResourceKey<? extends Registry<T>> key, Codec<T> elementCodec, RegistryValidator<T> validator) {
        private RegistryData(ResourceKey<? extends Registry<T>> key, Codec<T> elementCodec) {
            this(key, elementCodec, RegistryValidator.none());
        }
 
        public void runWithArguments(BiConsumer<ResourceKey<? extends Registry<T>>, Codec<T>> output) {
            output.accept(this.key, this.elementCodec);
        }
    }
}

引用的其他类

  • CrashReport

    • 引用位置: 方法调用
    • 关联成员: CrashReport.forThrowable()
  • ReportedException

    • 引用位置: 构造调用/返回值
    • 关联成员: ReportedException()
  • HolderLookup

    • 引用位置: 参数
  • Registry

    • 引用位置: 参数
  • RegistryAccess

    • 引用位置: 方法调用/构造调用/返回值
    • 关联成员: ImmutableRegistryAccess(), RegistryAccess.ImmutableRegistryAccess()
  • RegistryLoadTask

    • 引用位置: 参数
  • RegistryOps

    • 引用位置: 方法调用/构造调用/返回值
    • 关联成员: RegistryInfoLookup(), RegistryOps.RegistryInfoLookup()
  • RegistryValidator

    • 引用位置: 方法调用
    • 关联成员: RegistryValidator.nonEmpty(), RegistryValidator.none()
  • ResourceKey

    • 引用位置: 参数/字段
  • ResourceManager

    • 引用位置: 参数
  • ResourceProvider

    • 引用位置: 参数