Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: begin impl for Equipment #71

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Boy0000
Copy link
Contributor

@Boy0000 Boy0000 commented Nov 28, 2024

Currently missing a few things, if this is even wanted
Wings property for using player-texture not added
image

also not added color-field for leather etc
image

@yusshu yusshu self-assigned this Dec 9, 2024
@yusshu yusshu added the enhancement New feature or request label Dec 9, 2024
@yusshu
Copy link
Member

yusshu commented Dec 9, 2024

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 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));
        }
    }
}

@Boy0000
Copy link
Contributor Author

Boy0000 commented Dec 9, 2024

definetly makes more sense yep 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants