[Tutorial] Play a cutscene video in your mod!

Started by Shocking Artist on Thu, 06/11/2020 - 20:55

Topic category: User side tutorials

[Tutorial] Play a cutscene video in your mod!
Fri, 03/05/2021 - 14:30 (edited)

Before I start, I want to say thank you to Tbroski and Klemen for helping me create this tutorial.

and Yes, the video would not be 4K resolution

No java knowledge is required!

 

First, create a video, make sure it in .mov or .mp4.

Secondly, create a gif using your video using EZGIF, GIPHY or FFMPEG

Thirdly, split the gif into sprites, Klemen recommends the software handbrake

I don't like it so much, I recommend you go for FFMPEG

Be sure to make your video 32-64 FPS, and 300 frames max. A frame rate below that would be laggy in Mcreator. More than 300 frames would use up too much space.

Then, you basically get a folder full of your images from 0 to whatever frame, I have 200 frames, for example.

Import all of them by clicking on the first one and shift on the last one to the "Other Textures" section.

Now to the code part, create a procedure element, and make the trigger on player tick update.

Go to the code, and add the following:

		Entity entity = (Entity) dependencies.get("entity");
		entity.getPersistentData().putDouble("Frame", ((entity.getPersistentData().getDouble("Frame")) + 1));
		entity.getPersistentData().putString("Location",
				(("yourmodid:textures/") + "" + (Math.round((entity.getPersistentData().getDouble("Frame")))) + "" + (".png")));
		if (((entity.getPersistentData().getDouble("Frame")) >= maxframe)) {
			entity.getPersistentData().putDouble("Frame", 0);
		}

Where yourmodid is your mod Id and you should replace maxframe to whatever you last frame is.

Next, create a custom overlay, and change the Base Texture to whatever you want.

Lock the code, and change the line of code that binds your base texture to this:

                Minecraft.getInstance().getTextureManager().bindTexture(new ResourceLocation((entity.getPersistentData().getString("Location"))));

Run your mod and you should be seeing a silky smooth video playing, the video will repeat once it reaches the end.

You can even add sound to the video using basic procedures.

Now I've tought you the basics, you can customize it anyway you want!

Edited by Shocking Artist on Fri, 03/05/2021 - 14:30
Last seen on 20:04, 11. Apr 2021
Joined Aug 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Really nice! However, if we…
Sat, 06/20/2020 - 20:34

Really nice! However, if we have a lot o GIF, we will have a ;lot of textures/pictures, so i think it's bretter to create a folder for each GIF, as we can define the GIf path ourself.

Last seen on 04:08, 7. Jan 2021
Joined Apr 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
so would this work if i…
Tue, 06/30/2020 - 20:55

so would this work if i wanted  to make a "cutscene"in a story mode mod (a mod that has a story that you must follow)

Was waiting for you to…
Tue, 09/01/2020 - 09:46

Was waiting for you to publish this ;) Nicely written, good work!

Last seen on 23:05, 10. Apr 2021
Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Wow i cant believe its…
Sat, 09/05/2020 - 14:28

Wow i cant believe its really possible

Last seen on 21:30, 8. Apr 2021
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
For a 300 frame 30 fps…
Thu, 03/04/2021 - 13:04

For a 300 frame 30 fps cutscene how much storage are we looking at once the mod is exported?