simplified-mojang-api 0.0.3 → 0.0.5
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.
- package/dist/events/afterEventsSimplifiedManager.d.ts +10 -2
- package/dist/events/afterEventsSimplifiedManager.js +11 -2
- package/dist/events/beforeEventsSimplifiedManager.d.ts +2 -1
- package/dist/events/beforeEventsSimplifiedManager.js +1 -1
- package/dist/events/worldToolsSimplifiedManager.d.ts +38 -0
- package/dist/events/worldToolsSimplifiedManager.js +43 -0
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as mc from "@minecraft/server";
|
|
2
2
|
/**
|
|
3
3
|
* Clase principal que maneja los eventos after de forma simplificada para mejor manejo de errores.
|
|
4
|
-
* @export
|
|
5
4
|
* @class AfterEventsSimplified
|
|
6
5
|
* @author HaJuegos - 11-03-2026
|
|
7
6
|
*/
|
|
8
|
-
|
|
7
|
+
declare class AfterEventsSimplified {
|
|
9
8
|
private entityDieManager;
|
|
9
|
+
private playerSpawnManager;
|
|
10
10
|
/**
|
|
11
11
|
* Eventos que se inicializan cuando la clase es llamada o inicializada.
|
|
12
12
|
* @constructor
|
|
@@ -19,5 +19,13 @@ export declare class AfterEventsSimplified {
|
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
21
|
onEntityDie(callback: (args: mc.EntityDieAfterEvent) => void): void;
|
|
22
|
+
/**
|
|
23
|
+
* Metodo auxiliar que ejecuta los eventos relacionado cuando un jugador respawnea de forma simplificada.
|
|
24
|
+
* @param {(args: mc.PlayerSpawnAfterEvent) => void} callback Los argumentos del evento y su logica.
|
|
25
|
+
* @author HaJuegos - 11-03-2026
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
onPlayerSpawns(callback: (args: mc.PlayerSpawnAfterEvent) => void): void;
|
|
22
29
|
}
|
|
23
30
|
export declare const afterEventsSimplified: AfterEventsSimplified;
|
|
31
|
+
export {};
|
|
@@ -2,17 +2,17 @@ import { BaseEventManager } from "../core/eventsManager";
|
|
|
2
2
|
import * as mc from "@minecraft/server";
|
|
3
3
|
/**
|
|
4
4
|
* Clase principal que maneja los eventos after de forma simplificada para mejor manejo de errores.
|
|
5
|
-
* @export
|
|
6
5
|
* @class AfterEventsSimplified
|
|
7
6
|
* @author HaJuegos - 11-03-2026
|
|
8
7
|
*/
|
|
9
|
-
|
|
8
|
+
class AfterEventsSimplified {
|
|
10
9
|
/**
|
|
11
10
|
* Eventos que se inicializan cuando la clase es llamada o inicializada.
|
|
12
11
|
* @constructor
|
|
13
12
|
*/
|
|
14
13
|
constructor() {
|
|
15
14
|
this.entityDieManager = new BaseEventManager(mc.world.afterEvents.entityDie, "AfterEntityDie");
|
|
15
|
+
this.playerSpawnManager = new BaseEventManager(mc.world.afterEvents.playerSpawn, "AfterPlayerSpawn");
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Metodo auxiliar que ejecuta los eventos relacionado cuando una entidad muere de forma simplificada.
|
|
@@ -23,5 +23,14 @@ export class AfterEventsSimplified {
|
|
|
23
23
|
onEntityDie(callback) {
|
|
24
24
|
this.entityDieManager.register(callback);
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Metodo auxiliar que ejecuta los eventos relacionado cuando un jugador respawnea de forma simplificada.
|
|
28
|
+
* @param {(args: mc.PlayerSpawnAfterEvent) => void} callback Los argumentos del evento y su logica.
|
|
29
|
+
* @author HaJuegos - 11-03-2026
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
onPlayerSpawns(callback) {
|
|
33
|
+
this.playerSpawnManager.register(callback);
|
|
34
|
+
}
|
|
26
35
|
}
|
|
27
36
|
export const afterEventsSimplified = new AfterEventsSimplified();
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @author HaJuegos - 11-03-2026
|
|
5
5
|
* @export
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
declare class BeforeEventsSimplified {
|
|
8
8
|
/**
|
|
9
9
|
* Eventos que se inicializan cuando la clase es llamada o inicializada.
|
|
10
10
|
* @constructor
|
|
@@ -12,3 +12,4 @@ export declare class BeforeEventsSimplified {
|
|
|
12
12
|
constructor();
|
|
13
13
|
}
|
|
14
14
|
export declare const beforeEventsSimplified: BeforeEventsSimplified;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as mc from "@minecraft/server";
|
|
2
|
+
/**
|
|
3
|
+
* Clase principal que otorga simplificaciones de las llamadas de world y sus utilidades de sus llamadas y/o variables.
|
|
4
|
+
* @class WorldToolsSimplified
|
|
5
|
+
* @author HaJuegos - 12-03-2026
|
|
6
|
+
*/
|
|
7
|
+
declare class WorldToolsSimplified {
|
|
8
|
+
/**
|
|
9
|
+
* Eventos que se inicializan cuando la clase es llamada o inicializada.
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
constructor();
|
|
13
|
+
/**
|
|
14
|
+
* Metodo auxiliar que envia un mensaje global al mundo en formato string o rawmessage.
|
|
15
|
+
* @public
|
|
16
|
+
* @param {(string | mc.RawMessage)} message Mensaje o RawMessage en concreto a enviar.
|
|
17
|
+
* @author HaJuegos - 12-03-2026
|
|
18
|
+
*/
|
|
19
|
+
sendMessageGlobal(message: string | mc.RawMessage): void;
|
|
20
|
+
/**
|
|
21
|
+
* Metodo auxiliar que convierte segundos a ticks de forma simple.
|
|
22
|
+
* @public
|
|
23
|
+
* @param {number} seconds Los segundos a convertir.
|
|
24
|
+
* @returns {number} Los ticks convertidos.
|
|
25
|
+
* @author HaJuegos - 12-03-2026
|
|
26
|
+
*/
|
|
27
|
+
convertSecondsToTicks(seconds: number): number;
|
|
28
|
+
/**
|
|
29
|
+
* Metodo auxiliar que convierte ticks a segundos de forma simple.
|
|
30
|
+
* @public
|
|
31
|
+
* @param {number} ticks Los ticks a convertir.
|
|
32
|
+
* @returns {number} Los segundos convertidos.
|
|
33
|
+
* @author HaJuegos - 12-03-2026
|
|
34
|
+
*/
|
|
35
|
+
convertTicksToSeconds(ticks: number): number;
|
|
36
|
+
}
|
|
37
|
+
export declare const worldToolsSimplified: WorldToolsSimplified;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as mc from "@minecraft/server";
|
|
2
|
+
/**
|
|
3
|
+
* Clase principal que otorga simplificaciones de las llamadas de world y sus utilidades de sus llamadas y/o variables.
|
|
4
|
+
* @class WorldToolsSimplified
|
|
5
|
+
* @author HaJuegos - 12-03-2026
|
|
6
|
+
*/
|
|
7
|
+
class WorldToolsSimplified {
|
|
8
|
+
/**
|
|
9
|
+
* Eventos que se inicializan cuando la clase es llamada o inicializada.
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
constructor() { }
|
|
13
|
+
/**
|
|
14
|
+
* Metodo auxiliar que envia un mensaje global al mundo en formato string o rawmessage.
|
|
15
|
+
* @public
|
|
16
|
+
* @param {(string | mc.RawMessage)} message Mensaje o RawMessage en concreto a enviar.
|
|
17
|
+
* @author HaJuegos - 12-03-2026
|
|
18
|
+
*/
|
|
19
|
+
sendMessageGlobal(message) {
|
|
20
|
+
mc.world.sendMessage(message);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Metodo auxiliar que convierte segundos a ticks de forma simple.
|
|
24
|
+
* @public
|
|
25
|
+
* @param {number} seconds Los segundos a convertir.
|
|
26
|
+
* @returns {number} Los ticks convertidos.
|
|
27
|
+
* @author HaJuegos - 12-03-2026
|
|
28
|
+
*/
|
|
29
|
+
convertSecondsToTicks(seconds) {
|
|
30
|
+
return mc.TicksPerSecond * seconds;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Metodo auxiliar que convierte ticks a segundos de forma simple.
|
|
34
|
+
* @public
|
|
35
|
+
* @param {number} ticks Los ticks a convertir.
|
|
36
|
+
* @returns {number} Los segundos convertidos.
|
|
37
|
+
* @author HaJuegos - 12-03-2026
|
|
38
|
+
*/
|
|
39
|
+
convertTicksToSeconds(ticks) {
|
|
40
|
+
return ticks / mc.TicksPerSecond;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export const worldToolsSimplified = new WorldToolsSimplified();
|
package/package.json
CHANGED