mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-31 20:32:34 +00:00
fix: initialize player abilities based on gamemode on first join (#1373)
when a player first joins with creative or spectator mode, their abilities (flying, invulnerability, creative mode flag) were not being set, this caused blocks to not display properly and flying to be disabled until switching gamemodes now calls set_for_gamemode() during player::new() to match vanilla fixes #1367
This commit is contained in:
@@ -452,6 +452,10 @@ impl Player {
|
||||
PlayerScreenHandler::new(&inventory, None, 0).await,
|
||||
));
|
||||
|
||||
// Initialize abilities based on gamemode (like vanilla's GameMode.setAbilities())
|
||||
let mut abilities = Abilities::default();
|
||||
abilities.set_for_gamemode(gamemode);
|
||||
|
||||
Self {
|
||||
living_entity,
|
||||
config: RwLock::new(config),
|
||||
@@ -471,7 +475,7 @@ impl Player {
|
||||
teleport_id_count: AtomicI32::new(0),
|
||||
mining: AtomicBool::new(false),
|
||||
mining_pos: Mutex::new(BlockPos::ZERO),
|
||||
abilities: Mutex::new(Abilities::default()),
|
||||
abilities: Mutex::new(abilities),
|
||||
gamemode: AtomicCell::new(gamemode),
|
||||
previous_gamemode: AtomicCell::new(None),
|
||||
// TODO: Send the CPlayerSpawnPosition packet when the client connects with proper values
|
||||
|
||||
Reference in New Issue
Block a user