forked from MinecraftTAS/TASmod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PlaybackSerialiser] Added options and label FileCommands
- Option and Label FileCommands replacing Controlbytes - Interpolation can't be turned off so it will not make a return from Controlbytes - Refined FileCommands overall
- Loading branch information
1 parent
947a29c
commit 2da7c94
Showing
10 changed files
with
242 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...a/com/minecrafttas/tasmod/playback/filecommands/integrated/LabelFileCommandExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package com.minecrafttas.tasmod.playback.filecommands.integrated; | ||
|
||
import java.io.IOException; | ||
|
||
import com.dselent.bigarraylist.BigArrayList; | ||
import com.minecrafttas.tasmod.playback.PlaybackControllerClient.TickContainer; | ||
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand; | ||
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandContainer; | ||
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandExtension; | ||
import com.minecrafttas.tasmod.playback.filecommands.PlaybackFileCommand.PlaybackFileCommandLine; | ||
|
||
public class LabelFileCommandExtension extends PlaybackFileCommandExtension { | ||
|
||
private String labelText = ""; | ||
|
||
BigArrayList<PlaybackFileCommandContainer> label = new BigArrayList<>(); | ||
|
||
@Override | ||
public String name() { | ||
return "tasmod_label@v1"; | ||
} | ||
|
||
@Override | ||
public String[] getFileCommandNames() { | ||
return new String[] { "label" }; | ||
} | ||
|
||
@Override | ||
public void onDeserialiseInlineComment(long tick, TickContainer container, PlaybackFileCommandContainer fileCommandContainer) { | ||
if (fileCommandContainer.containsKey("label")) { | ||
label.add(fileCommandContainer.split("label")); | ||
} | ||
} | ||
|
||
@Override | ||
public void onPlayback(long tick, TickContainer tickContainer) { | ||
PlaybackFileCommandContainer containerInTick = label.get(tick - 1); | ||
if (containerInTick == null) { | ||
return; | ||
} | ||
|
||
PlaybackFileCommandLine line = containerInTick.get("label"); | ||
if (line == null) { | ||
return; | ||
} | ||
|
||
for (PlaybackFileCommand command : line) { | ||
labelText = String.join(", ", command.getArgs()); | ||
} | ||
} | ||
|
||
@Override | ||
public void onClear() { | ||
try { | ||
label.clearMemory(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
label = new BigArrayList<>(); | ||
} | ||
|
||
public String getLabelText() { | ||
return labelText; | ||
} | ||
} |
Oops, something went wrong.