- 致编者:请牢记我们的域名wiki.mcbe-dev.net!
- 致编者:欢迎加入本Wiki的官方交流QQ群或Discord服务器!
- 基岩版1.19.31现已发布!(了解更多)
- Inner Core现已支持Xbox模组联机!(了解更多)
- 如果您是第一次来到本Wiki,欢迎注册一个账户
- 点击顶部的“编辑”或“编辑源代码”按钮即可编辑当前页面
- 请知悉:在不登录时也可以编辑和新建页面,但是您当前的IP地址会记录在编辑历史中
Manual:LevelEventHook:修订间差异
来自Minecraft基岩版开发Wiki
添加的内容 删除的内容
WikiHelper(留言 | 贡献) 小 (文本替换 - 替换“ {{ModPE}}”为“ {{ModPE}}”) |
Miemie Method(留言 | 贡献) 小 (→上下文) 标签:2017年版源代码编辑 |
||
(未显示同一用户的6个中间版本) | |||
第1行: | 第1行: | ||
{{lowercase c}}{{Function |
|||
===语法=== |
|||
|title=levelEventHook |
|||
|type=hk |
|||
===参数=== |
|||
|par1=numi |
|||
;参数一 |
|||
|par2=numi |
|||
entity: 触发爆炸的实体 |
|||
|par3=numi |
|||
;参数二 |
|||
|par4=numi |
|||
eventType: 事件类型(观测数据。开关门数据为1003,羊吃草的数据为2001,睡觉的数据为9800) |
|||
|par5=numi |
|||
;参数三 |
|||
|par6=numi |
|||
x: x轴坐标 |
|||
|return=void |
|||
;参数四 |
|||
|api=modpe |
|||
y: y轴坐标 |
|||
|lang=js |
|||
;参数五 |
|||
|added= |
|||
z: z轴坐标 |
|||
}} |
|||
;参数六 |
|||
{{samp|'''levelEventHook'''}}是[[ModPE Script]]的一个钩子函数,当[[存档事件]]触发时会被调用。 |
|||
data: 未知(观测数据。开关门,睡觉的数据为0,羊吃草的数据为2) |
|||
===效果=== |
|||
==语法== |
|||
当门(木门,栅栏门,陷阱门)被打开或关闭时触发;当羊吃掉草时触发;睡觉时触发 |
|||
<code>function levelEventHook(''player'', ''eventType'', ''x'', ''y'', ''z'', ''data''){}</code> |
|||
<pre> |
|||
已停用! |
|||
==参数== |
|||
</pre> |
|||
;参数一 {{cd|''player''}} |
|||
:int类型,广播该存档事件的客户端对应的玩家的UUID。 |
|||
;参数二 {{cd|''eventType''}} |
|||
:int类型,事件类型的数字ID。 |
|||
;参数三 {{cd|''x''}} |
|||
:int类型,该存档事件发生的X坐标。 |
|||
;参数四 {{cd|''y''}} |
|||
:int类型,该存档事件发生的Y坐标。 |
|||
;参数五 {{cd|''z''}} |
|||
:int类型,该存档事件发生的Z坐标。 |
|||
;参数六 {{cd|''data''}} |
|||
:int类型,该存档事件的数据值。 |
|||
==挂钩上下文== |
|||
一个[[存档事件]]在游戏的存档事件广播器中广播。 |
|||
==存档事件列表== |
|||
{| class="wikitable" |
|||
! 枚举键 !! 值 !! 描述 |
|||
|- |
|||
| 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 || |
|||
|} |
|||
==历史== |
|||
{{H|blocklauncher}} |
|||
{{H||?|加入了{{cd|levelEventHook(''entity'', ''eventType'', ''x'', ''y'', ''z'', ''data'')}}。}} |
|||
{{H||?|参数表中的{{cd|''entity''}}改名为{{cd|''player''}}。}} |
|||
{{H||?|将该函数从ModPE Script的函数转储中隐去。}} |
|||
{{H|foot}} |
|||
{{ModPE}} |
{{ModPE}} |
2021年9月23日 (四) 16:24的版本
levelEventHook
Function
钩子函数
钩子函数
参数类型
参数 1
Number:int
参数 2
Number:int
参数 3
Number:int
参数 4
Number:int
参数 5
Number:int
参数 6
Number:int
返回值类型
void
API
适用语言
levelEventHook是ModPE 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的函数转储中隐去。 |