github.com/df-mc/dragonfly@v0.9.13/server/block/model/lantern.go (about)

     1  package model
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/block/cube"
     5  	"github.com/df-mc/dragonfly/server/world"
     6  )
     7  
     8  // Lantern is a model for the lantern block. It can be placed on the ground or hanging from the ceiling.
     9  type Lantern struct {
    10  	// Hanging specifies if the lantern is hanging from a block or if it's placed on the ground.
    11  	Hanging bool
    12  }
    13  
    14  // BBox returns a physics.BBox attached to either the ceiling or to the ground.
    15  func (l Lantern) BBox(cube.Pos, *world.World) []cube.BBox {
    16  	if l.Hanging {
    17  		return []cube.BBox{cube.Box(0.3125, 0.125, 0.3125, 0.6875, 0.625, 0.6875)}
    18  	}
    19  	return []cube.BBox{cube.Box(0.3125, 0, 0.3125, 0.6875, 0.5, 0.6875)}
    20  }
    21  
    22  // FaceSolid always returns false.
    23  func (l Lantern) FaceSolid(cube.Pos, cube.Face, *world.World) bool {
    24  	return false
    25  }