Move to new block dataset
This commit is contained in:
@ -3,7 +3,8 @@ package world
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Tnze/go-mc/data"
|
|
||||||
|
"github.com/Tnze/go-mc/data/block"
|
||||||
pk "github.com/Tnze/go-mc/net/packet"
|
pk "github.com/Tnze/go-mc/net/packet"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ func perBits(BitsPerBlock byte) int {
|
|||||||
case BitsPerBlock < 9:
|
case BitsPerBlock < 9:
|
||||||
return int(BitsPerBlock)
|
return int(BitsPerBlock)
|
||||||
default:
|
default:
|
||||||
return data.BitsPerBlock // DefaultBitsPerBlock
|
return block.BitsPerBlock
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"math/rand"
|
"math/rand"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Tnze/go-mc/data"
|
"github.com/Tnze/go-mc/data/block"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newDirectSection(bpb int) Section {
|
func newDirectSection(bpb int) Section {
|
||||||
@ -15,7 +15,7 @@ func newDirectSection(bpb int) Section {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDirectSection(t *testing.T) {
|
func TestDirectSection(t *testing.T) {
|
||||||
for bpb := 4; bpb <= data.BitsPerBlock; bpb++ {
|
for bpb := 4; bpb <= block.BitsPerBlock; bpb++ {
|
||||||
testSection(newDirectSection(bpb), bpb)(t)
|
testSection(newDirectSection(bpb), bpb)(t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ func TestDirectSection_clone(t *testing.T) {
|
|||||||
for i := 0; i < 16*16*16; i++ {
|
for i := 0; i < 16*16*16; i++ {
|
||||||
s.SetBlock(i, dataset[i])
|
s.SetBlock(i, dataset[i])
|
||||||
}
|
}
|
||||||
s = s.(*directSection).clone(data.BitsPerBlock)
|
s = s.(*directSection).clone(block.BitsPerBlock)
|
||||||
for i := 0; i < 16*16*16; i++ {
|
for i := 0; i < 16*16*16; i++ {
|
||||||
if s := s.GetBlock(i); dataset[i] != s {
|
if s := s.GetBlock(i); dataset[i] != s {
|
||||||
t.Fatalf("direct section error: want: %v, get %v", dataset[i], s)
|
t.Fatalf("direct section error: want: %v, get %v", dataset[i], s)
|
||||||
|
110053
data/blocks.go
110053
data/blocks.go
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user