Skip to content

Commit a5fbf35

Browse files
committed
Add item DataComponent implements (part 4)
1 parent 76ff3a8 commit a5fbf35

17 files changed

+519
-422
lines changed

level/component/blockentitydata.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
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-
}
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+
}

level/component/bucketentitydata.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
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-
}
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+
}

level/component/bundlecontents.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
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-
}
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+
}

level/component/chargedprojectiles.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
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-
}
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+
}

level/component/components.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,38 @@ func NewComponent(id int32) DataComponent {
6666
case 27:
6767
return new(MapDecorations)
6868
case 28:
69+
return new(MapPostProcessing)
6970
case 29:
71+
return new(ChargedProjectiles)
7072
case 30:
73+
return new(BundleContents)
7174
case 31:
75+
return new(PotionContents)
7276
case 32:
77+
return new(SuspiciousStewEffects)
7378
case 33:
79+
return new(WritableBookContent)
7480
case 34:
7581
case 35:
82+
return new(Trim)
7683
case 36:
84+
return new(DebugStickState)
7785
case 37:
86+
return new(EntityData)
7887
case 38:
88+
return new(BucketEntityData)
7989
case 39:
90+
return new(BlockEntityData)
8091
case 40:
92+
return new(Instrument)
8193
case 41:
94+
return new(OminousBottleAmplifier)
8295
case 42:
96+
return new(JukeboxPlayable)
8397
case 43:
8498
return new(Recipes)
8599
case 44:
100+
return new(LodestoneTracker)
86101
case 45:
87102
case 46:
88103
case 47:

level/component/debugstickstate.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
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-
}
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+
}

level/component/entitydata.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
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-
}
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+
}

0 commit comments

Comments
 (0)