VanillaRegistries.java

net.minecraft.data.registries.VanillaRegistries

信息

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

    TODO

字段/常量

  • BUILDER
    • 类型: RegistrySetBuilder
    • 修饰符: private static final
    • 源码定位: L65
    • 说明:

      TODO

内部类/嵌套类型

构造器

方法

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

private static void validateThatAllBiomeFeaturesHaveBiomeFilter(HolderLookup.Provider provider) @ L112

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

参数:

  • provider: HolderLookup.Provider

说明:

TODO

public static void validateThatAllBiomeFeaturesHaveBiomeFilter(HolderGetter<PlacedFeature> placedFeatures, HolderLookup<Biome> biomes) @ L116

  • 方法名:validateThatAllBiomeFeaturesHaveBiomeFilter
  • 源码定位:L116
  • 返回类型:void
  • 修饰符:public static

参数:

  • placedFeatures: HolderGetter
  • biomes: HolderLookup

说明:

TODO

private static boolean validatePlacedFeature(PlacedFeature value) @ L133

  • 方法名:validatePlacedFeature
  • 源码定位:L133
  • 返回类型:boolean
  • 修饰符:private static

参数:

  • value: PlacedFeature

说明:

TODO

public static HolderLookup.Provider createLookup() @ L137

  • 方法名:createLookup
  • 源码定位:L137
  • 返回类型:HolderLookup.Provider
  • 修饰符:public static

参数:

说明:

TODO

代码

public class VanillaRegistries {
    private static final RegistrySetBuilder BUILDER = new RegistrySetBuilder()
        .add(Registries.DIMENSION_TYPE, DimensionTypes::bootstrap)
        .add(Registries.CONFIGURED_CARVER, Carvers::bootstrap)
        .add(Registries.CONFIGURED_FEATURE, FeatureUtils::bootstrap)
        .add(Registries.PLACED_FEATURE, PlacementUtils::bootstrap)
        .add(Registries.STRUCTURE, Structures::bootstrap)
        .add(Registries.STRUCTURE_SET, StructureSets::bootstrap)
        .add(Registries.PROCESSOR_LIST, ProcessorLists::bootstrap)
        .add(Registries.TEMPLATE_POOL, Pools::bootstrap)
        .add(Registries.BIOME, BiomeData::bootstrap)
        .add(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST, MultiNoiseBiomeSourceParameterLists::bootstrap)
        .add(Registries.NOISE, NoiseData::bootstrap)
        .add(Registries.DENSITY_FUNCTION, NoiseRouterData::bootstrap)
        .add(Registries.NOISE_SETTINGS, NoiseGeneratorSettings::bootstrap)
        .add(Registries.WORLD_PRESET, WorldPresets::bootstrap)
        .add(Registries.FLAT_LEVEL_GENERATOR_PRESET, FlatLevelGeneratorPresets::bootstrap)
        .add(Registries.CHAT_TYPE, ChatType::bootstrap)
        .add(Registries.TRIM_PATTERN, TrimPatterns::bootstrap)
        .add(Registries.TRIM_MATERIAL, TrimMaterials::bootstrap)
        .add(Registries.TRIAL_SPAWNER_CONFIG, TrialSpawnerConfigs::bootstrap)
        .add(Registries.WOLF_VARIANT, WolfVariants::bootstrap)
        .add(Registries.WOLF_SOUND_VARIANT, WolfSoundVariants::bootstrap)
        .add(Registries.PAINTING_VARIANT, PaintingVariants::bootstrap)
        .add(Registries.DAMAGE_TYPE, DamageTypes::bootstrap)
        .add(Registries.BANNER_PATTERN, BannerPatterns::bootstrap)
        .add(Registries.ENCHANTMENT, Enchantments::bootstrap)
        .add(Registries.ENCHANTMENT_PROVIDER, VanillaEnchantmentProviders::bootstrap)
        .add(Registries.JUKEBOX_SONG, JukeboxSongs::bootstrap)
        .add(Registries.INSTRUMENT, Instruments::bootstrap)
        .add(Registries.PIG_VARIANT, PigVariants::bootstrap)
        .add(Registries.PIG_SOUND_VARIANT, PigSoundVariants::bootstrap)
        .add(Registries.COW_VARIANT, CowVariants::bootstrap)
        .add(Registries.COW_SOUND_VARIANT, CowSoundVariants::bootstrap)
        .add(Registries.CHICKEN_VARIANT, ChickenVariants::bootstrap)
        .add(Registries.CHICKEN_SOUND_VARIANT, ChickenSoundVariants::bootstrap)
        .add(Registries.ZOMBIE_NAUTILUS_VARIANT, ZombieNautilusVariants::bootstrap)
        .add(Registries.TEST_ENVIRONMENT, GameTestEnvironments::bootstrap)
        .add(Registries.TEST_INSTANCE, GameTestInstances::bootstrap)
        .add(Registries.FROG_VARIANT, FrogVariants::bootstrap)
        .add(Registries.CAT_VARIANT, CatVariants::bootstrap)
        .add(Registries.CAT_SOUND_VARIANT, CatSoundVariants::bootstrap)
        .add(Registries.DIALOG, Dialogs::bootstrap)
        .add(Registries.WORLD_CLOCK, WorldClocks::bootstrap)
        .add(Registries.TIMELINE, Timelines::bootstrap)
        .add(Registries.VILLAGER_TRADE, VillagerTrades::bootstrap)
        .add(Registries.TRADE_SET, TradeSets::bootstrap);
 
    private static void validateThatAllBiomeFeaturesHaveBiomeFilter(HolderLookup.Provider provider) {
        validateThatAllBiomeFeaturesHaveBiomeFilter(provider.lookupOrThrow(Registries.PLACED_FEATURE), provider.lookupOrThrow(Registries.BIOME));
    }
 
    public static void validateThatAllBiomeFeaturesHaveBiomeFilter(HolderGetter<PlacedFeature> placedFeatures, HolderLookup<Biome> biomes) {
        biomes.listElements().forEach(biome -> {
            Identifier biomeKey = biome.key().identifier();
            List<HolderSet<PlacedFeature>> biomeFeatures = biome.value().getGenerationSettings().features();
            biomeFeatures.stream().flatMap(HolderSet::stream).forEach(feature -> feature.unwrap().ifLeft(key -> {
                Holder.Reference<PlacedFeature> value = placedFeatures.getOrThrow((ResourceKey<PlacedFeature>)key);
                if (!validatePlacedFeature(value.value())) {
                    Util.logAndPauseIfInIde("Placed feature " + key.identifier() + " in biome " + biomeKey + " is missing BiomeFilter.biome()");
                }
            }).ifRight(value -> {
                if (!validatePlacedFeature(value)) {
                    Util.logAndPauseIfInIde("Placed inline feature in biome " + biome + " is missing BiomeFilter.biome()");
                }
            }));
        });
    }
 
    private static boolean validatePlacedFeature(PlacedFeature value) {
        return value.placement().contains(BiomeFilter.biome());
    }
 
    public static HolderLookup.Provider createLookup() {
        RegistryAccess.Frozen staticRegistries = RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY);
        HolderLookup.Provider newRegistries = BUILDER.build(staticRegistries);
        validateThatAllBiomeFeaturesHaveBiomeFilter(newRegistries);
        return newRegistries;
    }
}

引用的其他类

  • HolderGetter

    • 引用位置: 参数
  • HolderLookup

    • 引用位置: 参数/返回值
  • RegistryAccess

    • 引用位置: 方法调用
    • 关联成员: RegistryAccess.fromRegistryOfRegistries()
  • RegistrySetBuilder

    • 引用位置: 字段/构造调用
    • 关联成员: RegistrySetBuilder()
  • Util

    • 引用位置: 方法调用
    • 关联成员: Util.logAndPauseIfInIde()
  • Biome

    • 引用位置: 参数
  • BiomeFilter

    • 引用位置: 方法调用
    • 关联成员: BiomeFilter.biome()
  • PlacedFeature

    • 引用位置: 参数