feather-rs / feather

A Minecraft server implementation in Rust
Apache License 2.0
2.6k stars 143 forks source link

Use player.dat #458

Closed Iaiao closed 2 years ago

Iaiao commented 3 years ago

player.dat

Status

Description

This PR makes player's data (inventory, abilities, position, gamemode, previous gamemode, health) persistent by saving it to player.dat files, adds player abilities and previous gamemode component (used in F3+F4 gamemode switcher), methods client.send_abilities, client.set_hotbar_slot, world.load_player_data and world.save_player_data. This also adds derive_more dependency to derive Deref and DerefMut on single-field components.

Related issues

Checklist

Note: if you locally don't get any errors, but GitHub Actions fails (especially at clippy) you might want to check your rust toolchain version. You can then feel free to fix these warnings/errors in your PR.

Iaiao commented 3 years ago

Looks okay, not sure why PreviousGamemode is it own type but I assume there's a reason

Because it's a component, the client uses it in F3+F4 gamemode switcher. It also allows -1 value, which means there's no previous gamemode

Defman commented 2 years ago

This does not seem to compile on the CI.

Tracreed commented 2 years ago

This does not seem to compile on the CI.

Seems to be the problem of the superflat file adding together str. Some get it and some don't. It hasn't changed so it shouldn't fail.

Defman commented 2 years ago

Is it ready to be merged?

Iaiao commented 2 years ago

Yes, it's ready