Skip to content

Commit

Permalink
remove unused item/inventory types
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Sep 3, 2024
1 parent 57a4f76 commit 1b50e94
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 106 deletions.
20 changes: 0 additions & 20 deletions inventory.go

This file was deleted.

12 changes: 0 additions & 12 deletions item.go

This file was deleted.

37 changes: 22 additions & 15 deletions mapblock.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@ package types
import "fmt"

type MapBlock struct {
Size int `json:"size"`
Version byte `json:"version"`
Underground bool `json:"underground"`
AirOnly bool `json:"air_only"`
Timestamp uint32 `json:"timestamp"`
Mapdata *MapData `json:"mapdata"`
Metadata *Metadata `json:"metadata"`
Size int `json:"size"`
Version byte `json:"version"`
Underground bool `json:"underground"`
AirOnly bool `json:"air_only"`
Timestamp uint32 `json:"timestamp"`
ContentId []int `json:"contentid"`
Param1 []int `json:"param1"`
Param2 []int `json:"param2"`
// index -> inventory-map
Inventory map[int]map[string][]string `json:"inventory"`
// index -> fields
Fields map[int]map[string]string `json:"fields"`
// nodeid -> nodename
BlockMapping map[int]string `json:"blockmapping"`
}

func NewMapblock() *MapBlock {
mb := MapBlock{}
mb.Metadata = NewMetadata()
mb.Inventory = make(map[int]map[string][]string)
mb.Fields = make(map[int]map[string]string)
mb.BlockMapping = make(map[int]string)
return &mb
}
Expand All @@ -26,11 +33,11 @@ func (mb *MapBlock) IsEmpty() bool {
}

func (mb *MapBlock) GetNodeId(p *Pos) int {
return mb.Mapdata.ContentId[p.Index()]
return mb.ContentId[p.Index()]
}

func (mb *MapBlock) GetParam2(p *Pos) int {
return mb.Mapdata.Param2[p.Index()]
return mb.Param2[p.Index()]
}

func (mb *MapBlock) GetNodeName(p *Pos) string {
Expand All @@ -41,14 +48,14 @@ func (mb *MapBlock) GetNodeName(p *Pos) string {
func (mb *MapBlock) GetNode(p *Pos) (*Node, error) {
i := p.Index()

if i > len(mb.Mapdata.ContentId) {
return nil, fmt.Errorf("unexpected index, got %d, len: %d, pos: %s", i, len(mb.Mapdata.ContentId), p)
if i > len(mb.ContentId) {
return nil, fmt.Errorf("unexpected index, got %d, len: %d, pos: %s", i, len(mb.ContentId), p)
}

return &Node{
Pos: p,
Name: mb.BlockMapping[mb.Mapdata.ContentId[i]],
Param1: mb.Mapdata.Param1[i],
Param2: mb.Mapdata.Param2[i],
Name: mb.BlockMapping[mb.ContentId[i]],
Param1: mb.Param1[i],
Param2: mb.Param2[i],
}, nil
}
7 changes: 0 additions & 7 deletions mapdata.go

This file was deleted.

52 changes: 0 additions & 52 deletions metadata.go

This file was deleted.

0 comments on commit 1b50e94

Please sign in to comment.