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

Add nearby players collision check when trying to place blocks #293

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Tiiita
Copy link
Contributor

@Tiiita Tiiita commented Nov 15, 2024

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. [ ]

  • Code is well-formatted and adheres to project style guidelines: cargo fmt

  • Code does not produce any clippy warnings cargo clippy

@Tiiita Tiiita force-pushed the check_collision_before_block_place branch from b9ee79b to afae3d0 Compare December 2, 2024 18:57
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.

1 participant