You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: wikis/summoningrituals/docs/recipe/outputs.md
+39-5Lines changed: 39 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
# Altar Recipe Outputs
2
2
3
-
Altar recipe outputs can be item, entity, or command inputs. A recipe requires at least one item, entity, _or_ command output in order to be valid.
3
+
Altar recipe outputs can be item, entity, or command outputs. A recipe requires at least one item, entity, _or_ command output to be valid.
4
4
5
5
> [!WARNING] NOTE
6
-
> This page assumes that you know how to get an instance of the altar recipe builder. If you do not know how to do that or you didn't read about the general recipe structure yet, please read the [recipe basics page](basics.md).
6
+
> This page assumes that you know how to get an instance of the altar recipe builder. If you do not know how to do that, or if you have not read about the general recipe structure yet, please read the [recipe basics page](basics.md).
7
7
8
8
## Item Outputs
9
9
@@ -15,7 +15,7 @@ Altar recipe outputs can be item, entity, or command inputs. A recipe requires a
15
15
16
16
### Syntax
17
17
18
-
The required type `ItemOutput` is a custom type by Summoning Rituals. This type, next to the `ItemStack`, stores optional offset and spread values that define where to spawn the item output.
18
+
The required type `ItemOutput` is a custom type provided by Summoning Rituals. In addition to the `ItemStack`, this type stores optional offset and spread values that define where the item output spawns.
19
19
20
20
This custom type supports all KubeJS `ItemStack` wrappers. You can use multiple different syntaxes to pass an instance of it to the recipe builder. If you want to specify multiple entries, you have to wrap them in an array via `[]`.
21
21
@@ -52,7 +52,7 @@ To pass additional data to an item output such as offset and spread values, you
52
52
53
53
### Syntax
54
54
55
-
Because entities are not wrapped by KubeJS by default, Summoning Rituals offers custom wrappers to provide an easy syntax. Additionally, because entity outputs support additional properties, the mod offers a builder binding to pass additional data.
55
+
Because entities are not wrapped by KubeJS by default, Summoning Rituals offers custom wrappers to provide an easy syntax. Additionally, because entity outputs support extra properties, the mod offers a builder binding for passing additional data.
56
56
57
57
```js
58
58
.entityOutputs([
@@ -71,4 +71,38 @@ To pass additional data to an entity output such as NBT, a custom tooltip, or of
71
71
72
72
## Command Outputs
73
73
74
-
TODO
74
+
- type: `CommandOutput`
75
+
- required: no
76
+
- default: empty
77
+
- primary access: `commands(...)`
78
+
- aliases: `command`
79
+
80
+
### Syntax
81
+
82
+
Summoning Rituals offers a few ways to pass command outputs to the recipe builder. Even if multiple commands are provided, they are grouped into a single `CommandOutput` instance. In addition to the commands, this object also supports a custom tooltip that can be displayed in recipe viewers instead of the raw commands, and a toggle for whether the command requires player context.
When no custom tooltip is provided, recipe viewers show the output commands in their raw form. If a tooltip is provided, it is shown _instead_ of the commands. That means if you want to show the actual command, you have to add it to the tooltip yourself. Commands you pass to the function do not have to start with a slash, but you can include one for better clarity if you prefer.
91
+
92
+
The `requiresPlayer` boolean defaults to true. If a command output requires player context, the output command is not invoked if the ritual is started without a player, for example, by automation. Entity descriptors like `@s` always reference the player starting the ritual.
93
+
94
+
### Examples
95
+
96
+
```js
97
+
// say Hi and Hello in the chat
98
+
// the leading slash is optional
99
+
.commands(["say Hi", "/say Hello"])
100
+
101
+
// give the invoking player experience
102
+
// use a custom tooltip for recipe viewers
103
+
.command(["experience add @s 1"], ["Give 1 experience to the player"])
104
+
105
+
// kill the invoking player
106
+
// the @s is optional because kill has an implicit entity target
0 commit comments