Manual:LevelEventHook:修订间差异

来自Minecraft基岩版开发Wiki
添加的内容 删除的内容
→‎参数
标签2017年版源代码编辑
(文本替换 - 替换“{{lowercase c}}”为“{{lowercase cu}}”)
 
(未显示同一用户的8个中间版本)
第1行: 第1行:
{{lowercase c}}{{Function
{{lowercase cu}}{{Function
|title=levelEventHook
|title=levelEventHook
|type=hk
|type=hk
第20行: 第20行:
==参数==
==参数==
;参数一 {{cd|''player''}}
;参数一 {{cd|''player''}}
:int类型,该存档事件来自的客户端对应的玩家的UUID。
:int类型,广播该存档事件的客户端对应的玩家的UUID{{verify}}
;参数二 {{cd|''eventType''}}
;参数二 {{cd|''eventType''}}
:int类型,事件类型的数字ID。
:int类型,事件类型的数字ID。
第32行: 第32行:
:int类型,该存档事件的数据值。
:int类型,该存档事件的数据值。


==上下文==
==挂钩上下文==
一个[[存档事件]]游戏的存档事件广播器广播。
一个[[存档事件]]游戏的存档事件广播器广播。


==存档事件列表==
==存档事件列表==
{{needs update|section=1}}
{| class="wikitable"
{| class="wikitable"
! 枚举键 !! 值 !! 描述
! 枚举键 !! 值 !! 描述
|-
|-
| Undefined || 0 ||
| Undefined || 0 || 未定义事件
|-
|-
| SoundClick || 1000 ||
| SoundClick || 1000 || 音效:点击
|-
|-
| SoundClickFail || 1001 ||
| SoundClickFail || 1001 || 音效:点击失败
|-
|-
| SoundLaunch || 1002 ||
| SoundLaunch || 1002 || 音效:启动
|-
|-
| SoundOpenDoor || 1003 ||
| SoundOpenDoor || 1003 || 音效:开门
|-
|-
| SoundFizz || 1004 ||
| SoundFizz || 1004 || 音效:滋滋声
|-
|-
| SoundFuse || 1005 ||
| SoundFuse || 1005 || 音效:熔化
|-
|-
| SoundPlayRecording || 1006 ||
| SoundPlayRecording || 1006 || 音效:播放唱片
|-
|-
| SoundGhastWarning || 1007 ||
| SoundGhastWarning || 1007 || 音效:恶魂警告
|-
|-
| SoundGhastFireball || 1008 ||
| SoundGhastFireball || 1008 || 音效:恶魂火球
|-
|-
| SoundBlazeFireball || 1009 ||
| SoundBlazeFireball || 1009 || 音效:烈焰人火球
|-
|-
| SoundZombieWoodenDoor || 1010 ||
| SoundZombieWoodenDoor || 1010 || 音效:僵尸砸门
|-
|-
| SoundZombieDoorCrash || 1012 ||
| SoundZombieDoorCrash || 1012 || 音效:僵尸破门
|-
|-
| SoundZombieInfected || 1016 ||
| SoundZombieInfected || 1016 || 音效:僵尸感染
|-
|-
| SoundZombieConverted || 1017 ||
| SoundZombieConverted || 1017 || 音效:僵尸恢复
|-
|-
| SoundEndermanTeleport || 1018 ||
| SoundEndermanTeleport || 1018 || 音效:末影螨传送
|-
|-
| SoundAnvilBroken || 1020 ||
| SoundAnvilBroken || 1020 || 音效:铁砧损坏
|-
|-
| SoundAnvilUsed || 1021 ||
| SoundAnvilUsed || 1021 || 音效:铁砧使用
|-
|-
| SoundAnvilLand || 1022 ||
| SoundAnvilLand || 1022 || 音效:铁砧落地
|-
|-
| SoundInfinityArrowPickup || 1030 ||
| SoundInfinityArrowPickup || 1030 || 音效:无线箭矢获取
|-
|-
| SoundTeleportEnderPearl || 1032 ||
| SoundTeleportEnderPearl || 1032 || 音效:末影珍珠传送
|-
|-
| SoundAddItem || 1040 ||
| SoundAddItem || 1040 || 音效:添加物品
|-
|-
| SoundItemFrameBreak || 1041 ||
| SoundItemFrameBreak || 1041 || 音效:物品展示框破碎
|-
|-
| SoundItemFramePlace || 1042 ||
| SoundItemFramePlace || 1042 || 音效:物品展示框放置
|-
|-
| SoundItemFrameRemoveItem || 1043 ||
| SoundItemFrameRemoveItem || 1043 || 音效:物品展示框移除物品
|-
|-
| SoundItemFrameRotateItem || 1044 ||
| SoundItemFrameRotateItem || 1044 || 音效:物品展示框旋转物品
|-
|-
| SoundExperienceOrbPickup || 1051 ||
| SoundExperienceOrbPickup || 1051 || 音效:拾起经验球
|-
|-
| SoundTotemUsed || 1052 ||
| SoundTotemUsed || 1052 || 音效:使用图腾
|-
|-
| SoundArmorStandBreak || 1060 ||
| SoundArmorStandBreak || 1060 || 音效:盔甲架破碎
|-
|-
| SoundArmorStandHit || 1061 ||
| SoundArmorStandHit || 1061 || 音效:盔甲架受到攻击
|-
|-
| SoundArmorStandLand || 1062 ||
| SoundArmorStandLand || 1062 || 音效:盔甲架落地
|-
|-
| SoundArmorStandPlace || 1063 ||
| SoundArmorStandPlace || 1063 || 音效:盔甲架放置
|-
|-
| ParticlesShoot || 2000 ||
| ParticlesShoot || 2000 || 粒子:发射
|-
|-
| ParticlesDestroyBlock || 2001 ||
| ParticlesDestroyBlock || 2001 || 粒子:摧毁方块
|-
|-
| ParticlesPotionSplash || 2002 ||
| ParticlesPotionSplash || 2002 || 粒子:药水喷溅
|-
|-
| ParticlesEyeOfEnderDeath || 2003 ||
| ParticlesEyeOfEnderDeath || 2003 || 粒子:末影之眼死亡
|-
|-
| ParticlesMobBlockSpawn || 2004 ||
| ParticlesMobBlockSpawn || 2004 || 粒子:生物方块生成
|-
|-
| ParticleCropGrowth || 2005 ||
| ParticleCropGrowth || 2005 || 粒子:作物生长
|-
|-
| ParticleSoundGuardianGhost || 2006 ||
| ParticleSoundGuardianGhost || 2006 || 粒子音效:守卫者恶魂
|-
|-
| ParticleDeathSmoke || 2007 ||
| ParticleDeathSmoke || 2007 || 粒子:死亡烟雾
|-
|-
| ParticleDenyBlock || 2008 ||
| ParticleDenyBlock || 2008 || 粒子:拒绝方块
|-
|-
| ParticleGenericSpawn || 2009 ||
| ParticleGenericSpawn || 2009 || 粒子:常规生成
|-
|-
| ParticlesDragonEgg || 2010 ||
| ParticlesDragonEgg || 2010 || 粒子:龙蛋
|-
|-
| ParticlesCropEaten || 2011 ||
| ParticlesCropEaten || 2011 || 粒子:作物被啃食
|-
|-
| ParticlesCrit || 2012 ||
| ParticlesCrit || 2012 || 粒子:暴击
|-
|-
| ParticlesTeleport || 2013 ||
| ParticlesTeleport || 2013 || 粒子:传送
|-
|-
| ParticlesCrackBlock || 2014 ||
| ParticlesCrackBlock || 2014 || 粒子:方块产生裂痕
|-
|-
| ParticlesBubble || 2015 ||
| ParticlesBubble || 2015 || 粒子:气泡
|-
|-
| ParticlesEvaporate || 2016 ||
| ParticlesEvaporate || 2016 || 粒子:蒸发
|-
|-
| ParticlesDestroyArmorStand || 2017 ||
| ParticlesDestroyArmorStand || 2017 || 粒子:摧毁盔甲架
|-
|-
| ParticlesBreakingEgg || 2018 ||
| ParticlesBreakingEgg || 2018 || 粒子:蛋破碎
|-
|-
| ParticleDestroyEgg || 2019 ||
| ParticleDestroyEgg || 2019 || 粒子:摧毁蛋
|-
|-
| ParticlesEvaporateWater || 2020 ||
| ParticlesEvaporateWater || 2020 || 粒子:蒸发水
|-
|-
| ParticlesDestroyBlockNoSound || 2021 ||
| ParticlesDestroyBlockNoSound || 2021 || 粒子:无声摧毁方块
|-
|-
| ParticlesKnockbackRoar || 2022 ||
| ParticlesKnockbackRoar || 2022 || 粒子:击退咆哮
|-
|-
| ParticlesTeleportTrail || 2023 ||
| ParticlesTeleportTrail || 2023 || 粒子:传送拖尾
|-
|-
| ParticlesPointCloud || 2024 ||
| ParticlesPointCloud || 2024 || 粒子:药水效果云
|-
|-
| ParticlesExplosion || 2025 ||
| ParticlesExplosion || 2025 || 粒子:爆炸
|-
|-
| ParticlesBlockExplosion || 2026 ||
| ParticlesBlockExplosion || 2026 || 粒子:方块爆炸
|-
|-
| StartRaining || 3001 ||
| StartRaining || 3001 || 时间:开始雨雪
|-
|-
| StartThunderstorm || 3002 ||
| StartThunderstorm || 3002 || 时间:开始雷暴
|-
|-
| StopRaining || 3003 ||
| StopRaining || 3003 || 时间:停止雨雪
|-
|-
| StopThunderstorm || 3004 ||
| StopThunderstorm || 3004 || 时间:停止雷暴
|-
|-
| GlobalPause || 3005 ||
| GlobalPause || 3005 || 时间:全局暂停
|-
|-
| SimTimeStep || 3006 ||
| SimTimeStep || 3006 || 时间:模拟时间步进
|-
|-
| SimTimeScale || 3007 ||
| SimTimeScale || 3007 || 时间:模拟时间放缩
|-
|-
| ActivateBlock || 3500 ||
| ActivateBlock || 3500 || 方块:激活方块
|-
|-
| CauldronExplode || 3501 ||
| CauldronExplode || 3501 || 方块:炼药锅爆炸
|-
|-
| CauldronDyeArmor || 3502 ||
| CauldronDyeArmor || 3502 || 方块:炼药锅盔甲染色
|-
|-
| CauldronCleanArmor || 3503 ||
| CauldronCleanArmor || 3503 || 方块:炼药锅盔甲清洗
|-
|-
| CauldronFillPotion || 3504 ||
| CauldronFillPotion || 3504 || 方块:炼药锅填充药水
|-
|-
| CauldronTakePotion || 3505 ||
| CauldronTakePotion || 3505 || 方块:炼药锅取回药水
|-
|-
| CauldronFillWater || 3506 ||
| CauldronFillWater || 3506 || 方块:炼药锅填充水
|-
|-
| CauldronTakeWater || 3507 ||
| CauldronTakeWater || 3507 || 方块:炼药锅取回水
|-
|-
| CauldronAddDye || 3508 ||
| CauldronAddDye || 3508 || 方块:炼药锅添加染料
|-
|-
| CauldronCleanBanner || 3509 ||
| CauldronCleanBanner || 3509 || 方块:炼药锅旗帜清洗
|-
|-
| CauldronFlush || 3510 ||
| CauldronFlush || 3510 || 方块:炼药锅冲洗{{verify}}
|-
|-
| AgentSpawnEffect || 3511 ||
| AgentSpawnEffect || 3511 || 方块:智能体生成效果
|-
|-
| CauldronFillLava || 3512 ||
| CauldronFillLava || 3512 || 方块:炼药锅填充熔岩
|-
|-
| CauldronTakeLava || 3513 ||
| CauldronTakeLava || 3513 || 方块:炼药锅取回熔岩
|-
|-
| StartBlockCracking || 3600 ||
| StartBlockCracking || 3600 || 方块:方块开始产生裂痕
|-
|-
| StopBlockCracking || 3601 ||
| StopBlockCracking || 3601 || 方块:方块停止产生裂痕
|-
|-
| UpdateBlockCracking || 3602 ||
| UpdateBlockCracking || 3602 || 方块:方块更新裂痕规模
|-
|-
| AllPlayersSleeping || 9800 ||
| AllPlayersSleeping || 9800 || 玩家:所有玩家入睡
|-
|-
| JumpPrevented || 9810 ||
| JumpPrevented || 9810 || 玩家:跳跃被阻止
|-
|-
| ParticleLegacyEvent || 16384 ||
| ParticleLegacyEvent || 16384 || 粒子旧版事件
|}
|}



2022年7月23日 (六) 05:16的最新版本

levelEventHook
Function
钩子函数
参数类型
参数 1
Number:int
参数 2
Number:int
参数 3
Number:int
参数 4
Number:int
参数 5
Number:int
参数 6
Number:int
返回值类型
void
API
适用语言

levelEventHookModPE Script的一个钩子函数,当存档事件触发时会被调用。

语法[编辑]

function levelEventHook(player, eventType, x, y, z, data){}

参数[编辑]

参数一 player
int类型,广播该存档事件的客户端对应的玩家的UUID‌[需要验证]
参数二 eventType
int类型,事件类型的数字ID。
参数三 x
int类型,该存档事件发生的X坐标。
参数四 y
int类型,该存档事件发生的Y坐标。
参数五 z
int类型,该存档事件发生的Z坐标。
参数六 data
int类型,该存档事件的数据值。

挂钩上下文[编辑]

一个存档事件在游戏的存档事件广播器中广播。

存档事件列表[编辑]

枚举键 描述
Undefined 0 未定义事件
SoundClick 1000 音效:点击
SoundClickFail 1001 音效:点击失败
SoundLaunch 1002 音效:启动
SoundOpenDoor 1003 音效:开门
SoundFizz 1004 音效:滋滋声
SoundFuse 1005 音效:熔化
SoundPlayRecording 1006 音效:播放唱片
SoundGhastWarning 1007 音效:恶魂警告
SoundGhastFireball 1008 音效:恶魂火球
SoundBlazeFireball 1009 音效:烈焰人火球
SoundZombieWoodenDoor 1010 音效:僵尸砸门
SoundZombieDoorCrash 1012 音效:僵尸破门
SoundZombieInfected 1016 音效:僵尸感染
SoundZombieConverted 1017 音效:僵尸恢复
SoundEndermanTeleport 1018 音效:末影螨传送
SoundAnvilBroken 1020 音效:铁砧损坏
SoundAnvilUsed 1021 音效:铁砧使用
SoundAnvilLand 1022 音效:铁砧落地
SoundInfinityArrowPickup 1030 音效:无线箭矢获取
SoundTeleportEnderPearl 1032 音效:末影珍珠传送
SoundAddItem 1040 音效:添加物品
SoundItemFrameBreak 1041 音效:物品展示框破碎
SoundItemFramePlace 1042 音效:物品展示框放置
SoundItemFrameRemoveItem 1043 音效:物品展示框移除物品
SoundItemFrameRotateItem 1044 音效:物品展示框旋转物品
SoundExperienceOrbPickup 1051 音效:拾起经验球
SoundTotemUsed 1052 音效:使用图腾
SoundArmorStandBreak 1060 音效:盔甲架破碎
SoundArmorStandHit 1061 音效:盔甲架受到攻击
SoundArmorStandLand 1062 音效:盔甲架落地
SoundArmorStandPlace 1063 音效:盔甲架放置
ParticlesShoot 2000 粒子:发射
ParticlesDestroyBlock 2001 粒子:摧毁方块
ParticlesPotionSplash 2002 粒子:药水喷溅
ParticlesEyeOfEnderDeath 2003 粒子:末影之眼死亡
ParticlesMobBlockSpawn 2004 粒子:生物方块生成
ParticleCropGrowth 2005 粒子:作物生长
ParticleSoundGuardianGhost 2006 粒子音效:守卫者恶魂
ParticleDeathSmoke 2007 粒子:死亡烟雾
ParticleDenyBlock 2008 粒子:拒绝方块
ParticleGenericSpawn 2009 粒子:常规生成
ParticlesDragonEgg 2010 粒子:龙蛋
ParticlesCropEaten 2011 粒子:作物被啃食
ParticlesCrit 2012 粒子:暴击
ParticlesTeleport 2013 粒子:传送
ParticlesCrackBlock 2014 粒子:方块产生裂痕
ParticlesBubble 2015 粒子:气泡
ParticlesEvaporate 2016 粒子:蒸发
ParticlesDestroyArmorStand 2017 粒子:摧毁盔甲架
ParticlesBreakingEgg 2018 粒子:蛋破碎
ParticleDestroyEgg 2019 粒子:摧毁蛋
ParticlesEvaporateWater 2020 粒子:蒸发水
ParticlesDestroyBlockNoSound 2021 粒子:无声摧毁方块
ParticlesKnockbackRoar 2022 粒子:击退咆哮
ParticlesTeleportTrail 2023 粒子:传送拖尾
ParticlesPointCloud 2024 粒子:药水效果云
ParticlesExplosion 2025 粒子:爆炸
ParticlesBlockExplosion 2026 粒子:方块爆炸
StartRaining 3001 时间:开始雨雪
StartThunderstorm 3002 时间:开始雷暴
StopRaining 3003 时间:停止雨雪
StopThunderstorm 3004 时间:停止雷暴
GlobalPause 3005 时间:全局暂停
SimTimeStep 3006 时间:模拟时间步进
SimTimeScale 3007 时间:模拟时间放缩
ActivateBlock 3500 方块:激活方块
CauldronExplode 3501 方块:炼药锅爆炸
CauldronDyeArmor 3502 方块:炼药锅盔甲染色
CauldronCleanArmor 3503 方块:炼药锅盔甲清洗
CauldronFillPotion 3504 方块:炼药锅填充药水
CauldronTakePotion 3505 方块:炼药锅取回药水
CauldronFillWater 3506 方块:炼药锅填充水
CauldronTakeWater 3507 方块:炼药锅取回水
CauldronAddDye 3508 方块:炼药锅添加染料
CauldronCleanBanner 3509 方块:炼药锅旗帜清洗
CauldronFlush 3510 方块:炼药锅冲洗‌[需要验证]
AgentSpawnEffect 3511 方块:智能体生成效果
CauldronFillLava 3512 方块:炼药锅填充熔岩
CauldronTakeLava 3513 方块:炼药锅取回熔岩
StartBlockCracking 3600 方块:方块开始产生裂痕
StopBlockCracking 3601 方块:方块停止产生裂痕
UpdateBlockCracking 3602 方块:方块更新裂痕规模
AllPlayersSleeping 9800 玩家:所有玩家入睡
JumpPrevented 9810 玩家:跳跃被阻止
ParticleLegacyEvent 16384 粒子旧版事件

历史[编辑]

BlockLauncher
?加入了levelEventHook(entity, eventType, x, y, z, data)
?参数表中的entity改名为player
?将该函数从ModPE Script的函数转储中隐去。

Template:ModPE