simplified-mojang-api 0.0.22 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,6 +22,7 @@ declare class AfterEventsSimplified {
|
|
|
22
22
|
private entitySpawnsManager;
|
|
23
23
|
private effectAddManager;
|
|
24
24
|
private placeBlockManager;
|
|
25
|
+
private breakBlockManager;
|
|
25
26
|
/**
|
|
26
27
|
* Eventos que se inicializan cuando la clase es llamada o inicializada.
|
|
27
28
|
* @constructor
|
|
@@ -293,6 +294,20 @@ declare class AfterEventsSimplified {
|
|
|
293
294
|
* ```
|
|
294
295
|
*/
|
|
295
296
|
onPlaceBlock(callback: (args: mc.PlayerPlaceBlockAfterEvent) => void): void;
|
|
297
|
+
/**
|
|
298
|
+
* Metodo auxiliar que ejecuta los eventos relacionados cuando un bloque es roto de forma simplificada.
|
|
299
|
+
* @param {(args: mc.PlayerBreakBlockAfterEvent) => void} callback Los eventos relacionados.
|
|
300
|
+
* @author HaJuegos - 23-03-2026
|
|
301
|
+
* @public
|
|
302
|
+
* @afterEvent Metodo que detecta el evento despues de que suceda. Obteniendo la informacion sin permitir modificarla en su mayoria.
|
|
303
|
+
* @example
|
|
304
|
+
* ```ts
|
|
305
|
+
* afterEventsSimplified.onBreakBlock((args) => {
|
|
306
|
+
* console.warn(`${args.player.name} rompio el bloque ${args.block.typeId}.`);
|
|
307
|
+
* });
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
onBreakBlock(callback: (args: mc.PlayerBreakBlockAfterEvent) => void): void;
|
|
296
311
|
}
|
|
297
312
|
export declare const afterEventsSimplified: AfterEventsSimplified;
|
|
298
313
|
export {};
|
|
@@ -28,6 +28,7 @@ class AfterEventsSimplified {
|
|
|
28
28
|
this.entitySpawnsManager = new BaseEventManager(mc.world.afterEvents.entitySpawn, "AfterEntitySpawns");
|
|
29
29
|
this.effectAddManager = new BaseEventManager(mc.world.afterEvents.effectAdd, "AfterEffectAdd");
|
|
30
30
|
this.placeBlockManager = new BaseEventManager(mc.world.afterEvents.playerPlaceBlock, "AfterPlaceBlock");
|
|
31
|
+
this.breakBlockManager = new BaseEventManager(mc.world.afterEvents.playerBreakBlock, "AfterBreakBlock");
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* Metodo auxiliar que ejecuta los eventos relacionado cuando una entidad muere de forma simplificada.
|
|
@@ -330,5 +331,21 @@ class AfterEventsSimplified {
|
|
|
330
331
|
onPlaceBlock(callback) {
|
|
331
332
|
this.placeBlockManager.register(callback);
|
|
332
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Metodo auxiliar que ejecuta los eventos relacionados cuando un bloque es roto de forma simplificada.
|
|
336
|
+
* @param {(args: mc.PlayerBreakBlockAfterEvent) => void} callback Los eventos relacionados.
|
|
337
|
+
* @author HaJuegos - 23-03-2026
|
|
338
|
+
* @public
|
|
339
|
+
* @afterEvent Metodo que detecta el evento despues de que suceda. Obteniendo la informacion sin permitir modificarla en su mayoria.
|
|
340
|
+
* @example
|
|
341
|
+
* ```ts
|
|
342
|
+
* afterEventsSimplified.onBreakBlock((args) => {
|
|
343
|
+
* console.warn(`${args.player.name} rompio el bloque ${args.block.typeId}.`);
|
|
344
|
+
* });
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
onBreakBlock(callback) {
|
|
348
|
+
this.breakBlockManager.register(callback);
|
|
349
|
+
}
|
|
333
350
|
}
|
|
334
351
|
export const afterEventsSimplified = new AfterEventsSimplified();
|
|
@@ -15,6 +15,7 @@ declare class BeforeEventsSimplified {
|
|
|
15
15
|
private interactEntityManager;
|
|
16
16
|
private effectAddManager;
|
|
17
17
|
private placeBlockManager;
|
|
18
|
+
private breakBlockManager;
|
|
18
19
|
/**
|
|
19
20
|
* Eventos que se inicializan cuando la clase es llamada o inicializada.
|
|
20
21
|
* @constructor
|
|
@@ -160,6 +161,21 @@ declare class BeforeEventsSimplified {
|
|
|
160
161
|
* ```
|
|
161
162
|
*/
|
|
162
163
|
onPlaceBlock(callback: (args: mc.PlayerPlaceBlockBeforeEvent) => void): void;
|
|
164
|
+
/**
|
|
165
|
+
* Metodo auxiliar que ejecuta los eventos relacionados cuando un jugador va a romper un bloque de forma simplificada.
|
|
166
|
+
* @param {(args: mc.PlayerBreakBlockBeforeEvent) => void} callback Los eventos relacionados.
|
|
167
|
+
* @author HaJuegos - 23-03-2026
|
|
168
|
+
* @public
|
|
169
|
+
* @beforeEvent Metodo que detecta el evento antes de que suceda. Permitiendo cancelar o personalizar el evento antes de que se vea en el juego.
|
|
170
|
+
* @example
|
|
171
|
+
* ```ts
|
|
172
|
+
* beforeEventsSimplified.onBreakBlock((args) => {
|
|
173
|
+
* console.warn(`${args.player.name} va a romper el bloque ${args.block.typeId}.`);
|
|
174
|
+
* args.cancel = true; // Ahora ya no puede romperlo
|
|
175
|
+
* });
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
onBreakBlock(callback: (args: mc.PlayerBreakBlockBeforeEvent) => void): void;
|
|
163
179
|
/**
|
|
164
180
|
* Metodo auxiliar que registra y ejecuta los eventos relacionados cuando se quiere registrar un custom component de un bloque.
|
|
165
181
|
* @param {string} nameComponent Nombre del componente en cuestion a registrar.
|
|
@@ -21,6 +21,7 @@ class BeforeEventsSimplified {
|
|
|
21
21
|
this.interactEntityManager = new BaseEventManager(mc.world.beforeEvents.playerInteractWithEntity, "BeforeInteractEntity");
|
|
22
22
|
this.effectAddManager = new BaseEventManager(mc.world.beforeEvents.effectAdd, "BeforeAddEffect");
|
|
23
23
|
this.placeBlockManager = new BaseEventManager(mc.world.beforeEvents.playerPlaceBlock, "BeforePlayerPlaceBlock");
|
|
24
|
+
this.breakBlockManager = new BaseEventManager(mc.world.beforeEvents.playerBreakBlock, "BeforePlayerBreakBlock");
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
27
|
* Metodo auxiliar que ejecuta los eventos relacionados cuando el add-on se carga por primera vez
|
|
@@ -180,6 +181,23 @@ class BeforeEventsSimplified {
|
|
|
180
181
|
onPlaceBlock(callback) {
|
|
181
182
|
this.placeBlockManager.register(callback);
|
|
182
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Metodo auxiliar que ejecuta los eventos relacionados cuando un jugador va a romper un bloque de forma simplificada.
|
|
186
|
+
* @param {(args: mc.PlayerBreakBlockBeforeEvent) => void} callback Los eventos relacionados.
|
|
187
|
+
* @author HaJuegos - 23-03-2026
|
|
188
|
+
* @public
|
|
189
|
+
* @beforeEvent Metodo que detecta el evento antes de que suceda. Permitiendo cancelar o personalizar el evento antes de que se vea en el juego.
|
|
190
|
+
* @example
|
|
191
|
+
* ```ts
|
|
192
|
+
* beforeEventsSimplified.onBreakBlock((args) => {
|
|
193
|
+
* console.warn(`${args.player.name} va a romper el bloque ${args.block.typeId}.`);
|
|
194
|
+
* args.cancel = true; // Ahora ya no puede romperlo
|
|
195
|
+
* });
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
onBreakBlock(callback) {
|
|
199
|
+
this.breakBlockManager.register(callback);
|
|
200
|
+
}
|
|
183
201
|
// Metodos no auxiliares
|
|
184
202
|
/**
|
|
185
203
|
* Metodo auxiliar que registra y ejecuta los eventos relacionados cuando se quiere registrar un custom component de un bloque.
|
package/package.json
CHANGED