* ViewDistance returns the view distance of the client, in chunks, or the server's render distance if the client's view distance is bigger or not set */
()
| 82 | ViewDistance returns the view distance of the client, in chunks, or the server's render distance if the client's view distance is bigger or not set |
| 83 | */ |
| 84 | func (p *Player) ViewDistance() int32 { |
| 85 | plVd := int32(p.ClientInformation.Load().ViewDistance) |
| 86 | if plVd == 0 || plVd > p.serverProperties.ViewDistance { |
| 87 | return p.serverProperties.ViewDistance |
| 88 | } |
| 89 | |
| 90 | return plVd |
| 91 | } |
| 92 | |
| 93 | // writeOrKill tries to write the packet to the player and kills the connection on failure |
| 94 | func (p *Player) writeOrKill(pk packet.Encodeable) { |