Skip to content

Commit

Permalink
world/world.go: Updated and cleaned up documentation.
Browse files Browse the repository at this point in the history
Also removed/resolved some TODOs.
  • Loading branch information
Sandertv committed Nov 23, 2024
1 parent 22913b5 commit 2f26ce2
Show file tree
Hide file tree
Showing 5 changed files with 220 additions and 191 deletions.
1 change: 0 additions & 1 deletion server/block/stairs_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
// encodeStairsBlock encodes the provided block in to an identifier and meta value that can be used to encode the stairs.
func encodeStairsBlock(block world.Block) string {
switch block := block.(type) {
// TODO: Copper
case Andesite:
if block.Polished {
return "polished_andesite"
Expand Down
2 changes: 0 additions & 2 deletions server/player/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ func (p *Player) Locale() language.Tag {
// handlers of the Handler passed.
// Handle sets the player's Handler to NopHandler if nil is passed.
func (p *Player) Handle(h Handler) {
// TODO: Decide where handlers go!
if h == nil {
h = NopHandler{}
}
Expand Down Expand Up @@ -2954,7 +2953,6 @@ func (p *Player) useContext() *item.UseContext {

// Handler returns the Handler of the player.
func (p *Player) Handler() Handler {
// TODO: Figure out handlers.
return p.h
}

Expand Down
2 changes: 1 addition & 1 deletion server/session/handler_container_close.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (h *ContainerCloseHandler) Handle(p packet.Packet, s *Session, tx *world.Tx
case byte(s.openedWindowID.Load()):
s.closeCurrentContainer(tx)
case 0xff:
// TODO: H closing the crafting grid.
// TODO: Handle closing the crafting grid.
default:
return fmt.Errorf("unexpected close request for unopened container %v", pk.WindowID)
}
Expand Down
5 changes: 5 additions & 0 deletions server/world/block_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ type BlockSource interface {
// Block returns the block at the given position in the block source.
Block(cube.Pos) Block
}

// worldSource is a wrapper around a World that implements BlockSource.
type worldSource struct{ w *World }

func (w worldSource) Block(pos cube.Pos) Block { return w.w.block(pos) }
Loading

0 comments on commit 2f26ce2

Please sign in to comment.