first commit
This commit is contained in:
1426
docs/mcdocs/1-ModAPI/接口/世界/地图.md
Normal file
1426
docs/mcdocs/1-ModAPI/接口/世界/地图.md
Normal file
File diff suppressed because it is too large
Load Diff
338
docs/mcdocs/1-ModAPI/接口/世界/天气.md
Normal file
338
docs/mcdocs/1-ModAPI/接口/世界/天气.md
Normal file
@@ -0,0 +1,338 @@
|
||||
---
|
||||
sidebarDepth: 1
|
||||
---
|
||||
# 天气
|
||||
|
||||
## GetDimensionLocalWeatherInfo
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.weatherCompServer.WeatherComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取独立维度天气信息(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气)
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimension | int | 维度id |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| dict | 独立维度天气信息(下雨强度,下雨时间,打雷强度,打雷时间,是否开启天气循环) |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateWeather(levelId)
|
||||
comp.GetDimensionLocalWeatherInfo(0)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetDimensionUseLocalWeather
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.weatherCompServer.WeatherComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取某个维度是否拥有自己的天气规则
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimension | int | 维度id |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否使用了独立天气规则 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateWeather(levelId)
|
||||
comp.GetDimensionUseLocalWeather(0)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## IsRaining
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.weatherCompServer.WeatherComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取是否下雨
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否下雨 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateWeather(levelId)
|
||||
comp.IsRaining()
|
||||
```
|
||||
|
||||
|
||||
|
||||
## IsThunder
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.weatherCompServer.WeatherComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取是否打雷
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否打雷 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateWeather(levelId)
|
||||
comp.IsThunder()
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetDimensionLocalDoWeatherCycle
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.weatherCompServer.WeatherComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置某个维度是否开启天气循环(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气)
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimension | int | 维度id |
|
||||
| value | bool | 是否开启天气循环 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否设置成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateWeather(levelId)
|
||||
comp.SetDimensionLocalDoWeatherCycle(0, True)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetDimensionLocalRain
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.weatherCompServer.WeatherComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置某个维度下雨(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气)
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimension | int | 维度id |
|
||||
| rainLevel | float | 下雨强度,范围0-1 |
|
||||
| rainTime | int | 下雨的持续时间,单位为帧,一秒20帧。持续时间结束后会自动转换为相反的天气 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否设置成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateWeather(levelId)
|
||||
comp.SetDimensionLocalRain(0, 0.5, 180)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetDimensionLocalThunder
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.weatherCompServer.WeatherComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置某个维度打雷(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气)
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimension | int | 维度id |
|
||||
| thunderLevel | float | 打雷强度,范围0-1 |
|
||||
| thunderTime | int | 打雷的持续时间,单位为帧,一秒20帧。持续时间结束后会自动转换为相反的天气 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否设置成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateWeather(levelId)
|
||||
comp.SetDimensionLocalThunder(0, 0.5, 180)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetDimensionUseLocalWeather
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.weatherCompServer.WeatherComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置某个维度拥有自己的天气规则,开启后该维度可以拥有与其他维度不同的天气和天气更替的规则
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimension | int | 维度id |
|
||||
| value | bool | 是否开启独立天气 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否成功 |
|
||||
|
||||
- 备注
|
||||
- 我们对主世界以及自定义维度新增了“局部天气”的概念。在此之前,所有的维度会共享一个“全局天气”,即设置天气或天气循环规则时,会对所有维度生效。
|
||||
现在,我们可以将某个维度使用局部天气规则,并且单独设置它的下雨强度,下雨时间,打雷强度,打雷时间,是否开启天气循环(见[SetDimensionLocalRain](#setdimensionlocalrain)、[SetDimensionLocalThunder](#setdimensionlocalthunder)、[SetDimensionLocalDoWeatherCycle](#setdimensionlocaldoweathercycle))。
|
||||
在下文中,我们会将使用局部天气规则的维度称为“局部维度”,而使用全局天气的维度称为“全局维度”。默认情况下,维度都是全局维度。
|
||||
原版的weather指令,接口[SetRaining](#setraining)、[SetThunder](#setthunder)均不会对局部维度产生影响
|
||||
- 启用局部天气规则时,默认继承全局的天气强度和时间,局部维度天气循环默认开启
|
||||
- 天气规则对原版的下界与末地无效,这两个维度并没有天气系统
|
||||
- 建议统一在游戏启动时调用
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateWeather(levelId)
|
||||
comp.SetDimensionUseLocalWeather(0, True)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetRaining
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.weatherCompServer.WeatherComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置是否下雨
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| level | float | 下雨强度,范围为0-1 |
|
||||
| time | int | 天气的持续时间,单位为帧,一秒20帧。持续时间结束后会自动转换为相反的天气。注意,需要在游戏设置中开启天气更替后该参数才会生效。 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置是否成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateWeather(levelId)
|
||||
comp.SetRaining(0.5,1000)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetThunder
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.weatherCompServer.WeatherComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置是否打雷
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| level | float | 打雷强度,范围为0-1 |
|
||||
| time | int | 打雷持续时间,单位为帧,一秒20帧。注意,需要在游戏设置中开启天气更替后该参数才会生效。 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置是否成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateWeather(levelId)
|
||||
comp.SetThunder(0.5,1000)set_lightning
|
||||
```
|
||||
|
||||
|
||||
|
||||
688
docs/mcdocs/1-ModAPI/接口/世界/实体管理.md
Normal file
688
docs/mcdocs/1-ModAPI/接口/世界/实体管理.md
Normal file
@@ -0,0 +1,688 @@
|
||||
---
|
||||
sidebarDepth: 1
|
||||
---
|
||||
# 实体管理
|
||||
|
||||
## CreateEngineEntityByTypeStr
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.system.serverSystem.ServerSystem
|
||||
|
||||
- 描述
|
||||
|
||||
创建指定identifier的实体
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| engineTypeStr | str | 实体identifier,例如'minecraft:husk' |
|
||||
| pos | tuple(float,float,float) | 生成坐标 |
|
||||
| rot | tuple(float,float) | 生物面向 |
|
||||
| dimensionId | int | 生成的维度,默认值为0(0为主世界,1为地狱,2为末地) |
|
||||
| isNpc | bool | 是否为npc,默认值为False。npc不会移动、转向、存盘。 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| str或None | 实体Id或者None |
|
||||
|
||||
- 备注
|
||||
- 在未加载的chunk无法创建
|
||||
生成村民请使用"minecraft:villager_v2"
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
ServerSystem = serverApi.GetServerSystemCls()
|
||||
class MyServerSystem(ServerSystem):
|
||||
def createMob(self):
|
||||
# 在主世界(0,5,0)的位置创建一个朝向为(0, 0)的尸壳
|
||||
entityId = self.CreateEngineEntityByTypeStr('minecraft:husk', (0, 5, 0), (0, 0), 0)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## CreateEngineItemEntity
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.system.serverSystem.ServerSystem
|
||||
|
||||
- 描述
|
||||
|
||||
用于创建物品实体(即掉落物),返回物品实体的entityId
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| itemDict | dict | <a href="../../../../mcguide/20-玩法开发/10-基本概念/1-我的世界基础概念.html#物品信息字典#物品信息字典">物品信息字典</a> |
|
||||
| dimensionId | int | 设置dimension,默认为主世界 |
|
||||
| pos | tuple(float,float,float) | 生成坐标 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| str或None | 实体Id或者None |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
itemDict = {
|
||||
'itemName': 'minecraft:bow',
|
||||
'count': 1,
|
||||
'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],
|
||||
'auxValue': 0,
|
||||
'customTips':'§c new item §r',
|
||||
'extraId': 'abc',
|
||||
'userData': { 'color': { '__type__':8, '__value__':'gray'} },
|
||||
}
|
||||
itemEntityId = self.CreateEngineItemEntity(itemDict, 0, (0, 5, 0))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## CreateExperienceOrb
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.expCompServer.ExpComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
创建专属经验球
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| exp | int | 经验球经验 |
|
||||
| position | tuple(float,float,float) | 创建的位置 |
|
||||
| isSpecial | bool | 是否专属经验球 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置是否成功 |
|
||||
|
||||
- 备注
|
||||
- 设置经验球经验,entityId是人的entityId。专属的经验球只有entityId的人才能拾取
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateExp(entityId)
|
||||
comp.CreateExperienceOrb(25,(10,10,10),False)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## CreateProjectileEntity
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.projectileCompServer.ProjectileComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
创建抛射物(直接发射)
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| spawnerId | str | 创建者Id |
|
||||
| entityIdentifier | str | 创建抛射物的identifier,如minecraft:snowball |
|
||||
| param | dict | 默认为None,详细说明请见备注 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| str | 创建抛射物的Id,失败时为“-1” |
|
||||
|
||||
- 备注
|
||||
- param参数解释如下:
|
||||
| 参数 | 类型 | 解释 |
|
||||
| ----------------- | ----- | ------------------------------------------------------------ |
|
||||
| position | tuple(float,float,float) | 初始位置 |
|
||||
| direction | tuple(float,float,float) | 初始朝向 |
|
||||
| power | float | 投掷的力量值 |
|
||||
| gravity | float | 抛射物重力因子,默认为json配置中的值 |
|
||||
| damage | float | 抛射物伤害值,默认为json配置中的值 |
|
||||
| targetId | str | 抛射物目标(指定了target之后,会和潜影贝生物发射的跟踪导弹的那个投掷物是一个效果),默认不指定 |
|
||||
| isDamageOwner | bool | 对创建者是否造成伤害,默认不造成伤害 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateProjectile(levelId)
|
||||
param = {
|
||||
'position': (1,1,1),
|
||||
'direction': (1,1,1)
|
||||
}
|
||||
comp.CreateProjectileEntity(playerId, "minecraft:snowball", param)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## DestroyEntity
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.system.serverSystem.ServerSystem
|
||||
|
||||
- 描述
|
||||
|
||||
销毁实体
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| entityId | str | 销毁的实体ID |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否销毁成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
ServerSystem = serverApi.GetServerSystemCls()
|
||||
class FpsServerSystem(ServerSystem):
|
||||
def testDestroyEntity(self, entityId):
|
||||
self.DestroyEntity(entityId)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetDroppedItem
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.itemCompServer.ItemCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取掉落物的物品信息
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| itemEntityId | str | 掉落物的entityId |
|
||||
| getUserData | bool | 是否获取userData,默认为False |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| dict | 信息 |
|
||||
|
||||
- 备注
|
||||
- 如果掉落物实体不存在,返回值为None
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateItem(levelId)
|
||||
comp.GetDroppedItem(entityId)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetEngineActor
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.extraServerApi
|
||||
|
||||
- 描述
|
||||
|
||||
获取所有实体(不包含玩家)。
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| dict | 当前地图中的所有实体信息,key:实体id,value:实体dict |
|
||||
|
||||
- 备注
|
||||
- 实体信息字典 entityDict
|
||||
| 关键字 | 数据类型 | 说明 |
|
||||
| ----------| --------------------- | ---------|
|
||||
| dimensionId | int | 维度id |
|
||||
| identifier | str | 实体identifier |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
entityDicts = serverApi.GetEngineActor()
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetLocalPlayerId
|
||||
|
||||
<span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
method in mod.client.extraClientApi
|
||||
|
||||
- 描述
|
||||
|
||||
获取本地玩家的id
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| str | 客户端玩家Id |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
localId = clientApi.GetLocalPlayerId()
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetPlayerList
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.extraServerApi
|
||||
|
||||
- 描述
|
||||
|
||||
获取level中所有玩家的id列表
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| list(str) | 返回玩家id列表 |
|
||||
|
||||
- 备注
|
||||
- 由于引擎中的玩家id是无序存储的,所以该接口返回列表的先后顺序没有实际意义,仅为在多平台下表现一致。
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
print serverApi.GetPlayerList()
|
||||
```
|
||||
|
||||
|
||||
|
||||
## HasEntity
|
||||
|
||||
<span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
method in mod.client.component.gameCompClient.GameComponentClient
|
||||
|
||||
- 描述
|
||||
|
||||
判断 entity 是否存在
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| entityId | str | 实体id |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| int | 0表示不存在,1表示存在 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateGame(levelId)
|
||||
exist = comp.HasEntity(entityId)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## IsEntityAlive
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
### 服务端接口
|
||||
|
||||
<span id="s0"></span>
|
||||
method in mod.server.component.gameCompServer.GameComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
判断生物实体是否存活或非生物实体是否存在
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| entityId | str | 实体id |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | false表示生物实体已死亡或非生物实体已销毁,true表示生物实体存活或非生物实体存在 |
|
||||
|
||||
- 备注
|
||||
- 注意,如果检测的实体所在的区块被卸载,则该接口返回False。因此,需要注意实体所在的区块是否被加载。
|
||||
- 区块卸载:游戏只会加载玩家周围的区块,玩家移动到别的区域时,原来所在区域的区块会被卸载,参考[区块介绍](https://minecraft-zh.gamepedia.com/%E5%8C%BA%E5%9D%97)
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateGame(levelId)
|
||||
alive = comp.IsEntityAlive(entityId)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 客户端接口
|
||||
|
||||
<span id="c0"></span>
|
||||
method in mod.client.component.gameCompClient.GameComponentClient
|
||||
|
||||
- 描述
|
||||
|
||||
判断生物实体是否存活或非生物实体是否存在
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| entityId | str | 实体id |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | false表示生物实体已死亡或非生物实体已销毁,true表示生物实体存活或非生物实体存在 |
|
||||
|
||||
- 备注
|
||||
- 注意,如果检测的实体所在的区块被卸载,则该接口返回False。因此,需要注意实体所在的区块是否被加载。
|
||||
- 区块卸载:游戏只会加载玩家周围的区块,玩家移动到别的区域时,原来所在区域的区块会被卸载,参考[区块介绍](https://minecraft-zh.gamepedia.com/%E5%8C%BA%E5%9D%97)
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateGame(levelId)
|
||||
alive = comp.IsEntityAlive(entityId)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## KillEntity
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.gameCompServer.GameComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
杀死某个Entity
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| entityId | str | 要杀死的目标的entityId |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否杀死成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateGame(levelId)
|
||||
comp.KillEntity(entityId)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SpawnItemToLevel
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.itemCompServer.ItemCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
生成物品掉落物,如果需要获取物品的entityId,可以调用服务端系统接口CreateEngineItemEntity
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| itemDict | dict | <a href="../../../../mcguide/20-玩法开发/10-基本概念/1-我的世界基础概念.html#物品信息字典#物品信息字典">物品信息字典</a> |
|
||||
| dimensionId | int | 设置dimension |
|
||||
| pos | tuple(float,float,float) | 生成位置 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置结果 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
itemDict = {
|
||||
'itemName': 'minecraft:bow',
|
||||
'count': 1,
|
||||
'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],
|
||||
'auxValue': 0,
|
||||
'customTips':'§c new item §r',
|
||||
'extraId': 'abc',
|
||||
'userData': {},
|
||||
}
|
||||
comp = serverApi.GetEngineCompFactory().CreateItem(levelId)
|
||||
comp.SpawnItemToLevel(itemDict, 0, (0,80,20))
|
||||
# 当最大生成数量为 1 时,可以继续调用生成 2 个物品
|
||||
comp.SpawnItemToLevel(itemDict, 0, (0,80,20))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SpawnLootTable
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.actorLootCompServer.ActorLootComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
使用生物类型模拟一次随机掉落,生成的物品与json定义的概率有关
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| pos | tuple(int,int,int) | 掉落位置 |
|
||||
| identifier | str | 实体identifier,如minecraft:guardian |
|
||||
| playerKillerId | str | 玩家杀手(只能是玩家),默认None |
|
||||
| damageCauseEntityId | str | 伤害来源实体Id(掉落与该实体手持物品的抢夺附魔等级有关),默认None |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否成功生成掉落 |
|
||||
|
||||
- 备注
|
||||
- 需要在对应的player实体附近生成,否则会生成失败。对于某些特殊的生物,如minecraft:sheep,需要使用SpawnLootTableWithActor接口来模拟随机掉落。
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateActorLoot(playerId)
|
||||
result = comp.SpawnLootTable((1, 4, 5), 'minecraft:guardian')
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SpawnLootTableWithActor
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.actorLootCompServer.ActorLootComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
使用生物实例模拟一次随机掉落,生成的物品与json定义的概率有关
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| pos | tuple(int,int,int) | 掉落位置 |
|
||||
| entityId | str | 模拟生物的生物Id |
|
||||
| playerKillerId | str | 玩家杀手(只能是玩家),默认None |
|
||||
| damageCauseEntityId | str | 伤害来源实体Id(掉落与该实体手持物品的抢夺附魔等级有关),默认None |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否成功生成掉落 |
|
||||
|
||||
- 备注
|
||||
- 需要在对应的player实体附近生成,否则会生成失败
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateActorLoot(playerId)
|
||||
result = comp.SpawnLootTableWithActor((1, 4, 5), '-335007449086')
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SpawnResources
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
产生方块随机掉落(该方法不适用于实体方块)
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| identifier | str | 方块的identifier,如minecraft:wool |
|
||||
| pos | tuple(int,int,int) | 掉落位置 |
|
||||
| aux | int | 方块的附加值 |
|
||||
| probability | float | 掉落概率,范围为[0, 1],0为不掉落,1为100%掉落 |
|
||||
| bonusLootLevel | int | [时运等级](https://minecraft-zh.gamepedia.com/时运),默认为0 |
|
||||
| dimensionId | int | 掉落方块的维度,默认值为-1,传入非负值时用于获取产生方块掉落的维度;否则将随机挑选一个存在玩家的维度产生掉落 |
|
||||
| allowRandomness | bool | 是否允许随机采集,默认为True,如果为False,掉落概率probability无效 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否成功 |
|
||||
|
||||
- 备注
|
||||
- 时运等级[bonusLootLevel]只对部分方块生效
|
||||
掉落概率[probability]对部分农作物树叶不生效
|
||||
- 可在对应维度的常加载区块产生掉落
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
# 金矿石掉落
|
||||
result = comp.SpawnResources('minecraft:gold_ore', (1,1,1), 7, 1.0, 10)
|
||||
# 指定维度产生掉落
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
result = comp.SpawnResources('minecraft:gold_ore', (1,1,1), 7, 1.0, 10, 0)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SpawnResourcesSilkTouched
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
模拟方块精准采集掉落
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| identifier | str | 方块的identifier,如minecraft:wool |
|
||||
| pos | tuple(int,int,int) | 掉落位置 |
|
||||
| aux | int | 方块的附加值 |
|
||||
| dimensionId | int | 掉落方块的维度,默认值为-1,传入非负值时用于获取产生方块掉落的维度;否则将随机挑选一个存在玩家的维度产生掉落 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否成功 |
|
||||
|
||||
- 备注
|
||||
- 如果指定方块不属于精准采集方块,返回False
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
result = comp.SpawnResourcesSilkTouched('minecraft:gold_ore', (1,1,1), 7)
|
||||
```
|
||||
|
||||
|
||||
|
||||
175
docs/mcdocs/1-ModAPI/接口/世界/指令.md
Normal file
175
docs/mcdocs/1-ModAPI/接口/世界/指令.md
Normal file
@@ -0,0 +1,175 @@
|
||||
---
|
||||
sidebarDepth: 1
|
||||
---
|
||||
# 指令
|
||||
|
||||
## GetCommandPermissionLevel
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.commandCompServer.CommandCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
返回设定使用/op命令时OP的权限等级(对应server.properties中的op-permission-level配置)
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| int | 权限等级:1-OP可以绕过重生点保护;2-OP可以使用所有单人游戏作弊命令;3-OP可以使用大多数多人游戏中独有的命令;4-OP可以使用所有命令 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateCommand(levelId)
|
||||
opLevel = comp.GetCommandPermissionLevel()
|
||||
print "GetCommandPermissionLevel oplevel={}".format(opLevel)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetDefaultPlayerPermissionLevel
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.commandCompServer.CommandCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
返回新玩家加入时的权限身份(对应server.properties中的default-player-permission-level配置)
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| int | 权限身份:0-Visitor;1-Member;2-Operator;3-自定义 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateCommand(levelId)
|
||||
opLevel = comp.GetDefaultPlayerPermissionLevel()
|
||||
print "GetDefaultPlayerPermissionLevel oplevel={}".format(opLevel)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetCommand
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.commandCompServer.CommandCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
使用游戏内指令
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| cmdStr | str | 指令 |
|
||||
| playerId | str | 玩家id:可选,如果playerId不设置,则随机选择玩家 |
|
||||
| showOutput | bool | 是否输出到聊天窗口:可选,默认False,如果为True的话,指令正确时,才会和聊天框输入原生指令一样输出返回信息。只有当该参数为True的时候会触发OnCommandOutputServerEvent与OnCommandOutputClientEvent |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 命令是否执行成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateCommand(levelId)
|
||||
comp.SetCommand("/tp @p 100 5 100")#传送指令
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetCommandPermissionLevel
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.commandCompServer.CommandCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置当玩家使用/op命令时OP的权限等级(对应server.properties中的op-permission-level配置)
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| opLevel | int | 权限等级:1-OP可以绕过重生点保护;2-OP可以使用所有单人游戏作弊命令;3-OP可以使用大多数多人游戏中独有的命令;4-OP可以使用所有命令 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 命令是否执行成功 |
|
||||
|
||||
- 备注
|
||||
- 此API不会修改已经获取了op的玩家的权限等级,仅影响调用API之后才获取op的玩家,建议在游戏初始化时调用此API
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateCommand(levelId)
|
||||
opLevel = 4
|
||||
suc = comp.SetCommandPermissionLevel(opLevel)
|
||||
print "SetCommandPermissionLevel to {} suc={}".format(opLevel, suc)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetDefaultPlayerPermissionLevel
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.commandCompServer.CommandCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置新玩家加入时的权限身份(对应server.properties中的default-player-permission-level配置)
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| opLevel | int | 权限身份:0-Visitor;1-Member;2-Operator;3-自定义 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 命令是否执行成功 |
|
||||
|
||||
- 备注
|
||||
- 此API不会修改已经加入过游戏的玩家的权限身份,仅影响调用API之后才新加入的玩家,建议在游戏初始化时调用此API
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateCommand(levelId)
|
||||
opLevel = 1
|
||||
suc = comp.SetDefaultPlayerPermissionLevel(opLevel)
|
||||
print "SetDefaultPlayerPermissionLevel to {} suc={}".format(opLevel, suc)
|
||||
```
|
||||
|
||||
|
||||
|
||||
529
docs/mcdocs/1-ModAPI/接口/世界/方块管理.md
Normal file
529
docs/mcdocs/1-ModAPI/接口/世界/方块管理.md
Normal file
@@ -0,0 +1,529 @@
|
||||
---
|
||||
sidebarDepth: 1
|
||||
---
|
||||
# 方块管理
|
||||
|
||||
## GetBlock
|
||||
|
||||
<span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
method in mod.client.component.blockInfoCompClient.BlockInfoComponentClient
|
||||
|
||||
- 描述
|
||||
|
||||
获取某一位置的block
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| pos | tuple(float,float,float) | 方块位置 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| tuple(str,int) | 参数1:方块的名称,参数2:方块的附加值AuxValue |
|
||||
|
||||
- 备注
|
||||
- 已经加载的地形才设置、获取方块信息
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
comp.GetBlock((x,y,z))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetBlockClip
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
### 服务端接口
|
||||
|
||||
<span id="s0"></span>
|
||||
method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取某一位置方块当前<a href="../../../../mcguide/20-玩法开发/15-自定义游戏内容/2-自定义方块/1-JSON组件.html#netease-aabb">clip的aabb</a>
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| pos | tuple(int,int,int) | 方块位置 |
|
||||
| dimensionId | int | 方块所在维度,不填时默认为-1 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| dict | 方块clip的aabb字典 |
|
||||
|
||||
- 备注
|
||||
- 已经加载的地形才能获取方块信息,支持获取对应维度的常加载区块内方块信息
|
||||
- 由于方块的碰撞盒可以随临近方块改变而改变,因此该接口返回的是调用时方块clip的aabb
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
blockDict = comp.GetBlockClip((0, 5, 0), 0)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 客户端接口
|
||||
|
||||
<span id="c0"></span>
|
||||
method in mod.client.component.blockInfoCompClient.BlockInfoComponentClient
|
||||
|
||||
- 描述
|
||||
|
||||
获取指定位置方块当前clip的aabb
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| pos | tuple(int,int,int) | 方块位置 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| dict | 方块aabb字典 |
|
||||
|
||||
- 备注
|
||||
- 由于方块的碰撞盒可以随临近方块改变而改变,因此该接口返回的是调用时方块clip的aabb
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
comp.GetBlockClip((x,y,z))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetBlockCollision
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
### 服务端接口
|
||||
|
||||
<span id="s0"></span>
|
||||
method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取某一位置方块当前collision的aabb
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| pos | tuple(int,int,int) | 方块位置 |
|
||||
| dimensionId | int | 方块所在维度,不填时默认为-1 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| dict | 方块aabb字典 |
|
||||
|
||||
- 备注
|
||||
- 已经加载的地形才能获取方块信息,支持获取对应维度的常加载区块内方块信息
|
||||
- 由于方块的碰撞盒可以随临近方块改变而改变,因此该接口返回的是调用时方块collision的aabb
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
blockDict = comp.GetBlockCollision((0, 5, 0), 0)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 客户端接口
|
||||
|
||||
<span id="c0"></span>
|
||||
method in mod.client.component.blockInfoCompClient.BlockInfoComponentClient
|
||||
|
||||
- 描述
|
||||
|
||||
获取指定位置方块当前collision的aabb
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| pos | tuple(int,int,int) | 方块位置 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| dict | 方块aabb字典 |
|
||||
|
||||
- 备注
|
||||
- 由于方块的碰撞盒可以随临近方块改变而改变,因此该接口返回的是调用时方块collision的aabb
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
comp.GetBlockCollision((x,y,z))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetBlockNew
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取某一位置的block
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| pos | tuple(int,int,int) | 方块位置 |
|
||||
| dimensionId | int | 方块所在维度 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| dict | <a href="../../../../mcguide/20-玩法开发/10-基本概念/1-我的世界基础概念.html#方块信息字典">方块信息字典</a> |
|
||||
|
||||
- 备注
|
||||
- 已经加载的地形才能获取方块信息,支持获取对应维度的常加载区块内方块信息
|
||||
- 对于有多种状态的方块,aux计算比较复杂,推荐使用GetBlockStates获取方块状态字典
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
blockDict = comp.GetBlockNew((0, 5, 0), 0)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetDestroyTotalTime
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
### 服务端接口
|
||||
|
||||
<span id="s0"></span>
|
||||
method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取使用物品破坏方块需要的时间
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| blockName | str | 方块标识符,格式[namespace:name:auxvalue],auxvalue默认为0 |
|
||||
| itemName | str | 物品标识符,格式[namespace:name:auxvalue],auxvalue默认为0,默认为None(不使用物品) |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| float | 需要消耗的时间 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
comp.GetDestroyTotalTime("minecraft:diamond_block", "minecraft:stone_pickaxe")
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 客户端接口
|
||||
|
||||
<span id="c0"></span>
|
||||
method in mod.client.component.blockInfoCompClient.BlockInfoComponentClient
|
||||
|
||||
- 描述
|
||||
|
||||
获取使用物品破坏方块需要的时间
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| blockName | str | 方块标识符,格式[namespace:name:auxvalue],auxvalue默认为0 |
|
||||
| itemName | str | 物品标识符,格式[namespace:name:auxvalue],auxvalue默认为0,默认为None(不使用物品) |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| float | 需要消耗的时间 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
comp.GetDestroyTotalTime("minecraft:diamond_block", "minecraft:stone_pickaxe")
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetLiquidBlock
|
||||
|
||||
<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 | 方块所在维度 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| dict | <a href="../../../../mcguide/20-玩法开发/10-基本概念/1-我的世界基础概念.html#方块信息字典">方块信息字典</a> |
|
||||
|
||||
- 备注
|
||||
- 已经加载的地形才能获取方块信息,支持获取对应维度的常加载区块内方块信息
|
||||
- 对于不含水或者不是流体的方块,则返回None。对于一个含水的方块,如含水的橡木栅栏,GetLiquidBlock会返回其含有的流体的信息(包括自定义流体),GetBlockNew则会返回橡木栅栏的信息。而对于一般的水方块(包括自定义流体),GetLiquidBlock和GetBlockNew则都会返回水的信息(包括自定义流体)。因此可以用GetLiquidBlock和GetBlockNew判断某个方块是否流体
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
liquidBlockDict = comp.GetLiquidBlock((0, 5, 0), 0)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetTopBlockHeight
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
### 服务端接口
|
||||
|
||||
<span id="s0"></span>
|
||||
method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取某一位置最高的非空气方块的高度
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| pos | tuple(int,int) | x轴与z轴位置 |
|
||||
| dimension | int | 维度id,默认为0,可在获取常加载区块内最高非空气方块高度 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| int或None | 高度。若区块未加载返回None |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
height = comp.GetTopBlockHeight((5, 5), 0)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 客户端接口
|
||||
|
||||
<span id="c0"></span>
|
||||
method in mod.client.component.blockInfoCompClient.BlockInfoComponentClient
|
||||
|
||||
- 描述
|
||||
|
||||
获取当前维度某一位置最高的非空气方块的高度
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| pos | tuple(int,int) | x轴与z轴位置 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| int或None | 高度。若区块未加载返回None |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
height = comp.GetTopBlockHeight((5, 5))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetBlockNew
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置某一位置的方块
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| pos | tuple(int,int,int) | 方块位置 |
|
||||
| blockDict | dict | <a href="../../../../mcguide/20-玩法开发/10-基本概念/1-我的世界基础概念.html#方块信息字典">方块信息字典</a> |
|
||||
| oldBlockHandling | int | 0:替换,1:销毁,2:保留,默认为0 |
|
||||
| dimensionId | int | 方块所在维度,必需参数 |
|
||||
| isLegacy | bool | 是否设置为传统的aux,建议设置为True,即aux对应的state不随着版本迭代而变化。默认为False |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置结果 |
|
||||
|
||||
- 备注
|
||||
- 已经加载的地形才能设置方块,支持在对应维度的常加载区块内设置方块
|
||||
- **若使用SetBlockNew接口替换含方块实体的方块,除自定义方块实体外,当替换前后方块实体类型相同时,其方块实体内数据不会发生改变。**
|
||||
例如在箱子中放置了物品,使用SetBlockNew接口将箱子方块替换为箱子方块后,新的箱子中依然保留旧箱子内的物品。<br>
|
||||
要避免这种情况,中间添加一次不同方块实体类型(或不含方块实体)的方块替换即可。比如先将箱子替换为空气,再将空气替换为箱子。
|
||||
- 随着版本更新,aux值对应的方块state会发生改变,对于有多种状态的方块,aux计算方式比较复杂,推荐先通过GetBlockAuxValueFromStates获取传统aux值再进行设置。
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockState(levelId)
|
||||
# GetBlockAuxValueFromStates 只需要调用一次,得到的auxValue可以缓存以来以供后续使用
|
||||
auxValue = comp.GetBlockAuxValueFromStates("minecraft:wool", { 'color': 'orange' })
|
||||
|
||||
blockDict = {
|
||||
'name': 'minecraft:wool',
|
||||
'aux': auxValue
|
||||
}
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
|
||||
comp.SetBlockNew((0, 5, 0), blockDict, 0, 0, True)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetLiquidBlock
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置某一位置的方块的extraBlock,可在此设置方块含水等
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| pos | tuple(int,int,int) | 方块位置 |
|
||||
| blockDict | dict | <a href="../../../../mcguide/20-玩法开发/10-基本概念/1-我的世界基础概念.html#方块信息字典">方块信息字典</a> |
|
||||
| dimensionId | int | 方块所在维度,必需参数 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置结果 |
|
||||
|
||||
- 备注
|
||||
- 已经加载的地形才能设置方块,支持在对应维度的常加载区块内设置方块
|
||||
- dimensionId需要是playerId对应玩家所在的维度;如果dimensionId是-1则默认使用playerId对应玩家所在的维度
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
blockDict = {
|
||||
'name': 'minecraft:water',
|
||||
'aux': 5
|
||||
}
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)
|
||||
comp.SetLiquidBlock((0, 5, 0), blockDict, 0)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetSnowBlock
|
||||
|
||||
<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 | 方块所在维度,必需参数 |
|
||||
| height | int | 雪块的高度,默认是1 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置结果 |
|
||||
|
||||
- 备注
|
||||
- 已经加载的地形才能设置方块,支持在对应维度的常加载区块内设置方块
|
||||
- dimensionId需要是playerId对应玩家所在的维度;如果dimensionId是-1则默认使用playerId对应玩家所在的维度
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)
|
||||
comp.SetSnowBlock((0, 5, 0), 0, 1)
|
||||
```
|
||||
|
||||
|
||||
|
||||
355
docs/mcdocs/1-ModAPI/接口/世界/方块组合.md
Normal file
355
docs/mcdocs/1-ModAPI/接口/世界/方块组合.md
Normal file
@@ -0,0 +1,355 @@
|
||||
---
|
||||
sidebarDepth: 1
|
||||
---
|
||||
# 方块组合
|
||||
|
||||
## CreateMicroBlockResStr
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.blockCompServer.BlockCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
生成微缩方块资源Json字符串
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| identifier | str | 微缩方块唯一标识 |
|
||||
| start | tuple(int,int,int) | 微缩起始坐标 |
|
||||
| end | tuple(int,int,int) | 微缩结束坐标 |
|
||||
| colorMap | dict | 默认为None,微缩方块颜色对应表 |
|
||||
| isMerge | bool | 默认为False,是否合并同类型方块 |
|
||||
| icon | str | 默认为空字符串,微缩方块图标,需要定义在 terrain_texture.json 中 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| str | 生成的微缩方块的资源字符串 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlock(levelId)
|
||||
result = comp.CreateMicroBlockResStr("x", (12, 60, 12), (26, 76, 26), colorMap={'minecraft:grass': [12, 22, 123, 255]}, isMerge=True, icon="micro_block_datiangou")
|
||||
with open("micro_block_x.json", "w+") as f:
|
||||
f.write(result)
|
||||
#该例子中,方块将以 (12 60 12) 为起点,以 (26 76 26) 为终点进行微缩,最终微缩方块里所有草方块的颜色为 rgba(12,22,123,255),实际显示颜色会依据环境光照微调,物品栏里的图标为 terrain_texture.json 里 micro_block_datiangou 对应的图片。
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetBlankBlockPalette
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
### 服务端接口
|
||||
|
||||
<span id="s0"></span>
|
||||
method in mod.server.component.blockCompServer.BlockCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取一个空白的方块调色板。
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| BlockPaletteComponent | 返回生成的方块调色板实例,如获取失败则返回None |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlock(levelId)
|
||||
blankPalette = comp.GetBlankBlockPalette()
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 客户端接口
|
||||
|
||||
<span id="c0"></span>
|
||||
method in mod.client.component.blockCompClient.BlockCompClient
|
||||
|
||||
- 描述
|
||||
|
||||
获取一个空白的方块调色板。
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| BlockPaletteComponent | 返回生成的方块调色板实例,如获取失败则返回None |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateBlock(levelId)
|
||||
blankPalette = comp.GetBlankBlockPalette()
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetBlockPaletteBetweenPos
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
### 服务端接口
|
||||
|
||||
<span id="s0"></span>
|
||||
method in mod.server.component.blockCompServer.BlockCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
根据输入的两个方块位置创建并获取一个方块调色板,方块调色板用于描述和记录世界中的多个方块的组合。这个方块调色板包含了这两个位置之间的所有方块及其相对位置。
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimensionId | int | 方块所在维度 |
|
||||
| startBlockPos | tuple(int,int,int) | 起始方块位置 |
|
||||
| endBlockPos | tuple(int,int,int) | 终点方块位置 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| BlockPaletteComponent | 返回生成的方块调色板实例,如创建失败则返回None |
|
||||
|
||||
- 备注
|
||||
- 对于床方块,方块调色板获取床方块时,只会添加床头的方块,床尾方块会进行忽略。对于门方块,则只会添加门的下半部分的方块,门的上半部分会进行忽略。
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
# playerId可以为None,也可以传入玩家的id。当传入的dimensionId为0或正值时,依赖dimensionId来获取区域;当传入的dimensionId为负值时,依赖传入的playerId来获取区域。
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlock(entityId)
|
||||
palette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 客户端接口
|
||||
|
||||
<span id="c0"></span>
|
||||
method in mod.client.component.blockCompClient.BlockCompClient
|
||||
|
||||
- 描述
|
||||
|
||||
根据输入的两个位置创建并获取一个方块调色板,该接口会搜索这两个位置之间的所有方块创建方块调色板,方块调色板用于描述和记录世界中的多个方块的组合。这个方块调色板包含了这两个位置之间的所有方块及其相对位置。
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| startPos | tuple(int,int,int) | 起始位置 |
|
||||
| endPos | tuple(int,int,int) | 终点位置 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| BlockPaletteComponent | 返回生成的方块调色板实例,如创建失败则返回None |
|
||||
|
||||
- 备注
|
||||
- 对于床方块,方块调色板获取床方块时,只会添加床头的方块,床尾方块会进行忽略。对于门方块,则只会添加门的下半部分的方块,门的上半部分会进行忽略。
|
||||
- 需要等区域内的方块完全加载才能正确获取调色板
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateBlock(levelId)
|
||||
palette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetBlockPaletteFromPosList
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
### 服务端接口
|
||||
|
||||
<span id="s0"></span>
|
||||
method in mod.server.component.blockCompServer.BlockCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
根据输入的方块位置列表创建并获取一个方块调色板,方块调色板用于描述和记录世界中的多个方块的组合。创建的方块调色板包含了这个位置列表中的所有方块及其相对位置。
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimensionId | int | 方块所在维度 |
|
||||
| posList | list(tuple(int,int,int)) | 方块位置列表 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| BlockPaletteComponent | 返回生成的方块调色板实例,如创建失败则返回None |
|
||||
|
||||
- 备注
|
||||
- 对于床方块,方块调色板获取床方块时,只会添加床头的方块,床尾方块会进行忽略。对于门方块,则只会添加门的下半部分的方块,门的上半部分会进行忽略。
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
# playerId可以为None,也可以传入玩家的id。当传入的dimensionId为0或正值时,依赖dimensionId来获取区域;当传入的dimensionId为负值时,依赖传入的playerId来获取区域。
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlock(entityId)
|
||||
palette = comp.GetBlockPaletteFromPosList(0,
|
||||
[(200,64,200),
|
||||
(201,64,200)
|
||||
(202,64,200)
|
||||
])
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 客户端接口
|
||||
|
||||
<span id="c0"></span>
|
||||
method in mod.client.component.blockCompClient.BlockCompClient
|
||||
|
||||
- 描述
|
||||
|
||||
根据输入的方块位置列表创建并获取一个方块调色板,方块调色板用于描述和记录世界中的多个方块的组合。创建的方块调色板包含了这个位置列表中的所有方块及其相对位置。
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| posList | list(tuple(int,int,int)) | 方块位置列表 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| BlockPaletteComponent | 返回生成的方块调色板实例,如创建失败则返回None |
|
||||
|
||||
- 备注
|
||||
- 对于床方块,方块调色板获取床方块时,只会添加床头的方块,床尾方块会进行忽略。对于门方块,则只会添加门的下半部分的方块,门的上半部分会进行忽略。
|
||||
- 需要等列表内的方块完全加载才能正确获取调色板
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateBlock(levelId)
|
||||
palette = comp.GetBlockPaletteFromPosList([
|
||||
(200,64,200),
|
||||
(201,64,200)
|
||||
(202,64,200)
|
||||
])
|
||||
```
|
||||
|
||||
|
||||
|
||||
## RegisterBlockPatterns
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.blockCompServer.BlockCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
注册特殊方块组合
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| pattern | list(str) | 方块组合位置 |
|
||||
| defines | dict | 方块组合类型 |
|
||||
| result_actor_name | str | 合成结果 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置结果 |
|
||||
|
||||
- 备注
|
||||
- 注意:该pattern不限定方向,只要能在任一平面上组合成功就能合成对应的实体。
|
||||
- 如示例代码所示,不需要放方块的位置需要显式定义为空气方块
|
||||
- 当引擎中已注册过相同的pattern和defines时,该接口不会更新result_actor_name,并返回False
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlock(levelId)
|
||||
pattern = [
|
||||
'A#A',
|
||||
'XXX',
|
||||
'AXA'
|
||||
]
|
||||
defines ={
|
||||
'#': 'minecraft:gold_block',
|
||||
'X': 'minecraft:iron_block',
|
||||
'A': 'minecraft:air',
|
||||
}
|
||||
comp.RegisterBlockPatterns(pattern,defines,'minecraft:chicken')
|
||||
#该例子左中右下放铁块,上面放金块,会生成一只鸡
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetBlockByBlockPalette
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.blockCompServer.BlockCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
根据输入的方块调色板内容,将调色板内记录的所有方块设置为实际的方块。
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| blockPalette | BlockPaletteComponent | 方块调色板,由GetBlockPaletteBetweenPos以及GetBlockPaletteFromPosList接口获取 |
|
||||
| dimensionId | int | 方块所在维度。如果输入的数值小于0,则使用entityId获取设置方块的区块。 |
|
||||
| pos | tuple(int,int,int) | 设置方块的原点位置,将以这个位置作为原点设置方块 |
|
||||
| rotation | int | 方块组合体的旋转,旋转方向为绕设置方块的原点位置所在的y轴进行旋转,旋转角度仅支持-270,-180,-90,0,90,180,270。如果传入的不是这些值,将取其中最接近输入值的数值。 |
|
||||
| conflictMode | int | 冲突模式枚举,可选参数,默认为0。在生成过程中,遇到生成的位置有其他方块的情况时,那么将会根据冲突模式来进行处理。可以输入的值为:0,1,2, 分别代表: 0: 替换地图中的方块,1: 跳过这个方块,2: 放弃之后的生成过程。 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 生成过程是否成功,无法完成整个生成过程返回False,完成整个生成过程则返回True。如果冲突模式为2时,遇到冲突方块时放弃之后的生成过程,这时候接口也会返回False。 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlock(entityId)
|
||||
palette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))
|
||||
# 将方块以(205,64,200)为原点设置palette中的方块,旋转90度,冲突模式为0,即替代地图中的方块
|
||||
comp.SetBlockByBlockPalette(palette, 0, (205,64,200),90,0)
|
||||
```
|
||||
|
||||
|
||||
|
||||
397
docs/mcdocs/1-ModAPI/接口/世界/时间.md
Normal file
397
docs/mcdocs/1-ModAPI/接口/世界/时间.md
Normal file
@@ -0,0 +1,397 @@
|
||||
---
|
||||
sidebarDepth: 1
|
||||
---
|
||||
# 时间
|
||||
|
||||
## GetLocalDoDayNightCycle
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.dimensionCompServer.DimensionCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取维度是否打开昼夜更替
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimension | int | 维度id |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否打开昼夜更替 |
|
||||
|
||||
- 备注
|
||||
- 维度使用局部时间规则时,返回维度自身的昼夜更替规则;没有使用时返回全局的昼夜更替规则
|
||||
- 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateDimension(levelId)
|
||||
comp.GetLocalDoDayNightCycle(3)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetLocalTime
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.dimensionCompServer.DimensionCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取维度的时间
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimension | int | 维度id |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| int | 时间,单位为帧数,表示该存档从新建起经过的时间,而非当前游戏天内的时间。mc中一个游戏天相当于现实的20分钟,即24000帧 |
|
||||
|
||||
- 备注
|
||||
- 维度使用局部时间规则时,返回局部时间;没有使用时返回全局时间
|
||||
- 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateDimension(levelId)
|
||||
# 从游戏开始经过的总帧数
|
||||
passedTime = comp.GetLocalTime(3)
|
||||
# 当前游戏天内的帧数
|
||||
timeOfDay = passedTime % 24000
|
||||
# 从游戏开始经过的游戏天数
|
||||
day = passedTime / 24000
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetTime
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.timeCompServer.TimeComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取当前世界时间
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| int | 当前时间,单位为帧数,表示该存档从新建起经过的时间,而非当前游戏天内的时间。mc中一个游戏天相当于现实的20分钟,即24000帧 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateTime(levelId)
|
||||
# 从游戏开始经过的总帧数
|
||||
passedTime = comp.GetTime()
|
||||
# 当前游戏天内的帧数
|
||||
timeOfDay = passedTime % 24000
|
||||
# 从游戏开始经过的游戏天数
|
||||
day = passedTime / 24000
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetUseLocalTime
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.dimensionCompServer.DimensionCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取某个维度是否设置了使用局部时间规则
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimension | int | 维度id |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否使用局部时间规则 |
|
||||
|
||||
- 备注
|
||||
- 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateDimension(levelId)
|
||||
comp.GetUseLocalTime(3)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetLocalDoDayNightCycle
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.dimensionCompServer.DimensionCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置使用局部时间规则的维度是否打开昼夜更替
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimension | int | 维度id |
|
||||
| value | bool | 是否打开昼夜更替 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否设置成功 |
|
||||
|
||||
- 备注
|
||||
- 只有使用局部时间规则维度才能设置
|
||||
- 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)
|
||||
- 在pc开发包下,可以在聊天栏键入`dmtime cycle on`或`dmtime cycle off`来测试开启与关闭当前维度的昼夜更替
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateDimension(levelId)
|
||||
comp.SetLocalDoDayNightCycle(3, False)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetLocalTime
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.dimensionCompServer.DimensionCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置使用局部时间规则维度的时间
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimension | int | 维度id |
|
||||
| time | int | 时间,单位为帧数。表示该存档从新建起经过的时间,而非当前游戏天内的时间。mc中一个游戏天相当于现实的20分钟,即24000帧 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否设置成功 |
|
||||
|
||||
- 备注
|
||||
- 游戏有天数的概念,使用时需要进行考虑。您也可以直接使用[SetLocalTimeOfDay](#setlocaltimeofday)设置一天内所在的时间而不用计算天数。
|
||||
- 只有使用局部时间规则维度才能设置
|
||||
- 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateDimension(levelId)
|
||||
# 获取当前的时间
|
||||
passedTime = comp.GetLocalTime(3)
|
||||
# 获取当前的天数
|
||||
day = passedTime / 24000
|
||||
# 设置为当天的正午
|
||||
comp.SetLocalTime(3, day * 24000 + 6000)
|
||||
# 设置为次日的日出
|
||||
comp.SetLocalTime(3, (day + 1) * 24000 + 0)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetLocalTimeOfDay
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.dimensionCompServer.DimensionCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置使用局部时间规则维度在一天内所在的时间
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimension | int | 维度id |
|
||||
| timeOfDay | int | 时间,单位为帧数,表示游戏天内的时间,范围为0到24000。mc中一个游戏天相当于现实的20分钟,即24000帧 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置是否成功 |
|
||||
|
||||
- 备注
|
||||
- 具体的逻辑与time指令相同,若timeOfDay比当前时间晚,则设置到当天的timeOfDay;若timeOfDay比当前时间早,则设置到次日的timeOfDay
|
||||
- 在pc开发包下,可以在聊天栏键入`dmtime time <int:帧数>`来测试设置当前维度的局部时间
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateDimension(levelId)
|
||||
# 设置为正午
|
||||
comp.SetLocalTimeOfDay(3, 6000)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetTime
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.timeCompServer.TimeComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置当前世界时间
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| time | int | 时间,单位为帧数,表示该存档从新建起经过的时间,而非当前游戏天内的时间。mc中一个游戏天相当于现实的20分钟,即24000帧 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置是否成功 |
|
||||
|
||||
- 备注
|
||||
- 游戏有天数的概念,使用时需要进行考虑。您也可以直接使用[SetTimeOfDay](#settimeofday)设置一天内所在的时间而不用计算天数。
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateTime(levelId)
|
||||
# 获取当前的时间
|
||||
passedTime = comp.GetTime()
|
||||
# 获取当前的天数
|
||||
day = passedTime / 24000
|
||||
# 设置为当天的正午
|
||||
comp.SetTime(day * 24000 + 6000)
|
||||
# 设置为次日的日出
|
||||
comp.SetTime((day + 1) * 24000 + 0)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetTimeOfDay
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.timeCompServer.TimeComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置当前世界在一天内所在的时间
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| timeOfDay | int | 时间,单位为帧数,表示游戏天内的时间,范围为0到24000。mc中一个游戏天相当于现实的20分钟,即24000帧 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置是否成功 |
|
||||
|
||||
- 备注
|
||||
- 具体的逻辑与time指令相同,若timeOfDay比当前时间晚,则设置到当天的timeOfDay;若timeOfDay比当前时间早,则设置到次日的timeOfDay
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateTime(levelId)
|
||||
# 设置为正午
|
||||
comp.SetTimeOfDay(6000)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetUseLocalTime
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.dimensionCompServer.DimensionCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
让某个维度拥有自己的局部时间规则,开启后该维度可以拥有与其他维度不同的时间与是否昼夜更替的规则
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| dimension | int | 维度id |
|
||||
| value | bool | 是否开启局部时间规则 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否设置成功 |
|
||||
|
||||
- 备注
|
||||
- 我们对主世界以及自定义维度新增了“局部时间规则”的概念。在此之前,所有的维度会共享一个“全局时间”,即设置时间或dodaynightcycle规则时,会对所有维度生效。
|
||||
现在,我们可以将某个维度使用局部时间规则,并且单独设置他的时间(见[SetLocalTime](#setlocaltime))与dodaynightcycle规则(见[SetLocalDoDayNightCycle](#setlocaldodaynightcycle))。
|
||||
在下文中,我们会将使用局部时间规则的维度称为“局部维度”,而使用全局时间的维度称为“全局维度”。默认情况下,维度都是全局维度。
|
||||
原版的time指令,gamerule dodaylightcycle指令与开启昼夜更替的设置,daylock指令与终为白日的设置,均不会对局部维度生效。
|
||||
当世界上同时存在局部维度与全局维度时,只有以下两种情况可以睡觉来跳过黑夜:
|
||||
1. 所有玩家都在全局维度睡觉。这时会将全局时间跳到第二天早上。
|
||||
2. 所有玩家都在同一个局部维度睡觉。这时会将该局部维度的时间跳到第二天早上。
|
||||
- 启用局部时间规则时,默认继承全局的时间与昼夜更替规则
|
||||
- 时间规则对原版的下界与末地无效,这两个维度永远为黑夜且没有昼夜更替
|
||||
- 建议统一在游戏启动时调用
|
||||
- 在pc开发包下,可以在聊天栏键入`dmtime on`或`dmtime off`来测试开启与关闭当前维度的局部时间
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateDimension(levelId)
|
||||
comp.SetUseLocalTime(3, True)
|
||||
```
|
||||
|
||||
|
||||
|
||||
372
docs/mcdocs/1-ModAPI/接口/世界/消息.md
Normal file
372
docs/mcdocs/1-ModAPI/接口/世界/消息.md
Normal file
@@ -0,0 +1,372 @@
|
||||
---
|
||||
sidebarDepth: 1
|
||||
---
|
||||
# 消息
|
||||
|
||||
## NotifyOneMessage
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.msgCompServer.MsgComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
给指定玩家发送聊天框消息
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| playerId | str | 指定玩家id |
|
||||
| msg | str | 消息内容 |
|
||||
| color | str | 颜色样式代码字符串,可参考wiki[样式代码](https://minecraft-zh.gamepedia.com/%E6%A0%B7%E5%BC%8F%E4%BB%A3%E7%A0%81),默认为白色 |
|
||||
|
||||
- 返回值
|
||||
|
||||
无
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateMsg(entityId)
|
||||
comp.NotifyOneMessage(playerId, "test", "§c")
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SendMsg
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.msgCompServer.MsgComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
模拟玩家给所有人发送聊天栏消息
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| name | str | 发送者玩家的名字 |
|
||||
| msg | str | 消息内容 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置结果 |
|
||||
|
||||
- 备注
|
||||
- name参数需要设置玩家的名字(可通过name组件获取),如果设置的玩家名字不存在,则随机找一个玩家发出该消息
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateMsg(entityId)
|
||||
comp.SendMsg("playerName","test")
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SendMsgToPlayer
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.msgCompServer.MsgComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
模拟玩家给另一个玩家发送聊天栏消息
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| fromEntityId | str | 发送者玩家ID |
|
||||
| toEntityId | str | 接受者玩家ID |
|
||||
| msg | str | 消息内容 |
|
||||
|
||||
- 返回值
|
||||
|
||||
无
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
comp = serverApi.GetEngineCompFactory().CreateMsg(entityId)
|
||||
comp.SendMsgToPlayer(fromEntityId, toEntityId, "test")
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetLeftCornerNotify
|
||||
|
||||
<span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
method in mod.client.component.textNotifyCompClient.TextNotifyComponet
|
||||
|
||||
- 描述
|
||||
|
||||
客户端设置左上角通知信息
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| textMsg | str | 通知内容 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置是否成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateTextNotifyClient(levelId)
|
||||
comp.SetLeftCornerNotify("做好准备")
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetNotifyMsg
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.gameCompServer.GameComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置消息通知
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| msg | str | 消息内容 |
|
||||
| color | str | 使用GenerateColor接口获取的颜色,默认为白色 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置是否成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateGame(levelId)
|
||||
comp.SetNotifyMsg("消息通知", serverApi.GenerateColor('BLUE'))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetOnePopupNotice
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.gameCompServer.GameComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
在具体某个玩家的物品栏上方弹出popup类型通知,位置位于tip类型消息下方,此功能更建议客户端使用game组件的对应接口SetPopupNotice
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| playerId | str | 具体玩家Id |
|
||||
| message | str | 消息内容,可以在消息前增加extraServerApi.GenerateColor("RED")字符来设置颜色,具体参考样例 |
|
||||
| subtitle | str | 消息子标题内容,效果同message,也可设置颜色,位置位于message上方 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置是否成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateGame(playerId)
|
||||
# playerId 变量改为具体的玩家Id
|
||||
comp.SetOnePopupNotice(playerId, serverApi.GenerateColor("RED") + "消息通知", "消息子标题")
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetOneTipMessage
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.gameCompServer.GameComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
在具体某个玩家的物品栏上方弹出tip类型通知,位置位于popup类型通知上方,此功能更建议在客户端使用game组件的对应接口SetTipMessage
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| playerId | str | 具体玩家Id |
|
||||
| message | str | 消息内容,可以在消息前增加extraServerApi.GenerateColor("RED")字符来设置颜色,具体参考样例 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置是否成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateGame(playerId)
|
||||
# playerId 变量改为具体的玩家Id
|
||||
comp.SetOneTipMessage(playerId, serverApi.GenerateColor("RED") + "tip提示")
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetPopupNotice
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
### 服务端接口
|
||||
|
||||
<span id="s0"></span>
|
||||
method in mod.server.component.gameCompServer.GameComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
在所有玩家物品栏上方弹出popup类型通知,位置位于tip类型消息下方
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| message | str | 消息内容,可以在消息前增加extraServerApi.GenerateColor("RED")字符来设置颜色,具体参考样例 |
|
||||
| subtitle | str | 消息子标题内容,效果同message,也可设置颜色,位置位于message上方 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置是否成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateGame(levelId)
|
||||
comp.SetPopupNotice(serverApi.GenerateColor("RED") + "消息通知", "消息子标题")
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 客户端接口
|
||||
|
||||
<span id="c0"></span>
|
||||
method in mod.client.component.gameCompClient.GameComponentClient
|
||||
|
||||
- 描述
|
||||
|
||||
在本地玩家的物品栏上方弹出popup类型通知,位置位于tip类型消息下方
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| message | str | 消息内容,可以在消息前增加extraClientApi.GenerateColor("RED")字符来设置颜色,具体参考样例 |
|
||||
| subtitle | str | 消息子标题内容,效果同message,也可设置颜色,位置位于message上方 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置是否成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateGame(entityId)
|
||||
comp.SetPopupNotice(clientApi.GenerateColor("RED") + "消息通知", "消息子标题")
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetTipMessage
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
### 服务端接口
|
||||
|
||||
<span id="s0"></span>
|
||||
method in mod.server.component.gameCompServer.GameComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
在所有玩家物品栏上方弹出tip类型通知,位置位于popup类型通知上方
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| message | str | 消息内容,可以在消息前增加extraServerApi.GenerateColor("RED")字符来设置颜色,具体参考样例 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置是否成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateGame(levelId)
|
||||
comp.SetTipMessage(serverApi.GenerateColor("RED") + "tip提示")
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 客户端接口
|
||||
|
||||
<span id="c0"></span>
|
||||
method in mod.client.component.gameCompClient.GameComponentClient
|
||||
|
||||
- 描述
|
||||
|
||||
在本地玩家的物品栏上方弹出tip类型通知,位置位于popup类型通知上方
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| message | str | 消息内容,可以在消息前增加extraClientApi.GenerateColor("RED")字符来设置颜色,具体参考样例 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置是否成功 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateGame(entityId)
|
||||
comp.SetTipMessage(clientApi.GenerateColor("RED") + "tip提示")
|
||||
```
|
||||
|
||||
|
||||
|
||||
1044
docs/mcdocs/1-ModAPI/接口/世界/渲染.md
Normal file
1044
docs/mcdocs/1-ModAPI/接口/世界/渲染.md
Normal file
File diff suppressed because it is too large
Load Diff
1035
docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md
Normal file
1035
docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md
Normal file
File diff suppressed because it is too large
Load Diff
110
docs/mcdocs/1-ModAPI/接口/世界/生物生成.md
Normal file
110
docs/mcdocs/1-ModAPI/接口/世界/生物生成.md
Normal file
@@ -0,0 +1,110 @@
|
||||
---
|
||||
sidebarDepth: 1
|
||||
---
|
||||
# 生物生成
|
||||
|
||||
## GetEntityLimit
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.extraServerApi
|
||||
|
||||
- 描述
|
||||
|
||||
获取世界最大可生成实体数量上限。可生成实体的含义见[SetEntityLimit](#setentitylimit)
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| int | 最大可生成实体数量上限 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
print serverApi.GetEntityLimit()
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetEntityLimit
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.extraServerApi
|
||||
|
||||
- 描述
|
||||
|
||||
设置世界最大可生成实体数量上限。可生成实体指具有spawnrule的实体。当前世界上被加载的可生成实体数量超过这个上限时,生物就不会再通过spawnrule刷出。
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| num | int | 最大可生成实体数量上限 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 返回是否设置成功 |
|
||||
|
||||
- 备注
|
||||
- 该上限与生物json文件中配置的种群密度共同作用,比如上限是200,但种群密度是10,那么该生物随机生成不会超过10个。此外生物上限还和适合生成的区块容量相关,设置上限过高的话可能因其他限制条件而不能达到该高度。
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
print serverApi.SetEntityLimit(300)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SpawnCustomModule
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.mobSpawnCompServer.MobSpawnComponentServer
|
||||
|
||||
- 描述
|
||||
|
||||
设置自定义刷怪
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| biomeType | int | [BiomeType枚举](../../枚举值/BiomeType.md) |
|
||||
| change | int | [Change枚举](../../枚举值/Change.md) |
|
||||
| entityType | int | [EntityType枚举](../../枚举值/EntityType.md) |
|
||||
| probability | int | 生成的权重[1, 10] |
|
||||
| minCount | int | 最小生成数量[0, 10] |
|
||||
| maxCount | int | 最大生成数量[0, 10] |
|
||||
| environment | int | 1:生成在表面;2:生成在水里 |
|
||||
| minBrightness | int | 生成该生物时的最小光照[1, 15],不设置时使用默认值 |
|
||||
| maxBrightness | int | 生成该生物时的最大光照[1, 15],不设置时使用默认值 |
|
||||
| minHeight | int | 生成该生物时最小的海拔高度[0, 256],不设置时使用默认值 |
|
||||
| maxHeight | int | 生成该生物时最大的海拔高度[0, 256],不设置时使用默认值 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置结果 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateMobSpawn(levelId)
|
||||
comp.SpawnCustomModule(BiomeType.river,Change.Add,EntityType.Dolphin,10,1,10,2)
|
||||
```
|
||||
|
||||
|
||||
|
||||
279
docs/mcdocs/1-ModAPI/接口/世界/索引.md
Normal file
279
docs/mcdocs/1-ModAPI/接口/世界/索引.md
Normal file
@@ -0,0 +1,279 @@
|
||||
---
|
||||
sidebarDepth: 1
|
||||
---
|
||||
# 索引
|
||||
|
||||
---
|
||||
|
||||
- [地图](#地图)
|
||||
- [实体管理](#实体管理)
|
||||
- [方块管理](#方块管理)
|
||||
- [生物生成](#生物生成)
|
||||
- [配方](#配方)
|
||||
- [方块组合](#方块组合)
|
||||
- [渲染](#渲染)
|
||||
- [时间](#时间)
|
||||
- [天气](#天气)
|
||||
- [游戏规则](#游戏规则)
|
||||
- [自定义数据](#自定义数据)
|
||||
- [指令](#指令)
|
||||
- [消息](#消息)
|
||||
|
||||
### 地图
|
||||
|
||||
| 接口 | <div style="width: 3em"></div> | 描述 |
|
||||
| --- | --- | --- |
|
||||
| [CanSee](地图.md#cansee) | <span style="display:inline;color:#ff5555">服务端</span> | 判断起始对象是否可看见目标对象,基于对象的Head位置判断 |
|
||||
| [CheckBlockToPos](地图.md#checkblocktopos) | <span style="display:inline;color:#ff5555">服务端</span> | 判断位置之间是否有方块 |
|
||||
| [CheckChunkState](地图.md#checkchunkstate) | <span style="display:inline;color:#ff5555">服务端</span> | 判断指定位置的chunk是否加载完成 |
|
||||
| [CreateDimension](地图.md#createdimension) | <span style="display:inline;color:#ff5555">服务端</span> | 创建新的dimension |
|
||||
| [CreateExplosion](地图.md#createexplosion) | <span style="display:inline;color:#ff5555">服务端</span> | 用于生成爆炸 |
|
||||
| [DeleteAllArea](地图.md#deleteallarea) | <span style="display:inline;color:#ff5555">服务端</span> | 删除所有常加载区域 |
|
||||
| [DeleteArea](地图.md#deletearea) | <span style="display:inline;color:#ff5555">服务端</span> | 删除一个常加载区域 |
|
||||
| [DetectStructure](地图.md#detectstructure) | <span style="display:inline;color:#ff5555">服务端</span> | 检测自定义门的结构 |
|
||||
| [GetAllAreaKeys](地图.md#getallareakeys) | <span style="display:inline;color:#ff5555">服务端</span> | 获取所有常加载区域名称列表 |
|
||||
| [GetBiomeName](地图.md#getbiomename) | <span style="display:inline;color:#ff5555">服务端</span> | 获取某一位置所属的生物群系信息 |
|
||||
| [GetBlockLightLevel](地图.md#getblocklightlevel) | <span style="display:inline;color:#ff5555">服务端</span> | 获取方块位置的光照等级 |
|
||||
| [GetChunkEntites](地图.md#getchunkentites) | <span style="display:inline;color:#ff5555">服务端</span> | 获取指定位置的区块中,全部的实体和玩家的ID列表 |
|
||||
| [GetChunkMaxPos](地图.md#getchunkmaxpos) | <span style="display:inline;color:#ff5555">服务端</span> | 获取某区块最大点的坐标 |
|
||||
| [GetChunkMinPos](地图.md#getchunkminpos) | <span style="display:inline;color:#ff5555">服务端</span> | 获取某区块最小点的坐标 |
|
||||
| [GetChunkMobNum](地图.md#getchunkmobnum) | <span style="display:inline;color:#ff5555">服务端</span> | 获取某区块中的生物数量(不包括玩家,但包括盔甲架) |
|
||||
| [GetChunkPosFromBlockPos](地图.md#getchunkposfromblockpos) | <span style="display:inline;color:#ff5555">服务端</span> | 通过方块坐标获得该方块所在区块坐标 |
|
||||
| [GetChunkPosFromBlockPos](地图.md#getchunkposfromblockpos) | <span style="display:inline;color:#7575f9">客户端</span> | 通过方块坐标获得该方块所在区块坐标 |
|
||||
| [GetCurrentDimension](地图.md#getcurrentdimension) | <span style="display:inline;color:#7575f9">客户端</span> | 获取客户端当前维度 |
|
||||
| [GetEntitiesAround](地图.md#getentitiesaround) | <span style="display:inline;color:#ff5555">服务端</span> | 获取区域内的entity列表 |
|
||||
| [GetEntitiesAroundByType](地图.md#getentitiesaroundbytype) | <span style="display:inline;color:#ff5555">服务端</span> | 获取区域内的某类型的entity列表 |
|
||||
| [GetEntitiesInSquareArea](地图.md#getentitiesinsquarearea) | <span style="display:inline;color:#ff5555">服务端</span> | 获取区域内的entity列表 |
|
||||
| [GetEntityInArea](地图.md#getentityinarea) | <span style="display:inline;color:#7575f9">客户端</span> | 返回区域内的实体,可获取到区域范围内已加载的实体列表 |
|
||||
| [GetLevelId](地图.md#getlevelid) | <span style="display:inline;color:#ff5555">服务端</span> | 获取levelId。某些组件需要levelId创建,可以用此接口获取levelId。其中level即为当前地图的游戏。 |
|
||||
| [GetLevelId](地图.md#getlevelid) | <span style="display:inline;color:#7575f9">客户端</span> | 获取levelId。某些组件需要levelId创建,可以用此接口获取levelId。其中level即为当前地图的游戏。 |
|
||||
| [GetLoadedChunks](地图.md#getloadedchunks) | <span style="display:inline;color:#ff5555">服务端</span> | 获取指定维度当前已经加载完毕的全部区块的坐标列表 |
|
||||
| [GetSpawnDimension](地图.md#getspawndimension) | <span style="display:inline;color:#ff5555">服务端</span> | 获取世界出生维度 |
|
||||
| [GetSpawnPosition](地图.md#getspawnposition) | <span style="display:inline;color:#ff5555">服务端</span> | 获取世界出生点坐标 |
|
||||
| [IsChunkGenerated](地图.md#ischunkgenerated) | <span style="display:inline;color:#ff5555">服务端</span> | 获取某个区块是否生成过。 |
|
||||
| [IsSlimeChunk](地图.md#isslimechunk) | <span style="display:inline;color:#ff5555">服务端</span> | 获取某个区块是否史莱姆区块。 |
|
||||
| [LocateNeteaseFeatureRule](地图.md#locateneteasefeaturerule) | <span style="display:inline;color:#ff5555">服务端</span> | 与[/locate指令](https://minecraft-zh.gamepedia.com/%E5%91%BD%E4%BB%A4/locate)相似,用于定位<a href="../../../../mcguide/20-玩法开发/15-自定义游戏内容/4-自定义维度/4-自定义特征.html#特征规则(feature-rules)">网易自定义特征规则</a> |
|
||||
| [LocateStructureFeature](地图.md#locatestructurefeature) | <span style="display:inline;color:#ff5555">服务端</span> | 与[/locate指令](https://minecraft-zh.gamepedia.com/%E5%91%BD%E4%BB%A4/locate)相似,用于定位原版的部分结构,如海底神殿、末地城等。 |
|
||||
| [MayPlace](地图.md#mayplace) | <span style="display:inline;color:#ff5555">服务端</span> | 判断方块是否可以放置 |
|
||||
| [MayPlaceOn](地图.md#mayplaceon) | <span style="display:inline;color:#ff5555">服务端</span> | 判断物品是否可以放到指定的位置上 |
|
||||
| [MirrorDimension](地图.md#mirrordimension) | <span style="display:inline;color:#ff5555">服务端</span> | 复制不同dimension的地形 |
|
||||
| [PlaceStructure](地图.md#placestructure) | <span style="display:inline;color:#ff5555">服务端</span> | 放置结构 |
|
||||
| [SetAddArea](地图.md#setaddarea) | <span style="display:inline;color:#ff5555">服务端</span> | 设置区块的常加载 |
|
||||
| [SetMergeSpawnItemRadius](地图.md#setmergespawnitemradius) | <span style="display:inline;color:#ff5555">服务端</span> | 设置新生成的物品是否合堆 |
|
||||
| [SetSpawnDimensionAndPosition](地图.md#setspawndimensionandposition) | <span style="display:inline;color:#ff5555">服务端</span> | 设置世界出生点维度与坐标 |
|
||||
| [UpgradeMapDimensionVersion](地图.md#upgrademapdimensionversion) | <span style="display:inline;color:#ff5555">服务端</span> | 提升指定地图维度的版本号,版本号不符的维度,地图存档信息将被废弃。使用后存档的地图版本均会同步提升至最新版本,假如希望使用此接口清理指定维度的地图存档,需要在保证该维度区块都没有被加载时调用。 |
|
||||
|
||||
### 实体管理
|
||||
|
||||
| 接口 | <div style="width: 3em"></div> | 描述 |
|
||||
| --- | --- | --- |
|
||||
| [CreateEngineEntityByTypeStr](实体管理.md#createengineentitybytypestr) | <span style="display:inline;color:#ff5555">服务端</span> | 创建指定identifier的实体 |
|
||||
| [CreateEngineItemEntity](实体管理.md#createengineitementity) | <span style="display:inline;color:#ff5555">服务端</span> | 用于创建物品实体(即掉落物),返回物品实体的entityId |
|
||||
| [CreateExperienceOrb](实体管理.md#createexperienceorb) | <span style="display:inline;color:#ff5555">服务端</span> | 创建专属经验球 |
|
||||
| [CreateProjectileEntity](实体管理.md#createprojectileentity) | <span style="display:inline;color:#ff5555">服务端</span> | 创建抛射物(直接发射) |
|
||||
| [DestroyEntity](实体管理.md#destroyentity) | <span style="display:inline;color:#ff5555">服务端</span> | 销毁实体 |
|
||||
| [GetDroppedItem](实体管理.md#getdroppeditem) | <span style="display:inline;color:#ff5555">服务端</span> | 获取掉落物的物品信息 |
|
||||
| [GetEngineActor](实体管理.md#getengineactor) | <span style="display:inline;color:#ff5555">服务端</span> | 获取所有实体(不包含玩家)。 |
|
||||
| [GetLocalPlayerId](实体管理.md#getlocalplayerid) | <span style="display:inline;color:#7575f9">客户端</span> | 获取本地玩家的id |
|
||||
| [GetPlayerList](实体管理.md#getplayerlist) | <span style="display:inline;color:#ff5555">服务端</span> | 获取level中所有玩家的id列表 |
|
||||
| [HasEntity](实体管理.md#hasentity) | <span style="display:inline;color:#7575f9">客户端</span> | 判断 entity 是否存在 |
|
||||
| [IsEntityAlive](实体管理.md#isentityalive) | <span style="display:inline;color:#ff5555">服务端</span> | 判断生物实体是否存活或非生物实体是否存在 |
|
||||
| [IsEntityAlive](实体管理.md#isentityalive) | <span style="display:inline;color:#7575f9">客户端</span> | 判断生物实体是否存活或非生物实体是否存在 |
|
||||
| [KillEntity](实体管理.md#killentity) | <span style="display:inline;color:#ff5555">服务端</span> | 杀死某个Entity |
|
||||
| [SpawnItemToLevel](实体管理.md#spawnitemtolevel) | <span style="display:inline;color:#ff5555">服务端</span> | 生成物品掉落物,如果需要获取物品的entityId,可以调用服务端系统接口CreateEngineItemEntity |
|
||||
| [SpawnLootTable](实体管理.md#spawnloottable) | <span style="display:inline;color:#ff5555">服务端</span> | 使用生物类型模拟一次随机掉落,生成的物品与json定义的概率有关 |
|
||||
| [SpawnLootTableWithActor](实体管理.md#spawnloottablewithactor) | <span style="display:inline;color:#ff5555">服务端</span> | 使用生物实例模拟一次随机掉落,生成的物品与json定义的概率有关 |
|
||||
| [SpawnResources](实体管理.md#spawnresources) | <span style="display:inline;color:#ff5555">服务端</span> | 产生方块随机掉落(该方法不适用于实体方块) |
|
||||
| [SpawnResourcesSilkTouched](实体管理.md#spawnresourcessilktouched) | <span style="display:inline;color:#ff5555">服务端</span> | 模拟方块精准采集掉落 |
|
||||
|
||||
### 方块管理
|
||||
|
||||
| 接口 | <div style="width: 3em"></div> | 描述 |
|
||||
| --- | --- | --- |
|
||||
| [GetBlock](方块管理.md#getblock) | <span style="display:inline;color:#7575f9">客户端</span> | 获取某一位置的block |
|
||||
| [GetBlockClip](方块管理.md#getblockclip) | <span style="display:inline;color:#ff5555">服务端</span> | 获取某一位置方块当前<a href="../../../../mcguide/20-玩法开发/15-自定义游戏内容/2-自定义方块/1-JSON组件.html#netease-aabb">clip的aabb</a> |
|
||||
| [GetBlockClip](方块管理.md#getblockclip) | <span style="display:inline;color:#7575f9">客户端</span> | 获取指定位置方块当前clip的aabb |
|
||||
| [GetBlockCollision](方块管理.md#getblockcollision) | <span style="display:inline;color:#ff5555">服务端</span> | 获取某一位置方块当前collision的aabb |
|
||||
| [GetBlockCollision](方块管理.md#getblockcollision) | <span style="display:inline;color:#7575f9">客户端</span> | 获取指定位置方块当前collision的aabb |
|
||||
| [GetBlockNew](方块管理.md#getblocknew) | <span style="display:inline;color:#ff5555">服务端</span> | 获取某一位置的block |
|
||||
| [GetDestroyTotalTime](方块管理.md#getdestroytotaltime) | <span style="display:inline;color:#ff5555">服务端</span> | 获取使用物品破坏方块需要的时间 |
|
||||
| [GetDestroyTotalTime](方块管理.md#getdestroytotaltime) | <span style="display:inline;color:#7575f9">客户端</span> | 获取使用物品破坏方块需要的时间 |
|
||||
| [GetLiquidBlock](方块管理.md#getliquidblock) | <span style="display:inline;color:#ff5555">服务端</span> | 获取某个位置方块所含流体信息接口 |
|
||||
| [GetTopBlockHeight](方块管理.md#gettopblockheight) | <span style="display:inline;color:#ff5555">服务端</span> | 获取某一位置最高的非空气方块的高度 |
|
||||
| [GetTopBlockHeight](方块管理.md#gettopblockheight) | <span style="display:inline;color:#7575f9">客户端</span> | 获取当前维度某一位置最高的非空气方块的高度 |
|
||||
| [SetBlockNew](方块管理.md#setblocknew) | <span style="display:inline;color:#ff5555">服务端</span> | 设置某一位置的方块 |
|
||||
| [SetLiquidBlock](方块管理.md#setliquidblock) | <span style="display:inline;color:#ff5555">服务端</span> | 设置某一位置的方块的extraBlock,可在此设置方块含水等 |
|
||||
| [SetSnowBlock](方块管理.md#setsnowblock) | <span style="display:inline;color:#ff5555">服务端</span> | 设置某一位置的方块含雪 |
|
||||
|
||||
### 生物生成
|
||||
|
||||
| 接口 | <div style="width: 3em"></div> | 描述 |
|
||||
| --- | --- | --- |
|
||||
| [GetEntityLimit](生物生成.md#getentitylimit) | <span style="display:inline;color:#ff5555">服务端</span> | 获取世界最大可生成实体数量上限。可生成实体的含义见[SetEntityLimit](生物生成.md#setentitylimit) |
|
||||
| [SetEntityLimit](生物生成.md#setentitylimit) | <span style="display:inline;color:#ff5555">服务端</span> | 设置世界最大可生成实体数量上限。可生成实体指具有spawnrule的实体。当前世界上被加载的可生成实体数量超过这个上限时,生物就不会再通过spawnrule刷出。 |
|
||||
| [SpawnCustomModule](生物生成.md#spawncustommodule) | <span style="display:inline;color:#ff5555">服务端</span> | 设置自定义刷怪 |
|
||||
|
||||
### 配方
|
||||
|
||||
| 接口 | <div style="width: 3em"></div> | 描述 |
|
||||
| --- | --- | --- |
|
||||
| [AddBrewingRecipes](配方.md#addbrewingrecipes) | <span style="display:inline;color:#ff5555">服务端</span> | 添加酿造台配方的接口 |
|
||||
| [GetRecipeResult](配方.md#getreciperesult) | <span style="display:inline;color:#ff5555">服务端</span> | 根据配方id获取配方结果。仅支持合成配方 |
|
||||
| [GetRecipesByInput](配方.md#getrecipesbyinput) | <span style="display:inline;color:#ff5555">服务端</span> | 通过输入物品查询配方 |
|
||||
| [GetRecipesByInput](配方.md#getrecipesbyinput) | <span style="display:inline;color:#7575f9">客户端</span> | 通过输入物品查询配方 |
|
||||
| [GetRecipesByResult](配方.md#getrecipesbyresult) | <span style="display:inline;color:#ff5555">服务端</span> | 通过输出物品查询配方所需要的输入材料 |
|
||||
| [GetRecipesByResult](配方.md#getrecipesbyresult) | <span style="display:inline;color:#7575f9">客户端</span> | 通过输出物品查询配方所需要的输入材料 |
|
||||
|
||||
### 方块组合
|
||||
|
||||
| 接口 | <div style="width: 3em"></div> | 描述 |
|
||||
| --- | --- | --- |
|
||||
| [CreateMicroBlockResStr](方块组合.md#createmicroblockresstr) | <span style="display:inline;color:#ff5555">服务端</span> | 生成微缩方块资源Json字符串 |
|
||||
| [GetBlankBlockPalette](方块组合.md#getblankblockpalette) | <span style="display:inline;color:#ff5555">服务端</span> | 获取一个空白的方块调色板。 |
|
||||
| [GetBlankBlockPalette](方块组合.md#getblankblockpalette) | <span style="display:inline;color:#7575f9">客户端</span> | 获取一个空白的方块调色板。 |
|
||||
| [GetBlockPaletteBetweenPos](方块组合.md#getblockpalettebetweenpos) | <span style="display:inline;color:#ff5555">服务端</span> | 根据输入的两个方块位置创建并获取一个方块调色板,方块调色板用于描述和记录世界中的多个方块的组合。这个方块调色板包含了这两个位置之间的所有方块及其相对位置。 |
|
||||
| [GetBlockPaletteBetweenPos](方块组合.md#getblockpalettebetweenpos) | <span style="display:inline;color:#7575f9">客户端</span> | 根据输入的两个位置创建并获取一个方块调色板,该接口会搜索这两个位置之间的所有方块创建方块调色板,方块调色板用于描述和记录世界中的多个方块的组合。这个方块调色板包含了这两个位置之间的所有方块及其相对位置。 |
|
||||
| [GetBlockPaletteFromPosList](方块组合.md#getblockpalettefromposlist) | <span style="display:inline;color:#ff5555">服务端</span> | 根据输入的方块位置列表创建并获取一个方块调色板,方块调色板用于描述和记录世界中的多个方块的组合。创建的方块调色板包含了这个位置列表中的所有方块及其相对位置。 |
|
||||
| [GetBlockPaletteFromPosList](方块组合.md#getblockpalettefromposlist) | <span style="display:inline;color:#7575f9">客户端</span> | 根据输入的方块位置列表创建并获取一个方块调色板,方块调色板用于描述和记录世界中的多个方块的组合。创建的方块调色板包含了这个位置列表中的所有方块及其相对位置。 |
|
||||
| [RegisterBlockPatterns](方块组合.md#registerblockpatterns) | <span style="display:inline;color:#ff5555">服务端</span> | 注册特殊方块组合 |
|
||||
| [SetBlockByBlockPalette](方块组合.md#setblockbyblockpalette) | <span style="display:inline;color:#ff5555">服务端</span> | 根据输入的方块调色板内容,将调色板内记录的所有方块设置为实际的方块。 |
|
||||
|
||||
### 渲染
|
||||
|
||||
| 接口 | <div style="width: 3em"></div> | 描述 |
|
||||
| --- | --- | --- |
|
||||
| [GetAmbientBrightness](渲染.md#getambientbrightness) | <span style="display:inline;color:#7575f9">客户端</span> | 获取环境光亮度,影响天空亮度,不影响实体与方块光照 |
|
||||
| [GetFogColor](渲染.md#getfogcolor) | <span style="display:inline;color:#7575f9">客户端</span> | 获取当前雾效颜色 |
|
||||
| [GetFogLength](渲染.md#getfoglength) | <span style="display:inline;color:#7575f9">客户端</span> | 获取雾效范围 |
|
||||
| [GetMoonRot](渲染.md#getmoonrot) | <span style="display:inline;color:#7575f9">客户端</span> | 获取月亮角度 |
|
||||
| [GetSkyColor](渲染.md#getskycolor) | <span style="display:inline;color:#7575f9">客户端</span> | 获取天空颜色 |
|
||||
| [GetSkyTextures](渲染.md#getskytextures) | <span style="display:inline;color:#7575f9">客户端</span> | 获取当前维度天空盒贴图,天空盒共6张贴图 |
|
||||
| [GetStarBrightness](渲染.md#getstarbrightness) | <span style="display:inline;color:#7575f9">客户端</span> | 获取星星亮度 |
|
||||
| [GetSunRot](渲染.md#getsunrot) | <span style="display:inline;color:#7575f9">客户端</span> | 获取太阳角度 |
|
||||
| [GetUseAmbientBrightness](渲染.md#getuseambientbrightness) | <span style="display:inline;color:#7575f9">客户端</span> | 判断是否在mod设置了环境光亮度 |
|
||||
| [GetUseFogColor](渲染.md#getusefogcolor) | <span style="display:inline;color:#7575f9">客户端</span> | 判断当前是否开启设置雾效颜色,该值默认为False,使用mod传入的颜色值后为True |
|
||||
| [GetUseFogLength](渲染.md#getusefoglength) | <span style="display:inline;color:#7575f9">客户端</span> | 判断当前是否开启设置雾效范围,该值默认为False,使用mod传入的范围值后为True |
|
||||
| [GetUseMoonRot](渲染.md#getusemoonrot) | <span style="display:inline;color:#7575f9">客户端</span> | 判断是否在mod设置了月亮角度 |
|
||||
| [GetUseSkyColor](渲染.md#getuseskycolor) | <span style="display:inline;color:#7575f9">客户端</span> | 判断是否在mod设置了天空颜色 |
|
||||
| [GetUseStarBrightness](渲染.md#getusestarbrightness) | <span style="display:inline;color:#7575f9">客户端</span> | 判断是否在mod设置了星星亮度 |
|
||||
| [GetUseSunRot](渲染.md#getusesunrot) | <span style="display:inline;color:#7575f9">客户端</span> | 判断是否在mod设置了太阳角度 |
|
||||
| [HideNameTag](渲染.md#hidenametag) | <span style="display:inline;color:#7575f9">客户端</span> | 隐藏场景内所有名字显示,包括玩家名字,生物的自定义名称,物品展示框与命令方块的悬浮文本等 |
|
||||
| [ResetAmbientBrightness](渲染.md#resetambientbrightness) | <span style="display:inline;color:#7575f9">客户端</span> | 重置环境光亮度 |
|
||||
| [ResetFogColor](渲染.md#resetfogcolor) | <span style="display:inline;color:#7575f9">客户端</span> | 重置雾效颜色 |
|
||||
| [ResetFogLength](渲染.md#resetfoglength) | <span style="display:inline;color:#7575f9">客户端</span> | 重置雾效范围 |
|
||||
| [ResetMoonRot](渲染.md#resetmoonrot) | <span style="display:inline;color:#7575f9">客户端</span> | 重置月亮角度 |
|
||||
| [ResetSkyColor](渲染.md#resetskycolor) | <span style="display:inline;color:#7575f9">客户端</span> | 重置天空颜色 |
|
||||
| [ResetSkyTextures](渲染.md#resetskytextures) | <span style="display:inline;color:#7575f9">客户端</span> | 重置当前维度天空盒贴图。如果有使用addon配置贴图则会使用配置的贴图,否则为游戏内默认无贴图的情况 |
|
||||
| [ResetStarBrightness](渲染.md#resetstarbrightness) | <span style="display:inline;color:#7575f9">客户端</span> | 重置星星亮度 |
|
||||
| [ResetSunRot](渲染.md#resetsunrot) | <span style="display:inline;color:#7575f9">客户端</span> | 重置太阳角度 |
|
||||
| [SetAmbientBrightness](渲染.md#setambientbrightness) | <span style="display:inline;color:#7575f9">客户端</span> | 设置环境光亮度,影响天空亮度,不影响实体与方块光照 |
|
||||
| [SetFogColor](渲染.md#setfogcolor) | <span style="display:inline;color:#7575f9">客户端</span> | 设置雾效颜色 |
|
||||
| [SetFogLength](渲染.md#setfoglength) | <span style="display:inline;color:#7575f9">客户端</span> | 设置雾效范围 |
|
||||
| [SetMoonRot](渲染.md#setmoonrot) | <span style="display:inline;color:#7575f9">客户端</span> | 设置月亮所在角度 |
|
||||
| [SetSkyColor](渲染.md#setskycolor) | <span style="display:inline;color:#7575f9">客户端</span> | 设置天空颜色 |
|
||||
| [SetSkyTextures](渲染.md#setskytextures) | <span style="display:inline;color:#7575f9">客户端</span> | 设置当前维度天空盒贴图,天空盒需要6张贴图 |
|
||||
| [SetStarBrightness](渲染.md#setstarbrightness) | <span style="display:inline;color:#7575f9">客户端</span> | 设置星星亮度,白天也可以显示星星 |
|
||||
| [SetSunRot](渲染.md#setsunrot) | <span style="display:inline;color:#7575f9">客户端</span> | 设置太阳所在角度 |
|
||||
| [SkyTextures](渲染.md#skytextures) | <span style="display:inline;color:#7575f9">客户端</span> | 修改太阳、月亮、云层分布、天空盒的贴图。使用addon配置,非python接口。 |
|
||||
|
||||
### 时间
|
||||
|
||||
| 接口 | <div style="width: 3em"></div> | 描述 |
|
||||
| --- | --- | --- |
|
||||
| [GetLocalDoDayNightCycle](时间.md#getlocaldodaynightcycle) | <span style="display:inline;color:#ff5555">服务端</span> | 获取维度是否打开昼夜更替 |
|
||||
| [GetLocalTime](时间.md#getlocaltime) | <span style="display:inline;color:#ff5555">服务端</span> | 获取维度的时间 |
|
||||
| [GetTime](时间.md#gettime) | <span style="display:inline;color:#ff5555">服务端</span> | 获取当前世界时间 |
|
||||
| [GetUseLocalTime](时间.md#getuselocaltime) | <span style="display:inline;color:#ff5555">服务端</span> | 获取某个维度是否设置了使用局部时间规则 |
|
||||
| [SetLocalDoDayNightCycle](时间.md#setlocaldodaynightcycle) | <span style="display:inline;color:#ff5555">服务端</span> | 设置使用局部时间规则的维度是否打开昼夜更替 |
|
||||
| [SetLocalTime](时间.md#setlocaltime) | <span style="display:inline;color:#ff5555">服务端</span> | 设置使用局部时间规则维度的时间 |
|
||||
| [SetLocalTimeOfDay](时间.md#setlocaltimeofday) | <span style="display:inline;color:#ff5555">服务端</span> | 设置使用局部时间规则维度在一天内所在的时间 |
|
||||
| [SetTime](时间.md#settime) | <span style="display:inline;color:#ff5555">服务端</span> | 设置当前世界时间 |
|
||||
| [SetTimeOfDay](时间.md#settimeofday) | <span style="display:inline;color:#ff5555">服务端</span> | 设置当前世界在一天内所在的时间 |
|
||||
| [SetUseLocalTime](时间.md#setuselocaltime) | <span style="display:inline;color:#ff5555">服务端</span> | 让某个维度拥有自己的局部时间规则,开启后该维度可以拥有与其他维度不同的时间与是否昼夜更替的规则 |
|
||||
|
||||
### 天气
|
||||
|
||||
| 接口 | <div style="width: 3em"></div> | 描述 |
|
||||
| --- | --- | --- |
|
||||
| [GetDimensionLocalWeatherInfo](天气.md#getdimensionlocalweatherinfo) | <span style="display:inline;color:#ff5555">服务端</span> | 获取独立维度天气信息(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气) |
|
||||
| [GetDimensionUseLocalWeather](天气.md#getdimensionuselocalweather) | <span style="display:inline;color:#ff5555">服务端</span> | 获取某个维度是否拥有自己的天气规则 |
|
||||
| [IsRaining](天气.md#israining) | <span style="display:inline;color:#ff5555">服务端</span> | 获取是否下雨 |
|
||||
| [IsThunder](天气.md#isthunder) | <span style="display:inline;color:#ff5555">服务端</span> | 获取是否打雷 |
|
||||
| [SetDimensionLocalDoWeatherCycle](天气.md#setdimensionlocaldoweathercycle) | <span style="display:inline;color:#ff5555">服务端</span> | 设置某个维度是否开启天气循环(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气) |
|
||||
| [SetDimensionLocalRain](天气.md#setdimensionlocalrain) | <span style="display:inline;color:#ff5555">服务端</span> | 设置某个维度下雨(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气) |
|
||||
| [SetDimensionLocalThunder](天气.md#setdimensionlocalthunder) | <span style="display:inline;color:#ff5555">服务端</span> | 设置某个维度打雷(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气) |
|
||||
| [SetDimensionUseLocalWeather](天气.md#setdimensionuselocalweather) | <span style="display:inline;color:#ff5555">服务端</span> | 设置某个维度拥有自己的天气规则,开启后该维度可以拥有与其他维度不同的天气和天气更替的规则 |
|
||||
| [SetRaining](天气.md#setraining) | <span style="display:inline;color:#ff5555">服务端</span> | 设置是否下雨 |
|
||||
| [SetThunder](天气.md#setthunder) | <span style="display:inline;color:#ff5555">服务端</span> | 设置是否打雷 |
|
||||
|
||||
### 游戏规则
|
||||
|
||||
| 接口 | <div style="width: 3em"></div> | 描述 |
|
||||
| --- | --- | --- |
|
||||
| [AddBannedItem](游戏规则.md#addbanneditem) | <span style="display:inline;color:#ff5555">服务端</span> | 增加禁用物品 |
|
||||
| [AddBlockProtectField](游戏规则.md#addblockprotectfield) | <span style="display:inline;color:#ff5555">Apollo</span> | 设置一个方块无法被玩家/实体破坏的区域 |
|
||||
| [CleanBlockProtectField](游戏规则.md#cleanblockprotectfield) | <span style="display:inline;color:#ff5555">Apollo</span> | 取消全部已设置的方块无法被玩家/实体破坏的区域 |
|
||||
| [ClearBannedItems](游戏规则.md#clearbanneditems) | <span style="display:inline;color:#ff5555">服务端</span> | 清空禁用物品 |
|
||||
| [DisableVineBlockSpread](游戏规则.md#disablevineblockspread) | <span style="display:inline;color:#ff5555">服务端</span> | 设置是否禁用藤曼蔓延生长 |
|
||||
| [ForbidLiquidFlow](游戏规则.md#forbidliquidflow) | <span style="display:inline;color:#ff5555">服务端</span> | 禁止/允许地图中的流体流动 |
|
||||
| [GetBannedItemList](游戏规则.md#getbanneditemlist) | <span style="display:inline;color:#ff5555">服务端</span> | 获取禁用物品列表 |
|
||||
| [GetGameDiffculty](游戏规则.md#getgamediffculty) | <span style="display:inline;color:#ff5555">服务端</span> | 获取游戏难度 |
|
||||
| [GetGameRulesInfoServer](游戏规则.md#getgamerulesinfoserver) | <span style="display:inline;color:#ff5555">服务端</span> | 获取游戏规则 |
|
||||
| [GetGameType](游戏规则.md#getgametype) | <span style="display:inline;color:#ff5555">服务端</span> | 获取默认游戏模式 |
|
||||
| [GetLevelGravity](游戏规则.md#getlevelgravity) | <span style="display:inline;color:#ff5555">服务端</span> | 获取重力因子 |
|
||||
| [GetSeed](游戏规则.md#getseed) | <span style="display:inline;color:#ff5555">服务端</span> | 获取存档种子 |
|
||||
| [IsDisableCommandMinecart](游戏规则.md#isdisablecommandminecart) | <span style="display:inline;color:#ff5555">服务端</span> | 获取当前是否允许运行命令方块矿车内置逻辑指令,当前仅Apollo网络服可用 |
|
||||
| [IsLockDifficulty](游戏规则.md#islockdifficulty) | <span style="display:inline;color:#ff5555">服务端</span> | 获取当前世界的游戏难度是否被锁定 |
|
||||
| [LockDifficulty](游戏规则.md#lockdifficulty) | <span style="display:inline;color:#ff5555">服务端</span> | 锁定当前世界游戏难度(仅本次游戏有效),锁定后任何玩家在游戏内都无法通过指令或暂停菜单修改游戏难度 |
|
||||
| [OpenCityProtect](游戏规则.md#opencityprotect) | <span style="display:inline;color:#ff5555">Apollo</span> | 开启城市保护,包括禁止破坏方块,禁止对方块使用物品,禁止怪物攻击玩家,禁止玩家之间互相攻击,禁止日夜切换,禁止天气变化,禁止怪物群落刷新 |
|
||||
| [RemoveBannedItem](游戏规则.md#removebanneditem) | <span style="display:inline;color:#ff5555">服务端</span> | 移除禁用物品 |
|
||||
| [RemoveBlockProtectField](游戏规则.md#removeblockprotectfield) | <span style="display:inline;color:#ff5555">Apollo</span> | 取消一个方块无法被玩家/实体破坏的区域 |
|
||||
| [SetCanActorSetOnFireByLightning](游戏规则.md#setcanactorsetonfirebylightning) | <span style="display:inline;color:#ff5555">服务端</span> | 禁止/允许闪电点燃实体 |
|
||||
| [SetCanBlockSetOnFireByLightning](游戏规则.md#setcanblocksetonfirebylightning) | <span style="display:inline;color:#ff5555">服务端</span> | 禁止/允许闪电点燃方块 |
|
||||
| [SetDefaultGameType](游戏规则.md#setdefaultgametype) | <span style="display:inline;color:#ff5555">服务端</span> | 设置默认游戏模式 |
|
||||
| [SetDisableCommandMinecart](游戏规则.md#setdisablecommandminecart) | <span style="display:inline;color:#ff5555">服务端</span> | 设置停止/开启运行命令方块矿车内置逻辑指令,当前仅Apollo网络服可用 |
|
||||
| [SetDisableContainers](游戏规则.md#setdisablecontainers) | <span style="display:inline;color:#ff5555">服务端</span> | 禁止所有容器界面的打开,包括玩家背包,各种包含背包界面的容器方块如工作台与箱子,以及包含背包界面的实体交互如马背包与村民交易 |
|
||||
| [SetDisableDropItem](游戏规则.md#setdisabledropitem) | <span style="display:inline;color:#ff5555">服务端</span> | 设置禁止丢弃物品 |
|
||||
| [SetDisableGravityInLiquid](游戏规则.md#setdisablegravityinliquid) | <span style="display:inline;color:#ff5555">服务端</span> | 是否屏蔽所有实体在液体(水、岩浆)中的重力 |
|
||||
| [SetDisableHunger](游戏规则.md#setdisablehunger) | <span style="display:inline;color:#ff5555">服务端</span> | 设置是否屏蔽饥饿度 |
|
||||
| [SetGameDifficulty](游戏规则.md#setgamedifficulty) | <span style="display:inline;color:#ff5555">服务端</span> | 设置游戏难度 |
|
||||
| [SetGameRulesInfoServer](游戏规则.md#setgamerulesinfoserver) | <span style="display:inline;color:#ff5555">服务端</span> | 设置游戏规则。所有参数均可选。 |
|
||||
| [SetHurtCD](游戏规则.md#sethurtcd) | <span style="display:inline;color:#ff5555">服务端</span> | 设置伤害CD |
|
||||
| [SetLevelGravity](游戏规则.md#setlevelgravity) | <span style="display:inline;color:#ff5555">服务端</span> | 设置重力因子 |
|
||||
|
||||
### 自定义数据
|
||||
|
||||
| 接口 | <div style="width: 3em"></div> | 描述 |
|
||||
| --- | --- | --- |
|
||||
| [CleanExtraData](自定义数据.md#cleanextradata) | <span style="display:inline;color:#ff5555">服务端</span> | 清除实体的自定义数据或者世界的自定义数据,清除实体数据时使用对应实体id创建组件,清除世界数据时使用levelId创建组件 |
|
||||
| [GetExtraData](自定义数据.md#getextradata) | <span style="display:inline;color:#ff5555">服务端</span> | 获取实体的自定义数据或者世界的自定义数据,某个键所对应的值。获取实体数据时使用对应实体id创建组件,获取世界数据时使用levelId创建组件 |
|
||||
| [GetWholeExtraData](自定义数据.md#getwholeextradata) | <span style="display:inline;color:#ff5555">服务端</span> | 获取完整的实体的自定义数据或者世界的自定义数据,获取实体数据时使用对应实体id创建组件,获取世界数据时使用levelId创建组件 |
|
||||
| [SaveExtraData](自定义数据.md#saveextradata) | <span style="display:inline;color:#ff5555">服务端</span> | 用于保存实体的自定义数据或者世界的自定义数据 |
|
||||
| [SetExtraData](自定义数据.md#setextradata) | <span style="display:inline;color:#ff5555">服务端</span> | 用于设置实体的自定义数据或者世界的自定义数据,数据以键值对的形式保存。设置实体数据时使用对应实体id创建组件,设置世界数据时使用levelId创建组件 |
|
||||
|
||||
### 指令
|
||||
|
||||
| 接口 | <div style="width: 3em"></div> | 描述 |
|
||||
| --- | --- | --- |
|
||||
| [GetCommandPermissionLevel](指令.md#getcommandpermissionlevel) | <span style="display:inline;color:#ff5555">服务端</span> | 返回设定使用/op命令时OP的权限等级(对应server.properties中的op-permission-level配置) |
|
||||
| [GetDefaultPlayerPermissionLevel](指令.md#getdefaultplayerpermissionlevel) | <span style="display:inline;color:#ff5555">服务端</span> | 返回新玩家加入时的权限身份(对应server.properties中的default-player-permission-level配置) |
|
||||
| [SetCommand](指令.md#setcommand) | <span style="display:inline;color:#ff5555">服务端</span> | 使用游戏内指令 |
|
||||
| [SetCommandPermissionLevel](指令.md#setcommandpermissionlevel) | <span style="display:inline;color:#ff5555">服务端</span> | 设置当玩家使用/op命令时OP的权限等级(对应server.properties中的op-permission-level配置) |
|
||||
| [SetDefaultPlayerPermissionLevel](指令.md#setdefaultplayerpermissionlevel) | <span style="display:inline;color:#ff5555">服务端</span> | 设置新玩家加入时的权限身份(对应server.properties中的default-player-permission-level配置) |
|
||||
|
||||
### 消息
|
||||
|
||||
| 接口 | <div style="width: 3em"></div> | 描述 |
|
||||
| --- | --- | --- |
|
||||
| [NotifyOneMessage](消息.md#notifyonemessage) | <span style="display:inline;color:#ff5555">服务端</span> | 给指定玩家发送聊天框消息 |
|
||||
| [SendMsg](消息.md#sendmsg) | <span style="display:inline;color:#ff5555">服务端</span> | 模拟玩家给所有人发送聊天栏消息 |
|
||||
| [SendMsgToPlayer](消息.md#sendmsgtoplayer) | <span style="display:inline;color:#ff5555">服务端</span> | 模拟玩家给另一个玩家发送聊天栏消息 |
|
||||
| [SetLeftCornerNotify](消息.md#setleftcornernotify) | <span style="display:inline;color:#7575f9">客户端</span> | 客户端设置左上角通知信息 |
|
||||
| [SetNotifyMsg](消息.md#setnotifymsg) | <span style="display:inline;color:#ff5555">服务端</span> | 设置消息通知 |
|
||||
| [SetOnePopupNotice](消息.md#setonepopupnotice) | <span style="display:inline;color:#ff5555">服务端</span> | 在具体某个玩家的物品栏上方弹出popup类型通知,位置位于tip类型消息下方,此功能更建议客户端使用game组件的对应接口SetPopupNotice |
|
||||
| [SetOneTipMessage](消息.md#setonetipmessage) | <span style="display:inline;color:#ff5555">服务端</span> | 在具体某个玩家的物品栏上方弹出tip类型通知,位置位于popup类型通知上方,此功能更建议在客户端使用game组件的对应接口SetTipMessage |
|
||||
| [SetPopupNotice](消息.md#setpopupnotice) | <span style="display:inline;color:#ff5555">服务端</span> | 在所有玩家物品栏上方弹出popup类型通知,位置位于tip类型消息下方 |
|
||||
| [SetPopupNotice](消息.md#setpopupnotice) | <span style="display:inline;color:#7575f9">客户端</span> | 在本地玩家的物品栏上方弹出popup类型通知,位置位于tip类型消息下方 |
|
||||
| [SetTipMessage](消息.md#settipmessage) | <span style="display:inline;color:#ff5555">服务端</span> | 在所有玩家物品栏上方弹出tip类型通知,位置位于popup类型通知上方 |
|
||||
| [SetTipMessage](消息.md#settipmessage) | <span style="display:inline;color:#7575f9">客户端</span> | 在本地玩家的物品栏上方弹出tip类型通知,位置位于popup类型通知上方 |
|
||||
|
||||
194
docs/mcdocs/1-ModAPI/接口/世界/自定义数据.md
Normal file
194
docs/mcdocs/1-ModAPI/接口/世界/自定义数据.md
Normal file
@@ -0,0 +1,194 @@
|
||||
---
|
||||
sidebarDepth: 1
|
||||
---
|
||||
# 自定义数据
|
||||
|
||||
## CleanExtraData
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.exDataCompServer.ExDataCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
清除实体的自定义数据或者世界的自定义数据,清除实体数据时使用对应实体id创建组件,清除世界数据时使用levelId创建组件
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| key | str | 自定义key |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置结果 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
# 清除实体数据
|
||||
entitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)
|
||||
suc = entitycomp.CleanExtraData("nickname")
|
||||
print "CleanExtraData entity=%s suc=%s" % (entityId, suc)
|
||||
# 清除全局数据
|
||||
levelcomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)
|
||||
suc = levelcomp.CleanExtraData("globalMsg")
|
||||
print "CleanExtraData for level suc=%s" % suc
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetExtraData
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.exDataCompServer.ExDataCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取实体的自定义数据或者世界的自定义数据,某个键所对应的值。获取实体数据时使用对应实体id创建组件,获取世界数据时使用levelId创建组件
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| key | str | 自定义key |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| any | key对应的值 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
# 获取全局数据
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)
|
||||
levelExData = comp.GetExtraData("globalMsg")
|
||||
# 获取
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)
|
||||
nickName = comp.GetExtraData("nickName")
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetWholeExtraData
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.exDataCompServer.ExDataCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
获取完整的实体的自定义数据或者世界的自定义数据,获取实体数据时使用对应实体id创建组件,获取世界数据时使用levelId创建组件
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| dict或None | 获取指定实体或者全局的额外存储数据字典,假如没有任何额外存储数据,那么返回None或者空字典 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
#获取实体数据字典
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)
|
||||
dataDict = comp.GetWholeExtraData()
|
||||
if dataDict:
|
||||
for key, value in dataDict.iteritems():
|
||||
print "key=%s value=%s" % (key, str(value))
|
||||
#获取全局数据字典
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)
|
||||
dataDict = comp.GetWholeExtraData()
|
||||
if dataDict:
|
||||
for key, value in dataDict.iteritems():
|
||||
print "key=%s value=%s" % (key, str(value))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SaveExtraData
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.exDataCompServer.ExDataCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
用于保存实体的自定义数据或者世界的自定义数据
|
||||
|
||||
- 参数
|
||||
|
||||
无
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 保存结果 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
# 设置实体的自定义数据
|
||||
entitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)
|
||||
entitycomp.SetExtraData("nickname", "steve", False)
|
||||
entitycomp.SetExtraData("score", 256, False)
|
||||
# more data to set
|
||||
entitycomp.SaveExtraData()
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SetExtraData
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.exDataCompServer.ExDataCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
用于设置实体的自定义数据或者世界的自定义数据,数据以键值对的形式保存。设置实体数据时使用对应实体id创建组件,设置世界数据时使用levelId创建组件
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| key | str | 自定义key |
|
||||
| value | any | key对应的值,支持python基本数据类型 |
|
||||
| autoSave | bool | 默认自动保存,默认为True,如果批量设置数据,请将该参数设置为False,同时在设置数据完毕时调用SaveExtraData接口 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 设置结果 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
# 设置实体的自定义数据
|
||||
entitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)
|
||||
entitycomp.SetExtraData("nickname","steve")
|
||||
entitycomp.SetExtraData("score",256)
|
||||
# 设置世界的自定义数据
|
||||
levelcomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)
|
||||
levelcomp.SetExtraData("globalMsg","helloWorld")
|
||||
```
|
||||
|
||||
|
||||
|
||||
247
docs/mcdocs/1-ModAPI/接口/世界/配方.md
Normal file
247
docs/mcdocs/1-ModAPI/接口/世界/配方.md
Normal file
@@ -0,0 +1,247 @@
|
||||
---
|
||||
sidebarDepth: 1
|
||||
---
|
||||
# 配方
|
||||
|
||||
## AddBrewingRecipes
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.recipeCompServer.RecipeCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
添加酿造台配方的接口
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| brewType | str | recipe_brewing_mix或者recipe_brewing_container,recipe_brewing_mix代表混合酿造配方,recipe_brewing_container代表换容酿造配方 |
|
||||
| inputName | str | 该配方接受的物品 |
|
||||
| reagentName | str | 酿造所需要的额外物品 |
|
||||
| outputName | str | 该配方输出的物品 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| bool | 是否设置成功 |
|
||||
|
||||
- 备注
|
||||
- 输出的物品无法和原来的物品堆叠一起
|
||||
- 对于已有的配方会返回False
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateRecipe(serverApi.GetLevelId())
|
||||
print(comp.AddBrewingRecipes("recipe_brewing_container", "minecraft:potion", "minecraft:gunpowder", "minecraft:splash_potion"))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetRecipeResult
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span>
|
||||
|
||||
method in mod.server.component.recipeCompServer.RecipeCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
根据配方id获取配方结果。仅支持合成配方
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| recipeId | str | 配方id,对应配方json文件中的identifier字段 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| list(dict) | list的元素resultDict字典见备注 |
|
||||
|
||||
- 备注
|
||||
- resultDict字典内容如下
|
||||
| 关键字 | 数据类型 | 说明 |
|
||||
| ----------| --------------------- | ---------|
|
||||
| itemName | str | 物品名称id |
|
||||
|auxValue| int | 物品附加值 |
|
||||
|num| int | 物品数目 |
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateRecipe(serverApi.GetLevelId())
|
||||
comp.GetRecipeResult(recipe1)
|
||||
comp.GetRecipeResult(recipe2)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetRecipesByInput
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
### 服务端接口
|
||||
|
||||
<span id="s0"></span>
|
||||
method in mod.server.component.recipeCompServer.RecipeCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
通过输入物品查询配方
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| inputIdentifier | str | 输入物品的标识符 |
|
||||
| tag | str | 对应配方json中的tags字段里面的值 |
|
||||
| aux | int | 输出物品的附加值, 不传参的话默认为0 |
|
||||
| maxResultNum | int | 最大输出条目数,若大于等于0时,结果超过maxResultNum,则只返回maxResultNum条。默认-1,表示返回全部 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| list(dict) | 返回符合条件的配方列表 |
|
||||
|
||||
- 备注
|
||||
- 获取熔炉配方时,若输出物品数量为1时,output使用字符串表示物品identifier及附加值;若输出物品数量大于1时,output为一个dict
|
||||
- 在获取酿造台配方时,不匹配tag标签与aux值,药水的identifier需要输入全称,例如:minecraft:potion_type:long_turtle_master,否则无法获取正确的配方。
|
||||
- 需要遍历较多数据,不建议频繁调用
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateRecipe(serverApi.GetLevelId())
|
||||
print(comp.GetRecipesByInput("minecraft:log", "crafting_table", 0, -1))
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 客户端接口
|
||||
|
||||
<span id="c0"></span>
|
||||
method in mod.client.component.recipeCompClient.RecipeCompClient
|
||||
|
||||
- 描述
|
||||
|
||||
通过输入物品查询配方
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| inputIdentifier | str | 输入物品的标识符 |
|
||||
| tag | str | 对应配方json中的tags字段里面的值 |
|
||||
| aux | int | 输出物品的附加值, 不传参的话默认为0 |
|
||||
| maxResultNum | int | 最大输出条目数,若大于等于0时,结果超过maxResultNum,则只返回maxResultNum条。默认-1,表示返回全部 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| list(dict) | 返回符合条件的配方列表 |
|
||||
|
||||
- 备注
|
||||
- 获取熔炉配方时,若输出物品数量为1时,output使用字符串表示物品identifier及附加值;若输出物品数量大于1时,output为一个dict
|
||||
- 在获取酿造台配方时,不匹配tag标签与aux值,药水的identifier需要输入全称,例如:minecraft:potion_type:long_turtle_master,否则无法获取正确的配方。
|
||||
- 需要遍历较多数据,不建议频繁调用
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateRecipe(clientApi.GetLevelId())
|
||||
print(comp.GetRecipesByInput("minecraft:log", "crafting_table", 0, -1))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GetRecipesByResult
|
||||
|
||||
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
|
||||
|
||||
### 服务端接口
|
||||
|
||||
<span id="s0"></span>
|
||||
method in mod.server.component.recipeCompServer.RecipeCompServer
|
||||
|
||||
- 描述
|
||||
|
||||
通过输出物品查询配方所需要的输入材料
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| resultIdentifier | str | 输出物品的标识符 |
|
||||
| tag | str | 对应配方json中的tags字段里面的值 |
|
||||
| aux | int | 输出物品的附加值, 不传参的话默认为0 |
|
||||
| maxResultNum | int | 最大输出条目数,若大于等于0时,结果超过maxResultNum,则只返回maxResultNum条。默认-1,表示返回全部 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| list(dict) | 返回符合条件的配方列表 |
|
||||
|
||||
- 备注
|
||||
- 获取熔炉配方时,若输出物品数量为1时,output使用字符串表示物品identifier及附加值;若输出物品数量大于1时,output为一个dict
|
||||
- 在获取酿造台配方时,不匹配tag标签与aux值,药水的identifier需要输入全称,例如:minecraft:potion_type:long_turtle_master,否则无法获取正确的配方。
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateRecipe(serverApi.GetLevelId())
|
||||
print(comp.GetRecipesByResult("minecraft:boat", "crafting_table", 4, -1))
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 客户端接口
|
||||
|
||||
<span id="c0"></span>
|
||||
method in mod.client.component.recipeCompClient.RecipeCompClient
|
||||
|
||||
- 描述
|
||||
|
||||
通过输出物品查询配方所需要的输入材料
|
||||
|
||||
- 参数
|
||||
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| resultIdentifier | str | 输出物品的标识符 |
|
||||
| tag | str | 对应配方json中的tags字段里面的值 |
|
||||
| aux | int | 输出物品的附加值, 不传参的话默认为0 |
|
||||
| maxResultNum | int | 最大输出条目数,若大于等于0时,结果超过maxResultNum,则只返回maxResultNum条。默认-1,表示返回全部 |
|
||||
|
||||
- 返回值
|
||||
|
||||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- |
|
||||
| list(dict) | 返回符合条件的配方列表 |
|
||||
|
||||
- 备注
|
||||
- 获取熔炉配方时,若输出物品数量为1时,output使用字符串表示物品identifier及附加值;若输出物品数量大于1时,output为一个dict
|
||||
- 在获取酿造台配方时,不匹配tag标签与aux值,药水的identifier需要输入全称,例如:minecraft:potion_type:long_turtle_master,否则无法获取正确的配方。
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateRecipe(clientApi.GetLevelId())
|
||||
print(comp.GetRecipesByResult("minecraft:boat", "crafting_table", 4, -1))
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user