Skip to content

Commit 1d57a6f

Browse files
AussieBoxmisode
andauthored
Add Starry Express Guidebook Entry generator (#873)
* Add Guidebook Entry generator * Small changes --------- Co-authored-by: Misode <misoloo64@gmail.com>
1 parent 4283f59 commit 1d57a6f

3 files changed

Lines changed: 186 additions & 0 deletions

File tree

‎public/mcdoc/starexpress.mcdoc‎

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
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+
}

‎src/config.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,15 @@
11121112
"dependency": "pixelmon",
11131113
"wiki": "https://pixelmonmod.com/wiki/",
11141114
"minVersion": "1.21.1"
1115+
},
1116+
{
1117+
"id": "starexpress:guidebook_entry",
1118+
"url": "starexpress/guidebook-entry",
1119+
"path": "guidebook_entries",
1120+
"tags": ["partners"],
1121+
"dependency": "starexpress",
1122+
"wiki": "https://github.com/AussieBox/StarryExpress/wiki/The-Guidebook",
1123+
"minVersion": "1.21.1"
11151124
}
11161125
],
11171126
"legacyGuides": [

‎src/locales/en.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
"generator.pixelmon:pokedex": "Pokedex",
163163
"generator.pixelmon:pokedex_trigger": "Pokedex Trigger",
164164
"generator.pixelmon:pokedex_region": "Region",
165+
"generator.starexpress:guidebook_entry": "Guidebook Entry",
165166
"generator.trade_set": "Trade Set",
166167
"generator.trial_spawner": "Trial Spawner",
167168
"generator.trim_material": "Trim Material",
@@ -237,6 +238,7 @@
237238
"partner.obsidian": "Obsidian",
238239
"partner.ohthetreesyoullgrow": "Oh The Trees You'll Grow",
239240
"partner.sky_aesthetics": "Sky Aesthetics",
241+
"partner.starexpress": "Starry Express",
240242
"partner.thermoo": "Thermoo",
241243
"partner.pixelmon": "Pixelmon",
242244
"presets": "Presets",

0 commit comments

Comments
 (0)