github.com/df-mc/dragonfly@v0.9.13/server/block/model/cake.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 // Cake is a model used by cake blocks. 9 type Cake struct { 10 // Bites is the amount of bites that were taken from the cake. A cake can have up to 7 bites taken from it, before 11 // being consumed entirely. 12 Bites int 13 } 14 15 // BBox returns an BBox with a size that depends on the amount of bites taken. 16 func (c Cake) BBox(cube.Pos, *world.World) []cube.BBox { 17 return []cube.BBox{cube.Box(0.0625, 0, 0.0625, 0.9375, 0.5, 0.9375). 18 ExtendTowards(cube.FaceWest, -(float64(c.Bites) / 8))} 19 } 20 21 // FaceSolid always returns false. 22 func (c Cake) FaceSolid(cube.Pos, cube.Face, *world.World) bool { 23 return false 24 }