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

78 lines
1.7 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
---
# 告示牌
## GetSignBlockText
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer
- 描述
获取告示牌(方块)的文本内容
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| pos | tuple(int,int,int) | 告示牌的位置坐标 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| str | 告示牌上的文本内容 |
- 备注
- 当输入的坐标位置的方块不是告示牌的时候返回None
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)
pos = (-1, 4, 34)
text = comp.GetSignBlockText(pos)
print "GetSignBlockText text={}".format(text)
```
## SetSignBlockText
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer
- 描述
设置告示牌(方块)的文本内容
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| pos | tuple(int,int,int) | 告示牌的位置坐标 |
| text | str | 想要设置的文本内容 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否设置成功 |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)
pos = (-1, 4, 34)
suc = comp.SetSignBlockText(pos, "文本内容")
print "SetSignBlockText suc={}".format(suc)
```