|
2 | 2 |
|
3 | 3 | #### `"onMobDie"` - Mob/Player Death Event |
4 | 4 |
|
5 | | -- Listener function prototype |
| 5 | +- Listener function prototype |
6 | 6 | `function(mob,source,cause)` |
7 | | -- Parameters: |
8 | | - - mob : `Entity` |
9 | | - Dead entity object. |
10 | | - - source : `Entity` |
11 | | - The entity object that dealt the last damage (may be `Null`). |
12 | | - - cause : `Integer` |
13 | | - Cause of injury |
| 7 | +- Parameters: |
| 8 | + - mob : `Entity` |
| 9 | + Dead entity object. |
| 10 | + - source : `Entity` |
| 11 | + The entity object that dealt the last damage (may be `Null`). |
| 12 | + - cause : `Integer` |
| 13 | + Cause of injury |
14 | 14 | - Intercept event: cannot be intercepted. |
15 | 15 |
|
16 | 16 | Note that when the player dies, in addition to triggering `onPlayerDie` event, this event will also be triggered once. |
17 | 17 |
|
18 | | - |
19 | | - |
20 | 18 | #### `"onMobHurt"` - Mob/Player Hurt Event |
21 | 19 |
|
22 | | -- Listener function prototype |
| 20 | +- Listener function prototype |
23 | 21 | `function(mob,source,damage,cause)` |
24 | | -- Parameters: |
25 | | - - mob : `Entity` |
26 | | - The damaged entity. |
27 | | - - source : `Entity` |
28 | | - The entity that dealt the damage (may be `Null`). |
29 | | - - damage : `Integer` |
30 | | - The amount of damage dealt. |
31 | | - - cause : `Integer` |
32 | | - Cause of injury |
| 22 | +- Parameters: |
| 23 | + - mob : `Entity` |
| 24 | + The damaged entity. |
| 25 | + - source : `Entity` |
| 26 | + The entity that dealt the damage (may be `Null`). |
| 27 | + - damage : `Integer` |
| 28 | + The amount of damage dealt. |
| 29 | + - cause : `Integer` |
| 30 | + Cause of injury |
33 | 31 |
|
34 | 32 | - Intercept events: function returns `false` |
35 | 33 |
|
36 | | - |
37 | | - |
38 | 34 | #### `"onEntityExplode"` - Entity Explosion Event |
39 | 35 |
|
40 | | -- Listener function prototype |
| 36 | +- Listener function prototype |
41 | 37 | `function(source,pos,radius,maxResistance,isDestroy,isFire)` |
42 | | -- Parameters: |
43 | | - - source : `Entity` |
44 | | - The entity object that caused the explosion. |
45 | | - - pos : `FloatPos` |
46 | | - The coordinates of the explosion. |
47 | | - - radius : `Float` |
48 | | - Blast radius. |
49 | | - - maxResistance : `Float` |
50 | | - The maximum resistance of blocks that will break. |
51 | | - - isDestroy : `Boolean` |
52 | | - Does the explosion destroy blocks. |
53 | | - - isFire : `Boolean` |
54 | | - Does the explosion produce flames. |
55 | | - |
56 | | -- Intercept events: function returns `false` |
57 | | - |
| 38 | +- Parameters: |
| 39 | + - source : `Entity` |
| 40 | + The entity object that caused the explosion. |
| 41 | + - pos : `FloatPos` |
| 42 | + The coordinates of the explosion. |
| 43 | + - radius : `Float` |
| 44 | + Blast radius. |
| 45 | + - maxResistance : `Float` |
| 46 | + The maximum resistance of blocks that will break. |
| 47 | + - isDestroy : `Boolean` |
| 48 | + Does the explosion destroy blocks. |
| 49 | + - isFire : `Boolean` |
| 50 | + Does the explosion produce flames. |
58 | 51 |
|
| 52 | +- Intercept events: function returns `false` |
59 | 53 |
|
60 | 54 | #### `"onTryMobSpawn"` - Mob try Naturally Spawn Event |
61 | 55 |
|
62 | | -- Listener function prototype |
| 56 | +- Listener function prototype |
63 | 57 | `function(typeName,pos)` |
64 | | -- Parameters: |
65 | | - - typeName : `string` |
66 | | - Entity Name |
67 | | - - pos : `FloatPos` |
68 | | - The coordinates of the spawn. |
69 | | - |
70 | | -- Intercept events: function returns `false` |
71 | | - |
| 58 | +- Parameters: |
| 59 | + - typeName : `string` |
| 60 | + Entity Name |
| 61 | + - pos : `FloatPos` |
| 62 | + The coordinates of the spawn. |
72 | 63 |
|
| 64 | +- Intercept events: function returns `false` |
73 | 65 |
|
74 | 66 | #### `"onMobSpawned"` - Mob Naturally Spawn Finished Event |
75 | 67 |
|
76 | | -- Listener function prototype |
| 68 | +- Listener function prototype |
77 | 69 | `function(entity,pos)` |
78 | | -- Parameters: |
79 | | - - entity: `Entity` |
80 | | - The entity that spawned. |
81 | | - - pos : `FloatPos` |
82 | | - The coordinates of the spawn. |
83 | | - |
| 70 | +- Parameters: |
| 71 | + - entity: `Entity` |
| 72 | + The entity that spawned. |
| 73 | + - pos : `FloatPos` |
| 74 | + The coordinates of the spawn. |
| 75 | + |
84 | 76 | - Intercept events: cannot be intercepted. |
85 | 77 |
|
86 | 78 | You can use entity.despawn() or entity.remove() to intercept this event. |
87 | 79 |
|
88 | | - |
89 | | - |
90 | 80 | #### `"onProjectileHitEntity"` - Entity Hit by Projectile Event |
91 | 81 |
|
92 | | -- Listener function prototype |
| 82 | +- Listener function prototype |
93 | 83 | `function(entity,source)` |
94 | | -- Parameters: |
95 | | - - entity: `Entity` |
96 | | - The entity that was hit with a projectile. |
97 | | - - source : `Entity` |
98 | | - The projecticle entity (like arrows). |
| 84 | +- Parameters: |
| 85 | + - entity: `Entity` |
| 86 | + The entity that was hit with a projectile. |
| 87 | + - source : `Entity` |
| 88 | + The projecticle entity (like arrows). |
99 | 89 | - Intercept event: cannot be intercepted. |
100 | 90 |
|
101 | | - |
102 | | - |
103 | 91 | #### `"onWitherBossDestroy"` - Block Broken by Wither Event |
104 | 92 |
|
105 | | -- Listener function prototype |
| 93 | +- Listener function prototype |
106 | 94 | `function(witherBoss,AAbb,aaBB)` |
107 | | -- Parameters: |
108 | | - - witherBoss: `Entity` |
109 | | - The Wither entity object. |
110 | | - - AAbb: `IntPos` |
111 | | - The area that the wither will destroy (box), the A coordinate of the diagonal point. |
112 | | - - aaBB: `IntPos` |
113 | | - The area that the wither will destroy (box), the B coordinate of the diagonal point. |
114 | | - |
| 95 | +- Parameters: |
| 96 | + - witherBoss: `Entity` |
| 97 | + The Wither entity object. |
| 98 | + - AAbb: `IntPos` |
| 99 | + The area that the wither will destroy (box), the A coordinate of the diagonal point. |
| 100 | + - aaBB: `IntPos` |
| 101 | + The area that the wither will destroy (box), the B coordinate of the diagonal point. |
| 102 | + |
115 | 103 | - Intercept events: function returns `false` |
116 | 104 |
|
117 | 105 | Note that this event does not include wither explosion damage. |
118 | 106 |
|
119 | | - |
120 | | - |
121 | 107 | #### `"onRide"` - Mob Ride Event |
122 | 108 |
|
123 | | -- Listener function prototype |
| 109 | +- Listener function prototype |
124 | 110 | `function(entity1,entity2)` |
125 | | -- Parameters: |
126 | | - - entity1 : `Entity` |
127 | | - The entity that is riding the other entity. |
128 | | - - entity2 : `Entity` |
129 | | - The entity that is being ridden. |
| 111 | +- Parameters: |
| 112 | + - entity1 : `Entity` |
| 113 | + The entity that is riding the other entity. |
| 114 | + - entity2 : `Entity` |
| 115 | + The entity that is being ridden. |
130 | 116 | - Intercept events: function returns `false` |
131 | 117 |
|
132 | 118 | Note: Riding includes minecart, boat, horse, pig, etc. |
133 | 119 |
|
134 | | - |
135 | | - |
136 | 120 | #### `"onStepOnPressurePlate"` - Pressure Plate Step Event |
137 | 121 |
|
138 | | -- Listener function prototype |
| 122 | +- Listener function prototype |
139 | 123 | `function(entity,pressurePlate)` |
140 | | -- Parameters: |
141 | | - - entity : `Entity` |
142 | | - The entity that stepped on the plate. |
143 | | - - pressurePlate : `Block` |
144 | | - The pressed pressure plate block. |
| 124 | +- Parameters: |
| 125 | + - entity : `Entity` |
| 126 | + The entity that stepped on the plate. |
| 127 | + - pressurePlate : `Block` |
| 128 | + The pressed pressure plate block. |
145 | 129 | - Intercept events: function returns `false` |
146 | 130 |
|
147 | 131 | Note: When a creature steps on a pressure plate, this event will be triggered repeatedly. |
148 | 132 |
|
149 | | - |
150 | | - |
151 | 133 | #### `"onSpawnProjectile"` - Projectile Spawn Event |
152 | 134 |
|
153 | | -- Listener function prototype |
| 135 | +- Listener function prototype |
154 | 136 | `function(shooter,type)` |
155 | | -- Parameters: |
156 | | - - shooter : `Entity` |
157 | | - The entity that fired the projectile. |
158 | | - - type : `String` |
159 | | - Projectile Standard Type Name. |
| 137 | +- Parameters: |
| 138 | + - shooter : `Entity` |
| 139 | + The entity that fired the projectile. |
| 140 | + - type : `String` |
| 141 | + Projectile Standard Type Name. |
160 | 142 |
|
161 | 143 | - Intercept events: function returns `false` |
162 | 144 |
|
163 | | -Note: Projectiles known to be intercepted are eggs, ender pearls, snowballs, tridents, arrows, and fishing rods (fish hooks). |
164 | | - |
165 | | - |
| 145 | +Note: Projectiles known to be intercepted are eggs, ender pearls, snowballs, tridents, arrows, and fishing rods (fish |
| 146 | +hooks). |
166 | 147 |
|
167 | 148 | #### `"onProjectileCreated"` - Projectile Created Event |
168 | 149 |
|
169 | | -- Listener function prototype |
| 150 | +- Listener function prototype |
170 | 151 | `function(shooter,entity)` |
171 | | -- Parameters: |
172 | | - - shooter : `Entity` |
173 | | - The entity that created the projectile. |
174 | | - - entity : `Entity` |
175 | | - The projectile entity object being created. |
| 152 | +- Parameters: |
| 153 | + - shooter : `Entity` |
| 154 | + The entity that created the projectile. |
| 155 | + - entity : `Entity` |
| 156 | + The projectile entity object being created. |
176 | 157 |
|
177 | 158 | - Intercept event: cannot be intercepted. |
178 | 159 |
|
179 | | - |
180 | | - |
181 | 160 | #### `"onNpcCmd"` - NPC Command Execution Event |
182 | 161 |
|
183 | | -- Listener function prototype |
| 162 | +!!! warning |
| 163 | + This event is only available in 0.9.6 and later versions. |
| 164 | + |
| 165 | +- Listener function prototype |
184 | 166 | `function(npc,pl,cmd)` |
185 | | -- Parameters: |
186 | | - - npc : `Entity` |
187 | | - The NPC entity that executed the command. |
188 | | - - pl : `Player` |
189 | | - The player that triggered the execution of the NPC command. |
190 | | - - cmd : `String` |
191 | | - The command being executed by NPCs. |
| 167 | +- Parameters: |
| 168 | + - npc : `Entity` |
| 169 | + The NPC entity that executed the command. |
| 170 | + - pl : `Player` |
| 171 | + The player that triggered the execution of the NPC command. |
| 172 | + - cmd : `String` |
| 173 | + The command being executed by NPCs. If there are multiple commands, they are separated by `;`. |
192 | 174 | - Intercept events: function returns `false` |
193 | 175 |
|
194 | | - |
195 | | - |
196 | 176 | #### `"onChangeArmorStand"` - Armor Stand Change Event |
197 | 177 |
|
198 | | -- Listener function prototype |
| 178 | +- Listener function prototype |
199 | 179 | `function(as,pl,slot)` |
200 | 180 |
|
201 | | -- Parameters: |
| 181 | +- Parameters: |
202 | 182 |
|
203 | | - - as: `Entity` |
204 | | - Manipulated Armor Stand entity object. |
205 | | - - pl : `Player` |
206 | | - The player that manipulated the armor stand. |
207 | | - - slot : `Number` |
208 | | - Equipment slot number. |
| 183 | + - as: `Entity` |
| 184 | + Manipulated Armor Stand entity object. |
| 185 | + - pl : `Player` |
| 186 | + The player that manipulated the armor stand. |
| 187 | + - slot : `Number` |
| 188 | + Equipment slot number. |
209 | 189 |
|
210 | 190 | - Intercept events: function returns `false` |
211 | 191 |
|
212 | | - |
213 | | - |
214 | 192 | #### `"onEntityTransformation"` - Entity Transformation Event |
215 | 193 |
|
216 | | -- Listener function prototype |
| 194 | +- Listener function prototype |
217 | 195 | `function(uniqueId,entity)` |
218 | | -- Parameters: |
| 196 | +- Parameters: |
219 | 197 |
|
220 | | - - uniqueId: `String` |
221 | | - Unique identifer of the pre-transformed entity. |
222 | | - - entity : `Entity` |
223 | | - The transformed entity. |
| 198 | + - uniqueId: `String` |
| 199 | + Unique identifer of the pre-transformed entity. |
| 200 | + - entity : `Entity` |
| 201 | + The transformed entity. |
224 | 202 | - Intercept event: cannot be intercepted. |
225 | 203 |
|
226 | | -Note: This event is triggered when the `TransformationComponent` of the entity in `Addons` is activated, and is mostly used for the interaction between the engine and the Addon. Only `UniqueId` is provided since the entity pointer before the transition is destroyed quickly. |
| 204 | +Note: This event is triggered when the `TransformationComponent` of the entity in `Addons` is activated, and is mostly |
| 205 | +used for the interaction between the engine and the Addon. Only `UniqueId` is provided since the entity pointer before |
| 206 | +the transition is destroyed quickly. |
0 commit comments