|
| 1 | +use ::java::util::BlockState |
| 2 | +use ::java::world::item::ItemStack |
| 3 | + |
| 4 | +dispatch minecraft:resource[starexpress:guidebook_entry] to struct GuidebookEntry { |
| 5 | + /// The guidebook entry's title. Can point to a translation key, and supports MiniMessage. |
| 6 | + title: string, |
| 7 | + /// The guidebook entry's subtitle. Can point to a translation key, and supports MiniMessage. |
| 8 | + subtitle?: string, |
| 9 | + /// Keywords that replace all instances of themselves with a link to this guidebook entry. All keywords must be a translation key. |
| 10 | + keywords?: [string], |
| 11 | + description: [DescriptionElement] |
| 12 | +} |
| 13 | + |
| 14 | +enum(string) ElementType { |
| 15 | + /// Represents a block. |
| 16 | + BlockElement = "block", |
| 17 | + /// Represents a fake hotbar. Displays up to 9 stacks of items. |
| 18 | + HotbarElement = "hotbar", |
| 19 | + /// Represents an item. |
| 20 | + ItemElement = "item", |
| 21 | + /// Represents a semi-transparent line. |
| 22 | + SpacerElement = "spacer", |
| 23 | + /// Represents text. Can point to a translation key, and supports MiniMessage. |
| 24 | + TextElement = "text", |
| 25 | + /// Represents a texture. Takes a full path (e.g. "minecraft:textures/item/diamond.png"). |
| 26 | + TextureElement = "texture", |
| 27 | + /// Represents text alongside a block. Text can point to a translation key, and supports MiniMessage. |
| 28 | + TextWithBlockElement = "text_with_block", |
| 29 | + /// Represents text alongside an item. Text can point to a translation key, and supports MiniMessage. |
| 30 | + TextWithItemElement = "text_with_item", |
| 31 | + /// Represents text alongside a texture. Text can point to a translation key, and supports MiniMessage. Texture takes a full path (e.g. "minecraft:textures/item/diamond.png"). |
| 32 | + TextWithTextureElement = "text_with_texture", |
| 33 | + |
| 34 | + /// Checks if the given variable is either true or false, and returns a different element depending on the outcome. |
| 35 | + BooleanConditional = "conditional_boolean", |
| 36 | + /// Checks if the given variable contains the given string, and returns a different element depending on the outcome. |
| 37 | + StringContainsConditional = "conditional_string_contains", |
| 38 | + /// Checks if the given variable matches the given string, and returns a different element depending on the outcome. |
| 39 | + StringMatchesConditional = "conditional_string_matches" |
| 40 | +} |
| 41 | + |
| 42 | +type DescriptionElement = struct { |
| 43 | + /// A unique ID for the element. No other element in the guidebook entry can have this ID. |
| 44 | + id: string, |
| 45 | + /// The element's type. Controls what the element represents and what it requires as input. |
| 46 | + type: ElementType, |
| 47 | + ...starexpress:guidebook_entry[[type]], |
| 48 | +} |
| 49 | + |
| 50 | +dispatch starexpress:guidebook_entry[block] to struct { |
| 51 | + /// The BlockState to display. |
| 52 | + block: BlockState, |
| 53 | + /// The size of the displayed BlockState. Defaults to 16. |
| 54 | + sizing?: int |
| 55 | +} |
| 56 | + |
| 57 | +dispatch starexpress:guidebook_entry[hotbar] to struct { |
| 58 | + /// The ItemStack in the hotbar's first slot. |
| 59 | + item0?: ItemStack, |
| 60 | + /// The ItemStack in the hotbar's second slot. |
| 61 | + item1?: ItemStack, |
| 62 | + /// The ItemStack in the hotbar's third slot. |
| 63 | + item2?: ItemStack, |
| 64 | + /// The ItemStack in the hotbar's fourth slot. |
| 65 | + item3?: ItemStack, |
| 66 | + /// The ItemStack in the hotbar's fifth slot. |
| 67 | + item4?: ItemStack, |
| 68 | + /// The ItemStack in the hotbar's sixth slot. |
| 69 | + item5?: ItemStack, |
| 70 | + /// The ItemStack in the hotbar's seventh slot. |
| 71 | + item6?: ItemStack, |
| 72 | + /// The ItemStack in the hotbar's eighth slot. |
| 73 | + item7?: ItemStack, |
| 74 | + /// The ItemStack in the hotbar's ninth slot. |
| 75 | + item8?: ItemStack |
| 76 | +} |
| 77 | + |
| 78 | +dispatch starexpress:guidebook_entry[item] to struct { |
| 79 | + /// The ItemStack to display. |
| 80 | + item: ItemStack, |
| 81 | + /// The size of the displayed ItemStack. Defaults to 16. |
| 82 | + sizing?: int |
| 83 | +} |
| 84 | + |
| 85 | +dispatch starexpress:guidebook_entry[spacer] to struct { |
| 86 | + |
| 87 | +} |
| 88 | + |
| 89 | +dispatch starexpress:guidebook_entry[text] to struct { |
| 90 | + /// The text to display. Can point to a translation key, and supports MiniMessage. |
| 91 | + text: string |
| 92 | +} |
| 93 | + |
| 94 | +dispatch starexpress:guidebook_entry[texture] to struct { |
| 95 | + /// The texture to display. Takes a full path (e.g. "minecraft:textures/item/diamond.png"). |
| 96 | + texture: #[id="texture"] string, |
| 97 | + /// The native width of the texture. |
| 98 | + width: int, |
| 99 | + /// The native width of the texture. |
| 100 | + height: int, |
| 101 | + /// The width of the texture when displayed on-screen. |
| 102 | + region_width?: int, |
| 103 | + /// The height of the texture when displayed on-screen. |
| 104 | + region_height?: int |
| 105 | +} |
| 106 | + |
| 107 | +dispatch starexpress:guidebook_entry[text_with_block] to struct { |
| 108 | + /// The text to display. Can point to a translation key, and supports MiniMessage. |
| 109 | + text: string, |
| 110 | + /// The alignment of the text. The displayed BlockState will appear on the opposite side. |
| 111 | + text_alignment: ("left" | "right"), |
| 112 | + /// The BlockState to display. |
| 113 | + block: BlockState, |
| 114 | + /// The size of the displayed BlockState. Defaults to 16. |
| 115 | + sizing?: int |
| 116 | +} |
| 117 | + |
| 118 | +dispatch starexpress:guidebook_entry[text_with_item] to struct { |
| 119 | + /// The text to display. Can point to a translation key, and supports MiniMessage. |
| 120 | + text: string, |
| 121 | + /// The alignment of the text. The displayed ItemStack will appear on the opposite side. |
| 122 | + text_alignment: ("left" | "right"), |
| 123 | + /// The ItemStack to display. |
| 124 | + item: ItemStack, |
| 125 | + /// The size of the displayed ItemStack. Defaults to 16. |
| 126 | + sizing?: int |
| 127 | +} |
| 128 | + |
| 129 | +dispatch starexpress:guidebook_entry[text_with_texture] to struct { |
| 130 | + /// The text to display. Can point to a translation key, and supports MiniMessage. |
| 131 | + text: string, |
| 132 | + /// The alignment of the text. The displayed texture will appear on the opposite side. |
| 133 | + text_alignment: ("left" | "right"), |
| 134 | + /// The texture to display. Takes a full path (e.g. "minecraft:textures/item/diamond.png"). |
| 135 | + texture: #[id="texture"] string, |
| 136 | + /// The native width of the texture. |
| 137 | + width: int, |
| 138 | + /// The native width of the texture. |
| 139 | + height: int, |
| 140 | + /// The width of the texture when displayed on-screen. |
| 141 | + region_width?: int, |
| 142 | + /// The height of the texture when displayed on-screen. |
| 143 | + region_height?: int |
| 144 | +} |
| 145 | + |
| 146 | +dispatch starexpress:guidebook_entry[conditional_boolean] to struct { |
| 147 | + /// The variable to check. Returns its value, and errors if the variable is not a boolean. |
| 148 | + variable: #[id="variable"] string, |
| 149 | + /// The element to return if the result is true. |
| 150 | + true?: DescriptionElement, |
| 151 | + /// The element to return if the result is false. |
| 152 | + false?: DescriptionElement, |
| 153 | +} |
| 154 | + |
| 155 | +dispatch starexpress:guidebook_entry[conditional_string_contains] to struct { |
| 156 | + /// The variable to check. Returns true if it contains the given regex, and errors if the variable is not a string or text. |
| 157 | + variable: #[id="variable"] string, |
| 158 | + /// The regex that the variable must contain in order to return true. |
| 159 | + regex: string, |
| 160 | + /// The element to return if the result is true. |
| 161 | + true?: DescriptionElement, |
| 162 | + /// The element to return if the result is false. |
| 163 | + false?: DescriptionElement, |
| 164 | +} |
| 165 | + |
| 166 | +dispatch starexpress:guidebook_entry[conditional_string_matches] to struct { |
| 167 | + /// The variable to check. Returns true if it matches the given regex, and errors if the variable is not a string or text. |
| 168 | + variable: #[id="variable"] string, |
| 169 | + /// The regex that the variable must match in order to return true. |
| 170 | + regex: string, |
| 171 | + /// The element to return if the result is true. |
| 172 | + true?: DescriptionElement, |
| 173 | + /// The element to return if the result is false. |
| 174 | + false?: DescriptionElement, |
| 175 | +} |
0 commit comments