2929import com .minecrafttas .tasmod .virtual .VirtualMouse ;
3030
3131/**
32- * <p>The base class of a flavor.
32+ * <p>The base class of a flavor
3333 *
3434 * <p>All serialisation and deserialisation is broken apart into functions whenever possible,<br>
3535 * with the intention of allowing small changes to the existing syntax.
@@ -116,32 +116,61 @@ public abstract class SerialiserFlavorBase implements Registerable {
116116 */
117117
118118 /**
119+ * <h3>Example</h3>
120+ * <pre>
121+ * ##################### TASfile ####################
122+ * </pre>
119123 * @return The very top of the header
120124 */
121125 protected String headerStart () {
122126 return createCenteredHeading ("TASfile" , '#' , 50 );
123127 }
124128
125129 /**
126- * The end of the header, used for detecting when the header stops
130+ * <p>The end of the header, used for detecting when the header stops
131+ * <h3>Example</h3>
132+ * <pre>
133+ * ##################################################
134+ * </pre>
127135 * @return The end of the header
128136 */
129137 protected String headerEnd () {
130138 return createPaddedString ('#' , 50 );
131139 }
132140
133141 /**
134- * <p>Serialises the flavor of this file, the enabled file commands and other metadata.
135- * <p>{@link #serialiseFlavorName(List)}
142+ * <p>Serialises the flavor of this file, the enabled file commands and other metadata
143+ * <h3>Tree</h3>
136144 * <pre>
137145 * serialiseHeader
138- * ├── {@link #headerStart()} // The start of the header
139- * ├── {@link #serialiseFlavorName(List)} // The name of the flavor
140- * ├── {@link #serialiseFileCommandNames(List)} // The names of the enabled file commands
141- * ├── {@link #serialiseMetadata(List)} // The metadata of this movie
142- * │ ├── {@link #serialiseMetadataName(List, String)} // The metadata extension name
143- * │ └── {@link #serialiseMetadataValues(List, LinkedHashMap)} // All values in the extension
144- * └── {@link #headerEnd()} // The end of the header
146+ * ├── {@link #headerStart()}
147+ * ├── {@link #serialiseFlavorName(List)}
148+ * ├── {@link #serialiseFileCommandNames(List)}
149+ * ├── {@link #serialiseMetadata(List)}
150+ * │ ├── {@link #serialiseMetadataName(List, String)}
151+ * │ └── {@link #serialiseMetadataValues(List, LinkedHashMap)}
152+ * └── {@link #headerEnd()}
153+ * </pre>
154+ * <h3>Example</h3>
155+ * <pre>
156+ * ##################### TASfile #################### // {@link #headerStart()}
157+ * Flavor: beta1 // {@link #serialiseFlavorName(List)}
158+ * FileCommand-Extensions: tasmod_desyncMonitor@v1, tasmod_options@v1, tasmod_label@v1 // {@link #serialiseFileCommandNames(List)}
159+ *
160+ * --------------------- Credits -------------------- // {@link #serialiseMetadataName(List, String)}
161+ * Title:Insert TAS category here // {@link #serialiseMetadataValues(List, LinkedHashMap)}
162+ * Author:Insert author here
163+ * Playing Time:00:00.0
164+ * Rerecords:0
165+ *
166+ * ----------------- Start Position -----------------
167+ * x:-32.577311363268976
168+ * y:56.0
169+ * z:-4.457057187505265
170+ * pitch:29.25007
171+ * yaw:-88.80094
172+ *
173+ * ################################################## // {@link #headerEnd()}
145174 * </pre>
146175 * @return List of lines containing the header
147176 */
@@ -156,16 +185,28 @@ public List<String> serialiseHeader() {
156185 }
157186
158187 /**
159- * <p>How the flavor name is serialised.
188+ * <p>How the flavor name is serialised
160189 * <p>You normally don't have to edit this,<br>
161190 * as the flavor name is taken from the extension name.
191+ * <h3>Example</h3>
192+ * <pre>
193+ * Flavor: beta1
194+ * </pre>
162195 *
163196 * @param out The serialised lines, passed by reference
164197 */
165198 protected void serialiseFlavorName (List <String > out ) {
166199 out .add ("Flavor: " + getExtensionName ());
167200 }
168201
202+ /**
203+ * <p>Adds the file commands that are enabled to the lines
204+ * <h3>Example</h3>
205+ * <pre>
206+ * FileCommand-Extensions: tasmod_label@v1, tasmod_desyncMonitor@v1
207+ * </pre>
208+ * @param out The serialised lines, passed by reference
209+ */
169210 protected void serialiseFileCommandNames (List <String > out ) {
170211 List <String > stringlist = new ArrayList <>();
171212 List <PlaybackFileCommandExtension > extensionList = TASmodAPIRegistry .PLAYBACK_FILE_COMMAND .getEnabled ();
@@ -176,6 +217,25 @@ protected void serialiseFileCommandNames(List<String> out) {
176217 out .add ("" );
177218 }
178219
220+ /**
221+ * <p>Serialises the metadata to the header of the TASfile
222+ * <h3>Example</h3>
223+ * <pre>
224+ * --------------------- Credits --------------------
225+ * Title:Insert TAS category here
226+ * Author:Insert author here
227+ * Playing Time:00:00.0
228+ * Rerecords:0
229+ *
230+ * ----------------- Start Position -----------------
231+ * x:-32.577311363268976
232+ * y:56.0
233+ * z:-4.457057187505265
234+ * pitch:29.25007
235+ * yaw:-88.80094
236+ * </pre>
237+ * @param out
238+ */
179239 protected void serialiseMetadata (List <String > out ) {
180240 if (!processExtensions )
181241 return ;
@@ -189,16 +249,64 @@ protected void serialiseMetadata(List<String> out) {
189249 }
190250 }
191251
252+ /**
253+ * <p>Serialises only the name of the metadata section
254+ * <h3>Example</h3>
255+ * <pre>
256+ * --------------------- Credits --------------------
257+ * </pre>
258+ * @param out The lines passed in by reference
259+ * @param name The name to process
260+ */
192261 protected void serialiseMetadataName (List <String > out , String name ) {
193262 out .add (createCenteredHeading (name , '-' , 50 ));
194263 }
195264
265+ /**
266+ * <p>Serialises only the values of the metadata section
267+ * <h3>Example</h3>
268+ * <pre>
269+ * Title:Insert TAS category here
270+ * Author:Insert author here
271+ * Playing Time:00:00.0
272+ * Rerecords:0
273+ * </pre>
274+ * @param out
275+ * @param data
276+ */
196277 protected void serialiseMetadataValues (List <String > out , LinkedHashMap <String , String > data ) {
197278 data .forEach ((key , value ) -> {
198279 out .add (String .format ("%s:%s" , key , value ));
199280 });
200281 }
201282
283+ /*
284+ ___ _____ _ _ ____ ____ _ _ ____
285+ / __)( _ )( \( )(_ _)( ___)( \( )(_ _)
286+ ( (__ )(_)( ) ( )( )__) ) ( )(
287+ \___)(_____)(_)\_) (__) (____)(_)\_) (__)
288+
289+ */
290+
291+ /**
292+ * <p>Serialises a list of inputs into a list of strings
293+ * <h3>Tree</h3>
294+ * <pre>
295+ * serialise
296+ * └── {@link #serialiseContainer(BigArrayList, TickContainer)}
297+ * ├── {@link #serialiseKeyboard(VirtualKeyboard)}
298+ * ├── {@link #serialiseMouse(VirtualMouse)}
299+ * ├── {@link #serialiseCameraAngle(VirtualCameraAngle)}
300+ * ├── {@link #serialiseInlineComments(List, List)}
301+ * │ └── {@link #serialiseFileCommandsInLine(List)}
302+ * ├── {@link #serialiseEndlineComments(List, List)} // Same as serialiseInlineComments
303+ * │ └── {@link #serialiseFileCommandsEndLine(List)} // Unused
304+ * └── {@link #mergeInputs(BigArrayList, List, List, List, List)}
305+ * </pre>
306+ * @param inputs The inputs to serialise
307+ * @param toTick The tick where to stop, used for partial serialisation by savestates. -1 to serialise all
308+ * @return The list of lines
309+ */
202310 public BigArrayList <String > serialise (BigArrayList <TickContainer > inputs , long toTick ) {
203311 BigArrayList <String > out = new BigArrayList <>();
204312
@@ -253,6 +361,10 @@ protected String serialiseFileCommandsInLine(List<PlaybackFileCommand> fileComma
253361 return String .join (" " , serialisedCommands );
254362 }
255363
364+ protected String serialiseFileCommandsEndLine (List <PlaybackFileCommand > fileCommands ) {
365+ return serialiseFileCommandsInLine (fileCommands );
366+ }
367+
256368 protected List <String > serialiseKeyboard (VirtualKeyboard keyboard ) {
257369 List <String > out = new ArrayList <>();
258370
0 commit comments