gl01/internal/world/blocks/water.go
2022-02-24 20:20:33 +08:00

39 lines
1.2 KiB
Go

package blocks
import (
"edgaru089.ml/go/gl01/internal/util/itype"
"edgaru089.ml/go/gl01/internal/world"
)
type WaterBehaviour struct{}
func (WaterBehaviour) Static() bool { return false }
func (WaterBehaviour) RequireDataset() bool { return false }
func (WaterBehaviour) RequireBlockUpdate() bool { return false }
func (WaterBehaviour) Appearance(position itype.Vec3i, aux int, data itype.Dataset, w *world.World) world.BlockAppearance {
return world.BlockAppearance{
Name: "water",
Transparent: true,
NotSolid: true,
RenderType: world.CustomRendering,
CustomRenderAppend: func(
position itype.Vec3i,
aux int,
data itype.Dataset,
w *world.World,
vertexArray []world.Vertex, vertsWater []world.Vertex) (verts, waters []world.Vertex) {
if block := w.Block(position.Addv(0, 1, 0)); block.Id != Water {
return vertexArray, appendFace(itype.YPlus, position, "water.png", itype.Vec3f{0, -0.125, 0}, vertsWater)
}
return vertexArray, vertsWater
},
}
}
func (WaterBehaviour) BlockUpdate(position itype.Vec3i, aux int, data itype.Dataset, w *world.World) bool {
return false
}
func (WaterBehaviour) Break(position itype.Vec3i, aux int, data itype.Dataset, w *world.World) {}