Initialize Commit
This commit is contained in:
26
codec/packet/game/client/add_entity.go
Normal file
26
codec/packet/game/client/add_entity.go
Normal 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
|
||||
}
|
20
codec/packet/game/client/animate.go
Normal file
20
codec/packet/game/client/animate.go
Normal 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
|
||||
}
|
25
codec/packet/game/client/award_stats.go
Normal file
25
codec/packet/game/client/award_stats.go
Normal 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
|
||||
}
|
16
codec/packet/game/client/block_changed_ack.go
Normal file
16
codec/packet/game/client/block_changed_ack.go
Normal 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
|
||||
}
|
19
codec/packet/game/client/block_destruction.go
Normal file
19
codec/packet/game/client/block_destruction.go
Normal 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
|
||||
}
|
13
codec/packet/game/client/block_entity_data.go
Normal file
13
codec/packet/game/client/block_entity_data.go
Normal 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"`
|
||||
}
|
18
codec/packet/game/client/block_event.go
Normal file
18
codec/packet/game/client/block_event.go
Normal 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
|
||||
}
|
16
codec/packet/game/client/block_update.go
Normal file
16
codec/packet/game/client/block_update.go
Normal 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
|
||||
}
|
163
codec/packet/game/client/boss_event.go
Normal file
163
codec/packet/game/client/boss_event.go
Normal 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
|
||||
}
|
7
codec/packet/game/client/bundle_delimiter.go
Normal file
7
codec/packet/game/client/bundle_delimiter.go
Normal file
@ -0,0 +1,7 @@
|
||||
package client
|
||||
|
||||
// BundleDelimiter
|
||||
//
|
||||
// codec:gen
|
||||
type BundleDelimiter struct {
|
||||
}
|
7
codec/packet/game/client/change_difficulty.go
Normal file
7
codec/packet/game/client/change_difficulty.go
Normal file
@ -0,0 +1,7 @@
|
||||
package client
|
||||
|
||||
// codec:gen
|
||||
type ChangeDifficulty struct {
|
||||
Difficulty []int8
|
||||
Locked bool
|
||||
}
|
6
codec/packet/game/client/chunk_batch_finished.go
Normal file
6
codec/packet/game/client/chunk_batch_finished.go
Normal file
@ -0,0 +1,6 @@
|
||||
package client
|
||||
|
||||
// codec:gen
|
||||
type ChunkBatchFinished struct {
|
||||
BatchSize int32 `mc:"VarInt"`
|
||||
}
|
7
codec/packet/game/client/chunk_batch_start.go
Normal file
7
codec/packet/game/client/chunk_batch_start.go
Normal file
@ -0,0 +1,7 @@
|
||||
package client
|
||||
|
||||
// ChunkBatchStartPacket
|
||||
//
|
||||
// codec:gen
|
||||
type ChunkBatchStart struct {
|
||||
}
|
8
codec/packet/game/client/chunk_biomes.go
Normal file
8
codec/packet/game/client/chunk_biomes.go
Normal file
@ -0,0 +1,8 @@
|
||||
package client
|
||||
|
||||
//codec:gen
|
||||
type ChunkBiomes struct {
|
||||
ChunkX int32
|
||||
ChunkZ int32
|
||||
Data []byte `mc:"ByteArray"`
|
||||
}
|
6
codec/packet/game/client/clear_titles.go
Normal file
6
codec/packet/game/client/clear_titles.go
Normal file
@ -0,0 +1,6 @@
|
||||
package client
|
||||
|
||||
//codec:gen
|
||||
type ClearTitles struct {
|
||||
Reset bool
|
||||
}
|
6
codec/packet/game/client/close_container.go
Normal file
6
codec/packet/game/client/close_container.go
Normal file
@ -0,0 +1,6 @@
|
||||
package client
|
||||
|
||||
//codec:gen
|
||||
type CloseContainer struct {
|
||||
WindowID int32 `mc:"VarInt"`
|
||||
}
|
2429
codec/packet/game/client/codecs.go
Normal file
2429
codec/packet/game/client/codecs.go
Normal file
File diff suppressed because it is too large
Load Diff
20
codec/packet/game/client/command_suggestions.go
Normal file
20
codec/packet/game/client/command_suggestions.go
Normal 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
|
||||
}
|
9
codec/packet/game/client/commands.go
Normal file
9
codec/packet/game/client/commands.go
Normal 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"`
|
||||
}
|
11
codec/packet/game/client/container_set_content.go
Normal file
11
codec/packet/game/client/container_set_content.go
Normal 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
|
||||
}
|
22
codec/packet/game/client/container_set_data.go
Normal file
22
codec/packet/game/client/container_set_data.go
Normal 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
|
||||
}
|
24
codec/packet/game/client/container_set_slot.go
Normal file
24
codec/packet/game/client/container_set_slot.go
Normal 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
|
||||
}
|
8
codec/packet/game/client/cookie_request.go
Normal file
8
codec/packet/game/client/cookie_request.go
Normal file
@ -0,0 +1,8 @@
|
||||
package client
|
||||
|
||||
import pk "github.com/Tnze/go-mc/net/packet"
|
||||
|
||||
//codec:gen
|
||||
type CookieRequest struct {
|
||||
Key pk.Identifier
|
||||
}
|
21
codec/packet/game/client/cooldown.go
Normal file
21
codec/packet/game/client/cooldown.go
Normal 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
|
||||
}
|
21
codec/packet/game/client/custom_chat_completions.go
Normal file
21
codec/packet/game/client/custom_chat_completions.go
Normal 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
|
||||
}
|
9
codec/packet/game/client/custom_payload.go
Normal file
9
codec/packet/game/client/custom_payload.go
Normal 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"`
|
||||
}
|
29
codec/packet/game/client/damage_event.go
Normal file
29
codec/packet/game/client/damage_event.go
Normal 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
|
||||
}
|
21
codec/packet/game/client/debug_sample.go
Normal file
21
codec/packet/game/client/debug_sample.go
Normal 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
|
||||
}
|
20
codec/packet/game/client/delete_chat.go
Normal file
20
codec/packet/game/client/delete_chat.go
Normal 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
|
||||
}
|
8
codec/packet/game/client/disconnect.go
Normal file
8
codec/packet/game/client/disconnect.go
Normal file
@ -0,0 +1,8 @@
|
||||
package client
|
||||
|
||||
import "github.com/Tnze/go-mc/chat"
|
||||
|
||||
//codec:gen
|
||||
type Disconnect struct {
|
||||
Reason chat.Message
|
||||
}
|
22
codec/packet/game/client/disguised_chat.go
Normal file
22
codec/packet/game/client/disguised_chat.go
Normal 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
|
||||
}
|
21
codec/packet/game/client/entity_event.go
Normal file
21
codec/packet/game/client/entity_event.go
Normal 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
|
||||
}
|
10
codec/packet/game/client/entity_position_sync.go
Normal file
10
codec/packet/game/client/entity_position_sync.go
Normal 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
|
||||
}
|
25
codec/packet/game/client/explode.go
Normal file
25
codec/packet/game/client/explode.go
Normal 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
|
||||
}
|
21
codec/packet/game/client/forget_level_chunk.go
Normal file
21
codec/packet/game/client/forget_level_chunk.go
Normal 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
|
||||
}
|
17
codec/packet/game/client/game_event.go
Normal file
17
codec/packet/game/client/game_event.go
Normal 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
|
||||
}
|
8
codec/packet/game/client/horse_screen_open.go
Normal file
8
codec/packet/game/client/horse_screen_open.go
Normal file
@ -0,0 +1,8 @@
|
||||
package client
|
||||
|
||||
//codec:gen
|
||||
type OpenHorseScreen struct {
|
||||
WindowID int32 `mc:"VarInt"`
|
||||
InventoryColumnsSize int32 `mc:"VarInt"`
|
||||
EntityID int32
|
||||
}
|
7
codec/packet/game/client/hurt_animation.go
Normal file
7
codec/packet/game/client/hurt_animation.go
Normal file
@ -0,0 +1,7 @@
|
||||
package client
|
||||
|
||||
//codec:gen
|
||||
type HurtAnimation struct {
|
||||
EntityID int32 `mc:"VarInt"`
|
||||
Yaw float32
|
||||
}
|
11
codec/packet/game/client/initialize_border.go
Normal file
11
codec/packet/game/client/initialize_border.go
Normal 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"`
|
||||
}
|
6
codec/packet/game/client/keep_alive.go
Normal file
6
codec/packet/game/client/keep_alive.go
Normal file
@ -0,0 +1,6 @@
|
||||
package client
|
||||
|
||||
//codec:gen
|
||||
type KeepAlive struct {
|
||||
ID int64
|
||||
}
|
12
codec/packet/game/client/level_chunk_with_light.go
Normal file
12
codec/packet/game/client/level_chunk_with_light.go
Normal 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
|
||||
}
|
20
codec/packet/game/client/level_event.go
Normal file
20
codec/packet/game/client/level_event.go
Normal 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
|
||||
}
|
47
codec/packet/game/client/login.go
Normal file
47
codec/packet/game/client/login.go
Normal 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
|
||||
}
|
57
codec/packet/game/client/map_data.go
Normal file
57
codec/packet/game/client/map_data.go
Normal 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
|
||||
}
|
1
codec/packet/game/client/merchant_offers.go
Normal file
1
codec/packet/game/client/merchant_offers.go
Normal file
@ -0,0 +1 @@
|
||||
package client
|
42
codec/packet/game/client/packet.go
Normal file
42
codec/packet/game/client/packet.go
Normal 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{}
|
||||
}
|
18
codec/packet/game/client/player_abilities.go
Normal file
18
codec/packet/game/client/player_abilities.go
Normal 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
|
||||
}
|
24
codec/packet/game/client/player_position.go
Normal file
24
codec/packet/game/client/player_position.go
Normal 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
|
||||
}
|
17
codec/packet/game/client/respawn.go
Normal file
17
codec/packet/game/client/respawn.go
Normal 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
|
||||
}
|
9
codec/packet/game/client/update_light.go
Normal file
9
codec/packet/game/client/update_light.go
Normal 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
|
||||
}
|
10
codec/packet/game/server/packet.go
Normal file
10
codec/packet/game/server/packet.go
Normal 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
9897
codec/packet/protocol.wiki
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user