Skip to content

Commit

Permalink
switched to nbt for blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
aimjel committed Oct 16, 2023
1 parent 0542a31 commit 76e2dda
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 241,098 deletions.
26 changes: 5 additions & 21 deletions server/block/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ type Block interface {
}

func GetBlock(name string) Block {
if b, ok := registeredBlocks[name]; ok {
return b
}

return &UnknownBlock{encodedName: name}
}

func GetBlockId(b Block) (int, bool) {
block := jsonBlocks[b.EncodedName()]
block := blocks[b.EncodedName()]

for _, state := range block.States {
//if reflect.DeepEqual(state.Properties, b.Properties()) {
// return state.Id, true
//}

if eq(state.Properties, b.Properties()) {
return state.Id, true
Expand All @@ -40,20 +41,3 @@ func eq(a, b map[string]string) bool {

return true
}

type UnknownBlock struct {
encodedName string
properties map[string]string
}

func (u UnknownBlock) EncodedName() string {
return u.encodedName
}

func (u UnknownBlock) New(m map[string]string) Block {
return UnknownBlock{encodedName: u.encodedName, properties: m}
}

func (u UnknownBlock) Properties() map[string]string {
return u.properties
}
6 changes: 0 additions & 6 deletions server/block/block_test.go

This file was deleted.

Loading

0 comments on commit 76e2dda

Please sign in to comment.