Added a function in world/mod.rs that checks nearby players by a given point and a radius.
Using this function I switched the function that gets the nearby players to the new one and chose a radius of 20.
So every time a player tries to place a block it searches up players in the radius of 20 blocks and checks the collision with them.
If no collision was found it places the block. With that change I also fixed the bug that players could place blocks at their head height and start to swim.
Testing
Tried to place blocks beside or in myself and my 2. account. Both tries worked as expected. Feels like original vanilla minecraft.
I also tried to change the game modes and place from different angles.
Checklist
(Not needed) More testing with more than 2 players. [ ]
[x] Code is well-formatted and adheres to project style guidelines: cargo fmt
[x] Code does not produce any clippy warnings cargo clippy
Description
Added a function in world/mod.rs that checks nearby players by a given point and a radius. Using this function I switched the function that gets the nearby players to the new one and chose a radius of 20. So every time a player tries to place a block it searches up players in the radius of 20 blocks and checks the collision with them. If no collision was found it places the block. With that change I also fixed the bug that players could place blocks at their head height and start to swim.
Testing
Tried to place blocks beside or in myself and my 2. account. Both tries worked as expected. Feels like original vanilla minecraft. I also tried to change the game modes and place from different angles.
Checklist
(Not needed) More testing with more than 2 players. [ ]
[x] Code is well-formatted and adheres to project style guidelines:
cargo fmt
[x] Code does not produce any clippy warnings
cargo clippy