1.21.6 Clientbound PlayState Packets

This commit is contained in:
2025-06-20 04:22:08 +08:00
parent e40ed2e534
commit 195d34f32d
204 changed files with 10118 additions and 3287 deletions

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
package client
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
import "git.konjactw.dev/patyhank/minego/codec/slot"
//codec:gen
type SetContainerContent struct {

View File

@ -1,7 +1,7 @@
package client
import (
"git.konjactw.dev/patyhank/minego/codec/data/slot"
"git.konjactw.dev/patyhank/minego/codec/slot"
"github.com/Tnze/go-mc/data/packetid"
"github.com/Tnze/go-mc/net/packet"
)

View File

@ -0,0 +1,12 @@
package client
//codec:gen
type ReportDetails struct {
Title string
Description string
}
//codec:gen
type CustomReportDetails struct {
Details []ReportDetails
}

View File

@ -1 +1,31 @@
package client
import (
"git.konjactw.dev/patyhank/minego/codec/slot"
)
//codec:gen
type TradeOption struct {
Input slot.TradeSlot
Output slot.Slot
HasSecondInput bool
//opt:optional:HasSecondInput
SecondInput slot.TradeSlot
TradeDisabled bool
TradeUses int32
MaxTradeUses int32
Experience int32
SpecialPrice int32
PriceMultiplier float32
Demand int32
}
//codec:gen
type MerchantOffers struct {
WindowID int32 `mc:"VarInt"`
Offers []TradeOption
Level int32 `mc:"VarInt"`
Experience int32 `mc:"VarInt"`
IsRegular bool
CanRestock bool
}

View File

@ -0,0 +1,8 @@
package client
//codec:gen
type UpdateEntityPosition struct {
EntityID int32 `mc:"VarInt"`
DeltaX, DeltaY, DeltaZ int16
OnGround bool
}

View File

@ -0,0 +1,11 @@
package client
import pk "github.com/Tnze/go-mc/net/packet"
//codec:gen
type UpdateEntityPositionAndRotation struct {
EntityID int32 `mc:"VarInt"`
DeltaX, DeltaY, DeltaZ int16
Yaw, Pitch pk.Angle
OnGround bool
}

View File

@ -0,0 +1,8 @@
package client
//codec:gen
type UpdateEntityRotation struct {
EntityID int32 `mc:"VarInt"`
Yaw, Pitch float32
OnGround bool
}

View File

@ -0,0 +1,17 @@
package client
import pk "github.com/Tnze/go-mc/net/packet"
//codec:gen
type MinecartStep struct {
X, Y, Z float64
VelocityX, VelocityY, VelocityZ float64
Yaw, Pitch pk.Angle
Weight float32
}
//codec:gen
type MoveMinecartAlongTrack struct {
EntityID int32 `mc:"VarInt"`
Steps []MinecartStep
}

View File

@ -0,0 +1,7 @@
package client
//codec:gen
type MoveVehicle struct {
X, Y, Z float64
Yaw, Pitch float32
}

View File

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

View File

@ -0,0 +1,9 @@
package client
import "github.com/Tnze/go-mc/chat"
type OpenScreen struct {
WindowID int32 `mc:"VarInt"`
WindowType int32 `mc:"VarInt"`
WindowTitle chat.Message
}

View File

@ -0,0 +1,9 @@
package client
import pk "github.com/Tnze/go-mc/net/packet"
//codec:gen
type OpenSignEditor struct {
Location pk.Position
Front bool
}

View File

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

View File

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

View File

@ -0,0 +1,9 @@
package client
import "git.konjactw.dev/patyhank/minego/codec/slot/display/recipe"
//codec:gen
type PlaceGhostRecipe struct {
WindowID int32 `mc:"VarInt"`
RecipeDisplay recipe.Display
}

View File

@ -8,7 +8,7 @@ var _ ClientboundPacket = (*PlayerAbilities)(nil)
//codec:gen
type PlayerAbilities struct {
Flags uint8
Flags int8
FlyingSpeed float32
WalkingSpeed float32
}

View File

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

View File

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

View File

@ -0,0 +1,9 @@
package client
import "github.com/Tnze/go-mc/chat"
//codec:gen
type CombatDeath struct {
PlayerID int32 `mc:"VarInt"`
Message chat.Message
}

View File

@ -0,0 +1,10 @@
package client
import (
"github.com/google/uuid"
)
//codec:gen
type PlayerInfoRemove struct {
UUIDs []uuid.UUID `mc:"UUID"`
}

View File

@ -0,0 +1,224 @@
package client
import (
"github.com/Tnze/go-mc/chat"
"github.com/Tnze/go-mc/chat/sign"
pk "github.com/Tnze/go-mc/net/packet"
"github.com/Tnze/go-mc/yggdrasil/user"
"github.com/google/uuid"
"io"
)
type PlayerInfo interface {
pk.Field
playerInfoBitMask() int
}
type PlayerInfoUpdate struct {
Players map[uuid.UUID][]PlayerInfo
}
func (p PlayerInfoUpdate) WriteTo(w io.Writer) (n int64, err error) {
bitset := pk.NewFixedBitSet(8)
for _, infos := range p.Players {
for _, info := range infos {
bitset.Set(info.playerInfoBitMask(), true)
}
}
n1, err := bitset.WriteTo(w)
if err != nil {
return n1, err
}
n += n1
n2, err := pk.VarInt(len(p.Players)).WriteTo(w)
if err != nil {
return n1 + n2, err
}
n += n2
for playerUUID, infos := range p.Players {
n3, err := (*pk.UUID)(&playerUUID).WriteTo(w)
if err != nil {
return n1 + n2 + n3, err
}
n += n3
for _, info := range infos {
n4, err := info.WriteTo(w)
if err != nil {
return n1 + n2 + n3 + n4, err
}
n += n4
}
}
return
}
func (p *PlayerInfoUpdate) ReadFrom(r io.Reader) (n int64, err error) {
bitset := pk.NewFixedBitSet(8)
n1, err := bitset.ReadFrom(r)
if err != nil {
return n1, err
}
m := make(map[uuid.UUID][]PlayerInfo)
var playerLens pk.VarInt
n2, err := playerLens.ReadFrom(r)
if err != nil {
return n1 + n2, err
}
for i := 0; i < int(playerLens); i++ {
var playerUUID uuid.UUID
n3, err := (*pk.UUID)(&playerUUID).ReadFrom(r)
if err != nil {
return n1 + n2 + n3, err
}
var temp int64
var infos []PlayerInfo
if bitset.Get(0x01) {
n4, err := playerInfoRead(&infos, &PlayerInfoAddPlayer{}, r)
if err != nil {
return n1 + n2 + n3 + n4, err
}
temp += n4
}
if bitset.Get(0x02) {
n4, err := playerInfoRead(&infos, &PlayerInfoInitializeChat{}, r)
if err != nil {
return n1 + n2 + n3 + n4, err
}
temp += n4
}
if bitset.Get(0x04) {
n4, err := playerInfoRead(&infos, &PlayerInfoUpdateGameMode{}, r)
if err != nil {
return n1 + n2 + n3 + n4, err
}
temp += n4
}
if bitset.Get(0x08) {
n4, err := playerInfoRead(&infos, &PlayerInfoUpdateListed{}, r)
if err != nil {
return n1 + n2 + n3 + n4, err
}
temp += n4
}
if bitset.Get(0x10) {
n4, err := playerInfoRead(&infos, &PlayerInfoUpdateLatency{}, r)
if err != nil {
return n1 + n2 + n3 + n4, err
}
temp += n4
}
if bitset.Get(0x20) {
n4, err := playerInfoRead(&infos, &PlayerInfoUpdateDisplayName{}, r)
if err != nil {
return n1 + n2 + n3 + n4, err
}
temp += n4
}
if bitset.Get(0x40) {
n4, err := playerInfoRead(&infos, &PlayerInfoUpdateListPriority{}, r)
if err != nil {
return n1 + n2 + n3 + n4, err
}
temp += n4
}
if bitset.Get(0x80) {
n4, err := playerInfoRead(&infos, &PlayerInfoUpdateHat{}, r)
if err != nil {
return n1 + n2 + n3 + n4, err
}
temp += n4
}
m[playerUUID] = infos
}
return
}
func playerInfoRead(infos *[]PlayerInfo, info PlayerInfo, r io.Reader) (int64, error) {
n, err := info.ReadFrom(r)
if err != nil {
return n, err
}
*infos = append(*infos, info)
return n, err
}
//codec:gen
type PlayerInfoAddPlayer struct {
Name string
Properties []user.Property
}
//codec:gen
type PlayerInfoChatData struct {
ChatSessionID uuid.UUID `mc:"UUID"`
Session sign.Session
}
//codec:gen
type PlayerInfoInitializeChat struct {
Data pk.Option[PlayerInfoChatData, *PlayerInfoChatData]
}
//codec:gen
type PlayerInfoUpdateGameMode struct {
GameMode int32 `mc:"VarInt"`
}
//codec:gen
type PlayerInfoUpdateListed struct {
Listed bool
}
//codec:gen
type PlayerInfoUpdateLatency struct {
Ping int32 `mc:"VarInt"`
}
//codec:gen
type PlayerInfoUpdateDisplayName struct {
DisplayName pk.Option[chat.Message, *chat.Message]
}
//codec:gen
type PlayerInfoUpdateListPriority struct {
Priority int32 `mc:"VarInt"`
}
//codec:gen
type PlayerInfoUpdateHat struct {
Visible bool
}
func (PlayerInfoAddPlayer) playerInfoBitMask() int {
return 0x01
}
func (PlayerInfoInitializeChat) playerInfoBitMask() int {
return 0x02
}
func (PlayerInfoUpdateGameMode) playerInfoBitMask() int {
return 0x04
}
func (PlayerInfoUpdateListed) playerInfoBitMask() int {
return 0x08
}
func (PlayerInfoUpdateLatency) playerInfoBitMask() int {
return 0x10
}
func (PlayerInfoUpdateDisplayName) playerInfoBitMask() int {
return 0x20
}
func (PlayerInfoUpdateListPriority) playerInfoBitMask() int {
return 0x40
}
func (PlayerInfoUpdateHat) playerInfoBitMask() int {
return 0x80
}

View File

@ -0,0 +1,16 @@
package client
//codec:gen
type LookedAtEntity struct {
EntityID int32 `mc:"VarInt"`
LookType int32 `mc:"VarInt"`
}
//codec:gen
type LookAt struct {
LookType int32 `mc:"VarInt"` // Feet = 0 Eyes = 1
TargetX, TargetY, TargetZ float64
HasLookedAtEntity bool
//opt:optional:HasLookedAtEntity
LookedAtEntity *LookedAtEntity
}

View File

@ -6,17 +6,13 @@ import (
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
ID int32 `mc:"VarInt"`
X, Y, Z float64
VelocityX, VelocityY, VelocityZ float64
YRot, XRot float32
Flags int32
}
func (PlayerPosition) ClientboundPacketID() packetid.ClientboundPacketID {

View File

@ -0,0 +1,7 @@
package client
//codec:gen
type PlayerRotation struct {
Yaw float32
Pitch float32
}

View File

@ -0,0 +1,7 @@
package client
//codec:gen
type ProjectilePower struct {
EntityID int32
Power float64
}

View File

@ -0,0 +1,29 @@
package client
import (
"git.konjactw.dev/patyhank/minego/codec/slot/display/recipe"
pk "github.com/Tnze/go-mc/net/packet"
)
//codec:gen
type RecipeIngredients struct {
Data []pk.IDSet
}
//codec:gen
type Recipe struct {
RecipeID int32 `mc:"VarInt"`
Display recipe.Display
GroupID int32 `mc:"VarInt"`
CategoryID int32 `mc:"VarInt"`
HasIngredients bool
//opt:optional:HasIngredients
Ingredients RecipeIngredients
Flags int8
}
//codec:gen
type RecipeBookAdd struct {
Recipes []Recipe
Replace bool
}

View File

@ -0,0 +1,6 @@
package client
//codec:gen
type RecipeBookRemove struct {
Recipes []int32 `mc:"VarInt"`
}

View File

@ -0,0 +1,12 @@
package client
//codec:gen
type RecipeBookSettings struct {
CraftingRecipeBookOpen bool
CraftingRecipeBookFilterEnabled bool
SmeltingRecipeBookOpen bool
SmeltingRecipeBookFilterEnabled bool
BlastingFurnaceRecipeBookOpen bool
SmokingRecipeBookOpen bool
SmokingRecipeBookFilterEnabled bool
}

View File

@ -0,0 +1,6 @@
package client
//codec:gen
type RemoveEntities struct {
EntityIDs []int32 `mc:"VarInt"`
}

View File

@ -0,0 +1,7 @@
package client
//codec:gen
type RemoveMobEffect struct {
EntityID int32
EffectID int32
}

View File

@ -0,0 +1 @@
package client

View File

@ -0,0 +1,12 @@
package client
import (
"github.com/google/uuid"
)
//codec:gen
type RemoveResourcePacket struct {
HasUUID bool
//opt:optional:HasUUID
UUID uuid.UUID `mc:"UUID"`
}

View File

@ -0,0 +1,17 @@
package client
import (
"github.com/Tnze/go-mc/chat"
"github.com/google/uuid"
)
//codec:gen
type AddResourcePack struct {
UUID uuid.UUID `mc:"UUID"`
URL string
Hash string
Forced bool
HasPromptMessage bool
//opt:optional:HasPromptMessage
PromptMessage chat.Message
}

View File

@ -0,0 +1,9 @@
package client
import pk "github.com/Tnze/go-mc/net/packet"
//codec:gen
type SetHeadRotation struct {
EntityID int32 `mc:"VarInt"`
HeadYaw pk.Angle
}

View File

@ -0,0 +1,35 @@
package client
//codec:gen
type UpdateSectionsBlocks struct {
ChunkSectionPosition int64
Blocks []int64 `mc:"VarLong"`
}
func (s *UpdateSectionsBlocks) SetSectionPos(x, y, z int32) {
s.ChunkSectionPosition = ((int64(x) & 0x3FFFFF) << 42) | (int64(y) & 0xFFFFF) | ((int64(z) & 0x3FFFFF) << 20)
}
func (s UpdateSectionsBlocks) ToSectionPos() (x, y, z int32) {
sectionX := int32(s.ChunkSectionPosition >> 42)
sectionY := int32(s.ChunkSectionPosition << 44 >> 44)
sectionZ := int32(s.ChunkSectionPosition >> 22 >> 42)
return sectionX, sectionY, sectionZ
}
func (s *UpdateSectionsBlocks) AddBlock(x, y, z int, stateID int32) {
s.Blocks = append(s.Blocks, int64(stateID)<<12|(int64(x)<<8|int64(y)<<4|int64(z)))
}
func (s UpdateSectionsBlocks) ParseBlocks() map[[3]int32]int32 {
m := make(map[[3]int32]int32)
for _, block := range s.Blocks {
blockStateId := block >> 12
blockLocalX := (block >> 8) & 0xF
blockLocalY := block & 0xF
blockLocalZ := (block >> 4) & 0xF
m[[3]int32{int32(blockLocalX), int32(blockLocalY), int32(blockLocalZ)}] = int32(blockStateId)
}
return m
}

View File

@ -0,0 +1,8 @@
package client
//codec:gen
type SelectAdvancementsTab struct {
HasIdentifier bool
//opt:optional:HasIdentifier
Identifier string `mc:"Identifier"`
}

View File

@ -0,0 +1,13 @@
package client
import (
"github.com/Tnze/go-mc/chat"
)
//codec:gen
type ServerData struct {
MOTD chat.Message
HasIcon bool
//opt:optional:HasIcon
Icon []int8 `mc:"Byte"`
}

View File

@ -0,0 +1,16 @@
package client
import "github.com/Tnze/go-mc/chat"
type ServerLinkData struct {
IsBuiltin bool
//opt:enum:IsBuiltin:true
Type int32 `mc:"VarInt"`
//opt:enum:IsBuiltin:false
Name chat.Message
URL string
}
//codec:gen
type ServerLinks struct {
}

View File

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

View File

@ -0,0 +1,6 @@
package client
//codec:gen
type SetBorderCenter struct {
X, Z float64
}

View File

@ -0,0 +1,6 @@
package client
type SetBorderLerpSize struct {
OldDiameter, NewDiameter float64
Speed int64 `mc:"VarLong"`
}

View File

@ -0,0 +1,6 @@
package client
//codec:gen
type SetBorderSize struct {
Diameter float64
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,8 @@
package client
import "git.konjactw.dev/patyhank/minego/codec/slot"
//codec:gen
type SetCursorItem struct {
CarriedItem slot.Slot
}

View File

@ -0,0 +1,9 @@
package client
import pk "github.com/Tnze/go-mc/net/packet"
//codec:gen
type SetDefaultSpawnPosition struct {
Location pk.Position
Angle float32
}

View File

@ -0,0 +1,7 @@
package client
//codec:gen
type DisplayObjective struct {
Position int32 `mc:"VarInt"`
ScoreName string
}

View File

@ -0,0 +1,11 @@
package client
import (
"git.konjactw.dev/patyhank/minego/codec/metadata"
)
//codec:gen
type SetEntityMetadata struct {
EntityID int32 `mc:"VarInt"`
Metadata metadata.EntityMetadata
}

View File

@ -0,0 +1,7 @@
package client
//codec:gen
type SetEntityLink struct {
AttachedEntityID int32
HoldingEntityID int32 // leader, -1 to detach
}

View File

@ -0,0 +1,6 @@
package client
type SetEntityVelocity struct {
EntityID int32 `mc:"VarInt"`
VelocityX, VelocityY, VelocityZ int16
}

View File

@ -0,0 +1,67 @@
package client
import (
"git.konjactw.dev/patyhank/minego/codec/slot"
pk "github.com/Tnze/go-mc/net/packet"
"io"
)
type EquipmentData struct {
Slot int8
Item slot.Slot
}
type Equipment []EquipmentData
func (e Equipment) WriteTo(w io.Writer) (n int64, err error) {
for i, equipment := range e {
b := equipment.Slot
if len(e)-1 == i {
b |= -128
}
n1, err := pk.Byte(b).WriteTo(w)
n += n1
if err != nil {
return n, err
}
n2, err := equipment.Item.WriteTo(w)
n += n2
if err != nil {
return n, err
}
}
return
}
func (e *Equipment) ReadFrom(r io.Reader) (n int64, err error) {
for {
var b pk.Byte
n1, err := b.ReadFrom(r)
n += n1
if err != nil {
return n, err
}
var equipment EquipmentData
equipment.Slot = int8(b & 127)
n2, err := equipment.Item.ReadFrom(r)
n += n2
if err != nil {
return n, err
}
*e = append(*e, equipment)
if n&-128 == 0 {
break
}
}
return
}
//codec:gen
type SetEquipment struct {
EntityID int32 `mc:"VarInt"`
Equipment
}

View File

@ -0,0 +1,8 @@
package client
//codec:gen
type SetExperience struct {
ExperienceBar float32
Level int32 `mc:"VarInt"`
TotalExperience int32 `mc:"VarInt"`
}

View File

@ -0,0 +1,10 @@
package client
import "git.konjactw.dev/patyhank/minego/codec/metadata"
//codec:gen
type SetHealth struct {
Health float32
Food metadata.VarInt
FoodSaturation float32
}

View File

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

View File

@ -0,0 +1,29 @@
package client
import "github.com/Tnze/go-mc/chat"
//codec:gen
type ObjectivesData struct {
Value chat.Message
HasNumberFormat bool
//opt:optional:HasNumberFormat
NumberFormat *ScoreNumberFormat
}
type ObjectivesCreateData struct {
ObjectivesData
}
type ObjectivesUpdateData struct {
ObjectivesData
}
//codec:gen
type UpdateObjectives struct {
ObjectiveName string
Mode int8
//opt:enum:Mode:0
Create ObjectivesCreateData
//opt:enum:Mode:2
Update ObjectivesUpdateData
}

View File

@ -0,0 +1,7 @@
package client
//codec:gen
type SetPassengers struct {
EntityID int32 `mc:"VarInt"`
Passengers []int32 `mc:"VarInt"`
}

View File

@ -0,0 +1,9 @@
package client
import "git.konjactw.dev/patyhank/minego/codec/slot"
//codec:gen
type SetPlayerInventory struct {
Slot int32 `mc:"VarInt"`
Data slot.Slot
}

View File

@ -0,0 +1,58 @@
package client
import (
"github.com/Tnze/go-mc/chat"
)
//codec:gen
type UpdateTeams struct {
TeamName string
Type int8
//opt:enum:Type:0
CreateTeam UpdateTeamsCreateTeam
//opt:enum:Type:1
RemoveTeam UpdateTeamsRemoveTeam
//opt:enum:Type:2
UpdateTeam UpdateTeamsUpdateTeam
//opt:enum:Type:3
AddEntities UpdateTeamsAddEntities
//opt:enum:Type:4
RemoveEntities UpdateTeamsRemoveEntities
}
//codec:gen
type UpdateTeamsCreateTeam struct {
TeamDisplayName chat.Message
FriendlyFlags int8
NameTagVisibility int32 `mc:"VarInt"`
CollisionRule int32 `mc:"VarInt"`
TeamColor int32 `mc:"VarInt"`
TeamPrefix chat.Message
TeamSuffix chat.Message
Entities []string `mc:"String"`
}
//codec:gen
type UpdateTeamsRemoveTeam struct {
}
//codec:gen
type UpdateTeamsUpdateTeam struct {
DisplayName chat.Message
FriendlyFlags int8
NameTagVisibility int32 `mc:"VarInt"`
CollisionRule int32 `mc:"VarInt"`
TeamColor int32 `mc:"VarInt"`
TeamPrefix chat.Message
TeamSuffix chat.Message
}
//codec:gen
type UpdateTeamsAddEntities struct {
Entities []string `mc:"String"`
}
//codec:gen
type UpdateTeamsRemoveEntities struct {
Entities []string `mc:"String"`
}

View File

@ -0,0 +1,28 @@
package client
import (
"github.com/Tnze/go-mc/chat"
"github.com/Tnze/go-mc/nbt"
)
//codec:gen
type ScoreNumberFormat struct {
NumberFormat int32
//opt:enum:NumberFormat:1
StyledTag nbt.RawMessage `mc:"NBT"`
//opt:enum:NumberFormat:2
Content chat.Message
}
//codec:gen
type UpdateScore struct {
EntityName string
ObjectiveName string
Value int32 `mc:"VarInt"`
HasDisplayName bool
//opt:optional:HasDisplayName
DisplayName chat.Message
HasScoreFormat bool
//opt:optional:HasScoreFormat
NumberFormat ScoreNumberFormat
}

View File

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

View File

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

View File

@ -0,0 +1,8 @@
package client
//codec:gen
type SetTime struct {
WorldAge int64
TimeOfDay int64
TimeOfDayIncreasing bool
}

View File

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

View File

@ -0,0 +1,8 @@
package client
//codec:gen
type SetTitleAnimationTimes struct {
FadeIn int32
Stay int32
FadeOut int32
}

View File

@ -0,0 +1,11 @@
package client
import (
"github.com/Tnze/go-mc/nbt"
)
type ShowDialog struct {
DialogID int32 `mc:"VarInt"`
//opt:id:DialogID
DialogData nbt.RawMessage `mc:"NBT"`
}

View File

@ -0,0 +1,13 @@
package client
import "git.konjactw.dev/patyhank/minego/codec/component"
//codec:gen
type SoundEffect struct {
SoundID int32 `mc:"VarInt"`
//opt:id:SoundID
SoundEvent *component.SoundEvent
EffectPositionX, EffectPositionY, EffectPositionZ int32
Volume, Pitch float32
Seed int64
}

View File

@ -0,0 +1,16 @@
package client
import (
"git.konjactw.dev/patyhank/minego/codec/component"
"github.com/Tnze/go-mc/net/packet"
)
//codec:gen
type EntitySoundEffect struct {
SoundEvent packet.OptID[component.SoundEvent, *component.SoundEvent]
SoundCategory int32 `mc:"VarInt"`
EntityID int32 `mc:"VarInt"`
Volume float32
Pitch float32
Seed int32
}

View File

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

View File

@ -0,0 +1,34 @@
package client
import (
pk "github.com/Tnze/go-mc/net/packet"
"io"
)
type StopSound struct {
Flags int8
Source int32 `mc:"VarInt"`
Sound string `mc:"Identifier"`
}
func (s StopSound) WriteTo(w io.Writer) (n int64, err error) {
pk.Byte(s.Flags).WriteTo(w)
if s.Flags&0x01 != 0 {
pk.VarInt(s.Source).WriteTo(w)
}
if s.Flags&0x02 != 0 {
pk.Identifier(s.Sound).WriteTo(w)
}
return
}
func (s *StopSound) ReadFrom(r io.Reader) (n int64, err error) {
(*pk.Byte)(&s.Flags).ReadFrom(r)
if s.Flags&0x01 != 0 {
(*pk.VarInt)(&s.Source).ReadFrom(r)
}
if s.Flags&0x02 != 0 {
(*pk.Identifier)(&s.Sound).ReadFrom(r)
}
return
}

View File

@ -0,0 +1,7 @@
package client
//codec:gen
type StoreCookie struct {
Key string `mc:"Identifier"`
Payload []int8 `mc:"Byte"`
}

View File

@ -0,0 +1,9 @@
package client
import "github.com/Tnze/go-mc/chat"
//codec:gen
type SystemChatMessage struct {
Content chat.Message
Overlay bool
}

View File

@ -0,0 +1,8 @@
package client
import "github.com/Tnze/go-mc/chat"
type SetTabListHeaderAndFooter struct {
Header chat.Message
Footer chat.Message
}

View File

@ -0,0 +1,9 @@
package client
import "github.com/Tnze/go-mc/nbt"
//codec:gen
type TagQueryResponse struct {
TransactionID int32 `mc:"VarInt"`
NBT nbt.RawMessage `mc:"NBT"`
}

View File

@ -0,0 +1,8 @@
package client
//codec:gen
type PickupItem struct {
CollectedEntityID int32 `mc:"VarInt"`
CollectorEntityID int32 `mc:"VarInt"`
PickupItemCount int32 `mc:"VarInt"`
}

View File

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

View File

@ -0,0 +1,15 @@
package client
import "github.com/Tnze/go-mc/chat"
//codec:gen
type TestInstanceBlockStatus struct {
Status chat.Message
HasSize bool
//opt:optional:HasSize
SizeX float64
//opt:optional:HasSize
SizeY float64
//opt:optional:HasSize
SizeZ float64
}

View File

@ -0,0 +1,7 @@
package client
//codec:gen
type SetTickingState struct {
TickRate float32
IsFrozen bool
}

View File

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

View File

@ -0,0 +1,7 @@
package client
//codec:gen
type Transfer struct {
Host string
Port int32 `mc:"VarInt"`
}

View File

@ -0,0 +1,54 @@
package client
import (
"git.konjactw.dev/patyhank/minego/codec/slot"
"github.com/Tnze/go-mc/chat"
)
//codec:gen
type AdvancementDisplay struct {
Title chat.Message
Description chat.Message
Icon slot.Slot
FrameType int32 `mc:"VarInt"`
Flags int32
HasBackgroundTexture bool
//opt:optional:HasBackgroundTexture
BackgroundTexture string `mc:"Identifier"`
X, Y float32
}
//codec:gen
type AdvancementRequirements struct {
OR []string
}
//codec:gen
type Advancement struct {
ID string `mc:"Identifier"`
HasParentID bool
//opt:optional:HasParentID
ParentID string
HasDisplayData bool
//opt:optional:HasDisplayData
DisplayData AdvancementDisplay
Requirements []AdvancementRequirements
SendTelemetryData bool
}
type AdvancementProgress struct {
ID string `mc:"Identifier"`
CriterionId string `mc:"Identifier"`
HasAchieved bool
//opt:optional:HasAchieved
AchievingDate int64
}
//codec:gen
type UpdateAdvancements struct {
Clear bool
Advancements []Advancement
RemovedIds []string `mc:"Identifier"`
Progress []AdvancementProgress
ShowAdvancementsToast bool
}

View File

@ -0,0 +1,21 @@
package client
//codec:gen
type AttributeModifier struct {
Id string `mc:"Identifier"`
Amount float64
Operation int8
}
//codec:gen
type Attribute struct {
Id int32 `mc:"VarInt"`
Value float64
Modifiers []AttributeModifier
}
//codec:gen
type UpdateAttributes struct {
EntityID int32 `mc:"VarInt"`
Attributes []Attribute
}

View File

@ -0,0 +1,10 @@
package client
//codec:gen
type EntityEffect struct {
EntityID int32 `mc:"VarInt"`
EffectID int32 `mc:"VarInt"`
Amplifier int32 `mc:"VarInt"`
Duration int32 `mc:"VarInt"`
Flags int8
}

View File

@ -0,0 +1,24 @@
package client
import (
"git.konjactw.dev/patyhank/minego/codec/slot/display/slot"
pk "github.com/Tnze/go-mc/net/packet"
)
//codec:gen
type PropertySet struct {
Id string `mc:"Identifier"`
Items []int32 `mc:"VarInt"`
}
//codec:gen
type StonecutterRecipe struct {
Ingredient pk.IDSet
SlotDisplay slot.Display
}
//codec:gen
type UpdateRecipes struct {
PropertySets []PropertySet
StonecutterRecipes []StonecutterRecipe
}

View File

@ -0,0 +1,15 @@
package client
type Tag struct {
Name string `mc:"Identifier"`
Entries []int32 `mc:"VarInt"`
}
type RegistryTag struct {
Registry string `mc:"Identifier"`
Tags []Tag
}
type UpdateTags struct {
Data []RegistryTag
}

View File

@ -0,0 +1,40 @@
package client
import "github.com/google/uuid"
//codec:gen
type WaypointColor struct {
R, G, B uint8
}
//codec:gen
type WaypointVec3i struct {
X, Y, Z int32 `mc:"VarInt"`
}
type WaypointChunkPos struct {
X, Z int32 `mc:"VarInt"`
}
type WaypointAzimuth struct {
Angle float32
}
type Waypoint struct {
Operation int32 `mc:"VarInt"`
IsUUIDIdentifier bool
//opt:enum:IsUUIDIdentifier:true
UUID uuid.UUID `mc:"UUID"`
//opt:enum:IsUUIDIdentifier:false
Name string
HasColor bool
//opt:optional:HasColor
Color WaypointColor
WaypointType int32 `mc:"VarInt"`
//opt:enum:WaypointType:1
WaypointPlayerPos WaypointVec3i
//opt:enum:WaypointType:2
WaypointChunkPos WaypointChunkPos
//opt:enum:WaypointType:3
WaypointAzimuth WaypointAzimuth
}