@starktma/minecraft-utils 1.3.25 → 1.4.0
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/database/database.d.ts +6 -4
- package/dist/database/database.d.ts.map +1 -1
- package/dist/database/database.js +24 -11
- package/dist/database/database.js.map +1 -1
- package/dist/game-state-machine/database.d.ts +1 -1
- package/dist/game-state-machine/database.d.ts.map +1 -1
- package/dist/game-state-machine/database.js +1 -1
- package/dist/game-state-machine/database.js.map +1 -1
- package/dist/math/index.d.ts +63 -59
- package/dist/math/index.d.ts.map +1 -1
- package/dist/math/index.js +150 -76
- package/dist/math/index.js.map +1 -1
- package/dist/minecraft/effectsAPI.d.ts +44 -57
- package/dist/minecraft/effectsAPI.d.ts.map +1 -1
- package/dist/minecraft/effectsAPI.js +354 -351
- package/dist/minecraft/effectsAPI.js.map +1 -1
- package/dist/minecraft/index.d.ts +7 -7
- package/dist/minecraft/index.d.ts.map +1 -1
- package/dist/minecraft/index.js +45 -31
- package/dist/minecraft/index.js.map +1 -1
- package/dist/minecraft/projectileAPI.d.ts +21 -59
- package/dist/minecraft/projectileAPI.d.ts.map +1 -1
- package/dist/minecraft/projectileAPI.js +139 -137
- package/dist/minecraft/projectileAPI.js.map +1 -1
- package/dist/minecraft/structuresAPI.d.ts +10 -0
- package/dist/minecraft/structuresAPI.d.ts.map +1 -0
- package/dist/minecraft/structuresAPI.js +61 -0
- package/dist/minecraft/structuresAPI.js.map +1 -0
- package/package.json +5 -1
- package/dist/minecraft/potionAPI.d.ts +0 -74
- package/dist/minecraft/potionAPI.d.ts.map +0 -1
- package/dist/minecraft/potionAPI.js +0 -228
- package/dist/minecraft/potionAPI.js.map +0 -1
|
@@ -1,82 +1,69 @@
|
|
|
1
|
-
import { Entity, RGBA } from "@minecraft/server";
|
|
2
|
-
|
|
1
|
+
import { Entity, RGBA, StartupEvent } from "@minecraft/server";
|
|
2
|
+
import { SimpleObject } from "../database";
|
|
3
|
+
interface EffectObject extends SimpleObject {
|
|
3
4
|
id: string;
|
|
4
|
-
|
|
5
|
+
namespace: string;
|
|
5
6
|
effectType: string;
|
|
6
7
|
amplifier: number;
|
|
7
8
|
duration: number;
|
|
8
9
|
color: RGBA;
|
|
9
10
|
}
|
|
10
|
-
interface EffectSounds {
|
|
11
|
-
ambient?: string;
|
|
12
|
-
start?: string;
|
|
13
|
-
end?: string;
|
|
14
|
-
}
|
|
15
11
|
interface EffectConfig {
|
|
16
12
|
effectType: string;
|
|
17
13
|
color: RGBA;
|
|
18
|
-
sounds?:
|
|
14
|
+
sounds?: {
|
|
15
|
+
ambient?: string;
|
|
16
|
+
start?: string;
|
|
17
|
+
end?: string;
|
|
18
|
+
};
|
|
19
19
|
particleType?: string;
|
|
20
|
-
handler:
|
|
20
|
+
handler: (entity: Entity, effect: EffectObject) => void;
|
|
21
|
+
}
|
|
22
|
+
interface PotionConfig {
|
|
23
|
+
effectKey: string;
|
|
24
|
+
namespace: string;
|
|
25
|
+
effectId: number;
|
|
26
|
+
handler: (entity: Entity, amplifier: number, duration: number, color: RGBA) => void;
|
|
27
|
+
splashRange?: number;
|
|
28
|
+
lingeringMaxRadius?: number;
|
|
29
|
+
lingeringLifetime?: number;
|
|
30
|
+
lingeringDurationMultiplier?: number;
|
|
21
31
|
}
|
|
22
|
-
type EffectHandler = (entity: Entity, effect: EffectObject) => void;
|
|
23
32
|
declare class EffectManager {
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
|
|
33
|
+
private static instance;
|
|
34
|
+
private effectConfigs;
|
|
35
|
+
private potionConfigs;
|
|
36
|
+
private areaEffectClouds;
|
|
37
|
+
private cloudIdCounter;
|
|
38
|
+
private trackedEntities;
|
|
39
|
+
private entityDatabases;
|
|
27
40
|
static getInstance(): EffectManager;
|
|
28
41
|
private constructor();
|
|
29
42
|
private getEntityDatabase;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
private trackEntity;
|
|
35
|
-
/**
|
|
36
|
-
* Stop tracking an entity (when it has no more effects)
|
|
37
|
-
* @param entity - The entity to stop tracking
|
|
38
|
-
*/
|
|
39
|
-
private untrackEntity;
|
|
40
|
-
/**
|
|
41
|
-
* Check if an entity has any effect tags
|
|
42
|
-
* @param entity - The entity to check
|
|
43
|
-
* @returns True if entity has any effect tags
|
|
44
|
-
*/
|
|
45
|
-
private entityHasEffectTags;
|
|
46
|
-
/**
|
|
47
|
-
* Parse effect data from entity tags regardless of namespace
|
|
48
|
-
* @param entity - The entity to get effects from
|
|
49
|
-
* @returns Array of effect objects parsed from all effect tags
|
|
50
|
-
*/
|
|
51
|
-
private getEffectsFromTags;
|
|
52
|
-
/**
|
|
53
|
-
* Parse ALL effect data from entity tags regardless of namespace
|
|
54
|
-
* @param entity - The entity to get effects from
|
|
55
|
-
* @returns Array of effect objects parsed from all effect tags
|
|
56
|
-
*/
|
|
57
|
-
private getAllEffectsFromTags;
|
|
58
|
-
/**
|
|
59
|
-
* Register a effect effect with full configuration
|
|
60
|
-
* @param config - Complete effect configuration including effect type, color, sounds, particle type, and handler
|
|
61
|
-
* @returns Helper functions for adding, removing, and applying the effect
|
|
62
|
-
*/
|
|
43
|
+
private getEffect;
|
|
44
|
+
private getAllEffects;
|
|
45
|
+
private hasActiveEffects;
|
|
46
|
+
private debug;
|
|
63
47
|
registerEffect(config: EffectConfig): {
|
|
64
|
-
addEffect: (entity: Entity, amplifier: number,
|
|
48
|
+
addEffect: (entity: Entity, amplifier: number, durationTicks: number) => void;
|
|
65
49
|
removeEffect: (entity: Entity) => void;
|
|
66
|
-
applyEffect:
|
|
50
|
+
applyEffect: (entity: Entity, effect: EffectObject) => void;
|
|
67
51
|
};
|
|
68
52
|
addEffect(entity: Entity, effectType: string, amplifier: number, duration: number): void;
|
|
69
53
|
removeEffect(entity: Entity, effectType: string): void;
|
|
70
54
|
removeAllEffects(entity: Entity): void;
|
|
71
|
-
extendEffect(entity: Entity, effectType: string, additionalDuration: number): boolean;
|
|
72
55
|
hasEffect(entity: Entity, effectType: string): boolean;
|
|
73
56
|
getEffects(entity: Entity): EffectObject[];
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
57
|
+
registerPotion(config: PotionConfig): {
|
|
58
|
+
handler: (entity: Entity, amplifier: number, duration: number, color: RGBA) => void;
|
|
59
|
+
};
|
|
60
|
+
start(startup?: StartupEvent, debug?: boolean): void;
|
|
61
|
+
private handleProjectileHit;
|
|
62
|
+
private handleSplash;
|
|
63
|
+
private handleLingering;
|
|
64
|
+
private updateCloud;
|
|
65
|
+
private getColorFromEntity;
|
|
80
66
|
}
|
|
81
|
-
|
|
67
|
+
declare const effectManager: EffectManager;
|
|
68
|
+
export { EffectManager, effectManager, EffectObject, EffectConfig, PotionConfig };
|
|
82
69
|
//# sourceMappingURL=effectsAPI.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effectsAPI.d.ts","sourceRoot":"","sources":["../../src/minecraft/effectsAPI.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"effectsAPI.d.ts","sourceRoot":"","sources":["../../src/minecraft/effectsAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,MAAM,EAKN,IAAI,EACJ,YAAY,EAIZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAkB,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3D,UAAU,YAAa,SAAQ,YAAY;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,IAAI,CAAC;CACZ;AAQD,UAAU,YAAY;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE;QAAE,OA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