Files
2025-03-18 14:46:12 +08:00

154 lines
3.9 KiB
Markdown
Raw Permalink 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) | 告示牌的位置坐标 |
| dimensionId | int | 告示牌所在维度 |
| side | int | 设置 正/反 面的文本样式0表示正面1表示背面默认为正面 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| str | 告示牌上的文本内容 |
- 备注
- 当输入的坐标位置的方块不是告示牌的时候返回None
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
pos = (-1, 4, 34)
dimensionId = 0
text = comp.GetSignBlockText(pos, dimensionId)
print "GetSignBlockText text={}".format(text)
```
## GetSignTextStyle
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.component.blockEntityCompServer.BlockEntityCompServer
- 描述
获取告示牌的文本样式信息
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| pos | tuple(int,int,int) | 方块位置 |
| dimensionId | int | 方块所在维度 |
| side | int | 告示牌正/背面0表示正面1表示背面默认为正面 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| dict | 样式信息颜色rgba和发光格式{“color”:(flota,float,float,float),"lighting":bool} |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)
print comp.GetSignTextStyle((x, y, z), 0)
```
## 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 | 想要设置的文本内容 |
| dimensionId | int | 告示牌所在维度 |
| side | int | 设置 正/反 面的文本样式0表示正面1表示背面默认为正面 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否设置成功 |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)
pos = (-1, 4, 34)
dimensionId = 0
suc = comp.SetSignBlockText(pos, "文本内容", dimensionId)
print "SetSignBlockText suc={}".format(suc)
```
## SetSignTextStyle
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.component.blockEntityCompServer.BlockEntityCompServer
- 描述
设置告示牌的文本样式
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| pos | tuple(int,int,int) | 方块位置 |
| dimensionId | int | 方块所在维度 |
| color | tuple(float,float,float,float) | 颜色通道值(r, g, b, a) |
| lighting | bool | 是否发光,即是否显示被发光墨囊染色后的效果 |
| side | int | 设置 正/反 面的文本样式0表示正面1表示背面默认为正面 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否设置成功 |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)
print comp.SetSignTextStyle((x, y, z), 0, (0, 1, 0, 0.5), True)
```