github.com/df-mc/dragonfly@v0.9.13/server/session/handler_sub_chunk_request.go (about)

     1  package session
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/world"
     5  	"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
     6  )
     7  
     8  // SubChunkRequestHandler handles sub-chunk requests from the client. The server will respond with a packet containing
     9  // the requested sub-chunks.
    10  type SubChunkRequestHandler struct{}
    11  
    12  // Handle ...
    13  func (*SubChunkRequestHandler) Handle(p packet.Packet, s *Session) error {
    14  	pk := p.(*packet.SubChunkRequest)
    15  	s.ViewSubChunks(world.SubChunkPos(pk.Position), pk.Offsets)
    16  	return nil
    17  }