#how to make skin variants?
1 messages · Page 1 of 1 (latest)
So, the way it's done is with entity properties. These are set in the behavior pack on spawn, and the queried in the render controller to display the texture
Here's what the relevant part of the event looks like for the cow:json "first_valid": [ { "filters": { "test": "has_biome_tag", "value": "spawns_warm_variant_farm_animals" }, "set_property": { "minecraft:climate_variant": "warm" } }, { "filters": { "test": "has_biome_tag", "value": "spawns_cold_variant_farm_animals" }, "set_property": { "minecraft:climate_variant": "cold" } } ]
With this being the property definition:```json
"properties": {
"minecraft:climate_variant": {
"type": "enum",
"values": [ "temperate", "warm", "cold" ],
"default": "temperate",
"client_sync": true
}
}
Here's what the cow uses in its render controller: ```json
{
"format_version": "1.8.0",
"render_controllers": {
"controller.render.cow.v2": {
"arrays": {
"textures": {
"Array.textures": [
"Texture.default",
"Texture.warm",
"Texture.cold"
]
},
"geometries": {
"Array.geos": [
"Geometry.default",
"Geometry.warm",
"Geometry.cold"
]
}
},
"geometry": "Array.geos[v.index]",
"materials": [ { "*": "v.is_cold ? Material.cold : Material.default" } ],
"textures": [ "Array.textures[v.index]" ]
}
}
}
v.is_cold is defined in the entity file in the rp
Here's the new cow entity file in the rp:
{
"format_version": "1.10.0",
"minecraft:client_entity": {
"description": {
"identifier": "minecraft:cow",
"min_engine_version": "1.8.0",
"materials": {
"default": "cow",
"cold": "cow_cold"
},
"textures": {
"default": "textures/entity/cow/cow_v2",
"warm": "textures/entity/cow/cow_warm",
"cold": "textures/entity/cow/cow_cold"
},
"geometry": {
"default": "geometry.cow.v2",
"warm": "geometry.cow.warm",
"cold": "geometry.cow.cold"
},
"animations": {
"setup": "animation.cow.setup",
"walk": "animation.quadruped.walk",
"look_at_target": "animation.common.look_at_target",
"baby_transform": "animation.cow.baby_transform"
},
"scripts": {
"animate": [
"setup",
{
"walk": "query.modified_move_speed"
},
"look_at_target",
{
"baby_transform": "query.is_baby"
}
],
"pre_animation": [
"t.variant = query.property('minecraft:climate_variant');",
"v.index = (t.variant == 'temperate') ? 0 : ((t.variant == 'warm') ? 1 : 2);",
"v.is_cold = t.variant == 'cold';"
]
},
"render_controllers": [
"controller.render.cow.v2"
],
"spawn_egg": {
"texture": "spawn_egg_cow"
}
}
}
}```
@static wagon mk entiende algo de esto mire
2/3