Skip to content

Commit 915a707

Browse files
committed
📦 WIP: Push documentation for some challenge types
1 parent 561ac74 commit 915a707

File tree

3 files changed

+353
-0
lines changed

3 files changed

+353
-0
lines changed
Lines changed: 296 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
1+
# Challenge Types
2+
3+
Backpacked comes with many built-in challenge types
4+
5+
## Breed Animals
6+
7+
**ID:** `backpacked:breed_animal`
8+
9+
**Description:** A challenge that requires the player to breed animals of a specified type together
10+
11+
| Key | Type | Required | Default | Description |
12+
| -------- | ------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------- |
13+
| `animal` | Object | Yes || An entity predicate object. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/entity) for details |
14+
| `count` | Integer | No | 1 | The amount of times to breed the animals together |
15+
16+
#### Examples
17+
<div class="code-block">
18+
**Breed cows together five times to unlock the backpack**
19+
20+
```json title="data/<namespace>/backpacked/<your_backpack>.json"
21+
{
22+
"unlock_challenge": {
23+
"formatter": "backpacked:bred_x_of_x", // Ideal formatter for this type
24+
"challenge": {
25+
"type": "backpacked:breed_animal",
26+
"animal": {
27+
"type": "minecraft:cow"
28+
},
29+
"count": 5
30+
}
31+
}
32+
}
33+
```
34+
</div>
35+
36+
<div class="code-block">
37+
**Breed two `tabby` variant cats together while they are affected with the `jump_boost` status effect to unlock the backpack**
38+
39+
```json title="data/<namespace>/backpacked/<your_backpack>.json"
40+
{
41+
"unlock_challenge": {
42+
"formatter": "backpacked:bred_x_of_x", // Ideal formatter for this type
43+
"challenge": {
44+
"type": "backpacked:breed_animal",
45+
"animal": {
46+
"type": "minecraft:cat",
47+
"components": { // 1.21.5+
48+
"minecraft:cat/variant": "tabby"
49+
},
50+
"effects": {
51+
"minecraft:jump_boost": {}
52+
}
53+
}
54+
}
55+
}
56+
}
57+
```
58+
</div>
59+
60+
61+
62+
## Craft Item
63+
64+
**ID:** `backpacked:craft_item`
65+
66+
**Description:** A challenge that requires the player to breed animals of a specified type together
67+
68+
| Key | Type | Required | Default | Description |
69+
| -------------- | ------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
70+
| `crafted_item` | Object | No || A crafted item predicate object. If not defined or an empty object, any item will count towards the crafting goal. See [Crafted Item Predicate](/docs/custom-backpack/setting-the-unlock-challenge/predicates.mdx#crafted-item-predicate) for documentation and more examples. |
71+
| `count` | Integer | No | 1 | The amount of items to craft in total |
72+
73+
#### Examples
74+
<div class="code-block">
75+
**Craft twenty pieces of `bread` to unlock the backpack**
76+
77+
```json title="data/<namespace>/backpacked/<your_backpack>.json"
78+
{
79+
"unlock_challenge": {
80+
"formatter": "backpacked:crafted_x_of_x", // Ideal formatter for this type
81+
"challenge": {
82+
"type": "backpacked:craft_item",
83+
"crafted_item": {
84+
"items": [
85+
"minecraft:bread"
86+
]
87+
},
88+
"count": 20
89+
}
90+
}
91+
}
92+
```
93+
</div>
94+
95+
96+
## Explore Biome
97+
98+
**ID:** `backpacked:explore_biome`
99+
100+
**Description:** A challenge that requires the player to travel to one or more specified biomes
101+
102+
| Key | Type | Required | Default | Description |
103+
| ------- | ------------ | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
104+
| `biome` | String/Array | Yes || A biome id or a list of biome ids. See the [Minecraft Wiki](https://minecraft.wiki/w/Biome#Biome_IDs) for available biomes. Also supports biomes from mods too! |
105+
106+
#### Examples
107+
<div class="code-block">
108+
**Travel to every snowy biome to unlock this backpack**
109+
110+
```json title="data/<namespace>/backpacked/<your_backpack>.json"
111+
{
112+
"unlock_challenge": {
113+
"formatter": "backpacked:explored_x_of_x", // Ideal formatter for this type
114+
"challenge": {
115+
"type": "backpacked:explore_biome",
116+
"biome": [
117+
"minecraft:snowy_plains",
118+
"minecraft:snowy_taiga",
119+
"minecraft:ice_spikes",
120+
"minecraft:snowy_slopes",
121+
"minecraft:frozen_peaks",
122+
"minecraft:jagged_peaks",
123+
"minecraft:snowy_beach",
124+
"minecraft:frozen_ocean",
125+
"minecraft:deep_frozen_ocean",
126+
"minecraft:frozen_river",
127+
]
128+
}
129+
}
130+
}
131+
```
132+
</div>
133+
134+
<div class="code-block">
135+
**Travel to the Deep Dark to unlock this backpack**
136+
137+
```json title="data/<namespace>/backpacked/<your_backpack>.json"
138+
{
139+
"unlock_challenge": {
140+
"formatter": "backpacked:explored_x_of_x", // Ideal formatter for this type
141+
"challenge": {
142+
"type": "backpacked:explore_biome",
143+
"biome": "minecraft:deep_dark" // String instead of array is allowed if only one biome
144+
}
145+
}
146+
}
147+
```
148+
</div>
149+
150+
## Feed Animal
151+
152+
**ID:** `backpacked:feed_animal`
153+
154+
**Description:** A challenge that requires the player to feed animals (with a matching predicate) an amount of times
155+
156+
| Key | Type | Required | Default | Description |
157+
| -------- | ------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
158+
| `animal` | Object | Yes || An entity predicate object. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/entity) for details. Entity must be an animal regardless of the predicate conditions, other mobs will not work. |
159+
| `count` | Integer | No | 1 | The amount of times to feed the animals |
160+
161+
#### Examples
162+
<div class="code-block">
163+
**Feed any farm animals twenty times to unlock this backpack**
164+
165+
```json title="data/<namespace>/backpacked/<your_backpack>.json"
166+
{
167+
"unlock_challenge": {
168+
"formatter": "backpacked:fed_x_of_x", // Ideal formatter for this type
169+
"challenge": {
170+
"type": "backpacked:feed_animal",
171+
"animal": {
172+
"type": [
173+
"minecraft:cow",
174+
"minecraft:chicken",
175+
"minecraft:pig",
176+
"minecraft:sheep"
177+
]
178+
},
179+
"count": 20
180+
}
181+
}
182+
}
183+
```
184+
</div>
185+
186+
## Interact with Block
187+
188+
**ID:** `backpacked:interact_with_block`
189+
190+
**Description:** A challenge that requires the player to interact with a block
191+
192+
| Key | Type | Required | Default | Description |
193+
| -------- | ------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
194+
| `block` | Object | No || An optinal blockstate predicate to test the interacting block. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/entity) for more details. |
195+
| `item` | Object | No || An optional item predicate to test the held item of the interacting player. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/entity) for more details. |
196+
| `player` | Object | No || An optional entity predicate for the player. See [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/entity) for more details. |
197+
| `count` | Integer | No | 1 | The amount of times to perform the action |
198+
199+
#### Examples
200+
<div class="code-block">
201+
**Fertilize crops one-hundred times using bonemeal to unlock this backpack**
202+
203+
```json title="data/<namespace>/backpacked/<your_backpack>.json"
204+
{
205+
"unlock_challenge": {
206+
"formatter": "backpacked:completed_x_of_x",
207+
"challenge": {
208+
"type": "backpacked:interact_with_block",
209+
"block": {
210+
"blocks": "#minecraft:crops"
211+
},
212+
"item": {
213+
"items": [
214+
"minecraft:bonemeal"
215+
]
216+
},
217+
"count": 100
218+
}
219+
}
220+
}
221+
```
222+
</div>
223+
224+
<div class="code-block">
225+
**Cook a piece of food on a campfire to unlock this backpack**
226+
227+
```json title="data/<namespace>/backpacked/<your_backpack>.json"
228+
{
229+
"unlock_challenge": {
230+
"formatter": "backpacked:completed_x_of_x",
231+
"challenge": {
232+
"type": "backpacked:interact_with_block",
233+
"block": {
234+
"blocks": [
235+
"minecraft:campfire"
236+
],
237+
"state": {
238+
"lit": true
239+
}
240+
}
241+
}
242+
}
243+
}
244+
```
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.
246+
247+
</div>
248+
249+
<div class="code-block">
250+
**Process bonemeal from a Composter five times to unlock this backpack**
251+
252+
```json title="data/<namespace>/backpacked/<your_backpack>.json"
253+
{
254+
"unlock_challenge": {
255+
"formatter": "backpacked:completed_x_of_x",
256+
"challenge": {
257+
"type": "backpacked:interact_with_block",
258+
"block": {
259+
"blocks": {
260+
"minecraft:composter"
261+
},
262+
"state": {
263+
"level": "8"
264+
}
265+
},
266+
"count": 5
267+
}
268+
}
269+
}
270+
```
271+
**Notes:** Level 8 is the final stage of the composter before it drops bonemeal. The next interaction will match the above predicate, drop bonemeal, and will count towards the challenge progress.
272+
</div>
273+
274+
<div class="code-block">
275+
**Press a stone button one-million times to unlock this backpack**
276+
277+
```json title="data/<namespace>/backpacked/<your_backpack>.json"
278+
{
279+
"unlock_challenge": {
280+
"formatter": "backpacked:completed_x_of_x",
281+
"challenge": {
282+
"type": "backpacked:interact_with_block",
283+
"block": {
284+
"blocks": [
285+
"minecraft:stone_button"
286+
],
287+
"state": {
288+
"powered": "false"
289+
}
290+
},
291+
"count": 1000000
292+
}
293+
}
294+
}
295+
```
296+
</div>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
sidebar_position: 7
3+
---
4+
5+
# Setting the Unlock Challenge
6+
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.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Predicates
2+
3+
## Entity Predicate
4+
5+
Entity Predicates are a vanilla feature, and are used in Advancements. See the [Minecraft Wiki](https://minecraft.wiki/w/Advancement/Conditions/entity) for full documentation.
6+
7+
:::important TIP
8+
The Minecraft Wiki only shows documentation for the most recent version of Minecraft. If designing an addon for Backpacked on an older version of Minecraft, the wiki may not be 100% accurate. You may find this [**generator**](https://misode.github.io/predicate/) helpful as it will generate the JSON and also allow you to select the Minecraft version to target.
9+
:::
10+
11+
## Crafted Item Predicate
12+
13+
Crafted Item Predicates are a custom predicate implemented by Backpacked just for crafted items.
14+
15+
| Key | Type | Required | Default | Description |
16+
| ----------- | ------------ | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
17+
| `namespace` | String/Array | No || The owner namespace of the item. Example: `minecraft` or `backpacked`. Can also be an array of namespaces `["minecraft", "backpacked", "create"]`. |
18+
| `tag` | String | No || An optional item tag. See [Minecraft Wiki](https://minecraft.wiki/w/Item_tag_(Java_Edition)) for more details. |
19+
| `items` | Array | No || An optional array of item id(s). Example: `["minecraft:stick"]` |
20+
21+
### Examples
22+
<div class="code-block">
23+
**Match any item**
24+
```json
25+
"predicate": {
26+
// an empty object will match everything
27+
}
28+
```
29+
</div>
30+
31+
<div class="code-block">
32+
**Match exactly a stick item**
33+
```json
34+
"predicate": {
35+
"items": [
36+
"minecraft:stick"
37+
]
38+
}
39+
```
40+
</div>
41+
42+
<div class="code-block">
43+
**Match items that come from the mod with the namespace `create` and must also have the item tag `create:seats`**
44+
```json
45+
"predicate": {
46+
"namespace": "create",
47+
"tag": "create:seats"
48+
}
49+
```
50+
</div>

0 commit comments

Comments
 (0)