place blocks

This commit is contained in:
2022-02-24 20:20:33 +08:00
parent 9195dd7c3f
commit 32b06810e2
17 changed files with 309 additions and 55 deletions

View File

@ -64,6 +64,7 @@ func NewEntity(typename string, pos itype.Vec3d) *Entity {
b: b,
pos: pos,
name: typename,
ds: make(itype.Dataset),
}
}
@ -106,3 +107,29 @@ func (e *Entity) EyeHeight() float64 {
func (e *Entity) EyePosition() itype.Vec3d {
return e.pos.Addv(0, e.EyeHeight(), 0)
}
func (e *Entity) DatasetI(name string) int64 {
return e.ds[name].(int64)
}
func (e *Entity) DatasetF(name string) float64 {
return e.ds[name].(float64)
}
func (e *Entity) DatasetS(name string) string {
return e.ds[name].(string)
}
func (e *Entity) DatasetB(name string) bool {
return e.ds[name].(bool)
}
func (e *Entity) SetDatasetI(name string, val int64) {
e.ds[name] = val
}
func (e *Entity) SetDatasetF(name string, val float64) {
e.ds[name] = val
}
func (e *Entity) SetDatasetS(name string, val string) {
e.ds[name] = val
}
func (e *Entity) SetDatasetB(name string, val bool) {
e.ds[name] = val
}