mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-02 06:28:48 +00:00
0.10.0
This commit is contained in:
1 parent
be99313e81
commit
63535e6b3d
79 files changed
+2007
-529
No files matched your search
@@ -3,6 +3,7 @@ package com.moulberry.flashback.exporting;
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import com.moulberry.flashback.Flashback;
|
||||
import com.moulberry.flashback.SneakyThrow;
|
||||
import com.moulberry.flashback.combo_options.AudioCodec;
|
||||
import org.bytedeco.ffmpeg.avutil.AVFrame;
|
||||
import org.bytedeco.ffmpeg.avutil.AVPixFmtDescriptor;
|
||||
import org.bytedeco.ffmpeg.global.avutil;
|
||||
@@ -91,7 +92,7 @@ public class AsyncFFmpegVideoWriter implements AutoCloseable, VideoWriter {
|
||||
|
||||
int audioChannels = 0;
|
||||
if (settings.recordAudio()) {
|
||||
if (settings.stereoAudio()) {
|
||||
if (settings.audioCodec() == AudioCodec.VORBIS || settings.stereoAudio()) {
|
||||
audioChannels = 2;
|
||||
} else {
|
||||
audioChannels = 1;
|
||||
|
||||
@@ -27,11 +27,16 @@ import net.minecraft.Util;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.screens.CreditsAndAttributionScreen;
|
||||
import net.minecraft.client.gui.screens.WinScreen;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.client.renderer.FogRenderer;
|
||||
import net.minecraft.client.renderer.ShaderInstance;
|
||||
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
|
||||
import net.minecraft.client.resources.sounds.SoundInstance;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.util.FormattedCharSequence;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
@@ -129,6 +134,7 @@ public class ExportJob {
|
||||
}
|
||||
this.running = true;
|
||||
Minecraft.getInstance().mouseHandler.releaseMouse();
|
||||
Minecraft.getInstance().getSoundManager().stop();
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
|
||||
@@ -160,9 +166,21 @@ public class ExportJob {
|
||||
this.running = false;
|
||||
this.shouldChangeFramebufferSize = false;
|
||||
|
||||
// Reset display size
|
||||
Minecraft.getInstance().options.guiScale().set(oldGuiScale);
|
||||
Minecraft.getInstance().resizeDisplay();
|
||||
|
||||
// Refreeze server & client
|
||||
replayServer.replayPaused = true;
|
||||
ClientLevel level = Minecraft.getInstance().level;
|
||||
if (level != null) {
|
||||
level.tickRateManager().setFrozen(true);
|
||||
}
|
||||
|
||||
Minecraft.getInstance().getSoundManager().stop();
|
||||
Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_CHIME, 1.0f));
|
||||
Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BELL, 1.0f));
|
||||
|
||||
try {
|
||||
Files.deleteIfExists(exportTempFile);
|
||||
} catch (IOException ignored) {}
|
||||
@@ -210,7 +228,6 @@ public class ExportJob {
|
||||
}
|
||||
Minecraft.getInstance().resizeDisplay();
|
||||
|
||||
|
||||
DoubleList ticks = calculateTicks(this.settings.editorState(), this.settings.startTick(), this.settings.endTick(), this.settings.framerate());
|
||||
|
||||
int clientTickCount = 0;
|
||||
|
||||
@@ -12,6 +12,8 @@ import org.lwjgl.system.MemoryUtil;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@@ -38,6 +40,9 @@ public class PNGSequenceVideoWriter implements VideoWriter {
|
||||
}
|
||||
|
||||
private Thread createEncodeThread() {
|
||||
boolean outputIsDirectory = Files.isDirectory(this.settings.output());
|
||||
boolean encodeMultiple = outputIsDirectory || this.settings.startTick() != this.settings.endTick();
|
||||
|
||||
Thread encodeThread = new Thread(() -> {
|
||||
while (true) {
|
||||
NativeImage src;
|
||||
@@ -69,8 +74,20 @@ public class PNGSequenceVideoWriter implements VideoWriter {
|
||||
}
|
||||
|
||||
this.sequenceNumber += 1;
|
||||
String filename = String.format("%04d.png", this.sequenceNumber);
|
||||
src.writeToFile(this.settings.output().resolve(filename));
|
||||
|
||||
Path output = this.settings.output();
|
||||
if (encodeMultiple) {
|
||||
if (outputIsDirectory) {
|
||||
String filename = String.format("%04d.png", this.sequenceNumber);
|
||||
src.writeToFile(output.resolve(filename));
|
||||
} else {
|
||||
String filename = output.getFileName().toString();
|
||||
filename += String.format("-%04d.png", this.sequenceNumber);
|
||||
src.writeToFile(output.getParent().resolve(filename));
|
||||
}
|
||||
} else {
|
||||
src.writeToFile(this.settings.output());
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
this.threadedError.set(t);
|
||||
this.finishEncodeThread.set(true);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.moulberry.flashback.exporting;
|
||||
|
||||
import com.moulberry.flashback.Flashback;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.multiplayer.PlayerInfo;
|
||||
@@ -54,14 +55,14 @@ public class PerfectFrames {
|
||||
|
||||
if (level != null) {
|
||||
if (forceFrameReady) {
|
||||
System.err.println("Waiting for skin loading took too long, ignoring...");
|
||||
Flashback.LOGGER.error("Waiting for skin loading took too long, ignoring...");
|
||||
for (AbstractClientPlayer player : level.players()) {
|
||||
if (player == Minecraft.getInstance().player) {
|
||||
continue;
|
||||
}
|
||||
PlayerInfo playerInfo = player.getPlayerInfo();
|
||||
if (playerInfo != null && !skinManager.getOrLoad(playerInfo.getProfile()).isDone()) {
|
||||
System.err.println("Took too long to load skin for " + player.getUUID());
|
||||
Flashback.LOGGER.error("Took too long to load skin for {}", player.getUUID());
|
||||
ignoreSkinLoading.add(player.getUUID());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user