github.com/df-mc/dragonfly@v0.9.13/server/block/model/fence_gate.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 // FenceGate is a model used by fence gates. The model is completely zero-ed when the FenceGate is opened. 9 type FenceGate struct { 10 // Facing is the facing direction of the FenceGate. A fence gate can only be opened in this direction or the 11 // direction opposite to it. 12 Facing cube.Direction 13 // Open specifies if the FenceGate is open. In this case, BBox returns an empty slice. 14 Open bool 15 } 16 17 // BBox returns up to one physics.BBox depending on the facing direction of the FenceGate and whether it is open. 18 func (f FenceGate) BBox(cube.Pos, *world.World) []cube.BBox { 19 if f.Open { 20 return nil 21 } 22 return []cube.BBox{cube.Box(0, 0, 0, 1, 1.5, 1).Stretch(f.Facing.Face().Axis(), -0.375)} 23 } 24 25 // FaceSolid always returns false. 26 func (f FenceGate) FaceSolid(cube.Pos, cube.Face, *world.World) bool { 27 return false 28 }