package net.minecraft.world.entity.animal; import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; public record CatVariant(ResourceLocation texture) { public static final StreamCodec> STREAM_CODEC = ByteBufCodecs.holderRegistry(Registries.CAT_VARIANT); public static final ResourceKey TABBY = createKey("tabby"); public static final ResourceKey BLACK = createKey("black"); public static final ResourceKey RED = createKey("red"); public static final ResourceKey SIAMESE = createKey("siamese"); public static final ResourceKey BRITISH_SHORTHAIR = createKey("british_shorthair"); public static final ResourceKey CALICO = createKey("calico"); public static final ResourceKey PERSIAN = createKey("persian"); public static final ResourceKey RAGDOLL = createKey("ragdoll"); public static final ResourceKey WHITE = createKey("white"); public static final ResourceKey JELLIE = createKey("jellie"); public static final ResourceKey ALL_BLACK = createKey("all_black"); private static ResourceKey createKey(String name) { return ResourceKey.create(Registries.CAT_VARIANT, ResourceLocation.withDefaultNamespace(name)); } public static CatVariant bootstrap(Registry registry) { register(registry, TABBY, "textures/entity/cat/tabby.png"); register(registry, BLACK, "textures/entity/cat/black.png"); register(registry, RED, "textures/entity/cat/red.png"); register(registry, SIAMESE, "textures/entity/cat/siamese.png"); register(registry, BRITISH_SHORTHAIR, "textures/entity/cat/british_shorthair.png"); register(registry, CALICO, "textures/entity/cat/calico.png"); register(registry, PERSIAN, "textures/entity/cat/persian.png"); register(registry, RAGDOLL, "textures/entity/cat/ragdoll.png"); register(registry, WHITE, "textures/entity/cat/white.png"); register(registry, JELLIE, "textures/entity/cat/jellie.png"); return register(registry, ALL_BLACK, "textures/entity/cat/all_black.png"); } private static CatVariant register(Registry registry, ResourceKey key, String texture) { return Registry.register(registry, key, new CatVariant(ResourceLocation.withDefaultNamespace(texture))); } }