Initialize Commit

This commit is contained in:
2025-06-19 15:01:07 +08:00
commit e40ed2e534
164 changed files with 19741 additions and 0 deletions

View File

@ -0,0 +1,26 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
"github.com/google/uuid"
)
var _ ClientboundPacket = (*AddEntity)(nil)
var _ packet.Field = (*AddEntity)(nil)
// AddEntityPacket
// codec:gen
type AddEntity struct {
ID int32 `mc:"VarInt"`
UUID uuid.UUID `mc:"UUID"`
Type int32 `mc:"VarInt"`
X, Y, Z float64
XRot, YRot, YHeadRot int8
Data int32 `mc:"VarInt"`
VelocityX, VelocityY, VelocityZ int16
}
func (AddEntity) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundAddEntity
}

View File

@ -0,0 +1,20 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
)
var _ ClientboundPacket = (*Animate)(nil)
var _ packet.Field = (*Animate)(nil)
// AnimatePacket
// codec:gen
type Animate struct {
EntityID int32 `mc:"VarInt"`
Action uint8
}
func (Animate) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundAnimate
}

View File

@ -0,0 +1,25 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
)
// codec:gen
type StatsData struct {
CategoryID int32 `mc:"VarInt"`
StatID int32 `mc:"VarInt"`
Value int32 `mc:"VarInt"`
}
var _ ClientboundPacket = (*AwardStats)(nil)
var _ packet.Field = (*AwardStats)(nil)
// codec:gen
type AwardStats struct {
Stats []StatsData
}
func (AwardStats) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundAwardStats
}

View File

@ -0,0 +1,16 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
)
var _ ClientboundPacket = (*BlockChangedAck)(nil)
// codec:gen
type BlockChangedAck struct {
Sequence int32 `mc:"VarInt"`
}
func (BlockChangedAck) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundBlockChangedAck
}

View File

@ -0,0 +1,19 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
)
var _ ClientboundPacket = (*BlockDestruction)(nil)
// codec:gen
type BlockDestruction struct {
ID int32 `mc:"VarInt"`
Position packet.Position
Progress uint8
}
func (BlockDestruction) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundBlockDestruction
}

View File

@ -0,0 +1,13 @@
package client
import (
"github.com/Tnze/go-mc/nbt"
"github.com/Tnze/go-mc/net/packet"
)
// codec:gen
type BlockEntityData struct {
Position packet.Position
Type int32 `mc:"VarInt"`
Data nbt.RawMessage `mc:"NBT"`
}

View File

@ -0,0 +1,18 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
)
// codec:gen
type BlockEvent struct {
Position packet.Position
EventType uint8
Data uint8
Block int32 `mc:"VarInt"`
}
func (BlockEvent) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundBlockEvent
}

View File

@ -0,0 +1,16 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
)
// codec:gen
type BlockUpdate struct {
Position packet.Position
BlockState int32 `mc:"VarInt"`
}
func (BlockUpdate) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundBlockUpdate
}

View File

@ -0,0 +1,163 @@
package client
import (
"io"
"github.com/Tnze/go-mc/chat"
pk "github.com/Tnze/go-mc/net/packet"
"github.com/google/uuid"
)
// codec:gen
type BossEvent struct {
UUID uuid.UUID `mc:"UUID"`
BossEventOp BossEventOperation
}
// codec:gen
type BossEventOpAdd struct {
Message chat.Message
Progress float32
Color int32 `mc:"VarInt"`
Overlay int32 `mc:"VarInt"`
Flags uint8
}
// codec:gen
type BossEventOpRemove struct {
}
// codec:gen
type BossEventOpUpdate struct {
Progress float32
}
// codec:gen
type BossEventOpUpdateName struct {
Message chat.Message
}
// codec:gen
type BossEventOpUpdateStyle struct {
Color int32 `mc:"VarInt"`
Overlay int32 `mc:"VarInt"`
}
// codec:gen
type BossEventOpUpdateProperties struct {
Flags uint8
}
type BossEventOperation struct {
Operation int32 `mc:"VarInt"`
OpData any
}
func (c *BossEventOperation) ReadFrom(r io.Reader) (int64, error) {
o, err := (*pk.VarInt)(&c.Operation).ReadFrom(r)
if err != nil {
return o, err
}
var i int64
switch c.Operation {
case 0:
var op BossEventOpAdd
i, err = op.ReadFrom(r)
if err != nil {
return i, err
}
c.OpData = &op
case 1:
var op BossEventOpRemove
i, err = op.ReadFrom(r)
if err != nil {
return i, err
}
c.OpData = &op
case 2:
var op BossEventOpUpdate
i, err = op.ReadFrom(r)
if err != nil {
return i, err
}
c.OpData = &op
case 3:
var op BossEventOpUpdateName
i, err = op.ReadFrom(r)
if err != nil {
return i, err
}
c.OpData = &op
case 4:
var op BossEventOpUpdateStyle
i, err = op.ReadFrom(r)
if err != nil {
return i, err
}
c.OpData = &op
case 5:
var op BossEventOpUpdateProperties
i, err = op.ReadFrom(r)
if err != nil {
return i, err
}
c.OpData = &op
}
return o + i, nil
}
func (c *BossEventOperation) WriteTo(w io.Writer) (int64, error) {
o, err := (*pk.VarInt)(&c.Operation).WriteTo(w)
if err != nil {
return o, err
}
switch c.Operation {
case 0:
op := c.OpData.(*BossEventOpAdd)
i, err := op.WriteTo(w)
if err != nil {
return o + i, err
}
return o + i, nil
case 1:
op := c.OpData.(*BossEventOpRemove)
i, err := op.WriteTo(w)
if err != nil {
return o + i, err
}
return o + i, nil
case 2:
op := c.OpData.(*BossEventOpUpdate)
i, err := op.WriteTo(w)
if err != nil {
return o + i, err
}
return o + i, nil
case 3:
op := c.OpData.(*BossEventOpUpdateName)
i, err := op.WriteTo(w)
if err != nil {
return o + i, err
}
return o + i, nil
case 4:
op := c.OpData.(*BossEventOpUpdateStyle)
i, err := op.WriteTo(w)
if err != nil {
return o + i, err
}
return o + i, nil
case 5:
op := c.OpData.(*BossEventOpUpdateProperties)
i, err := op.WriteTo(w)
if err != nil {
return o + i, err
}
return o + i, nil
}
return o, nil
}

View File

@ -0,0 +1,7 @@
package client
// BundleDelimiter
//
// codec:gen
type BundleDelimiter struct {
}

View File

@ -0,0 +1,7 @@
package client
// codec:gen
type ChangeDifficulty struct {
Difficulty []int8
Locked bool
}

View File

@ -0,0 +1,6 @@
package client
// codec:gen
type ChunkBatchFinished struct {
BatchSize int32 `mc:"VarInt"`
}

View File

@ -0,0 +1,7 @@
package client
// ChunkBatchStartPacket
//
// codec:gen
type ChunkBatchStart struct {
}

View File

@ -0,0 +1,8 @@
package client
//codec:gen
type ChunkBiomes struct {
ChunkX int32
ChunkZ int32
Data []byte `mc:"ByteArray"`
}

View File

@ -0,0 +1,6 @@
package client
//codec:gen
type ClearTitles struct {
Reset bool
}

View File

@ -0,0 +1,6 @@
package client
//codec:gen
type CloseContainer struct {
WindowID int32 `mc:"VarInt"`
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
package client
import (
"github.com/Tnze/go-mc/chat"
pk "github.com/Tnze/go-mc/net/packet"
)
//codec:gen
type CommandSuggestionsMatch struct {
Match string
Tooltip pk.Option[chat.Message, *chat.Message]
}
//codec:gen
type CommandSuggestions struct {
ID int32 `mc:"VarInt"`
Start int32 `mc:"VarInt"`
Length int32 `mc:"VarInt"`
Matches []CommandSuggestionsMatch
}

View File

@ -0,0 +1,9 @@
package client
import "github.com/Tnze/go-mc/server/command"
//codec:gen
type Commands struct {
Nodes []command.Node
RootIndex int32 `mc:"VarInt"`
}

View File

@ -0,0 +1,11 @@
package client
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
//codec:gen
type SetContainerContent struct {
WindowID int32 `mc:"VarInt"`
StateID int32 `mc:"VarInt"`
Slots []slot.Slot
CarriedItem slot.Slot
}

View File

@ -0,0 +1,22 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
)
var _ ClientboundPacket = (*ContainerSetData)(nil)
var _ packet.Field = (*ContainerSetData)(nil)
// ContainerSetDataPacket
//
//codec:gen
type ContainerSetData struct {
ContainerID int8
ID int16
Value int16
}
func (ContainerSetData) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundContainerSetData
}

View File

@ -0,0 +1,24 @@
package client
import (
"git.konjactw.dev/patyhank/minego/codec/data/slot"
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
)
var _ ClientboundPacket = (*ContainerSetSlot)(nil)
var _ packet.Field = (*ContainerSetSlot)(nil)
// ContainerSetSlotPacket
//
//codec:gen
type ContainerSetSlot struct {
ContainerID int32 `mc:"VarInt"`
StateID int32 `mc:"VarInt"`
Slot int16
ItemStack slot.Slot
}
func (ContainerSetSlot) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundContainerSetSlot
}

View File

@ -0,0 +1,8 @@
package client
import pk "github.com/Tnze/go-mc/net/packet"
//codec:gen
type CookieRequest struct {
Key pk.Identifier
}

View File

@ -0,0 +1,21 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
pk "github.com/Tnze/go-mc/net/packet"
)
var _ ClientboundPacket = (*Cooldown)(nil)
var _ pk.Field = (*Cooldown)(nil)
// CooldownPacket
//
//codec:gen
type Cooldown struct {
CooldownGroup pk.Identifier `mc:"Identifier"`
Duration int32 `mc:"VarInt"`
}
func (Cooldown) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundCooldown
}

View File

@ -0,0 +1,21 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
)
var _ ClientboundPacket = (*CustomChatCompletions)(nil)
var _ packet.Field = (*CustomChatCompletions)(nil)
// CustomChatCompletionsPacket
//
//codec:gen
type CustomChatCompletions struct {
Action int32 `mc:"VarInt"`
Entries []string
}
func (CustomChatCompletions) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundCustomChatCompletions
}

View File

@ -0,0 +1,9 @@
package client
import pk "github.com/Tnze/go-mc/net/packet"
//codec:gen
type CustomPayload struct {
Channel pk.Identifier
Data []byte `mc:"ByteArray"`
}

View File

@ -0,0 +1,29 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
pk "github.com/Tnze/go-mc/net/packet"
)
var _ ClientboundPacket = (*DamageEvent)(nil)
var _ pk.Field = (*DamageEvent)(nil)
//codec:gen
type DamageEventPos struct {
X, Y, Z float64
}
// DamageEventPacket
//
//codec:gen
type DamageEvent struct {
EntityID int32 `mc:"VarInt"`
SourceType int32 `mc:"VarInt"`
SourceCauseID int32 `mc:"VarInt"`
SourceDirectID int32 `mc:"VarInt"`
SourcePos pk.Option[DamageEventPos, *DamageEventPos]
}
func (DamageEvent) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundDamageEvent
}

View File

@ -0,0 +1,21 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
)
var _ ClientboundPacket = (*DebugSample)(nil)
var _ packet.Field = (*DebugSample)(nil)
// DebugSamplePacket
//
//codec:gen
type DebugSample struct {
Sample []int64
DebugSampleType int32 `mc:"VarInt"`
}
func (DebugSample) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundDebugSample
}

View File

@ -0,0 +1,20 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
)
var _ ClientboundPacket = (*DeleteChat)(nil)
var _ packet.Field = (*DeleteChat)(nil)
// DeleteChatPacket
//
//codec:gen
type DeleteChat struct {
MessageSignature []byte `mc:"ByteArray"`
}
func (DeleteChat) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundDeleteChat
}

View File

@ -0,0 +1,8 @@
package client
import "github.com/Tnze/go-mc/chat"
//codec:gen
type Disconnect struct {
Reason chat.Message
}

View File

@ -0,0 +1,22 @@
package client
import (
"github.com/Tnze/go-mc/chat"
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
)
var _ ClientboundPacket = (*DisguisedChat)(nil)
var _ packet.Field = (*DisguisedChat)(nil)
// DisguisedChatPacket
//
//codec:gen
type DisguisedChat struct {
Message chat.Message
ChatType []byte `mc:"ByteArray"`
}
func (DisguisedChat) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundDisguisedChat
}

View File

@ -0,0 +1,21 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
)
var _ ClientboundPacket = (*EntityEvent)(nil)
var _ packet.Field = (*EntityEvent)(nil)
// EntityEventPacket
//
//codec:gen
type EntityEvent struct {
EntityID int32
EventID int8
}
func (EntityEvent) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundEntityEvent
}

View File

@ -0,0 +1,10 @@
package client
//codec:gen
type TeleportEntity struct {
EntityID int32 `mc:"VarInt"`
X, Y, Z float64
VelocityX, VelocityY, VelocityZ float64
Yaw, Pitch float32
OnGround bool
}

View File

@ -0,0 +1,25 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
pk "github.com/Tnze/go-mc/net/packet"
)
var _ ClientboundPacket = (*Explode)(nil)
//codec:gen
type Vec3 struct {
X, Y, Z float64
}
//codec:gen
type Explode struct {
CenterX float64
CenterY float64
CenterZ float64
PlayerKnockbackVelocity pk.Option[Vec3, *Vec3]
}
func (Explode) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundExplode
}

View File

@ -0,0 +1,21 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
)
var _ ClientboundPacket = (*ForgetLevelChunk)(nil)
//codec:gen
type ChunkPos struct {
X, Z int32
}
//codec:gen
type ForgetLevelChunk struct {
Pos ChunkPos
}
func (ForgetLevelChunk) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundForgetLevelChunk
}

View File

@ -0,0 +1,17 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
)
var _ ClientboundPacket = (*GameEvent)(nil)
//codec:gen
type GameEvent struct {
Event uint8
Param float32
}
func (GameEvent) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundGameEvent
}

View File

@ -0,0 +1,8 @@
package client
//codec:gen
type OpenHorseScreen struct {
WindowID int32 `mc:"VarInt"`
InventoryColumnsSize int32 `mc:"VarInt"`
EntityID int32
}

View File

@ -0,0 +1,7 @@
package client
//codec:gen
type HurtAnimation struct {
EntityID int32 `mc:"VarInt"`
Yaw float32
}

View File

@ -0,0 +1,11 @@
package client
//codec:gen
type InitializeWorldBorder struct {
X, Z float64
OldDiameter, NewDiameter float64
Speed int64 `mc:"VarLong"`
PortalTeleportBoundary int32 `mc:"VarInt"`
WarningBlocks int32 `mc:"VarInt"`
WarningTime int32 `mc:"VarInt"`
}

View File

@ -0,0 +1,6 @@
package client
//codec:gen
type KeepAlive struct {
ID int64
}

View File

@ -0,0 +1,12 @@
package client
import "github.com/Tnze/go-mc/level"
var _ ClientboundPacket = (*LevelChunkWithLight)(nil)
//codec:gen
type LevelChunkWithLight struct {
X int32
Z int32
Data level.Chunk
}

View File

@ -0,0 +1,20 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
pk "github.com/Tnze/go-mc/net/packet"
)
var _ ClientboundPacket = (*LevelEvent)(nil)
//codec:gen
type LevelEvent struct {
Type int32
Pos pk.Position
Data int32
GlobalEvent bool
}
func (LevelEvent) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundLevelEvent
}

View File

@ -0,0 +1,47 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
pk "github.com/Tnze/go-mc/net/packet"
)
var _ ClientboundPacket = (*Login)(nil)
//codec:gen
type GlobalPos struct {
Dimension string `mc:"Identifier"`
Pos pk.Position
}
//codec:gen
type CommonPlayerSpawnInfo struct {
DimensionType int32 `mc:"VarInt"`
Dimension string `mc:"Identifier"`
Seed int64
GameType uint8
PreviousGameType int8
IsDebug bool
IsFlat bool
LastDeathLocation pk.Option[GlobalPos, *GlobalPos]
PortalCooldown int32 `mc:"VarInt"`
SeaLevel int32 `mc:"VarInt"`
}
//codec:gen
type Login struct {
PlayerID int32 `mc:"VarInt"`
Hardcore bool
Levels []string `mc:"Identifier"`
MaxPlayers int32 `mc:"VarInt"`
ChunkRadius int32 `mc:"VarInt"`
SimulationDistance int32 `mc:"VarInt"`
ReducedDebugInfo bool
ShowDeathScreen bool
DoLimitedCrafting bool
CommonPlayerSpawnInfo CommonPlayerSpawnInfo
EnforcesSecureChat bool
}
func (Login) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundLogin
}

View File

@ -0,0 +1,57 @@
package client
import (
"io"
"github.com/Tnze/go-mc/chat"
pk "github.com/Tnze/go-mc/net/packet"
)
//codec:gen
type MapIcon struct {
Type int32 `mc:"VarInt"`
X, Z int8
Direction int8
DisplayName pk.Option[chat.Message, *chat.Message]
}
type MapColorPatch struct {
Columns uint8
Rows uint8
X, Z uint8
Data []pk.UnsignedByte
}
func (c *MapColorPatch) ReadFrom(r io.Reader) (n int64, err error) {
t, err := (*pk.UnsignedByte)(&c.Columns).ReadFrom(r)
if err != nil {
return t, err
}
if c.Columns <= 0 {
return t, err
}
a, err := (*pk.UnsignedByte)(&c.Rows).ReadFrom(r)
b, err := (*pk.UnsignedByte)(&c.X).ReadFrom(r)
d, err := (*pk.UnsignedByte)(&c.Z).ReadFrom(r)
e, err := pk.Array(&c.Data).ReadFrom(r)
return t + a + b + d + e, err
}
func (c MapColorPatch) WriteTo(w io.Writer) (n int64, err error) {
n, err = pk.UnsignedByte(c.Columns).WriteTo(w)
if c.Columns <= 0 {
return n, err
}
n, err = pk.UnsignedByte(c.Rows).WriteTo(w)
n, err = pk.UnsignedByte(c.X).WriteTo(w)
n, err = pk.UnsignedByte(c.Z).WriteTo(w)
n, err = pk.Array(&c.Data).WriteTo(w)
return n, err
}
//codec:gen
type MapData struct {
MapID int32 `mc:"VarInt"`
Scale int8
Locked bool
}

View File

@ -0,0 +1 @@
package client

View File

@ -0,0 +1,42 @@
//codec:ignore
package client
import (
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
)
type ClientboundPacket interface {
packet.Field
}
var ClientboundPackets = make(map[packetid.ClientboundPacketID]ClientboundPacket)
func init() {
ClientboundPackets[packetid.ClientboundAddEntity] = &AddEntity{}
ClientboundPackets[packetid.ClientboundAnimate] = &Animate{}
ClientboundPackets[packetid.ClientboundAwardStats] = &AwardStats{}
ClientboundPackets[packetid.ClientboundBlockChangedAck] = &BlockChangedAck{}
ClientboundPackets[packetid.ClientboundBlockDestruction] = &BlockDestruction{}
ClientboundPackets[packetid.ClientboundBlockEntityData] = &BlockEntityData{}
ClientboundPackets[packetid.ClientboundBlockEvent] = &BlockEvent{}
ClientboundPackets[packetid.ClientboundBlockUpdate] = &BlockUpdate{}
ClientboundPackets[packetid.ClientboundBossEvent] = &BossEvent{}
ClientboundPackets[packetid.ClientboundChangeDifficulty] = &ChangeDifficulty{}
ClientboundPackets[packetid.ClientboundChunkBatchFinished] = &ChunkBatchFinished{}
ClientboundPackets[packetid.ClientboundChunkBatchStart] = &ChunkBatchStart{}
ClientboundPackets[packetid.ClientboundChunksBiomes] = &ChunkBiomes{}
ClientboundPackets[packetid.ClientboundClearTitles] = &ClearTitles{}
ClientboundPackets[packetid.ClientboundContainerClose] = &CloseContainer{}
ClientboundPackets[packetid.ClientboundCommandSuggestions] = &CommandSuggestions{}
ClientboundPackets[packetid.ClientboundCommands] = &Commands{}
ClientboundPackets[packetid.ClientboundContainerSetData] = &ContainerSetData{}
ClientboundPackets[packetid.ClientboundContainerSetSlot] = &ContainerSetSlot{}
ClientboundPackets[packetid.ClientboundCooldown] = &Cooldown{}
ClientboundPackets[packetid.ClientboundCustomChatCompletions] = &CustomChatCompletions{}
ClientboundPackets[packetid.ClientboundDamageEvent] = &DamageEvent{}
ClientboundPackets[packetid.ClientboundDebugSample] = &DebugSample{}
ClientboundPackets[packetid.ClientboundDeleteChat] = &DeleteChat{}
ClientboundPackets[packetid.ClientboundDisguisedChat] = &DisguisedChat{}
ClientboundPackets[packetid.ClientboundEntityEvent] = &EntityEvent{}
}

View File

@ -0,0 +1,18 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
)
var _ ClientboundPacket = (*PlayerAbilities)(nil)
//codec:gen
type PlayerAbilities struct {
Flags uint8
FlyingSpeed float32
WalkingSpeed float32
}
func (PlayerAbilities) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundPlayerAbilities
}

View File

@ -0,0 +1,24 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
)
var _ ClientboundPacket = (*PlayerPosition)(nil)
//codec:gen
type PositionMoveRotation struct {
X, Y, Z float64
YRot, XRot float32
}
//codec:gen
type PlayerPosition struct {
ID int32 `mc:"VarInt"`
Change PositionMoveRotation
Relatives uint8
}
func (PlayerPosition) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundPlayerPosition
}

View File

@ -0,0 +1,17 @@
package client
import (
"github.com/Tnze/go-mc/data/packetid"
)
var _ ClientboundPacket = (*Respawn)(nil)
//codec:gen
type Respawn struct {
CommonPlayerSpawnInfo CommonPlayerSpawnInfo
DataToKeep uint8
}
func (Respawn) ClientboundPacketID() packetid.ClientboundPacketID {
return packetid.ClientboundRespawn
}

View File

@ -0,0 +1,9 @@
package client
import "github.com/Tnze/go-mc/level"
//codec:gen
type UpdateLight struct {
ChunkX, ChunkZ int32 `mc:"VarInt"`
Data level.LightData
}

View File

@ -0,0 +1,10 @@
//codec:ignore
package server
import "github.com/Tnze/go-mc/data/packetid"
type ServerboundPacket interface {
ServerboundPacketID() packetid.ServerboundPacketID
}
var ServerboundPackets = make(map[packetid.ServerboundPacketID]ServerboundPacket)

9897
codec/packet/protocol.wiki Normal file

File diff suppressed because it is too large Load Diff