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

World border #123

Closed
wants to merge 4 commits into from
Closed

World border #123

wants to merge 4 commits into from

Conversation

Sekky61
Copy link
Contributor

@Sekky61 Sekky61 commented Oct 18, 2022

World Border

This PR implements packets and methods to do with world borders.
World border is a wall defined by center point and diameter. It restricts client from going outside the border.

Implemented packets

  • InitializeWorldBorder (this one was defined as WorldBorderInitialize, but unused)
  • SetBorderCenter
  • SetBorderLerpSize
  • SetBorderSize
  • SetBorderWarningDelay
  • SetBorderWarningDistance

TODOs

I do not yet understand the behavior of portal_teleport_boundary field on InitializeWorldBorder. It seems to affect the shape of the border, sometimes making it rectangular instead of square, or making it disappear entirely.

I could not replicate the appearance of the warning screen when getting close to the border.

Discussion

Take this as a draft of the API. I considered two options, basic methods on Client for basic usecases (current state of PR) and copying packet API to the Client API.
Is it acceptable to allow unusual usecases with manual send_packet only?

@dyc3
Copy link
Collaborator

dyc3 commented Oct 18, 2022

Is it acceptable to allow unusual usecases with manual send_packet only?

send_packet is publicly accessible just in case we didn't account for a specific use case. It's a courtesy. That being said, I see no reason why this API wouldn't cover all the use cases as long as you expand it so that all the different kinds of packets can be sent without calling send_packet explicitly.

Are there any particular weird use cases you had in mind?

@rj00a
Copy link
Member

rj00a commented Oct 19, 2022

Is it acceptable to allow unusual usecases with manual send_packet only?

If it's something obscure or behavior not really intended by Mojang then I think it's fine to require a manual send_packet. But it shouldn't be done in the example.

@CodeDoctorDE
Copy link

Any updates? This would be a nice feature for nice game modes

@dyc3
Copy link
Collaborator

dyc3 commented May 6, 2023

This PR is based on a really old version of valence. A lot of it will have to be reworked. @CodeDoctorDE, feel free to make a new PR for this.

@CodeDoctorDE
Copy link

Hmm, I'm very new to rust and I'm not an expert with the minecraft protocol

@rj00a
Copy link
Member

rj00a commented Jun 19, 2023

World border was implemented in #364.

@rj00a rj00a closed this Jun 19, 2023
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.

4 participants