chunk example fix
This commit is contained in:
@ -20,7 +20,7 @@ import (
|
|||||||
// Note that Ary DO NOT read or write the Len. You are controlling it manually.
|
// Note that Ary DO NOT read or write the Len. You are controlling it manually.
|
||||||
type Ary struct {
|
type Ary struct {
|
||||||
Len interface{} // Value or Pointer of any integer type, only needed in ReadFrom
|
Len interface{} // Value or Pointer of any integer type, only needed in ReadFrom
|
||||||
Ary interface{} // Slice of FieldEncoder, FieldDecoder or both (Field)
|
Ary interface{} // Slice or Pointer of Slice of FieldEncoder, FieldDecoder or both (Field)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a Ary) WriteTo(r io.Writer) (n int64, err error) {
|
func (a Ary) WriteTo(r io.Writer) (n int64, err error) {
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"github.com/Tnze/go-mc/data/packetid"
|
"github.com/Tnze/go-mc/data/packetid"
|
||||||
pk "github.com/Tnze/go-mc/net/packet"
|
pk "github.com/Tnze/go-mc/net/packet"
|
||||||
"github.com/Tnze/go-mc/save/region"
|
"github.com/Tnze/go-mc/save/region"
|
||||||
"math/rand"
|
|
||||||
"testing"
|
"testing"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
@ -41,8 +40,8 @@ func BenchmarkColumn_Load(b *testing.B) {
|
|||||||
defer r.Close()
|
defer r.Close()
|
||||||
|
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
//x, y := (i%1024)/32, (i%1024)%32
|
x, y := (i%1024)/32, (i%1024)%32
|
||||||
x, y := rand.Intn(32), rand.Intn(32)
|
//x, y := rand.Intn(32), rand.Intn(32)
|
||||||
|
|
||||||
data, err := r.ReadSector(x, y)
|
data, err := r.ReadSector(x, y)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -117,7 +116,7 @@ func ExampleColumn_send() {
|
|||||||
pk.NBT(c.Level.Heightmaps), // Heightmaps
|
pk.NBT(c.Level.Heightmaps), // Heightmaps
|
||||||
bal, pk.Ary{
|
bal, pk.Ary{
|
||||||
Len: bal, // Biomes array length
|
Len: bal, // Biomes array length
|
||||||
Ary: c.Level.Biomes, // Biomes
|
Ary: *(*[]pk.VarInt)(unsafe.Pointer(&c.Level.Biomes)), // Biomes
|
||||||
},
|
},
|
||||||
size, pk.Ary{
|
size, pk.Ary{
|
||||||
Len: size, // Size
|
Len: size, // Size
|
||||||
|
Reference in New Issue
Block a user