/* * Decompiled with CFR 0.152. */ package net.minecraft.world.entity.animal; import java.util.List; import net.minecraft.advancements.criterion.MinMaxBounds; import net.minecraft.core.ClientAsset; import net.minecraft.core.HolderGetter; 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.StructureTags; import net.minecraft.world.entity.animal.CatVariant; import net.minecraft.world.entity.variant.MoonBrightnessCheck; import net.minecraft.world.entity.variant.PriorityProvider; import net.minecraft.world.entity.variant.SpawnPrioritySelectors; import net.minecraft.world.entity.variant.StructureCheck; import net.minecraft.world.level.levelgen.structure.Structure; public interface CatVariants { public static final ResourceKey TABBY = CatVariants.createKey("tabby"); public static final ResourceKey BLACK = CatVariants.createKey("black"); public static final ResourceKey RED = CatVariants.createKey("red"); public static final ResourceKey SIAMESE = CatVariants.createKey("siamese"); public static final ResourceKey BRITISH_SHORTHAIR = CatVariants.createKey("british_shorthair"); public static final ResourceKey CALICO = CatVariants.createKey("calico"); public static final ResourceKey PERSIAN = CatVariants.createKey("persian"); public static final ResourceKey RAGDOLL = CatVariants.createKey("ragdoll"); public static final ResourceKey WHITE = CatVariants.createKey("white"); public static final ResourceKey JELLIE = CatVariants.createKey("jellie"); public static final ResourceKey ALL_BLACK = CatVariants.createKey("all_black"); private static ResourceKey createKey(String name) { return ResourceKey.create(Registries.CAT_VARIANT, Identifier.withDefaultNamespace(name)); } public static void bootstrap(BootstrapContext context) { HolderGetter structures = context.lookup(Registries.STRUCTURE); CatVariants.registerForAnyConditions(context, TABBY, "entity/cat/tabby"); CatVariants.registerForAnyConditions(context, BLACK, "entity/cat/black"); CatVariants.registerForAnyConditions(context, RED, "entity/cat/red"); CatVariants.registerForAnyConditions(context, SIAMESE, "entity/cat/siamese"); CatVariants.registerForAnyConditions(context, BRITISH_SHORTHAIR, "entity/cat/british_shorthair"); CatVariants.registerForAnyConditions(context, CALICO, "entity/cat/calico"); CatVariants.registerForAnyConditions(context, PERSIAN, "entity/cat/persian"); CatVariants.registerForAnyConditions(context, RAGDOLL, "entity/cat/ragdoll"); CatVariants.registerForAnyConditions(context, WHITE, "entity/cat/white"); CatVariants.registerForAnyConditions(context, JELLIE, "entity/cat/jellie"); CatVariants.register(context, ALL_BLACK, "entity/cat/all_black", new SpawnPrioritySelectors(List.of(new PriorityProvider.Selector(new StructureCheck(structures.getOrThrow(StructureTags.CATS_SPAWN_AS_BLACK)), 1), new PriorityProvider.Selector(new MoonBrightnessCheck(MinMaxBounds.Doubles.atLeast(0.9)), 0)))); } private static void registerForAnyConditions(BootstrapContext context, ResourceKey name, String texture) { CatVariants.register(context, name, texture, SpawnPrioritySelectors.fallback(0)); } private static void register(BootstrapContext context, ResourceKey name, String texture, SpawnPrioritySelectors spawnConditions) { context.register(name, new CatVariant(new ClientAsset.ResourceTexture(Identifier.withDefaultNamespace(texture)), spawnConditions)); } }