gl01/internal/world/blocks/water.go

39 lines
1.2 KiB
Go
Raw Normal View History

2022-01-28 15:24:03 +08:00
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 {
2022-01-28 15:24:03 +08:00
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) {
2022-01-28 15:24:03 +08:00
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)
2022-01-28 15:24:03 +08:00
}
return vertexArray, vertsWater
2022-01-28 15:24:03 +08:00
},
}
}
func (WaterBehaviour) BlockUpdate(position itype.Vec3i, aux int, data itype.Dataset, w *world.World) bool {
return false
}
2022-02-24 20:20:33 +08:00
func (WaterBehaviour) Break(position itype.Vec3i, aux int, data itype.Dataset, w *world.World) {}