Skip to content

Commit 75f1b2a

Browse files
committed
kjs-ori: add examples on how to get recipe data in collide event
1 parent 200b94c commit 75f1b2a

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

wikis/kubejs-oritech/docs/event/particle/collided.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,29 @@ that happens when no valid recipe is found.
5555
- description: spawns a nether portal at the given position; this is usually used by a special interaction when two Fire Charges
5656
collide with high speed
5757

58+
## Oritech Recipe
59+
60+
The instance you obtain when using the `recipe` property is an `OritechRecipe`. This type is reused for all Oritech recipes, so it is not
61+
as straightforward to use. The following shows available properties you can call on the recipe instance to get its data.
62+
63+
All properties and functions, that are not listed here, should not be used and are intended for internal use.
64+
65+
```js
66+
// obtains the time of the recipe in ticks
67+
let time = recipe.time
68+
69+
// obtains the input ingredients of the recipe as list
70+
let ingredients = recipe.inputs
71+
let firstInput = ingredients[0] // get the first input ingredient
72+
73+
// obtains the output item stacks of the recipe as list
74+
let results = recipe.results
75+
let firstResult = results[0] // get the first output item stack
76+
```
77+
78+
Because this type is reused for all Oritech recipes, the inputs and outputs use lists, even if this specific recipe only has two inputs
79+
and a single output. Make sure to unwrap the list to invoke logic on specific elements.
80+
5881
## Event Listener
5982

6083
To access the event, the first thing you need to do is to open an event listener for the `particleCollided` event in a server script.

0 commit comments

Comments
 (0)