MCPcopy Create free account
hub / github.com/ZeppelinMC/Zeppelin / Attribute

Method Attribute

server/entity/entity.go:54–72  ·  view source on GitHub ↗
(id string)

Source from the content-addressed store, hash-verified

52}
53
54func (p *Entity) Attribute(id string) *Attribute {
55 p.attr_mu.Lock()
56 defer p.attr_mu.Unlock()
57 i := slices.IndexFunc(p.attributes, func(att Attribute) bool { return att.Id == id })
58 if i == -1 {
59 attr, ok := DefaultAttributes[id]
60 if !ok {
61 return nil
62 }
63 a := Attribute{
64 Id: id,
65 Base: attr,
66 }
67 p.attributes = append(p.attributes, a)
68 return &a
69 }
70 attr := &p.attributes[i]
71 return attr
72}
73
74// Attributes returns a clone of the attributes of this state
75func (p *Entity) Attributes() []Attribute {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected