@@ -85,20 +85,43 @@ namespace OBJECTIVES {
8585// ▓ □〓≡ ╝╚╔╗╬ ╓ ╩┌ ┐└ ┘ ↑ ↓ → ← ↔ ▀▐ ░ ▒▬ ♦ ◘
8686// → ✎ ❣ ✚ ✔ ✖ ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ⊻ ⊼ ⊽ ⋃ ⌀ ⌂
8787
88- const TELLRAW_PREFIX = new JsonText ( [
89- { text : '[' , color : 'gray' } ,
90- { text : 'AJ' , color : 'aqua' } ,
91- { text : '] ' } ,
92- ] )
88+ const TELLRAW_PREFIX = ( ) =>
89+ new JsonText ( [
90+ { text : '\n[' , color : 'gray' } ,
91+ { text : 'AJ' , color : 'aqua' } ,
92+ '] ' ,
93+ [
94+ { text : '(from ' , color : 'gray' , italic : true } ,
95+ Project ! . animated_java . export_namespace ,
96+ ')' ,
97+ ] ,
98+ ' -> ' ,
99+ ] )
100+
101+ const TELLRAW_ERROR_PREFIX = ( ) =>
102+ new JsonText ( [ TELLRAW_PREFIX ( ) , { text : 'ERROR: ' , color : 'red' } , '\n ' ] )
103+
104+ const TELLRAW_SUFFIX = ( ) => new JsonText ( [ '\n' ] )
105+
106+ const TELLRAW_LEARN_MORE_LINK = ( url : string ) =>
107+ new JsonText ( [
108+ '\n ' ,
109+ {
110+ text : 'Click here to learn more' ,
111+ color : 'blue' ,
112+ underlined : true ,
113+ italic : true ,
114+ clickEvent : { action : 'open_url' , value : url } ,
115+ } ,
116+ ] )
93117
94118namespace TELLRAW {
95- export const RIG_OUTDATED = ( exportNamespace : string ) =>
119+ export const RIG_OUTDATED = ( ) =>
96120 new JsonText ( [
97121 '' ,
98- TELLRAW_PREFIX ,
99- { text : 'Error: ' , color : 'red' } ,
122+ TELLRAW_ERROR_PREFIX ( ) ,
100123 { text : 'The ' , color : 'red' } ,
101- { text : exportNamespace , color : 'yellow' } ,
124+ { text : Project ! . animated_java . export_namespace , color : 'yellow' } ,
102125 { text : ' rig instance at' , color : 'red' } ,
103126 [
104127 { text : ' [' , color : 'yellow' } ,
@@ -123,6 +146,9 @@ namespace TELLRAW {
123146 color : 'aqua' ,
124147 underlined : true ,
125148 } ,
149+ // '\n',
150+ // TELLRAW_LEARN_MORE_LINK(''),
151+ TELLRAW_SUFFIX ( ) ,
126152 ] )
127153 export const RIG_OUTDATED_TEXT_DISPLAY = ( ) =>
128154 new JsonText ( [
@@ -132,35 +158,42 @@ namespace TELLRAW {
132158 color : 'red' ,
133159 } ,
134160 ] )
135- export const FUNCTION_NOT_EXECUTED_AS_ROOT_ERROR = ( functionName : string , rootTag : string ) =>
161+ export const FUNCTION_NOT_EXECUTED_AS_ROOT_ERROR = ( functionName : string ) =>
136162 new JsonText ( [
137163 '' ,
138- TELLRAW_PREFIX ,
139- { text : 'Error: ' , color : 'red' } ,
140- { text : 'The function ' , color : 'red' } ,
141- { text : functionName , color : 'yellow' } ,
142- { text : ' must be executed as the root entity.' , color : 'red' } ,
143- { text : '\n You can use ' , color : 'red' } ,
144- { text : `execute as @e[tag=${ rootTag } ] run ...` , color : 'aqua' } ,
145- { text : ' to run the function as the root.' , color : 'red' } ,
164+ TELLRAW_ERROR_PREFIX ( ) ,
165+ {
166+ text : 'This function' ,
167+ color : 'blue' ,
168+ underlined : true ,
169+ hoverEvent : {
170+ action : 'show_text' ,
171+ contents : [ { text : functionName , color : 'yellow' } ] ,
172+ } ,
173+ } ,
174+ { text : " must be executed as the rig's root entity." , color : 'red' } ,
175+ '\n' ,
176+ TELLRAW_LEARN_MORE_LINK (
177+ 'https://animated-java.dev/docs/exported-rigs/controlling-a-rig-instance'
178+ ) ,
179+ TELLRAW_SUFFIX ( ) ,
146180 ] )
147181 // Summon Function
148182 export const VARIANT_CANNOT_BE_EMPTY = ( ) =>
149183 new JsonText ( [
150184 '' ,
151- TELLRAW_PREFIX ,
152- { text : 'Error: ' , color : 'red' } ,
185+ TELLRAW_ERROR_PREFIX ( ) ,
153186 { text : 'variant' , color : 'yellow' } ,
154187 { text : ' cannot be an empty string.' , color : 'red' } ,
188+ TELLRAW_SUFFIX ( ) ,
155189 ] )
156190 export const INVALID_VARIANT = (
157191 variantName : string ,
158192 variants : Record < string , IRenderedVariant >
159193 ) =>
160194 new JsonText ( [
161195 '' ,
162- TELLRAW_PREFIX ,
163- { text : 'Error: ' , color : 'red' } ,
196+ TELLRAW_ERROR_PREFIX ( ) ,
164197 { text : 'The variant ' , color : 'red' } ,
165198 { text : variantName , color : 'yellow' } ,
166199 { text : ' does not exist.' , color : 'red' } ,
@@ -177,28 +210,28 @@ namespace TELLRAW {
177210 { text : variant . name , color : 'yellow' } ,
178211 ] )
179212 ) ,
213+ TELLRAW_SUFFIX ( ) ,
180214 ] )
181215 export const ANIMATION_CANNOT_BE_EMPTY = ( ) =>
182216 new JsonText ( [
183217 '' ,
184- TELLRAW_PREFIX ,
185- { text : 'Error: ' , color : 'red' } ,
218+ TELLRAW_ERROR_PREFIX ( ) ,
186219 { text : 'animation' , color : 'yellow' } ,
187220 { text : ' cannot be an empty string.' , color : 'red' } ,
221+ TELLRAW_SUFFIX ( ) ,
188222 ] )
189223 export const FRAME_CANNOT_BE_NEGATIVE = ( ) =>
190224 new JsonText ( [
191225 '' ,
192- TELLRAW_PREFIX ,
193- { text : 'Error: ' , color : 'red' } ,
226+ TELLRAW_ERROR_PREFIX ( ) ,
194227 { text : 'frame' , color : 'yellow' } ,
195228 { text : ' must be a non-negative integer.' , color : 'red' } ,
229+ TELLRAW_SUFFIX ( ) ,
196230 ] )
197231 export const INVALID_ANIMATION = ( animationName : string , animations : IRenderedAnimation [ ] ) =>
198232 new JsonText ( [
199233 '' ,
200- TELLRAW_PREFIX ,
201- { text : 'Error: ' , color : 'red' } ,
234+ TELLRAW_ERROR_PREFIX ( ) ,
202235 { text : 'The animation ' , color : 'red' } ,
203236 { text : animationName , color : 'yellow' } ,
204237 { text : ' does not exist.' , color : 'red' } ,
@@ -215,13 +248,14 @@ namespace TELLRAW {
215248 { text : anim . safe_name , color : 'yellow' } ,
216249 ] )
217250 ) ,
251+ TELLRAW_SUFFIX ( ) ,
218252 ] )
219253 export const NO_VARIANTS = ( ) =>
220254 new JsonText ( [
221255 '' ,
222- TELLRAW_PREFIX ,
223- { text : 'Error: ' , color : 'red' } ,
256+ TELLRAW_ERROR_PREFIX ( ) ,
224257 { text : 'No variants are available.' , color : 'red' } ,
258+ TELLRAW_SUFFIX ( ) ,
225259 ] )
226260}
227261
0 commit comments