Initialize Commit
This commit is contained in:
16
.claude/settings.local.json
Normal file
16
.claude/settings.local.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(./packetizer)",
|
||||
"Bash(packetizer)",
|
||||
"Bash(find:*)",
|
||||
"Bash(grep:*)",
|
||||
"Bash(rg:*)",
|
||||
"Bash(go:*)",
|
||||
"*",
|
||||
"Bash(./gen-packet.sh:*)",
|
||||
"Bash(chmod:*)"
|
||||
],
|
||||
"deny": []
|
||||
}
|
||||
}
|
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
14
.idea/deployment.xml
generated
Normal file
14
.idea/deployment.xml
generated
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
|
||||
<serverData>
|
||||
<paths name="diceServer">
|
||||
<serverdata>
|
||||
<mappings>
|
||||
<mapping local="$PROJECT_DIR$" web="/" />
|
||||
</mappings>
|
||||
</serverdata>
|
||||
</paths>
|
||||
</serverData>
|
||||
</component>
|
||||
</project>
|
6
.idea/graphql-settings.xml
generated
Normal file
6
.idea/graphql-settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GraphQLSettings">
|
||||
<option name="enableApolloKotlinSupport" value="true" />
|
||||
</component>
|
||||
</project>
|
9
.idea/minego.iml
generated
Normal file
9
.idea/minego.iml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="Go" enabled="true" />
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/minego.iml" filepath="$PROJECT_DIR$/.idea/minego.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
114
CLAUDE.md
Normal file
114
CLAUDE.md
Normal file
@ -0,0 +1,114 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
MinEGO is a Go-based Minecraft protocol implementation that generates packet codecs and data components for Minecraft Java Edition protocol version 1.21.6 (protocol 771). The project uses code generation to create serialization/deserialization code for Minecraft network packets and item components.
|
||||
|
||||
## Architecture
|
||||
|
||||
The project follows a modular architecture centered around code generation:
|
||||
|
||||
- **`codec/data/component/`** - Contains Go structs for all Minecraft item components (e.g., damage, enchantments, custom_name). Each component implements the `slot.Component` interface with Type() and ID() methods.
|
||||
- **`codec/data/packet/game/`** - Contains client and server packet definitions following the Minecraft protocol specification
|
||||
- **`codec/data/slot/`** - Core slot/item stack implementation and component registration system
|
||||
- **`net/`** - Network layer implementation (currently empty)
|
||||
- **Protocol Reference** - `codec/data/packet/protocol.wiki` contains the complete Minecraft protocol specification from wiki.vg
|
||||
|
||||
## Code Generation System
|
||||
|
||||
The project uses a custom code generator called `packetizer` that processes Go structs marked with `//codec:gen` comments. This generates the necessary ReadFrom/WriteTo methods for network serialization.
|
||||
|
||||
Key patterns:
|
||||
- Structs marked with `//codec:gen` will have codecs auto-generated
|
||||
- Structs marked with `//codec:ignore` are excluded from generation
|
||||
- Components must implement `Type() slot.ComponentID` and `ID() string` methods
|
||||
- Components are registered in `codec/data/component/components.go` using `slot.RegisterComponent()`
|
||||
|
||||
## Development Commands
|
||||
|
||||
### Code Generation
|
||||
```bash
|
||||
# Generate packet codecs (run from project root)
|
||||
./gen-packet.sh
|
||||
# This runs: packetizer ./codec
|
||||
```
|
||||
|
||||
### Standard Go Commands
|
||||
```bash
|
||||
# Build the project
|
||||
go build
|
||||
|
||||
# Run tests (if any exist)
|
||||
go test ./...
|
||||
|
||||
# Format code
|
||||
go fmt ./...
|
||||
|
||||
# Get dependencies
|
||||
go mod tidy
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
- **github.com/Tnze/go-mc** - Core Minecraft protocol library (uses forked version)
|
||||
- **packetizer** - Custom code generation tool (available at /root/go/bin/packetizer)
|
||||
|
||||
## Working with Components
|
||||
|
||||
When adding new Minecraft item components:
|
||||
1. Create the struct in `codec/data/component/` following existing patterns
|
||||
2. Add `//codec:gen` comment above the struct
|
||||
3. Implement `Type()` and `ID()` methods with correct component ID and namespace
|
||||
4. Register the component in `components.go` init() function
|
||||
5. Run `./gen-packet.sh` to generate codecs
|
||||
|
||||
## Working with Packets
|
||||
|
||||
When adding new packet types:
|
||||
1. Define the packet struct in appropriate `client/` or `server/` directory
|
||||
2. Add `//codec:gen` comment for auto-generation
|
||||
3. Register the packet in the appropriate packets map
|
||||
4. Run `./gen-packet.sh` to generate codecs
|
||||
|
||||
## Module Path
|
||||
|
||||
The project uses `git.konjactw.dev/patyhank/minego` as its module path and includes a replace directive for the go-mc dependency pointing to a custom fork.
|
||||
|
||||
## Code Generation Tasks
|
||||
|
||||
- **Java to Go Packet Conversion**:
|
||||
* Task to implement Game State packets by converting Java code from `~/GoProjects/mc-network-source/network/protocol/game` to Go structs
|
||||
* Focus on maintaining the same read/write logic during translation
|
||||
* Ensure packet structures match the original Java implementation
|
||||
* Use packetizer for automatic codec generation
|
||||
|
||||
## Reference Notes
|
||||
|
||||
- PacketID Reference:
|
||||
* In `/root/go/pkg/mod/git.konjactw.dev/patyhank/go-mc@v1.20.3-0.20250618004758-a3d57fde34e8/data/packetid/packetid.go`, you can find all packet IDs (excluding handshake stage)
|
||||
|
||||
## Packet Serialization Techniques
|
||||
|
||||
- 對於Optional封包資料 簡易的格式可以使用pk.Option[XXX,*XXX] 的方法 比較複雜的需要自己實作一個ReadFrom&WriteTo 並且移除codec:gen的標記
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
// ExampleTypeFull full example for codec generator
|
||||
//
|
||||
//codec:gen
|
||||
type ExampleTypeFull struct {
|
||||
PlayerID int32 `mc:"VarInt"`
|
||||
PlayerName string
|
||||
UUID uuid.UUID `mc:"UUID"`
|
||||
ResourceLocation string `mc:"Identifier"`
|
||||
Data nbt.RawMessage `mc:"NBT"`
|
||||
ByteData []byte `mc:"ByteArray"`
|
||||
Health float32
|
||||
Balance float64
|
||||
Message chat.Message
|
||||
SentMessages []chat.Message
|
||||
}
|
||||
```
|
28
codec/component/attribute_modifiers.go
Normal file
28
codec/component/attribute_modifiers.go
Normal file
@ -0,0 +1,28 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type AttributeModifiers struct {
|
||||
Modifiers []AttributeModifier
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type AttributeModifier struct {
|
||||
AttributeID int32 `mc:"VarInt"`
|
||||
ModifierID pk.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"
|
||||
}
|
16
codec/component/axolotl_variant.go
Normal file
16
codec/component/axolotl_variant.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
33
codec/component/banner_patterns.go
Normal file
33
codec/component/banner_patterns.go
Normal file
@ -0,0 +1,33 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
"github.com/Tnze/go-mc/net/packet"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//codec:gen
|
||||
type BannerPatterns struct {
|
||||
Layers []BannerLayer
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type BannerLayer struct {
|
||||
PatternType int32 `mc:"VarInt"`
|
||||
AssetID pk.Option[packet.Identifier, *packet.Identifier]
|
||||
TranslationKey pk.Option[pk.String, *pk.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"
|
||||
}
|
16
codec/component/base_color.go
Normal file
16
codec/component/base_color.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type BaseColor struct {
|
||||
Color DyeColor
|
||||
}
|
||||
|
||||
func (*BaseColor) Type() slot.ComponentID {
|
||||
return 64
|
||||
}
|
||||
|
||||
func (*BaseColor) ID() string {
|
||||
return "minecraft:base_color"
|
||||
}
|
26
codec/component/bees.go
Normal file
26
codec/component/bees.go
Normal file
@ -0,0 +1,26 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/block_entity_data.go
Normal file
19
codec/component/block_entity_data.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
22
codec/component/block_state.go
Normal file
22
codec/component/block_state.go
Normal file
@ -0,0 +1,22 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
35
codec/component/blocks_attacks.go
Normal file
35
codec/component/blocks_attacks.go
Normal file
@ -0,0 +1,35 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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]
|
||||
BlockSound pk.Option[SoundEvent, *SoundEvent]
|
||||
DisableSound pk.Option[SoundEvent, *SoundEvent]
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type DamageReduction struct {
|
||||
HorizontalBlockingAngle float32
|
||||
Type pk.Option[pk.IDSet, *pk.IDSet]
|
||||
Base float32
|
||||
Factor float32
|
||||
}
|
||||
|
||||
func (*BlocksAttacks) Type() slot.ComponentID {
|
||||
return 33
|
||||
}
|
||||
|
||||
func (*BlocksAttacks) ID() string {
|
||||
return "minecraft:blocks_attacks"
|
||||
}
|
19
codec/component/break_sound.go
Normal file
19
codec/component/break_sound.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/bucket_entity_data.go
Normal file
19
codec/component/bucket_entity_data.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/bundle_contents.go
Normal file
16
codec/component/bundle_contents.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type BundleContents struct {
|
||||
Items []slot.Slot
|
||||
}
|
||||
|
||||
func (*BundleContents) Type() slot.ComponentID {
|
||||
return 41
|
||||
}
|
||||
|
||||
func (*BundleContents) ID() string {
|
||||
return "minecraft:bundle_contents"
|
||||
}
|
16
codec/component/can_break.go
Normal file
16
codec/component/can_break.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type CanBreak struct {
|
||||
BlockPredicates []BlockPredicate
|
||||
}
|
||||
|
||||
func (*CanBreak) Type() slot.ComponentID {
|
||||
return 12
|
||||
}
|
||||
|
||||
func (*CanBreak) ID() string {
|
||||
return "minecraft:can_break"
|
||||
}
|
62
codec/component/can_place_on.go
Normal file
62
codec/component/can_place_on.go
Normal file
@ -0,0 +1,62 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/cat_collar.go
Normal file
16
codec/component/cat_collar.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type CatCollar struct {
|
||||
Color DyeColor
|
||||
}
|
||||
|
||||
func (*CatCollar) Type() slot.ComponentID {
|
||||
return 93
|
||||
}
|
||||
|
||||
func (*CatCollar) ID() string {
|
||||
return "minecraft:cat/collar"
|
||||
}
|
16
codec/component/cat_variant.go
Normal file
16
codec/component/cat_variant.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/charged_projectiles.go
Normal file
16
codec/component/charged_projectiles.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type ChargedProjectiles struct {
|
||||
Projectiles []slot.Slot
|
||||
}
|
||||
|
||||
func (*ChargedProjectiles) Type() slot.ComponentID {
|
||||
return 40
|
||||
}
|
||||
|
||||
func (*ChargedProjectiles) ID() string {
|
||||
return "minecraft:charged_projectiles"
|
||||
}
|
58
codec/component/chicken_variant.go
Normal file
58
codec/component/chicken_variant.go
Normal file
@ -0,0 +1,58 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
3949
codec/component/codecs.go
Normal file
3949
codec/component/codecs.go
Normal file
File diff suppressed because it is too large
Load Diff
102
codec/component/components.go
Normal file
102
codec/component/components.go
Normal file
@ -0,0 +1,102 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
func init() {
|
||||
slot.RegisterComponent(&CustomData{})
|
||||
slot.RegisterComponent(&MaxStackSize{})
|
||||
slot.RegisterComponent(&MaxDamage{})
|
||||
slot.RegisterComponent(&Damage{})
|
||||
slot.RegisterComponent(&Unbreakable{})
|
||||
slot.RegisterComponent(&CustomName{})
|
||||
slot.RegisterComponent(&ItemName{})
|
||||
slot.RegisterComponent(&ItemModel{})
|
||||
slot.RegisterComponent(&Lore{})
|
||||
slot.RegisterComponent(&Rarity{})
|
||||
slot.RegisterComponent(&Enchantments{})
|
||||
slot.RegisterComponent(&CanPlaceOn{})
|
||||
slot.RegisterComponent(&CanBreak{})
|
||||
slot.RegisterComponent(&AttributeModifiers{})
|
||||
slot.RegisterComponent(&CustomModelData{})
|
||||
slot.RegisterComponent(&TooltipDisplay{})
|
||||
slot.RegisterComponent(&RepairCost{})
|
||||
slot.RegisterComponent(&CreativeSlotLock{})
|
||||
slot.RegisterComponent(&EnchantmentGlintOverride{})
|
||||
slot.RegisterComponent(&IntangibleProjectile{})
|
||||
slot.RegisterComponent(&Food{})
|
||||
slot.RegisterComponent(&Consumable{})
|
||||
slot.RegisterComponent(&UseRemainder{})
|
||||
slot.RegisterComponent(&UseCooldown{})
|
||||
slot.RegisterComponent(&DamageResistant{})
|
||||
slot.RegisterComponent(&Tool{})
|
||||
slot.RegisterComponent(&Weapon{})
|
||||
slot.RegisterComponent(&Enchantable{})
|
||||
slot.RegisterComponent(&Equippable{})
|
||||
slot.RegisterComponent(&Repairable{})
|
||||
slot.RegisterComponent(&Glider{})
|
||||
slot.RegisterComponent(&TooltipStyle{})
|
||||
slot.RegisterComponent(&DeathProtection{})
|
||||
slot.RegisterComponent(&BlocksAttacks{})
|
||||
slot.RegisterComponent(&StoredEnchantments{})
|
||||
slot.RegisterComponent(&DyedColor{})
|
||||
slot.RegisterComponent(&MapColor{})
|
||||
slot.RegisterComponent(&MapID{})
|
||||
slot.RegisterComponent(&MapDecorations{})
|
||||
slot.RegisterComponent(&MapPostProcessing{})
|
||||
slot.RegisterComponent(&ChargedProjectiles{})
|
||||
slot.RegisterComponent(&BundleContents{})
|
||||
slot.RegisterComponent(&PotionContents{})
|
||||
slot.RegisterComponent(&PotionDurationScale{})
|
||||
slot.RegisterComponent(&SuspiciousStewEffects{})
|
||||
slot.RegisterComponent(&WritableBookContent{})
|
||||
slot.RegisterComponent(&WrittenBookContent{})
|
||||
slot.RegisterComponent(&Trim{})
|
||||
slot.RegisterComponent(&DebugStickState{})
|
||||
slot.RegisterComponent(&EntityData{})
|
||||
slot.RegisterComponent(&BucketEntityData{})
|
||||
slot.RegisterComponent(&BlockEntityData{})
|
||||
slot.RegisterComponent(&Instrument{})
|
||||
slot.RegisterComponent(&ProvidesTrimMaterial{})
|
||||
slot.RegisterComponent(&OminousBottleAmplifier{})
|
||||
slot.RegisterComponent(&JukeboxPlayable{})
|
||||
slot.RegisterComponent(&ProvidesBannerPatterns{})
|
||||
slot.RegisterComponent(&Recipes{})
|
||||
slot.RegisterComponent(&LodestoneTracker{})
|
||||
slot.RegisterComponent(&FireworkExplosion{})
|
||||
slot.RegisterComponent(&Fireworks{})
|
||||
slot.RegisterComponent(&Profile{})
|
||||
slot.RegisterComponent(&NoteBlockSound{})
|
||||
slot.RegisterComponent(&BannerPatterns{})
|
||||
slot.RegisterComponent(&BaseColor{})
|
||||
slot.RegisterComponent(&PotDecorations{})
|
||||
slot.RegisterComponent(&Container{})
|
||||
slot.RegisterComponent(&BlockState{})
|
||||
slot.RegisterComponent(&Bees{})
|
||||
slot.RegisterComponent(&Lock{})
|
||||
slot.RegisterComponent(&ContainerLoot{})
|
||||
slot.RegisterComponent(&BreakSound{})
|
||||
slot.RegisterComponent(&VillagerVariant{})
|
||||
slot.RegisterComponent(&WolfVariant{})
|
||||
slot.RegisterComponent(&WolfSoundVariant{})
|
||||
slot.RegisterComponent(&WolfCollar{})
|
||||
slot.RegisterComponent(&FoxVariant{})
|
||||
slot.RegisterComponent(&SalmonSize{})
|
||||
slot.RegisterComponent(&ParrotVariant{})
|
||||
slot.RegisterComponent(&TropicalFishPattern{})
|
||||
slot.RegisterComponent(&TropicalFishBaseColor{})
|
||||
slot.RegisterComponent(&TropicalFishPatternColor{})
|
||||
slot.RegisterComponent(&MooshroomVariant{})
|
||||
slot.RegisterComponent(&RabbitVariant{})
|
||||
slot.RegisterComponent(&PigVariant{})
|
||||
slot.RegisterComponent(&CowVariant{})
|
||||
slot.RegisterComponent(&ChickenVariant{})
|
||||
slot.RegisterComponent(&FrogVariant{})
|
||||
slot.RegisterComponent(&HorseVariant{})
|
||||
slot.RegisterComponent(&PaintingVariant{})
|
||||
slot.RegisterComponent(&LlamaVariant{})
|
||||
slot.RegisterComponent(&AxolotlVariant{})
|
||||
slot.RegisterComponent(&CatVariant{})
|
||||
slot.RegisterComponent(&CatCollar{})
|
||||
slot.RegisterComponent(&SheepColor{})
|
||||
slot.RegisterComponent(&ShulkerColor{})
|
||||
}
|
35
codec/component/consumable.go
Normal file
35
codec/component/consumable.go
Normal file
@ -0,0 +1,35 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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.
|
||||
Sound SoundEvent
|
||||
HasConsumeParticles bool
|
||||
Effects []ConsumeEffect
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type SoundEvent struct {
|
||||
SoundEventID packet.Identifier
|
||||
FixedRange packet.Option[packet.Float, *packet.Float]
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type ConsumeEffect struct {
|
||||
Type int32 `mc:"VarInt"`
|
||||
// Data varies by type - would need custom handling
|
||||
}
|
||||
|
||||
func (*Consumable) Type() slot.ComponentID {
|
||||
return 21
|
||||
}
|
||||
|
||||
func (*Consumable) ID() string {
|
||||
return "minecraft:consumable"
|
||||
}
|
16
codec/component/container.go
Normal file
16
codec/component/container.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type Container struct {
|
||||
Items []slot.Slot
|
||||
}
|
||||
|
||||
func (*Container) Type() slot.ComponentID {
|
||||
return 66
|
||||
}
|
||||
|
||||
func (*Container) ID() string {
|
||||
return "minecraft:container"
|
||||
}
|
19
codec/component/container_loot.go
Normal file
19
codec/component/container_loot.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/cow_variant.go
Normal file
16
codec/component/cow_variant.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/creative_slot_lock.go
Normal file
16
codec/component/creative_slot_lock.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/custom_data.go
Normal file
19
codec/component/custom_data.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
19
codec/component/custom_model_data.go
Normal file
19
codec/component/custom_model_data.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/custom_name.go
Normal file
19
codec/component/custom_name.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/damage.go
Normal file
16
codec/component/damage.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/damage_resistant.go
Normal file
19
codec/component/damage_resistant.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/death_protection.go
Normal file
16
codec/component/death_protection.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type DeathProtection struct {
|
||||
Effects []ConsumeEffect
|
||||
}
|
||||
|
||||
func (*DeathProtection) Type() slot.ComponentID {
|
||||
return 32
|
||||
}
|
||||
|
||||
func (*DeathProtection) ID() string {
|
||||
return "minecraft:death_protection"
|
||||
}
|
19
codec/component/debug_stick_state.go
Normal file
19
codec/component/debug_stick_state.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/dyed_color.go
Normal file
16
codec/component/dyed_color.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/enchantable.go
Normal file
16
codec/component/enchantable.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type Enchantable struct {
|
||||
Value int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*Enchantable) Type() slot.ComponentID {
|
||||
return 27
|
||||
}
|
||||
|
||||
func (*Enchantable) ID() string {
|
||||
return "minecraft:enchantable"
|
||||
}
|
16
codec/component/enchantment_glint_override.go
Normal file
16
codec/component/enchantment_glint_override.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type EnchantmentGlintOverride struct {
|
||||
HasGlint bool
|
||||
}
|
||||
|
||||
func (*EnchantmentGlintOverride) Type() slot.ComponentID {
|
||||
return 18
|
||||
}
|
||||
|
||||
func (*EnchantmentGlintOverride) ID() string {
|
||||
return "minecraft:enchantment_glint_override"
|
||||
}
|
21
codec/component/enchantments.go
Normal file
21
codec/component/enchantments.go
Normal file
@ -0,0 +1,21 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type Enchantments struct {
|
||||
Enchantments []Enchantment
|
||||
}
|
||||
|
||||
type Enchantment struct {
|
||||
TypeID int32 `mc:"VarInt"`
|
||||
Level int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (*Enchantments) Type() slot.ComponentID {
|
||||
return 10
|
||||
}
|
||||
|
||||
func (*Enchantments) ID() string {
|
||||
return "minecraft:enchantments"
|
||||
}
|
19
codec/component/entity_data.go
Normal file
19
codec/component/entity_data.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
29
codec/component/equippable.go
Normal file
29
codec/component/equippable.go
Normal file
@ -0,0 +1,29 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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.
|
||||
EquipSound SoundEvent
|
||||
HasModel bool
|
||||
Model pk.Option[pk.Identifier, *pk.Identifier]
|
||||
HasCameraOverlay bool
|
||||
CameraOverlay pk.Option[pk.Identifier, *pk.Identifier]
|
||||
HasAllowedEntities bool
|
||||
AllowedEntities pk.Option[pk.IDSet, *pk.IDSet]
|
||||
Dispensable bool
|
||||
Swappable bool
|
||||
DamageOnHurt bool
|
||||
}
|
||||
|
||||
func (*Equippable) Type() slot.ComponentID {
|
||||
return 28
|
||||
}
|
||||
|
||||
func (*Equippable) ID() string {
|
||||
return "minecraft:equippable"
|
||||
}
|
25
codec/component/firework_explosion.go
Normal file
25
codec/component/firework_explosion.go
Normal file
@ -0,0 +1,25 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type FireworkExplosion struct {
|
||||
Explosion FireworkExplosionData
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type FireworkExplosionData struct {
|
||||
Shape int32 `mc:"VarInt"`
|
||||
Colors []int32 `mc:"PrefixedArray"`
|
||||
FadeColors []int32 `mc:"PrefixedArray"`
|
||||
HasTrail bool
|
||||
HasTwinkle bool
|
||||
}
|
||||
|
||||
func (*FireworkExplosion) Type() slot.ComponentID {
|
||||
return 59
|
||||
}
|
||||
|
||||
func (*FireworkExplosion) ID() string {
|
||||
return "minecraft:firework_explosion"
|
||||
}
|
17
codec/component/fireworks.go
Normal file
17
codec/component/fireworks.go
Normal file
@ -0,0 +1,17 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
18
codec/component/food.go
Normal file
18
codec/component/food.go
Normal file
@ -0,0 +1,18 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/fox_variant.go
Normal file
16
codec/component/fox_variant.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/frog_variant.go
Normal file
16
codec/component/frog_variant.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/glider.go
Normal file
16
codec/component/glider.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type Glider struct {
|
||||
// no fields
|
||||
}
|
||||
|
||||
func (*Glider) Type() slot.ComponentID {
|
||||
return 30
|
||||
}
|
||||
|
||||
func (*Glider) ID() string {
|
||||
return "minecraft:glider"
|
||||
}
|
16
codec/component/horse_variant.go
Normal file
16
codec/component/horse_variant.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/instrument.go
Normal file
28
codec/component/instrument.go
Normal file
@ -0,0 +1,28 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/intangible_projectile.go
Normal file
19
codec/component/intangible_projectile.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/item_model.go
Normal file
19
codec/component/item_model.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/item_name.go
Normal file
19
codec/component/item_name.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/jukebox_playable.go
Normal file
67
codec/component/jukebox_playable.go
Normal file
@ -0,0 +1,67 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/llama_variant.go
Normal file
16
codec/component/llama_variant.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/lock.go
Normal file
19
codec/component/lock.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/lodestone_tracker.go
Normal file
23
codec/component/lodestone_tracker.go
Normal file
@ -0,0 +1,23 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/lore.go
Normal file
19
codec/component/lore.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/map_color.go
Normal file
16
codec/component/map_color.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/map_decorations.go
Normal file
19
codec/component/map_decorations.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/map_id.go
Normal file
16
codec/component/map_id.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/map_post_processing.go
Normal file
16
codec/component/map_post_processing.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/max_damage.go
Normal file
16
codec/component/max_damage.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/max_stack_size.go
Normal file
16
codec/component/max_stack_size.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/mooshroom_variant.go
Normal file
16
codec/component/mooshroom_variant.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/note_block_sound.go
Normal file
19
codec/component/note_block_sound.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/ominous_bottle_amplifier.go
Normal file
16
codec/component/ominous_bottle_amplifier.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/painting_variant.go
Normal file
24
codec/component/painting_variant.go
Normal file
@ -0,0 +1,24 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/parrot_variant.go
Normal file
16
codec/component/parrot_variant.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/pig_variant.go
Normal file
16
codec/component/pig_variant.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/pot_decorations.go
Normal file
16
codec/component/pot_decorations.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
47
codec/component/potion_contents.go
Normal file
47
codec/component/potion_contents.go
Normal file
@ -0,0 +1,47 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
//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"`
|
||||
|
||||
Amplifier int32 `mc:"VarInt"`
|
||||
Duration int32 `mc:"VarInt"`
|
||||
Ambient bool
|
||||
ShowParticles bool
|
||||
ShowIcon bool
|
||||
HasHiddenEffect bool
|
||||
HiddenEffect pk.Option[PotionEffectExtraDetails, *PotionEffectExtraDetails]
|
||||
}
|
||||
|
||||
//codec:gen
|
||||
type PotionEffectExtraDetails struct {
|
||||
Amplifier int32 `mc:"VarInt"`
|
||||
Duration int32 `mc:"VarInt"`
|
||||
Ambient bool
|
||||
ShowParticles bool
|
||||
ShowIcon bool
|
||||
HasHiddenEffect bool
|
||||
}
|
||||
|
||||
func (*PotionContents) Type() slot.ComponentID {
|
||||
return 42
|
||||
}
|
||||
|
||||
func (*PotionContents) ID() string {
|
||||
return "minecraft:potion_contents"
|
||||
}
|
16
codec/component/potion_duration_scale.go
Normal file
16
codec/component/potion_duration_scale.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/profile.go
Normal file
31
codec/component/profile.go
Normal file
@ -0,0 +1,31 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/provides_banner_patterns.go
Normal file
19
codec/component/provides_banner_patterns.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/provides_trim_material.go
Normal file
58
codec/component/provides_trim_material.go
Normal file
@ -0,0 +1,58 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/rabbit_variant.go
Normal file
16
codec/component/rabbit_variant.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/rarity.go
Normal file
16
codec/component/rarity.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/recipes.go
Normal file
19
codec/component/recipes.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/repair_cost.go
Normal file
16
codec/component/repair_cost.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/repairable.go
Normal file
19
codec/component/repairable.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/salmon_size.go
Normal file
16
codec/component/salmon_size.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/sheep_color.go
Normal file
16
codec/component/sheep_color.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type SheepColor struct {
|
||||
Color DyeColor
|
||||
}
|
||||
|
||||
func (*SheepColor) Type() slot.ComponentID {
|
||||
return 94
|
||||
}
|
||||
|
||||
func (*SheepColor) ID() string {
|
||||
return "minecraft:sheep/color"
|
||||
}
|
16
codec/component/shulker_color.go
Normal file
16
codec/component/shulker_color.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type ShulkerColor struct {
|
||||
Color DyeColor
|
||||
}
|
||||
|
||||
func (*ShulkerColor) Type() slot.ComponentID {
|
||||
return 95
|
||||
}
|
||||
|
||||
func (*ShulkerColor) ID() string {
|
||||
return "minecraft:shulker/color"
|
||||
}
|
16
codec/component/stored_enchantments.go
Normal file
16
codec/component/stored_enchantments.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type StoredEnchantments struct {
|
||||
Enchantments []Enchantment
|
||||
}
|
||||
|
||||
func (*StoredEnchantments) Type() slot.ComponentID {
|
||||
return 34
|
||||
}
|
||||
|
||||
func (*StoredEnchantments) ID() string {
|
||||
return "minecraft:stored_enchantments"
|
||||
}
|
22
codec/component/suspicious_stew_effects.go
Normal file
22
codec/component/suspicious_stew_effects.go
Normal file
@ -0,0 +1,22 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/tool.go
Normal file
30
codec/component/tool.go
Normal file
@ -0,0 +1,30 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
17
codec/component/tooltip_display.go
Normal file
17
codec/component/tooltip_display.go
Normal file
@ -0,0 +1,17 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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
codec/component/tooltip_style.go
Normal file
19
codec/component/tooltip_style.go
Normal file
@ -0,0 +1,19 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
41
codec/component/trim.go
Normal file
41
codec/component/trim.go
Normal file
@ -0,0 +1,41 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
16
codec/component/tropical_fish_base_color.go
Normal file
16
codec/component/tropical_fish_base_color.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/tropical_fish_pattern.go
Normal file
16
codec/component/tropical_fish_pattern.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/tropical_fish_pattern_color.go
Normal file
16
codec/component/tropical_fish_pattern_color.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/unbreakable.go
Normal file
16
codec/component/unbreakable.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type Unbreakable struct {
|
||||
// no fields
|
||||
}
|
||||
|
||||
func (*Unbreakable) Type() slot.ComponentID {
|
||||
return 4
|
||||
}
|
||||
|
||||
func (*Unbreakable) ID() string {
|
||||
return "minecraft:unbreakable"
|
||||
}
|
20
codec/component/use_cooldown.go
Normal file
20
codec/component/use_cooldown.go
Normal file
@ -0,0 +1,20 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
16
codec/component/use_remainder.go
Normal file
16
codec/component/use_remainder.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/slot"
|
||||
|
||||
//codec:gen
|
||||
type UseRemainder struct {
|
||||
Remainder slot.Slot
|
||||
}
|
||||
|
||||
func (*UseRemainder) Type() slot.ComponentID {
|
||||
return 22
|
||||
}
|
||||
|
||||
func (*UseRemainder) ID() string {
|
||||
return "minecraft:use_remainder"
|
||||
}
|
16
codec/component/villager_variant.go
Normal file
16
codec/component/villager_variant.go
Normal file
@ -0,0 +1,16 @@
|
||||
package component
|
||||
|
||||
import "git.konjactw.dev/patyhank/minego/codec/data/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"
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user