Skip to content

Commit 613e4f1

Browse files
authored
upd: custom component documentation
1 parent cda75eb commit 613e4f1

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

content/docs/extension-docs/custom-components.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ interface TemplateContext {
101101
Creates a new dialogue scene to be used within your add-on. This function is only available if your project target version is at least "1.17.40"
102102

103103
- `lootTable(lootTable: any): string`
104-
Returns a string that points to your defined loot table
104+
Creates a loot table for the entity and returns a string that points to this loot table
105105

106106
- `tradeTable(tradeTable: any): string`
107-
Returns a string that points to your defined trade table
107+
Creates a trade table for the entity and returns a string that points to this trade table
108108

109109
- `spawnRule(spawnRule: any): void`
110-
Creates a new spawn rule file for entities that use the custom component
110+
Creates a new spawn rule file for entities that uses the custom component
111111

112112
#### Item
113113

@@ -127,6 +127,8 @@ interface TemplateContext {
127127
identifier: string
128128
projectNamespace: string
129129
sourceItem: () => any
130+
lootTable: (lootTable: any) => string
131+
recipe: (recipe: any) => void
130132
player: {
131133
create: (
132134
template: any,
@@ -143,14 +145,18 @@ interface TemplateContext {
143145
condition?: string | false
144146
) => void
145147
}
146-
lootTable: (lootTable: any) => string
147-
recipe: (recipe: any) => void
148148
}
149149
```
150150

151151
- `sourceItem(): any`
152152
Access the source item that your component currently gets applied to.
153153

154+
- `lootTable(lootTable: any): string`
155+
Creates a loot table for the item and returns a string that points to this loot table
156+
157+
- `recipe(recipe: any): void`
158+
Creates a new recipe for items that uses the custom component
159+
154160
The `player` object gives access to these functions:
155161

156162
- `animation(animation: any, condition?: string | false): void`
@@ -162,12 +168,6 @@ The `player` object gives access to these functions:
162168
- `create(template: any, location?: string): void`
163169
Allows you to create data inside of the player. `template` should be a JavaScript object of the data to merge into the player behavior file at the given `location`. `location` should be a path separated by `'/'` to where you want the `template` to be created. For example: `minecraft:entity/description`. The default merge behaviour can optionally be overridden with `operation` which should be a function that takes default merge function `deepMerge`, the data at `location` (`oldData`) and the new data being merged in (`newData`). It should return the result of the custom merge. For example: `(deepMerge, oldData, newData) => newData` will overwrite the data at `location`.
164170

165-
- `lootTable(lootTable: any): string`
166-
Returns a string that points to your defined loot table
167-
168-
- `recipe(recipe: any): void`
169-
Creates a new recipe for items that use the custom component
170-
171171
#### Block
172172

173173
```ts
@@ -203,10 +203,10 @@ interface TemplateContext {
203203
Trigger an event reponse whenever your component gets removed from this block
204204

205205
- `lootTable(lootTable: any): string`
206-
Returns a string that points to your defined loot table
206+
Creates a loot table for the block and returns a string that points to this loot table
207207

208208
- `recipe(recipe: any): void`
209-
Creates a new recipe for blocks that use the custom component
209+
Creates a new recipe for blocks that uses the custom component
210210

211211
### Creating Files
212212

0 commit comments

Comments
 (0)