Removed the opening of GuiReplaySaving to allow for more general approach

This commit is contained in:
CrushedPixel
2015-06-01 11:05:03 +02:00
parent 98c2b65023
commit 7aaae3ea5c
4 changed files with 12 additions and 16 deletions

View File

@@ -69,10 +69,14 @@ public class GuiEventHandler {
} }
if(!AuthenticationHandler.isAuthenticated()) return; if(!AuthenticationHandler.isAuthenticated()) return;
/*
if(event.gui != null && GuiReplaySaving.replaySaving && !allowedGUIs.contains(event.gui.getClass())) { if(event.gui != null && GuiReplaySaving.replaySaving && !allowedGUIs.contains(event.gui.getClass())) {
event.gui = new GuiReplaySaving(event.gui); event.gui = new GuiReplaySaving(event.gui);
return; return;
} }
*/
if(event.gui instanceof GuiChat || event.gui instanceof GuiInventory) { if(event.gui instanceof GuiChat || event.gui instanceof GuiInventory) {
if(ReplayHandler.isInReplay()) { if(ReplayHandler.isInReplay()) {
event.setCanceled(true); event.setCanceled(true);

View File

@@ -1,13 +1,10 @@
package eu.crushedpixel.replaymod.gui; package eu.crushedpixel.replaymod.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
public class GuiReplaySaving extends GuiScreen { public class GuiReplaySaving extends GuiScreen {
public static boolean replaySaving = false;
private GuiScreen waiting = null; private GuiScreen waiting = null;
public GuiReplaySaving(GuiScreen waiting) { public GuiReplaySaving(GuiScreen waiting) {
@@ -20,9 +17,10 @@ public class GuiReplaySaving extends GuiScreen {
this.drawCenteredString(this.fontRendererObj, I18n.format("replaymod.gui.replaysaving.title"), this.width / 2, 20, 16777215); this.drawCenteredString(this.fontRendererObj, I18n.format("replaymod.gui.replaysaving.title"), this.width / 2, 20, 16777215);
this.drawCenteredString(this.fontRendererObj, I18n.format("replaymod.gui.replaysaving.message"), this.width / 2, 40, 16777215); this.drawCenteredString(this.fontRendererObj, I18n.format("replaymod.gui.replaysaving.message"), this.width / 2, 40, 16777215);
super.drawScreen(mouseX, mouseY, partialTicks); super.drawScreen(mouseX, mouseY, partialTicks);
if(!replaySaving) { }
Minecraft.getMinecraft().displayGuiScreen(waiting);
} public void dispatch() {
mc.displayGuiScreen(waiting);
} }
} }

View File

@@ -3,7 +3,6 @@ package eu.crushedpixel.replaymod.recording;
import com.google.common.hash.Hashing; import com.google.common.hash.Hashing;
import com.google.common.io.Files; import com.google.common.io.Files;
import com.google.gson.Gson; import com.google.gson.Gson;
import eu.crushedpixel.replaymod.gui.GuiReplaySaving;
import eu.crushedpixel.replaymod.holders.PacketData; import eu.crushedpixel.replaymod.holders.PacketData;
import eu.crushedpixel.replaymod.utils.ReplayFile; import eu.crushedpixel.replaymod.utils.ReplayFile;
import eu.crushedpixel.replaymod.utils.ReplayFileIO; import eu.crushedpixel.replaymod.utils.ReplayFileIO;
@@ -15,8 +14,11 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import java.io.*; import java.io.*;
import java.util.*; import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
@@ -146,8 +148,6 @@ public abstract class DataListener extends ChannelInboundHandlerAdapter {
active = false; active = false;
try { try {
GuiReplaySaving.replaySaving = true;
String mcversion = Minecraft.getMinecraft().getVersion(); String mcversion = Minecraft.getMinecraft().getVersion();
String[] split = mcversion.split("-"); String[] split = mcversion.split("-");
if(split.length > 0) { if(split.length > 0) {
@@ -169,10 +169,8 @@ public abstract class DataListener extends ChannelInboundHandlerAdapter {
file.delete(); file.delete();
FileUtils.deleteDirectory(tempResourcePacksFolder); FileUtils.deleteDirectory(tempResourcePacksFolder);
GuiReplaySaving.replaySaving = false;
} catch(Exception e) { } catch(Exception e) {
e.printStackTrace(); e.printStackTrace();
GuiReplaySaving.replaySaving = false;
} }
} }

View File

@@ -3,7 +3,6 @@ package eu.crushedpixel.replaymod.video;
import eu.crushedpixel.replaymod.ReplayMod; import eu.crushedpixel.replaymod.ReplayMod;
import eu.crushedpixel.replaymod.chat.ChatMessageHandler.ChatMessageType; import eu.crushedpixel.replaymod.chat.ChatMessageHandler.ChatMessageType;
import eu.crushedpixel.replaymod.events.TickAndRenderListener; import eu.crushedpixel.replaymod.events.TickAndRenderListener;
import eu.crushedpixel.replaymod.gui.GuiReplaySaving;
import eu.crushedpixel.replaymod.replay.ReplayHandler; import eu.crushedpixel.replaymod.replay.ReplayHandler;
import eu.crushedpixel.replaymod.utils.ImageUtils; import eu.crushedpixel.replaymod.utils.ImageUtils;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@@ -37,8 +36,6 @@ public class ReplayScreenshot {
locked = true; locked = true;
try { try {
GuiReplaySaving.replaySaving = true;
mc.gameSettings.hideGUI = true; mc.gameSettings.hideGUI = true;
mc.currentScreen = null; mc.currentScreen = null;
@@ -91,7 +88,6 @@ public class ReplayScreenshot {
} catch(Exception e) { } catch(Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
GuiReplaySaving.replaySaving = false;
locked = false; locked = false;
TickAndRenderListener.finishScreenshot(); TickAndRenderListener.finishScreenshot();
} }