Deprecate most static fields in ReplayMod class

Fix replay restarting
This commit is contained in:
johni0702
2015-10-04 20:09:57 +02:00
parent 4d27875955
commit fd4ec8e2f9
8 changed files with 69 additions and 35 deletions

View File

@@ -2,7 +2,6 @@ package com.replaymod.replay;
import com.google.common.base.Preconditions;
import com.mojang.authlib.GameProfile;
import com.replaymod.core.ReplayMod;
import com.replaymod.replay.events.ReplayCloseEvent;
import com.replaymod.replay.events.ReplayOpenEvent;
import com.replaymod.replay.gui.overlay.GuiReplayOverlay;
@@ -83,9 +82,6 @@ public class ReplayHandler {
markers = replayFile.getMarkers().or(Collections.<Marker>emptySet());
// TODO: get rid of chat message handler
ReplayMod.chatMessageHandler.initialize();
replaySender = new ReplaySender(this, replayFile, asyncMode);
setup();
@@ -312,9 +308,9 @@ public class ReplayHandler {
Display.update();
// Send the packets
ReplayMod.replaySender.sendPacketsTill(targetTime);
ReplayMod.replaySender.setAsyncMode(true);
ReplayMod.replaySender.setReplaySpeed(0);
replaySender.sendPacketsTill(targetTime);
replaySender.setAsyncMode(true);
replaySender.setReplaySpeed(0);
mc.getNetHandler().getNetworkManager().processReceivedPackets();
@SuppressWarnings("unchecked")

View File

@@ -8,7 +8,6 @@ import com.replaymod.replay.handler.GuiHandler;
import de.johni0702.replaystudio.replay.ReplayFile;
import de.johni0702.replaystudio.replay.ZipReplayFile;
import de.johni0702.replaystudio.studio.ReplayStudio;
import eu.crushedpixel.replaymod.chat.ChatMessageHandler;
import net.minecraft.client.Minecraft;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
@@ -61,8 +60,7 @@ public class ReplayModReplay {
public void onSuccess(NoGuiScreenshot result) {
try {
replayHandler.getReplayFile().writeThumb(result.getImage());
ReplayMod.chatMessageHandler.addLocalizedChatMessage("replaymod.chat.savedthumb",
ChatMessageHandler.ChatMessageType.INFORMATION);
core.printInfoToChat("replaymod.chat.savedthumb");
} catch (IOException e) {
e.printStackTrace();
}

View File

@@ -4,7 +4,6 @@ import com.google.common.base.Preconditions;
import com.google.common.io.Files;
import com.google.common.util.concurrent.ListenableFutureTask;
import de.johni0702.replaystudio.replay.ReplayFile;
import com.replaymod.core.ReplayMod;
import eu.crushedpixel.replaymod.holders.PacketData;
import eu.crushedpixel.replaymod.replay.Restrictions;
import eu.crushedpixel.replaymod.settings.ReplaySettings;
@@ -67,6 +66,8 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
S39PacketPlayerAbilities.class,
S45PacketTitle.class);
private static int TP_DISTANCE_LIMIT = 128;
/**
* The replay handler responsible for the current replay.
*/
@@ -404,8 +405,8 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
}
if(cent != null) {
if(!allowMovement && !((Math.abs(cent.posX - ppl.func_148932_c()) > ReplayMod.TP_DISTANCE_LIMIT) ||
(Math.abs(cent.posZ - ppl.func_148933_e()) > ReplayMod.TP_DISTANCE_LIMIT))) {
if(!allowMovement && !((Math.abs(cent.posX - ppl.func_148932_c()) > TP_DISTANCE_LIMIT) ||
(Math.abs(cent.posZ - ppl.func_148933_e()) > TP_DISTANCE_LIMIT))) {
return null;
} else {
allowMovement = false;