redscript-mc 1.2.16 → 1.2.18

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.
@@ -8,14 +8,12 @@
8
8
  // ──────────────────────────────────────────────────────────────────────
9
9
 
10
10
  /// Displays a message to all players in chat as the server.
11
- /// 以服务器名义向所有玩家发送聊天消息。
12
11
  /// @param message Message to broadcast to all players
13
12
  /// @example say("Hello, world!");
14
13
  /// @example say("Game has started!");
15
14
  declare fn say(message: string): void;
16
15
 
17
16
  /// Sends a private message to a player or selector using tellraw.
18
- /// 使用 tellraw 向玩家或选择器发送私信。
19
17
  /// @param target Target player or entity selector
20
18
  /// @param message Message to send privately
21
19
  /// @example tell(@s, "You won!");
@@ -23,20 +21,17 @@ declare fn say(message: string): void;
23
21
  declare fn tell(target: selector, message: string): void;
24
22
 
25
23
  /// Alias for tell(). Sends a raw text message using tellraw.
26
- /// tell() 的别名,使用 tellraw 发送原始文本消息。
27
24
  /// @param target Target player or entity selector
28
25
  /// @param message Message text (supports f-string interpolation)
29
26
  /// @example tellraw(@s, "Hello!");
30
27
  declare fn tellraw(target: selector, message: string): void;
31
28
 
32
29
  /// Sends a message to all players in chat (@a).
33
- /// 向所有玩家(@a)发送聊天消息。
34
30
  /// @param message Message to broadcast
35
31
  /// @example announce("Round 1 starts in 3 seconds!");
36
32
  declare fn announce(message: string): void;
37
33
 
38
34
  /// Shows a large title on screen for target players.
39
- /// 为目标玩家在屏幕上显示大标题。
40
35
  /// @param target Target player(s)
41
36
  /// @param message Title text to display
42
37
  /// @example title(@a, "Round 1");
@@ -44,21 +39,18 @@ declare fn announce(message: string): void;
44
39
  declare fn title(target: selector, message: string): void;
45
40
 
46
41
  /// Shows subtitle text below the main title on screen.
47
- /// 在屏幕主标题下方显示副标题文字。
48
42
  /// @param target Target player(s)
49
43
  /// @param message Subtitle text (appears below title)
50
44
  /// @example subtitle(@a, "Fight!");
51
45
  declare fn subtitle(target: selector, message: string): void;
52
46
 
53
47
  /// Displays text in the action bar (above the hotbar).
54
- /// 在动作栏(快捷栏上方)显示文字。
55
48
  /// @param target Target player(s)
56
49
  /// @param message Action bar text (above hotbar)
57
50
  /// @example actionbar(@a, "⏱ ${time}s remaining");
58
51
  declare fn actionbar(target: selector, message: string): void;
59
52
 
60
53
  /// Sets title display timing in ticks. 20 ticks = 1 second.
61
- /// 设置标题显示时间(以 tick 为单位),20 tick = 1 秒。
62
54
  /// @param target Target player(s)
63
55
  /// @param fadeIn Fade-in duration in ticks
64
56
  /// @param stay Stay duration in ticks
@@ -72,83 +64,74 @@ declare fn title_times(target: selector, fadeIn: int, stay: int, fadeOut: int):
72
64
  // ──────────────────────────────────────────────────────────────────────
73
65
 
74
66
  /// Gives item(s) to a player.
75
- /// 给予玩家物品。
76
67
  /// @param target Target player(s)
77
68
  /// @param item Item ID (e.g. "minecraft:diamond")
78
- /// @param count? Number of items to give
79
- /// @param nbt? Optional NBT data for the item
69
+ /// @param count Number of items to give (optional)
70
+ /// @param nbt Optional NBT data for the item (optional)
80
71
  /// @example give(@s, "minecraft:diamond", 5);
81
72
  /// @example give(@a, "minecraft:apple");
82
73
  /// @example give(@s, "minecraft:diamond_sword", 1, "{Enchantments:[{id:\"minecraft:sharpness\",lvl:5s}]}");
83
- declare fn give(target: selector, item: string, count?: int, nbt?: string): void;
74
+ declare fn give(target: selector, item: string, count: int = 1, nbt: string): void;
84
75
 
85
76
  /// Kills the target entity. Defaults to the executing entity (@s).
86
- /// 击杀目标实体,默认击杀当前执行实体(@s)。
87
- /// @param target? Target to kill (default: @s)
77
+ /// @param target Target to kill (default: @s) (optional)
88
78
  /// @example kill(@e[type=minecraft:zombie]);
89
79
  /// @example kill(@s);
90
80
  /// @example kill(@e[tag=enemy]);
91
- declare fn kill(target?: selector): void;
81
+ declare fn kill(target: selector = @s): void;
92
82
 
93
83
  /// Applies a status effect to an entity.
94
- /// 为实体应用药水状态效果。
95
84
  /// @param target Target entity or player
96
85
  /// @param effect Effect ID (e.g. "minecraft:speed")
97
- /// @param duration? Duration in seconds
98
- /// @param amplifier? Effect level (0-255, where 0 = level 1)
86
+ /// @param duration Duration in seconds (optional)
87
+ /// @param amplifier Effect level (0-255, where 0 = level 1) (optional)
99
88
  /// @example effect(@s, "minecraft:speed", 60, 1);
100
89
  /// @example effect(@a, "minecraft:regeneration", 10);
101
90
  /// @example effect(@e[type=minecraft:zombie], "minecraft:slowness", 20, 2);
102
- declare fn effect(target: selector, effect: string, duration?: int, amplifier?: int): void;
91
+ declare fn effect(target: selector, effect: string, duration: int = 30, amplifier: int = 0): void;
103
92
 
104
93
  /// Removes a status effect from an entity, or clears all effects.
105
- /// 移除实体的药水效果,省略 effect 参数则清除所有效果。
106
94
  /// @param target Target entity or player
107
- /// @param effect? Effect to remove (omit to clear all)
95
+ /// @param effect Effect to remove (omit to clear all) (optional)
108
96
  /// @example effect_clear(@s, "minecraft:poison");
109
97
  /// @example effect_clear(@a);
110
- declare fn effect_clear(target: selector, effect?: string): void;
98
+ declare fn effect_clear(target: selector, effect: string): void;
111
99
 
112
100
  /// Removes items from a player's inventory.
113
- /// 清除玩家背包中的物品。
114
101
  /// @param target Target player
115
- /// @param item? Specific item to remove (omit to clear all)
102
+ /// @param item Specific item to remove (omit to clear all) (optional)
116
103
  /// @example clear(@s, "minecraft:dirt");
117
104
  /// @example clear(@a);
118
- declare fn clear(target: selector, item?: string): void;
105
+ declare fn clear(target: selector, item: string): void;
119
106
 
120
107
  /// Kicks a player from the server with an optional reason.
121
- /// 将玩家踢出服务器,可附加原因。
122
108
  /// @param player Target player to kick
123
- /// @param reason? Kick message shown to the player
109
+ /// @param reason Kick message shown to the player (optional)
124
110
  /// @example kick(@s, "You lost!");
125
111
  /// @example kick(@p, "AFK too long");
126
- declare fn kick(player: selector, reason?: string): void;
112
+ declare fn kick(player: selector, reason: string): void;
127
113
 
128
114
  /// Adds experience points or levels to a player.
129
- /// 给玩家增加经验点或等级。
130
115
  /// @param target Target player
131
116
  /// @param amount Amount of XP to add
132
- /// @param type? "points" or "levels"
117
+ /// @param type "points" or "levels" (optional)
133
118
  /// @example xp_add(@s, 100);
134
119
  /// @example xp_add(@s, 5, "levels");
135
- declare fn xp_add(target: selector, amount: int, type?: string): void;
120
+ declare fn xp_add(target: selector, amount: int, type: string = points): void;
136
121
 
137
122
  /// Sets a player's experience points or levels.
138
- /// 设置玩家的经验点或等级。
139
123
  /// @param target Target player
140
124
  /// @param amount New XP value
141
- /// @param type? "points" or "levels"
125
+ /// @param type "points" or "levels" (optional)
142
126
  /// @example xp_set(@s, 0, "levels");
143
127
  /// @example xp_set(@s, 500);
144
- declare fn xp_set(target: selector, amount: int, type?: string): void;
128
+ declare fn xp_set(target: selector, amount: int, type: string = points): void;
145
129
 
146
130
  // ──────────────────────────────────────────────────────────────────────
147
131
  // World & Block
148
132
  // ──────────────────────────────────────────────────────────────────────
149
133
 
150
134
  /// Teleports an entity to a player or position.
151
- /// 将实体传送到指定玩家或坐标。
152
135
  /// @param target Entity to teleport
153
136
  /// @param destination Target player or BlockPos coordinates
154
137
  /// @example tp(@s, (0, 64, 0));
@@ -157,14 +140,12 @@ declare fn xp_set(target: selector, amount: int, type?: string): void;
157
140
  declare fn tp(target: selector, destination: selector): void;
158
141
 
159
142
  /// @deprecated Use tp() instead. Teleports an entity to a position.
160
- /// @deprecated 请使用 tp()。将实体传送到指定位置。
161
143
  /// @param target Entity to teleport
162
144
  /// @param destination Target player or position
163
145
  /// @example tp(@s, (0, 64, 0)); // use tp instead
164
146
  declare fn tp_to(target: selector, destination: selector): void;
165
147
 
166
148
  /// Places a block at the specified coordinates.
167
- /// 在指定坐标放置方块。
168
149
  /// @param pos Block position, e.g. (0, 64, 0) or (~1, ~0, ~0)
169
150
  /// @param block Block ID (e.g. "minecraft:stone")
170
151
  /// @example setblock((0, 64, 0), "minecraft:stone");
@@ -172,7 +153,6 @@ declare fn tp_to(target: selector, destination: selector): void;
172
153
  declare fn setblock(pos: BlockPos, block: string): void;
173
154
 
174
155
  /// Fills a cuboid region with a specified block.
175
- /// 用指定方块填充一个立方体区域。
176
156
  /// @param from Start corner of the region
177
157
  /// @param to End corner of the region
178
158
  /// @param block Block to fill with
@@ -181,7 +161,6 @@ declare fn setblock(pos: BlockPos, block: string): void;
181
161
  declare fn fill(from: BlockPos, to: BlockPos, block: string): void;
182
162
 
183
163
  /// Clones a region of blocks to a new location.
184
- /// 将一个区域的方块复制到新的位置。
185
164
  /// @param from Source region start corner
186
165
  /// @param to Source region end corner
187
166
  /// @param dest Destination corner
@@ -189,64 +168,57 @@ declare fn fill(from: BlockPos, to: BlockPos, block: string): void;
189
168
  declare fn clone(from: BlockPos, to: BlockPos, dest: BlockPos): void;
190
169
 
191
170
  /// Summons an entity at the specified position.
192
- /// 在指定位置生成实体。
193
171
  /// @param type Entity type ID (e.g. "minecraft:zombie")
194
- /// @param x? X coordinate (default: ~)
195
- /// @param y? Y coordinate (default: ~)
196
- /// @param z? Z coordinate (default: ~)
197
- /// @param nbt? Optional NBT data for the entity
172
+ /// @param x X coordinate (default: ~) (optional)
173
+ /// @param y Y coordinate (default: ~) (optional)
174
+ /// @param z Z coordinate (default: ~) (optional)
175
+ /// @param nbt Optional NBT data for the entity (optional)
198
176
  /// @example summon("minecraft:zombie", ~0, ~0, ~0);
199
177
  /// @example summon("minecraft:armor_stand", (0, 64, 0));
200
178
  /// @example summon("minecraft:zombie", ~0, ~0, ~0, "{CustomName:\"Boss\"}");
201
- declare fn summon(type: string, x?: coord, y?: coord, z?: coord, nbt?: string): void;
179
+ declare fn summon(type: string, x: coord = ~, y: coord = ~, z: coord = ~, nbt: string): void;
202
180
 
203
181
  /// Spawns a particle effect at the specified position.
204
- /// 在指定位置生成粒子效果。
205
182
  /// @param name Particle type ID (e.g. "minecraft:flame")
206
- /// @param x? X coordinate
207
- /// @param y? Y coordinate
208
- /// @param z? Z coordinate
183
+ /// @param x X coordinate (optional)
184
+ /// @param y Y coordinate (optional)
185
+ /// @param z Z coordinate (optional)
209
186
  /// @example particle("minecraft:flame", (~0, ~1, ~0));
210
187
  /// @example particle("minecraft:explosion", (0, 100, 0));
211
- declare fn particle(name: string, x?: coord, y?: coord, z?: coord): void;
188
+ declare fn particle(name: string, x: coord = ~, y: coord = ~, z: coord = ~): void;
212
189
 
213
190
  /// Plays a sound effect for target players.
214
- /// 为目标玩家播放音效。
215
191
  /// @param sound Sound event ID (e.g. "entity.experience_orb.pickup")
216
192
  /// @param source Sound category: "master", "music", "record", "weather", "block", "hostile", "neutral", "player", "ambient", "voice"
217
193
  /// @param target Target player to hear the sound
218
- /// @param x? X origin position
219
- /// @param y? Y origin position
220
- /// @param z? Z origin position
221
- /// @param volume? Volume (default: 1.0)
222
- /// @param pitch? Pitch (default: 1.0)
223
- /// @param minVolume? Minimum volume for distant players
194
+ /// @param x X origin position (optional)
195
+ /// @param y Y origin position (optional)
196
+ /// @param z Z origin position (optional)
197
+ /// @param volume Volume (default: 1.0) (optional)
198
+ /// @param pitch Pitch (default: 1.0) (optional)
199
+ /// @param minVolume Minimum volume for distant players (optional)
224
200
  /// @example playsound("entity.experience_orb.pickup", "player", @s);
225
201
  /// @example playsound("ui.toast.challenge_complete", "master", @a);
226
- declare fn playsound(sound: string, source: string, target: selector, x?: coord, y?: coord, z?: coord, volume?: float, pitch?: float, minVolume?: float): void;
202
+ declare fn playsound(sound: string, source: string, target: selector, x: coord, y: coord, z: coord, volume: float = 1.0, pitch: float = 1.0, minVolume: float): void;
227
203
 
228
204
  /// Sets the weather condition.
229
- /// 设置天气状态。
230
205
  /// @param type "clear", "rain", or "thunder"
231
206
  /// @example weather("clear");
232
207
  /// @example weather("thunder");
233
208
  declare fn weather(type: string): void;
234
209
 
235
210
  /// Sets the world time.
236
- /// 设置世界时间。
237
211
  /// @param value Time in ticks, or "day"/"night"/"noon"/"midnight"
238
212
  /// @example time_set(0); // dawn
239
213
  /// @example time_set("midnight");
240
214
  declare fn time_set(value: string): void;
241
215
 
242
216
  /// Advances the world time by a number of ticks.
243
- /// 将世界时间推进指定的 tick 数。
244
217
  /// @param ticks Number of ticks to advance
245
218
  /// @example time_add(6000); // advance by half a day
246
219
  declare fn time_add(ticks: int): void;
247
220
 
248
221
  /// Sets a gamerule value.
249
- /// 设置游戏规则的值。
250
222
  /// @param rule Gamerule name (e.g. "keepInventory")
251
223
  /// @param value New value (true/false for boolean rules, integer for numeric)
252
224
  /// @example gamerule("keepInventory", true);
@@ -254,7 +226,6 @@ declare fn time_add(ticks: int): void;
254
226
  declare fn gamerule(rule: string, value: string): void;
255
227
 
256
228
  /// Sets the game difficulty.
257
- /// 设置游戏难度。
258
229
  /// @param level "peaceful", "easy", "normal", or "hard"
259
230
  /// @example difficulty("hard");
260
231
  /// @example difficulty("peaceful");
@@ -265,7 +236,6 @@ declare fn difficulty(level: string): void;
265
236
  // ──────────────────────────────────────────────────────────────────────
266
237
 
267
238
  /// Adds a scoreboard tag to an entity.
268
- /// 为实体添加计分板标签。
269
239
  /// @param target Target entity
270
240
  /// @param tag Tag name to add
271
241
  /// @example tag_add(@s, "hasKey");
@@ -273,7 +243,6 @@ declare fn difficulty(level: string): void;
273
243
  declare fn tag_add(target: selector, tag: string): void;
274
244
 
275
245
  /// Removes a scoreboard tag from an entity.
276
- /// 从实体身上移除计分板标签。
277
246
  /// @param target Target entity
278
247
  /// @param tag Tag name to remove
279
248
  /// @example tag_remove(@s, "hasKey");
@@ -284,7 +253,6 @@ declare fn tag_remove(target: selector, tag: string): void;
284
253
  // ──────────────────────────────────────────────────────────────────────
285
254
 
286
255
  /// Reads a value from a vanilla MC scoreboard objective.
287
- /// 从原版 MC 计分板目标读取数值。
288
256
  /// @param target Player, entity, or fake player name (e.g. "#counter")
289
257
  /// @param objective Scoreboard objective name
290
258
  /// @returns int
@@ -293,7 +261,6 @@ declare fn tag_remove(target: selector, tag: string): void;
293
261
  declare fn scoreboard_get(target: selector, objective: string): int;
294
262
 
295
263
  /// Alias for scoreboard_get(). Reads a value from a scoreboard.
296
- /// scoreboard_get() 的别名,从计分板读取数值。
297
264
  /// @param target Player, entity, or fake player name
298
265
  /// @param objective Scoreboard objective name
299
266
  /// @returns int
@@ -301,7 +268,6 @@ declare fn scoreboard_get(target: selector, objective: string): int;
301
268
  declare fn score(target: selector, objective: string): int;
302
269
 
303
270
  /// Sets a value in a vanilla MC scoreboard objective.
304
- /// 设置原版 MC 计分板目标中的数值。
305
271
  /// @param target Player, entity, or fake player
306
272
  /// @param objective Objective name
307
273
  /// @param value New score value
@@ -310,29 +276,25 @@ declare fn score(target: selector, objective: string): int;
310
276
  declare fn scoreboard_set(target: selector, objective: string, value: int): void;
311
277
 
312
278
  /// Displays a scoreboard objective in a display slot.
313
- /// 在指定显示位置展示计分板目标。
314
279
  /// @param slot "list", "sidebar", or "belowName"
315
280
  /// @param objective Objective name to display
316
281
  /// @example scoreboard_display("sidebar", "kills");
317
282
  declare fn scoreboard_display(slot: string, objective: string): void;
318
283
 
319
284
  /// Clears the display in a scoreboard slot.
320
- /// 清除计分板显示位置的内容。
321
285
  /// @param slot "list", "sidebar", or "belowName"
322
286
  /// @example scoreboard_hide("sidebar");
323
287
  declare fn scoreboard_hide(slot: string): void;
324
288
 
325
289
  /// Creates a new scoreboard objective.
326
- /// 创建新的计分板目标。
327
290
  /// @param name Objective name
328
291
  /// @param criteria Criteria (e.g. "dummy", "playerKillCount")
329
- /// @param displayName? Optional display name
292
+ /// @param displayName Optional display name (optional)
330
293
  /// @example scoreboard_add_objective("kills", "playerKillCount");
331
294
  /// @example scoreboard_add_objective("timer", "dummy", "Game Timer");
332
- declare fn scoreboard_add_objective(name: string, criteria: string, displayName?: string): void;
295
+ declare fn scoreboard_add_objective(name: string, criteria: string, displayName: string): void;
333
296
 
334
297
  /// Removes a scoreboard objective.
335
- /// 删除计分板目标。
336
298
  /// @param name Objective name to remove
337
299
  /// @example scoreboard_remove_objective("kills");
338
300
  declare fn scoreboard_remove_objective(name: string): void;
@@ -342,7 +304,6 @@ declare fn scoreboard_remove_objective(name: string): void;
342
304
  // ──────────────────────────────────────────────────────────────────────
343
305
 
344
306
  /// Generates a random integer in range [min, max] using scoreboard arithmetic. Compatible with all MC versions.
345
- /// 使用计分板运算生成 [min, max] 范围内的随机整数,兼容所有 MC 版本。
346
307
  /// @param min Minimum value (inclusive)
347
308
  /// @param max Maximum value (inclusive)
348
309
  /// @returns int
@@ -351,7 +312,6 @@ declare fn scoreboard_remove_objective(name: string): void;
351
312
  declare fn random(min: int, max: int): int;
352
313
 
353
314
  /// Generates a random integer using /random command (MC 1.20.3+). Faster and more reliable than random().
354
- /// 使用 /random 命令(MC 1.20.3+)生成随机整数,比 random() 更快更可靠。
355
315
  /// @param min Minimum value (inclusive)
356
316
  /// @param max Maximum value (inclusive)
357
317
  /// @returns int
@@ -359,29 +319,26 @@ declare fn random(min: int, max: int): int;
359
319
  declare fn random_native(min: int, max: int): int;
360
320
 
361
321
  /// Resets a random sequence with an optional seed (MC 1.20.3+).
362
- /// 重置随机序列,可指定种子(MC 1.20.3+)。
363
322
  /// @param sequence Sequence name (namespaced, e.g. "mypack:loot")
364
- /// @param seed? Seed value
323
+ /// @param seed Seed value (optional)
365
324
  /// @example random_sequence("mypack:loot", 42);
366
- declare fn random_sequence(sequence: string, seed?: int): void;
325
+ declare fn random_sequence(sequence: string, seed: int = 0): void;
367
326
 
368
327
  // ──────────────────────────────────────────────────────────────────────
369
328
  // Data (NBT)
370
329
  // ──────────────────────────────────────────────────────────────────────
371
330
 
372
331
  /// Reads NBT data from an entity, block, or storage into an integer variable.
373
- /// 从实体、方块或存储读取 NBT 数据到整型变量。
374
332
  /// @param targetType "entity", "block", or "storage"
375
333
  /// @param target Target selector or storage path
376
334
  /// @param path NBT path (e.g. "Health")
377
- /// @param scale? Scale factor
335
+ /// @param scale Scale factor (optional)
378
336
  /// @returns int
379
337
  /// @example let hp: int = data_get("entity", "@s", "Health");
380
338
  /// @example let val: int = data_get("storage", "mypack:data", "myKey");
381
- declare fn data_get(targetType: string, target: string, path: string, scale?: float): int;
339
+ declare fn data_get(targetType: string, target: string, path: string, scale: float = 1): int;
382
340
 
383
341
  /// Merges NBT data into an entity, block, or storage.
384
- /// 将 NBT 数据合并到实体、方块或存储中。
385
342
  /// @param target Target entity selector or block position
386
343
  /// @param nbt NBT data to merge (struct literal or string)
387
344
  /// @example data_merge(@s, { Invisible: 1b, Silent: 1b });
@@ -392,62 +349,53 @@ declare fn data_merge(target: selector, nbt: string): void;
392
349
  // ──────────────────────────────────────────────────────────────────────
393
350
 
394
351
  /// Creates a new boss bar.
395
- /// 创建新的 Boss 血条。
396
352
  /// @param id Boss bar ID (namespaced, e.g. "minecraft:health")
397
353
  /// @param name Display name
398
354
  /// @example bossbar_add("mymod:timer", "Time Left");
399
355
  declare fn bossbar_add(id: string, name: string): void;
400
356
 
401
357
  /// Sets the current value of a boss bar.
402
- /// 设置 Boss 血条的当前值。
403
358
  /// @param id Boss bar ID
404
359
  /// @param value Current value
405
360
  /// @example bossbar_set_value("mymod:timer", 60);
406
361
  declare fn bossbar_set_value(id: string, value: int): void;
407
362
 
408
363
  /// Sets the maximum value of a boss bar.
409
- /// 设置 Boss 血条的最大值。
410
364
  /// @param id Boss bar ID
411
365
  /// @param max Maximum value
412
366
  /// @example bossbar_set_max("mymod:timer", 300);
413
367
  declare fn bossbar_set_max(id: string, max: int): void;
414
368
 
415
369
  /// Sets the color of a boss bar.
416
- /// 设置 Boss 血条的颜色。
417
370
  /// @param id Boss bar ID
418
371
  /// @param color "blue", "green", "pink", "purple", "red", "white", or "yellow"
419
372
  /// @example bossbar_set_color("mymod:timer", "red");
420
373
  declare fn bossbar_set_color(id: string, color: string): void;
421
374
 
422
375
  /// Sets the style (segmentation) of a boss bar.
423
- /// 设置 Boss 血条的样式(分段方式)。
424
376
  /// @param id Boss bar segmentation style
425
377
  /// @param style "notched_6", "notched_10", "notched_12", "notched_20", or "progress"
426
378
  /// @example bossbar_set_style("mymod:timer", "notched_10");
427
379
  declare fn bossbar_set_style(id: string, style: string): void;
428
380
 
429
381
  /// Shows or hides a boss bar.
430
- /// 显示或隐藏 Boss 血条。
431
382
  /// @param id Boss bar ID
432
383
  /// @param visible Visibility state (true = show, false = hide)
433
384
  /// @example bossbar_set_visible("mymod:timer", true);
434
385
  declare fn bossbar_set_visible(id: string, visible: bool): void;
435
386
 
436
387
  /// Sets which players can see the boss bar.
437
- /// 设置哪些玩家能看到 Boss 血条。
438
388
  /// @param id Boss bar ID
439
389
  /// @param target Players who should see the boss bar
440
390
  /// @example bossbar_set_players("mymod:timer", @a);
441
391
  declare fn bossbar_set_players(id: string, target: selector): void;
442
392
 
443
393
  /// Removes a boss bar.
444
- /// 移除 Boss 血条。
445
394
  /// @param id Boss bar ID to remove
446
395
  /// @example bossbar_remove("mymod:timer");
447
396
  declare fn bossbar_remove(id: string): void;
448
397
 
449
398
  /// Gets the current value of a boss bar.
450
- /// 获取 Boss 血条的当前值。
451
399
  /// @param id Boss bar ID
452
400
  /// @returns int
453
401
  /// @example let v: int = bossbar_get_value("mymod:timer");
@@ -458,21 +406,18 @@ declare fn bossbar_get_value(id: string): int;
458
406
  // ──────────────────────────────────────────────────────────────────────
459
407
 
460
408
  /// Creates a new team.
461
- /// 创建新的队伍。
462
409
  /// @param name Team name
463
- /// @param displayName? Optional display name
410
+ /// @param displayName Optional display name (optional)
464
411
  /// @example team_add("red");
465
412
  /// @example team_add("blue", "Blue Team");
466
- declare fn team_add(name: string, displayName?: string): void;
413
+ declare fn team_add(name: string, displayName: string): void;
467
414
 
468
415
  /// Removes a team.
469
- /// 移除队伍。
470
416
  /// @param name Team name to remove
471
417
  /// @example team_remove("red");
472
418
  declare fn team_remove(name: string): void;
473
419
 
474
420
  /// Adds entities to a team.
475
- /// 将实体加入队伍。
476
421
  /// @param name Team name to join
477
422
  /// @param target Entities to add to the team
478
423
  /// @example team_join("red", @s);
@@ -480,13 +425,11 @@ declare fn team_remove(name: string): void;
480
425
  declare fn team_join(name: string, target: selector): void;
481
426
 
482
427
  /// Removes entities from their current team.
483
- /// 将实体从当前队伍中移除。
484
428
  /// @param target Entities to remove from their team
485
429
  /// @example team_leave(@s);
486
430
  declare fn team_leave(target: selector): void;
487
431
 
488
432
  /// Sets a team option/property.
489
- /// 设置队伍选项/属性。
490
433
  /// @param name Team name
491
434
  /// @param option Option name (e.g. "color", "friendlyFire", "prefix")
492
435
  /// @param value Option value
@@ -499,21 +442,18 @@ declare fn team_option(name: string, option: string, value: string): void;
499
442
  // ──────────────────────────────────────────────────────────────────────
500
443
 
501
444
  /// Creates a new unique set backed by NBT storage. Returns the set ID.
502
- /// 创建新的基于 NBT 存储的唯一集合,返回集合 ID。
503
445
  /// @returns string
504
446
  /// @example let enemies: string = set_new();
505
447
  /// @example set_add(enemies, "@s");
506
448
  declare fn set_new(): string;
507
449
 
508
450
  /// Adds a value to a set (no-op if already present).
509
- /// 向集合添加值(若已存在则不操作)。
510
451
  /// @param setId Set ID returned by set_new()
511
452
  /// @param value Value to add
512
453
  /// @example set_add(enemies, "@s");
513
454
  declare fn set_add(setId: string, value: string): void;
514
455
 
515
456
  /// Returns 1 if the set contains the value, 0 otherwise.
516
- /// 若集合包含该值返回 1,否则返回 0。
517
457
  /// @param setId Set ID
518
458
  /// @param value Value to check
519
459
  /// @returns int
@@ -521,14 +461,12 @@ declare fn set_add(setId: string, value: string): void;
521
461
  declare fn set_contains(setId: string, value: string): int;
522
462
 
523
463
  /// Removes a value from a set.
524
- /// 从集合中移除一个值。
525
464
  /// @param setId Set ID
526
465
  /// @param value Value to remove
527
466
  /// @example set_remove(enemies, "@s");
528
467
  declare fn set_remove(setId: string, value: string): void;
529
468
 
530
469
  /// Removes all values from a set.
531
- /// 清空集合中的所有值。
532
470
  /// @param setId Set ID to clear
533
471
  /// @example set_clear(enemies);
534
472
  declare fn set_clear(setId: string): void;
@@ -538,14 +476,12 @@ declare fn set_clear(setId: string): void;
538
476
  // ──────────────────────────────────────────────────────────────────────
539
477
 
540
478
  /// Executes a callback function after a delay (in ticks).
541
- /// 在指定延迟(tick)后执行回调函数。
542
479
  /// @param delay Delay in ticks before executing the callback
543
480
  /// @param callback Lambda function to execute after delay
544
481
  /// @example setTimeout(100, () => { say("5 seconds passed!"); });
545
482
  declare fn setTimeout(delay: int, callback: string): void;
546
483
 
547
484
  /// Executes a callback function repeatedly at a fixed interval. Returns an interval ID.
548
- /// 以固定间隔重复执行回调函数,返回间隔 ID。
549
485
  /// @param interval Interval in ticks between executions
550
486
  /// @param callback Lambda function to execute repeatedly
551
487
  /// @returns int
@@ -553,7 +489,6 @@ declare fn setTimeout(delay: int, callback: string): void;
553
489
  declare fn setInterval(interval: int, callback: string): int;
554
490
 
555
491
  /// Cancels a repeating interval created by setInterval().
556
- /// 取消由 setInterval() 创建的重复间隔。
557
492
  /// @param id Interval ID returned by setInterval()
558
493
  /// @example clearInterval(timer);
559
494
  declare fn clearInterval(id: int): void;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "redscript-vscode",
3
- "version": "1.0.1",
3
+ "version": "1.0.9",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "redscript-vscode",
9
- "version": "1.0.1",
9
+ "version": "1.0.9",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "redscript": "file:../../"
@@ -2,7 +2,7 @@
2
2
  "name": "redscript-vscode",
3
3
  "displayName": "RedScript for Minecraft",
4
4
  "description": "Syntax highlighting, error diagnostics, and language support for RedScript — a compiler targeting Minecraft Java Edition",
5
- "version": "1.0.6",
5
+ "version": "1.0.9",
6
6
  "publisher": "bkmashiro",
7
7
  "icon": "icon.png",
8
8
  "license": "MIT",
@@ -137,7 +137,7 @@
137
137
  },
138
138
  {
139
139
  "name": "keyword.declaration.redscript",
140
- "match": "\\b(fn|let|struct|enum|impl|import|namespace|trigger)\\b"
140
+ "match": "\\b(fn|let|struct|enum|impl|import|namespace|trigger|declare)\\b"
141
141
  },
142
142
  {
143
143
  "name": "keyword.declaration.const.redscript",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redscript-mc",
3
- "version": "1.2.16",
3
+ "version": "1.2.18",
4
4
  "description": "A high-level programming language that compiles to Minecraft datapacks",
5
5
  "main": "dist/index.js",
6
6
  "bin": {