Removed not working Shutdown Hook Thread
Fixed Hunger Bar not properly rendering while Recording Indicator enabled
This commit is contained in:
@@ -25,6 +25,7 @@ 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.events.TickAndRenderListener;
|
||||||
|
import eu.crushedpixel.replaymod.gui.GuiReplaySaving;
|
||||||
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;
|
||||||
@@ -35,15 +36,15 @@ import eu.crushedpixel.replaymod.settings.ReplaySettings;
|
|||||||
@Mod(modid = ReplayMod.MODID, version = ReplayMod.VERSION)
|
@Mod(modid = ReplayMod.MODID, version = ReplayMod.VERSION)
|
||||||
public class ReplayMod
|
public class ReplayMod
|
||||||
{
|
{
|
||||||
|
|
||||||
//TODO: Set ReplayHandler replaying to false when replay is exited
|
//TODO: Set ReplayHandler replaying to false when replay is exited
|
||||||
//TODO: Hide Titles upon hurrying
|
//TODO: Hide Titles upon hurrying
|
||||||
//TODO: Override Enchantment Rendering for items when replaying (to adjust speed of animation)
|
//TODO: Override Enchantment Rendering for items when replaying (to adjust speed of animation)
|
||||||
|
|
||||||
//TODO: Show the player whether he has already uploaded a replay
|
//TODO: Show the player whether he has already uploaded a replay
|
||||||
|
|
||||||
//TODO: Hinting to the b/v key feature
|
//TODO: Hinting to the b/v key feature
|
||||||
|
|
||||||
//XXX
|
//XXX
|
||||||
//Known Bugs
|
//Known Bugs
|
||||||
//
|
//
|
||||||
@@ -52,23 +53,23 @@ public class ReplayMod
|
|||||||
//Incompatible with Shaders Mod
|
//Incompatible with Shaders Mod
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
public static final String MODID = "replaymod";
|
public static final String MODID = "replaymod";
|
||||||
public static final String VERSION = "0.0.1";
|
public static final String VERSION = "0.0.1";
|
||||||
|
|
||||||
private static final Minecraft mc = Minecraft.getMinecraft();
|
private static final Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
|
||||||
public static GuiReplayOverlay overlay = new GuiReplayOverlay();
|
public static GuiReplayOverlay overlay = new GuiReplayOverlay();
|
||||||
|
|
||||||
public static ReplaySettings replaySettings;
|
public static ReplaySettings replaySettings;
|
||||||
public static Configuration config;
|
public static Configuration config;
|
||||||
|
|
||||||
public static boolean firstMainMenu = true;
|
public static boolean firstMainMenu = true;
|
||||||
|
|
||||||
public static RecordingHandler recordingHandler;
|
public static RecordingHandler recordingHandler;
|
||||||
|
|
||||||
public static int TP_DISTANCE_LIMIT = 128;
|
public static int TP_DISTANCE_LIMIT = 128;
|
||||||
|
|
||||||
public static final ApiClient apiClient = new ApiClient();
|
public static final ApiClient apiClient = new ApiClient();
|
||||||
|
|
||||||
// The instance of your mod that Forge uses.
|
// The instance of your mod that Forge uses.
|
||||||
@@ -79,7 +80,7 @@ public class ReplayMod
|
|||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
config = new Configuration(event.getSuggestedConfigurationFile());
|
config = new Configuration(event.getSuggestedConfigurationFile());
|
||||||
config.load();
|
config.load();
|
||||||
|
|
||||||
replaySettings = new ReplaySettings();
|
replaySettings = new ReplaySettings();
|
||||||
replaySettings.readValues();
|
replaySettings.readValues();
|
||||||
}
|
}
|
||||||
@@ -88,9 +89,9 @@ public class ReplayMod
|
|||||||
public void init(FMLInitializationEvent event) {
|
public void init(FMLInitializationEvent event) {
|
||||||
FMLCommonHandler.instance().bus().register(new ConnectionEventHandler());
|
FMLCommonHandler.instance().bus().register(new ConnectionEventHandler());
|
||||||
MinecraftForge.EVENT_BUS.register(new GuiEventHandler());
|
MinecraftForge.EVENT_BUS.register(new GuiEventHandler());
|
||||||
|
|
||||||
FMLCommonHandler.instance().bus().register(new KeyInputHandler());
|
FMLCommonHandler.instance().bus().register(new KeyInputHandler());
|
||||||
|
|
||||||
recordingHandler = new RecordingHandler();
|
recordingHandler = new RecordingHandler();
|
||||||
FMLCommonHandler.instance().bus().register(recordingHandler);
|
FMLCommonHandler.instance().bus().register(recordingHandler);
|
||||||
MinecraftForge.EVENT_BUS.register(recordingHandler);
|
MinecraftForge.EVENT_BUS.register(recordingHandler);
|
||||||
@@ -101,22 +102,22 @@ public class ReplayMod
|
|||||||
overlay = new GuiReplayOverlay();
|
overlay = new GuiReplayOverlay();
|
||||||
FMLCommonHandler.instance().bus().register(overlay);
|
FMLCommonHandler.instance().bus().register(overlay);
|
||||||
MinecraftForge.EVENT_BUS.register(overlay);
|
MinecraftForge.EVENT_BUS.register(overlay);
|
||||||
|
|
||||||
TickAndRenderListener tarl = new TickAndRenderListener();
|
TickAndRenderListener tarl = new TickAndRenderListener();
|
||||||
FMLCommonHandler.instance().bus().register(tarl);
|
FMLCommonHandler.instance().bus().register(tarl);
|
||||||
MinecraftForge.EVENT_BUS.register(tarl);
|
MinecraftForge.EVENT_BUS.register(tarl);
|
||||||
|
|
||||||
KeybindRegistry.initialize();
|
KeybindRegistry.initialize();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mc.entityRenderer = new SafeEntityRenderer(mc, mc.entityRenderer);
|
mc.entityRenderer = new SafeEntityRenderer(mc, mc.entityRenderer);
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
//clean up replay_recordings folder
|
//clean up replay_recordings folder
|
||||||
removeTmcprFiles();
|
removeTmcprFiles();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
boolean auth = false;
|
boolean auth = false;
|
||||||
try {
|
try {
|
||||||
@@ -125,28 +126,20 @@ public class ReplayMod
|
|||||||
JOptionPane.showMessageDialog(null, "Couldn't connect to the Replay Mod Server to verify whether you donated!");
|
JOptionPane.showMessageDialog(null, "Couldn't connect to the Replay Mod Server to verify whether you donated!");
|
||||||
FMLCommonHandler.instance().exitJava(0, false);
|
FMLCommonHandler.instance().exitJava(0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!auth) {
|
if(!auth) {
|
||||||
JOptionPane.showMessageDialog(null, "It seems like you didn't donate, so you can't use the Replay Mod yet.");
|
JOptionPane.showMessageDialog(null, "It seems like you didn't donate, so you can't use the Replay Mod yet.");
|
||||||
FMLCommonHandler.instance().exitJava(0, false);
|
FMLCommonHandler.instance().exitJava(0, false);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
LightingHandler.setLighting(false);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeTmcprFiles() {
|
private void removeTmcprFiles() {
|
||||||
File folder = new File("./replay_recordings/");
|
File folder = new File("./replay_recordings/");
|
||||||
folder.mkdirs();
|
folder.mkdirs();
|
||||||
|
|
||||||
for(File f : folder.listFiles()) {
|
for(File f : folder.listFiles()) {
|
||||||
if("."+FilenameUtils.getExtension(f.getAbsolutePath()) == ConnectionEventHandler.TEMP_FILE_EXTENSION) {
|
if(("."+FilenameUtils.getExtension(f.getAbsolutePath())).equals(ConnectionEventHandler.TEMP_FILE_EXTENSION)) {
|
||||||
f.delete();
|
f.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void renderRecordingIndicator(RenderGameOverlayEvent.Post event) {
|
public void renderRecordingIndicator(RenderGameOverlayEvent.Text event) {
|
||||||
if(!ReplayHandler.isInReplay() && ReplayMod.replaySettings.showRecordingIndicator() && ConnectionEventHandler.isRecording()) {
|
if(!ReplayHandler.isInReplay() && ReplayMod.replaySettings.showRecordingIndicator() && ConnectionEventHandler.isRecording()) {
|
||||||
GlStateManager.resetColor();
|
GlStateManager.resetColor();
|
||||||
GlStateManager.enableAlpha();
|
GlStateManager.enableAlpha();
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public abstract class DataListener extends ChannelInboundHandlerAdapter {
|
|||||||
|
|
||||||
String[] pl = players.toArray(new String[players.size()]);
|
String[] pl = players.toArray(new String[players.size()]);
|
||||||
|
|
||||||
ReplayMetaData metaData = new ReplayMetaData(singleplayer, worldName, (int) lastSentPacket, startTime, pl, mcversion);
|
ReplayMetaData metaData = new ReplayMetaData(singleplayer, worldName, (int)lastSentPacket, startTime, pl, mcversion);
|
||||||
String json = gson.toJson(metaData);
|
String json = gson.toJson(metaData);
|
||||||
|
|
||||||
File folder = new File("./replay_recordings/");
|
File folder = new File("./replay_recordings/");
|
||||||
|
|||||||
Reference in New Issue
Block a user