---
sidebarDepth: 1
---
# 渲染
## GetAmbientBrightness
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
获取环境光亮度,影响天空亮度,不影响实体与方块光照
- 参数
无
- 返回值
|
数据类型
| 说明 |
| :--- | :--- |
| float | 范围0到1之间 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
ambineBrightness = comp.GetAmbientBrightness()
```
## GetFogColor
客户端
method in mod.client.component.fogCompClient.FogCompClient
- 描述
获取当前雾效颜色
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| tuple(float,float,float,float) | 颜色rgba |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateFog(levelId)
# 获取雾效颜色
fogColor = comp.GetFogColor()
```
## GetFogLength
客户端
method in mod.client.component.fogCompClient.FogCompClient
- 描述
获取雾效范围
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| tuple(float,float) | 雾效起始值与终点值 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateFog(levelId)
start,end = comp.GetFogLength()
```
## GetMoonRot
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
获取月亮角度
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| tuple(float,float,float) | 第一个float表示南北偏移,第二个float表示月亮的自旋角度,第三个float表示月升月落。单位为角度 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
rot = comp.GetMoonRot()
```
## GetSkyColor
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
获取天空颜色
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| tuple(float,float,float,float) | 颜色RGBA,0到1之间,目前a值暂时没用 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
color = comp.GetSkyColor()
```
## GetSkyTextures
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
获取当前维度天空盒贴图,天空盒共6张贴图
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| list(str)或None | 天空盒贴图列表,该值可能为None |
- 示例
```python
# 贴图列表按顺序分别对应世界坐标的 负Z轴方向, 正X轴方向,正Z轴方向,负X轴方向,正Y轴方向,负Y轴方向。 其中正Y轴即为上方(采用右手坐标系)。
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
textureList = comp.GetSkyTextures()
```
## GetStarBrightness
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
获取星星亮度
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| float | 范围0到1之间 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
starBrightness = comp.GetStarBrightness()
```
## GetSunRot
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
获取太阳角度
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| tuple(float,float,float) | 第一个float表示南北偏移,第二个float表示太阳的自旋角度,第三个float表示日升日落。单位为角度 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
rot = comp.GetSunRot()
```
## GetUseAmbientBrightness
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
判断是否在mod设置了环境光亮度
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 是否设置 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
useAmbientBrightness = comp.GetUseAmbientBrightness()
```
## GetUseFogColor
客户端
method in mod.client.component.fogCompClient.FogCompClient
- 描述
判断当前是否开启设置雾效颜色,该值默认为False,使用mod传入的颜色值后为True
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 是否设置 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateFog(levelId)
# 获取是否开启设置雾效颜色
useFogColor = comp.GetUseFogColor()
```
## GetUseFogLength
客户端
method in mod.client.component.fogCompClient.FogCompClient
- 描述
判断当前是否开启设置雾效范围,该值默认为False,使用mod传入的范围值后为True
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 是否设置 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateFog(levelId)
# 获取是否开启设置雾效范围
useFogLength = comp.GetUseFogLength()
```
## GetUseMoonRot
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
判断是否在mod设置了月亮角度
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 是否设置 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
useMoonRot = comp.GetUseMoonRot()
```
## GetUseSkyColor
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
判断是否在mod设置了天空颜色
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 是否设置 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
useSkyColor = comp.GetUseSkyColor()
```
## GetUseStarBrightness
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
判断是否在mod设置了星星亮度
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 是否设置 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
useStarBrightness = comp.GetUseStarBrightness()
```
## GetUseSunRot
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
判断是否在mod设置了太阳角度
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 是否设置 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
useSunRot = comp.GetUseSunRot()
```
## HideNameTag
客户端
method in mod.client.extraClientApi
- 描述
隐藏场景内所有名字显示,包括玩家名字,生物的自定义名称,物品展示框与命令方块的悬浮文本等
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| isHide | bool | 是否隐藏,True为隐藏,False为显示 |
- 返回值
无
- 示例
```python
import mod.client.extraClientApi as clientApi
clientApi.HideNameTag(True)
```
## ResetAmbientBrightness
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
重置环境光亮度
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
comp.ResetAmbientBrightness()
```
## ResetFogColor
客户端
method in mod.client.component.fogCompClient.FogCompClient
- 描述
重置雾效颜色
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateFog(levelId)
comp.ResetFogColor()
```
## ResetFogLength
客户端
method in mod.client.component.fogCompClient.FogCompClient
- 描述
重置雾效范围
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateFog(levelId)
comp.ResetFogLength()
```
## ResetMoonRot
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
重置月亮角度
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
comp.ResetMoonRot()
```
## ResetSkyColor
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
重置天空颜色
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
comp.ResetSkyColor()
```
## ResetSkyTextures
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
重置当前维度天空盒贴图。如果有使用addon配置贴图则会使用配置的贴图,否则为游戏内默认无贴图的情况
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
comp.ResetSkyTextures()
```
## ResetStarBrightness
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
重置星星亮度
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
comp.ResetStarBrightness()
```
## ResetSunRot
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
重置太阳角度
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
comp.ResetSunRot()
```
## SetAmbientBrightness
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
设置环境光亮度,影响天空亮度,不影响实体与方块光照
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| brightness | float | 范围0到1之间 |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
comp.SetAmbientBrightness(0.1)
```
## SetFogColor
客户端
method in mod.client.component.fogCompClient.FogCompClient
- 描述
设置雾效颜色
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| color | tuple(float,float,float,float) | 颜色RGBA,范围0到1之间,a值主要用于水下效果 |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateFog(levelId)
# 雾效设置为全白色
comp.SetFogColor((1.0,1.0,1.0,1.0))
```
## SetFogLength
客户端
method in mod.client.component.fogCompClient.FogCompClient
- 描述
设置雾效范围
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| start | float | 雾效起始距离 |
| end | float | 雾效终点范围 |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateFog(levelId)
comp.SetFogLength(10, 50)
```
## SetMoonRot
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
设置月亮所在角度
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| rot | tuple(float,float,float) | 第一个float表示南北偏移,第二个float表示月亮的自旋角度,第三个float表示月升月落。单位为角度 |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
comp.SetMoonRot((10, 0, 10))
```
## SetSkyColor
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
设置天空颜色
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| color | tuple(float,float,float,float) | 颜色RGBA,0到1之间,目前a值暂时没用 |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
comp.SetSkyColor((0.5, 0.5, 0.8, 1.0))
```
## SetSkyTextures
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
设置当前维度天空盒贴图,天空盒需要6张贴图
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| textureList | list(str) | 需要为6张贴图的路径,路径为从textures目录开始的绝对路径,如果天空盒某个方向不需要设置,则传空字符串 |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 备注
- 游戏内切dimension的时候会重设天空盒贴图,因此开发者需要监听对应的切换维度完成事件(DimensionChangeFinishClientEvent)进行贴图的处理。
- 示例
```python
# 贴图列表按顺序分别对应世界坐标的 负Z轴方向, 正X轴方向,正Z轴方向,负X轴方向,正Y轴方向,负Y轴方向。 其中正Y轴即为上方(采用右手坐标系)。
textureList = ['', 'textures/environment/positiveX','textures/environment/positiveZ', '', 'textures/environment/positiveY', '']
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
comp.SetSkyTextures(textureList)
```
## SetStarBrightness
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
设置星星亮度,白天也可以显示星星
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| brightness | float | 范围0到1之间 |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
comp.SetStarBrightness(0.1)
```
## SetSunRot
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
设置太阳所在角度
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| rot | tuple(float,float,float) | 第一个float表示南北偏移,第二个float表示太阳的自旋角度,第三个float表示日升日落。单位为角度 |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)
comp.SetSunRot((10, 0, 10))
```
## SkyTextures
客户端
method in mod.client.component.skyRenderCompClient.SkyRenderCompClient
- 描述
修改太阳、月亮、云层分布、天空盒的贴图。使用addon配置,非python接口。
- 参数
无
- 返回值
无
- 备注
- 游戏提供了重载贴图的方式来修改太阳、月亮、云层分布、天空盒的贴图。
**末地和下界没有太阳月亮和云层,另外末地的天空是用一张贴图end_sky.png而不是天空盒贴图,end_sky.png要结合雾效颜色使用。下界暂不支持此功能**。
具体路径为:
| 贴图 | 路径 |
| ------------ | ------------------------------------------------------------ |
| 太阳贴图 | modResource目录/textures/environment/{dimName}_sun.png |
| 月亮贴图 | modResource目录/textures/environment/{dimName}_moon_phases.png |
| 云层分布贴图 | modResource目录/textures/environment/{dimName}_clouds.png |
| 天空盒贴图 | modResource目录/textures/environment/{dimName}_cubemap/cubemap_0.png |
其中:天空盒贴图需要放6张图,即最后需要包含```cubemap_0.png```到```cubemap_5.png```,而```{dimName}```表示dimension的名称,各个dimension名称如下:
| dimension | 名称 |
| --------------------------- | --------------- |
| 末地 | theend |
| 下界 | nether |
| 上界 | overworld |
| 其他复制出来的dimension镜像 | 从3到20的数字id |
示例:
```json
modResource/textures/environment/4_sun.png
modResource/textures/environment/overworld_moon_phases.png
modResource/textures/environment/3_clouds.png
modResource/textures/environment/overworld_cubemap/cubemap_0.png # -z方向
modResource/textures/environment/overworld_cubemap/cubemap_1.png # x方向
modResource/textures/environment/overworld_cubemap/cubemap_2.png # z方向
modResource/textures/environment/overworld_cubemap/cubemap_3.png # -x方向
modResource/textures/environment/overworld_cubemap/cubemap_4.png # y方向
modResource/textures/environment/overworld_cubemap/cubemap_5.png # -y方向
modResource/textures/environment/end_sky.png #末地天空渲染贴图
```