refactor package

This commit is contained in:
2025-08-22 05:14:59 +08:00
parent bec0a56a3d
commit 65690e51ab
371 changed files with 835 additions and 627 deletions

View File

@ -0,0 +1,19 @@
package server
import (
"github.com/Tnze/go-mc/data/packetid"
pk "github.com/Tnze/go-mc/net/packet"
)
type ServerboundPacket interface {
pk.Field
PacketID() packetid.ServerboundPacketID
}
type serverPacketCreator func() ServerboundPacket
var packetRegistry = make(map[packetid.ServerboundPacketID]serverPacketCreator)
func registerPacket(id packetid.ServerboundPacketID, creator serverPacketCreator) {
packetRegistry[id] = creator
}