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

Custom skin example #462

Merged
merged 3 commits into from
Sep 19, 2023
Merged

Custom skin example #462

merged 3 commits into from
Sep 19, 2023

Conversation

dyc3
Copy link
Collaborator

@dyc3 dyc3 commented Aug 11, 2023

  • bare minimum to do custom skins on player entities
  • add a CustomSkin component

Objective

This PR aims to make it a little bit easier to create player entities with custom skins. This is common for things like NPCs.

closes #460

Solution

  • Added a new example.
  • Ideally, we could provide the CustomSkin component inside valence itself, maybe in a new valence_util crate?

@rj00a
Copy link
Member

rj00a commented Aug 11, 2023

Instead of a new component, perhaps we should use a custom world query with convenience methods to avoid duplicating data.

@dyc3
Copy link
Collaborator Author

dyc3 commented Sep 19, 2023

@rj00a Would you mind elaborating on your idea there? I might have some spare time soon to fix this up.

@rj00a
Copy link
Member

rj00a commented Sep 19, 2023

I was thinking something like this:

#[derive(WorldQuery)]
#[world_query(mutable)]
pub struct SkinQuery {
    pub properties: &'static mut Properties,
}

impl SkinQueryItem<'_> {
    pub fn skin(&self) {}
    pub fn cape(&self) {}
    pub fn set_skin(&mut self) {}
    pub fn set_cape(&mut self) {}
}

impl SkinQueryReadOnlyItem<'_> {
    pub fn skin(&self) {}
    pub fn cape(&self) {}
}

@rj00a
Copy link
Member

rj00a commented Sep 19, 2023

wait, we can just make those methods on Properties.

@dyc3 dyc3 marked this pull request as ready for review September 19, 2023 14:21
@dyc3 dyc3 requested a review from rj00a September 19, 2023 17:15
@rj00a rj00a merged commit 623392b into main Sep 19, 2023
@rj00a rj00a deleted the custom-skins branch September 19, 2023 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom skins for NPC Player entities
2 participants