API for developers to play cutscenes in their mods?
Opened this issue ยท 7 comments
Developers create camera paths in game. Then press export as replay file. They can then, using the library, import the replay file (from a resource pack/path) and play it.
The chunks from the replay file will be loaded temporarily and any players/entities loaded aswell.
Then the developer can play, pause, rewind, speed up, slow down etc. via code.
See this: https://github.com/raphydaphy/CutsceneAPI
An example, but its for 1.14, and very outdated.
From the game's PoV, replays appear to be a (more or less) regular server. And just like you cannot be connected to two servers at the same time, you cannot play a replay while connected to another server or single player. That seems like a deal breaker for what you want or am I missing something?
Personally, i'm suggesting this for a massive single player mod i've been working on. It relies heavily on story. Even if it requires the player to leave the world silently then play the replay, then re-join seamlessy, it would work.
If the case is that the player needs to leave the world to play the cutscene, the loading scene can easily be replaced with mixins, to images etc.
Hm, I don't think that's useful enough in general to warrant creating an API for it.
Seems easier and much more flexible to just update that other project.
If you want to play with it nonetheless, here's a piece of code which loads a replay from a file, plays it until there's a world, then does some processing (here you could continue playing the replay and move the player as required for your cutscene) and then, some time later, closes the replay (before recursively loading the next one):
ReplayMod/src/main/java/com/replaymod/render/gui/GuiRenderQueue.java
Lines 217 to 257 in 57c7362