package blocks

import (
	"edgaru089.ink/go/gl01/internal/util/itype"
	"edgaru089.ink/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) {}
