@kradle/challenges 0.2.0 → 0.2.1
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/AGENTS.md +17 -7
- package/LLM_README.md +260 -108
- package/README.md +62 -71
- package/dist/actions.d.ts +12 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +15 -1
- package/dist/actions.js.map +1 -1
- package/package.json +1 -1
- package/src/actions.ts +17 -2
package/AGENTS.md
CHANGED
|
@@ -68,10 +68,10 @@ The main engine that:
|
|
|
68
68
|
- `build()`: Generates all MCFunctions and calls `savePack()`
|
|
69
69
|
|
|
70
70
|
**Generated MCFunctions:**
|
|
71
|
-
1. `start_challenge` - Initial setup, tags players, sets game state
|
|
72
|
-
2. `init_participants` -
|
|
73
|
-
3. `on_tick` - Main loop: updates variables, processes events, checks end condition
|
|
74
|
-
4. `end_challenge` - Announces winners, saves game state
|
|
71
|
+
1. `start_challenge` - Initial setup, tags players, sets game state (runs globally)
|
|
72
|
+
2. `init_participants` - Player setup (runs globally, delayed 1 second via schedule)
|
|
73
|
+
3. `on_tick` - Main loop: updates variables, processes events, checks end condition (runs globally every tick)
|
|
74
|
+
4. `end_challenge` - Announces winners, saves game state (runs globally)
|
|
75
75
|
|
|
76
76
|
#### 2. Actions Library (`actions.ts`)
|
|
77
77
|
|
|
@@ -90,13 +90,21 @@ Pre-built game operations. Each action is a function that generates Sandstone co
|
|
|
90
90
|
**Implementation Pattern:**
|
|
91
91
|
```typescript
|
|
92
92
|
export const Actions = {
|
|
93
|
-
give: (
|
|
94
|
-
give(
|
|
93
|
+
give: ({ item, target, count = 1 }: { item: ITEMS; target: TargetNames; count?: number }) => {
|
|
94
|
+
give(mapTarget(target), item, count);
|
|
95
95
|
},
|
|
96
96
|
// ...
|
|
97
97
|
};
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
**Target Mapping:**
|
|
101
|
+
The `mapTarget()` function converts `TargetNames` to selectors:
|
|
102
|
+
- `"all"` → `@a[tag=kradle_participant]`
|
|
103
|
+
- `"self"` → `"@s"`
|
|
104
|
+
- `SelectorClass` → passed through
|
|
105
|
+
- `"minecraft:entity_type"` → `@e[type=minecraft:entity_type]`
|
|
106
|
+
- Other strings → `@a[tag=<string>]` (treated as team names)
|
|
107
|
+
|
|
100
108
|
#### 3. Variable System (`types.ts`, `challenge.ts`)
|
|
101
109
|
|
|
102
110
|
**Variable Types:**
|
|
@@ -118,9 +126,11 @@ export const Actions = {
|
|
|
118
126
|
**Score Events:**
|
|
119
127
|
- Track previous tick values to detect changes
|
|
120
128
|
- Fire when score reaches target (fire_once) or while condition holds (repeatable)
|
|
121
|
-
-
|
|
129
|
+
- For individual variables: events fire per-player
|
|
130
|
+
- For global variables: events fire globally
|
|
122
131
|
|
|
123
132
|
**Advancement Events:**
|
|
133
|
+
- Always fire per-player (advancement triggers are inherently per-player)
|
|
124
134
|
- Converted to score events internally
|
|
125
135
|
- Advancement grants → score increment → event fires
|
|
126
136
|
- Advancement revoked after triggering
|
package/LLM_README.md
CHANGED
|
@@ -53,9 +53,18 @@ Minecraft runs at 20 ticks per second. Time values in this API are in ticks:
|
|
|
53
53
|
- 1 minute = 1200 ticks (60 * 20)
|
|
54
54
|
- 5 minutes = 6000 ticks
|
|
55
55
|
|
|
56
|
-
### Namespace
|
|
56
|
+
### Namespace & Item IDs
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
**IMPORTANT:** Most Actions require the full `minecraft:` prefix for items, blocks, and entities:
|
|
59
|
+
- ✅ Correct: `item: "minecraft:diamond_sword"`
|
|
60
|
+
- ❌ Wrong: `item: "diamond_sword"`
|
|
61
|
+
|
|
62
|
+
The only exceptions are when the API explicitly accepts an item without the namespace (check each Action's documentation).
|
|
63
|
+
|
|
64
|
+
**Examples:**
|
|
65
|
+
- Items: `"minecraft:diamond"`, `"minecraft:iron_sword"`, `"minecraft:cooked_beef"`
|
|
66
|
+
- Blocks: `"minecraft:stone"`, `"minecraft:diamond_block"`
|
|
67
|
+
- Entities: `"minecraft:zombie"`, `"minecraft:pig"`, `"minecraft:creeper"`
|
|
59
68
|
|
|
60
69
|
### Scores
|
|
61
70
|
|
|
@@ -74,6 +83,14 @@ Roles define player groups (e.g., teams). Each role can have different win condi
|
|
|
74
83
|
|
|
75
84
|
## createChallenge API
|
|
76
85
|
|
|
86
|
+
### Required Imports
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { createChallenge, Actions, forEveryPlayer } from "@kradle/challenges";
|
|
90
|
+
import { _, execute, Selector, rel, abs } from "sandstone";
|
|
91
|
+
import type { Score } from "sandstone";
|
|
92
|
+
```
|
|
93
|
+
|
|
77
94
|
### Signature
|
|
78
95
|
|
|
79
96
|
```typescript
|
|
@@ -244,7 +261,7 @@ current_y_position: {
|
|
|
244
261
|
type: "individual",
|
|
245
262
|
objective_type: "dummy",
|
|
246
263
|
updater: (value) => {
|
|
247
|
-
|
|
264
|
+
value.set(Actions.getCurrentPlayerPosition().y)
|
|
248
265
|
},
|
|
249
266
|
}
|
|
250
267
|
```
|
|
@@ -306,6 +323,8 @@ score.lowerOrEqualThan(number | Score);
|
|
|
306
323
|
|
|
307
324
|
### Lifecycle Events
|
|
308
325
|
|
|
326
|
+
All lifecycle events run globally (not per-player).
|
|
327
|
+
|
|
309
328
|
#### `start_challenge`
|
|
310
329
|
|
|
311
330
|
Runs once when the challenge starts. Use for global setup.
|
|
@@ -320,19 +339,19 @@ start_challenge: () => {
|
|
|
320
339
|
|
|
321
340
|
#### `init_participants`
|
|
322
341
|
|
|
323
|
-
Runs
|
|
342
|
+
Runs 1 second after start_challenge. Use for player setup. It still runs globally.
|
|
324
343
|
|
|
325
344
|
```typescript
|
|
326
345
|
init_participants: () => {
|
|
327
|
-
Actions.give({ item: "minecraft:diamond_sword", count: 1 });
|
|
328
|
-
Actions.setAttribute({
|
|
329
|
-
Actions.teleport({ target: "
|
|
346
|
+
Actions.give({ target: "all", item: "minecraft:diamond_sword", count: 1 });
|
|
347
|
+
Actions.setAttribute({ target: "all", attribute_: "generic.max_health", value: 40 });
|
|
348
|
+
Actions.teleport({ target: "all", x: 0, y: 100, z: 0, absolute: true });
|
|
330
349
|
}
|
|
331
350
|
```
|
|
332
351
|
|
|
333
352
|
#### `on_tick`
|
|
334
353
|
|
|
335
|
-
Runs every tick
|
|
354
|
+
Runs every tick. Use sparingly for performance.
|
|
336
355
|
|
|
337
356
|
```typescript
|
|
338
357
|
on_tick: () => {
|
|
@@ -385,7 +404,7 @@ Score events watch a variable and trigger when it reaches a specified target val
|
|
|
385
404
|
```typescript
|
|
386
405
|
{
|
|
387
406
|
score: variables.death_count,
|
|
388
|
-
mode: "fire_once", // Triggers once when death_count changes from
|
|
407
|
+
mode: "fire_once", // Triggers once when death_count changes away from initial value
|
|
389
408
|
actions: () => {
|
|
390
409
|
Actions.announce({ message: "First death!" });
|
|
391
410
|
},
|
|
@@ -400,6 +419,8 @@ Score events watch a variable and trigger when it reaches a specified target val
|
|
|
400
419
|
|
|
401
420
|
Advancement events trigger when a Minecraft advancement criterion is met. Internally, an advancement is created that grants when the criterion triggers, which then fires the event. The `criteria` array follows the [Minecraft Advancement JSON format](https://minecraft.fandom.com/wiki/Advancement/JSON_format).
|
|
402
421
|
|
|
422
|
+
Advancement-based events always fire per-player.
|
|
423
|
+
|
|
403
424
|
**Parameters:**
|
|
404
425
|
- `criteria` (required): Array of advancement trigger objects with optional conditions
|
|
405
426
|
- `mode` (required): `"fire_once"` or `"repeatable"`
|
|
@@ -424,7 +445,7 @@ Advancement events trigger when a Minecraft advancement criterion is met. Intern
|
|
|
424
445
|
],
|
|
425
446
|
mode: "repeatable",
|
|
426
447
|
actions: () => {
|
|
427
|
-
Actions.increment({
|
|
448
|
+
Actions.increment({ variable: variables.pvp_hits });
|
|
428
449
|
Actions.announce({ message: "PvP hit!" });
|
|
429
450
|
},
|
|
430
451
|
}
|
|
@@ -439,7 +460,7 @@ Advancement events trigger when a Minecraft advancement criterion is met. Intern
|
|
|
439
460
|
],
|
|
440
461
|
mode: "repeatable",
|
|
441
462
|
actions: () => {
|
|
442
|
-
Actions.increment({
|
|
463
|
+
Actions.increment({ variable: variables.combat_actions });
|
|
443
464
|
},
|
|
444
465
|
}
|
|
445
466
|
```
|
|
@@ -459,12 +480,26 @@ See the [Minecraft Wiki](https://minecraft.fandom.com/wiki/Advancement/JSON_form
|
|
|
459
480
|
|
|
460
481
|
## Actions
|
|
461
482
|
|
|
483
|
+
Actions are higher-level functions that wrap common Minecraft operations. They provide:
|
|
484
|
+
- Automatic target mapping (`"all"`, `"self"`, team names → proper selectors)
|
|
485
|
+
- Integration with Kradle's interface (e.g., `Actions.announce` messages appear in Kradle)
|
|
486
|
+
- Consistent API for common operations
|
|
487
|
+
|
|
488
|
+
For advanced use cases not covered by Actions, you can fall back to Sandstone's lower-level functions directly (`give`, `tellraw`, `effect`, `kill`, `execute`, etc.). See [Sandstone Integration](#sandstone-integration).
|
|
489
|
+
|
|
462
490
|
All actions are called via the `Actions` object:
|
|
463
491
|
|
|
464
492
|
```typescript
|
|
465
493
|
import { Actions } from "@kradle/challenges";
|
|
466
494
|
```
|
|
467
495
|
|
|
496
|
+
### Target Parameter
|
|
497
|
+
|
|
498
|
+
Many actions accept a `target` parameter of type `TargetNames`, which can be:
|
|
499
|
+
- `"all"` - Targets all participants (maps to `@a[tag=kradle_participant]`)
|
|
500
|
+
- `"self"` - Targets the current player (maps to `@s`)
|
|
501
|
+
- Any `Selector` instance - Custom selector for fine-grained targeting (e.g., `Selector("@a", { team: "red" })`)
|
|
502
|
+
|
|
468
503
|
### Communication
|
|
469
504
|
|
|
470
505
|
#### `Actions.announce(params)`
|
|
@@ -473,24 +508,44 @@ Broadcast message to all players with KRADLE tag.
|
|
|
473
508
|
|
|
474
509
|
```typescript
|
|
475
510
|
Actions.announce({
|
|
476
|
-
message:
|
|
511
|
+
message: JSONTextComponent; // Message (string or formatted object)
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
// Simple string:
|
|
515
|
+
Actions.announce({ message: "Game starting!" });
|
|
516
|
+
|
|
517
|
+
// Formatted JSONTextComponent:
|
|
518
|
+
Actions.announce({
|
|
519
|
+
message: [
|
|
520
|
+
{ text: "Player ", color: "white" },
|
|
521
|
+
{ selector: "@s", color: "gold", bold: true },
|
|
522
|
+
{ text: " won the game!", color: "green" }
|
|
523
|
+
]
|
|
477
524
|
});
|
|
478
525
|
```
|
|
479
526
|
|
|
480
527
|
#### `Actions.tellraw(params)`
|
|
481
528
|
|
|
482
|
-
Send formatted message to specific target.
|
|
529
|
+
Send formatted message to specific target. **Note:** These messages are only visible to players in-game and will not appear in Kradle's interface. Use `Actions.announce` for messages that should be visible in Kradle.
|
|
483
530
|
|
|
484
531
|
```typescript
|
|
485
532
|
Actions.tellraw({
|
|
486
|
-
target:
|
|
487
|
-
message: JSONTextComponent;
|
|
533
|
+
target: TargetNames; // "all", "self", or any selector
|
|
534
|
+
message: JSONTextComponent; // Message (string or formatted object)
|
|
488
535
|
});
|
|
489
536
|
|
|
490
|
-
//
|
|
537
|
+
// Examples:
|
|
491
538
|
Actions.tellraw({
|
|
492
|
-
target: "
|
|
493
|
-
message: { text: "
|
|
539
|
+
target: "all",
|
|
540
|
+
message: ["Hello, ", { text: "world!", color: "gold", bold: true }]
|
|
541
|
+
});
|
|
542
|
+
Actions.tellraw({
|
|
543
|
+
target: "self",
|
|
544
|
+
message: "You won!"
|
|
545
|
+
});
|
|
546
|
+
Actions.tellraw({
|
|
547
|
+
target: "self",
|
|
548
|
+
message: { text: "Critical hit!", color: "red", bold: true }
|
|
494
549
|
});
|
|
495
550
|
```
|
|
496
551
|
|
|
@@ -498,60 +553,66 @@ Actions.tellraw({
|
|
|
498
553
|
|
|
499
554
|
#### `Actions.give(params)`
|
|
500
555
|
|
|
501
|
-
Give items to
|
|
556
|
+
Give items to a target.
|
|
502
557
|
|
|
503
558
|
```typescript
|
|
504
559
|
Actions.give({
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
560
|
+
target: TargetNames; // "all", "self", or any selector
|
|
561
|
+
item: string; // Item ID (with "minecraft:" prefix)
|
|
562
|
+
count?: number; // Amount (default: 1)
|
|
508
563
|
});
|
|
509
564
|
|
|
510
565
|
// Examples:
|
|
511
|
-
Actions.give({ item: "minecraft:diamond_sword", count: 1 });
|
|
512
|
-
Actions.give({
|
|
513
|
-
|
|
514
|
-
count: 1,
|
|
515
|
-
nbt: {
|
|
516
|
-
Enchantments: [{ id: "minecraft:sharpness", lvl: 5 }]
|
|
517
|
-
}
|
|
518
|
-
});
|
|
566
|
+
Actions.give({ target: "self", item: "minecraft:diamond_sword", count: 1 });
|
|
567
|
+
Actions.give({ target: "all", item: "minecraft:diamond", count: 10 });
|
|
568
|
+
Actions.give({ target: Selector("@a", { team: "red" }), item: "minecraft:iron_sword", count: 1 });
|
|
519
569
|
```
|
|
520
570
|
|
|
571
|
+
**Note:** The `target` parameter can be:
|
|
572
|
+
- `"all"` - All participants
|
|
573
|
+
- `"self"` - Current player (`@s`)
|
|
574
|
+
- Any `Selector` instance for custom targeting
|
|
575
|
+
|
|
521
576
|
#### `Actions.giveLoot(params)`
|
|
522
577
|
|
|
523
|
-
Give random items from loot table.
|
|
578
|
+
Give random items from weighted loot table.
|
|
524
579
|
|
|
525
580
|
```typescript
|
|
526
581
|
Actions.giveLoot({
|
|
527
|
-
|
|
528
|
-
count: number;
|
|
582
|
+
target: TargetNames; // "all", "self", or any selector
|
|
583
|
+
items: [{ name: ITEMS; count: number; weight: number }]; // Weighted item list
|
|
529
584
|
});
|
|
530
585
|
|
|
531
586
|
// Example:
|
|
532
587
|
Actions.giveLoot({
|
|
533
|
-
|
|
534
|
-
|
|
588
|
+
target: "self",
|
|
589
|
+
items: [
|
|
590
|
+
{ name: "minecraft:diamond", count: 5, weight: 1 },
|
|
591
|
+
{ name: "minecraft:iron_ingot", count: 10, weight: 3 },
|
|
592
|
+
{ name: "minecraft:gold_ingot", count: 7, weight: 2 }
|
|
593
|
+
]
|
|
535
594
|
});
|
|
536
595
|
```
|
|
537
596
|
|
|
597
|
+
**Note:** This creates a weighted loot table. Items with higher weights are more likely to be selected.
|
|
598
|
+
|
|
538
599
|
#### `Actions.clear(params)`
|
|
539
600
|
|
|
540
|
-
Clear items from
|
|
601
|
+
Clear all items from a target's inventory.
|
|
541
602
|
|
|
542
603
|
```typescript
|
|
543
604
|
Actions.clear({
|
|
544
|
-
|
|
605
|
+
target: TargetNames; // "all", "self", or any selector
|
|
545
606
|
});
|
|
546
607
|
|
|
547
608
|
// Examples:
|
|
548
|
-
Actions.clear({
|
|
549
|
-
Actions.clear({});
|
|
609
|
+
Actions.clear({ target: "self" }); // Clear current player's inventory
|
|
610
|
+
Actions.clear({ target: "all" }); // Clear all participants' inventories
|
|
550
611
|
```
|
|
551
612
|
|
|
552
613
|
#### `Actions.countItems(params)`
|
|
553
614
|
|
|
554
|
-
Count the number of a specific item in a target's inventory. Creates and returns a temporary variable with the count.
|
|
615
|
+
Count the number of a specific item in a target's inventory. Creates and returns a temporary variable with the count. This is the prefered way of counting items.
|
|
555
616
|
|
|
556
617
|
```typescript
|
|
557
618
|
Actions.countItems({
|
|
@@ -577,6 +638,39 @@ variables.my_diamond_count.set(count);
|
|
|
577
638
|
|
|
578
639
|
**Note:** This action creates a temporary variable internally using `Variable()` and uses `execute.store.result.score` with `clear` command (count 0) to count items without removing them from the inventory.
|
|
579
640
|
|
|
641
|
+
#### `Actions.getCurrentPlayerPosition()`
|
|
642
|
+
|
|
643
|
+
Get the current player's position as x, y, z Score variables. Must be called in a player context (e.g., inside `forEveryPlayer`, individual variables updaters, or when `@s` is a player). This is the prefered way of checking a player's position.
|
|
644
|
+
|
|
645
|
+
```typescript
|
|
646
|
+
Actions.getCurrentPlayerPosition(): { x: Score; y: Score; z: Score }
|
|
647
|
+
|
|
648
|
+
// Example - Check if player is above Y=100:
|
|
649
|
+
const pos = Actions.getCurrentPlayerPosition();
|
|
650
|
+
_.if(pos.y.greaterThan(100), () => {
|
|
651
|
+
Actions.announce({ message: "You reached the sky!" });
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
// Example - Store position in custom variables:
|
|
655
|
+
const { x, y, z } = Actions.getCurrentPlayerPosition();
|
|
656
|
+
variables.player_x.set(x);
|
|
657
|
+
variables.player_y.set(y);
|
|
658
|
+
variables.player_z.set(z);
|
|
659
|
+
|
|
660
|
+
// Example - Check if player is in a specific area:
|
|
661
|
+
const pos = Actions.getCurrentPlayerPosition();
|
|
662
|
+
_.if(_.and(
|
|
663
|
+
pos.x.greaterThan(0),
|
|
664
|
+
pos.x.lowerThan(100),
|
|
665
|
+
pos.z.greaterThan(0),
|
|
666
|
+
pos.z.lowerThan(100)
|
|
667
|
+
), () => {
|
|
668
|
+
Actions.announce({ message: "You're in the zone!" });
|
|
669
|
+
});
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
**Note:** This returns integer coordinates (block position). The values are truncated from the player's exact floating-point position.
|
|
673
|
+
|
|
580
674
|
### Entities
|
|
581
675
|
|
|
582
676
|
#### `Actions.summonMultiple(params)`
|
|
@@ -585,16 +679,22 @@ Summon multiple entities at location.
|
|
|
585
679
|
|
|
586
680
|
```typescript
|
|
587
681
|
Actions.summonMultiple({
|
|
588
|
-
entity: string;
|
|
589
|
-
count: number;
|
|
590
|
-
|
|
682
|
+
entity: string; // Entity ID (with "minecraft:" prefix)
|
|
683
|
+
count: number; // How many entities to summon
|
|
684
|
+
x: number; // X coordinate
|
|
685
|
+
y: number; // Y coordinate
|
|
686
|
+
z: number; // Z coordinate
|
|
687
|
+
absolute: boolean; // true for absolute coords, false for relative
|
|
591
688
|
});
|
|
592
689
|
|
|
593
690
|
// Example:
|
|
594
691
|
Actions.summonMultiple({
|
|
595
|
-
entity: "zombie",
|
|
692
|
+
entity: "minecraft:zombie",
|
|
596
693
|
count: 5,
|
|
597
|
-
|
|
694
|
+
x: 0,
|
|
695
|
+
y: 64,
|
|
696
|
+
z: 0,
|
|
697
|
+
absolute: true
|
|
598
698
|
});
|
|
599
699
|
```
|
|
600
700
|
|
|
@@ -604,10 +704,20 @@ Summon item entity at location.
|
|
|
604
704
|
|
|
605
705
|
```typescript
|
|
606
706
|
Actions.summonItem({
|
|
607
|
-
item: string;
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
707
|
+
item: string; // Item ID (with "minecraft:" prefix)
|
|
708
|
+
x: number; // X coordinate
|
|
709
|
+
y: number; // Y coordinate
|
|
710
|
+
z: number; // Z coordinate
|
|
711
|
+
absolute: boolean; // true for absolute coords, false for relative
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
// Example:
|
|
715
|
+
Actions.summonItem({
|
|
716
|
+
item: "minecraft:diamond",
|
|
717
|
+
x: 0,
|
|
718
|
+
y: 64,
|
|
719
|
+
z: 0,
|
|
720
|
+
absolute: true
|
|
611
721
|
});
|
|
612
722
|
```
|
|
613
723
|
|
|
@@ -617,29 +727,32 @@ Kill entities matching selector.
|
|
|
617
727
|
|
|
618
728
|
```typescript
|
|
619
729
|
Actions.kill({
|
|
620
|
-
|
|
730
|
+
selector: TargetNames; // "all", "self", or any selector
|
|
621
731
|
});
|
|
622
732
|
|
|
623
733
|
// Examples:
|
|
624
|
-
Actions.kill({
|
|
625
|
-
Actions.kill({
|
|
734
|
+
Actions.kill({ selector: Selector("@e", { type: "minecraft:zombie" }) });
|
|
735
|
+
Actions.kill({ selector: Selector("@e", { type: "!minecraft:player" }) });
|
|
736
|
+
Actions.kill({ selector: "all" }); // Kill all participants
|
|
626
737
|
```
|
|
627
738
|
|
|
628
739
|
#### `Actions.teleport(params)`
|
|
629
740
|
|
|
630
|
-
Teleport
|
|
741
|
+
Teleport entities to a location.
|
|
631
742
|
|
|
632
743
|
```typescript
|
|
633
744
|
Actions.teleport({
|
|
634
|
-
target:
|
|
635
|
-
|
|
745
|
+
target: TargetNames; // "all", "self", or any selector
|
|
746
|
+
x: number; // X coordinate
|
|
747
|
+
y: number; // Y coordinate
|
|
748
|
+
z: number; // Z coordinate
|
|
749
|
+
absolute: boolean; // true for absolute coords, false for relative
|
|
636
750
|
});
|
|
637
751
|
|
|
638
|
-
//
|
|
639
|
-
Actions.teleport({
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
});
|
|
752
|
+
// Examples:
|
|
753
|
+
Actions.teleport({ target: "self", x: 0, y: 100, z: 0, absolute: true });
|
|
754
|
+
Actions.teleport({ target: "all", x: 0, y: 64, z: 0, absolute: true });
|
|
755
|
+
Actions.teleport({ target: "self", x: 10, y: 0, z: 5, absolute: false }); // Relative position
|
|
643
756
|
```
|
|
644
757
|
|
|
645
758
|
### World
|
|
@@ -650,14 +763,20 @@ Set a single block.
|
|
|
650
763
|
|
|
651
764
|
```typescript
|
|
652
765
|
Actions.setBlock({
|
|
653
|
-
|
|
654
|
-
|
|
766
|
+
block: string; // Block ID (with "minecraft:" prefix)
|
|
767
|
+
x: number; // X coordinate
|
|
768
|
+
y: number; // Y coordinate
|
|
769
|
+
z: number; // Z coordinate
|
|
770
|
+
absolute: boolean; // true for absolute coords, false for relative
|
|
655
771
|
});
|
|
656
772
|
|
|
657
773
|
// Example:
|
|
658
774
|
Actions.setBlock({
|
|
659
|
-
|
|
660
|
-
|
|
775
|
+
block: "minecraft:diamond_block",
|
|
776
|
+
x: 0,
|
|
777
|
+
y: 64,
|
|
778
|
+
z: 0,
|
|
779
|
+
absolute: true
|
|
661
780
|
});
|
|
662
781
|
```
|
|
663
782
|
|
|
@@ -667,19 +786,33 @@ Fill region with blocks.
|
|
|
667
786
|
|
|
668
787
|
```typescript
|
|
669
788
|
Actions.fill({
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
789
|
+
block: string; // Block ID (with "minecraft:" prefix)
|
|
790
|
+
x1: number; // Start X coordinate
|
|
791
|
+
y1: number; // Start Y coordinate
|
|
792
|
+
z1: number; // Start Z coordinate
|
|
793
|
+
x2: number; // End X coordinate
|
|
794
|
+
y2: number; // End Y coordinate
|
|
795
|
+
z2: number; // End Z coordinate
|
|
796
|
+
absolute: boolean; // true for absolute coords, false for relative
|
|
797
|
+
mode: "fill" | "line" | "pyramid"; // Fill mode
|
|
674
798
|
});
|
|
675
799
|
|
|
676
|
-
//
|
|
800
|
+
// Examples:
|
|
677
801
|
Actions.fill({
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
802
|
+
block: "minecraft:stone",
|
|
803
|
+
x1: 0, y1: 64, z1: 0,
|
|
804
|
+
x2: 10, y2: 64, z2: 10,
|
|
805
|
+
absolute: true,
|
|
681
806
|
mode: "fill"
|
|
682
807
|
});
|
|
808
|
+
|
|
809
|
+
Actions.fill({
|
|
810
|
+
block: "minecraft:gold_block",
|
|
811
|
+
x1: 0, y1: 64, z1: 0,
|
|
812
|
+
x2: 0, y2: 10, z2: 0,
|
|
813
|
+
absolute: true,
|
|
814
|
+
mode: "pyramid" // Builds a pyramid
|
|
815
|
+
});
|
|
683
816
|
```
|
|
684
817
|
|
|
685
818
|
#### `Actions.setTime(params)`
|
|
@@ -721,19 +854,13 @@ Set score to value or copy from another score.
|
|
|
721
854
|
```typescript
|
|
722
855
|
// Set to number
|
|
723
856
|
Actions.set({
|
|
724
|
-
|
|
725
|
-
value: number;
|
|
726
|
-
});
|
|
727
|
-
|
|
728
|
-
// Copy from another score
|
|
729
|
-
Actions.set({
|
|
730
|
-
score: Score;
|
|
731
|
-
source: Score;
|
|
857
|
+
variable: Score;
|
|
858
|
+
value: number | Score;
|
|
732
859
|
});
|
|
733
860
|
|
|
734
861
|
// Examples:
|
|
735
|
-
Actions.set({
|
|
736
|
-
Actions.set({
|
|
862
|
+
Actions.set({ variable: variables.main_score, value: 0 });
|
|
863
|
+
Actions.set({ variable: variables.main_score, value: variables.diamonds });
|
|
737
864
|
```
|
|
738
865
|
|
|
739
866
|
#### `Actions.increment(params)`
|
|
@@ -742,8 +869,11 @@ Add 1 to score.
|
|
|
742
869
|
|
|
743
870
|
```typescript
|
|
744
871
|
Actions.increment({
|
|
745
|
-
|
|
872
|
+
variable: Score;
|
|
746
873
|
});
|
|
874
|
+
|
|
875
|
+
// Example:
|
|
876
|
+
Actions.increment({ variable: variables.counter });
|
|
747
877
|
```
|
|
748
878
|
|
|
749
879
|
#### `Actions.decrement(params)`
|
|
@@ -752,34 +882,38 @@ Subtract 1 from score.
|
|
|
752
882
|
|
|
753
883
|
```typescript
|
|
754
884
|
Actions.decrement({
|
|
755
|
-
|
|
885
|
+
variable: Score;
|
|
756
886
|
});
|
|
887
|
+
|
|
888
|
+
// Example:
|
|
889
|
+
Actions.decrement({ variable: variables.counter });
|
|
757
890
|
```
|
|
758
891
|
|
|
759
892
|
### Player Attributes
|
|
760
893
|
|
|
761
894
|
#### `Actions.setAttribute(params)`
|
|
762
895
|
|
|
763
|
-
Set entity attribute.
|
|
896
|
+
Set entity attribute for a target.
|
|
764
897
|
|
|
765
898
|
```typescript
|
|
766
899
|
Actions.setAttribute({
|
|
767
|
-
|
|
768
|
-
|
|
900
|
+
target: TargetNames; // "all", "self", or any selector
|
|
901
|
+
attribute_: string; // Attribute name
|
|
902
|
+
value: number; // Attribute value
|
|
769
903
|
});
|
|
770
904
|
|
|
771
905
|
// Examples:
|
|
772
|
-
Actions.setAttribute({
|
|
773
|
-
Actions.setAttribute({
|
|
774
|
-
Actions.setAttribute({
|
|
906
|
+
Actions.setAttribute({ target: "self", attribute_: "generic.max_health", value: 40 });
|
|
907
|
+
Actions.setAttribute({ target: "all", attribute_: "generic.movement_speed", value: 0.2 });
|
|
908
|
+
Actions.setAttribute({ target: "self", attribute_: "generic.attack_damage", value: 10 });
|
|
775
909
|
```
|
|
776
910
|
|
|
777
|
-
Common attributes:
|
|
778
|
-
- `"max_health"` - Maximum HP (default 20)
|
|
779
|
-
- `"movement_speed"` - Walk speed (default 0.1)
|
|
780
|
-
- `"attack_damage"` - Base attack damage
|
|
781
|
-
- `"armor"` - Armor points
|
|
782
|
-
- `"knockback_resistance"` - Knockback resistance (0-1)
|
|
911
|
+
Common attributes (with `generic.` prefix):
|
|
912
|
+
- `"generic.max_health"` - Maximum HP (default 20)
|
|
913
|
+
- `"generic.movement_speed"` - Walk speed (default 0.1)
|
|
914
|
+
- `"generic.attack_damage"` - Base attack damage
|
|
915
|
+
- `"generic.armor"` - Armor points
|
|
916
|
+
- `"generic.knockback_resistance"` - Knockback resistance (0-1)
|
|
783
917
|
|
|
784
918
|
|
|
785
919
|
### Logging
|
|
@@ -790,9 +924,16 @@ Log variable to watcher system (debugging).
|
|
|
790
924
|
|
|
791
925
|
```typescript
|
|
792
926
|
Actions.log_variable({
|
|
793
|
-
message: string;
|
|
794
|
-
variable: Score;
|
|
795
|
-
store:
|
|
927
|
+
message: string; // Log message
|
|
928
|
+
variable: Score; // Variable to log
|
|
929
|
+
store: boolean; // Whether to store in backend
|
|
930
|
+
});
|
|
931
|
+
|
|
932
|
+
// Example:
|
|
933
|
+
Actions.log_variable({
|
|
934
|
+
message: "Player score",
|
|
935
|
+
variable: variables.main_score,
|
|
936
|
+
store: true
|
|
796
937
|
});
|
|
797
938
|
```
|
|
798
939
|
|
|
@@ -810,9 +951,15 @@ import { forEveryPlayer } from "@kradle/challenges";
|
|
|
810
951
|
forEveryPlayer(() => {
|
|
811
952
|
// Runs as(@s) at(@s) for each participant
|
|
812
953
|
// @s is the current player
|
|
954
|
+
// All individual variables reference the current player within this context
|
|
813
955
|
});
|
|
814
956
|
```
|
|
815
957
|
|
|
958
|
+
**Important Notes:**
|
|
959
|
+
- Individual variables automatically reference the current player (`@s`) within the loop
|
|
960
|
+
- Global variables remain global and are the same across all iterations
|
|
961
|
+
- Each iteration executes at the player's position (`at(@s)`)
|
|
962
|
+
|
|
816
963
|
**Example - Find maximum score:**
|
|
817
964
|
```typescript
|
|
818
965
|
max_score: {
|
|
@@ -820,6 +967,7 @@ max_score: {
|
|
|
820
967
|
updater: (value, { main_score }) => {
|
|
821
968
|
value.set(0);
|
|
822
969
|
forEveryPlayer(() => {
|
|
970
|
+
// main_score here refers to the current player's main_score
|
|
823
971
|
_.if(main_score.greaterThan(value), () => {
|
|
824
972
|
value.set(main_score);
|
|
825
973
|
});
|
|
@@ -957,7 +1105,7 @@ createChallenge({
|
|
|
957
1105
|
Actions.announce({ message: "First to kill 2 pigs wins!" });
|
|
958
1106
|
},
|
|
959
1107
|
init_participants: () => {
|
|
960
|
-
Actions.give({ item: "minecraft:iron_sword", count: 1 });
|
|
1108
|
+
Actions.give({ target: "all", item: "minecraft:iron_sword", count: 1 });
|
|
961
1109
|
},
|
|
962
1110
|
}))
|
|
963
1111
|
.custom_events(({ pigs_farmed }) => [
|
|
@@ -992,7 +1140,7 @@ createChallenge({
|
|
|
992
1140
|
type: "individual",
|
|
993
1141
|
objective_type: "dummy",
|
|
994
1142
|
updater: (value) => {
|
|
995
|
-
|
|
1143
|
+
value.set(Actions.getCurrentPlayerPosition().y)
|
|
996
1144
|
},
|
|
997
1145
|
},
|
|
998
1146
|
max_height: {
|
|
@@ -1036,8 +1184,8 @@ createChallenge({
|
|
|
1036
1184
|
Actions.announce({ message: "Climb as high as you can!" });
|
|
1037
1185
|
},
|
|
1038
1186
|
init_participants: () => {
|
|
1039
|
-
Actions.give({ item: "minecraft:cobblestone", count: 64 });
|
|
1040
|
-
Actions.give({ item: "minecraft:cobblestone", count: 64 });
|
|
1187
|
+
Actions.give({ target: "all", item: "minecraft:cobblestone", count: 64 });
|
|
1188
|
+
Actions.give({ target: "all", item: "minecraft:cobblestone", count: 64 });
|
|
1041
1189
|
},
|
|
1042
1190
|
}))
|
|
1043
1191
|
.custom_events(() => [])
|
|
@@ -1088,9 +1236,9 @@ createChallenge({
|
|
|
1088
1236
|
Actions.announce({ message: "Last player standing wins!" });
|
|
1089
1237
|
},
|
|
1090
1238
|
init_participants: () => {
|
|
1091
|
-
Actions.give({ item: "minecraft:stone_sword", count: 1 });
|
|
1092
|
-
Actions.give({ item: "minecraft:leather_chestplate", count: 1 });
|
|
1093
|
-
Actions.give({ item: "minecraft:cooked_beef", count: 10 });
|
|
1239
|
+
Actions.give({ target: "all", item: "minecraft:stone_sword", count: 1 });
|
|
1240
|
+
Actions.give({ target: "all", item: "minecraft:leather_chestplate", count: 1 });
|
|
1241
|
+
Actions.give({ target: "all", item: "minecraft:cooked_beef", count: 10 });
|
|
1094
1242
|
},
|
|
1095
1243
|
}))
|
|
1096
1244
|
.custom_events(({ kills }) => [
|
|
@@ -1149,7 +1297,7 @@ createChallenge({
|
|
|
1149
1297
|
},
|
|
1150
1298
|
init_participants: () => {
|
|
1151
1299
|
// Different items based on role would be set via role-specific logic
|
|
1152
|
-
Actions.give({ item: "minecraft:wooden_sword", count: 1 });
|
|
1300
|
+
Actions.give({ target: "all", item: "minecraft:wooden_sword", count: 1 });
|
|
1153
1301
|
},
|
|
1154
1302
|
}))
|
|
1155
1303
|
.custom_events(() => [])
|
|
@@ -1213,7 +1361,7 @@ createChallenge({
|
|
|
1213
1361
|
Actions.announce({ message: "Capture the enemy flag and return to base!" });
|
|
1214
1362
|
},
|
|
1215
1363
|
init_participants: () => {
|
|
1216
|
-
Actions.give({ item: "minecraft:iron_sword", count: 1 });
|
|
1364
|
+
Actions.give({ target: "all", item: "minecraft:iron_sword", count: 1 });
|
|
1217
1365
|
},
|
|
1218
1366
|
}))
|
|
1219
1367
|
.custom_events(({ captured_flag }) => [
|
|
@@ -1290,6 +1438,10 @@ current_y: {
|
|
|
1290
1438
|
type: "individual",
|
|
1291
1439
|
objective_type: "dummy",
|
|
1292
1440
|
updater: (value) => {
|
|
1441
|
+
// Prefered way: using the dedicated Action
|
|
1442
|
+
value.set(Actions.getCurrentPlayerPosition().y)
|
|
1443
|
+
|
|
1444
|
+
// Alternative way: using execute.store + data.get
|
|
1293
1445
|
execute.as("@s").store.result.score(value).run.data.get.entity("@s", "Pos[1]");
|
|
1294
1446
|
},
|
|
1295
1447
|
}
|
package/README.md
CHANGED
|
@@ -22,46 +22,6 @@ Like for installation, we strongly recommend using Kradle's CLI to bootstrap a c
|
|
|
22
22
|
kradle challenge create my-challenge
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
```typescript
|
|
26
|
-
import { createChallenge, Actions } from "@kradle/challenges";
|
|
27
|
-
|
|
28
|
-
createChallenge({
|
|
29
|
-
name: "my-challenge",
|
|
30
|
-
kradle_challenge_path: "./output",
|
|
31
|
-
roles: ["player"] as const,
|
|
32
|
-
GAME_DURATION: 2 * 60 * 20, // 2 minutes in ticks
|
|
33
|
-
custom_variables: {
|
|
34
|
-
diamonds_collected: {
|
|
35
|
-
type: "individual",
|
|
36
|
-
objective_type: "minecraft.picked_up:minecraft.diamond",
|
|
37
|
-
default: 0,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
})
|
|
41
|
-
.events(({ diamonds_collected }) => ({
|
|
42
|
-
start_challenge: () => {
|
|
43
|
-
Actions.setTime({ time: "day" });
|
|
44
|
-
Actions.announce({ message: "Collect as many diamonds as possible!" });
|
|
45
|
-
},
|
|
46
|
-
init_participants: () => {
|
|
47
|
-
Actions.give({ item: "iron_pickaxe", count: 1 });
|
|
48
|
-
},
|
|
49
|
-
}))
|
|
50
|
-
.custom_events(({ diamonds_collected }) => [
|
|
51
|
-
{
|
|
52
|
-
score: diamonds_collected,
|
|
53
|
-
target: 10,
|
|
54
|
-
mode: "fire_once",
|
|
55
|
-
actions: () => {
|
|
56
|
-
Actions.announce({ message: "Someone collected 10 diamonds!" });
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
])
|
|
60
|
-
.end_condition(({ game_timer }) => game_timer.greaterThan(2 * 60 * 20))
|
|
61
|
-
.win_conditions(({ diamonds_collected }, { player }) => ({
|
|
62
|
-
[player]: diamonds_collected.greaterThan(0),
|
|
63
|
-
}));
|
|
64
|
-
```
|
|
65
25
|
|
|
66
26
|
## API Overview
|
|
67
27
|
|
|
@@ -131,7 +91,7 @@ current_height: {
|
|
|
131
91
|
type: "individual",
|
|
132
92
|
objective_type: "dummy",
|
|
133
93
|
updater: (value) => {
|
|
134
|
-
|
|
94
|
+
value.set(Actions.getPlayerPosition().y)
|
|
135
95
|
},
|
|
136
96
|
}
|
|
137
97
|
```
|
|
@@ -176,6 +136,8 @@ If you track a Minecraft objective, you do not need an updater!
|
|
|
176
136
|
|
|
177
137
|
### Lifecycle Events
|
|
178
138
|
|
|
139
|
+
Lifecycle events are triggered once on specific occasions.
|
|
140
|
+
|
|
179
141
|
```typescript
|
|
180
142
|
.events((variables, roles) => ({
|
|
181
143
|
start_challenge: () => {
|
|
@@ -185,13 +147,13 @@ If you track a Minecraft objective, you do not need an updater!
|
|
|
185
147
|
},
|
|
186
148
|
|
|
187
149
|
init_participants: () => {
|
|
188
|
-
// Runs
|
|
189
|
-
Actions.give({ item: "diamond_sword", count: 1 });
|
|
190
|
-
Actions.setAttribute({
|
|
150
|
+
// Runs 1s after the challenge starts
|
|
151
|
+
Actions.give({ target: "all", item: "minecraft:diamond_sword", count: 1 });
|
|
152
|
+
Actions.setAttribute({ target: "all", attribute_: "generic.max_health", value: 40 });
|
|
191
153
|
},
|
|
192
154
|
|
|
193
155
|
on_tick: () => {
|
|
194
|
-
// Runs every tick
|
|
156
|
+
// Runs once every tick
|
|
195
157
|
},
|
|
196
158
|
|
|
197
159
|
end_challenge: () => {
|
|
@@ -207,14 +169,16 @@ Custom events trigger actions based on score thresholds or Minecraft advancement
|
|
|
207
169
|
|
|
208
170
|
#### Score-based events
|
|
209
171
|
|
|
210
|
-
Score events watch a variable and trigger when it reaches a target value.
|
|
172
|
+
Score events watch a variable and trigger when it reaches a target value.
|
|
211
173
|
|
|
212
|
-
- **`score`**: The variable to watch
|
|
174
|
+
- **`score`**: The variable to watch.
|
|
213
175
|
- **`target`** (optional): The target value. If omitted, triggers on any score change
|
|
214
176
|
- **`mode`**:
|
|
215
177
|
- `"fire_once"`: Triggers once when the score reaches the target (per player for individual variables)
|
|
216
178
|
- `"repeatable"`: Triggers every tick while the score is at target
|
|
217
179
|
|
|
180
|
+
For individual variables, events fire per-player; for global variables, events fire globally.
|
|
181
|
+
|
|
218
182
|
```typescript
|
|
219
183
|
.custom_events((variables, roles) => [
|
|
220
184
|
{
|
|
@@ -234,6 +198,8 @@ If `target` is omitted, the event triggers whenever the score changes (useful fo
|
|
|
234
198
|
|
|
235
199
|
Advancement events trigger when a Minecraft advancement criterion is met (e.g., player attacks, item picked up). The criteria follow the [Minecraft Advancement JSON format](https://minecraft.fandom.com/wiki/Advancement/JSON_format).
|
|
236
200
|
|
|
201
|
+
Advancement-based events always fire per-player.
|
|
202
|
+
|
|
237
203
|
- **`criteria`**: Array of advancement triggers with optional conditions
|
|
238
204
|
- **`mode`**:
|
|
239
205
|
- `"fire_once"`: Triggers once per player when the advancement is granted
|
|
@@ -252,7 +218,7 @@ Advancement events trigger when a Minecraft advancement criterion is met (e.g.,
|
|
|
252
218
|
],
|
|
253
219
|
mode: "repeatable",
|
|
254
220
|
actions: () => {
|
|
255
|
-
Actions.increment({
|
|
221
|
+
Actions.increment({ variable: variables.pvp_hits });
|
|
256
222
|
},
|
|
257
223
|
},
|
|
258
224
|
])
|
|
@@ -291,41 +257,66 @@ Define how winners are determined per role:
|
|
|
291
257
|
|
|
292
258
|
## Actions
|
|
293
259
|
|
|
294
|
-
|
|
260
|
+
Actions are higher-level functions that wrap common Minecraft operations, designed to work seamlessly with Kradle's challenge system. They handle target mapping, formatting, and integration with Kradle's interface automatically.
|
|
261
|
+
|
|
262
|
+
For more advanced use cases, you can always fall back to Sandstone's lower-level functions directly (e.g., `give`, `tellraw`, `effect`, `kill`, `execute`). See the [Sandstone Integration](#sandstone-integration) section below.
|
|
295
263
|
|
|
296
264
|
### Communication
|
|
297
265
|
```typescript
|
|
266
|
+
// Simple string message
|
|
298
267
|
Actions.announce({ message: "Hello everyone!" });
|
|
299
|
-
|
|
268
|
+
|
|
269
|
+
// Formatted JSONTextComponent message
|
|
270
|
+
Actions.announce({
|
|
271
|
+
message: [
|
|
272
|
+
{ text: "Player ", color: "white" },
|
|
273
|
+
{ selector: "@s", color: "gold", bold: true },
|
|
274
|
+
{ text: " scored!", color: "green" }
|
|
275
|
+
]
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// Send to specific target (only visible in-game, not in Kradle's interface)
|
|
279
|
+
Actions.tellraw({ target: "all", message: ["Hello ", { text: "world", color: "gold" }] });
|
|
280
|
+
Actions.tellraw({ target: "self", message: { text: "You win!", color: "green", bold: true } });
|
|
300
281
|
```
|
|
301
282
|
|
|
302
283
|
### Items & Inventory
|
|
303
284
|
```typescript
|
|
304
|
-
Actions.give({ item: "diamond_sword", count: 1 });
|
|
305
|
-
Actions.
|
|
306
|
-
|
|
307
|
-
|
|
285
|
+
Actions.give({ target: "self", item: "minecraft:diamond_sword", count: 1 });
|
|
286
|
+
Actions.giveLoot({
|
|
287
|
+
target: "self",
|
|
288
|
+
items: [
|
|
289
|
+
{ name: "minecraft:diamond", count: 5, weight: 1 },
|
|
290
|
+
{ name: "minecraft:iron_ingot", count: 10, weight: 3 }
|
|
291
|
+
]
|
|
292
|
+
});
|
|
293
|
+
Actions.clear({ target: "self" });
|
|
308
294
|
|
|
309
295
|
// Count items - returns a Score variable
|
|
310
296
|
const count = Actions.countItems({ target: "self", item: "minecraft:diamond" });
|
|
311
297
|
// Use in conditions or set to custom variables
|
|
312
298
|
_.if(count.greaterThan(5), () => { /* ... */ });
|
|
299
|
+
|
|
300
|
+
// Get player position - returns { x, y, z } Score variables
|
|
301
|
+
const pos = Actions.getCurrentPlayerPosition();
|
|
302
|
+
_.if(pos.y.greaterThan(100), () => { /* player is high up */ });
|
|
313
303
|
```
|
|
314
304
|
|
|
315
305
|
### Entities
|
|
316
306
|
```typescript
|
|
317
|
-
Actions.summonMultiple({ entity: "zombie", count: 5,
|
|
318
|
-
Actions.kill({
|
|
319
|
-
Actions.teleport({ target: "
|
|
307
|
+
Actions.summonMultiple({ entity: "minecraft:zombie", count: 5, x: 0, y: 64, z: 0, absolute: true });
|
|
308
|
+
Actions.kill({ selector: Selector("@e", { type: "minecraft:zombie" }) });
|
|
309
|
+
Actions.teleport({ target: "self", x: 0, y: 100, z: 0, absolute: true });
|
|
320
310
|
```
|
|
321
311
|
|
|
322
312
|
### World
|
|
323
313
|
```typescript
|
|
324
|
-
Actions.setBlock({
|
|
314
|
+
Actions.setBlock({ block: "minecraft:diamond_block", x: 0, y: 64, z: 0, absolute: true });
|
|
325
315
|
Actions.fill({
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
316
|
+
block: "minecraft:stone",
|
|
317
|
+
x1: 0, y1: 64, z1: 0,
|
|
318
|
+
x2: 10, y2: 64, z2: 10,
|
|
319
|
+
absolute: true,
|
|
329
320
|
mode: "fill" // "fill", "line", or "pyramid"
|
|
330
321
|
});
|
|
331
322
|
Actions.setTime({ time: "day" }); // or "night" or specific tick value
|
|
@@ -334,24 +325,24 @@ Actions.gamerule({ rule: "doDaylightCycle", value: false });
|
|
|
334
325
|
|
|
335
326
|
### Scores
|
|
336
327
|
```typescript
|
|
337
|
-
Actions.set({
|
|
338
|
-
Actions.set({
|
|
339
|
-
Actions.increment({
|
|
340
|
-
Actions.decrement({
|
|
328
|
+
Actions.set({ variable: variables.main_score, value: 10 });
|
|
329
|
+
Actions.set({ variable: variables.main_score, value: variables.diamonds });
|
|
330
|
+
Actions.increment({ variable: variables.counter });
|
|
331
|
+
Actions.decrement({ variable: variables.counter });
|
|
341
332
|
```
|
|
342
333
|
|
|
343
334
|
### Player Attributes
|
|
344
335
|
```typescript
|
|
345
|
-
Actions.setAttribute({
|
|
346
|
-
Actions.setAttribute({
|
|
336
|
+
Actions.setAttribute({ target: "self", attribute_: "generic.max_health", value: 40 });
|
|
337
|
+
Actions.setAttribute({ target: "self", attribute_: "generic.movement_speed", value: 0.2 });
|
|
347
338
|
```
|
|
348
339
|
|
|
349
340
|
### Custom Commands
|
|
350
341
|
```typescript
|
|
351
|
-
Actions.custom(
|
|
342
|
+
Actions.custom(() => {
|
|
352
343
|
// Any Sandstone code here
|
|
353
344
|
execute.as("@a").run.effect.give("@s", "speed", 10, 1);
|
|
354
|
-
}
|
|
345
|
+
});
|
|
355
346
|
```
|
|
356
347
|
|
|
357
348
|
## Utilities
|
|
@@ -406,8 +397,8 @@ createChallenge({
|
|
|
406
397
|
Actions.announce({ message: "Last player standing wins!" });
|
|
407
398
|
},
|
|
408
399
|
init_participants: () => {
|
|
409
|
-
Actions.give({ item: "stone_sword", count: 1 });
|
|
410
|
-
Actions.give({ item: "leather_chestplate", count: 1 });
|
|
400
|
+
Actions.give({ target: "all", item: "minecraft:stone_sword", count: 1 });
|
|
401
|
+
Actions.give({ target: "all", item: "minecraft:leather_chestplate", count: 1 });
|
|
411
402
|
},
|
|
412
403
|
}))
|
|
413
404
|
.custom_events(({ kills }) => [
|
package/dist/actions.d.ts
CHANGED
|
@@ -149,11 +149,11 @@ export declare const Actions: {
|
|
|
149
149
|
}) => void;
|
|
150
150
|
/**
|
|
151
151
|
* Send a chat message to a target.
|
|
152
|
-
* @param {
|
|
152
|
+
* @param {JSONTextComponent} message - The message to send.
|
|
153
153
|
* @param {TargetNames} target - The target to send the message to.
|
|
154
154
|
*/
|
|
155
155
|
tellraw: ({ message, target }: {
|
|
156
|
-
message:
|
|
156
|
+
message: JSONTextComponent;
|
|
157
157
|
target: TargetNames;
|
|
158
158
|
}) => void;
|
|
159
159
|
/**
|
|
@@ -216,5 +216,15 @@ export declare const Actions: {
|
|
|
216
216
|
target: TargetNames;
|
|
217
217
|
item: ITEMS;
|
|
218
218
|
}) => Score<string | undefined>;
|
|
219
|
+
/**
|
|
220
|
+
* Get the current player's position as x, y, z Score variables.
|
|
221
|
+
* Must be called in a player context (e.g., inside forEveryPlayer or when @s is a player).
|
|
222
|
+
* @returns An object with x, y, z Score variables containing the player's coordinates.
|
|
223
|
+
*/
|
|
224
|
+
getCurrentPlayerPosition: () => {
|
|
225
|
+
x: Score<string | undefined>;
|
|
226
|
+
y: Score<string | undefined>;
|
|
227
|
+
z: Score<string | undefined>;
|
|
228
|
+
};
|
|
219
229
|
};
|
|
220
230
|
//# sourceMapping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A;KAAE;IAKlF;;;OAGG;8BACuB;QAAE,QAAQ,EAAE,KAAK,CAAA;KAAE;IAI7C;;;OAGG;8BACuB;QAAE,QAAQ,EAAE,KAAK,CAAA;KAAE;IAI7C;;;;OAIG;+BACwB;QAAE,QAAQ,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAA;KAAE;IAIrE;;;;;OAKG;iDAE0C;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE;IAIjG;;;;;;;OAOG;8CACuC;QAAE,IAAI,EAAE,KAAK,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE;IAK7G;;;;;;OAMG;mCAC4B;QAAE,MAAM,EAAE,WAAW,CAAC;QAAC,IAAI,EAAE,KAAK,CAAA;KAAE;IAMnE;;;;OAIG;;;;;;CAU+C,CAAC"}
|
package/dist/actions.js
CHANGED
|
@@ -221,7 +221,7 @@ exports.Actions = {
|
|
|
221
221
|
},
|
|
222
222
|
/**
|
|
223
223
|
* Send a chat message to a target.
|
|
224
|
-
* @param {
|
|
224
|
+
* @param {JSONTextComponent} message - The message to send.
|
|
225
225
|
* @param {TargetNames} target - The target to send the message to.
|
|
226
226
|
*/
|
|
227
227
|
tellraw: ({ message, target }) => {
|
|
@@ -284,5 +284,19 @@ exports.Actions = {
|
|
|
284
284
|
sandstone_1.execute.store.result.score(variable).run.clear(mapTarget(target), item, 0);
|
|
285
285
|
return variable;
|
|
286
286
|
},
|
|
287
|
+
/**
|
|
288
|
+
* Get the current player's position as x, y, z Score variables.
|
|
289
|
+
* Must be called in a player context (e.g., inside forEveryPlayer or when @s is a player).
|
|
290
|
+
* @returns An object with x, y, z Score variables containing the player's coordinates.
|
|
291
|
+
*/
|
|
292
|
+
getCurrentPlayerPosition: () => {
|
|
293
|
+
const x = (0, sandstone_1.Variable)();
|
|
294
|
+
const y = (0, sandstone_1.Variable)();
|
|
295
|
+
const z = (0, sandstone_1.Variable)();
|
|
296
|
+
sandstone_1.execute.store.result.score(x).run.data.get.entity("@s", "Pos[0]");
|
|
297
|
+
sandstone_1.execute.store.result.score(y).run.data.get.entity("@s", "Pos[1]");
|
|
298
|
+
sandstone_1.execute.store.result.score(z).run.data.get.entity("@s", "Pos[2]");
|
|
299
|
+
return { x, y, z };
|
|
300
|
+
},
|
|
287
301
|
};
|
|
288
302
|
//# sourceMappingURL=actions.js.map
|
package/dist/actions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":";;;;;;AAqCA,8BAkBC;AAvDD,8DAAiC;AACjC,yCA2BmB;AAEnB,yCAAsC;AACtC,2CAA8E;AAM9E,SAAgB,SAAS,CAAC,MAA8B;IACvD,QAAQ,MAAM,EAAE,CAAC;QAChB,KAAK,KAAK;YACT,OAAO,eAAG,CAAC;QACZ,KAAK,MAAM;YACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,MAAM,YAAY,yBAAa,EAAE,CAAC;QACrC,OAAO,MAAM,CAAC;IACf,CAAC;IAED,6CAA6C;IAC7C,IAAI,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACrC,OAAO,IAAA,oBAAQ,EAAC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,IAAA,oBAAQ,EAAC,IAAI,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,qCAAqC;AAC9E,CAAC;AAEY,QAAA,OAAO,GAAG;IACtB;;;OAGG;IACH,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAkC,EAAE,EAAE;QACzD,IAAA,mBAAO,EAAC,IAAI,EAA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target.
|
|
322
|
-
* @param {
|
|
322
|
+
* @param {JSONTextComponent} message - The message to send.
|
|
323
323
|
* @param {TargetNames} target - The target to send the message to.
|
|
324
324
|
*/
|
|
325
|
-
tellraw: ({ message, target }: { message:
|
|
325
|
+
tellraw: ({ message, target }: { message: JSONTextComponent; target: TargetNames }) => {
|
|
326
326
|
tellraw(mapTarget(target), message);
|
|
327
327
|
},
|
|
328
328
|
|
|
@@ -388,4 +388,19 @@ export const Actions = {
|
|
|
388
388
|
execute.store.result.score(variable).run.clear(mapTarget(target), item, 0);
|
|
389
389
|
return variable;
|
|
390
390
|
},
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Get the current player's position as x, y, z Score variables.
|
|
394
|
+
* Must be called in a player context (e.g., inside forEveryPlayer or when @s is a player).
|
|
395
|
+
* @returns An object with x, y, z Score variables containing the player's coordinates.
|
|
396
|
+
*/
|
|
397
|
+
getCurrentPlayerPosition: () => {
|
|
398
|
+
const x = Variable();
|
|
399
|
+
const y = Variable();
|
|
400
|
+
const z = Variable();
|
|
401
|
+
execute.store.result.score(x).run.data.get.entity("@s", "Pos[0]");
|
|
402
|
+
execute.store.result.score(y).run.data.get.entity("@s", "Pos[1]");
|
|
403
|
+
execute.store.result.score(z).run.data.get.entity("@s", "Pos[2]");
|
|
404
|
+
return { x, y, z };
|
|
405
|
+
},
|
|
391
406
|
} satisfies Record<string, (...args: any[]) => any>;
|