creative
creative copied to clipboard
feat: begin impl for Equipment
Currently missing a few things, if this is even wanted
Wings property for using player-texture not added
also not added color-field for leather etc
Working on this now, do you think an enum would be better? (Seems like Mojang uses an enum too)
enum EquipmentLayerType {
HUMANOID, // humanoid
HUMANOID_LEGGINGS, // humanoid_leggings
WINGS, // wings
WOLF_BODY, // wolf_body
HORSE_BODY, // horse_body
LLAMA_BODY // llama_body
}
This would be more consistent with existing API (like with CubeFace and Element's faces()). Also for a complete implementation: Minecraft uses a List of layers instead, like
interface EquipmentLayer {
Key texture(); // "texture" (seems like its required)
@Nullable Dyeable dyeable(); // optional "dyeable"
boolean usePlayerTexture(); // false by default "use_player_texture"
interface Dyeable {
@Nullable Integer colorWhenUndyed(); // optional, "color_when_undyed"
}
}
so that Equipment is just a map of EquipmentLayerType -> List<EquipmentLayer> with various convenience methods
interface Equipment {
Map<EquipmentLayerType, List<EquipmentLayer>> layers();
...
interface Builder {
...
Builder addLayer(EquipmentLayerType type, EquipmentLayer layer);
default Builder addLayer(EquipmentLayerType type, Key texture) {
return addLayer(type, EquipmentLayer.layer(texture));
}
}
}
definetly makes more sense yep 👍