/* * 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.ChickenVariant; 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 ChickenVariants { public static final ResourceKey TEMPERATE = ChickenVariants.createKey(TemperatureVariants.TEMPERATE); public static final ResourceKey WARM = ChickenVariants.createKey(TemperatureVariants.WARM); public static final ResourceKey COLD = ChickenVariants.createKey(TemperatureVariants.COLD); public static final ResourceKey DEFAULT = TEMPERATE; private static ResourceKey createKey(Identifier id) { return ResourceKey.create(Registries.CHICKEN_VARIANT, id); } public static void bootstrap(BootstrapContext context) { ChickenVariants.register(context, TEMPERATE, ChickenVariant.ModelType.NORMAL, "temperate_chicken", SpawnPrioritySelectors.fallback(0)); ChickenVariants.register(context, WARM, ChickenVariant.ModelType.NORMAL, "warm_chicken", BiomeTags.SPAWNS_WARM_VARIANT_FARM_ANIMALS); ChickenVariants.register(context, COLD, ChickenVariant.ModelType.COLD, "cold_chicken", BiomeTags.SPAWNS_COLD_VARIANT_FARM_ANIMALS); } private static void register(BootstrapContext context, ResourceKey name, ChickenVariant.ModelType modelType, String textureName, TagKey spawnBiome) { HolderSet.Named biomes = context.lookup(Registries.BIOME).getOrThrow(spawnBiome); ChickenVariants.register(context, name, modelType, textureName, SpawnPrioritySelectors.single(new BiomeCheck(biomes), 1)); } private static void register(BootstrapContext context, ResourceKey name, ChickenVariant.ModelType modelType, String textureName, SpawnPrioritySelectors selectors) { Identifier textureId = Identifier.withDefaultNamespace("entity/chicken/" + textureName); context.register(name, new ChickenVariant(new ModelAndTexture(modelType, textureId), selectors)); } }