-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathblocks.go
34 lines (28 loc) · 902 Bytes
/
blocks.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package palette
import (
"github.com/df-mc/dragonfly/server/world"
"io"
)
// Blocks is a Palette that exists out of a slice of world.Block. It is a static palette in the sense that the
// blocks returned in the Blocks method do not change.
type Blocks struct {
b []world.Block
}
// NewBlocks creates a Blocks palette that returns the blocks passed in the Blocks method.
func NewBlocks(b []world.Block) Blocks {
return Blocks{b: b}
}
// Read reads a Blocks palette from an io.Reader.
func Read(r io.Reader) (Blocks, error) {
// TODO: Implement palette reading.
return Blocks{}, nil
}
// Write writes a Blocks palette to an io.Writer.
func (b Blocks) Write(w io.Writer) error {
// TODO: Implement palette writing.
return nil
}
// Blocks returns all world.Block passed to the NewBlocks function upon creation of the palette.
func (b Blocks) Blocks(_ *world.Tx) []world.Block {
return b.b
}