block state

This commit is contained in:
adman
2026-03-06 21:24:08 +01:00
parent 5dfd8fc499
commit 73d4e07b06
5 changed files with 167 additions and 27 deletions
+18
View File
@@ -14,3 +14,21 @@ func TestLookupBlockByStateId(t *testing.T) {
}
fmt.Println(b)
}
func TestBlockStates(t *testing.T) {
var stateId int32 = 8301
b, stateMap, err := data.FromBlockState("1.21.8", stateId)
if err != nil {
t.Fatal(err)
return
}
t.Logf("Block state map: %v, block: %v", stateMap, b.Name)
stateId2, err := b.IdFromStateMap(stateMap)
if err != nil {
t.Fatal(err)
return
}
if stateId2 != stateId {
t.Fatal("state id mismatch")
}
}