-
Notifications
You must be signed in to change notification settings - Fork 0
Summoning foxes can be now done with a string value as the "variant" nbt.
This is similar to the namespace system minecraft uses almost anywhere else but doesn't for some entity variants included the fox's.
For example this would be how to summon the vanilla lucy variant:
/summon minecraft:fox ~ ~ ~ {variant:"minecraft:red"}
Use mfvapi:fox/variant over minecraft:fox/variant. minecraft:fox/variant only works with vanilla variants and isn't namespaced.
The recommended way of creating new variants is to use the datapack method. If you need to interact with foxes in Java code, see § Java API;
Currently importing can only be done by importing the mod jar via gradle.
Fox variants can be defined in data packs, as part of the directory structure below.
data pack name.zip or
data pack name
├ pack.mcmeta
└ data
└ namespace
└ mfvapi
└ fox_variant
└ <name>.json
Fox variants are defined using the following format:
The root object.
├
assets: The assets to use for this variant:
│ ├
awake: The resource location of the texture to use when the fox is awake.
│ └
sleeping: The resource location of the texture to use when the fox is asleep.
├
baby_assets: The assets to use for the baby of this variant:
│ ├
awake: The resource location of the texture to use when the fox is awake.
│ └
sleeping: The resource location of the texture to use when the fox is asleep.
└
spawn_conditions: The spawn conditions of this variant, see Mob variant definitions § Spawn condition.
In addition, you can make foxes spawn in more biomes by adding them to the mfvapi:fox_spawn biome tag.
Fox variants now use FoxVariant instead of the hardcoded Fox.Variant enum. You can get and set the variant of a fox in the FoxVariants class.
It is recommended for you to make a class containing all the variants your mod adds.
public class ModFoxVariants {
public static final ResourceKey<FoxVariant> CHEESE = createKey("cheese");
private static ResourceKey<FoxVariant> createKey(String name) {
return ResourceKey.create(MfvApiRegistries.FOX_VARIANT, MoreCheese.id(name));
}
}To check if a fox is your variant:
FoxVariants.getVariant(fox).is(ModFoxVariants.CHEESE)Don't use anything inside the implementation packages unless you understand that it could suddenly stop working.