MCPcopy Create free account
hub / github.com/ZeppelinMC/Zeppelin / finishConfiguration

Method finishConfiguration

server/player/player.go:101–138  ·  view source on GitHub ↗

finishConfiguration finishes the configuration phase by sending the server brand, registries and tags

()

Source from the content-addressed store, hash-verified

99
100// finishConfiguration finishes the configuration phase by sending the server brand, registries and tags
101func (p *Player) finishConfiguration() error {
102 // begin packet reading in the background
103 go p.listenPackets()
104
105 // send the server brand (shows in F3)
106 if err := p.WritePacket(&configuration.ClientboundPluginMessage{
107 Channel: "minecraft:brand",
108 Data: encoding.AppendString(nil, "Zeppelin"),
109 }); err != nil {
110 return err
111 }
112
113 // send the registry packets
114 configuration.RegistryPacketsMutex.Lock()
115 for _, pk := range configuration.RegistryPackets {
116 if err := p.WritePacket(pk); err != nil {
117 return err
118 }
119 p.registryIndexes[pk.RegistryId] = slices.Clone(pk.Indexes)
120 }
121 configuration.RegistryPacketsMutex.Unlock()
122
123 // finish the configuration phase
124 if err := p.WritePacket(configuration.FinishConfiguration{}); err != nil {
125 return err
126 }
127
128 // wait for the client to acknowledge the finish configuration packet
129 if _, err := p.awaitPacket(configuration.PacketIdAcknowledgeFinishConfiguration); err != nil {
130 return err
131 }
132
133 // switch to play state
134 p.SetState(net.PlayState)
135
136 // send tags (blocks, fluids, etc)
137 return p.WritePacket(tags.Tags)
138}
139
140// startGame finishes the initialization for the player and logs it into the world
141func (p *Player) startGame() error {

Callers 1

LoginMethod · 0.95

Calls 5

listenPacketsMethod · 0.95
awaitPacketMethod · 0.95
AppendStringFunction · 0.92
WritePacketMethod · 0.80
SetStateMethod · 0.80

Tested by

no test coverage detected