Started creating GuiEditKeyframe
Therefore, added support for floating point numbers in GuiNumberInput
This commit is contained in:
@@ -118,12 +118,13 @@ public class GuiReplayOverlay extends Gui {
|
||||
@SubscribeEvent
|
||||
public void onRenderGui(RenderGameOverlayEvent.Post event) throws IllegalArgumentException, IllegalAccessException {
|
||||
|
||||
if(!ReplayHandler.isInReplay() || FMLClientHandler.instance().isGUIOpen(GuiSpectateSelection.class)
|
||||
if(!ReplayHandler.isInReplay() || FMLClientHandler.instance().isGUIOpen(GuiPlayerOverview.class)
|
||||
|| VideoWriter.isRecording() || FMLClientHandler.instance().isGUIOpen(GuiKeyframeRepository.class)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!ReplayGuiRegistry.hidden) ReplayGuiRegistry.hide();
|
||||
if(!ReplayGuiRegistry.hidden && ReplayHandler.isCamera()) ReplayGuiRegistry.hide();
|
||||
else if(!ReplayHandler.isCamera() && ReplayGuiRegistry.hidden) ReplayGuiRegistry.show();
|
||||
|
||||
if(FMLClientHandler.instance().isGUIOpen(GuiChat.class) || FMLClientHandler.instance().isGUIOpen(GuiInventory.class)) {
|
||||
mc.displayGuiScreen(new GuiMouseInput());
|
||||
@@ -308,7 +309,7 @@ public class GuiReplayOverlay extends Gui {
|
||||
GlStateManager.resetColor();
|
||||
this.drawModalRectWithCustomSizedTexture(time_ButtonX, time_ButtonY, x, y, 20, 20, 64, 64);
|
||||
|
||||
if(mouseX >= (timelineX + 4) && mouseX <= width - 18 && mouseY >= 11 && mouseY <= 29) {
|
||||
if(mouseX >= (timelineX + 4) && mouseX <= width - 18 && mouseY >= 11 && mouseY <= 29 && mc.currentScreen == null) {
|
||||
double tot = (width - 18) - (timelineX + 4);
|
||||
double perc = (mouseX - (timelineX + 4)) / tot;
|
||||
long time = Math.round(perc * (double) ReplayMod.replaySender.replayLength());
|
||||
@@ -365,6 +366,8 @@ public class GuiReplayOverlay extends Gui {
|
||||
this.drawModalRectWithCustomSizedTexture(cursorX - 3, y + 3, 44, 0, 8, 16, 64, 64);
|
||||
}
|
||||
|
||||
private long keyframeSelectionTime = 0;
|
||||
|
||||
private void drawRealTimeline(int minX, int maxX, int y, int mouseX, int mouseY) {
|
||||
int zero = minX + tl_begin_width;
|
||||
int full = maxX - tl_end_width;
|
||||
@@ -469,7 +472,7 @@ public class GuiReplayOverlay extends Gui {
|
||||
}
|
||||
|
||||
//show Time String
|
||||
if(mouseX >= zero && mouseX <= full && mouseY >= y && mouseY <= y + 22) {
|
||||
if(mouseX >= zero && mouseX <= full && mouseY >= y && mouseY <= y + 22 && mc.currentScreen == null) {
|
||||
long tot = Math.round((double) timelineLength * zoom_scale);
|
||||
double perc = (mouseX - (realTimelineX + 4)) / (double) (full - zero);
|
||||
|
||||
@@ -554,13 +557,23 @@ public class GuiReplayOverlay extends Gui {
|
||||
//tolerance is 2 pixels multiplied with the timespan of one pixel
|
||||
int tolerance = 2 * Math.round(abs_width / (float) width);
|
||||
|
||||
Keyframe close;
|
||||
if(mouseY >= y + 9) {
|
||||
TimeKeyframe close = ReplayHandler.getClosestTimeKeyframeForRealTime(ReplayHandler.getRealTimelineCursor(), tolerance);
|
||||
close = ReplayHandler.getClosestTimeKeyframeForRealTime(ReplayHandler.getRealTimelineCursor(), tolerance);
|
||||
ReplayHandler.selectKeyframe(close); //can be null, deselects keyframe
|
||||
} else {
|
||||
PositionKeyframe close = ReplayHandler.getClosestPlaceKeyframeForRealTime(ReplayHandler.getRealTimelineCursor(), tolerance);
|
||||
close = ReplayHandler.getClosestPlaceKeyframeForRealTime(ReplayHandler.getRealTimelineCursor(), tolerance);
|
||||
ReplayHandler.selectKeyframe(close); //can be null, deselects keyframe
|
||||
}
|
||||
|
||||
if(close != null) {
|
||||
long cur = System.currentTimeMillis();
|
||||
if(cur - keyframeSelectionTime < 500) { //if double click on Keyframe
|
||||
mc.displayGuiScreen(new GuiEditKeyframe(close));
|
||||
} else {
|
||||
keyframeSelectionTime = cur;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,8 +95,6 @@ public class RecordingHandler {
|
||||
|
||||
packet.readPacketData(pb);
|
||||
|
||||
packet.field_148960_i = player.getDataWatcher();
|
||||
|
||||
return packet;
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -320,7 +318,6 @@ public class RecordingHandler {
|
||||
if(event.entity.getEntityId() != mc.thePlayer.getEntityId()) {
|
||||
return;
|
||||
}
|
||||
;
|
||||
|
||||
S19PacketEntityStatus packet = new S19PacketEntityStatus();
|
||||
|
||||
@@ -358,7 +355,6 @@ public class RecordingHandler {
|
||||
if(event.entity.getEntityId() != mc.thePlayer.getEntityId()) {
|
||||
return;
|
||||
}
|
||||
;
|
||||
|
||||
S19PacketEntityStatus packet = new S19PacketEntityStatus();
|
||||
|
||||
@@ -404,7 +400,6 @@ public class RecordingHandler {
|
||||
if(event.entityPlayer != mc.thePlayer) {
|
||||
return;
|
||||
}
|
||||
;
|
||||
|
||||
System.out.println(event.getResult());
|
||||
S0APacketUseBed pub = new S0APacketUseBed();
|
||||
@@ -433,7 +428,6 @@ public class RecordingHandler {
|
||||
if(event.player != mc.thePlayer) {
|
||||
return;
|
||||
}
|
||||
;
|
||||
|
||||
S1BPacketEntityAttach pea = new S1BPacketEntityAttach();
|
||||
|
||||
|
||||
150
src/main/java/eu/crushedpixel/replaymod/gui/GuiEditKeyframe.java
Normal file
150
src/main/java/eu/crushedpixel/replaymod/gui/GuiEditKeyframe.java
Normal file
@@ -0,0 +1,150 @@
|
||||
package eu.crushedpixel.replaymod.gui;
|
||||
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiNumberInput;
|
||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||
import eu.crushedpixel.replaymod.holders.Position;
|
||||
import eu.crushedpixel.replaymod.holders.PositionKeyframe;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiEditKeyframe extends GuiScreen {
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
private GuiButton saveButton, cancelButton;
|
||||
|
||||
private GuiNumberInput xCoord, yCoord, zCoord, pitch, yaw;
|
||||
private List<GuiNumberInput> inputs = new ArrayList<GuiNumberInput>();
|
||||
|
||||
private int virtualHeight = 200;
|
||||
private int virtualY;
|
||||
|
||||
private Keyframe keyframe;
|
||||
private Keyframe keyframeBackup;
|
||||
private boolean save;
|
||||
private boolean posKeyframe;
|
||||
|
||||
private int w, w2;
|
||||
private int totalWidth;
|
||||
private int left;
|
||||
|
||||
public GuiEditKeyframe(Keyframe keyframe) {
|
||||
this.keyframe = keyframe;
|
||||
this.keyframeBackup = (Keyframe)keyframe.clone();
|
||||
this.posKeyframe = keyframe instanceof PositionKeyframe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
|
||||
virtualY = this.height - virtualHeight - 10;
|
||||
|
||||
if(!initialized) {
|
||||
saveButton = new GuiButton(GuiConstants.KEYFRAME_EDITOR_SAVE_BUTTON, 0, 0, 100, 20, I18n.format("replaymod.gui.save"));
|
||||
cancelButton = new GuiButton(GuiConstants.KEYFRAME_EDITOR_CANCEL_BUTTON, 0, 0, 100, 20, I18n.format("replaymod.gui.cancel"));
|
||||
|
||||
if(posKeyframe) {
|
||||
Position pos = ((PositionKeyframe)keyframe).getPosition();
|
||||
xCoord = new GuiNumberInput(GuiConstants.KEYFRAME_EDITOR_X_INPUT, fontRendererObj, 0, 0, 100, null, null, round(pos.getX()), true);
|
||||
yCoord = new GuiNumberInput(GuiConstants.KEYFRAME_EDITOR_Y_INPUT, fontRendererObj, 0, 0, 100, null, null, round(pos.getY()), true);
|
||||
zCoord = new GuiNumberInput(GuiConstants.KEYFRAME_EDITOR_Z_INPUT, fontRendererObj, 0, 0, 100, null, null, round(pos.getZ()), true);
|
||||
yaw = new GuiNumberInput(GuiConstants.KEYFRAME_EDITOR_YAW_INPUT, fontRendererObj, 0, 0, 100, -90d, 90d, round(pos.getYaw()), true);
|
||||
pitch = new GuiNumberInput(GuiConstants.KEYFRAME_EDITOR_PITCH_INPUT, fontRendererObj, 0, 0, 100, -180d, 180d, round(pos.getPitch()), true);
|
||||
|
||||
inputs.add(xCoord);
|
||||
inputs.add(yCoord);
|
||||
inputs.add(zCoord);
|
||||
inputs.add(yaw);
|
||||
inputs.add(pitch);
|
||||
}
|
||||
}
|
||||
|
||||
if(posKeyframe) {
|
||||
w = Math.max(fontRendererObj.getStringWidth(I18n.format("replaymod.gui.editkeyframe.xpos")),
|
||||
Math.max(fontRendererObj.getStringWidth(I18n.format("replaymod.gui.editkeyframe.ypos")),
|
||||
fontRendererObj.getStringWidth(I18n.format("replaymod.gui.editkeyframe.zpos"))));
|
||||
w2 = Math.max(fontRendererObj.getStringWidth(I18n.format("replaymod.gui.editkeyframe.camyaw")),
|
||||
fontRendererObj.getStringWidth(I18n.format("replaymod.gui.editkeyframe.campitch")));
|
||||
|
||||
totalWidth = w+100+w2+100+5+5+10;
|
||||
left = (this.width - totalWidth)/2;
|
||||
|
||||
int x = w + left + 5;
|
||||
int i=0;
|
||||
for(GuiNumberInput input : inputs) {
|
||||
input.xPosition = i < 3 ? x : left+totalWidth-100;
|
||||
input.yPosition = i < 3 ? virtualY + 20 + i*30 : virtualY + 20 + (i-3)*30;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
saveButton.yPosition = cancelButton.yPosition = virtualY + virtualHeight - 20 - 5;
|
||||
saveButton.xPosition = this.width - 100 - 5 - 10;
|
||||
cancelButton.xPosition = saveButton.xPosition - 100 - 5;
|
||||
|
||||
buttonList.add(saveButton);
|
||||
buttonList.add(cancelButton);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int keyCode) throws IOException {
|
||||
for(GuiNumberInput input : inputs) {
|
||||
if(input != null) input.textboxKeyTyped(typedChar, keyCode);
|
||||
}
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
||||
for(GuiNumberInput input : inputs) {
|
||||
if(input != null) input.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
}
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
for(GuiNumberInput input : inputs) {
|
||||
if(input != null) input.updateCursorCounter();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
drawGradientRect(10, virtualY, width - 10, virtualY + virtualHeight, -1072689136, -804253680);
|
||||
drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.title"), this.width / 2, virtualY + 5, Color.WHITE.getRGB());
|
||||
|
||||
if(posKeyframe) {
|
||||
drawString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.xpos"), left, virtualY + 27, Color.WHITE.getRGB());
|
||||
drawString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.ypos"), left, virtualY + 57, Color.WHITE.getRGB());
|
||||
drawString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.zpos"), left, virtualY + 87, Color.WHITE.getRGB());
|
||||
drawString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.camyaw"), left+totalWidth-100-5-w2, virtualY + 27, Color.WHITE.getRGB());
|
||||
drawString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.campitch"), left+totalWidth-100-5-w2, virtualY + 57, Color.WHITE.getRGB());
|
||||
}
|
||||
|
||||
for(GuiNumberInput input : inputs) {
|
||||
if(input != null) input.drawTextBox();
|
||||
}
|
||||
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
private double round(double val) {
|
||||
return Math.round(val*100.0) / 100.0;
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,16 @@ import java.awt.*;
|
||||
|
||||
public class GuiArrowButton extends GuiButton {
|
||||
|
||||
private boolean upwards = false;
|
||||
public enum Direction {
|
||||
UP, DOWN, RIGHT, LEFT;
|
||||
}
|
||||
|
||||
public GuiArrowButton(int buttonId, int x, int y, String buttonText, boolean upwards) {
|
||||
private Direction dir;
|
||||
|
||||
public GuiArrowButton(int buttonId, int x, int y, String buttonText, Direction dir) {
|
||||
super(buttonId, x, y, buttonText);
|
||||
|
||||
this.upwards = upwards;
|
||||
this.dir = dir;
|
||||
width = 20;
|
||||
height = 20;
|
||||
}
|
||||
@@ -21,14 +25,18 @@ public class GuiArrowButton extends GuiButton {
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
try {
|
||||
super.drawButton(mc, mouseX, mouseY);
|
||||
if(upwards) {
|
||||
if(dir == Direction.UP) {
|
||||
for(int i = 0; i <= Math.ceil(height / 2) - 5; i++) {
|
||||
drawHorizontalLine(xPosition + width - height + i + 4, xPosition + width - i - 6, yPosition + height - ((height / 3) + i + 2), Color.BLACK.getRGB());
|
||||
}
|
||||
} else {
|
||||
} else if(dir == Direction.DOWN) {
|
||||
for(int i = 0; i <= Math.ceil(height / 2) - 5; i++) {
|
||||
drawHorizontalLine(xPosition + width - height + i + 4, xPosition + width - i - 6, yPosition + (height / 3) + i + 2, Color.BLACK.getRGB());
|
||||
}
|
||||
} else if(dir == Direction.LEFT) {
|
||||
|
||||
} else if(dir == Direction.RIGHT) {
|
||||
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -5,19 +5,30 @@ import net.minecraft.client.gui.GuiTextField;
|
||||
|
||||
public class GuiNumberInput extends GuiTextField {
|
||||
|
||||
private int limit;
|
||||
private Double minimum, maximum;
|
||||
|
||||
private boolean acceptFloats = false;
|
||||
|
||||
public GuiNumberInput(int id, FontRenderer fontRenderer,
|
||||
int xPos, int yPos, int width, int limit) {
|
||||
int xPos, int yPos, int width, Double minimum, Double maximum, Double defaultValue, boolean acceptFloats) {
|
||||
super(id, fontRenderer, xPos, yPos, width, 20);
|
||||
this.limit = limit;
|
||||
this.minimum = minimum;
|
||||
this.maximum = maximum;
|
||||
this.acceptFloats = acceptFloats;
|
||||
if(defaultValue != null) setText(""+defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeText(String text) {
|
||||
try {
|
||||
Integer.valueOf(text);
|
||||
if(limit > 0 && (getText() + text).length() > limit) return;
|
||||
double val;
|
||||
if(acceptFloats) {
|
||||
val = Double.valueOf(getText() + text);
|
||||
} else {
|
||||
val = Integer.valueOf(getText() + text);
|
||||
}
|
||||
if(minimum != null && val < minimum) return;
|
||||
if(maximum != null && val > maximum) return;
|
||||
super.writeText(text);
|
||||
} catch(NumberFormatException e) {
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package eu.crushedpixel.replaymod.gui.elements;
|
||||
|
||||
import eu.crushedpixel.replaymod.api.client.holders.FileInfo;
|
||||
import eu.crushedpixel.replaymod.api.replay.holders.FileInfo;
|
||||
import eu.crushedpixel.replaymod.utils.ResourceHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package eu.crushedpixel.replaymod.gui.online;
|
||||
|
||||
import eu.crushedpixel.replaymod.api.client.ApiException;
|
||||
import eu.crushedpixel.replaymod.api.ApiException;
|
||||
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
||||
import eu.crushedpixel.replaymod.gui.PasswordTextField;
|
||||
import eu.crushedpixel.replaymod.online.authentication.AuthenticationHandler;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package eu.crushedpixel.replaymod.gui.online;
|
||||
|
||||
import eu.crushedpixel.replaymod.ReplayMod;
|
||||
import eu.crushedpixel.replaymod.api.client.SearchQuery;
|
||||
import eu.crushedpixel.replaymod.api.client.holders.FileInfo;
|
||||
import eu.crushedpixel.replaymod.api.client.pagination.DownloadedFilePagination;
|
||||
import eu.crushedpixel.replaymod.api.client.pagination.FavoritedFilePagination;
|
||||
import eu.crushedpixel.replaymod.api.client.pagination.Pagination;
|
||||
import eu.crushedpixel.replaymod.api.client.pagination.SearchPagination;
|
||||
import eu.crushedpixel.replaymod.api.replay.SearchQuery;
|
||||
import eu.crushedpixel.replaymod.api.replay.holders.FileInfo;
|
||||
import eu.crushedpixel.replaymod.api.replay.pagination.DownloadedFilePagination;
|
||||
import eu.crushedpixel.replaymod.api.replay.pagination.FavoritedFilePagination;
|
||||
import eu.crushedpixel.replaymod.api.replay.pagination.Pagination;
|
||||
import eu.crushedpixel.replaymod.api.replay.pagination.SearchPagination;
|
||||
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiLoadingListEntry;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiReplayListEntry;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package eu.crushedpixel.replaymod.gui.online;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import eu.crushedpixel.replaymod.api.client.ApiException;
|
||||
import eu.crushedpixel.replaymod.api.client.FileUploader;
|
||||
import eu.crushedpixel.replaymod.api.client.holders.Category;
|
||||
import eu.crushedpixel.replaymod.api.ApiException;
|
||||
import eu.crushedpixel.replaymod.api.replay.FileUploader;
|
||||
import eu.crushedpixel.replaymod.api.replay.holders.Category;
|
||||
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
||||
import eu.crushedpixel.replaymod.gui.replayviewer.GuiReplayViewer;
|
||||
import eu.crushedpixel.replaymod.online.authentication.AuthenticationHandler;
|
||||
|
||||
@@ -114,10 +114,10 @@ public class GuiConnectPart extends GuiStudioPart {
|
||||
}
|
||||
});
|
||||
|
||||
upButton = new GuiArrowButton(GuiConstants.REPLAY_EDITOR_UP_BUTTON, 195, yPos + 40, "", true);
|
||||
upButton = new GuiArrowButton(GuiConstants.REPLAY_EDITOR_UP_BUTTON, 195, yPos + 40, "", GuiArrowButton.Direction.UP);
|
||||
buttonList.add(upButton);
|
||||
|
||||
downButton = new GuiArrowButton(GuiConstants.REPLAY_EDITOR_DOWN_BUTTON, 219, yPos + 40, "", false);
|
||||
downButton = new GuiArrowButton(GuiConstants.REPLAY_EDITOR_DOWN_BUTTON, 219, yPos + 40, "", GuiArrowButton.Direction.DOWN);
|
||||
buttonList.add(downButton);
|
||||
|
||||
int w = GuiReplayEditor.instance.width - 243 - 20 - 4;
|
||||
|
||||
@@ -74,13 +74,13 @@ public class GuiTrimPart extends GuiStudioPart {
|
||||
@Override
|
||||
public void initGui() {
|
||||
if(!initialized) {
|
||||
startMinInput = new GuiNumberInput(1, fontRendererObj, 70, yPos, 30, 3);
|
||||
startSecInput = new GuiNumberInput(1, fontRendererObj, 120, yPos, 25, 2);
|
||||
startMsInput = new GuiNumberInput(1, fontRendererObj, 165, yPos, 30, 3);
|
||||
startMinInput = new GuiNumberInput(1, fontRendererObj, 70, yPos, 30, null, 999d, null, false);
|
||||
startSecInput = new GuiNumberInput(1, fontRendererObj, 120, yPos, 25, null, 99d, null, false);
|
||||
startMsInput = new GuiNumberInput(1, fontRendererObj, 165, yPos, 30, null, 999d, null, false);
|
||||
|
||||
endMinInput = new GuiNumberInput(1, fontRendererObj, 70, yPos + 30, 30, 3);
|
||||
endSecInput = new GuiNumberInput(1, fontRendererObj, 120, yPos + 30, 25, 2);
|
||||
endMsInput = new GuiNumberInput(1, fontRendererObj, 165, yPos + 30, 30, 3);
|
||||
endMinInput = new GuiNumberInput(1, fontRendererObj, 70, yPos + 30, 30, null, 999d, null, false);
|
||||
endSecInput = new GuiNumberInput(1, fontRendererObj, 120, yPos + 30, 25, null, 99d, null, false);
|
||||
endMsInput = new GuiNumberInput(1, fontRendererObj, 165, yPos + 30, 30, null, 999d, null, false);
|
||||
|
||||
inputOrder.clear();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package eu.crushedpixel.replaymod.gui.replayviewer;
|
||||
|
||||
import com.mojang.realmsclient.util.Pair;
|
||||
import eu.crushedpixel.replaymod.ReplayMod;
|
||||
import eu.crushedpixel.replaymod.api.client.holders.FileInfo;
|
||||
import eu.crushedpixel.replaymod.api.replay.holders.FileInfo;
|
||||
import eu.crushedpixel.replaymod.gui.GuiReplaySettings;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiReplayListEntry;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiReplayListExtended;
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package eu.crushedpixel.replaymod.holders;
|
||||
|
||||
public class Keyframe {
|
||||
public class Keyframe implements Cloneable {
|
||||
|
||||
private final int realTimestamp;
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new Keyframe(realTimestamp);
|
||||
}
|
||||
|
||||
public Keyframe(int realTimestamp) {
|
||||
this.realTimestamp = realTimestamp;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@ public class PositionKeyframe extends Keyframe {
|
||||
|
||||
private Position position;
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new PositionKeyframe(this.getRealTimestamp(), this.getPosition());
|
||||
}
|
||||
|
||||
public PositionKeyframe(int realTime, Position position) {
|
||||
super(realTime);
|
||||
this.position = position;
|
||||
|
||||
@@ -6,6 +6,11 @@ public class TimeKeyframe extends Keyframe {
|
||||
|
||||
private final int timestamp;
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new TimeKeyframe(this.getRealTimestamp(), this.getTimestamp());
|
||||
}
|
||||
|
||||
public TimeKeyframe(int realTime, int timestamp) {
|
||||
super(realTime);
|
||||
this.timestamp = timestamp;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package eu.crushedpixel.replaymod.online.authentication;
|
||||
|
||||
import eu.crushedpixel.replaymod.ReplayMod;
|
||||
import eu.crushedpixel.replaymod.api.client.ApiClient;
|
||||
import eu.crushedpixel.replaymod.api.client.ApiException;
|
||||
import eu.crushedpixel.replaymod.api.client.holders.AuthConfirmation;
|
||||
import eu.crushedpixel.replaymod.api.client.holders.AuthKey;
|
||||
import eu.crushedpixel.replaymod.api.ApiClient;
|
||||
import eu.crushedpixel.replaymod.api.ApiException;
|
||||
import eu.crushedpixel.replaymod.api.replay.holders.AuthConfirmation;
|
||||
import eu.crushedpixel.replaymod.api.replay.holders.AuthKey;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.network.play.server.S0FPacketSpawnMob;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PacketListener extends DataListener {
|
||||
@@ -93,20 +94,24 @@ public class PacketListener extends DataListener {
|
||||
|
||||
int timestamp = (int) (System.currentTimeMillis() - startTime);
|
||||
|
||||
|
||||
if(packet instanceof S0FPacketSpawnMob) {
|
||||
S0FPacketSpawnMob p = (S0FPacketSpawnMob) packet;
|
||||
if(p.field_149043_l == null) {
|
||||
p.field_149043_l = new DataWatcher(null);
|
||||
p.field_149043_l = new DataWatcher(null);
|
||||
for(DataWatcher.WatchableObject wo : (List<DataWatcher.WatchableObject>)p.func_149027_c()) {
|
||||
p.field_149043_l.addObject(wo.getDataValueId(), wo.getObject());
|
||||
}
|
||||
}
|
||||
|
||||
if(packet instanceof S0CPacketSpawnPlayer) {
|
||||
S0CPacketSpawnPlayer p = (S0CPacketSpawnPlayer) packet;
|
||||
if(p.field_148960_i == null) {
|
||||
p.field_148960_i = new DataWatcher(null);
|
||||
p.field_148960_i = new DataWatcher(null);
|
||||
for(DataWatcher.WatchableObject wo : (List<DataWatcher.WatchableObject>)p.func_148944_c()) {
|
||||
p.field_148960_i.addObject(wo.getDataValueId(), wo.getObject());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
byte[] array = ReplayFileIO.serializePacket(packet);
|
||||
|
||||
return new PacketData(array, timestamp);
|
||||
|
||||
@@ -2,7 +2,7 @@ package eu.crushedpixel.replaymod.registry;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
import eu.crushedpixel.replaymod.ReplayMod;
|
||||
import eu.crushedpixel.replaymod.api.client.ApiException;
|
||||
import eu.crushedpixel.replaymod.api.ApiException;
|
||||
import eu.crushedpixel.replaymod.online.authentication.AuthenticationHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
Reference in New Issue
Block a user