Skip to content

Commit eb39de6

Browse files
committed
📦 More progress on challenge types and predicates
1 parent c2efa9a commit eb39de6

File tree

4 files changed

+320
-16
lines changed

4 files changed

+320
-16
lines changed

docs/custom-backpack/setting-the-challenge.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/custom-backpack/setting-the-unlock-challenge/challenge-types.mdx

Lines changed: 182 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
Backpacked comes with many built-in challenge types
44

5-
## Breed Animals
5+
## List of Challenges
6+
7+
### Breed Animals
68

79
**ID:** `backpacked:breed_animal`
810

@@ -59,7 +61,7 @@ Backpacked comes with many built-in challenge types
5961

6062

6163

62-
## Craft Item
64+
### Craft Item
6365

6466
**ID:** `backpacked:craft_item`
6567

@@ -93,7 +95,7 @@ Backpacked comes with many built-in challenge types
9395
</div>
9496

9597

96-
## Explore Biome
98+
### Explore Biome
9799

98100
**ID:** `backpacked:explore_biome`
99101

@@ -147,7 +149,7 @@ Backpacked comes with many built-in challenge types
147149
```
148150
</div>
149151

150-
## Feed Animal
152+
### Feed Animal
151153

152154
**ID:** `backpacked:feed_animal`
153155

@@ -183,7 +185,7 @@ Backpacked comes with many built-in challenge types
183185
```
184186
</div>
185187

186-
## Interact with Block
188+
### Interact with Block
187189

188190
**ID:** `backpacked:interact_with_block`
189191

@@ -242,7 +244,7 @@ Backpacked comes with many built-in challenge types
242244
}
243245
}
244246
```
245-
**Notes:** No item is checked as the interaction only triggers when a valid item can be placed on the campfire, however you could check for a specific item using the `item` predicate.
247+
**Notes:** No item is checked as the interaction only triggers when a valid item can be placed on the campfire, however you could check for a specific item using the `item` predicate. Also check the lit state to ensure there is a fire, and it has not been put out with water.
246248

247249
</div>
248250

@@ -293,4 +295,177 @@ Backpacked comes with many built-in challenge types
293295
}
294296
}
295297
```
296-
</div>
298+
</div>
299+
300+
### Interact with Entity
301+
302+
**ID:** `backpacked:interact_with_entity`
303+
304+
**Description:** A challenge that requires the player to interact with an entity
305+
306+
| Key | Type | Required | Default | Description |
307+
| -------- | ------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
308+
| `entity` | Object | No || An optional entity predicate to test the interacted entity. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/entity) for more details. |
309+
| `item` | Object | No || An optional item predicate to test the held item of the player interacting with the entity. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/item) for more details. |
310+
| `player` | Object | No || An optional entity predicate for the player. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/entity) for more details. |
311+
| `count` | Integer | No | 1 | The amount of times to perform the action |
312+
313+
#### Examples
314+
<div class="code-block">
315+
**Start a trade with a Wandering Trader to unlock this backpack**
316+
317+
```json title="data/<namespace>/backpacked/<your_backpack>.json"
318+
{
319+
"unlock_challenge": {
320+
"formatter": "backpacked:completed_x_of_x",
321+
"challenge": {
322+
"type": "backpacked:interact_with_entity",
323+
"entity": {
324+
"type": "minecraft:wandering_trader"
325+
}
326+
}
327+
}
328+
}
329+
```
330+
</div>
331+
332+
### Kill Mob
333+
334+
**ID:** `backpacked:kill_mob`
335+
336+
**Description:** A challenge that requires the player to kill one or more mobs
337+
338+
| Key | Type | Required | Default | Description |
339+
| -------- | ------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
340+
| `mob` | Object | No || An optional entity predicate to test against the killed mob. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/entity) for more details. |
341+
| `item` | Object | No || An optional item predicate to test the item used when the player killed the `mob`. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/item) for more details. |
342+
| `player` | Object | No || An optional entity predicate for the player. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/entity) for more details. |
343+
| `count` | Integer | No | 1 | The amount of times the player has to kill the `mob` |
344+
345+
#### Examples
346+
<div class="code-block">
347+
**Battle and kill ten zombies, skeletons, creepers, or spiders using a diamond sword while underground in the overworld to unlock this backpack**
348+
349+
```json title="data/<namespace>/backpacked/<your_backpack>.json"
350+
{
351+
"unlock_challenge": {
352+
"formatter": "backpacked:completed_x_of_x",
353+
"challenge": {
354+
"type": "backpacked:kill_mob",
355+
"mob": {
356+
"type": [
357+
"minecraft:zombie",
358+
"minecraft:skeleton",
359+
"minecraft:creeper",
360+
"minecraft:spider"
361+
]
362+
},
363+
"item": {
364+
"items": [
365+
"minecraft:diamond_sword"
366+
]
367+
},
368+
"player": {
369+
"location": {
370+
"dimension": "minecraft:overworld",
371+
"position": {
372+
"y": {
373+
"max": 63,
374+
"min": -64
375+
}
376+
}
377+
}
378+
},
379+
"count": 10
380+
}
381+
}
382+
}
383+
```
384+
</div>
385+
386+
### Merchant Trade
387+
388+
**ID:** `backpacked:merchant_trade`
389+
390+
**Description:** A challenge that requires the player to trade with a merchant type entity. Supports Villagers, Wandering Traders, and even modded NPCs like Goblin Traders.
391+
392+
| Key | Type | Required | Default | Description |
393+
| ---------- | ------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
394+
| `merchant` | Object | No || An optional entity predicate to test against the merchant. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/entity) for more details. |
395+
| `item` | Object | No || An optional item predicate to test the item that was received by the player in the trade. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/item) for more details. |
396+
| `count` | Integer | No | 1 | The amount of trades. Each transaction is consider one trade. |
397+
398+
#### Examples
399+
<div class="code-block">
400+
**Get scammed by Wandering Trader (aka make any trade with them) to unlock this backpack**
401+
402+
```json title="data/<namespace>/backpacked/<your_backpack>.json"
403+
{
404+
"unlock_challenge": {
405+
"formatter": "backpacked:incomplete_complete",
406+
"challenge": {
407+
"type": "backpacked:merchant_trade",
408+
"merchant": {
409+
"type": "minecraft:wandering_trader"
410+
}
411+
}
412+
}
413+
}
414+
```
415+
</div>
416+
417+
<div class="code-block">
418+
**Recieve iron ingots from a Goblin Trader five times to unlock this backpack**
419+
420+
```json title="data/<namespace>/backpacked/<your_backpack>.json"
421+
{
422+
"unlock_challenge": {
423+
"formatter": "backpacked:completed_x_of_x",
424+
"challenge": {
425+
"type": "backpacked:merchant_trade",
426+
"merchant": {
427+
"type": "goblintraders:goblin_trader"
428+
},
429+
"item": {
430+
"items": [
431+
"minecraft:iron_ingot"
432+
]
433+
},
434+
"count": 5
435+
}
436+
}
437+
}
438+
```
439+
</div>
440+
441+
### Mine Block
442+
443+
**ID:** `backpacked:mine_block`
444+
445+
**Description:** A challenge that requires the player to trade with a merchant type entity. Supports Villagers, Wandering Traders, and even modded NPCs like Goblin Traders.
446+
447+
| Key | Type | Required | Default | Description |
448+
| -------- | ------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
449+
| `block` | Object | No || An optional block snapshot predicate to test to against the block that was just mined. See Block Snapshot Predicate for more details. |
450+
| `item` | Object | No || An optional item predicate to test the item that was used by the player to mine the block. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/item) for more details. |
451+
| `player` | Object | No || An optional entity predicate for the player. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/entity) for more details. |
452+
| `count` | Number | No | 1 | The amount of times the `player` has to mine the `block` |
453+
454+
#### Examples
455+
456+
TODO
457+
458+
### Travel Distance
459+
460+
**ID:** `backpacked:travel_distance`
461+
462+
**Description:** A challenge that requires the player to trade with a merchant type entity. Supports Villagers, Wandering Traders, and even modded NPCs like Goblin Traders.
463+
464+
| Key | Type | Required | Default | Description |
465+
| ---------------- | ------ | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
466+
| `movement` | String | No || The type of movement. See list below of valid movement types. If left undefined, any type of movement will count towards the `total distance`. |
467+
| `total_distance` | Number | Yes || The total distance the player must move while in the correct `movement` type. The number must be positive. |
468+
469+
#### Examples
470+
471+
TODO

docs/custom-backpack/setting-the-unlock-challenge/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ sidebar_position: 7
44

55
# Setting the Unlock Challenge
66

7-
Addons have the option to set an unlock challenge for their backpacks. Unlock challenges are similar to Achivements, the diffierence is that you get a reward (the backpack) upon compeletion.
7+
Every backpack has the option to set an unlock challenge. Unlock challenges are simply challenges the player can complete in order to unlock new backpacks. They are inspired from Advancements from the vanilla game, except the main difference is that the player unlocks a reward (the backpack). Unlock challenges are persistent per world, they do not transfer to different saves, just like Advancements. Partial completion of unlock challenges is also saved (e.g. if the player has to cut down one-hundred oak logs, and they have only cut fifty, Backpacked will remember fifty oak logs have already been cut).

0 commit comments

Comments
 (0)