github.com/df-mc/dragonfly@v0.9.13/server/session/handler_request_chunk_radius.go (about) 1 package session 2 3 import ( 4 "github.com/sandertv/gophertunnel/minecraft/protocol/packet" 5 ) 6 7 // RequestChunkRadiusHandler handles the RequestChunkRadius packet. 8 type RequestChunkRadiusHandler struct{} 9 10 // Handle ... 11 func (*RequestChunkRadiusHandler) Handle(p packet.Packet, s *Session) error { 12 pk := p.(*packet.RequestChunkRadius) 13 14 if pk.ChunkRadius > s.maxChunkRadius { 15 pk.ChunkRadius = s.maxChunkRadius 16 } 17 s.chunkRadius = pk.ChunkRadius 18 19 s.chunkLoader.ChangeRadius(int(pk.ChunkRadius)) 20 21 s.writePacket(&packet.ChunkRadiusUpdated{ChunkRadius: s.chunkRadius}) 22 return nil 23 }