Add 1.7.10 version

This commit is contained in:
Jonas Herzig
2018-03-07 22:00:30 +01:00
parent fbbca76099
commit eb04eb47dc
106 changed files with 2083 additions and 251 deletions

View File

@@ -13,11 +13,20 @@ import net.minecraft.util.ReportedException;
import net.minecraft.util.Timer;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
//#if MC>=10800
import net.minecraftforge.fml.common.FMLCommonHandler;
import java.io.IOException;
//#else
//$$ import cpw.mods.fml.common.FMLCommonHandler;
//$$ import cpw.mods.fml.common.eventhandler.Event;
//$$ import net.minecraft.client.renderer.entity.RenderManager;
//$$
//$$ import static com.replaymod.core.versions.MCVer.FML_BUS;
//#endif
public class InputReplayTimer extends WrappedTimer {
private final ReplayModReplay mod;
@@ -33,6 +42,11 @@ public class InputReplayTimer extends WrappedTimer {
public void updateTimer() {
super.updateTimer();
// 1.7.10: We have to run the scheduled executables (ours only) because MC would only run them every tick
//#if MC<=10710
//$$ FML_BUS.post(new RunScheduledTasks());
//#endif
// If we are in a replay, we have to manually process key and mouse events as the
// tick speed may vary or there may not be any ticks at all (when the replay is paused)
if (mod.getReplayHandler() != null) {
@@ -45,11 +59,15 @@ public class InputReplayTimer extends WrappedTimer {
handleKeyEvent();
}
} else {
//#if MC>=10800
try {
mc.currentScreen.handleInput();
} catch (IOException e) { // *SIGH*
e.printStackTrace();
}
//#else
//$$ mc.currentScreen.handleInput();
//#endif
}
}
}
@@ -91,17 +109,22 @@ public class InputReplayTimer extends WrappedTimer {
mc.setIngameFocus();
}
} else {
//#if MC>=10800
try {
mc.currentScreen.handleMouseInput();
} catch (IOException e) { // WHO IS RESPONSIBLE FOR THIS MESS?!?
e.printStackTrace();
}
//#else
//$$ mc.currentScreen.handleMouseInput();
//#endif
}
FMLCommonHandler.instance().fireMouseInput();
}
protected void handleKeyEvent() {
// TODO 1.7.10: This might be missing some 1.7.10-only key bindings or implement some of them incorrectly
int key = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey();
boolean pressed = Keyboard.getEventKeyState();
@@ -131,15 +154,23 @@ public class InputReplayTimer extends WrappedTimer {
if (pressed) {
// This might be subject to change as vanilla shaders are still kinda unused in 1.8
if (key == Keyboard.KEY_F4 && mc.entityRenderer != null) {
//#if MC>=10800
mc.entityRenderer.switchUseShader();
//#else
//$$ mc.entityRenderer.activateNextShader();
//#endif
}
if (mc.currentScreen != null) {
//#if MC>=10800
try {
mc.currentScreen.handleKeyboardInput();
} catch (IOException e) { // AND WHO THOUGHT THIS WAS A GREAT IDEA?
e.printStackTrace();
}
//#else
//$$ mc.currentScreen.handleKeyboardInput();
//#endif
} else {
if (key == Keyboard.KEY_ESCAPE) {
mc.displayInGameMenu();
@@ -176,7 +207,11 @@ public class InputReplayTimer extends WrappedTimer {
}
if (key == 48 && Keyboard.isKeyDown(61)) {
//#if MC>=10800
mc.getRenderManager().setDebugBoundingBox(!mc.getRenderManager().isDebugBoundingBox());
//#else
//$$ RenderManager.debugBoundingBox = !RenderManager.debugBoundingBox;
//#endif
}
if (key == 25 && Keyboard.isKeyDown(61)) {
@@ -196,6 +231,7 @@ public class InputReplayTimer extends WrappedTimer {
if (mc.gameSettings.keyBindTogglePerspective.isPressed()) {
mc.gameSettings.thirdPersonView = (mc.gameSettings.thirdPersonView + 1) % 3;
//#if MC>=10800
if (mc.entityRenderer != null) { // Extra check, not in vanilla code
if (mc.gameSettings.thirdPersonView == 0) {
mc.entityRenderer.loadEntityShader(mc.getRenderViewEntity());
@@ -203,6 +239,7 @@ public class InputReplayTimer extends WrappedTimer {
mc.entityRenderer.loadEntityShader(null);
}
}
//#endif
}
}
@@ -222,4 +259,8 @@ public class InputReplayTimer extends WrappedTimer {
FMLCommonHandler.instance().fireKeyInput();
}
//#if MC<=10710
//$$ public static class RunScheduledTasks extends Event {}
//#endif
}