Fix all warnings
Add and make use of Lombok Remove Mojang API Remove ZipFileUtils Remove StreamTools in favor of Apache IOUtils Keyframe should be abstract all derivatives final Replace clone in Keyframe with copy Move some constants from GuiReplaySetttings to GuiConstants
This commit is contained in:
@@ -97,15 +97,17 @@ public class GuiEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onInit(InitGuiEvent event) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<GuiButton> buttonList = event.buttonList;
|
||||
if(event.gui instanceof GuiIngameMenu && ReplayHandler.isInReplay()) {
|
||||
ReplayMod.replaySender.setReplaySpeed(0);
|
||||
for(GuiButton b : new ArrayList<GuiButton>(event.buttonList)) {
|
||||
for(GuiButton b : new ArrayList<GuiButton>(buttonList)) {
|
||||
if(b.id == 1) {
|
||||
b.displayString = I18n.format("replaymod.gui.exit");
|
||||
b.yPosition -= 24 * 2;
|
||||
b.id = GuiConstants.EXIT_REPLAY_BUTTON;
|
||||
} else if(b.id >= 5 && b.id <= 7) {
|
||||
event.buttonList.remove(b);
|
||||
buttonList.remove(b);
|
||||
} else if(b.id != 4) {
|
||||
b.yPosition -= 24 * 2;
|
||||
}
|
||||
@@ -113,7 +115,7 @@ public class GuiEventHandler {
|
||||
} else if(event.gui instanceof GuiMainMenu) {
|
||||
int i1 = event.gui.height / 4 + 24 + 10;
|
||||
|
||||
for(GuiButton b : (List<GuiButton>) event.buttonList) {
|
||||
for(GuiButton b : buttonList) {
|
||||
if(b.id != 0 && b.id != 4 && b.id != 5) {
|
||||
b.yPosition = b.yPosition - 2 * 24 + 10;
|
||||
}
|
||||
@@ -122,23 +124,23 @@ public class GuiEventHandler {
|
||||
GuiButton rm = new GuiButton(GuiConstants.REPLAY_MANAGER_BUTTON_ID, event.gui.width / 2 - 100, i1 + 2 * 24, I18n.format("replaymod.gui.replayviewer"));
|
||||
rm.width = rm.width / 2 - 2;
|
||||
//rm.enabled = AuthenticationHandler.isAuthenticated();
|
||||
event.buttonList.add(rm);
|
||||
buttonList.add(rm);
|
||||
|
||||
replayCount = ReplayFileIO.getAllReplayFiles().size();
|
||||
|
||||
GuiButton re = new GuiButton(GuiConstants.REPLAY_EDITOR_BUTTON_ID, event.gui.width / 2 + 2, i1 + 2 * 24, I18n.format("replaymod.gui.replayeditor"));
|
||||
re.width = re.width / 2 - 2;
|
||||
re.enabled = VersionValidator.isValid && replayCount > 0;
|
||||
event.buttonList.add(re);
|
||||
buttonList.add(re);
|
||||
|
||||
editorButton = re;
|
||||
|
||||
GuiButton rc = new GuiButton(GuiConstants.REPLAY_CENTER_BUTTON_ID, event.gui.width / 2 - 100, i1 + 3 * 24, I18n.format("replaymod.gui.replaycenter"));
|
||||
rc.enabled = true;
|
||||
event.buttonList.add(rc);
|
||||
buttonList.add(rc);
|
||||
|
||||
} else if(event.gui instanceof GuiOptions) {
|
||||
event.buttonList.add(new GuiButton(GuiConstants.REPLAY_OPTIONS_BUTTON_ID,
|
||||
buttonList.add(new GuiButton(GuiConstants.REPLAY_OPTIONS_BUTTON_ID,
|
||||
event.gui.width / 2 - 155, event.gui.height / 6 + 48 - 6 - 24, 310, 20, I18n.format("replaymod.gui.settings.title")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ReportedException;
|
||||
import net.minecraftforge.client.event.MouseEvent;
|
||||
@@ -116,26 +115,6 @@ public class MinecraftTicker {
|
||||
mc.refreshResources();
|
||||
}
|
||||
|
||||
if(i == 17 && Keyboard.isKeyDown(61)) {
|
||||
;
|
||||
}
|
||||
|
||||
if(i == 18 && Keyboard.isKeyDown(61)) {
|
||||
;
|
||||
}
|
||||
|
||||
if(i == 47 && Keyboard.isKeyDown(61)) {
|
||||
;
|
||||
}
|
||||
|
||||
if(i == 38 && Keyboard.isKeyDown(61)) {
|
||||
;
|
||||
}
|
||||
|
||||
if(i == 22 && Keyboard.isKeyDown(61)) {
|
||||
;
|
||||
}
|
||||
|
||||
if(i == 20 && Keyboard.isKeyDown(61)) {
|
||||
mc.refreshResources();
|
||||
}
|
||||
@@ -179,10 +158,12 @@ public class MinecraftTicker {
|
||||
mc.gameSettings.thirdPersonView = 0;
|
||||
}
|
||||
|
||||
if(mc.gameSettings.thirdPersonView == 0) {
|
||||
mc.entityRenderer.loadEntityShader(mc.getRenderViewEntity());
|
||||
} else if(mc.gameSettings.thirdPersonView == 1) {
|
||||
mc.entityRenderer.loadEntityShader((Entity) null);
|
||||
if (mc.entityRenderer != null) {
|
||||
if (mc.gameSettings.thirdPersonView == 0) {
|
||||
mc.entityRenderer.loadEntityShader(mc.getRenderViewEntity());
|
||||
} else if (mc.gameSettings.thirdPersonView == 1) {
|
||||
mc.entityRenderer.loadEntityShader(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,30 +203,23 @@ public class MinecraftTicker {
|
||||
mc.playerController.onStoppedUsingItem(mc.thePlayer);
|
||||
}
|
||||
|
||||
label435:
|
||||
|
||||
while(true) {
|
||||
if(!mc.gameSettings.keyBindAttack.isPressed()) {
|
||||
while(mc.gameSettings.keyBindUseItem.isPressed()) {
|
||||
;
|
||||
}
|
||||
|
||||
while(true) {
|
||||
if(mc.gameSettings.keyBindPickBlock.isPressed()) {
|
||||
continue;
|
||||
if (!mc.gameSettings.keyBindUseItem.isPressed()
|
||||
&& !mc.gameSettings.keyBindPickBlock.isPressed()) {
|
||||
break;
|
||||
}
|
||||
|
||||
break label435;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mc != null && mc.thePlayer != null)
|
||||
if(mc.thePlayer != null)
|
||||
mc.sendClickBlockToController(mc.currentScreen == null && mc.gameSettings.keyBindAttack.isKeyDown() && mc.inGameHasFocus);
|
||||
|
||||
if(mc != null)
|
||||
mc.systemTime = Minecraft.getSystemTime();
|
||||
mc.systemTime = Minecraft.getSystemTime();
|
||||
} catch (ReportedException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -24,16 +24,12 @@ import net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemPickupEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RecordingHandler {
|
||||
|
||||
public static final int entityID = Integer.MIN_VALUE + 9001;
|
||||
|
||||
private final Minecraft mc = Minecraft.getMinecraft();
|
||||
private Double lastX = null, lastY = null, lastZ = null;
|
||||
private List<Integer> lastEffects = new ArrayList<Integer>();
|
||||
private ItemStack[] playerItems = new ItemStack[5];
|
||||
private int ticksSinceLastCorrection = 0;
|
||||
private boolean wasSleeping = false;
|
||||
@@ -81,7 +77,7 @@ public class RecordingHandler {
|
||||
PacketBuffer pb = new PacketBuffer(bb);
|
||||
|
||||
pb.writeVarIntToBuffer(entityID);
|
||||
pb.writeUuid(player.getUUID(player.getGameProfile()));
|
||||
pb.writeUuid(EntityPlayer.getUUID(player.getGameProfile()));
|
||||
|
||||
pb.writeInt(MathHelper.floor_double(player.posX * 32.0D));
|
||||
pb.writeInt(MathHelper.floor_double(player.posY * 32.0D));
|
||||
@@ -106,7 +102,6 @@ public class RecordingHandler {
|
||||
public void resetVars() {
|
||||
lastX = lastY = lastZ = null;
|
||||
rotationYawHeadBefore = null;
|
||||
lastEffects = new ArrayList<Integer>();
|
||||
playerItems = new ItemStack[5];
|
||||
}
|
||||
|
||||
@@ -139,7 +134,7 @@ public class RecordingHandler {
|
||||
lastY = e.player.posY;
|
||||
lastZ = e.player.posZ;
|
||||
|
||||
Packet packet = null;
|
||||
Packet packet;
|
||||
if(force || Math.abs(dx) > 4.0 || Math.abs(dy) > 4.0 || Math.abs(dz) > 4.0) {
|
||||
int x = MathHelper.floor_double(e.player.posX * 32.0D);
|
||||
int y = MathHelper.floor_double(e.player.posY * 32.0D);
|
||||
@@ -148,14 +143,9 @@ public class RecordingHandler {
|
||||
byte pitch = (byte) ((int) (e.player.rotationPitch * 256.0F / 360.0F));
|
||||
packet = new S18PacketEntityTeleport(entityID, x, y, z, yaw, pitch, e.player.onGround);
|
||||
} else {
|
||||
byte oldYaw = (byte) ((int) (e.player.prevRotationYaw * 256.0F / 360.0F));
|
||||
byte newYaw = (byte) ((int) (e.player.rotationYaw * 256.0F / 360.0F));
|
||||
byte oldPitch = (byte) ((int) (e.player.prevRotationPitch * 256.0F / 360.0F));
|
||||
byte newPitch = (byte) ((int) (e.player.rotationPitch * 256.0F / 360.0F));
|
||||
|
||||
byte dPitch = (byte) (newPitch - oldPitch);
|
||||
byte dYaw = (byte) (newYaw - oldYaw);
|
||||
|
||||
packet = new S17PacketEntityLookMove(entityID,
|
||||
(byte) Math.round(dx * 32), (byte) Math.round(dy * 32), (byte) Math.round(dz * 32),
|
||||
newYaw, newPitch, e.player.onGround);
|
||||
|
||||
@@ -21,8 +21,6 @@ public class TickAndRenderListener {
|
||||
|
||||
private static int requestScreenshot = 0;
|
||||
|
||||
//private boolean f1Down = false;
|
||||
|
||||
public static void requestScreenshot() {
|
||||
if(requestScreenshot == 0) requestScreenshot = 1;
|
||||
}
|
||||
@@ -82,17 +80,16 @@ public class TickAndRenderListener {
|
||||
@SubscribeEvent
|
||||
public void onMouseMove(MouseEvent event) {
|
||||
if(!ReplayHandler.isInReplay()) return;
|
||||
boolean flag = true;
|
||||
|
||||
mc.mcProfiler.startSection("mouse");
|
||||
|
||||
if(flag && Minecraft.isRunningOnMac && mc.inGameHasFocus && !Mouse.isInsideWindow()) {
|
||||
if(Minecraft.isRunningOnMac && mc.inGameHasFocus && !Mouse.isInsideWindow()) {
|
||||
Mouse.setGrabbed(false);
|
||||
Mouse.setCursorPosition(Display.getWidth() / 2, Display.getHeight() / 2);
|
||||
Mouse.setGrabbed(true);
|
||||
}
|
||||
|
||||
if(mc.inGameHasFocus && flag && !(ReplayHandler.isInPath())) {
|
||||
if(mc.inGameHasFocus && !(ReplayHandler.isInPath())) {
|
||||
mc.mouseHelper.mouseXYChange();
|
||||
float f1 = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
|
||||
float f2 = f1 * f1 * f1 * 8.0F;
|
||||
|
||||
Reference in New Issue
Block a user