Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
More Axolotl Variants Api Wiki › Guides › How to Register a New Axolotl Variant in Your Own Mod

How to Register a New Axolotl Variant in Your Own Mod

Calling the Registration Method

To add a new variant, call ModdedAxolotlVariant.register(new ResourceLocation("yourmodid", "yourvariantname")) during mod initialization. The ResourceLocation takes two arguments: your mod ID and the variant name. Both must be lowercase and use only valid characters (letters, digits, underscores, dots, hyphens).

1. Choose whether the variant should be a natural variant or a breeding-only variant.

2. For a natural variant (one that can spawn in the world), chain .natural() before .build().

3. For a breeding-only variant (only obtainable by breeding two axolotls), omit .natural() and just call .build().

Example Calls

Natural variant: ModdedAxolotlVariant.register(new ResourceLocation("yourmodid", "yourvariantname")).natural().build();

Breeding-only variant: ModdedAxolotlVariant.register(new ResourceLocation("yourmodid", "yourvariantname")).build();

Run this code once during common setup so both client and server know about the variant. After registration, the variant can be summoned with /summon minecraft:axolotl ~ ~ ~ {Variant:"yourmodid:yourvariantname"}. Make sure the identifier you pass to register matches exactly what you use in commands.