valence icon indicating copy to clipboard operation
valence copied to clipboard

World border

Open Sekky61 opened this issue 2 years ago • 2 comments

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?

Sekky61 avatar Oct 18 '22 22:10 Sekky61

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?

dyc3 avatar Oct 18 '22 22:10 dyc3

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.

rj00a avatar Oct 19 '22 02:10 rj00a

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

CodeDoctorDE avatar May 06 '23 11:05 CodeDoctorDE

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.

dyc3 avatar May 06 '23 15:05 dyc3

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

CodeDoctorDE avatar May 06 '23 15:05 CodeDoctorDE

World border was implemented in #364.

rj00a avatar Jun 19 '23 06:06 rj00a