refactor package
This commit is contained in:
27
pkg/protocol/component/attribute_modifiers.go
Normal file
27
pkg/protocol/component/attribute_modifiers.go
Normal file
@ -0,0 +1,27 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type AttributeModifiers struct {
|
||||
Modifiers []AttributeModifier
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type AttributeModifier struct {
|
||||
AttributeID int32 `mc:"VarInt"`
|
||||
ModifierID string `mc:"Identifier"`
|
||||
Value float64
|
||||
Operation int32 `mc:"VarInt"` // 0=Add, 1=Multiply base, 2=Multiply total
|
||||
Slot int32 `mc:"VarInt"` // 0=Any, 1=Main hand, 2=Off hand, etc.
|
||||
}
|
||||
|
||||
func (*AttributeModifiers) Type() slot.ComponentID {
|
||||
return 13
|
||||
}
|
||||
|
||||
func (*AttributeModifiers) ID() string {
|
||||
return "minecraft:attribute_modifiers"
|
||||
}
|
18
pkg/protocol/component/axolotl_variant.go
Normal file
18
pkg/protocol/component/axolotl_variant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type AxolotlVariant struct {
|
||||
Variant int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*AxolotlVariant) Type() slot.ComponentID {
|
||||
return 91
|
||||
}
|
||||
|
||||
func (*AxolotlVariant) ID() string {
|
||||
return "minecraft:axolotl/variant"
|
||||
}
|
34
pkg/protocol/component/banner_patterns.go
Normal file
34
pkg/protocol/component/banner_patterns.go
Normal file
@ -0,0 +1,34 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type BannerPatterns struct {
|
||||
Layers []BannerLayer
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type BannerLayer struct {
|
||||
Pattern int32 `mc:"VarInt"`
|
||||
//opt:enum:Pattern:0
|
||||
AssetID pk.Identifier
|
||||
//opt:enum:Pattern:0
|
||||
TranslationKey string
|
||||
Color DyeColor
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type DyeColor struct {
|
||||
ColorID int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*BannerPatterns) Type() slot.ComponentID {
|
||||
return 63
|
||||
}
|
||||
|
||||
func (*BannerPatterns) ID() string {
|
||||
return "minecraft:banner_patterns"
|
||||
}
|
18
pkg/protocol/component/base_color.go
Normal file
18
pkg/protocol/component/base_color.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type BaseColor struct {
|
||||
Color DyeColor
|
||||
}
|
||||
|
||||
func (*BaseColor) Type() slot.ComponentID {
|
||||
return 64
|
||||
}
|
||||
|
||||
func (*BaseColor) ID() string {
|
||||
return "minecraft:base_color"
|
||||
}
|
26
pkg/protocol/component/bees.go
Normal file
26
pkg/protocol/component/bees.go
Normal file
@ -0,0 +1,26 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/nbt"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Bees struct {
|
||||
Bees []Bee
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type Bee struct {
|
||||
EntityData nbt.RawMessage `mc:"NBT"`
|
||||
TicksInHive int32 `mc:"VarInt"`
|
||||
MinTicksInHive int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*Bees) Type() slot.ComponentID {
|
||||
return 68
|
||||
}
|
||||
|
||||
func (*Bees) ID() string {
|
||||
return "minecraft:bees"
|
||||
}
|
19
pkg/protocol/component/block_entity_data.go
Normal file
19
pkg/protocol/component/block_entity_data.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/nbt"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type BlockEntityData struct {
|
||||
Data nbt.RawMessage `mc:"NBT"`
|
||||
}
|
||||
|
||||
func (*BlockEntityData) Type() slot.ComponentID {
|
||||
return 51
|
||||
}
|
||||
|
||||
func (*BlockEntityData) ID() string {
|
||||
return "minecraft:block_entity_data"
|
||||
}
|
24
pkg/protocol/component/block_state.go
Normal file
24
pkg/protocol/component/block_state.go
Normal file
@ -0,0 +1,24 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type BlockState struct {
|
||||
Properties []BlockStateProperty
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type BlockStateProperty struct {
|
||||
Name string
|
||||
Value string
|
||||
}
|
||||
|
||||
func (*BlockState) Type() slot.ComponentID {
|
||||
return 67
|
||||
}
|
||||
|
||||
func (*BlockState) ID() string {
|
||||
return "minecraft:block_state"
|
||||
}
|
48
pkg/protocol/component/blocks_attacks.go
Normal file
48
pkg/protocol/component/blocks_attacks.go
Normal file
@ -0,0 +1,48 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type BlocksAttacks struct {
|
||||
BlockDelaySeconds float32
|
||||
DisableCooldownScale float32
|
||||
DamageReductions []DamageReduction
|
||||
ItemDamageThreshold float32
|
||||
ItemDamageBase float32
|
||||
ItemDamageFactor float32
|
||||
BypassedBy pk.Option[pk.Identifier, *pk.Identifier]
|
||||
HasBlockSound bool
|
||||
//opt:optional:HasBlockSound
|
||||
BlockSoundID int32 `mc:"VarInt"`
|
||||
//opt:optional:HasBlockSound
|
||||
//opt:id:BlockSoundID
|
||||
BlockSound SoundEvent
|
||||
|
||||
HasDisableSound bool
|
||||
//opt:optional:HasDisableSound
|
||||
DisableSoundID int32 `mc:"VarInt"`
|
||||
//opt:optional:HasDisableSound
|
||||
//opt:id:DisableSoundID
|
||||
DisableSound SoundEvent
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type DamageReduction struct {
|
||||
HorizontalBlockingAngle float32
|
||||
HasType bool
|
||||
//opt:optional:HasType
|
||||
Type pk.IDSet
|
||||
Base float32
|
||||
Factor float32
|
||||
}
|
||||
|
||||
func (*BlocksAttacks) Type() slot.ComponentID {
|
||||
return 33
|
||||
}
|
||||
|
||||
func (*BlocksAttacks) ID() string {
|
||||
return "minecraft:blocks_attacks"
|
||||
}
|
19
pkg/protocol/component/break_sound.go
Normal file
19
pkg/protocol/component/break_sound.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type BreakSound struct {
|
||||
SoundData packet.OptID[SoundEvent, *SoundEvent]
|
||||
}
|
||||
|
||||
func (*BreakSound) Type() slot.ComponentID {
|
||||
return 71
|
||||
}
|
||||
|
||||
func (*BreakSound) ID() string {
|
||||
return "minecraft:break_sound"
|
||||
}
|
19
pkg/protocol/component/bucket_entity_data.go
Normal file
19
pkg/protocol/component/bucket_entity_data.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/nbt"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type BucketEntityData struct {
|
||||
Data nbt.RawMessage `mc:"NBT"`
|
||||
}
|
||||
|
||||
func (*BucketEntityData) Type() slot.ComponentID {
|
||||
return 50
|
||||
}
|
||||
|
||||
func (*BucketEntityData) ID() string {
|
||||
return "minecraft:bucket_entity_data"
|
||||
}
|
18
pkg/protocol/component/bundle_contents.go
Normal file
18
pkg/protocol/component/bundle_contents.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
slot2 "git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type BundleContents struct {
|
||||
Items []slot2.Slot
|
||||
}
|
||||
|
||||
func (*BundleContents) Type() slot2.ComponentID {
|
||||
return 41
|
||||
}
|
||||
|
||||
func (*BundleContents) ID() string {
|
||||
return "minecraft:bundle_contents"
|
||||
}
|
18
pkg/protocol/component/can_break.go
Normal file
18
pkg/protocol/component/can_break.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type CanBreak struct {
|
||||
BlockPredicates []BlockPredicate
|
||||
}
|
||||
|
||||
func (*CanBreak) Type() slot.ComponentID {
|
||||
return 12
|
||||
}
|
||||
|
||||
func (*CanBreak) ID() string {
|
||||
return "minecraft:can_break"
|
||||
}
|
62
pkg/protocol/component/can_place_on.go
Normal file
62
pkg/protocol/component/can_place_on.go
Normal file
@ -0,0 +1,62 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/nbt"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type CanPlaceOn struct {
|
||||
BlockPredicates []BlockPredicate
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type BlockPredicate struct {
|
||||
Blocks pk.Option[pk.IDSet, *pk.IDSet]
|
||||
Properties pk.Option[Properties, *Properties]
|
||||
NBT pk.Option[pk.NBTField, *pk.NBTField]
|
||||
DataComponents []ExactDataComponentMatcher
|
||||
PartialDataComponentPredicates []PartialDataComponentMatcher
|
||||
}
|
||||
|
||||
type Properties []Property
|
||||
|
||||
func (p Properties) WriteTo(w io.Writer) (n int64, err error) {
|
||||
return pk.Array(p).WriteTo(w)
|
||||
}
|
||||
|
||||
func (p *Properties) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
return pk.Array(p).ReadFrom(r)
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type Property struct {
|
||||
Name string
|
||||
IsExactMatch bool
|
||||
ExactValue pk.Option[pk.String, *pk.String]
|
||||
MinValue pk.Option[pk.String, *pk.String]
|
||||
MaxValue pk.Option[pk.String, *pk.String]
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type ExactDataComponentMatcher struct {
|
||||
Type int32 `mc:"VarInt"`
|
||||
Value nbt.RawMessage `mc:"NBT"`
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type PartialDataComponentMatcher struct {
|
||||
Type int32 `mc:"VarInt"`
|
||||
Predicate nbt.RawMessage `mc:"NBT"`
|
||||
}
|
||||
|
||||
func (*CanPlaceOn) Type() slot.ComponentID {
|
||||
return 11
|
||||
}
|
||||
|
||||
func (*CanPlaceOn) ID() string {
|
||||
return "minecraft:can_place_on"
|
||||
}
|
18
pkg/protocol/component/cat_collar.go
Normal file
18
pkg/protocol/component/cat_collar.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type CatCollar struct {
|
||||
Color DyeColor
|
||||
}
|
||||
|
||||
func (*CatCollar) Type() slot.ComponentID {
|
||||
return 93
|
||||
}
|
||||
|
||||
func (*CatCollar) ID() string {
|
||||
return "minecraft:cat/collar"
|
||||
}
|
18
pkg/protocol/component/cat_variant.go
Normal file
18
pkg/protocol/component/cat_variant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type CatVariant struct {
|
||||
Variant int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*CatVariant) Type() slot.ComponentID {
|
||||
return 92
|
||||
}
|
||||
|
||||
func (*CatVariant) ID() string {
|
||||
return "minecraft:cat/variant"
|
||||
}
|
18
pkg/protocol/component/charged_projectiles.go
Normal file
18
pkg/protocol/component/charged_projectiles.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
slot2 "git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type ChargedProjectiles struct {
|
||||
Projectiles []slot2.Slot
|
||||
}
|
||||
|
||||
func (*ChargedProjectiles) Type() slot2.ComponentID {
|
||||
return 40
|
||||
}
|
||||
|
||||
func (*ChargedProjectiles) ID() string {
|
||||
return "minecraft:charged_projectiles"
|
||||
}
|
58
pkg/protocol/component/chicken_variant.go
Normal file
58
pkg/protocol/component/chicken_variant.go
Normal file
@ -0,0 +1,58 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
type ChickenVariant struct {
|
||||
Mode int8
|
||||
VariantName packet.Identifier
|
||||
VariantID int32
|
||||
}
|
||||
|
||||
func (c *ChickenVariant) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
n1, err := (*packet.Byte)(&c.Mode).ReadFrom(r)
|
||||
if err != nil {
|
||||
return n1, err
|
||||
}
|
||||
if c.Mode == 0 {
|
||||
n2, err := c.VariantName.ReadFrom(r)
|
||||
return n1 + n2, err
|
||||
}
|
||||
|
||||
if c.Mode == 1 {
|
||||
n2, err := (*packet.VarInt)(&c.VariantID).ReadFrom(r)
|
||||
return n1 + n2, err
|
||||
}
|
||||
|
||||
return n1, err
|
||||
}
|
||||
|
||||
func (c ChickenVariant) WriteTo(w io.Writer) (int64, error) {
|
||||
n1, err := (*packet.Byte)(&c.Mode).WriteTo(w)
|
||||
if err != nil {
|
||||
return n1, err
|
||||
}
|
||||
|
||||
if c.Mode == 0 {
|
||||
n2, err := c.VariantName.WriteTo(w)
|
||||
return n1 + n2, err
|
||||
}
|
||||
|
||||
if c.Mode == 1 {
|
||||
n2, err := (*packet.VarInt)(&c.VariantID).WriteTo(w)
|
||||
return n1 + n2, err
|
||||
}
|
||||
return n1, err
|
||||
}
|
||||
|
||||
func (*ChickenVariant) Type() slot.ComponentID {
|
||||
return 86
|
||||
}
|
||||
|
||||
func (*ChickenVariant) ID() string {
|
||||
return "minecraft:chicken/variant"
|
||||
}
|
3891
pkg/protocol/component/codecs.go
Normal file
3891
pkg/protocol/component/codecs.go
Normal file
File diff suppressed because it is too large
Load Diff
296
pkg/protocol/component/components.go
Normal file
296
pkg/protocol/component/components.go
Normal file
@ -0,0 +1,296 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
func init() {
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &CustomData{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &MaxStackSize{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &MaxDamage{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Damage{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Unbreakable{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &CustomName{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &ItemName{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &ItemModel{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Lore{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Rarity{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Enchantments{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &CanPlaceOn{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &CanBreak{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &AttributeModifiers{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &CustomModelData{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &TooltipDisplay{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &RepairCost{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &CreativeSlotLock{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &EnchantmentGlintOverride{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &IntangibleProjectile{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Food{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Consumable{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &UseRemainder{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &UseCooldown{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &DamageResistant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Tool{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Weapon{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Enchantable{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Equippable{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Repairable{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Glider{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &TooltipStyle{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &DeathProtection{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &BlocksAttacks{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &StoredEnchantments{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &DyedColor{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &MapColor{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &MapID{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &MapDecorations{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &MapPostProcessing{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &ChargedProjectiles{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &BundleContents{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &PotionContents{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &PotionDurationScale{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &SuspiciousStewEffects{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &WritableBookContent{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &WrittenBookContent{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Trim{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &DebugStickState{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &EntityData{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &BucketEntityData{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &BlockEntityData{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Instrument{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &ProvidesTrimMaterial{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &OminousBottleAmplifier{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &JukeboxPlayable{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &ProvidesBannerPatterns{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Recipes{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &LodestoneTracker{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &FireworkExplosion{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Fireworks{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Profile{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &NoteBlockSound{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &BannerPatterns{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &BaseColor{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &PotDecorations{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Container{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &BlockState{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Bees{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &Lock{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &ContainerLoot{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &BreakSound{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &VillagerVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &WolfVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &WolfSoundVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &WolfCollar{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &FoxVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &SalmonSize{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &ParrotVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &TropicalFishPattern{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &TropicalFishBaseColor{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &TropicalFishPatternColor{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &MooshroomVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &RabbitVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &PigVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &CowVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &ChickenVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &FrogVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &HorseVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &PaintingVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &LlamaVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &AxolotlVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &CatVariant{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &CatCollar{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &SheepColor{}
|
||||
})
|
||||
slot.RegisterComponent(func() slot.Component {
|
||||
return &ShulkerColor{}
|
||||
})
|
||||
}
|
48
pkg/protocol/component/consumable.go
Normal file
48
pkg/protocol/component/consumable.go
Normal file
@ -0,0 +1,48 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Consumable struct {
|
||||
ConsumeSeconds float32
|
||||
Animation int32 `mc:"VarInt"` // 0=none, 1=eat, 2=drink, etc.
|
||||
SoundID int32 `mc:"VarInt"`
|
||||
//opt:id:SoundID
|
||||
SoundEvent *SoundEvent
|
||||
HasConsumeParticles bool
|
||||
Effects []ConsumeEffect
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type SoundEvent struct {
|
||||
SoundEventID packet.Identifier
|
||||
HasFixedRange bool
|
||||
//opt:optional:HasFixedRange
|
||||
FixedRange float32
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type ConsumeEffect struct {
|
||||
Type int32 `mc:"VarInt"`
|
||||
//opt:enum:Type:0
|
||||
ApplyEffects []PotionEffect
|
||||
//opt:enum:Type:0
|
||||
ApplyProbability float32
|
||||
//opt:enum:Type:1
|
||||
RemoveEffects packet.IDSet
|
||||
//opt:enum:Type:3
|
||||
TeleportRandomlyDiameter float32
|
||||
//opt:enum:Type:4
|
||||
PlaySound SoundEvent
|
||||
}
|
||||
|
||||
func (*Consumable) Type() slot.ComponentID {
|
||||
return 21
|
||||
}
|
||||
|
||||
func (*Consumable) ID() string {
|
||||
return "minecraft:consumable"
|
||||
}
|
18
pkg/protocol/component/container.go
Normal file
18
pkg/protocol/component/container.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
slot2 "git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Container struct {
|
||||
Items []slot2.Slot
|
||||
}
|
||||
|
||||
func (*Container) Type() slot2.ComponentID {
|
||||
return 66
|
||||
}
|
||||
|
||||
func (*Container) ID() string {
|
||||
return "minecraft:container"
|
||||
}
|
19
pkg/protocol/component/container_loot.go
Normal file
19
pkg/protocol/component/container_loot.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/nbt"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type ContainerLoot struct {
|
||||
Data nbt.RawMessage `mc:"NBT"`
|
||||
}
|
||||
|
||||
func (*ContainerLoot) Type() slot.ComponentID {
|
||||
return 70
|
||||
}
|
||||
|
||||
func (*ContainerLoot) ID() string {
|
||||
return "minecraft:container_loot"
|
||||
}
|
18
pkg/protocol/component/cow_variant.go
Normal file
18
pkg/protocol/component/cow_variant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type CowVariant struct {
|
||||
Variant int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*CowVariant) Type() slot.ComponentID {
|
||||
return 85
|
||||
}
|
||||
|
||||
func (*CowVariant) ID() string {
|
||||
return "minecraft:cow/variant"
|
||||
}
|
18
pkg/protocol/component/creative_slot_lock.go
Normal file
18
pkg/protocol/component/creative_slot_lock.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type CreativeSlotLock struct {
|
||||
// no fields
|
||||
}
|
||||
|
||||
func (*CreativeSlotLock) Type() slot.ComponentID {
|
||||
return 17
|
||||
}
|
||||
|
||||
func (*CreativeSlotLock) ID() string {
|
||||
return "minecraft:creative_slot_lock"
|
||||
}
|
19
pkg/protocol/component/custom_data.go
Normal file
19
pkg/protocol/component/custom_data.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/nbt"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type CustomData struct {
|
||||
Data nbt.RawMessage `mc:"NBT"`
|
||||
}
|
||||
|
||||
func (*CustomData) Type() slot.ComponentID {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (*CustomData) ID() string {
|
||||
return "minecraft:custom_data"
|
||||
}
|
21
pkg/protocol/component/custom_model_data.go
Normal file
21
pkg/protocol/component/custom_model_data.go
Normal file
@ -0,0 +1,21 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type CustomModelData struct {
|
||||
Floats []float32
|
||||
Flags []bool
|
||||
Strings []string
|
||||
Colors []int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*CustomModelData) Type() slot.ComponentID {
|
||||
return 14
|
||||
}
|
||||
|
||||
func (*CustomModelData) ID() string {
|
||||
return "minecraft:custom_model_data"
|
||||
}
|
19
pkg/protocol/component/custom_name.go
Normal file
19
pkg/protocol/component/custom_name.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/chat"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type CustomName struct {
|
||||
Name chat.Message
|
||||
}
|
||||
|
||||
func (*CustomName) Type() slot.ComponentID {
|
||||
return 5
|
||||
}
|
||||
|
||||
func (*CustomName) ID() string {
|
||||
return "minecraft:custom_name"
|
||||
}
|
18
pkg/protocol/component/damage.go
Normal file
18
pkg/protocol/component/damage.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Damage struct {
|
||||
Damage int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*Damage) Type() slot.ComponentID {
|
||||
return 3
|
||||
}
|
||||
|
||||
func (*Damage) ID() string {
|
||||
return "minecraft:damage"
|
||||
}
|
19
pkg/protocol/component/damage_resistant.go
Normal file
19
pkg/protocol/component/damage_resistant.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type DamageResistant struct {
|
||||
Types pk.Identifier // Tag specifying damage types
|
||||
}
|
||||
|
||||
func (*DamageResistant) Type() slot.ComponentID {
|
||||
return 24
|
||||
}
|
||||
|
||||
func (*DamageResistant) ID() string {
|
||||
return "minecraft:damage_resistant"
|
||||
}
|
18
pkg/protocol/component/death_protection.go
Normal file
18
pkg/protocol/component/death_protection.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type DeathProtection struct {
|
||||
Effects []ConsumeEffect
|
||||
}
|
||||
|
||||
func (*DeathProtection) Type() slot.ComponentID {
|
||||
return 32
|
||||
}
|
||||
|
||||
func (*DeathProtection) ID() string {
|
||||
return "minecraft:death_protection"
|
||||
}
|
19
pkg/protocol/component/debug_stick_state.go
Normal file
19
pkg/protocol/component/debug_stick_state.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/nbt"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type DebugStickState struct {
|
||||
Data nbt.RawMessage `mc:"NBT"`
|
||||
}
|
||||
|
||||
func (*DebugStickState) Type() slot.ComponentID {
|
||||
return 48
|
||||
}
|
||||
|
||||
func (*DebugStickState) ID() string {
|
||||
return "minecraft:debug_stick_state"
|
||||
}
|
18
pkg/protocol/component/dyed_color.go
Normal file
18
pkg/protocol/component/dyed_color.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type DyedColor struct {
|
||||
Color int32 `mc:"Int"` // RGB components encoded as integer
|
||||
}
|
||||
|
||||
func (*DyedColor) Type() slot.ComponentID {
|
||||
return 35
|
||||
}
|
||||
|
||||
func (*DyedColor) ID() string {
|
||||
return "minecraft:dyed_color"
|
||||
}
|
18
pkg/protocol/component/enchantable.go
Normal file
18
pkg/protocol/component/enchantable.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Enchantable struct {
|
||||
Value int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*Enchantable) Type() slot.ComponentID {
|
||||
return 27
|
||||
}
|
||||
|
||||
func (*Enchantable) ID() string {
|
||||
return "minecraft:enchantable"
|
||||
}
|
18
pkg/protocol/component/enchantment_glint_override.go
Normal file
18
pkg/protocol/component/enchantment_glint_override.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type EnchantmentGlintOverride struct {
|
||||
HasGlint bool
|
||||
}
|
||||
|
||||
func (*EnchantmentGlintOverride) Type() slot.ComponentID {
|
||||
return 18
|
||||
}
|
||||
|
||||
func (*EnchantmentGlintOverride) ID() string {
|
||||
return "minecraft:enchantment_glint_override"
|
||||
}
|
24
pkg/protocol/component/enchantments.go
Normal file
24
pkg/protocol/component/enchantments.go
Normal file
@ -0,0 +1,24 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Enchantments struct {
|
||||
Enchantments []Enchantment
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type Enchantment struct {
|
||||
Type int32 `mc:"VarInt"`
|
||||
Level int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*Enchantments) Type() slot.ComponentID {
|
||||
return 10
|
||||
}
|
||||
|
||||
func (*Enchantments) ID() string {
|
||||
return "minecraft:enchantments"
|
||||
}
|
19
pkg/protocol/component/entity_data.go
Normal file
19
pkg/protocol/component/entity_data.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/nbt"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type EntityData struct {
|
||||
Data nbt.RawMessage `mc:"NBT"`
|
||||
}
|
||||
|
||||
func (*EntityData) Type() slot.ComponentID {
|
||||
return 49
|
||||
}
|
||||
|
||||
func (*EntityData) ID() string {
|
||||
return "minecraft:entity_data"
|
||||
}
|
34
pkg/protocol/component/equippable.go
Normal file
34
pkg/protocol/component/equippable.go
Normal file
@ -0,0 +1,34 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Equippable struct {
|
||||
Slot int32 `mc:"VarInt"` // 0=mainhand, 1=feet, 2=legs, etc.
|
||||
EquipSoundID int32 `mc:"VarInt"`
|
||||
//opt:id:EquipSoundID
|
||||
EquipSoundEvent *SoundEvent
|
||||
HasModel bool
|
||||
//opt:optional:HasModel
|
||||
Model string `mc:"Identifier"`
|
||||
HasCameraOverlay bool
|
||||
//opt:optional:HasCameraOverlay
|
||||
CameraOverlay string `mc:"Identifier"`
|
||||
HasAllowedEntities bool
|
||||
//opt:optional:HasAllowedEntities
|
||||
AllowedEntitiesID pk.IDSet
|
||||
Dispensable bool
|
||||
Swappable bool
|
||||
DamageOnHurt bool
|
||||
}
|
||||
|
||||
func (*Equippable) Type() slot.ComponentID {
|
||||
return 28
|
||||
}
|
||||
|
||||
func (*Equippable) ID() string {
|
||||
return "minecraft:equippable"
|
||||
}
|
27
pkg/protocol/component/firework_explosion.go
Normal file
27
pkg/protocol/component/firework_explosion.go
Normal file
@ -0,0 +1,27 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type FireworkExplosion struct {
|
||||
Explosion FireworkExplosionData
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type FireworkExplosionData struct {
|
||||
Shape int32 `mc:"VarInt"`
|
||||
Colors []int32
|
||||
FadeColors []int32
|
||||
HasTrail bool
|
||||
HasTwinkle bool
|
||||
}
|
||||
|
||||
func (*FireworkExplosion) Type() slot.ComponentID {
|
||||
return 59
|
||||
}
|
||||
|
||||
func (*FireworkExplosion) ID() string {
|
||||
return "minecraft:firework_explosion"
|
||||
}
|
19
pkg/protocol/component/fireworks.go
Normal file
19
pkg/protocol/component/fireworks.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Fireworks struct {
|
||||
FlightDuration int32 `mc:"VarInt"`
|
||||
Explosions []FireworkExplosionData
|
||||
}
|
||||
|
||||
func (*Fireworks) Type() slot.ComponentID {
|
||||
return 60
|
||||
}
|
||||
|
||||
func (*Fireworks) ID() string {
|
||||
return "minecraft:fireworks"
|
||||
}
|
20
pkg/protocol/component/food.go
Normal file
20
pkg/protocol/component/food.go
Normal file
@ -0,0 +1,20 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Food struct {
|
||||
Nutrition int32 `mc:"VarInt"`
|
||||
SaturationModifier float32
|
||||
CanAlwaysEat bool
|
||||
}
|
||||
|
||||
func (*Food) Type() slot.ComponentID {
|
||||
return 20
|
||||
}
|
||||
|
||||
func (*Food) ID() string {
|
||||
return "minecraft:food"
|
||||
}
|
18
pkg/protocol/component/fox_variant.go
Normal file
18
pkg/protocol/component/fox_variant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type FoxVariant struct {
|
||||
Variant int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*FoxVariant) Type() slot.ComponentID {
|
||||
return 76
|
||||
}
|
||||
|
||||
func (*FoxVariant) ID() string {
|
||||
return "minecraft:fox/variant"
|
||||
}
|
18
pkg/protocol/component/frog_variant.go
Normal file
18
pkg/protocol/component/frog_variant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type FrogVariant struct {
|
||||
Variant int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*FrogVariant) Type() slot.ComponentID {
|
||||
return 87
|
||||
}
|
||||
|
||||
func (*FrogVariant) ID() string {
|
||||
return "minecraft:frog/variant"
|
||||
}
|
18
pkg/protocol/component/glider.go
Normal file
18
pkg/protocol/component/glider.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Glider struct {
|
||||
// no fields
|
||||
}
|
||||
|
||||
func (*Glider) Type() slot.ComponentID {
|
||||
return 30
|
||||
}
|
||||
|
||||
func (*Glider) ID() string {
|
||||
return "minecraft:glider"
|
||||
}
|
18
pkg/protocol/component/horse_variant.go
Normal file
18
pkg/protocol/component/horse_variant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type HorseVariant struct {
|
||||
Variant int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*HorseVariant) Type() slot.ComponentID {
|
||||
return 88
|
||||
}
|
||||
|
||||
func (*HorseVariant) ID() string {
|
||||
return "minecraft:horse/variant"
|
||||
}
|
28
pkg/protocol/component/instrument.go
Normal file
28
pkg/protocol/component/instrument.go
Normal file
@ -0,0 +1,28 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/chat"
|
||||
"github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Instrument struct {
|
||||
Instrument packet.OptID[InstrumentData, *InstrumentData]
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type InstrumentData struct {
|
||||
SoundEvent packet.OptID[SoundEvent, *SoundEvent]
|
||||
SoundRange float32
|
||||
Range float32
|
||||
Description chat.Message
|
||||
}
|
||||
|
||||
func (*Instrument) Type() slot.ComponentID {
|
||||
return 52
|
||||
}
|
||||
|
||||
func (*Instrument) ID() string {
|
||||
return "minecraft:instrument"
|
||||
}
|
19
pkg/protocol/component/intangible_projectile.go
Normal file
19
pkg/protocol/component/intangible_projectile.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/nbt"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type IntangibleProjectile struct {
|
||||
Empty nbt.RawMessage `mc:"NBT"` // Always empty compound tag
|
||||
}
|
||||
|
||||
func (*IntangibleProjectile) Type() slot.ComponentID {
|
||||
return 19
|
||||
}
|
||||
|
||||
func (*IntangibleProjectile) ID() string {
|
||||
return "minecraft:intangible_projectile"
|
||||
}
|
19
pkg/protocol/component/item_model.go
Normal file
19
pkg/protocol/component/item_model.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type ItemModel struct {
|
||||
Model packet.Identifier
|
||||
}
|
||||
|
||||
func (*ItemModel) Type() slot.ComponentID {
|
||||
return 7
|
||||
}
|
||||
|
||||
func (*ItemModel) ID() string {
|
||||
return "minecraft:item_model"
|
||||
}
|
19
pkg/protocol/component/item_name.go
Normal file
19
pkg/protocol/component/item_name.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/chat"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type ItemName struct {
|
||||
Name chat.Message
|
||||
}
|
||||
|
||||
func (*ItemName) Type() slot.ComponentID {
|
||||
return 6
|
||||
}
|
||||
|
||||
func (*ItemName) ID() string {
|
||||
return "minecraft:item_name"
|
||||
}
|
67
pkg/protocol/component/jukebox_playable.go
Normal file
67
pkg/protocol/component/jukebox_playable.go
Normal file
@ -0,0 +1,67 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/chat"
|
||||
"github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
type JukeboxPlayable struct {
|
||||
Mode int8
|
||||
Name packet.Identifier
|
||||
SongData packet.OptID[JukeboxSongData, *JukeboxSongData]
|
||||
}
|
||||
|
||||
func (p *JukeboxPlayable) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
n1, err := (*packet.Byte)(&p.Mode).ReadFrom(r)
|
||||
if err != nil {
|
||||
return n1, err
|
||||
}
|
||||
if p.Mode == 0 {
|
||||
n2, err := p.Name.ReadFrom(r)
|
||||
return n1 + n2, err
|
||||
}
|
||||
|
||||
if p.Mode == 1 {
|
||||
n2, err := p.SongData.ReadFrom(r)
|
||||
return n1 + n2, err
|
||||
}
|
||||
|
||||
return n1, err
|
||||
}
|
||||
|
||||
func (p JukeboxPlayable) WriteTo(w io.Writer) (int64, error) {
|
||||
n1, err := (*packet.Byte)(&p.Mode).WriteTo(w)
|
||||
if err != nil {
|
||||
return n1, err
|
||||
}
|
||||
|
||||
if p.Mode == 0 {
|
||||
n2, err := p.Name.WriteTo(w)
|
||||
return n1 + n2, err
|
||||
}
|
||||
|
||||
if p.Mode == 1 {
|
||||
n2, err := p.SongData.WriteTo(w)
|
||||
return n1 + n2, err
|
||||
}
|
||||
return n1, err
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type JukeboxSongData struct {
|
||||
SoundEvent packet.OptID[SoundEvent, *SoundEvent]
|
||||
Description chat.Message
|
||||
Duration float32
|
||||
Output int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*JukeboxPlayable) Type() slot.ComponentID {
|
||||
return 55
|
||||
}
|
||||
|
||||
func (*JukeboxPlayable) ID() string {
|
||||
return "minecraft:jukebox_playable"
|
||||
}
|
18
pkg/protocol/component/llama_variant.go
Normal file
18
pkg/protocol/component/llama_variant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type LlamaVariant struct {
|
||||
Variant int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*LlamaVariant) Type() slot.ComponentID {
|
||||
return 90
|
||||
}
|
||||
|
||||
func (*LlamaVariant) ID() string {
|
||||
return "minecraft:llama/variant"
|
||||
}
|
19
pkg/protocol/component/lock.go
Normal file
19
pkg/protocol/component/lock.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/nbt"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Lock struct {
|
||||
Key nbt.RawMessage `mc:"NBT"`
|
||||
}
|
||||
|
||||
func (*Lock) Type() slot.ComponentID {
|
||||
return 69
|
||||
}
|
||||
|
||||
func (*Lock) ID() string {
|
||||
return "minecraft:lock"
|
||||
}
|
23
pkg/protocol/component/lodestone_tracker.go
Normal file
23
pkg/protocol/component/lodestone_tracker.go
Normal file
@ -0,0 +1,23 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/net/packet"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type LodestoneTracker struct {
|
||||
HasGlobalPosition bool
|
||||
Dimension pk.Option[packet.Identifier, *packet.Identifier]
|
||||
Position pk.Option[pk.Position, *pk.Position]
|
||||
Tracked bool
|
||||
}
|
||||
|
||||
func (*LodestoneTracker) Type() slot.ComponentID {
|
||||
return 58
|
||||
}
|
||||
|
||||
func (*LodestoneTracker) ID() string {
|
||||
return "minecraft:lodestone_tracker"
|
||||
}
|
19
pkg/protocol/component/lore.go
Normal file
19
pkg/protocol/component/lore.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/chat"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Lore struct {
|
||||
Lines []chat.Message
|
||||
}
|
||||
|
||||
func (*Lore) Type() slot.ComponentID {
|
||||
return 8
|
||||
}
|
||||
|
||||
func (*Lore) ID() string {
|
||||
return "minecraft:lore"
|
||||
}
|
18
pkg/protocol/component/map_color.go
Normal file
18
pkg/protocol/component/map_color.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type MapColor struct {
|
||||
Color int32 `mc:"Int"` // RGB components encoded as integer
|
||||
}
|
||||
|
||||
func (*MapColor) Type() slot.ComponentID {
|
||||
return 36
|
||||
}
|
||||
|
||||
func (*MapColor) ID() string {
|
||||
return "minecraft:map_color"
|
||||
}
|
19
pkg/protocol/component/map_decorations.go
Normal file
19
pkg/protocol/component/map_decorations.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/nbt"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type MapDecorations struct {
|
||||
Data nbt.RawMessage `mc:"NBT"` // Always a Compound Tag
|
||||
}
|
||||
|
||||
func (*MapDecorations) Type() slot.ComponentID {
|
||||
return 38
|
||||
}
|
||||
|
||||
func (*MapDecorations) ID() string {
|
||||
return "minecraft:map_decorations"
|
||||
}
|
18
pkg/protocol/component/map_id.go
Normal file
18
pkg/protocol/component/map_id.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type MapID struct {
|
||||
MapID int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*MapID) Type() slot.ComponentID {
|
||||
return 37
|
||||
}
|
||||
|
||||
func (*MapID) ID() string {
|
||||
return "minecraft:map_id"
|
||||
}
|
18
pkg/protocol/component/map_post_processing.go
Normal file
18
pkg/protocol/component/map_post_processing.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type MapPostProcessing struct {
|
||||
PostProcessingType int32 `mc:"VarInt"` // 0=Lock, 1=Scale
|
||||
}
|
||||
|
||||
func (*MapPostProcessing) Type() slot.ComponentID {
|
||||
return 39
|
||||
}
|
||||
|
||||
func (*MapPostProcessing) ID() string {
|
||||
return "minecraft:map_post_processing"
|
||||
}
|
18
pkg/protocol/component/max_damage.go
Normal file
18
pkg/protocol/component/max_damage.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type MaxDamage struct {
|
||||
Damage int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*MaxDamage) Type() slot.ComponentID {
|
||||
return 2
|
||||
}
|
||||
|
||||
func (*MaxDamage) ID() string {
|
||||
return "minecraft:max_damage"
|
||||
}
|
18
pkg/protocol/component/max_stack_size.go
Normal file
18
pkg/protocol/component/max_stack_size.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type MaxStackSize struct {
|
||||
Size int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*MaxStackSize) Type() slot.ComponentID {
|
||||
return 1
|
||||
}
|
||||
|
||||
func (*MaxStackSize) ID() string {
|
||||
return "minecraft:max_stack_size"
|
||||
}
|
18
pkg/protocol/component/mooshroom_variant.go
Normal file
18
pkg/protocol/component/mooshroom_variant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type MooshroomVariant struct {
|
||||
Variant int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*MooshroomVariant) Type() slot.ComponentID {
|
||||
return 82
|
||||
}
|
||||
|
||||
func (*MooshroomVariant) ID() string {
|
||||
return "minecraft:mooshroom/variant"
|
||||
}
|
19
pkg/protocol/component/note_block_sound.go
Normal file
19
pkg/protocol/component/note_block_sound.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type NoteBlockSound struct {
|
||||
Sound packet.Identifier
|
||||
}
|
||||
|
||||
func (*NoteBlockSound) Type() slot.ComponentID {
|
||||
return 62
|
||||
}
|
||||
|
||||
func (*NoteBlockSound) ID() string {
|
||||
return "minecraft:note_block_sound"
|
||||
}
|
18
pkg/protocol/component/ominous_bottle_amplifier.go
Normal file
18
pkg/protocol/component/ominous_bottle_amplifier.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type OminousBottleAmplifier struct {
|
||||
Amplifier int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*OminousBottleAmplifier) Type() slot.ComponentID {
|
||||
return 54
|
||||
}
|
||||
|
||||
func (*OminousBottleAmplifier) ID() string {
|
||||
return "minecraft:ominous_bottle_amplifier"
|
||||
}
|
24
pkg/protocol/component/painting_variant.go
Normal file
24
pkg/protocol/component/painting_variant.go
Normal file
@ -0,0 +1,24 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/chat"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type PaintingVariant struct {
|
||||
Width int32
|
||||
Height int32
|
||||
AssetID pk.Identifier
|
||||
Title pk.Option[chat.Message, *chat.Message]
|
||||
Author pk.Option[chat.Message, *chat.Message]
|
||||
}
|
||||
|
||||
func (*PaintingVariant) Type() slot.ComponentID {
|
||||
return 89
|
||||
}
|
||||
|
||||
func (*PaintingVariant) ID() string {
|
||||
return "minecraft:painting/variant"
|
||||
}
|
18
pkg/protocol/component/parrot_variant.go
Normal file
18
pkg/protocol/component/parrot_variant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type ParrotVariant struct {
|
||||
Variant int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*ParrotVariant) Type() slot.ComponentID {
|
||||
return 78
|
||||
}
|
||||
|
||||
func (*ParrotVariant) ID() string {
|
||||
return "minecraft:parrot/variant"
|
||||
}
|
18
pkg/protocol/component/pig_variant.go
Normal file
18
pkg/protocol/component/pig_variant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type PigVariant struct {
|
||||
Variant int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*PigVariant) Type() slot.ComponentID {
|
||||
return 84
|
||||
}
|
||||
|
||||
func (*PigVariant) ID() string {
|
||||
return "minecraft:pig/variant"
|
||||
}
|
18
pkg/protocol/component/pot_decorations.go
Normal file
18
pkg/protocol/component/pot_decorations.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type PotDecorations struct {
|
||||
Decorations []int32 `mc:"PrefixedArray"`
|
||||
}
|
||||
|
||||
func (*PotDecorations) Type() slot.ComponentID {
|
||||
return 65
|
||||
}
|
||||
|
||||
func (*PotDecorations) ID() string {
|
||||
return "minecraft:pot_decorations"
|
||||
}
|
42
pkg/protocol/component/potion_contents.go
Normal file
42
pkg/protocol/component/potion_contents.go
Normal file
@ -0,0 +1,42 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type PotionContents struct {
|
||||
HasPotionID bool
|
||||
PotionID int32 `mc:"VarInt"`
|
||||
HasCustomColor bool
|
||||
CustomColor int32 `mc:"Int"`
|
||||
CustomEffects []PotionEffect
|
||||
CustomName string
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type PotionEffect struct {
|
||||
TypeID int32 `mc:"VarInt"`
|
||||
|
||||
Details PotionEffectDetails
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type PotionEffectDetails struct {
|
||||
Amplifier int32 `mc:"VarInt"`
|
||||
Duration int32 `mc:"VarInt"`
|
||||
Ambient bool
|
||||
ShowParticles bool
|
||||
ShowIcon bool
|
||||
HasHiddenEffect bool
|
||||
//opt:optional:HasHiddenEffect
|
||||
HiddenEffect *PotionEffect
|
||||
}
|
||||
|
||||
func (*PotionContents) Type() slot.ComponentID {
|
||||
return 42
|
||||
}
|
||||
|
||||
func (*PotionContents) ID() string {
|
||||
return "minecraft:potion_contents"
|
||||
}
|
18
pkg/protocol/component/potion_duration_scale.go
Normal file
18
pkg/protocol/component/potion_duration_scale.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type PotionDurationScale struct {
|
||||
EffectMultiplier float32
|
||||
}
|
||||
|
||||
func (*PotionDurationScale) Type() slot.ComponentID {
|
||||
return 43
|
||||
}
|
||||
|
||||
func (*PotionDurationScale) ID() string {
|
||||
return "minecraft:potion_duration_scale"
|
||||
}
|
31
pkg/protocol/component/profile.go
Normal file
31
pkg/protocol/component/profile.go
Normal file
@ -0,0 +1,31 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Profile struct {
|
||||
HasName bool
|
||||
Name pk.Option[pk.String, *pk.String]
|
||||
HasUniqueID bool
|
||||
UniqueID pk.Option[pk.UUID, *pk.UUID]
|
||||
Properties []ProfileProperty
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type ProfileProperty struct {
|
||||
Name string `mc:"String"`
|
||||
Value string `mc:"String"`
|
||||
HasSignature bool
|
||||
Signature pk.Option[pk.String, *pk.String]
|
||||
}
|
||||
|
||||
func (*Profile) Type() slot.ComponentID {
|
||||
return 61
|
||||
}
|
||||
|
||||
func (*Profile) ID() string {
|
||||
return "minecraft:profile"
|
||||
}
|
19
pkg/protocol/component/provides_banner_patterns.go
Normal file
19
pkg/protocol/component/provides_banner_patterns.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type ProvidesBannerPatterns struct {
|
||||
Key packet.Identifier
|
||||
}
|
||||
|
||||
func (*ProvidesBannerPatterns) Type() slot.ComponentID {
|
||||
return 56
|
||||
}
|
||||
|
||||
func (*ProvidesBannerPatterns) ID() string {
|
||||
return "minecraft:provides_banner_patterns"
|
||||
}
|
58
pkg/protocol/component/provides_trim_material.go
Normal file
58
pkg/protocol/component/provides_trim_material.go
Normal file
@ -0,0 +1,58 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
type ProvidesTrimMaterial struct {
|
||||
Mode int8
|
||||
Name packet.Identifier
|
||||
Material packet.OptID[TrimMaterial, *TrimMaterial]
|
||||
}
|
||||
|
||||
func (p *ProvidesTrimMaterial) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
n1, err := (*packet.Byte)(&p.Mode).ReadFrom(r)
|
||||
if err != nil {
|
||||
return n1, err
|
||||
}
|
||||
if p.Mode == 0 {
|
||||
n2, err := p.Name.ReadFrom(r)
|
||||
return n1 + n2, err
|
||||
}
|
||||
|
||||
if p.Mode == 1 {
|
||||
n2, err := p.Material.ReadFrom(r)
|
||||
return n1 + n2, err
|
||||
}
|
||||
|
||||
return n1, err
|
||||
}
|
||||
|
||||
func (p ProvidesTrimMaterial) WriteTo(w io.Writer) (int64, error) {
|
||||
n1, err := (*packet.Byte)(&p.Mode).WriteTo(w)
|
||||
if err != nil {
|
||||
return n1, err
|
||||
}
|
||||
|
||||
if p.Mode == 0 {
|
||||
n2, err := p.Name.WriteTo(w)
|
||||
return n1 + n2, err
|
||||
}
|
||||
|
||||
if p.Mode == 1 {
|
||||
n2, err := p.Material.WriteTo(w)
|
||||
return n1 + n2, err
|
||||
}
|
||||
return n1, err
|
||||
}
|
||||
|
||||
func (*ProvidesTrimMaterial) Type() slot.ComponentID {
|
||||
return 53
|
||||
}
|
||||
|
||||
func (*ProvidesTrimMaterial) ID() string {
|
||||
return "minecraft:provides_trim_material"
|
||||
}
|
18
pkg/protocol/component/rabbit_variant.go
Normal file
18
pkg/protocol/component/rabbit_variant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type RabbitVariant struct {
|
||||
Variant int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*RabbitVariant) Type() slot.ComponentID {
|
||||
return 83
|
||||
}
|
||||
|
||||
func (*RabbitVariant) ID() string {
|
||||
return "minecraft:rabbit/variant"
|
||||
}
|
18
pkg/protocol/component/rarity.go
Normal file
18
pkg/protocol/component/rarity.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Rarity struct {
|
||||
Rarity int32 `mc:"VarInt"` // 0=Common, 1=Uncommon, 2=Rare, 3=Epic
|
||||
}
|
||||
|
||||
func (*Rarity) Type() slot.ComponentID {
|
||||
return 9
|
||||
}
|
||||
|
||||
func (*Rarity) ID() string {
|
||||
return "minecraft:rarity"
|
||||
}
|
19
pkg/protocol/component/recipes.go
Normal file
19
pkg/protocol/component/recipes.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/nbt"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Recipes struct {
|
||||
Data nbt.RawMessage `mc:"NBT"`
|
||||
}
|
||||
|
||||
func (*Recipes) Type() slot.ComponentID {
|
||||
return 57
|
||||
}
|
||||
|
||||
func (*Recipes) ID() string {
|
||||
return "minecraft:recipes"
|
||||
}
|
18
pkg/protocol/component/repair_cost.go
Normal file
18
pkg/protocol/component/repair_cost.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type RepairCost struct {
|
||||
Cost int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*RepairCost) Type() slot.ComponentID {
|
||||
return 16
|
||||
}
|
||||
|
||||
func (*RepairCost) ID() string {
|
||||
return "minecraft:repair_cost"
|
||||
}
|
19
pkg/protocol/component/repairable.go
Normal file
19
pkg/protocol/component/repairable.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Repairable struct {
|
||||
Items pk.IDSet
|
||||
}
|
||||
|
||||
func (*Repairable) Type() slot.ComponentID {
|
||||
return 29
|
||||
}
|
||||
|
||||
func (*Repairable) ID() string {
|
||||
return "minecraft:repairable"
|
||||
}
|
18
pkg/protocol/component/salmon_size.go
Normal file
18
pkg/protocol/component/salmon_size.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type SalmonSize struct {
|
||||
SizeType int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*SalmonSize) Type() slot.ComponentID {
|
||||
return 77
|
||||
}
|
||||
|
||||
func (*SalmonSize) ID() string {
|
||||
return "minecraft:salmon/size"
|
||||
}
|
18
pkg/protocol/component/sheep_color.go
Normal file
18
pkg/protocol/component/sheep_color.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type SheepColor struct {
|
||||
Color DyeColor
|
||||
}
|
||||
|
||||
func (*SheepColor) Type() slot.ComponentID {
|
||||
return 94
|
||||
}
|
||||
|
||||
func (*SheepColor) ID() string {
|
||||
return "minecraft:sheep/color"
|
||||
}
|
18
pkg/protocol/component/shulker_color.go
Normal file
18
pkg/protocol/component/shulker_color.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type ShulkerColor struct {
|
||||
Color DyeColor
|
||||
}
|
||||
|
||||
func (*ShulkerColor) Type() slot.ComponentID {
|
||||
return 95
|
||||
}
|
||||
|
||||
func (*ShulkerColor) ID() string {
|
||||
return "minecraft:shulker/color"
|
||||
}
|
18
pkg/protocol/component/stored_enchantments.go
Normal file
18
pkg/protocol/component/stored_enchantments.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type StoredEnchantments struct {
|
||||
Enchantments []Enchantment
|
||||
}
|
||||
|
||||
func (*StoredEnchantments) Type() slot.ComponentID {
|
||||
return 34
|
||||
}
|
||||
|
||||
func (*StoredEnchantments) ID() string {
|
||||
return "minecraft:stored_enchantments"
|
||||
}
|
24
pkg/protocol/component/suspicious_stew_effects.go
Normal file
24
pkg/protocol/component/suspicious_stew_effects.go
Normal file
@ -0,0 +1,24 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type SuspiciousStewEffects struct {
|
||||
Effects []SuspiciousStewEffect
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type SuspiciousStewEffect struct {
|
||||
TypeID int32 `mc:"VarInt"`
|
||||
Duration int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*SuspiciousStewEffects) Type() slot.ComponentID {
|
||||
return 44
|
||||
}
|
||||
|
||||
func (*SuspiciousStewEffects) ID() string {
|
||||
return "minecraft:suspicious_stew_effects"
|
||||
}
|
30
pkg/protocol/component/tool.go
Normal file
30
pkg/protocol/component/tool.go
Normal file
@ -0,0 +1,30 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Tool struct {
|
||||
Rules []ToolRule
|
||||
DefaultMiningSpeed float32
|
||||
DamagePerBlock int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type ToolRule struct {
|
||||
Blocks pk.IDSet
|
||||
HasSpeed bool
|
||||
Speed pk.Option[pk.Float, *pk.Float]
|
||||
HasCorrectDropForBlocks bool
|
||||
CorrectDropForBlocks pk.Option[pk.Boolean, *pk.Boolean]
|
||||
}
|
||||
|
||||
func (*Tool) Type() slot.ComponentID {
|
||||
return 25
|
||||
}
|
||||
|
||||
func (*Tool) ID() string {
|
||||
return "minecraft:tool"
|
||||
}
|
19
pkg/protocol/component/tooltip_display.go
Normal file
19
pkg/protocol/component/tooltip_display.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type TooltipDisplay struct {
|
||||
HideTooltip bool
|
||||
HiddenComponents []int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*TooltipDisplay) Type() slot.ComponentID {
|
||||
return 15
|
||||
}
|
||||
|
||||
func (*TooltipDisplay) ID() string {
|
||||
return "minecraft:tooltip_display"
|
||||
}
|
19
pkg/protocol/component/tooltip_style.go
Normal file
19
pkg/protocol/component/tooltip_style.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type TooltipStyle struct {
|
||||
Style pk.Identifier
|
||||
}
|
||||
|
||||
func (*TooltipStyle) Type() slot.ComponentID {
|
||||
return 31
|
||||
}
|
||||
|
||||
func (*TooltipStyle) ID() string {
|
||||
return "minecraft:tooltip_style"
|
||||
}
|
42
pkg/protocol/component/trim.go
Normal file
42
pkg/protocol/component/trim.go
Normal file
@ -0,0 +1,42 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/chat"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Trim struct {
|
||||
TrimMaterial TrimMaterial
|
||||
TrimPattern TrimPattern
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type TrimMaterial struct {
|
||||
Suffix string
|
||||
Overrides []TrimOverride
|
||||
Description chat.Message
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type TrimOverride struct {
|
||||
MaterialType pk.Identifier
|
||||
OverrideAssetName string
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type TrimPattern struct {
|
||||
AssetName string
|
||||
TemplateItem int32 `mc:"VarInt"`
|
||||
Description chat.Message
|
||||
Decal bool
|
||||
}
|
||||
|
||||
func (*Trim) Type() slot.ComponentID {
|
||||
return 47
|
||||
}
|
||||
|
||||
func (*Trim) ID() string {
|
||||
return "minecraft:trim"
|
||||
}
|
18
pkg/protocol/component/tropical_fish_base_color.go
Normal file
18
pkg/protocol/component/tropical_fish_base_color.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type TropicalFishBaseColor struct {
|
||||
Color DyeColor
|
||||
}
|
||||
|
||||
func (*TropicalFishBaseColor) Type() slot.ComponentID {
|
||||
return 80
|
||||
}
|
||||
|
||||
func (*TropicalFishBaseColor) ID() string {
|
||||
return "minecraft:tropical_fish/base_color"
|
||||
}
|
18
pkg/protocol/component/tropical_fish_pattern.go
Normal file
18
pkg/protocol/component/tropical_fish_pattern.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type TropicalFishPattern struct {
|
||||
Pattern int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*TropicalFishPattern) Type() slot.ComponentID {
|
||||
return 79
|
||||
}
|
||||
|
||||
func (*TropicalFishPattern) ID() string {
|
||||
return "minecraft:tropical_fish/pattern"
|
||||
}
|
18
pkg/protocol/component/tropical_fish_pattern_color.go
Normal file
18
pkg/protocol/component/tropical_fish_pattern_color.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type TropicalFishPatternColor struct {
|
||||
Color DyeColor
|
||||
}
|
||||
|
||||
func (*TropicalFishPatternColor) Type() slot.ComponentID {
|
||||
return 81
|
||||
}
|
||||
|
||||
func (*TropicalFishPatternColor) ID() string {
|
||||
return "minecraft:tropical_fish/pattern_color"
|
||||
}
|
18
pkg/protocol/component/unbreakable.go
Normal file
18
pkg/protocol/component/unbreakable.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Unbreakable struct {
|
||||
// no fields
|
||||
}
|
||||
|
||||
func (*Unbreakable) Type() slot.ComponentID {
|
||||
return 4
|
||||
}
|
||||
|
||||
func (*Unbreakable) ID() string {
|
||||
return "minecraft:unbreakable"
|
||||
}
|
20
pkg/protocol/component/use_cooldown.go
Normal file
20
pkg/protocol/component/use_cooldown.go
Normal file
@ -0,0 +1,20 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type UseCooldown struct {
|
||||
Seconds float32
|
||||
CooldownGroup pk.Option[pk.Identifier, *pk.Identifier]
|
||||
}
|
||||
|
||||
func (*UseCooldown) Type() slot.ComponentID {
|
||||
return 23
|
||||
}
|
||||
|
||||
func (*UseCooldown) ID() string {
|
||||
return "minecraft:use_cooldown"
|
||||
}
|
18
pkg/protocol/component/use_remainder.go
Normal file
18
pkg/protocol/component/use_remainder.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
slot2 "git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type UseRemainder struct {
|
||||
Remainder slot2.Slot
|
||||
}
|
||||
|
||||
func (*UseRemainder) Type() slot2.ComponentID {
|
||||
return 22
|
||||
}
|
||||
|
||||
func (*UseRemainder) ID() string {
|
||||
return "minecraft:use_remainder"
|
||||
}
|
18
pkg/protocol/component/villager_variant.go
Normal file
18
pkg/protocol/component/villager_variant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type VillagerVariant struct {
|
||||
Variant int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*VillagerVariant) Type() slot.ComponentID {
|
||||
return 72
|
||||
}
|
||||
|
||||
func (*VillagerVariant) ID() string {
|
||||
return "minecraft:villager/variant"
|
||||
}
|
19
pkg/protocol/component/weapon.go
Normal file
19
pkg/protocol/component/weapon.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type Weapon struct {
|
||||
DamagePerAttack int32 `mc:"VarInt"`
|
||||
DisableBlockingFor float32 // In seconds
|
||||
}
|
||||
|
||||
func (*Weapon) Type() slot.ComponentID {
|
||||
return 26
|
||||
}
|
||||
|
||||
func (*Weapon) ID() string {
|
||||
return "minecraft:weapon"
|
||||
}
|
18
pkg/protocol/component/wolf_collar.go
Normal file
18
pkg/protocol/component/wolf_collar.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type WolfCollar struct {
|
||||
Color DyeColor
|
||||
}
|
||||
|
||||
func (*WolfCollar) Type() slot.ComponentID {
|
||||
return 75
|
||||
}
|
||||
|
||||
func (*WolfCollar) ID() string {
|
||||
return "minecraft:wolf/collar"
|
||||
}
|
18
pkg/protocol/component/wolf_sound_variant.go
Normal file
18
pkg/protocol/component/wolf_sound_variant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type WolfSoundVariant struct {
|
||||
Variant int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*WolfSoundVariant) Type() slot.ComponentID {
|
||||
return 74
|
||||
}
|
||||
|
||||
func (*WolfSoundVariant) ID() string {
|
||||
return "minecraft:wolf/sound_variant"
|
||||
}
|
18
pkg/protocol/component/wolf_variant.go
Normal file
18
pkg/protocol/component/wolf_variant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type WolfVariant struct {
|
||||
Variant int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*WolfVariant) Type() slot.ComponentID {
|
||||
return 73
|
||||
}
|
||||
|
||||
func (*WolfVariant) ID() string {
|
||||
return "minecraft:wolf/variant"
|
||||
}
|
26
pkg/protocol/component/writable_book_content.go
Normal file
26
pkg/protocol/component/writable_book_content.go
Normal file
@ -0,0 +1,26 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type WritableBookContent struct {
|
||||
Pages []WritableBookPage
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type WritableBookPage struct {
|
||||
RawContent string `mc:"String"`
|
||||
HasFilteredContent bool
|
||||
FilteredContent pk.Option[pk.String, *pk.String]
|
||||
}
|
||||
|
||||
func (*WritableBookContent) Type() slot.ComponentID {
|
||||
return 45
|
||||
}
|
||||
|
||||
func (*WritableBookContent) ID() string {
|
||||
return "minecraft:writable_book_content"
|
||||
}
|
32
pkg/protocol/component/written_book_content.go
Normal file
32
pkg/protocol/component/written_book_content.go
Normal file
@ -0,0 +1,32 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/pkg/protocol/slot"
|
||||
"github.com/Tnze/go-mc/chat"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type WrittenBookContent struct {
|
||||
RawTitle string `mc:"String"`
|
||||
HasFilteredTitle bool
|
||||
FilteredTitle pk.Option[pk.String, *pk.String]
|
||||
Author string `mc:"String"`
|
||||
Generation int32 `mc:"VarInt"`
|
||||
Pages []WrittenBookPage
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type WrittenBookPage struct {
|
||||
RawContent chat.Message
|
||||
HasFilteredContent bool
|
||||
FilteredContent pk.Option[chat.Message, *chat.Message]
|
||||
}
|
||||
|
||||
func (*WrittenBookContent) Type() slot.ComponentID {
|
||||
return 46
|
||||
}
|
||||
|
||||
func (*WrittenBookContent) ID() string {
|
||||
return "minecraft:written_book_content"
|
||||
}
|
262
pkg/protocol/metadata/codecs.go
Normal file
262
pkg/protocol/metadata/codecs.go
Normal file
@ -0,0 +1,262 @@
|
||||
// Code generated by github.com/go-mc/packetizer; DO NOT EDIT.
|
||||
|
||||
package metadata
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
func (c *Rotation) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = (*packet.Float)(&c.X).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.Float)(&c.Y).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.Float)(&c.Z).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (c Rotation) WriteTo(w io.Writer) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = (*packet.Float)(&c.X).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.Float)(&c.Y).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.Float)(&c.Z).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
func (c *NBT) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = packet.NBT(&c.Data).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (c NBT) WriteTo(w io.Writer) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = packet.NBT(&c.Data).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
func (c *Particles) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = packet.Array(&c.Particles).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (c Particles) WriteTo(w io.Writer) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = packet.Array(&c.Particles).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
func (c *VillagerData) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = (*packet.VarInt)(&c.Type).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.VarInt)(&c.Profession).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.VarInt)(&c.Level).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (c VillagerData) WriteTo(w io.Writer) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = (*packet.VarInt)(&c.Type).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.VarInt)(&c.Profession).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.VarInt)(&c.Level).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
func (c *GlobalPosition) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = (&c.Dimension).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (&c.Position).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (c GlobalPosition) WriteTo(w io.Writer) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = (&c.Dimension).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (&c.Position).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
func (c *OptGlobalPosition) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = (&c.GlobalPosition).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (c OptGlobalPosition) WriteTo(w io.Writer) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = (&c.GlobalPosition).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
func (c *Vector3) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = (*packet.Float)(&c.X).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.Float)(&c.Y).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.Float)(&c.Z).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (c Vector3) WriteTo(w io.Writer) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = (*packet.Float)(&c.X).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.Float)(&c.Y).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.Float)(&c.Z).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
func (c *Quaternion) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = (*packet.Float)(&c.X).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.Float)(&c.Y).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.Float)(&c.Z).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.Float)(&c.W).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (c Quaternion) WriteTo(w io.Writer) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = (*packet.Float)(&c.X).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.Float)(&c.Y).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.Float)(&c.Z).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.Float)(&c.W).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
157
pkg/protocol/metadata/metadata.go
Normal file
157
pkg/protocol/metadata/metadata.go
Normal file
@ -0,0 +1,157 @@
|
||||
package metadata
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
type MetadataType int32
|
||||
|
||||
const (
|
||||
MetadataByte MetadataType = iota
|
||||
MetadataVarInt
|
||||
MetadataVarLong
|
||||
MetadataFloat
|
||||
MetadataString
|
||||
MetadataChat
|
||||
MetadataOptChat
|
||||
MetadataSlot
|
||||
MetadataBoolean
|
||||
MetadataRotation
|
||||
MetadataPosition
|
||||
MetadataOptPosition
|
||||
MetadataDirection
|
||||
MetadataOptLivingEntity
|
||||
MetadataBlockState
|
||||
MetadataOptBlockState
|
||||
MetadataNBT
|
||||
MetadataParticle
|
||||
MetadataParticles
|
||||
MetadataVillagerData
|
||||
MetadataOptVarInt
|
||||
MetadataPose
|
||||
MetadataCatVariant
|
||||
MetadataCowVariant
|
||||
MetadataWolfVariant
|
||||
MetadataWolfSoundVariant
|
||||
MetadataFrogVariant
|
||||
MetadataPigVariant
|
||||
MetadataChickenVariant
|
||||
MetadataOptGlobalPosition
|
||||
MetadataPaintingVariant
|
||||
MetadataSnifferVariant
|
||||
MetadataArmadilloState
|
||||
MetadataVector3
|
||||
MetadataQuaternion
|
||||
)
|
||||
|
||||
type entityMetadata interface {
|
||||
EntityMetadataType() MetadataType
|
||||
pk.Field
|
||||
}
|
||||
|
||||
type EntityMetadata struct {
|
||||
Data map[uint8]entityMetadata
|
||||
}
|
||||
|
||||
func (m EntityMetadata) WriteTo(w io.Writer) (int64, error) {
|
||||
n := int64(0)
|
||||
for u, metadata := range m.Data {
|
||||
n1, err := pk.UnsignedByte(u).WriteTo(w)
|
||||
n += n1
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
n2, err := pk.VarInt(metadata.EntityMetadataType()).WriteTo(w)
|
||||
n += n2
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
|
||||
n3, err := metadata.WriteTo(w)
|
||||
n += n3
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
n4, err := pk.UnsignedByte(0xff).WriteTo(w)
|
||||
n += n4
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (m *EntityMetadata) ReadFrom(r io.Reader) (int64, error) {
|
||||
var index uint8
|
||||
n, err := (*pk.UnsignedByte)(&index).ReadFrom(r)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
for index != 0xff {
|
||||
var typeId MetadataType
|
||||
n1, err := (*pk.VarInt)(&typeId).ReadFrom(r)
|
||||
n += n1
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
|
||||
metadata := metadataType[typeId]()
|
||||
n2, err := metadata.ReadFrom(r)
|
||||
n += n2
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
m.Data[index] = metadata
|
||||
|
||||
n3, err := (*pk.UnsignedByte)(&index).ReadFrom(r)
|
||||
n += n3
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
|
||||
type metadataCreator func() entityMetadata
|
||||
|
||||
var metadataType = map[MetadataType]metadataCreator{}
|
||||
|
||||
func init() {
|
||||
metadataType[MetadataByte] = func() entityMetadata { return &Byte{} }
|
||||
metadataType[MetadataVarInt] = func() entityMetadata { return &VarInt{} }
|
||||
metadataType[MetadataVarLong] = func() entityMetadata { return &VarLong{} }
|
||||
metadataType[MetadataFloat] = func() entityMetadata { return &Float{} }
|
||||
metadataType[MetadataString] = func() entityMetadata { return &String{} }
|
||||
metadataType[MetadataChat] = func() entityMetadata { return &Chat{} }
|
||||
metadataType[MetadataOptChat] = func() entityMetadata { return &OptChat{} }
|
||||
metadataType[MetadataSlot] = func() entityMetadata { return &Slot{} }
|
||||
metadataType[MetadataBoolean] = func() entityMetadata { return &Boolean{} }
|
||||
metadataType[MetadataRotation] = func() entityMetadata { return &Rotation{} }
|
||||
metadataType[MetadataPosition] = func() entityMetadata { return &Position{} }
|
||||
metadataType[MetadataOptPosition] = func() entityMetadata { return &OptPosition{} }
|
||||
metadataType[MetadataDirection] = func() entityMetadata { return &Direction{} }
|
||||
metadataType[MetadataOptLivingEntity] = func() entityMetadata { return &OptLivingEntity{} }
|
||||
metadataType[MetadataBlockState] = func() entityMetadata { return &BlockState{} }
|
||||
metadataType[MetadataOptBlockState] = func() entityMetadata { return &OptBlockState{} }
|
||||
metadataType[MetadataNBT] = func() entityMetadata { return &NBT{} }
|
||||
metadataType[MetadataParticle] = func() entityMetadata { return &Particle{} }
|
||||
metadataType[MetadataParticles] = func() entityMetadata { return &Particles{} }
|
||||
metadataType[MetadataVillagerData] = func() entityMetadata { return &VillagerData{} }
|
||||
metadataType[MetadataOptVarInt] = func() entityMetadata { return &OptVarInt{} }
|
||||
metadataType[MetadataPose] = func() entityMetadata { return &Pose{} }
|
||||
metadataType[MetadataCatVariant] = func() entityMetadata { return &CatVariant{} }
|
||||
metadataType[MetadataCowVariant] = func() entityMetadata { return &CowVariant{} }
|
||||
metadataType[MetadataWolfVariant] = func() entityMetadata { return &WolfVariant{} }
|
||||
metadataType[MetadataWolfSoundVariant] = func() entityMetadata { return &WolfSoundVariant{} }
|
||||
metadataType[MetadataFrogVariant] = func() entityMetadata { return &FrogVariant{} }
|
||||
metadataType[MetadataPigVariant] = func() entityMetadata { return &PigVariant{} }
|
||||
metadataType[MetadataChickenVariant] = func() entityMetadata { return &ChickenVariant{} }
|
||||
metadataType[MetadataOptGlobalPosition] = func() entityMetadata { return &OptGlobalPosition{} }
|
||||
metadataType[MetadataPaintingVariant] = func() entityMetadata { return &PaintingVariant{} }
|
||||
metadataType[MetadataSnifferVariant] = func() entityMetadata { return &SnifferVariant{} }
|
||||
metadataType[MetadataArmadilloState] = func() entityMetadata { return &ArmadilloState{} }
|
||||
metadataType[MetadataVector3] = func() entityMetadata { return &Vector3{} }
|
||||
metadataType[MetadataQuaternion] = func() entityMetadata { return &Quaternion{} }
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user