Added Option to force load all chunks when rendering
Rewrote a lot of the Settings code Started destroying the ReplayProcess, gonna fix that ASAP
This commit is contained in:
Binary file not shown.
@@ -21,6 +21,7 @@ import eu.crushedpixel.replaymod.events.GuiEventHandler;
|
|||||||
import eu.crushedpixel.replaymod.events.GuiReplayOverlay;
|
import eu.crushedpixel.replaymod.events.GuiReplayOverlay;
|
||||||
import eu.crushedpixel.replaymod.events.KeyInputHandler;
|
import eu.crushedpixel.replaymod.events.KeyInputHandler;
|
||||||
import eu.crushedpixel.replaymod.events.RecordingHandler;
|
import eu.crushedpixel.replaymod.events.RecordingHandler;
|
||||||
|
import eu.crushedpixel.replaymod.events.TickAndRenderListener;
|
||||||
import eu.crushedpixel.replaymod.online.authentication.AuthenticationHandler;
|
import eu.crushedpixel.replaymod.online.authentication.AuthenticationHandler;
|
||||||
import eu.crushedpixel.replaymod.recording.ConnectionEventHandler;
|
import eu.crushedpixel.replaymod.recording.ConnectionEventHandler;
|
||||||
import eu.crushedpixel.replaymod.registry.KeybindRegistry;
|
import eu.crushedpixel.replaymod.registry.KeybindRegistry;
|
||||||
@@ -97,6 +98,10 @@ public class ReplayMod
|
|||||||
FMLCommonHandler.instance().bus().register(overlay);
|
FMLCommonHandler.instance().bus().register(overlay);
|
||||||
MinecraftForge.EVENT_BUS.register(overlay);
|
MinecraftForge.EVENT_BUS.register(overlay);
|
||||||
|
|
||||||
|
TickAndRenderListener tarl = new TickAndRenderListener();
|
||||||
|
FMLCommonHandler.instance().bus().register(tarl);
|
||||||
|
MinecraftForge.EVENT_BUS.register(tarl);
|
||||||
|
|
||||||
KeybindRegistry.initialize();
|
KeybindRegistry.initialize();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent;
|
|||||||
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
|
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import eu.crushedpixel.replaymod.ReplayMod;
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
|
import eu.crushedpixel.replaymod.gui.GuiCancelRender;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiReplaySaving;
|
import eu.crushedpixel.replaymod.gui.GuiReplaySaving;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiReplaySettings;
|
import eu.crushedpixel.replaymod.gui.GuiReplaySettings;
|
||||||
@@ -59,7 +60,7 @@ public class GuiEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onGui(GuiOpenEvent event) {
|
public void onGui(GuiOpenEvent event) {
|
||||||
if(VideoWriter.isRecording()) {
|
if(VideoWriter.isRecording() && !(event.gui instanceof GuiCancelRender)) {
|
||||||
event.gui = null;
|
event.gui = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,36 +3,26 @@ package eu.crushedpixel.replaymod.events;
|
|||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Gui;
|
import net.minecraft.client.gui.Gui;
|
||||||
import net.minecraft.client.gui.GuiChat;
|
import net.minecraft.client.gui.GuiChat;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.client.event.MouseEvent;
|
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
|
||||||
import net.minecraftforge.client.event.RenderHandEvent;
|
|
||||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
|
||||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
|
||||||
|
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
import org.lwjgl.opengl.Display;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.entities.CameraEntity;
|
import eu.crushedpixel.replaymod.entities.CameraEntity;
|
||||||
|
import eu.crushedpixel.replaymod.gui.GuiCancelRender;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiReplaySpeedSlider;
|
import eu.crushedpixel.replaymod.gui.GuiReplaySpeedSlider;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiSpectateSelection;
|
import eu.crushedpixel.replaymod.gui.GuiSpectateSelection;
|
||||||
import eu.crushedpixel.replaymod.gui.elements.GuiMouseInput;
|
import eu.crushedpixel.replaymod.gui.elements.GuiMouseInput;
|
||||||
@@ -40,12 +30,10 @@ import eu.crushedpixel.replaymod.holders.Keyframe;
|
|||||||
import eu.crushedpixel.replaymod.holders.Position;
|
import eu.crushedpixel.replaymod.holders.Position;
|
||||||
import eu.crushedpixel.replaymod.holders.PositionKeyframe;
|
import eu.crushedpixel.replaymod.holders.PositionKeyframe;
|
||||||
import eu.crushedpixel.replaymod.holders.TimeKeyframe;
|
import eu.crushedpixel.replaymod.holders.TimeKeyframe;
|
||||||
import eu.crushedpixel.replaymod.reflection.MCPNames;
|
import eu.crushedpixel.replaymod.recording.ConnectionEventHandler;
|
||||||
import eu.crushedpixel.replaymod.registry.ReplayGuiRegistry;
|
import eu.crushedpixel.replaymod.registry.ReplayGuiRegistry;
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayProcess;
|
|
||||||
import eu.crushedpixel.replaymod.utils.MouseUtils;
|
import eu.crushedpixel.replaymod.utils.MouseUtils;
|
||||||
import eu.crushedpixel.replaymod.video.ReplayScreenshot;
|
|
||||||
import eu.crushedpixel.replaymod.video.VideoWriter;
|
import eu.crushedpixel.replaymod.video.VideoWriter;
|
||||||
|
|
||||||
public class GuiReplayOverlay extends Gui {
|
public class GuiReplayOverlay extends Gui {
|
||||||
@@ -76,102 +64,17 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
|
|
||||||
private long lastSystemTime = System.currentTimeMillis();
|
private long lastSystemTime = System.currentTimeMillis();
|
||||||
|
|
||||||
private ResourceLocation guiLocation = new ResourceLocation("replaymod", "replay_gui.png");
|
private ResourceLocation replay_gui = new ResourceLocation("replaymod", "replay_gui.png");
|
||||||
private ResourceLocation keyframeLocation = new ResourceLocation("replaymod", "extended_gui.png");
|
private ResourceLocation extended_gui = new ResourceLocation("replaymod", "extended_gui.png");
|
||||||
private ResourceLocation timelineLocation = new ResourceLocation("replaymod", "timeline_icons.png");
|
private ResourceLocation timeline_icons = new ResourceLocation("replaymod", "timeline_icons.png");
|
||||||
|
|
||||||
private GuiReplaySpeedSlider speedSlider;
|
private GuiReplaySpeedSlider speedSlider;
|
||||||
|
|
||||||
private boolean mouseDown = false;
|
private boolean mouseDown = false;
|
||||||
|
|
||||||
private static boolean requestScreenshot = false;
|
|
||||||
|
|
||||||
private static Field isGamePaused;
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
isGamePaused = Minecraft.class.getDeclaredField(MCPNames.field("field_71445_n"));
|
|
||||||
isGamePaused.setAccessible(true);
|
|
||||||
} catch(Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//private Field drawBlockOutline;
|
|
||||||
|
|
||||||
public static void requestScreenshot() {
|
|
||||||
requestScreenshot = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GuiReplayOverlay() {
|
|
||||||
try {
|
|
||||||
// drawBlockOutline = EntityRenderer.class.getDeclaredField(MCPNames.field("field_175073_D"));
|
|
||||||
// drawBlockOutline.setAccessible(true);
|
|
||||||
// drawBlockOutline.set(Minecraft.getMinecraft().entityRenderer, false);
|
|
||||||
} catch(Exception e) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
//@SubscribeEvent TODO
|
|
||||||
public void renderHand(RenderHandEvent event) {
|
|
||||||
if(ReplayHandler.isInReplay()) {
|
|
||||||
event.setCanceled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void tick(TickEvent event) {
|
|
||||||
if(!ReplayHandler.isInReplay()) return;
|
|
||||||
if(ReplayHandler.getCameraEntity() != null)
|
|
||||||
ReplayHandler.getCameraEntity().updateMovement();
|
|
||||||
if(!ReplayHandler.isInPath()) onMouseMove(new MouseEvent());
|
|
||||||
FMLCommonHandler.instance().bus().post(new InputEvent.KeyInputEvent());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private double lastX, lastY, lastZ;
|
|
||||||
private float lastPitch, lastYaw;
|
|
||||||
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onChangeView(MouseEvent event) {
|
|
||||||
if(ReplayHandler.isInPath()) {
|
|
||||||
event.setCanceled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onRenderWorld(RenderWorldLastEvent event)
|
|
||||||
throws IllegalAccessException, IllegalArgumentException,
|
|
||||||
InvocationTargetException, IOException {
|
|
||||||
if(!ReplayHandler.isInReplay()) return;
|
|
||||||
if(ReplayHandler.isInPath()) ReplayProcess.unblockAndTick();
|
|
||||||
if(ReplayHandler.isCamera()) ReplayHandler.setCameraEntity(ReplayHandler.getCameraEntity());
|
|
||||||
if(ReplayHandler.isInReplay() && ReplayHandler.isPaused()) {
|
|
||||||
if(mc != null && mc.thePlayer != null)
|
|
||||||
MinecraftTicker.runMouseKeyboardTick(mc);
|
|
||||||
}
|
|
||||||
if((mc.getRenderViewEntity() == mc.thePlayer || !mc.getRenderViewEntity().isEntityAlive())
|
|
||||||
&& ReplayHandler.getCameraEntity() != null && !ReplayHandler.isInPath()) {
|
|
||||||
ReplayHandler.spectateCamera();
|
|
||||||
} else if(!ReplayHandler.isCamera()) {
|
|
||||||
lastX = mc.getRenderViewEntity().posX;
|
|
||||||
lastY = mc.getRenderViewEntity().posY;
|
|
||||||
lastZ = mc.getRenderViewEntity().posZ;
|
|
||||||
lastPitch = mc.getRenderViewEntity().rotationPitch;
|
|
||||||
lastYaw = mc.getRenderViewEntity().rotationYaw;
|
|
||||||
}
|
|
||||||
if(requestScreenshot) {
|
|
||||||
requestScreenshot = false;
|
|
||||||
ReplayScreenshot.saveScreenshot(mc.getFramebuffer());
|
|
||||||
}
|
|
||||||
if(mc.isGamePaused() && ReplayHandler.isInPath()) {
|
|
||||||
isGamePaused.set(mc, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resetUI() throws Exception {
|
public void resetUI() throws Exception {
|
||||||
if(FMLClientHandler.instance().isGUIOpen(GuiMouseInput.class)) {
|
if(FMLClientHandler.instance().isGUIOpen(GuiMouseInput.class)) {
|
||||||
mc.displayGuiScreen((GuiScreen)null);
|
mc.displayGuiScreen(null);
|
||||||
}
|
}
|
||||||
ReplayHandler.setRealTimelineCursor(0);
|
ReplayHandler.setRealTimelineCursor(0);
|
||||||
speedSlider = new GuiReplaySpeedSlider(1, sliderX, sliderY, "Speed");
|
speedSlider = new GuiReplaySpeedSlider(1, sliderX, sliderY, "Speed");
|
||||||
@@ -179,12 +82,22 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onRenderGui(RenderGameOverlayEvent event) {
|
public void onRenderGui(RenderGameOverlayEvent event) {
|
||||||
if(VideoWriter.isRecording()) {
|
if(VideoWriter.isRecording() && !(mc.currentScreen instanceof GuiCancelRender)) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void renderRecordingIndicator(RenderGameOverlayEvent.Post event) {
|
||||||
|
if(!ReplayHandler.isInReplay() && ReplayMod.replaySettings.showRecordingIndicator() && ConnectionEventHandler.isRecording()) {
|
||||||
|
GlStateManager.resetColor();
|
||||||
|
GlStateManager.enableAlpha();
|
||||||
|
mc.renderEngine.bindTexture(replay_gui);
|
||||||
|
this.drawModalRectWithCustomSizedTexture(10, 10, 40, 21, 16, 16, 64, 64);
|
||||||
|
this.drawString(mc.fontRendererObj, "RECORDING", 30, 18-(mc.fontRendererObj.FONT_HEIGHT/2), Color.WHITE.getRGB());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onRenderGui(RenderGameOverlayEvent.Post event) throws IllegalArgumentException, IllegalAccessException {
|
public void onRenderGui(RenderGameOverlayEvent.Post event) throws IllegalArgumentException, IllegalAccessException {
|
||||||
|
|
||||||
@@ -192,23 +105,13 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//System.out.println(System.currentTimeMillis()+" | "+MCTimerHandler.getTicks()+" | "+MCTimerHandler.getPartialTicks());
|
|
||||||
|
|
||||||
if(!ReplayGuiRegistry.hidden) ReplayGuiRegistry.hide();
|
if(!ReplayGuiRegistry.hidden) ReplayGuiRegistry.hide();
|
||||||
|
|
||||||
if(FMLClientHandler.instance().isGUIOpen(GuiChat.class) || FMLClientHandler.instance().isGUIOpen(GuiInventory.class)) {
|
if(FMLClientHandler.instance().isGUIOpen(GuiChat.class) || FMLClientHandler.instance().isGUIOpen(GuiInventory.class)) {
|
||||||
mc.displayGuiScreen(new GuiMouseInput());
|
mc.displayGuiScreen(new GuiMouseInput());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event.type == ElementType.PLAYER_LIST) {
|
|
||||||
if(event.isCancelable()) {
|
|
||||||
event.setCanceled(true);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
// drawBlockOutline.set(Minecraft.getMinecraft().entityRenderer, false);
|
|
||||||
|
|
||||||
if(!ReplayHandler.isInReplay()) {
|
if(!ReplayHandler.isInReplay()) {
|
||||||
return;
|
return;
|
||||||
@@ -247,7 +150,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
x = 20;
|
x = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.renderEngine.bindTexture(guiLocation);
|
mc.renderEngine.bindTexture(replay_gui);
|
||||||
|
|
||||||
GlStateManager.resetColor();
|
GlStateManager.resetColor();
|
||||||
this.drawModalRectWithCustomSizedTexture(ppButtonX, ppButtonY, x, y, 20, 20, 64, 64);
|
this.drawModalRectWithCustomSizedTexture(ppButtonX, ppButtonY, x, y, 20, 20, 64, 64);
|
||||||
@@ -277,7 +180,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
double time = perc*(double)ReplayHandler.getReplayLength();
|
double time = perc*(double)ReplayHandler.getReplayLength();
|
||||||
|
|
||||||
if(time < ReplayHandler.getReplayTime()) {
|
if(time < ReplayHandler.getReplayTime()) {
|
||||||
mc.displayGuiScreen((GuiScreen)null);
|
mc.displayGuiScreen(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraEntity cam = ReplayHandler.getCameraEntity();
|
CameraEntity cam = ReplayHandler.getCameraEntity();
|
||||||
@@ -315,7 +218,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
x = 20;
|
x = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.renderEngine.bindTexture(timelineLocation);
|
mc.renderEngine.bindTexture(timeline_icons);
|
||||||
|
|
||||||
GlStateManager.resetColor();
|
GlStateManager.resetColor();
|
||||||
this.drawModalRectWithCustomSizedTexture(exportButtonX, exportButtonY, x, y, 20, 20, 64, 64);
|
this.drawModalRectWithCustomSizedTexture(exportButtonX, exportButtonY, x, y, 20, 20, 64, 64);
|
||||||
@@ -342,7 +245,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
y += 20;
|
y += 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.renderEngine.bindTexture(keyframeLocation);
|
mc.renderEngine.bindTexture(extended_gui);
|
||||||
|
|
||||||
if(hover && Mouse.isButtonDown(0) && isClick() && FMLClientHandler.instance().isGUIOpen(GuiMouseInput.class)) {
|
if(hover && Mouse.isButtonDown(0) && isClick() && FMLClientHandler.instance().isGUIOpen(GuiMouseInput.class)) {
|
||||||
if(ReplayHandler.getSelected() == null || !(ReplayHandler.getSelected() instanceof PositionKeyframe)) {
|
if(ReplayHandler.getSelected() == null || !(ReplayHandler.getSelected() instanceof PositionKeyframe)) {
|
||||||
@@ -383,7 +286,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.renderEngine.bindTexture(keyframeLocation);
|
mc.renderEngine.bindTexture(extended_gui);
|
||||||
|
|
||||||
if(hover && Mouse.isButtonDown(0) && isClick() && FMLClientHandler.instance().isGUIOpen(GuiMouseInput.class)) {
|
if(hover && Mouse.isButtonDown(0) && isClick() && FMLClientHandler.instance().isGUIOpen(GuiMouseInput.class)) {
|
||||||
if(ReplayHandler.getSelected() == null || !(ReplayHandler.getSelected() instanceof TimeKeyframe)) {
|
if(ReplayHandler.getSelected() == null || !(ReplayHandler.getSelected() instanceof TimeKeyframe)) {
|
||||||
@@ -443,7 +346,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
int full = maxX-tl_end_width;
|
int full = maxX-tl_end_width;
|
||||||
|
|
||||||
GlStateManager.resetColor();
|
GlStateManager.resetColor();
|
||||||
mc.renderEngine.bindTexture(guiLocation);
|
mc.renderEngine.bindTexture(replay_gui);
|
||||||
this.drawModalRectWithCustomSizedTexture(minX, y, tl_begin_x, tl_y, tl_begin_width, 22, 64, 64);
|
this.drawModalRectWithCustomSizedTexture(minX, y, tl_begin_x, tl_y, tl_begin_width, 22, 64, 64);
|
||||||
|
|
||||||
for(int i=minX+tl_begin_width; i<maxX-tl_end_width; i += tl_end_x-tl_begin_width) {
|
for(int i=minX+tl_begin_width; i<maxX-tl_end_width; i += tl_end_x-tl_begin_width) {
|
||||||
@@ -494,7 +397,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
|
|
||||||
//the real timeline
|
//the real timeline
|
||||||
GlStateManager.resetColor();
|
GlStateManager.resetColor();
|
||||||
mc.renderEngine.bindTexture(guiLocation);
|
mc.renderEngine.bindTexture(replay_gui);
|
||||||
this.drawModalRectWithCustomSizedTexture(minX, y, tl_begin_x, tl_y, tl_begin_width, 22, 64, 64);
|
this.drawModalRectWithCustomSizedTexture(minX, y, tl_begin_x, tl_y, tl_begin_width, 22, 64, 64);
|
||||||
|
|
||||||
for(int i=minX+tl_begin_width; i<maxX-tl_end_width; i += tl_end_x-tl_begin_width) {
|
for(int i=minX+tl_begin_width; i<maxX-tl_end_width; i += tl_end_x-tl_begin_width) {
|
||||||
@@ -508,7 +411,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
//Time Slider
|
//Time Slider
|
||||||
int yo = y+22+1;
|
int yo = y+22+1;
|
||||||
GlStateManager.resetColor();
|
GlStateManager.resetColor();
|
||||||
mc.renderEngine.bindTexture(timelineLocation);
|
mc.renderEngine.bindTexture(timeline_icons);
|
||||||
this.drawModalRectWithCustomSizedTexture(minX, yo, sl_begin_x, sl_y, 2, 9, 64, 64);
|
this.drawModalRectWithCustomSizedTexture(minX, yo, sl_begin_x, sl_y, 2, 9, 64, 64);
|
||||||
|
|
||||||
for(int i=minX+2; i<maxX-1; i+= sl_end_x-2) {
|
for(int i=minX+2; i<maxX-1; i+= sl_end_x-2) {
|
||||||
@@ -697,7 +600,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
double rel_x = (float)real_width*perc;
|
double rel_x = (float)real_width*perc;
|
||||||
|
|
||||||
int real_x = (int)Math.round((minX+tl_begin_width)+rel_x);
|
int real_x = (int)Math.round((minX+tl_begin_width)+rel_x);
|
||||||
mc.renderEngine.bindTexture(this.guiLocation);
|
mc.renderEngine.bindTexture(this.replay_gui);
|
||||||
|
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
this.drawModalRectWithCustomSizedTexture(real_x-3, y+3, 44, 0, 8, 16, 64, 64);
|
this.drawModalRectWithCustomSizedTexture(real_x-3, y+3, 44, 0, 8, 16, 64, 64);
|
||||||
@@ -706,7 +609,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
|
|
||||||
|
|
||||||
//Draw Keyframe logos
|
//Draw Keyframe logos
|
||||||
mc.renderEngine.bindTexture(timelineLocation);
|
mc.renderEngine.bindTexture(timeline_icons);
|
||||||
for(Keyframe kf : ReplayHandler.getKeyframes()) {
|
for(Keyframe kf : ReplayHandler.getKeyframes()) {
|
||||||
if(kf.getRealTimestamp() > right_real) break;
|
if(kf.getRealTimestamp() > right_real) break;
|
||||||
if(kf.getRealTimestamp() >= left_real) {
|
if(kf.getRealTimestamp() >= left_real) {
|
||||||
@@ -758,7 +661,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
dx = 20;
|
dx = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.renderEngine.bindTexture(guiLocation);
|
mc.renderEngine.bindTexture(replay_gui);
|
||||||
|
|
||||||
GlStateManager.resetColor();
|
GlStateManager.resetColor();
|
||||||
this.drawModalRectWithCustomSizedTexture(r_ppButtonX, r_ppButtonY, dx, dy, 20, 20, 64, 64);
|
this.drawModalRectWithCustomSizedTexture(r_ppButtonX, r_ppButtonY, dx, dy, 20, 20, 64, 64);
|
||||||
@@ -847,39 +750,4 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onMouseMove(MouseEvent event) {
|
|
||||||
if(!ReplayHandler.isInReplay()) return;
|
|
||||||
boolean flag = Display.isActive();
|
|
||||||
flag = true;
|
|
||||||
|
|
||||||
mc.mcProfiler.startSection("mouse");
|
|
||||||
|
|
||||||
if (flag && Minecraft.isRunningOnMac && mc.inGameHasFocus && !Mouse.isInsideWindow())
|
|
||||||
{
|
|
||||||
Mouse.setGrabbed(false);
|
|
||||||
Mouse.setCursorPosition(Display.getWidth() / 2, Display.getHeight() / 2);
|
|
||||||
Mouse.setGrabbed(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mc.inGameHasFocus && flag)
|
|
||||||
{
|
|
||||||
mc.mouseHelper.mouseXYChange();
|
|
||||||
float f1 = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
|
|
||||||
float f2 = f1 * f1 * f1 * 8.0F;
|
|
||||||
float f3 = (float)mc.mouseHelper.deltaX * f2;
|
|
||||||
float f4 = (float)mc.mouseHelper.deltaY * f2;
|
|
||||||
byte b0 = 1;
|
|
||||||
|
|
||||||
if (mc.gameSettings.invertMouse)
|
|
||||||
{
|
|
||||||
b0 = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ReplayHandler.getCameraEntity() != null) {
|
|
||||||
ReplayHandler.getCameraEntity().setAngles(f3, f4 * (float)b0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,22 @@
|
|||||||
package eu.crushedpixel.replaymod.events;
|
package eu.crushedpixel.replaymod.events;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiIngame;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
|
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
|
||||||
import eu.crushedpixel.replaymod.ReplayMod;
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.entities.CameraEntity.MoveDirection;
|
import eu.crushedpixel.replaymod.entities.CameraEntity.MoveDirection;
|
||||||
|
import eu.crushedpixel.replaymod.gui.GuiCancelRender;
|
||||||
import eu.crushedpixel.replaymod.gui.elements.GuiMouseInput;
|
import eu.crushedpixel.replaymod.gui.elements.GuiMouseInput;
|
||||||
import eu.crushedpixel.replaymod.registry.KeybindRegistry;
|
import eu.crushedpixel.replaymod.registry.KeybindRegistry;
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
|
import eu.crushedpixel.replaymod.replay.ReplayProcess;
|
||||||
import eu.crushedpixel.replaymod.replay.spectate.SpectateHandler;
|
import eu.crushedpixel.replaymod.replay.spectate.SpectateHandler;
|
||||||
import eu.crushedpixel.replaymod.video.ReplayScreenshot;
|
import eu.crushedpixel.replaymod.video.ReplayScreenshot;
|
||||||
|
|
||||||
@@ -26,6 +32,12 @@ public class KeyInputHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Keyboard.getEventKeyState() && !Keyboard.isRepeatEvent() && Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)
|
||||||
|
&& ReplayHandler.isInPath() && ReplayProcess.isVideoRecording()
|
||||||
|
&& mc.currentScreen == null) {
|
||||||
|
mc.displayGuiScreen(new GuiCancelRender());
|
||||||
|
}
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
||||||
KeyBinding[] keyBindings = Minecraft.getMinecraft().gameSettings.keyBindings;
|
KeyBinding[] keyBindings = Minecraft.getMinecraft().gameSettings.keyBindings;
|
||||||
@@ -83,7 +95,8 @@ public class KeyInputHandler {
|
|||||||
//Custom registered handlers
|
//Custom registered handlers
|
||||||
if(kb.getKeyDescription().equals(KeybindRegistry.KEY_THUMBNAIL) && kb.isPressed() && !found) {
|
if(kb.getKeyDescription().equals(KeybindRegistry.KEY_THUMBNAIL) && kb.isPressed() && !found) {
|
||||||
ReplayScreenshot.prepareScreenshot();
|
ReplayScreenshot.prepareScreenshot();
|
||||||
GuiReplayOverlay.requestScreenshot();
|
//GuiReplayOverlay.requestScreenshot();
|
||||||
|
//TODO: Make this properly work
|
||||||
}
|
}
|
||||||
|
|
||||||
if(kb.getKeyDescription().equals(KeybindRegistry.KEY_SPECTATE) && kb.isPressed() && !found) {
|
if(kb.getKeyDescription().equals(KeybindRegistry.KEY_SPECTATE) && kb.isPressed() && !found) {
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
package eu.crushedpixel.replaymod.events;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
import org.lwjgl.opengl.Display;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraftforge.client.event.MouseEvent;
|
||||||
|
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||||
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||||
|
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||||
|
import eu.crushedpixel.replaymod.reflection.MCPNames;
|
||||||
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
|
import eu.crushedpixel.replaymod.replay.ReplayProcess;
|
||||||
|
import eu.crushedpixel.replaymod.video.ReplayScreenshot;
|
||||||
|
|
||||||
|
public class TickAndRenderListener {
|
||||||
|
|
||||||
|
private static Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
|
||||||
|
private double lastX, lastY, lastZ;
|
||||||
|
private float lastPitch, lastYaw;
|
||||||
|
|
||||||
|
private static Field isGamePaused;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
isGamePaused = Minecraft.class.getDeclaredField(MCPNames.field("field_71445_n"));
|
||||||
|
isGamePaused.setAccessible(true);
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onRenderWorld(RenderWorldLastEvent event) throws
|
||||||
|
InvocationTargetException, IOException, IllegalAccessException, IllegalArgumentException {
|
||||||
|
if(!ReplayHandler.isInReplay()) return;
|
||||||
|
if(ReplayHandler.isInPath()) ReplayProcess.unblockAndTick(false);
|
||||||
|
if(ReplayHandler.isCamera()) ReplayHandler.setCameraEntity(ReplayHandler.getCameraEntity());
|
||||||
|
if(ReplayHandler.isInReplay() && ReplayHandler.isPaused()) {
|
||||||
|
if(mc != null && mc.thePlayer != null)
|
||||||
|
MinecraftTicker.runMouseKeyboardTick(mc);
|
||||||
|
}
|
||||||
|
if((mc.getRenderViewEntity() == mc.thePlayer || !mc.getRenderViewEntity().isEntityAlive())
|
||||||
|
&& ReplayHandler.getCameraEntity() != null && !ReplayHandler.isInPath()) {
|
||||||
|
ReplayHandler.spectateCamera();
|
||||||
|
} else if(!ReplayHandler.isCamera()) {
|
||||||
|
lastX = mc.getRenderViewEntity().posX;
|
||||||
|
lastY = mc.getRenderViewEntity().posY;
|
||||||
|
lastZ = mc.getRenderViewEntity().posZ;
|
||||||
|
lastPitch = mc.getRenderViewEntity().rotationPitch;
|
||||||
|
lastYaw = mc.getRenderViewEntity().rotationYaw;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if(requestScreenshot) {
|
||||||
|
requestScreenshot = false;
|
||||||
|
ReplayScreenshot.saveScreenshot(mc.getFramebuffer());
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if(mc.isGamePaused() && ReplayHandler.isInPath()) {
|
||||||
|
isGamePaused.set(mc, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void tick(TickEvent event) {
|
||||||
|
if(!ReplayHandler.isInReplay()) return;
|
||||||
|
if(ReplayHandler.getCameraEntity() != null)
|
||||||
|
ReplayHandler.getCameraEntity().updateMovement();
|
||||||
|
if(ReplayHandler.isInPath()) ReplayProcess.unblockAndTick(true);
|
||||||
|
if(!ReplayHandler.isInPath()) onMouseMove(new MouseEvent());
|
||||||
|
FMLCommonHandler.instance().bus().post(new InputEvent.KeyInputEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onMouseMove(MouseEvent event) {
|
||||||
|
if(!ReplayHandler.isInReplay()) return;
|
||||||
|
boolean flag = Display.isActive();
|
||||||
|
flag = true;
|
||||||
|
|
||||||
|
mc.mcProfiler.startSection("mouse");
|
||||||
|
|
||||||
|
if (flag && Minecraft.isRunningOnMac && mc.inGameHasFocus && !Mouse.isInsideWindow())
|
||||||
|
{
|
||||||
|
Mouse.setGrabbed(false);
|
||||||
|
Mouse.setCursorPosition(Display.getWidth() / 2, Display.getHeight() / 2);
|
||||||
|
Mouse.setGrabbed(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mc.inGameHasFocus && flag)
|
||||||
|
{
|
||||||
|
mc.mouseHelper.mouseXYChange();
|
||||||
|
float f1 = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
|
||||||
|
float f2 = f1 * f1 * f1 * 8.0F;
|
||||||
|
float f3 = (float)mc.mouseHelper.deltaX * f2;
|
||||||
|
float f4 = (float)mc.mouseHelper.deltaY * f2;
|
||||||
|
byte b0 = 1;
|
||||||
|
|
||||||
|
if (mc.gameSettings.invertMouse)
|
||||||
|
{
|
||||||
|
b0 = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ReplayHandler.getCameraEntity() != null) {
|
||||||
|
ReplayHandler.getCameraEntity().setAngles(f3, f4 * (float)b0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package eu.crushedpixel.replaymod.gui;
|
||||||
|
|
||||||
|
import eu.crushedpixel.replaymod.replay.ReplayProcess;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.gui.GuiYesNo;
|
||||||
|
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||||
|
|
||||||
|
public class GuiCancelRender extends GuiYesNo {
|
||||||
|
|
||||||
|
private static Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
|
||||||
|
private static GuiYesNoCallback callback = new GuiYesNoCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void confirmClicked(boolean result, int id) {
|
||||||
|
if(result) {
|
||||||
|
ReplayProcess.stopReplayProcess(false);
|
||||||
|
}
|
||||||
|
mc.displayGuiScreen(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public GuiCancelRender() {
|
||||||
|
super(callback, "Cancel Rendering", "Are you sure that you want to cancel the current rendering process?", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,21 +2,16 @@ package eu.crushedpixel.replaymod.gui;
|
|||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.entity.item.EntityArmorStand;
|
|
||||||
import net.minecraft.network.play.server.S0EPacketSpawnObject;
|
|
||||||
import net.minecraft.network.play.server.S0FPacketSpawnMob;
|
|
||||||
import net.minecraft.network.play.server.S14PacketEntity;
|
|
||||||
import net.minecraft.network.play.server.S14PacketEntity.S15PacketEntityRelMove;
|
|
||||||
import net.minecraft.network.play.server.S14PacketEntity.S16PacketEntityLook;
|
|
||||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||||
import eu.crushedpixel.replaymod.ReplayMod;
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.settings.ReplaySettings;
|
import eu.crushedpixel.replaymod.settings.ReplaySettings;
|
||||||
import eu.crushedpixel.replaymod.settings.ReplaySettings.Option;
|
import eu.crushedpixel.replaymod.settings.ReplaySettings.RecordingOptions;
|
||||||
|
import eu.crushedpixel.replaymod.settings.ReplaySettings.RenderOptions;
|
||||||
|
import eu.crushedpixel.replaymod.settings.ReplaySettings.ReplayOptions;
|
||||||
|
|
||||||
public class GuiReplaySettings extends GuiScreen {
|
public class GuiReplaySettings extends GuiScreen {
|
||||||
|
|
||||||
@@ -32,8 +27,11 @@ public class GuiReplaySettings extends GuiScreen {
|
|||||||
private static final int ENABLE_LIGHTING = 9008;
|
private static final int ENABLE_LIGHTING = 9008;
|
||||||
private static final int FRAMERATE_SLIDER_ID = 9009;
|
private static final int FRAMERATE_SLIDER_ID = 9009;
|
||||||
private static final int RESOURCEPACK_ID = 9010;
|
private static final int RESOURCEPACK_ID = 9010;
|
||||||
|
private static final int WAITFORCHUNKS_ID = 9011;
|
||||||
|
private static final int INDICATOR_ID = 9012;
|
||||||
|
|
||||||
private GuiButton recordServerButton, recordSPButton, sendChatButton, linearButton, lightingButton, resourcePackButton;
|
private GuiButton recordServerButton, recordSPButton, sendChatButton, linearButton, lightingButton,
|
||||||
|
resourcePackButton, waitForChunksButton, showIndicatorButton;
|
||||||
|
|
||||||
public GuiReplaySettings(GuiScreen parentGuiScreen) {
|
public GuiReplaySettings(GuiScreen parentGuiScreen) {
|
||||||
this.parentGuiScreen = parentGuiScreen;
|
this.parentGuiScreen = parentGuiScreen;
|
||||||
@@ -44,61 +42,74 @@ public class GuiReplaySettings extends GuiScreen {
|
|||||||
this.buttonList.clear();
|
this.buttonList.clear();
|
||||||
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height - 27, I18n.format("gui.done", new Object[0])));
|
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height - 27, I18n.format("gui.done", new Object[0])));
|
||||||
|
|
||||||
Option[] aoptions = Option.values();
|
|
||||||
|
|
||||||
ReplaySettings settings = ReplayMod.replaySettings;
|
ReplaySettings settings = ReplayMod.replaySettings;
|
||||||
|
|
||||||
int k = 0;
|
int k = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Option o : aoptions) {
|
|
||||||
|
|
||||||
switch(o) {
|
for(RecordingOptions o : RecordingOptions.values()) {
|
||||||
case lighting:
|
if(o == RecordingOptions.notifications) {
|
||||||
this.buttonList.add(lightingButton = new GuiButton(ENABLE_LIGHTING, this.width / 2 - 155 + i % 2 * 160,
|
|
||||||
this.height / 6 + 24 * (i >> 1), 150, 20, "Enable Lighting: "+onOff(settings.isLightingEnabled())));
|
|
||||||
break;
|
|
||||||
case linear:
|
|
||||||
this.buttonList.add(linearButton = new GuiButton(FORCE_LINEAR, this.width / 2 - 155 + i % 2 * 160,
|
|
||||||
this.height / 6 + 24 * (i >> 1), 150, 20, "Camera Path: "+linearOnOff(settings.isLinearMovement())));
|
|
||||||
break;
|
|
||||||
case notifications:
|
|
||||||
this.buttonList.add(sendChatButton = new GuiButton(SEND_CHAT,
|
this.buttonList.add(sendChatButton = new GuiButton(SEND_CHAT,
|
||||||
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20,
|
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20,
|
||||||
"Enable Notifications: "+onOff(settings.isShowNotifications())));
|
"Enable Notifications: "+onOff(settings.isShowNotifications())));
|
||||||
break;
|
} else if(o == RecordingOptions.recordServer) {
|
||||||
case recordServer:
|
|
||||||
this.buttonList.add(recordServerButton = new GuiButton(RECORDSERVER_ID,
|
this.buttonList.add(recordServerButton = new GuiButton(RECORDSERVER_ID,
|
||||||
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20, "Record Server: "
|
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20, "Record Server: "
|
||||||
+onOff(settings.isEnableRecordingServer())));
|
+onOff(settings.isEnableRecordingServer())));
|
||||||
break;
|
} else if(o == RecordingOptions.recordSingleplayer) {
|
||||||
case recordSingleplayer:
|
|
||||||
this.buttonList.add(recordSPButton = new GuiButton(RECORDSP_ID, this.width / 2 - 155 + i % 2 * 160,
|
this.buttonList.add(recordSPButton = new GuiButton(RECORDSP_ID, this.width / 2 - 155 + i % 2 * 160,
|
||||||
this.height / 6 + 24 * (i >> 1), 150, 20, "Record Singleplayer: "+onOff(settings.isEnableRecordingSingleplayer())));
|
this.height / 6 + 24 * (i >> 1), 150, 20, "Record Singleplayer: "+onOff(settings.isEnableRecordingSingleplayer())));
|
||||||
break;
|
} else if(o == RecordingOptions.indicator) {
|
||||||
case useResources:
|
this.buttonList.add(showIndicatorButton = new GuiButton(INDICATOR_ID, this.width / 2 - 155 + i % 2 * 160,
|
||||||
this.buttonList.add(resourcePackButton = new GuiButton(RESOURCEPACK_ID, this.width / 2 - 155 + i % 2 * 160,
|
this.height / 6 + 24 * (i >> 1), 150, 20, "Show Recording Indicator: "+onOff(settings.showRecordingIndicator())));
|
||||||
this.height / 6 + 24 * (i >> 1), 150, 20, "Server Resource Packs: "+onOff(settings.getUseResourcePacks())));
|
|
||||||
break;
|
|
||||||
case videoFramerate:
|
|
||||||
this.buttonList.add(new GuiVideoFramerateSlider(FRAMERATE_SLIDER_ID,
|
|
||||||
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), settings.getVideoFramerate(), "Video Framerate"));
|
|
||||||
break;
|
|
||||||
case videoQuality:
|
|
||||||
this.buttonList.add(new GuiVideoQualitySlider(QUALITY_SLIDER_ID,
|
|
||||||
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), (float)settings.getVideoQuality(), "Video Quality"));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
++k;
|
++k;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (i % 2 == 1)
|
if (i % 2 == 1)
|
||||||
{
|
{
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(ReplayOptions o : ReplayOptions.values()) {
|
||||||
|
if(o == ReplayOptions.lighting) {
|
||||||
|
this.buttonList.add(lightingButton = new GuiButton(ENABLE_LIGHTING, this.width / 2 - 155 + i % 2 * 160,
|
||||||
|
this.height / 6 + 24 * (i >> 1), 150, 20, "Enable Lighting: "+onOff(settings.isLightingEnabled())));
|
||||||
|
} else if(o == ReplayOptions.linear) {
|
||||||
|
this.buttonList.add(linearButton = new GuiButton(FORCE_LINEAR, this.width / 2 - 155 + i % 2 * 160,
|
||||||
|
this.height / 6 + 24 * (i >> 1), 150, 20, "Camera Path: "+linearOnOff(settings.isLinearMovement())));
|
||||||
|
} else if(o == ReplayOptions.useResources) {
|
||||||
|
this.buttonList.add(resourcePackButton = new GuiButton(RESOURCEPACK_ID, this.width / 2 - 155 + i % 2 * 160,
|
||||||
|
this.height / 6 + 24 * (i >> 1), 150, 20, "Server Resource Packs: "+onOff(settings.getUseResourcePacks())));
|
||||||
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
|
++k;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i % 2 == 1)
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(RenderOptions o : RenderOptions.values()) {
|
||||||
|
if(o == RenderOptions.videoFramerate) {
|
||||||
|
this.buttonList.add(new GuiVideoFramerateSlider(FRAMERATE_SLIDER_ID,
|
||||||
|
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), settings.getVideoFramerate(), "Video Framerate"));
|
||||||
|
} else if(o == RenderOptions.videoQuality) {
|
||||||
|
this.buttonList.add(new GuiVideoQualitySlider(QUALITY_SLIDER_ID,
|
||||||
|
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), (float)settings.getVideoQuality(), "Video Quality"));
|
||||||
|
} else if(o == RenderOptions.waitForChunks) {
|
||||||
|
this.buttonList.add(resourcePackButton = new GuiButton(WAITFORCHUNKS_ID, this.width / 2 - 155 + i % 2 * 160,
|
||||||
|
this.height / 6 + 24 * (i >> 1), 150, 20, "Force Render Chunks: "+onOff(settings.getWaitForChunks())));
|
||||||
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
|
++k;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String onOff(boolean on) {
|
private String onOff(boolean on) {
|
||||||
@@ -163,6 +174,18 @@ public class GuiReplaySettings extends GuiScreen {
|
|||||||
resourcePackButton.displayString = "Server Resource Packs: "+onOff(enabled);
|
resourcePackButton.displayString = "Server Resource Packs: "+onOff(enabled);
|
||||||
ReplayMod.replaySettings.setUseResourcePacks(enabled);
|
ReplayMod.replaySettings.setUseResourcePacks(enabled);
|
||||||
break;
|
break;
|
||||||
|
case WAITFORCHUNKS_ID:
|
||||||
|
enabled = ReplayMod.replaySettings.getWaitForChunks();
|
||||||
|
enabled = !enabled;
|
||||||
|
resourcePackButton.displayString = "Force Render Chunks: "+onOff(enabled);
|
||||||
|
ReplayMod.replaySettings.setWaitForChunks(enabled);
|
||||||
|
break;
|
||||||
|
case INDICATOR_ID:
|
||||||
|
enabled = ReplayMod.replaySettings.showRecordingIndicator();
|
||||||
|
enabled = !enabled;
|
||||||
|
showIndicatorButton.displayString = "Show Recording Indicator: "+onOff(enabled);
|
||||||
|
ReplayMod.replaySettings.setEnableIndicator(enabled);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
package eu.crushedpixel.replaymod.replay;
|
package eu.crushedpixel.replaymod.replay;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.renderer.ChunkRenderContainer;
|
||||||
|
import net.minecraft.client.renderer.RenderGlobal;
|
||||||
|
import net.minecraft.client.renderer.chunk.RenderChunk;
|
||||||
import eu.crushedpixel.replaymod.ReplayMod;
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.chat.ChatMessageRequests;
|
import eu.crushedpixel.replaymod.chat.ChatMessageRequests;
|
||||||
import eu.crushedpixel.replaymod.chat.ChatMessageRequests.ChatMessageType;
|
import eu.crushedpixel.replaymod.chat.ChatMessageRequests.ChatMessageType;
|
||||||
|
import eu.crushedpixel.replaymod.gui.GuiCancelRender;
|
||||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||||
import eu.crushedpixel.replaymod.holders.Position;
|
import eu.crushedpixel.replaymod.holders.Position;
|
||||||
import eu.crushedpixel.replaymod.holders.PositionKeyframe;
|
import eu.crushedpixel.replaymod.holders.PositionKeyframe;
|
||||||
@@ -14,6 +19,7 @@ import eu.crushedpixel.replaymod.holders.TimeKeyframe;
|
|||||||
import eu.crushedpixel.replaymod.interpolation.LinearPoint;
|
import eu.crushedpixel.replaymod.interpolation.LinearPoint;
|
||||||
import eu.crushedpixel.replaymod.interpolation.LinearTimestamp;
|
import eu.crushedpixel.replaymod.interpolation.LinearTimestamp;
|
||||||
import eu.crushedpixel.replaymod.interpolation.SplinePoint;
|
import eu.crushedpixel.replaymod.interpolation.SplinePoint;
|
||||||
|
import eu.crushedpixel.replaymod.reflection.MCPNames;
|
||||||
import eu.crushedpixel.replaymod.timer.EnchantmentTimer;
|
import eu.crushedpixel.replaymod.timer.EnchantmentTimer;
|
||||||
import eu.crushedpixel.replaymod.timer.MCTimerHandler;
|
import eu.crushedpixel.replaymod.timer.MCTimerHandler;
|
||||||
import eu.crushedpixel.replaymod.video.ScreenCapture;
|
import eu.crushedpixel.replaymod.video.ScreenCapture;
|
||||||
@@ -36,6 +42,8 @@ public class ReplayProcess {
|
|||||||
private static LinearPoint motionLinear = null;
|
private static LinearPoint motionLinear = null;
|
||||||
private static LinearTimestamp timeLinear = null;
|
private static LinearTimestamp timeLinear = null;
|
||||||
|
|
||||||
|
private static double lastSpeed = 1f;
|
||||||
|
|
||||||
private static double previousReplaySpeed = 0;
|
private static double previousReplaySpeed = 0;
|
||||||
|
|
||||||
private static boolean calculated = false;
|
private static boolean calculated = false;
|
||||||
@@ -64,11 +72,12 @@ public class ReplayProcess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
blocked = deepBlock = false;
|
blocked = deepBlock = false;
|
||||||
|
|
||||||
startRealTime = System.currentTimeMillis();
|
startRealTime = System.currentTimeMillis();
|
||||||
lastRealTime = startRealTime;
|
lastRealTime = startRealTime;
|
||||||
lastRealReplayTime = 0;
|
lastRealReplayTime = 0;
|
||||||
lastTimestamp = -1;
|
lastTimestamp = -1;
|
||||||
|
lastSpeed = 1f;
|
||||||
linear = ReplayMod.replaySettings.isLinearMovement();
|
linear = ReplayMod.replaySettings.isLinearMovement();
|
||||||
ReplayHandler.sortKeyframes();
|
ReplayHandler.sortKeyframes();
|
||||||
ReplayHandler.setInPath(true);
|
ReplayHandler.setInPath(true);
|
||||||
@@ -80,15 +89,17 @@ public class ReplayProcess {
|
|||||||
if(tf != null) {
|
if(tf != null) {
|
||||||
int ts = tf.getTimestamp();
|
int ts = tf.getTimestamp();
|
||||||
if(ts < ReplayHandler.getReplayTime()) {
|
if(ts < ReplayHandler.getReplayTime()) {
|
||||||
mc.displayGuiScreen((GuiScreen)null);
|
mc.displayGuiScreen(null);
|
||||||
}
|
}
|
||||||
ReplayHandler.setReplayTime(ts);
|
ReplayHandler.setReplayTime(ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatMessageRequests.addChatMessage("Replay started!", ChatMessageType.INFORMATION);
|
ChatMessageRequests.addChatMessage("Replay started!", ChatMessageType.INFORMATION);
|
||||||
|
|
||||||
|
mc.renderGlobal.loadRenderers();
|
||||||
|
|
||||||
if(isVideoRecording()) {
|
if(isVideoRecording()) {
|
||||||
MCTimerHandler.setTimerSpeed(1);
|
MCTimerHandler.setTimerSpeed(1f);
|
||||||
MCTimerHandler.setPassiveTimer();
|
MCTimerHandler.setPassiveTimer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,11 +107,16 @@ public class ReplayProcess {
|
|||||||
public static void stopReplayProcess(boolean finished) {
|
public static void stopReplayProcess(boolean finished) {
|
||||||
if(!ReplayHandler.isInPath()) return;
|
if(!ReplayHandler.isInPath()) return;
|
||||||
if(finished) ChatMessageRequests.addChatMessage("Replay finished!", ChatMessageType.INFORMATION);
|
if(finished) ChatMessageRequests.addChatMessage("Replay finished!", ChatMessageType.INFORMATION);
|
||||||
else ChatMessageRequests.addChatMessage("Replay stopped!", ChatMessageType.INFORMATION);
|
else {
|
||||||
|
ChatMessageRequests.addChatMessage("Replay stopped!", ChatMessageType.INFORMATION);
|
||||||
|
if(isVideoRecording()) {
|
||||||
|
VideoWriter.abortRecording();
|
||||||
|
}
|
||||||
|
}
|
||||||
ReplayHandler.setInPath(false);
|
ReplayHandler.setInPath(false);
|
||||||
MCTimerHandler.setActiveTimer();
|
MCTimerHandler.setActiveTimer();
|
||||||
ReplayHandler.setSpeed(previousReplaySpeed);
|
ReplayHandler.setSpeed(previousReplaySpeed);
|
||||||
ReplayHandler.setSpeed(0);
|
//ReplayHandler.setSpeed(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean blocked = false;
|
private static boolean blocked = false;
|
||||||
@@ -108,22 +124,35 @@ public class ReplayProcess {
|
|||||||
|
|
||||||
private static boolean requestFinish = false;
|
private static boolean requestFinish = false;
|
||||||
|
|
||||||
public static void unblockAndTick() {
|
public static void unblockAndTick(boolean justCheck) {
|
||||||
if(!deepBlock) blocked = false;
|
if(!deepBlock) blocked = false;
|
||||||
if(!blocked || !isVideoRecording())
|
if(!blocked || !isVideoRecording())
|
||||||
ReplayProcess.tickReplay();
|
ReplayProcess.tickReplay(justCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void tickReplay() {
|
public static void tickReplay(boolean justCheck) {
|
||||||
pathTick(isVideoRecording());
|
pathTick(isVideoRecording(), justCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void pathTick(boolean recording) {
|
private static void pathTick(boolean recording, boolean justCheck) {
|
||||||
if(ReplayHandler.isHurrying()) {
|
if(ReplayHandler.isHurrying()) {
|
||||||
lastRealTime = System.currentTimeMillis();
|
lastRealTime = System.currentTimeMillis();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(recording && ((ReplayMod.replaySettings.getWaitForChunks() && RenderChunk.renderChunksUpdated != 0) || mc.currentScreen instanceof GuiCancelRender)) {
|
||||||
|
MCTimerHandler.setTimerSpeed(0f);
|
||||||
|
MCTimerHandler.setPartialTicks(0f);
|
||||||
|
MCTimerHandler.setRenderPartialTicks(0f);
|
||||||
|
MCTimerHandler.setTicks(0);
|
||||||
|
return;
|
||||||
|
} else if (recording && ReplayMod.replaySettings.getWaitForChunks()) {
|
||||||
|
MCTimerHandler.setTimerSpeed((float)lastSpeed);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(justCheck) return;
|
||||||
|
|
||||||
if(recording) {
|
if(recording) {
|
||||||
if(blocked) return;
|
if(blocked) return;
|
||||||
|
|
||||||
@@ -277,7 +306,10 @@ public class ReplayProcess {
|
|||||||
ReplayHandler.getCameraEntity().movePath(pos);
|
ReplayHandler.getCameraEntity().movePath(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReplayHandler.setSpeed(curSpeed);
|
if(curSpeed > 0) {
|
||||||
|
ReplayHandler.setSpeed(curSpeed);
|
||||||
|
lastSpeed = curSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
if(recording) {
|
if(recording) {
|
||||||
MCTimerHandler.updateTimer((1f/ReplayMod.replaySettings.getVideoFramerate()));
|
MCTimerHandler.updateTimer((1f/ReplayMod.replaySettings.getVideoFramerate()));
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void jumpToTime(int millis) {
|
public void jumpToTime(int millis) {
|
||||||
setReplaySpeed(replaySpeed);
|
if(!(ReplayHandler.isInPath() && ReplayProcess.isVideoRecording())) setReplaySpeed(replaySpeed);
|
||||||
|
|
||||||
if((millis < currentTimeStamp && !isHurrying())) {
|
if((millis < currentTimeStamp && !isHurrying())) {
|
||||||
if(ReplayHandler.isInPath()) {
|
if(ReplayHandler.isInPath()) {
|
||||||
@@ -494,7 +494,7 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
if(p == null) return;
|
if(p == null) return;
|
||||||
|
|
||||||
//If hurrying, ignore some packets, unless during Replay Path and *not* in initial hurry
|
//If hurrying, ignore some packets, unless during Replay Path and *not* in initial hurry
|
||||||
if(hurryToTimestamp && (!ReplayHandler.isInPath() || (desiredTimeStamp-currentTimeStamp > 1000))) {
|
if(hurryToTimestamp && (!ReplayHandler.isInPath() || (desiredTimeStamp-currentTimeStamp > 1000))) {
|
||||||
if(p instanceof S45PacketTitle ||
|
if(p instanceof S45PacketTitle ||
|
||||||
p instanceof S2APacketParticles) return;
|
p instanceof S2APacketParticles) return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package eu.crushedpixel.replaymod.settings;
|
package eu.crushedpixel.replaymod.settings;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.settings.GameSettings.Options;
|
import net.minecraft.client.settings.GameSettings.Options;
|
||||||
@@ -13,21 +16,61 @@ import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
|||||||
|
|
||||||
public class ReplaySettings {
|
public class ReplaySettings {
|
||||||
|
|
||||||
public enum Option {
|
public static interface ValueEnum {
|
||||||
recordServer(true), recordSingleplayer(true), notifications(true), linear(false),
|
public Object getValue();
|
||||||
lighting(false), useResources(true), videoQuality(0.5f), videoFramerate(30);
|
public void setValue(Object value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum RecordingOptions implements ValueEnum {
|
||||||
|
recordServer(true), recordSingleplayer(true), notifications(true), indicator(true);
|
||||||
|
|
||||||
private Object value;
|
private Object value;
|
||||||
|
|
||||||
public Object getValue() {
|
public Object getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(Object value) {
|
public void setValue(Object value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
Option(Object value) {
|
RecordingOptions(Object value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ReplayOptions implements ValueEnum {
|
||||||
|
linear(false), lighting(false), useResources(true);
|
||||||
|
|
||||||
|
private Object value;
|
||||||
|
|
||||||
|
public Object getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(Object value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReplayOptions(Object value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum RenderOptions implements ValueEnum {
|
||||||
|
videoQuality(0.5f), videoFramerate(30), waitForChunks(true);
|
||||||
|
|
||||||
|
private Object value;
|
||||||
|
|
||||||
|
public Object getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(Object value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderOptions(Object value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,74 +86,105 @@ public class ReplaySettings {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ValueEnum> getValueEnums() {
|
||||||
|
List<ValueEnum> enums = new ArrayList<ReplaySettings.ValueEnum>();
|
||||||
|
enums.addAll(Arrays.asList(ReplayOptions.values()));
|
||||||
|
enums.addAll(Arrays.asList(RenderOptions.values()));
|
||||||
|
return enums;
|
||||||
|
}
|
||||||
|
|
||||||
public void readValues() {
|
public void readValues() {
|
||||||
Configuration config = ReplayMod.config;
|
Configuration config = ReplayMod.config;
|
||||||
|
|
||||||
for(Option o : Option.values()) {
|
for(RecordingOptions o : RecordingOptions.values()) {
|
||||||
Property p = getConfigSetting(config, o);
|
Property p = getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "recording");
|
||||||
o.setValue(getValueObject(p));
|
o.setValue(getValueObject(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(ReplayOptions o : ReplayOptions.values()) {
|
||||||
|
Property p = getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "replay");
|
||||||
|
o.setValue(getValueObject(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(RenderOptions o : RenderOptions.values()) {
|
||||||
|
Property p = getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "render");
|
||||||
|
o.setValue(getValueObject(p));
|
||||||
|
}
|
||||||
|
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVideoFramerate() {
|
public int getVideoFramerate() {
|
||||||
return (Integer)Option.videoFramerate.getValue();
|
return (Integer)RenderOptions.videoFramerate.getValue();
|
||||||
}
|
}
|
||||||
public void setVideoFramerate(int framerate) {
|
public void setVideoFramerate(int framerate) {
|
||||||
Option.videoFramerate.setValue(Math.min(120, Math.max(10, framerate)));
|
RenderOptions.videoFramerate.setValue(Math.min(120, Math.max(10, framerate)));
|
||||||
rewriteSettings();
|
rewriteSettings();
|
||||||
}
|
}
|
||||||
public double getVideoQuality() {
|
public double getVideoQuality() {
|
||||||
return (Double)Option.videoQuality.getValue();
|
return (Double)RenderOptions.videoQuality.getValue();
|
||||||
|
}
|
||||||
|
public void setEnableIndicator(boolean enable) {
|
||||||
|
RecordingOptions.indicator.setValue(enable);
|
||||||
|
rewriteSettings();
|
||||||
|
}
|
||||||
|
public boolean showRecordingIndicator() {
|
||||||
|
return (Boolean)RecordingOptions.indicator.getValue();
|
||||||
}
|
}
|
||||||
public void setVideoQuality(double videoQuality) {
|
public void setVideoQuality(double videoQuality) {
|
||||||
Option.videoQuality.setValue(Math.min(0.9f, Math.max(0.1f, videoQuality)));
|
RenderOptions.videoQuality.setValue(Math.min(0.9f, Math.max(0.1f, videoQuality)));
|
||||||
rewriteSettings();
|
rewriteSettings();
|
||||||
}
|
}
|
||||||
public boolean isEnableRecordingServer() {
|
public boolean isEnableRecordingServer() {
|
||||||
return (Boolean)Option.recordServer.getValue();
|
return (Boolean)RecordingOptions.recordServer.getValue();
|
||||||
}
|
}
|
||||||
public void setEnableRecordingServer(boolean enableRecordingServer) {
|
public void setEnableRecordingServer(boolean enableRecordingServer) {
|
||||||
Option.recordServer.setValue(enableRecordingServer);
|
RecordingOptions.recordServer.setValue(enableRecordingServer);
|
||||||
rewriteSettings();
|
rewriteSettings();
|
||||||
}
|
}
|
||||||
public boolean isEnableRecordingSingleplayer() {
|
public boolean isEnableRecordingSingleplayer() {
|
||||||
return (Boolean)Option.recordSingleplayer.getValue();
|
return (Boolean)RecordingOptions.recordSingleplayer.getValue();
|
||||||
}
|
}
|
||||||
public void setEnableRecordingSingleplayer(boolean enableRecordingSingleplayer) {
|
public void setEnableRecordingSingleplayer(boolean enableRecordingSingleplayer) {
|
||||||
Option.recordSingleplayer.setValue(enableRecordingSingleplayer);
|
RecordingOptions.recordSingleplayer.setValue(enableRecordingSingleplayer);
|
||||||
rewriteSettings();
|
rewriteSettings();
|
||||||
}
|
}
|
||||||
public boolean isShowNotifications() {
|
public boolean isShowNotifications() {
|
||||||
return (Boolean)Option.notifications.getValue();
|
return (Boolean)RecordingOptions.notifications.getValue();
|
||||||
}
|
}
|
||||||
public void setShowNotifications(boolean showNotifications) {
|
public void setShowNotifications(boolean showNotifications) {
|
||||||
Option.notifications.setValue(showNotifications);
|
RecordingOptions.notifications.setValue(showNotifications);
|
||||||
rewriteSettings();
|
rewriteSettings();
|
||||||
}
|
}
|
||||||
public boolean isLinearMovement() {
|
public boolean isLinearMovement() {
|
||||||
return (Boolean)Option.linear.getValue();
|
return (Boolean)ReplayOptions.linear.getValue();
|
||||||
}
|
}
|
||||||
public void setLinearMovement(boolean linear) {
|
public void setLinearMovement(boolean linear) {
|
||||||
Option.linear.setValue(linear);
|
ReplayOptions.linear.setValue(linear);
|
||||||
rewriteSettings();
|
rewriteSettings();
|
||||||
}
|
}
|
||||||
public boolean isLightingEnabled() {
|
public boolean isLightingEnabled() {
|
||||||
return (Boolean)Option.lighting.getValue();
|
return (Boolean)ReplayOptions.lighting.getValue();
|
||||||
}
|
}
|
||||||
public void setUseResourcePacks(boolean use) {
|
public void setUseResourcePacks(boolean use) {
|
||||||
Option.useResources.setValue(use);
|
ReplayOptions.useResources.setValue(use);
|
||||||
rewriteSettings();
|
rewriteSettings();
|
||||||
}
|
}
|
||||||
public boolean getUseResourcePacks() {
|
public boolean getUseResourcePacks() {
|
||||||
return (Boolean)Option.useResources.getValue();
|
return (Boolean)ReplayOptions.useResources.getValue();
|
||||||
}
|
}
|
||||||
|
public void setWaitForChunks(boolean wait) {
|
||||||
|
RenderOptions.waitForChunks.setValue(wait);
|
||||||
|
rewriteSettings();
|
||||||
|
}
|
||||||
|
public boolean getWaitForChunks() {
|
||||||
|
return (Boolean)RenderOptions.waitForChunks.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: FIX
|
//TODO: FIX
|
||||||
public void setLightingEnabled(boolean enabled) {
|
public void setLightingEnabled(boolean enabled) {
|
||||||
Option.lighting.setValue(enabled);
|
ReplayOptions.lighting.setValue(enabled);
|
||||||
if(enabled) {
|
if(enabled) {
|
||||||
Minecraft.getMinecraft().gameSettings.setOptionFloatValue(Options.GAMMA, 1000);
|
Minecraft.getMinecraft().gameSettings.setOptionFloatValue(Options.GAMMA, 1000);
|
||||||
} else {
|
} else {
|
||||||
@@ -130,34 +204,39 @@ public class ReplaySettings {
|
|||||||
|
|
||||||
rewriteSettings();
|
rewriteSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rewriteSettings() {
|
public void rewriteSettings() {
|
||||||
ReplayMod.instance.config.load();
|
ReplayMod.instance.config.load();
|
||||||
ReplayMod.instance.config.removeCategory(ReplayMod.instance.config.getCategory("settings"));
|
|
||||||
|
for(String cat : ReplayMod.instance.config.getCategoryNames()) {
|
||||||
for(Option o : Option.values()) {
|
ReplayMod.instance.config.removeCategory(ReplayMod.instance.config.getCategory(cat));
|
||||||
getConfigSetting(ReplayMod.instance.config, o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(ReplayOptions o : ReplayOptions.values()) {
|
||||||
|
getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "replay");
|
||||||
|
}
|
||||||
|
|
||||||
|
for(RenderOptions o : RenderOptions.values()) {
|
||||||
|
getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "render");
|
||||||
|
}
|
||||||
|
|
||||||
ReplayMod.instance.config.save();
|
ReplayMod.instance.config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Property getConfigSetting(Configuration config, Option o) {
|
private Property getConfigSetting(Configuration config, String name, Object value, String category) {
|
||||||
Object value = o.getValue();
|
|
||||||
if(value instanceof Integer) {
|
if(value instanceof Integer) {
|
||||||
return config.get("settings", o.name(), (Integer)o.getValue());
|
return config.get(category, name, (Integer)value);
|
||||||
} else if(value instanceof Boolean) {
|
} else if(value instanceof Boolean) {
|
||||||
return config.get("settings", o.name(), (Boolean)o.getValue());
|
return config.get(category, name, (Boolean)value);
|
||||||
} else if(value instanceof Double) {
|
} else if(value instanceof Double) {
|
||||||
return config.get("settings", o.name(), (Double)o.getValue());
|
return config.get(category, name, (Double)value);
|
||||||
} else if(value instanceof Float) {
|
} else if(value instanceof Float) {
|
||||||
return config.get("settings", o.name(), (double)(Float)o.getValue());
|
return config.get(category, name, (double)(Float)value);
|
||||||
} else if(value instanceof String) {
|
} else if(value instanceof String) {
|
||||||
return config.get("settings", o.name(), (String)o.getValue());
|
return config.get(category, name, (String)value);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object getValueObject(Property p) {
|
private Object getValueObject(Property p) {
|
||||||
if(p.isIntValue()) {
|
if(p.isIntValue()) {
|
||||||
return p.getInt();
|
return p.getInt();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import net.minecraft.client.Minecraft;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.Timer;
|
import net.minecraft.util.Timer;
|
||||||
import eu.crushedpixel.replaymod.reflection.MCPNames;
|
import eu.crushedpixel.replaymod.reflection.MCPNames;
|
||||||
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
import eu.crushedpixel.replaymod.video.ReplayTimer;
|
import eu.crushedpixel.replaymod.video.ReplayTimer;
|
||||||
|
|
||||||
public class MCTimerHandler {
|
public class MCTimerHandler {
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ public class ReplayScreenshot {
|
|||||||
private static GuiScreen beforeScreen;
|
private static GuiScreen beforeScreen;
|
||||||
|
|
||||||
public static void prepareScreenshot() {
|
public static void prepareScreenshot() {
|
||||||
System.out.println("thumbnail preparing");
|
|
||||||
before = mc.gameSettings.hideGUI;
|
before = mc.gameSettings.hideGUI;
|
||||||
beforeSpeed = ReplayHandler.getSpeed();
|
beforeSpeed = ReplayHandler.getSpeed();
|
||||||
beforeScreen = mc.currentScreen;
|
beforeScreen = mc.currentScreen;
|
||||||
@@ -56,7 +55,6 @@ public class ReplayScreenshot {
|
|||||||
if(locked) return;
|
if(locked) return;
|
||||||
locked = true;
|
locked = true;
|
||||||
|
|
||||||
System.out.println("thumbnail started");
|
|
||||||
try {
|
try {
|
||||||
GuiReplaySaving.replaySaving = true;
|
GuiReplaySaving.replaySaving = true;
|
||||||
|
|
||||||
@@ -78,7 +76,6 @@ public class ReplayScreenshot {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
System.out.println("thumbnail saving started");
|
|
||||||
float aspect = 1280f/720f;
|
float aspect = 1280f/720f;
|
||||||
|
|
||||||
Rectangle rect;
|
Rectangle rect;
|
||||||
|
|||||||
@@ -27,8 +27,10 @@ public class VideoWriter {
|
|||||||
private static final String VIDEO_EXTENSION = ".avi";
|
private static final String VIDEO_EXTENSION = ".avi";
|
||||||
|
|
||||||
private static MovieWriter out;
|
private static MovieWriter out;
|
||||||
|
private static File file;
|
||||||
private static boolean isRecording = false;
|
private static boolean isRecording = false;
|
||||||
private static boolean requestFinish = false;
|
private static boolean requestFinish = false;
|
||||||
|
private static boolean abort = false;
|
||||||
|
|
||||||
private static Buffer buf;
|
private static Buffer buf;
|
||||||
private static int track;
|
private static int track;
|
||||||
@@ -52,7 +54,7 @@ public class VideoWriter {
|
|||||||
|
|
||||||
String fileName = sdf.format(Calendar.getInstance().getTime());
|
String fileName = sdf.format(Calendar.getInstance().getTime());
|
||||||
|
|
||||||
File file = new File(folder, fileName+VIDEO_EXTENSION);
|
file = new File(folder, fileName+VIDEO_EXTENSION);
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
|
|
||||||
out = Registry.getInstance().getWriter(file);
|
out = Registry.getInstance().getWriter(file);
|
||||||
@@ -79,15 +81,20 @@ public class VideoWriter {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while(true) {
|
while(true) {
|
||||||
if(toWrite.isEmpty()) {
|
if(toWrite.isEmpty() || abort) {
|
||||||
if(requestFinish) {
|
if(requestFinish) {
|
||||||
requestFinish = false;
|
requestFinish = false;
|
||||||
isRecording = false;
|
isRecording = false;
|
||||||
try {
|
try {
|
||||||
out.close();
|
out.close();
|
||||||
|
if(abort) {
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
abort = false;
|
||||||
|
toWrite = new LinkedBlockingQueue<BufferedImage>();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -132,4 +139,9 @@ public class VideoWriter {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void abortRecording() {
|
||||||
|
requestFinish = true;
|
||||||
|
abort = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.9 KiB |
Reference in New Issue
Block a user