github.com/df-mc/dragonfly@v0.9.13/server/world/block_model.go (about)

     1  package world
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/block/cube"
     5  )
     6  
     7  // BlockModel represents the model of a block. These models specify the ways a block can be collided with and
     8  // whether specific faces are solid wrt. being able to, for example, place torches onto those sides.
     9  type BlockModel interface {
    10  	// BBox returns the bounding boxes that a block with this model can be collided with.
    11  	BBox(pos cube.Pos, w *World) []cube.BBox
    12  	// FaceSolid checks if a specific face of a block at the position in a world passed is solid. Blocks may
    13  	// be attached to these faces.
    14  	FaceSolid(pos cube.Pos, face cube.Face, w *World) bool
    15  }
    16  
    17  // unknownModel is the model used for unknown blocks. It is the equivalent of a fully solid model.
    18  type unknownModel struct{}
    19  
    20  // BBox ...
    21  func (u unknownModel) BBox(cube.Pos, *World) []cube.BBox {
    22  	return []cube.BBox{cube.Box(0, 0, 0, 1, 1, 1)}
    23  }
    24  
    25  // FaceSolid ...
    26  func (u unknownModel) FaceSolid(cube.Pos, cube.Face, *World) bool {
    27  	return true
    28  }