Update packetid.go

This commit is contained in:
Tnze
2021-12-10 19:53:42 +08:00
parent 40151f803b
commit ef1fabe9c5
3 changed files with 16 additions and 10 deletions

View File

@ -97,7 +97,7 @@ func pingAndList(addr string, conn *mcnet.Conn) ([]byte, time.Duration, error) {
//PING //PING
startTime := time.Now() startTime := time.Now()
err = conn.WritePacket(pk.Marshal( err = conn.WritePacket(pk.Marshal(
packetid.StatusPing, packetid.StatusPingRequest,
pk.Long(startTime.Unix()), pk.Long(startTime.Unix()),
)) ))
if err != nil { if err != nil {

View File

@ -19,13 +19,13 @@ const (
// Status Clientbound // Status Clientbound
const ( const (
StatusResponse = iota StatusResponse = iota
StatusPong StatusPongResponse
) )
// Game Serverbound // Status Serverbound
const ( const (
StatusRequest = iota StatusRequest = iota
StatusPing StatusPingRequest
) )
// Game Clientbound // Game Clientbound
@ -64,16 +64,16 @@ const (
ClientboundHorseScreenOpen ClientboundHorseScreenOpen
ClientboundInitializeBorder ClientboundInitializeBorder
ClientboundKeepAlive ClientboundKeepAlive
ClientboundLevelChunk ClientboundLevelChunkWithLight
ClientboundLevelEvent ClientboundLevelEvent
ClientboundLevelParticles ClientboundLevelParticles
ClientboundLightUpdate ClientboundLightUpdate
ClientboundLogin ClientboundLogin
ClientboundMapItemData ClientboundMapItemData
ClientboundMerchantOffers ClientboundMerchantOffers
ClientboundEntityPosition ClientboundMoveEntityPos
ClientboundEntityPositionAndRotation ClientboundMoveEntityPosRot
ClientboundEntityRotation ClientboundMoveEntityRot
ClientboundMoveVehicle ClientboundMoveVehicle
ClientboundOpenBook ClientboundOpenBook
ClientboundOpenScreen ClientboundOpenScreen
@ -117,7 +117,7 @@ const (
ClientboundSetPassengers ClientboundSetPassengers
ClientboundSetPlayerTeam ClientboundSetPlayerTeam
ClientboundSetScore ClientboundSetScore
ClientboundUpdateSimulationDistance ClientboundSetSimulationDistance
ClientboundSetSubtitleText ClientboundSetSubtitleText
ClientboundSetTime ClientboundSetTime
ClientboundSetTitleText ClientboundSetTitleText
@ -139,6 +139,7 @@ const (
// Game Serverbound // Game Serverbound
const ( const (
ServerboundAcceptTeleportation = iota ServerboundAcceptTeleportation = iota
ServerboundBlockEntityTagQuery
ServerboundChangeDifficulty ServerboundChangeDifficulty
ServerboundChat ServerboundChat
ServerboundClientCommand ServerboundClientCommand
@ -149,10 +150,15 @@ const (
ServerboundContainerClose ServerboundContainerClose
ServerboundCustomPayload ServerboundCustomPayload
ServerboundEditBook ServerboundEditBook
ServerboundEntityTagQuery
ServerboundInteract ServerboundInteract
ServerboundJigsawGenerate ServerboundJigsawGenerate
ServerboundKeepAlive ServerboundKeepAlive
ServerboundLockDifficulty ServerboundLockDifficulty
ServerboundMovePlayerPos
ServerboundMovePlayerPosRot
ServerboundMovePlayerRot
ServerboundMovePlayerStatusOnly
ServerboundMoveVehicle ServerboundMoveVehicle
ServerboundPaddleBoat ServerboundPaddleBoat
ServerboundPickItem ServerboundPickItem

View File

@ -40,7 +40,7 @@ func (s *Server) acceptListPing(conn *net.Conn) {
break break
} }
err = conn.WritePacket(pk.Marshal(0x00, pk.String(resp))) err = conn.WritePacket(pk.Marshal(0x00, pk.String(resp)))
case packetid.StatusPong: //Ping case packetid.StatusPongResponse: //Ping
err = conn.WritePacket(p) err = conn.WritePacket(p)
} }
if err != nil { if err != nil {