Add basic replay restriction system (no restrictions yet)

This commit is contained in:
johni0702
2015-08-30 15:54:48 +02:00
parent 2bc79c0140
commit 6b6f6732d5
6 changed files with 127 additions and 16 deletions

View File

@@ -11,7 +11,9 @@ import eu.crushedpixel.replaymod.events.ReplayExitEvent;
import eu.crushedpixel.replaymod.gui.overlay.GuiReplayOverlay;
import eu.crushedpixel.replaymod.holders.*;
import eu.crushedpixel.replaymod.interpolation.KeyframeList;
import eu.crushedpixel.replaymod.registry.LightingHandler;
import eu.crushedpixel.replaymod.registry.PlayerHandler;
import eu.crushedpixel.replaymod.registry.ReplayGuiRegistry;
import eu.crushedpixel.replaymod.settings.RenderOptions;
import eu.crushedpixel.replaymod.utils.ReplayFile;
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
@@ -74,6 +76,11 @@ public class ReplayHandler {
*/
private static ReplayFile currentReplayFile;
/**
* Currently active replay restrictions.
*/
private static Restrictions restrictions;
public static KeyframeSet[] getKeyframeRepository() {
return keyframeRepository;
}
@@ -335,6 +342,8 @@ public class ReplayHandler {
setCameraTilt(0);
restrictions = new Restrictions();
networkManager = new NetworkManager(EnumPacketDirection.CLIENTBOUND) {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable t) {
@@ -399,6 +408,8 @@ public class ReplayHandler {
channel.close();
}
restrictions = new Restrictions();
networkManager = new NetworkManager(EnumPacketDirection.CLIENTBOUND) {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable t) {
@@ -459,8 +470,16 @@ public class ReplayHandler {
resetKeyframes(true);
PlayerHandler.resetHiddenPlayers();
ReplayGuiRegistry.show();
LightingHandler.setLighting(false);
if (mc.theWorld != null) {
mc.theWorld.sendQuittingDisconnectingPacket();
mc.loadWorld(null);
}
inReplay = false;
lastExit = System.currentTimeMillis();
FMLCommonHandler.instance().bus().post(new ReplayExitEvent());
}
@@ -553,4 +572,8 @@ public class ReplayHandler {
positionKeyframes.recalculate(ReplayMod.replaySettings.isLinearMovement());
timeKeyframes.recalculate(ReplayMod.replaySettings.isLinearMovement());
}
public static Restrictions getRestrictions() {
return restrictions;
}
}