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

Incorrect entity data for spawned entity #453

Closed
rj00a opened this issue Aug 8, 2023 · 1 comment · Fixed by #543
Closed

Incorrect entity data for spawned entity #453

rj00a opened this issue Aug 8, 2023 · 1 comment · Fixed by #543
Labels
bug Something isn't working

Comments

@rj00a
Copy link
Member

rj00a commented Aug 8, 2023

Valence Version

8759a21

What You Did

From discord:

commands.spawn(VillagerEntityBundle {
    location: Location(inst_ent),
    position: Position::new([0.5, 104.0, 0.5]),
    ..Default::default()
});

commands.spawn(VillagerEntityBundle {
    location: Location(inst_ent),
    position: Position::new([0.5, 104.0, 3.0]),
    villager_villager_data: VillagerData({
        valence::entity::VillagerData {
            kind: valence::entity::VillagerKind::Jungle,
            profession: VillagerProfession::Armorer,
            level: 5,
        }
    }),
    ..Default::default()
});

What Went Wrong

One of those villagers is on fire(!)

Additional Information

Something with TrackedData or one of the systems that initializes the tracked data is probably bugged.

There is a separate issue where tracked data is initialized with incorrect default values from other entities, but this looks like a different problem.

@rj00a rj00a added bug Something isn't working triage Bug has not been confirmed as real issue yet labels Aug 8, 2023
@pepperoni21
Copy link
Contributor

pepperoni21 commented Aug 9, 2023

commands.spawn(VillagerEntityBundle {
    location: Location(inst_ent),
    position: Position::new([0.5, 104.0, 3.0]),
    villager_villager_data: VillagerData({
        valence::entity::VillagerData {
            kind: valence::entity::VillagerKind::Jungle,
            profession: VillagerProfession::Armorer,
            level: 5,
        }
    }),
    ..Default::default()
});

This one spawns an on fire villager, by not specifying the villager_villager_data, the villager is not on fire.

Edit: For some reason, the villager is on fire only if its level is even (0-2-4-6-8...)

@rj00a rj00a removed the triage Bug has not been confirmed as real issue yet label Aug 10, 2023
@rj00a rj00a closed this as completed in #543 Oct 4, 2023
rj00a pushed a commit that referenced this issue Oct 4, 2023
Fix encoding villager level in `TrackedData`. The level should be
encoded as a `VarInt` when it was being encoded as an `i32`.

# Objective

- Fixes #453 

# Solution

- The level should be encoded as a `VarInt` when it was being encoded as
an `i32`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants