Make use of the source remapping feature of The Preprocessor plugin

This commit is contained in:
Jonas Herzig
2019-04-24 15:02:33 +02:00
parent 6127e0a027
commit 2ee91515f7
72 changed files with 401 additions and 1121 deletions

View File

@@ -176,7 +176,7 @@ public class RenderSettings {
switch (Util.getOSType()) {
case WINDOWS:
// Allow windows users to unpack the ffmpeg archive into a sub-folder of their .minecraft folder
File inDotMinecraft = new File(MCVer.mcDataDir(MCVer.getMinecraft()), "ffmpeg/bin/ffmpeg.exe");
File inDotMinecraft = new File(MCVer.getMinecraft().gameDir, "ffmpeg/bin/ffmpeg.exe");
if (inDotMinecraft.exists()) {
LOGGER.debug("FFmpeg found in .minecraft/ffmpeg");
return inDotMinecraft.getAbsolutePath();

View File

@@ -5,22 +5,12 @@ import com.replaymod.core.ReplayMod;
import com.replaymod.render.utils.RenderJob;
import com.replaymod.replay.events.ReplayCloseEvent;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.ReportedException;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
//#if MC>=10800
import net.minecraftforge.fml.common.Mod;
//#if MC>=11300
import net.minecraftforge.eventbus.api.SubscribeEvent;
//#else
//$$ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
//#endif
//#else
//$$ import cpw.mods.fml.common.Mod;
//$$ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
//#endif
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
@@ -61,17 +51,17 @@ public class ReplayModRender implements Module {
public File getVideoFolder() {
String path = core.getSettingsRegistry().get(Setting.RENDER_PATH);
File folder = new File(path.startsWith("./") ? mcDataDir(core.getMinecraft()) : null, path);
File folder = new File(path.startsWith("./") ? core.getMinecraft().gameDir : null, path);
try {
FileUtils.forceMkdir(folder);
} catch (IOException e) {
throw newReportedException(CrashReport.makeCrashReport(e, "Cannot create video folder."));
throw new ReportedException(CrashReport.makeCrashReport(e, "Cannot create video folder."));
}
return folder;
}
public Path getRenderSettingsPath() {
return mcDataDir(core.getMinecraft()).toPath().resolve("config/replaymod-rendersettings.json");
return core.getMinecraft().gameDir.toPath().resolve("config/replaymod-rendersettings.json");
}
public List<RenderJob> getRenderQueue() {

View File

@@ -68,7 +68,7 @@ public class VideoWriter implements FrameConsumer<RGBFrame> {
} catch (IOException e) {
throw new NoFFmpegException(e);
}
File exportLogFile = new File(MCVer.mcDataDir(MCVer.getMinecraft()), "export.log");
File exportLogFile = new File(MCVer.getMinecraft().gameDir, "export.log");
OutputStream exportLogOut = new TeeOutputStream(new FileOutputStream(exportLogFile), ffmpegLog);
new StreamPipe(process.getInputStream(), exportLogOut).start();
new StreamPipe(process.getErrorStream(), exportLogOut).start();

View File

@@ -106,7 +106,7 @@ public class BlendMeshBuilder
throw new IllegalStateException("Not building!");
} else {
if (!wellBehaved) {
getBuffer(Tessellator.getInstance()).finishDrawing();
Tessellator.getInstance().getBuffer().finishDrawing();
}
//#if MC<10809

View File

@@ -12,6 +12,7 @@ import com.replaymod.render.blend.exporters.TileEntityExporter;
//#endif
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.crash.ReportedException;
import org.apache.commons.io.output.NullOutputStream;
import org.blender.utils.BlenderFactory;
import org.cakelab.blender.io.BlenderFile;
@@ -82,7 +83,7 @@ public class BlendState implements Exporter {
CrashReport report = CrashReport.makeCrashReport(e, "Setup of blend exporter");
CrashReportCategory category = report.makeCategory("Exporter");
addDetail(category, "Exporter", exporter::toString);
throw newReportedException(report);
throw new ReportedException(report);
}
}
}
@@ -96,7 +97,7 @@ public class BlendState implements Exporter {
CrashReport report = CrashReport.makeCrashReport(e, "Tear down of blend exporter");
CrashReportCategory category = report.makeCategory("Exporter");
addDetail(category, "Exporter", exporter::toString);
throw newReportedException(report);
throw new ReportedException(report);
}
}
@@ -134,7 +135,7 @@ public class BlendState implements Exporter {
CrashReportCategory category = report.makeCategory("Exporter");
addDetail(category, "Exporter", exporter::toString);
addDetail(category, "Frame", () -> String.valueOf(frame));
throw newReportedException(report);
throw new ReportedException(report);
}
}
}
@@ -149,7 +150,7 @@ public class BlendState implements Exporter {
CrashReportCategory category = report.makeCategory("Exporter");
addDetail(category, "Exporter", exporter::toString);
addDetail(category, "Frame", () -> String.valueOf(frame));
throw newReportedException(report);
throw new ReportedException(report);
}
}

View File

@@ -26,7 +26,6 @@ import java.io.IOException;
import java.util.IdentityHashMap;
import java.util.Map;
import static com.replaymod.core.versions.MCVer.*;
import static com.replaymod.render.blend.Util.getGlModelViewMatrix;
public class ParticlesExporter implements Exporter {
@@ -111,9 +110,9 @@ public class ParticlesExporter implements Exporter {
// renderer translate there again.
// Instead of actually translating, we just add the translation on the current model-view-matrix.
Matrix4f modelView = getGlModelViewMatrix();
double dx = particle.prevPosX + (particle.posX - particle.prevPosX) * renderPartialTicks - interpPosX();
double dy = particle.prevPosY + (particle.posY - particle.prevPosY) * renderPartialTicks - interpPosY();
double dz = particle.prevPosZ + (particle.posZ - particle.prevPosZ) * renderPartialTicks - interpPosZ();
double dx = particle.prevPosX + (particle.posX - particle.prevPosX) * renderPartialTicks - Particle.interpPosX;
double dy = particle.prevPosY + (particle.posY - particle.prevPosY) * renderPartialTicks - Particle.interpPosY;
double dz = particle.prevPosZ + (particle.posZ - particle.prevPosZ) * renderPartialTicks - Particle.interpPosZ;
Vector3f offset = new Vector3f((float) dx, (float) dy, (float) dz);
Matrix4f.translate(offset, modelView, modelView);
renderState.pushModelView(modelView);

View File

@@ -8,14 +8,11 @@ import com.replaymod.render.rendering.FrameCapturer;
import com.replaymod.render.shader.Program;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.ReportedException;
import net.minecraft.util.ResourceLocation;
//#if MC>=10800
import static net.minecraft.client.renderer.GlStateManager.*;
//#else
//$$ import com.replaymod.render.hooks.GLStateTracker.BooleanState;
//$$ import static com.replaymod.core.versions.MCVer.GlStateManager.*;
//#endif
import static net.minecraft.client.renderer.GlStateManager.BooleanState;
import java.io.IOException;
@@ -76,7 +73,7 @@ public class ODSFrameCapturer implements FrameCapturer<ODSOpenGlFrame> {
leftEyeVariable = shaderProgram.getUniformVariable("leftEye");
directionVariable = shaderProgram.getUniformVariable("direction");
} catch (Exception e) {
throw newReportedException(CrashReport.makeCrashReport(e, "Creating ODS shaders"));
throw new ReportedException(CrashReport.makeCrashReport(e, "Creating ODS shaders"));
}
}

View File

@@ -13,12 +13,12 @@ import de.johni0702.minecraft.gui.layout.HorizontalLayout;
import de.johni0702.minecraft.gui.layout.VerticalLayout;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.crash.ReportedException;
import java.util.Arrays;
import java.util.function.Consumer;
import static com.replaymod.core.versions.MCVer.addDetail;
import static com.replaymod.core.versions.MCVer.newReportedException;
import static com.replaymod.render.ReplayModRender.LOGGER;
public class GuiExportFailed extends GuiScreen {
@@ -34,7 +34,7 @@ public class GuiExportFailed extends GuiScreen {
CrashReportCategory details = crashReport.makeCategory("Export details");
addDetail(details, "Settings", settings::toString);
addDetail(details, "FFmpeg log", e::getLog);
throw newReportedException(crashReport);
throw new ReportedException(crashReport);
} else {
// If they have, ask them whether it was intentional
GuiExportFailed gui = new GuiExportFailed(e, doRestart);

View File

@@ -4,6 +4,7 @@ import com.replaymod.core.versions.MCVer;
import lombok.RequiredArgsConstructor;
import net.minecraft.client.Minecraft;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.ReportedException;
//#if MC>=11300
import org.lwjgl.glfw.GLFW;
@@ -16,8 +17,6 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import static com.replaymod.core.versions.MCVer.newReportedException;
public class Pipeline<R extends Frame, P extends Frame> implements Runnable {
private final FrameCapturer<R> capturer;
@@ -84,7 +83,7 @@ public class Pipeline<R extends Frame, P extends Frame> implements Runnable {
consumer.close();
} catch (Throwable t) {
CrashReport crashReport = CrashReport.makeCrashReport(t, "Cleaning up rendering pipeline");
throw newReportedException(crashReport);
throw new ReportedException(crashReport);
}
}

View File

@@ -25,6 +25,8 @@ import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.crash.ReportedException;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.Timer;
//#if MC>=11300
@@ -35,12 +37,6 @@ import org.lwjgl.glfw.GLFW;
//$$ import org.lwjgl.opengl.Display;
//#endif
//#if MC>=10904
import net.minecraft.util.SoundCategory;
//#else
//$$ import net.minecraft.client.audio.SoundCategory;
//#endif
//#if MC>=10800
import com.replaymod.render.hooks.ChunkLoadingRenderGlobal;
import static net.minecraft.client.renderer.GlStateManager.*;
@@ -165,7 +161,7 @@ public class VideoRenderer implements RenderInfo {
renderingPipeline.run();
if (mc.hasCrashed) {
throw newReportedException(mc.crashReporter);
throw new ReportedException(mc.crashReporter);
}
if (settings.isInjectSphericalMetadata()) {