@kradle/challenges 0.1.0 → 0.2.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/AGENTS.md +273 -0
- package/CLAUDE.md +1 -0
- package/LLM_README.md +1380 -0
- package/README.md +498 -1
- package/dist/actions.d.ts +11 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +12 -0
- package/dist/actions.js.map +1 -1
- package/dist/challenge.js +1 -1
- package/dist/challenge.js.map +1 -1
- package/package.json +1 -1
- package/src/actions.ts +15 -1
- package/src/challenge.ts +1 -1
package/src/actions.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
tellraw,
|
|
26
26
|
time as timeCmd,
|
|
27
27
|
data,
|
|
28
|
+
Variable,
|
|
28
29
|
} from "sandstone";
|
|
29
30
|
import type { ATTRIBUTES, BLOCKS, ENTITY_TYPES, ITEMS } from "sandstone/arguments/generated";
|
|
30
31
|
import { Commands } from "./commands";
|
|
@@ -374,4 +375,17 @@ export const Actions = {
|
|
|
374
375
|
const abs = absolute ? "" : "~";
|
|
375
376
|
raw(`summon item ${abs}${x} ${abs}${y} ${abs}${z} {Item:{id:"${item}",Count:1b}}`);
|
|
376
377
|
},
|
|
377
|
-
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Count the number of a specific item in a target's inventory.
|
|
381
|
+
* @param params - The parameters object.
|
|
382
|
+
* @param params.target - The target to count items for.
|
|
383
|
+
* @param params.item - The item to count.
|
|
384
|
+
* @returns The variable containing the item count.
|
|
385
|
+
*/
|
|
386
|
+
countItems: ({ target, item }: { target: TargetNames; item: ITEMS }) => {
|
|
387
|
+
const variable = Variable();
|
|
388
|
+
execute.store.result.score(variable).run.clear(mapTarget(target), item, 0);
|
|
389
|
+
return variable;
|
|
390
|
+
},
|
|
391
|
+
} satisfies Record<string, (...args: any[]) => any>;
|
package/src/challenge.ts
CHANGED
|
@@ -267,7 +267,7 @@ export class ChallengeBase<const ROLES_NAMES extends string, const VARIABLE_NAME
|
|
|
267
267
|
const advancementsAsScoreCustomEvents: _InputScoreCustomEventType[] = inputCustomEvents
|
|
268
268
|
.filter(isAdvancementCustomEvent)
|
|
269
269
|
.map((event, index) => {
|
|
270
|
-
const trigger = (event.criteria?.[0].trigger ?? "").split("minecraft:").at(-1)
|
|
270
|
+
const trigger = (event.criteria?.[0].trigger ?? "").split("minecraft:").at(-1)?.replace(/[:/]/g, "_");
|
|
271
271
|
const name = `adv_${trigger}__${index}`;
|
|
272
272
|
const score = getOrCreateObjective(getUniqueObjectiveName(name), "dummy")("@s");
|
|
273
273
|
|