This commit is contained in:
boybook
2025-12-01 20:59:16 +08:00
parent 12738a142c
commit 760c2dd9ad
5535 changed files with 21070 additions and 2021 deletions

View File

@@ -341,8 +341,9 @@ method in mod.server.component.itemCompServer.ItemCompServer
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| playerId | str | 玩家id |
| slot | int | 容器槽位含义见:[容器类型枚举](../../枚举值/PlayerUISlot.md) |
| slot | int | 容器槽位。在isNeteaseUI为True时代表netease_ui_container中对应槽位isNeteaseUI为False时含义见:[容器类型枚举](../../枚举值/PlayerUISlot.md) |
| getUserData | bool | 是否获取userData默认为False |
| isNeteaseUI | bool | 默认为falsetrue时获取netease_ui_container的物品 |
- 返回值
@@ -352,7 +353,7 @@ method in mod.server.component.itemCompServer.ItemCompServer
- 备注
- 合成容器包括工作台、铁砧、附魔台、织布机、砂轮、切石机、制图台、锻造台。
- 所有合成容器槽位共享,不会根据不同容器重新排列
- 所有合成容器槽位共享,不会根据不同容器重新排列。网易ui容器独立于原版合成容器不同自定义容器中的netease_ui_container共享槽位。
- 示例
@@ -523,9 +524,10 @@ method in mod.server.component.itemCompServer.ItemCompServer
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| playerId | str | 玩家id |
| slot | int | 容器槽位含义见:[容器类型枚举](../../枚举值/PlayerUISlot.md) |
| slot | int | 容器槽位。在isNeteaseUI为True时代表netease_ui_container中对应槽位isNeteaseUI为False时含义见:[容器类型枚举](../../枚举值/PlayerUISlot.md) |
| itemDict | dict | <a href="../../../../mcguide/20-玩法开发/10-基本概念/1-我的世界基础概念.html#物品信息字典#物品信息字典">物品信息字典</a>没有物品则返回None |
| needBack | bool | 是否将容器槽位的已有物品放回至玩家背包中默认为True。设置为False时则会直接用itemDict中的物品覆盖容器槽位的已有物品。 |
| isNeteaseUI | bool | 默认为falsetrue时设置netease_ui_container的物品 |
- 返回值
@@ -537,6 +539,7 @@ method in mod.server.component.itemCompServer.ItemCompServer
- 合成容器包括工作台、铁砧、附魔台、织布机、砂轮、切石机、制图台、锻造台。
- 如果原槽位有物品,则会将原有物品放入玩家背包。如果玩家背包已满,则会在世界中玩家当前的位置生成对应的物品掉落物。
- 注意所有合成容器槽位共享不会根据不同容器重新排列没有打开容器或者打开了别的容器该接口会返回False。
- 如果设置的是netease_ui_container即使没有打开容器也能设置成功所有netease_ui_container槽位共享。
- 下面情况视为清空特定槽位:itemDict为None为{}, 或itemName为minecraft:air或者count为0同时needBack参数为False
- 由于创造输出物品生成位比较特殊该接口已经屏蔽了slot = 50的情况即无法设置创造输出位的物品。
@@ -584,7 +587,7 @@ method in mod.server.component.itemCompServer.ItemCompServer
- 备注
- 此接口不支持末影箱。对应的末影箱接口请参考 [SpawnItemToEnderChest](#spawnitemtoenderchest)
- 下面情况视为清空特定槽位:itemDict为空为{}, 或itemName为minecraft:air或者count为0
- 目前该接口支持的容器类型方块:箱子、潜影盒、漏斗、木桶、投掷器、发射器
- 目前该接口支持的容器类型方块:箱子、潜影盒、漏斗、木桶、投掷器、发射器、自定义容器
- 示例

View File

@@ -133,8 +133,8 @@ method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
blockDict = comp.SetBlockBasicInfo("minecraft:stone", {"blockLightEmission":1,
"blockLightAbsorption":1,
blockDict = comp.SetBlockBasicInfo("custom:custom_block", {"destroyTime":1,
"loot":"loot_tables/block/custom_block_drop.json",
"solid":False,
"tier":{"level":3}})
```

View File

@@ -123,6 +123,43 @@ print comp.DeleteClientDropItemEntity(entityId)
## DestroyCrackFrame
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.blockInfoCompClient.BlockInfoComponentClient
- 描述
销毁特定方块位置上的破坏纹理仅能销毁SetCrackFrame接口创建的破坏纹理
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| dimensionId | int | 方块所在维度。 |
| blockPos | tuple(int,int,int) | 目标方块的坐标。 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否执行成功。 |
- 备注
- 如果方块被替换,需开发者主动销毁裂纹
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)
# 销毁位置(30,66,30)的破坏纹理
comp.DestroyCrackFrame(0, (30, 66, 30))
```
## GetBlockEntityExtraUniforms
<span style="display:inline;color:#7575f9">客户端</span>
@@ -444,7 +481,7 @@ method in mod.client.component.blockInfoCompClient.BlockInfoComponentClient
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| pos | tuple(int,int,int) | 方块所在位置 |
| scale | tuple(int,int,int) | 实体模型在x,y,z各个轴上的缩放值。支持负值当某一轴的缩放值为负值时表示模型将会在这个轴上进行以另外两个轴为对称平面的镜像变换。 |
| scale | tuple(float,float,float) | 实体模型在x,y,z各个轴上的缩放值。支持负值当某一轴的缩放值为负值时表示模型将会在这个轴上进行以另外两个轴为对称平面的镜像变换。 |
- 返回值
@@ -454,7 +491,7 @@ method in mod.client.component.blockInfoCompClient.BlockInfoComponentClient
- 备注
- 模型的大小可以通过两个方式来调整:
(1) 在entity.json中scripts字段下定义scale如下所示
(1) 在entity.json中scripts字段下定义scale如下所示
"minecraft:client_entity": {
...
"scripts":{
@@ -549,3 +586,79 @@ print comp.SetBlockRenderDistance(48)
## SetCrackFrame
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.blockInfoCompClient.BlockInfoComponentClient
- 描述
仅客户端的破坏纹理的渲染,可自定义破坏阶段在第几帧。
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| dimensionId | int | 方块所在维度。 |
| blockPos | tuple(int,int,int) | 目标方块的坐标。 |
| frame | int | 第几张纹理取值范围0-9。 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否执行成功(不代表必定能显示裂纹)。 |
- 备注
- 目前自定义方块实体外观不支持裂纹的显示client_entity、netease_model
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)
# 在(30,66,30)这个位置播放破坏方块的纹理进度为1
comp.SetCrackFrame(0, (30, 66, 30), 1)
```
## SetDropItemTransform
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.itemCompClient.ItemCompClient
- 描述
设置通过AddDropItemToWorld添加的掉落物的位置、角度和缩放
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| entityId | str | 掉落物的entityIdentityId可在调用[AddDropItemToWorld](#AddDropItemToWorld)时保存返回值,或者通过[GetClientDropItemEntityIdList](#GetClientDropItemEntityIdList)接口获取list |
| position | tuple(float,float,float) | 生成的掉落物所在位置。如需设置后续参数需填写None占位传None表示不修改 |
| rotation | tuple(float,float,float) | 选填设置掉落物的角度不填默认为None设置rotation后将会固定角度[AddDropItemToWorld](#AddDropItemToWorld)设置的spinSpeed无效。如需设置后续参数需填写None占位传None表示不修改 |
| scale | float | 选填设置掉落物的缩放不填默认为None传None表示不修改 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否成功 |
- 备注
- Scale不能为负数设置过大可能会导致掉落物消失同时Scale过大会出现某些摄像机视角不会渲染的情况
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateItem(levelId)
print comp.SetDropItemTransform(entityId, (10, 10, 10), (90, 45, 30), 1.5) # entityId需要AddDropItemToWorld接口获取
```

View File

@@ -104,6 +104,7 @@ sidebarDepth: 1
| [AddDropItemToWorld](渲染.md#adddropitemtoworld) | <span style="display:inline;color:#7575f9">客户端</span> | 在客户端添加一个掉落物渲染 |
| [ChangeBlockTextures](渲染.md#changeblocktextures) | <span style="display:inline;color:#7575f9">客户端</span> | 替换方块贴图 |
| [DeleteClientDropItemEntity](渲染.md#deleteclientdropitementity) | <span style="display:inline;color:#7575f9">客户端</span> | 删除AddDropItemToWorld创建的客户端掉落物 |
| [DestroyCrackFrame](渲染.md#destroycrackframe) | <span style="display:inline;color:#7575f9">客户端</span> | 销毁特定方块位置上的破坏纹理仅能销毁SetCrackFrame接口创建的破坏纹理。 |
| [GetBlockEntityExtraUniforms](渲染.md#getblockentityextrauniforms) | <span style="display:inline;color:#7575f9">客户端</span> | 获取在自定义方块实体的shader当中使用的自定义变量的值该自定义变量总共可设置EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4总共4组每组为一个vec4(float, float, float ,float)类型的向量。 |
| [GetBlockRenderDistance](渲染.md#getblockrenderdistance) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家周围的可渲染距离 |
| [GetBlockTextures](渲染.md#getblocktextures) | <span style="display:inline;color:#7575f9">客户端</span> | 获取方块的初始贴图信息 |
@@ -115,6 +116,8 @@ sidebarDepth: 1
| [SetBlockEntityModelScale](渲染.md#setblockentitymodelscale) | <span style="display:inline;color:#7575f9">客户端</span> | 设置自定义方块实体的实体模型大小的缩放值可通过该接口来调整自定义方块实体的实体模型的大小。只有自定义方块实体定义实体模型才生效实体模型在resource_pack/entity/下定义,详细可参考自定义方块实体动画的教学文档。 |
| [SetBlockEntityParticlePosOffset](渲染.md#setblockentityparticleposoffset) | <span style="display:inline;color:#7575f9">客户端</span> | 设置自定义方块实体中粒子特效位置偏移值,用于调整粒子特效相对于方块位置的偏移。与特效/粒子/SetPos接口不同该接口调整的是相对于方块位置的位置偏移值而不是世界坐标。 |
| [SetBlockRenderDistance](渲染.md#setblockrenderdistance) | <span style="display:inline;color:#7575f9">客户端</span> | 设置玩家周围方块的可渲染距离 |
| [SetCrackFrame](渲染.md#setcrackframe) | <span style="display:inline;color:#7575f9">客户端</span> | 仅客户端的破坏纹理的渲染,可自定义破坏阶段在第几帧。 |
| [SetDropItemTransform](渲染.md#setdropitemtransform) | <span style="display:inline;color:#7575f9">客户端</span> | 设置通过AddDropItemToWorld添加的掉落物的位置、角度和缩放 |
### 容器