Files
netease-modsdk-wiki/docs/mcdocs/1-ModAPI/接口/方块/红石.md
2025-03-17 13:24:39 +08:00

75 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
sidebarDepth: 1
---
# 红石
## GetBlockPoweredState
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.component.redStoneCompServer.RedStoneComponentServer
- 描述
获取某个坐标方块的充能状态
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| pos | tuple(float,float,float) | 方块坐标位置 |
| dimensionId | int | 目标维度 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| int | 充能状态 0:未充能1弱充能2强充能 |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateRedStone(levelId)
comp.GetBlockPoweredState((1,1,1), 0)
```
## GetStrength
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.component.redStoneCompServer.RedStoneComponentServer
- 描述
获取某个坐标的红石信号强度
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| pos | tuple(float,float,float) | 坐标位置 |
| dimensionId | int | 目标维度 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| int | 红石信号强度[0, 15] |
- 备注
- 可获取对应维度的常加载区块内红石信号强度
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateRedStone(levelId)
comp.GetStrength((1,1,1), 0)
```