Started implementing authentication system
Added information (MC Version and online Users) to Replay Metadata
This commit is contained in:
@@ -15,7 +15,8 @@ import net.minecraftforge.client.event.GuiOpenEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import eu.crushedpixel.replaymod.gui.GuiCustomOptions;
|
||||
import eu.crushedpixel.replaymod.ReplayMod;
|
||||
import eu.crushedpixel.replaymod.authentication.AuthenticationHandler;
|
||||
import eu.crushedpixel.replaymod.gui.GuiExitReplay;
|
||||
import eu.crushedpixel.replaymod.gui.GuiReplayManager;
|
||||
import eu.crushedpixel.replaymod.gui.GuiReplaySaving;
|
||||
@@ -27,6 +28,7 @@ public class GuiEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onGui(GuiOpenEvent event) {
|
||||
if(!AuthenticationHandler.isAuthenticated()) return;
|
||||
if(event.gui instanceof GuiChat || event.gui instanceof GuiInventory) {
|
||||
if(ReplayHandler.replayActive()) {
|
||||
event.setCanceled(true);
|
||||
@@ -60,7 +62,9 @@ public class GuiEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
event.buttonList.add(new GuiButton(REPLAY_MANAGER_ID, event.gui.width / 2 - 100, i1 + 2*24, I18n.format("Replay Manager", new Object[0])));
|
||||
GuiButton rm = new GuiButton(REPLAY_MANAGER_ID, event.gui.width / 2 - 100, i1 + 2*24, I18n.format("Replay Manager", new Object[0]));
|
||||
rm.enabled = AuthenticationHandler.isAuthenticated();
|
||||
event.buttonList.add(rm);
|
||||
} else if(event.gui instanceof GuiOptions) {
|
||||
event.buttonList.add(new GuiButton(9001, event.gui.width / 2 - 155, event.gui.height / 6 + 48 - 6 - 24, 310, 20, "Replay Mod Settings..."));
|
||||
}
|
||||
@@ -68,6 +72,7 @@ public class GuiEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onButton(ActionPerformedEvent event) {
|
||||
if(!AuthenticationHandler.isAuthenticated()) return;
|
||||
if(event.gui instanceof GuiMainMenu && event.button.id == REPLAY_MANAGER_ID) {
|
||||
if(ConnectionEventHandler.saving) {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new GuiReplaySaving());
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
package eu.crushedpixel.replaymod.events;
|
||||
|
||||
import java.awt.Color;
|
||||
@@ -25,10 +26,12 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import eu.crushedpixel.replaymod.ReplayMod;
|
||||
import eu.crushedpixel.replaymod.entities.CameraEntity;
|
||||
import eu.crushedpixel.replaymod.entities.CameraEntity.MoveDirection;
|
||||
import eu.crushedpixel.replaymod.gui.GuiMouseInput;
|
||||
@@ -199,6 +202,13 @@ public class GuiReplayOverlay extends Gui {
|
||||
mc.displayGuiScreen((GuiScreen)null);
|
||||
}
|
||||
|
||||
CameraEntity cam = ReplayHandler.getCameraEntity();
|
||||
if(cam != null) {
|
||||
ReplayHandler.setLastPosition(new Position(cam.posX, cam.posY, cam.posZ, cam.rotationPitch, cam.rotationYaw));
|
||||
} else {
|
||||
ReplayHandler.setLastPosition(null);
|
||||
}
|
||||
|
||||
ReplayHandler.setReplayPos((int)time);
|
||||
}
|
||||
}
|
||||
@@ -736,7 +746,7 @@ public class GuiReplayOverlay extends Gui {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMouseMove(MouseEvent event) {
|
||||
if(!ReplayHandler.replayActive()) return;
|
||||
@@ -777,7 +787,11 @@ public class GuiReplayOverlay extends Gui {
|
||||
if(FMLClientHandler.instance().isGUIOpen(GuiMouseInput.class)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_V) && !Keyboard.isRepeatEvent() && Keyboard.getKeyCount() == 1) {
|
||||
ReplayMod.replaySettings.setLightingEnabled(!ReplayMod.replaySettings.isLightingEnabled());
|
||||
}
|
||||
|
||||
KeyBinding[] keyBindings = Minecraft.getMinecraft().gameSettings.keyBindings;
|
||||
for(KeyBinding kb : keyBindings) {
|
||||
if(!kb.isKeyDown()) {
|
||||
|
||||
@@ -30,11 +30,4 @@ public class ReplayTickHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onFovChange(FOVUpdateEvent event) {
|
||||
if(ReplayHandler.replayActive()) {
|
||||
event.newfov = 1f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user