/* * Decompiled with CFR 0.152. */ package net.minecraft.world.entity.animal; import net.minecraft.core.HolderSet; import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.BootstrapContext; import net.minecraft.resources.Identifier; import net.minecraft.resources.ResourceKey; import net.minecraft.tags.BiomeTags; import net.minecraft.tags.TagKey; import net.minecraft.world.entity.animal.CowVariant; import net.minecraft.world.entity.animal.TemperatureVariants; import net.minecraft.world.entity.variant.BiomeCheck; import net.minecraft.world.entity.variant.ModelAndTexture; import net.minecraft.world.entity.variant.SpawnPrioritySelectors; import net.minecraft.world.level.biome.Biome; public class CowVariants { public static final ResourceKey TEMPERATE = CowVariants.createKey(TemperatureVariants.TEMPERATE); public static final ResourceKey WARM = CowVariants.createKey(TemperatureVariants.WARM); public static final ResourceKey COLD = CowVariants.createKey(TemperatureVariants.COLD); public static final ResourceKey DEFAULT = TEMPERATE; private static ResourceKey createKey(Identifier id) { return ResourceKey.create(Registries.COW_VARIANT, id); } public static void bootstrap(BootstrapContext context) { CowVariants.register(context, TEMPERATE, CowVariant.ModelType.NORMAL, "temperate_cow", SpawnPrioritySelectors.fallback(0)); CowVariants.register(context, WARM, CowVariant.ModelType.WARM, "warm_cow", BiomeTags.SPAWNS_WARM_VARIANT_FARM_ANIMALS); CowVariants.register(context, COLD, CowVariant.ModelType.COLD, "cold_cow", BiomeTags.SPAWNS_COLD_VARIANT_FARM_ANIMALS); } private static void register(BootstrapContext context, ResourceKey name, CowVariant.ModelType modelType, String textureName, TagKey spawnBiome) { HolderSet.Named biomes = context.lookup(Registries.BIOME).getOrThrow(spawnBiome); CowVariants.register(context, name, modelType, textureName, SpawnPrioritySelectors.single(new BiomeCheck(biomes), 1)); } private static void register(BootstrapContext context, ResourceKey name, CowVariant.ModelType modelType, String textureName, SpawnPrioritySelectors selectors) { Identifier textureId = Identifier.withDefaultNamespace("entity/cow/" + textureName); context.register(name, new CowVariant(new ModelAndTexture(modelType, textureId), selectors)); } }