Skip to content

Commit

Permalink
world/block.go: Document math.MaxUint64 usage
Browse files Browse the repository at this point in the history
  • Loading branch information
TwistedAsylumMC committed Sep 3, 2024
1 parent 82db357 commit 6e71a3e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server/world/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func finaliseBlockRegistry() {
for rid, b := range blocks {
finaliseBlock(uint32(rid), b)
if b.Hash() != math.MaxUint64 {
// b is not an unknownBlock.
h := int64(BlockHash(b))
if other, ok := hashes.Get(h); ok {
panic(fmt.Sprintf("block %#v with hash %v already registered by %#v", b, h, blocks[other]))
Expand Down Expand Up @@ -181,6 +182,7 @@ func BlockRuntimeID(b Block) uint32 {
return airRID
}
if h := BlockHash(b); h != math.MaxUint64 {
// b is not an unknownBlock.
if rid, ok := hashes.Get(int64(h)); ok {
return uint32(rid)
}
Expand Down

0 comments on commit 6e71a3e

Please sign in to comment.