File tree Expand file tree Collapse file tree 12 files changed +393
-0
lines changed Expand file tree Collapse file tree 12 files changed +393
-0
lines changed Original file line number Diff line number Diff line change
1
+ package component
2
+
3
+ import (
4
+ "io"
5
+
6
+ "github.com/Tnze/go-mc/nbt/dynbt"
7
+ pk "github.com/Tnze/go-mc/net/packet"
8
+ )
9
+
10
+ var _ DataComponent = (* BlockEntityData )(nil )
11
+
12
+ type BlockEntityData struct {
13
+ dynbt.Value
14
+ }
15
+
16
+ // ID implements DataComponent.
17
+ func (BlockEntityData ) ID () string {
18
+ return "minecraft:block_entity_data"
19
+ }
20
+
21
+ // ReadFrom implements DataComponent.
22
+ func (b * BlockEntityData ) ReadFrom (r io.Reader ) (n int64 , err error ) {
23
+ return pk .NBT (& b .Value ).ReadFrom (r )
24
+ }
25
+
26
+ // WriteTo implements DataComponent.
27
+ func (b * BlockEntityData ) WriteTo (w io.Writer ) (n int64 , err error ) {
28
+ return pk .NBT (& b .Value ).WriteTo (w )
29
+ }
Original file line number Diff line number Diff line change
1
+ package component
2
+
3
+ import (
4
+ "io"
5
+
6
+ "github.com/Tnze/go-mc/nbt/dynbt"
7
+ pk "github.com/Tnze/go-mc/net/packet"
8
+ )
9
+
10
+ var _ DataComponent = (* BucketEntityData )(nil )
11
+
12
+ type BucketEntityData struct {
13
+ dynbt.Value
14
+ }
15
+
16
+ // ID implements DataComponent.
17
+ func (BucketEntityData ) ID () string {
18
+ return "minecraft:bucket_entity_data"
19
+ }
20
+
21
+ // ReadFrom implements DataComponent.
22
+ func (b * BucketEntityData ) ReadFrom (r io.Reader ) (n int64 , err error ) {
23
+ return pk .NBT (& b .Value ).ReadFrom (r )
24
+ }
25
+
26
+ // WriteTo implements DataComponent.
27
+ func (b * BucketEntityData ) WriteTo (w io.Writer ) (n int64 , err error ) {
28
+ return pk .NBT (& b .Value ).WriteTo (w )
29
+ }
Original file line number Diff line number Diff line change
1
+ package component
2
+
3
+ import "io"
4
+
5
+ var _ DataComponent = (* BundleContents )(nil )
6
+
7
+ type BundleContents struct {
8
+ // TODO
9
+ }
10
+
11
+ // ID implements DataComponent.
12
+ func (BundleContents ) ID () string {
13
+ return "minecraft:bundle_contents"
14
+ }
15
+
16
+ // ReadFrom implements DataComponent.
17
+ func (b * BundleContents ) ReadFrom (r io.Reader ) (n int64 , err error ) {
18
+ panic ("unimplemented" )
19
+ }
20
+
21
+ // WriteTo implements DataComponent.
22
+ func (b * BundleContents ) WriteTo (w io.Writer ) (n int64 , err error ) {
23
+ panic ("unimplemented" )
24
+ }
Original file line number Diff line number Diff line change
1
+ package component
2
+
3
+ import "io"
4
+
5
+ var _ DataComponent = (* ChargedProjectiles )(nil )
6
+
7
+ type ChargedProjectiles struct {
8
+ // TODO
9
+ }
10
+
11
+ // ID implements DataComponent.
12
+ func (ChargedProjectiles ) ID () string {
13
+ return "minecraft:charged_projectiles"
14
+ }
15
+
16
+ // ReadFrom implements DataComponent.
17
+ func (c * ChargedProjectiles ) ReadFrom (r io.Reader ) (n int64 , err error ) {
18
+ panic ("unimplemented" )
19
+ }
20
+
21
+ // WriteTo implements DataComponent.
22
+ func (c * ChargedProjectiles ) WriteTo (w io.Writer ) (n int64 , err error ) {
23
+ panic ("unimplemented" )
24
+ }
Original file line number Diff line number Diff line change
1
+ package component
2
+
3
+ import (
4
+ "io"
5
+
6
+ "github.com/Tnze/go-mc/level/block"
7
+ pk "github.com/Tnze/go-mc/net/packet"
8
+ )
9
+
10
+ var _ DataComponent = (* DebugStickState )(nil )
11
+
12
+ type DebugStickState struct {
13
+ Data block.State
14
+ }
15
+
16
+ // ID implements DataComponent.
17
+ func (DebugStickState ) ID () string {
18
+ return "minecraft:debug_stick_state"
19
+ }
20
+
21
+ // ReadFrom implements DataComponent.
22
+ func (d * DebugStickState ) ReadFrom (r io.Reader ) (n int64 , err error ) {
23
+ return pk .NBT (& d .Data ).ReadFrom (r )
24
+ }
25
+
26
+ // WriteTo implements DataComponent.
27
+ func (d * DebugStickState ) WriteTo (w io.Writer ) (n int64 , err error ) {
28
+ return pk .NBT (& d .Data ).WriteTo (w )
29
+ }
Original file line number Diff line number Diff line change
1
+ package component
2
+
3
+ import (
4
+ "io"
5
+
6
+ "github.com/Tnze/go-mc/nbt/dynbt"
7
+ pk "github.com/Tnze/go-mc/net/packet"
8
+ )
9
+
10
+ var _ DataComponent = (* EntityData )(nil )
11
+
12
+ type EntityData struct {
13
+ dynbt.Value
14
+ }
15
+
16
+ // ID implements DataComponent.
17
+ func (EntityData ) ID () string {
18
+ return "minecraft:entity_data"
19
+ }
20
+
21
+ // ReadFrom implements DataComponent.
22
+ func (e * EntityData ) ReadFrom (r io.Reader ) (n int64 , err error ) {
23
+ return pk .NBT (& e .Value ).ReadFrom (r )
24
+ }
25
+
26
+ // WriteTo implements DataComponent.
27
+ func (e * EntityData ) WriteTo (w io.Writer ) (n int64 , err error ) {
28
+ return pk .NBT (& e .Value ).WriteTo (w )
29
+ }
Original file line number Diff line number Diff line change
1
+ package component
2
+
3
+ import (
4
+ "io"
5
+
6
+ pk "github.com/Tnze/go-mc/net/packet"
7
+ )
8
+
9
+ var _ DataComponent = (* Instrument )(nil )
10
+
11
+ // TODO
12
+ type Instrument struct {
13
+ Type pk.VarInt
14
+ SoundEvent SoundEvent
15
+ UseDuration pk.Float
16
+ Range pk.Float
17
+ }
18
+
19
+ // ID implements DataComponent.
20
+ func (Instrument ) ID () string {
21
+ return "minecraft:instrument"
22
+ }
23
+
24
+ // ReadFrom implements DataComponent.
25
+ func (i * Instrument ) ReadFrom (r io.Reader ) (n int64 , err error ) {
26
+ return pk.Tuple {
27
+ & i .Type ,
28
+ pk.Opt {
29
+ Has : func () bool { return i .Type == 0 },
30
+ Field : pk.Tuple {
31
+ & i .SoundEvent ,
32
+ & i .UseDuration ,
33
+ & i .Range ,
34
+ },
35
+ },
36
+ }.ReadFrom (r )
37
+ }
38
+
39
+ // WriteTo implements DataComponent.
40
+ func (i * Instrument ) WriteTo (w io.Writer ) (n int64 , err error ) {
41
+ return pk.Tuple {
42
+ & i .Type ,
43
+ pk.Opt {
44
+ Has : func () bool { return i .Type == 0 },
45
+ Field : pk.Tuple {
46
+ & i .SoundEvent ,
47
+ & i .UseDuration ,
48
+ & i .Range ,
49
+ },
50
+ },
51
+ }.WriteTo (w )
52
+ }
53
+
54
+ // TODO
55
+ type SoundEvent struct {
56
+ Type pk.VarInt
57
+ SoundName pk.Identifier
58
+ FixedRange pk.Option [pk.Float , * pk.Float ]
59
+ }
60
+
61
+ func (s * SoundEvent ) ReadFrom (r io.Reader ) (int64 , error ) {
62
+ return pk.Tuple {
63
+ & s .Type ,
64
+ pk.Opt {
65
+ Has : func () bool { return s .Type == 0 },
66
+ Field : pk.Tuple {
67
+ & s .SoundName ,
68
+ & s .FixedRange ,
69
+ },
70
+ },
71
+ }.ReadFrom (r )
72
+ }
73
+
74
+ func (s SoundEvent ) WriteTo (w io.Writer ) (int64 , error ) {
75
+ return pk.Tuple {
76
+ & s .Type ,
77
+ pk.Opt {
78
+ Has : func () bool { return s .Type == 0 },
79
+ Field : pk.Tuple {
80
+ & s .SoundName ,
81
+ & s .FixedRange ,
82
+ },
83
+ },
84
+ }.WriteTo (w )
85
+ }
Original file line number Diff line number Diff line change
1
+ package component
2
+
3
+ import (
4
+ "io"
5
+
6
+ pk "github.com/Tnze/go-mc/net/packet"
7
+ )
8
+
9
+ var _ DataComponent = (* MapPostProcessing )(nil )
10
+
11
+ type MapPostProcessing int32
12
+
13
+ const (
14
+ Lock MapPostProcessing = iota
15
+ Scale
16
+ )
17
+
18
+ // ID implements DataComponent.
19
+ func (MapPostProcessing ) ID () string {
20
+ return "minecraft:map_post_processing"
21
+ }
22
+
23
+ // ReadFrom implements DataComponent.
24
+ func (m * MapPostProcessing ) ReadFrom (r io.Reader ) (n int64 , err error ) {
25
+ return (* pk .VarInt )(m ).ReadFrom (r )
26
+ }
27
+
28
+ // WriteTo implements DataComponent.
29
+ func (m * MapPostProcessing ) WriteTo (w io.Writer ) (n int64 , err error ) {
30
+ return (* pk .VarInt )(m ).WriteTo (w )
31
+ }
Original file line number Diff line number Diff line change
1
+ package component
2
+
3
+ import (
4
+ "io"
5
+
6
+ pk "github.com/Tnze/go-mc/net/packet"
7
+ )
8
+
9
+ var _ DataComponent = (* PotionContents )(nil )
10
+
11
+ type PotionContents struct {
12
+ PotionID pk.Option [pk.VarInt , * pk.VarInt ]
13
+ CustomColor pk.Option [pk.Int , * pk.Int ]
14
+ PotionEffects []any
15
+ }
16
+
17
+ // ID implements DataComponent.
18
+ func (PotionContents ) ID () string {
19
+ return "minecraft:potion_contents"
20
+ }
21
+
22
+ // ReadFrom implements DataComponent.
23
+ func (p * PotionContents ) ReadFrom (r io.Reader ) (n int64 , err error ) {
24
+ panic ("unimplemented" )
25
+ }
26
+
27
+ // WriteTo implements DataComponent.
28
+ func (p * PotionContents ) WriteTo (w io.Writer ) (n int64 , err error ) {
29
+ panic ("unimplemented" )
30
+ }
Original file line number Diff line number Diff line change
1
+ package component
2
+
3
+ import (
4
+ "io"
5
+ )
6
+
7
+ var _ DataComponent = (* SuspiciousStewEffects )(nil )
8
+
9
+ type SuspiciousStewEffects struct {
10
+ Effects []any
11
+ }
12
+
13
+ // ID implements DataComponent.
14
+ func (SuspiciousStewEffects ) ID () string {
15
+ return "minecraft:suspicious_stew_effects"
16
+ }
17
+
18
+ // ReadFrom implements DataComponent.
19
+ func (s * SuspiciousStewEffects ) ReadFrom (r io.Reader ) (n int64 , err error ) {
20
+ panic ("unimplemented" )
21
+ }
22
+
23
+ // WriteTo implements DataComponent.
24
+ func (s * SuspiciousStewEffects ) WriteTo (w io.Writer ) (n int64 , err error ) {
25
+ panic ("unimplemented" )
26
+ }
You can’t perform that action at this time.
0 commit comments