2.6
This commit is contained in:
@@ -107,6 +107,39 @@ result = comp.Get('query.mod.state')
|
||||
|
||||
|
||||
|
||||
## GetAllProperties
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.queryVariableCompServer.QueryVariableComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取实体属性列表
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| tuple(str) | 所有已注册properties,每个str为properties的名称,如果有错误,返回None |
|
||||
|
||||
- 备注
|
||||
- 可配合query.property,使用EvalMolangExpression获取实体属性的值。在客户端只能获取到client_sync为true的属性
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateQueryVariable(entityId)
|
||||
result = comp.GetAllProperties()
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetMolangValue
|
||||
|
||||
<span style="display:inline;color:#7575f9">客户端</span>
|
||||
@@ -251,6 +284,42 @@ result = comp.Set('query.mod.state', 1.0)
|
||||
|
||||
|
||||
|
||||
## SetPropertyValue
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.queryVariableCompServer.QueryVariableComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置实体属性的值
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| propertyName | str | 属性名,如minecraft:has_nectar |
|
||||
| value | str/int/float/bool | 属性值支持int/float/bool/enum(str),支持molang表达式 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否执行成功 |
|
||||
|
||||
- 备注
|
||||
- molang表达式需无副作用, 例如不能设置molang变量的值,例如"variable.moo = 1;return variable.moo;"。query仅支持query.has_property、query.property
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateQueryVariable(entityId)
|
||||
result = comp.SetPropertyValue('minecraft:has_nectar', True)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## UnRegister
|
||||
|
||||
<span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
@@ -320,10 +320,12 @@ sidebarDepth: 1
|
||||
| [EvalMolangExpression](molang.md#evalmolangexpression) | <span style="display:inline;color:#ff5555">服务端</span> | 在实体上下文上执行molang表达式 |
|
||||
| [EvalMolangExpression](molang.md#evalmolangexpression) | <span style="display:inline;color:#7575f9">客户端</span> | 在实体上下文上执行molang表达式 |
|
||||
| [Get](molang.md#get) | <span style="display:inline;color:#7575f9">客户端</span> | 获取某一个实体计算节点的值,如果不存在返回注册时的默认值 |
|
||||
| [GetAllProperties](molang.md#getallproperties) | <span style="display:inline;color:#ff5555">服务端</span> | 获取实体属性列表 |
|
||||
| [GetMolangValue](molang.md#getmolangvalue) | <span style="display:inline;color:#7575f9">客户端</span> | 获取实体molang变量的值 |
|
||||
| [GetStringHash64](molang.md#getstringhash64) | <span style="display:inline;color:#7575f9">客户端</span> | 返回字符串变量的hash64 |
|
||||
| [Register](molang.md#register) | <span style="display:inline;color:#7575f9">客户端</span> | 注册实体计算节点 |
|
||||
| [Set](molang.md#set) | <span style="display:inline;color:#7575f9">客户端</span> | 设置某一个实体计算节点的值 |
|
||||
| [SetPropertyValue](molang.md#setpropertyvalue) | <span style="display:inline;color:#ff5555">服务端</span> | 设置实体属性的值 |
|
||||
| [UnRegister](molang.md#unregister) | <span style="display:inline;color:#7575f9">客户端</span> | 注销实体计算节点 |
|
||||
|
||||
### 标签
|
||||
|
||||
@@ -2383,6 +2383,7 @@ method in mod.server.component.attrCompServer.AttrCompServer
|
||||
- 为了避免因浮点数误差导致错误,设置的时候通常会增加1/16个方块大小,即0.0625。所以此处我们设置2.0625。游戏中默认值是0.5625,即半格高度。
|
||||
- 只对玩家生效,无法修改其它实体该属性
|
||||
- 修改后不影响跳跃逻辑及跳跃高度,并不会因此而跳到更高,因此在某些特定情况下,你可以走上方块但跳不上去。
|
||||
- 设置的步长值较大时,可能会存在可以跨到方块顶部,却走不到方块中间空隙的特殊情况。
|
||||
|
||||
- 示例
|
||||
|
||||
|
||||
Reference in New Issue
Block a user