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