更新3.4API
This commit is contained in:
@@ -74,6 +74,8 @@ sidebarDepth: 1
|
||||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| blockPos | tuple(float,float,float) | 方块坐标 |
|
||||
| blockName | str | 方块的identifier,包含命名空间及名称 |
|
||||
| auxData | int | 方块附加值 |
|
||||
|
||||
- 返回值
|
||||
|
||||
@@ -351,6 +353,7 @@ comp.ListenOnBlockRemoveEvent("minecraft:wheat", True)
|
||||
| blockName | str | 方块的identifier,包含命名空间及名称 |
|
||||
| auxValue | int | 方块附加值 |
|
||||
| newStrength | int | 变化后的红石信号量 |
|
||||
| oldStrength | int | 变化前的红石信号量 |
|
||||
| dimensionId | int | 维度 |
|
||||
|
||||
- 返回值
|
||||
@@ -413,9 +416,6 @@ comp.ListenOnBlockRemoveEvent("minecraft:wheat", True)
|
||||
|
||||
无
|
||||
|
||||
- 备注
|
||||
- 有的方块是在ServerBlockUseEvent中设置cancel生效,但是有部分方块是在ClientBlockUseEvent中设置cancel才生效,如有需求建议在两个事件中同时设置cancel以保证生效。
|
||||
|
||||
在零件中直接声明一个同名函数,即可完成监听,详情参考<a href="../../../mcguide/20-玩法开发/14-预设玩法编程/12-深入理解零件/0-零件开发.html#零件事件">零件事件</a>
|
||||
|
||||
|
||||
@@ -449,7 +449,7 @@ import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateBlockUseEventWhiteList(clientApi.GetLevelId())
|
||||
comp.AddBlockItemListenForUseEvent("minecraft:nether_brick_stairs:2")
|
||||
# 注意blockName格式为namespace:name:auxvalue,如果不填auxvalue,则默认为所有auxvalue
|
||||
# auxValue详细值详见官方wiki,如https://minecraft-zh.gamepedia.com/楼梯 中的‘方块数据值’
|
||||
# auxValue详细值详见官方wiki,如https://zh.minecraft.wiki/w/楼梯 中的‘方块数据值’
|
||||
```
|
||||
|
||||
|
||||
@@ -482,7 +482,7 @@ import mod.client.extraClientApi as clientApi
|
||||
comp = clientApi.GetEngineCompFactory().CreateBlockUseEventWhiteList(clientApi.GetLevelId())
|
||||
comp.RemoveBlockItemListenForUseEvent("minecraft:nether_brick_stairs:2")
|
||||
# 注意blockName格式为namespace:name:auxvalue,如果不填auxvalue,则默认为所有auxvalue
|
||||
# auxValue详细值详见官方wiki,如https://minecraft-zh.gamepedia.com/楼梯 中的‘方块数据值’
|
||||
# auxValue详细值详见官方wiki,如https://zh.minecraft.wiki/w/楼梯 中的‘方块数据值’
|
||||
```
|
||||
|
||||
|
||||
@@ -1700,7 +1700,6 @@ comp.UnRegisterOnStandOn("minecraft:redstone_ore")
|
||||
|
||||
- 备注
|
||||
- 当对原生方块进行使用时,如堆肥桶等类似有 使用 功能的方块使用物品时,会触发该事件,而ServerItemUseOnEvent则不会被触发。对应的客户端事件同理。
|
||||
- 有的方块是在ServerBlockUseEvent中设置cancel生效,但是有部分方块是在ClientBlockUseEvent中设置cancel才生效,如有需求建议在两个事件中同时设置cancel以保证生效。
|
||||
- 部分工具对方块的使用效果,如锹犁地,不一定能通过该事件cancel,还需同时使用ItemUseOnServerEvent进行取消
|
||||
目前已知有:
|
||||
锹犁地相关的方块:草地、泥土、砂土、菌丝体、灰化土、缠根泥土,均需同时通过ServerBlockUseEvent和ItemUseOnServerEvent进行取消
|
||||
@@ -1738,7 +1737,7 @@ import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockUseEventWhiteList(levelId)
|
||||
comp.AddBlockItemListenForUseEvent("minecraft:nether_brick_stairs:2")
|
||||
# 注意blockName格式为namespace:name:auxvalue,如果不填auxvalue,则默认为所有auxvalue
|
||||
# auxValue详细值详见官方wiki,如https://minecraft-zh.gamepedia.com/楼梯 中的‘方块数据值’
|
||||
# auxValue详细值详见官方wiki,如https://zh.minecraft.wiki/w/楼梯 中的‘方块数据值’
|
||||
```
|
||||
|
||||
|
||||
@@ -1771,7 +1770,7 @@ import mod.server.extraServerApi as serverApi
|
||||
comp = serverApi.GetEngineCompFactory().CreateBlockUseEventWhiteList(levelId)
|
||||
comp.RemoveBlockItemListenForUseEvent("minecraft:nether_brick_stairs:2")
|
||||
# 注意blockName格式为namespace:name:auxvalue,如果不填auxvalue,则默认为所有auxvalue
|
||||
# auxValue详细值详见官方wiki,如https://minecraft-zh.gamepedia.com/楼梯 中的‘方块数据值’
|
||||
# auxValue详细值详见官方wiki,如https://zh.minecraft.wiki/w/楼梯 中的‘方块数据值’
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user