Finished Trim Part for Replay Studio
Fixed Scroll Bar for GuiSpectateSelection
This commit is contained in:
@@ -29,6 +29,10 @@ public class ReplayMod
|
|||||||
//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: Hinting to the b/v key feature
|
||||||
|
|
||||||
//XXX
|
//XXX
|
||||||
//Known Bugs
|
//Known Bugs
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -38,4 +38,5 @@ public class GuiConstants {
|
|||||||
|
|
||||||
public static final int REPLAY_EDITOR_SAVEMODE_BUTTON = 5003;
|
public static final int REPLAY_EDITOR_SAVEMODE_BUTTON = 5003;
|
||||||
public static final int REPLAY_EDITOR_SAVE_BUTTON = 5004;
|
public static final int REPLAY_EDITOR_SAVE_BUTTON = 5004;
|
||||||
|
public static final int REPLAY_EDITOR_BACK_BUTTON = 5005;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ public class GuiDropdown extends GuiTextField {
|
|||||||
public GuiDropdown(int id, FontRenderer fontRenderer,
|
public GuiDropdown(int id, FontRenderer fontRenderer,
|
||||||
int xPos, int yPos, int width) {
|
int xPos, int yPos, int width) {
|
||||||
super(id, fontRenderer, xPos, yPos, width, 20);
|
super(id, fontRenderer, xPos, yPos, width, 20);
|
||||||
setCursorPositionZero();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package eu.crushedpixel.replaymod.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
|
|
||||||
|
public class GuiNumberInput extends GuiTextField {
|
||||||
|
|
||||||
|
private int limit;
|
||||||
|
|
||||||
|
public GuiNumberInput(int id, FontRenderer fontRenderer,
|
||||||
|
int xPos, int yPos, int width, int limit) {
|
||||||
|
super(id, fontRenderer, xPos, yPos, width, 20);
|
||||||
|
this.limit = limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeText(String text) {
|
||||||
|
try {
|
||||||
|
Integer.valueOf(text);
|
||||||
|
if(limit > 0 && (getText()+text).length() > limit) return;
|
||||||
|
super.writeText(text);
|
||||||
|
} catch(NumberFormatException e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,6 +7,8 @@ import java.util.Collections;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
import net.minecraft.client.gui.Gui;
|
import net.minecraft.client.gui.Gui;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
@@ -185,17 +187,25 @@ public class GuiSpectateSelection extends GuiScreen {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int dw = Mouse.getDWheel();
|
||||||
|
if(dw > 0) {
|
||||||
|
dw = -1;
|
||||||
|
} else if(dw < 0) {
|
||||||
|
dw = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
upperPlayer = Math.max(Math.min(upperPlayer+dw, playerCount-fitting), 0);
|
||||||
|
|
||||||
if(fitting < playerCount) {
|
if(fitting < playerCount) {
|
||||||
float visiblePerc = (float)fitting/(float)playerCount;
|
float visiblePerc = ((float)fitting)/playerCount;
|
||||||
|
int barHeight = (int)(visiblePerc*(height-32-32));
|
||||||
|
|
||||||
int h = this.height-32-32;
|
float posPerc = ((float)upperPlayer)/playerCount;
|
||||||
int offset = Math.round((upperPlayer/(fitting))*visiblePerc*h);
|
int barY = (int)(posPerc*(height-32-32));
|
||||||
|
|
||||||
int lower = Math.round(32+offset+(h*visiblePerc));
|
|
||||||
|
|
||||||
this.drawRect(k2-18, 30-2, k2-10, this.height-30-2, Color.BLACK.getRGB());
|
this.drawRect(k2-18, 30-2, k2-10, this.height-30-2, Color.BLACK.getRGB());
|
||||||
this.drawRect(k2-16, 32-2+offset, k2-12, lower-2, Color.LIGHT_GRAY.getRGB());
|
this.drawRect(k2-16, 32-2+barY, k2-12, 32-1+barY+barHeight, Color.LIGHT_GRAY.getRGB());
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
|
|||||||
GuiButton exitButton = new GuiButton(GuiConstants.CENTER_BACK_BUTTON, 20, 20, "Main Menu");
|
GuiButton exitButton = new GuiButton(GuiConstants.CENTER_BACK_BUTTON, 20, 20, "Main Menu");
|
||||||
bottomBar.add(exitButton);
|
bottomBar.add(exitButton);
|
||||||
|
|
||||||
GuiButton managerButton = new GuiButton(GuiConstants.CENTER_MANAGER_BUTTON, 20, 20, "Replay Manager");
|
GuiButton managerButton = new GuiButton(GuiConstants.CENTER_MANAGER_BUTTON, 20, 20, "Replay Viewer");
|
||||||
bottomBar.add(managerButton);
|
bottomBar.add(managerButton);
|
||||||
|
|
||||||
GuiButton logoutButton = new GuiButton(GuiConstants.CENTER_LOGOUT_BUTTON, 20, 20, "Logout");
|
GuiButton logoutButton = new GuiButton(GuiConstants.CENTER_LOGOUT_BUTTON, 20, 20, "Logout");
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import eu.crushedpixel.replaymod.api.client.ApiException;
|
|||||||
import eu.crushedpixel.replaymod.api.client.FileUploader;
|
import eu.crushedpixel.replaymod.api.client.FileUploader;
|
||||||
import eu.crushedpixel.replaymod.api.client.holders.Category;
|
import eu.crushedpixel.replaymod.api.client.holders.Category;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
||||||
|
import eu.crushedpixel.replaymod.gui.replayviewer.GuiReplayViewer;
|
||||||
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.recording.ReplayMetaData;
|
import eu.crushedpixel.replaymod.recording.ReplayMetaData;
|
||||||
@@ -65,7 +66,11 @@ public class GuiUploadFile extends GuiScreen {
|
|||||||
private static final Pattern p = Pattern.compile("[^a-z0-9 \\-_]", Pattern.CASE_INSENSITIVE);
|
private static final Pattern p = Pattern.compile("[^a-z0-9 \\-_]", Pattern.CASE_INSENSITIVE);
|
||||||
private static final Pattern pt = Pattern.compile("[^a-z0-9,]", Pattern.CASE_INSENSITIVE);
|
private static final Pattern pt = Pattern.compile("[^a-z0-9,]", Pattern.CASE_INSENSITIVE);
|
||||||
|
|
||||||
public GuiUploadFile(File file) {
|
private GuiReplayViewer parent;
|
||||||
|
|
||||||
|
public GuiUploadFile(File file, GuiReplayViewer parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
|
||||||
this.textureResource = new ResourceLocation("upload_thumbs/"+FilenameUtils.getBaseName(file.getAbsolutePath()));
|
this.textureResource = new ResourceLocation("upload_thumbs/"+FilenameUtils.getBaseName(file.getAbsolutePath()));
|
||||||
dynTex = null;
|
dynTex = null;
|
||||||
|
|
||||||
@@ -111,7 +116,7 @@ public class GuiUploadFile extends GuiScreen {
|
|||||||
|
|
||||||
if(!correctFile) {
|
if(!correctFile) {
|
||||||
System.out.println("Invalid file provided to upload");
|
System.out.println("Invalid file provided to upload");
|
||||||
mc.displayGuiScreen(new GuiMainMenu()); //TODO: Error message
|
mc.displayGuiScreen(parent); //TODO: Error message
|
||||||
replayFile = null;
|
replayFile = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -236,7 +241,7 @@ public class GuiUploadFile extends GuiScreen {
|
|||||||
category = category.next();
|
category = category.next();
|
||||||
categoryButton.displayString = "Category: "+category.toNiceString();
|
categoryButton.displayString = "Category: "+category.toNiceString();
|
||||||
} else if(button.id == GuiConstants.UPLOAD_BACK_BUTTON) {
|
} else if(button.id == GuiConstants.UPLOAD_BACK_BUTTON) {
|
||||||
mc.displayGuiScreen(new GuiMainMenu());
|
mc.displayGuiScreen(parent);
|
||||||
} else if(button.id == GuiConstants.UPLOAD_START_BUTTON) {
|
} else if(button.id == GuiConstants.UPLOAD_START_BUTTON) {
|
||||||
final String name = fileTitleInput.getText().trim();
|
final String name = fileTitleInput.getText().trim();
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
|
|||||||
@@ -7,17 +7,33 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.GuiMainMenu;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
|
||||||
import de.johni0702.replaystudio.studio.ReplayStudio;
|
|
||||||
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiDropdown;
|
import eu.crushedpixel.replaymod.gui.GuiDropdown;
|
||||||
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||||
|
|
||||||
public class GuiReplayStudio extends GuiScreen {
|
public class GuiReplayStudio extends GuiScreen {
|
||||||
|
|
||||||
|
private enum StudioTab {
|
||||||
|
TRIM(new GuiTrimPart(110)), CONNECT(null), MODIFY(null);
|
||||||
|
|
||||||
|
private GuiStudioPart studioPart;
|
||||||
|
|
||||||
|
public GuiStudioPart getStudioPart() {
|
||||||
|
return studioPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
private StudioTab(GuiStudioPart part) {
|
||||||
|
this.studioPart = part;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private StudioTab currentTab = StudioTab.TRIM;
|
||||||
|
|
||||||
private GuiDropdown replayDropdown;
|
private GuiDropdown replayDropdown;
|
||||||
private GuiButton saveModeButton, saveButton;
|
private GuiButton saveModeButton, saveButton;
|
||||||
|
|
||||||
@@ -26,8 +42,6 @@ public class GuiReplayStudio extends GuiScreen {
|
|||||||
private boolean initialized = false;
|
private boolean initialized = false;
|
||||||
|
|
||||||
private List<File> replayFiles = new ArrayList<File>();
|
private List<File> replayFiles = new ArrayList<File>();
|
||||||
|
|
||||||
private GuiTrimPart trimPart = new GuiTrimPart(100);
|
|
||||||
|
|
||||||
private void refreshReplayDropdown() {
|
private void refreshReplayDropdown() {
|
||||||
replayDropdown.clearElements();
|
replayDropdown.clearElements();
|
||||||
@@ -60,40 +74,36 @@ public class GuiReplayStudio extends GuiScreen {
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int modeWidth = tabButtons.get(0).width;
|
||||||
|
|
||||||
if(!initialized) {
|
if(!initialized) {
|
||||||
replayDropdown = new GuiDropdown(1, fontRendererObj, 15+2+1+100, 60, this.width-30-8-100);
|
replayDropdown = new GuiDropdown(1, fontRendererObj, 15+2+1+80, 60, this.width-30-8-80-modeWidth-4);
|
||||||
refreshReplayDropdown();
|
refreshReplayDropdown();
|
||||||
} else {
|
} else {
|
||||||
replayDropdown.width = this.width-30-8-100;
|
replayDropdown.width = this.width-30-8-80-modeWidth-4;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<GuiButton> saveButtons = new ArrayList<GuiButton>();
|
|
||||||
|
|
||||||
if(!initialized) {
|
if(!initialized) {
|
||||||
saveButtons.add(saveModeButton = new GuiButton(GuiConstants.REPLAY_EDITOR_SAVEMODE_BUTTON, 0, 0, getSaveModeLabel()));
|
saveModeButton = new GuiButton(GuiConstants.REPLAY_EDITOR_SAVEMODE_BUTTON, width-15-modeWidth-3, 60, getSaveModeLabel());
|
||||||
saveButtons.add(saveButton = new GuiButton(GuiConstants.REPLAY_EDITOR_SAVE_BUTTON, 0, 0, "Save Replay"));
|
|
||||||
} else {
|
} else {
|
||||||
saveButtons.add(saveModeButton);
|
saveModeButton.xPosition = width-15-modeWidth-3;
|
||||||
saveButtons.add(saveButton);
|
|
||||||
}
|
}
|
||||||
|
saveModeButton.width = modeWidth;
|
||||||
|
buttonList.add(saveModeButton);
|
||||||
|
|
||||||
|
|
||||||
|
GuiButton backButton = new GuiButton(GuiConstants.REPLAY_EDITOR_BACK_BUTTON, width-70-18, height-20-5, "Back");
|
||||||
|
backButton.width = 70;
|
||||||
|
buttonList.add(backButton);
|
||||||
|
|
||||||
|
saveButton = new GuiButton(GuiConstants.REPLAY_EDITOR_SAVE_BUTTON, width-70-18, height-(2*20)-5-3, "Save");
|
||||||
|
saveButton.width = 70;
|
||||||
|
buttonList.add(saveButton);
|
||||||
|
|
||||||
w = this.width-30-100;
|
|
||||||
w2 = w/saveButtons.size();
|
|
||||||
i = 0;
|
|
||||||
for(GuiButton b : saveButtons) {
|
|
||||||
int x = 15+100+(w2*i);
|
|
||||||
b.xPosition = x+2;
|
|
||||||
b.yPosition = 90;
|
|
||||||
b.width = w2-4;
|
|
||||||
|
|
||||||
buttonList.add(b);
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
private String getSaveModeLabel() {
|
private String getSaveModeLabel() {
|
||||||
return overrideSave ? "Replace Source File" : "Save to new File";
|
return overrideSave ? "Replace Source File" : "Save to new File";
|
||||||
}
|
}
|
||||||
@@ -104,25 +114,66 @@ public class GuiReplayStudio extends GuiScreen {
|
|||||||
if(button.id == GuiConstants.REPLAY_EDITOR_SAVEMODE_BUTTON) {
|
if(button.id == GuiConstants.REPLAY_EDITOR_SAVEMODE_BUTTON) {
|
||||||
overrideSave = !overrideSave;
|
overrideSave = !overrideSave;
|
||||||
button.displayString = getSaveModeLabel();
|
button.displayString = getSaveModeLabel();
|
||||||
|
} else if(button.id == GuiConstants.REPLAY_EDITOR_BACK_BUTTON) {
|
||||||
|
mc.displayGuiScreen(new GuiMainMenu());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton)
|
protected void mouseClicked(int mouseX, int mouseY, int mouseButton)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
replayDropdown.mouseClicked(mouseX, mouseY, mouseButton);
|
replayDropdown.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
currentTab.getStudioPart().mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||||
this.drawDefaultBackground();
|
drawDefaultBackground();
|
||||||
this.drawCenteredString(this.fontRendererObj, "Replay Studio", this.width / 2, 10, 16777215);
|
currentTab.getStudioPart().drawScreen(mouseX, mouseY, partialTicks);
|
||||||
this.drawString(fontRendererObj, "Replay File:", 30, 67, Color.WHITE.getRGB());
|
|
||||||
this.drawString(fontRendererObj, "Save Mode:", 30, 97, Color.WHITE.getRGB());
|
drawCenteredString(fontRendererObj, currentTab.getStudioPart().getTitle(), width/2, 92, Color.WHITE.getRGB());
|
||||||
|
|
||||||
|
List<String> rows = new ArrayList<String>();
|
||||||
|
String remaining = currentTab.getStudioPart().getDescription();
|
||||||
|
while(remaining.length() > 0) {
|
||||||
|
String[] split = remaining.split(" ");
|
||||||
|
String b = "";
|
||||||
|
for(String sp : split) {
|
||||||
|
b += sp+" ";
|
||||||
|
if(fontRendererObj.getStringWidth(b.trim()) > width-30-70-20) {
|
||||||
|
b = b.substring(0, b.trim().length()-(sp.length()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String trimmed = b.trim();
|
||||||
|
rows.add(trimmed);
|
||||||
|
try {
|
||||||
|
remaining = remaining.substring(trimmed.length()+1);
|
||||||
|
} catch(Exception e) {break;}
|
||||||
|
}
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
for(String row : rows) {
|
||||||
|
drawString(fontRendererObj, row, 30, height-(15*(rows.size()-i)), Color.WHITE.getRGB());
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
drawCenteredString(fontRendererObj, "Replay Studio", this.width / 2, 10, 16777215);
|
||||||
|
drawString(fontRendererObj, "Replay File:", 30, 67, Color.WHITE.getRGB());
|
||||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
replayDropdown.drawTextBox();
|
replayDropdown.drawTextBox();
|
||||||
trimPart.drawScreen(mouseX, mouseY, partialTicks);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(char typedChar, int keyCode) throws IOException {
|
||||||
|
currentTab.getStudioPart().keyTyped(typedChar, keyCode);
|
||||||
|
super.keyTyped(typedChar, keyCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateScreen() {
|
||||||
|
currentTab.getStudioPart().updateScreen();
|
||||||
|
super.updateScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,18 @@
|
|||||||
package eu.crushedpixel.replaymod.gui.replaystudio;
|
package eu.crushedpixel.replaymod.gui.replaystudio;
|
||||||
|
|
||||||
public interface GuiStudioPart {
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
|
||||||
public void applyFilters();
|
public abstract class GuiStudioPart extends GuiScreen {
|
||||||
|
|
||||||
|
public abstract void applyFilters();
|
||||||
|
|
||||||
|
public abstract String getDescription();
|
||||||
|
|
||||||
|
public abstract String getTitle();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract void keyTyped(char typedChar, int keyCode);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract void mouseClicked(int mouseX, int mouseY, int mouseButton);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,112 @@
|
|||||||
package eu.crushedpixel.replaymod.gui.replaystudio;
|
package eu.crushedpixel.replaymod.gui.replaystudio;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import eu.crushedpixel.replaymod.gui.GuiNumberInput;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
|
||||||
public class GuiTrimPart extends GuiScreen implements GuiStudioPart{
|
public class GuiTrimPart extends GuiStudioPart {
|
||||||
|
|
||||||
private int yPos = 0;
|
private int yPos = 0;
|
||||||
|
|
||||||
|
private Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
|
||||||
|
private static final String DESCRIPTION = "Removes the beginning and end of a Replay File and only keeps the Replay between the given Timestamps";
|
||||||
|
private static final String TITLE = "Trim Replay";
|
||||||
|
|
||||||
|
private boolean initialized = false;
|
||||||
|
|
||||||
|
private GuiNumberInput startMinInput, startSecInput, startMsInput;
|
||||||
|
private GuiNumberInput endMinInput, endSecInput, endMsInput;
|
||||||
|
|
||||||
public GuiTrimPart(int yPos) {
|
public GuiTrimPart(int yPos) {
|
||||||
this.yPos = yPos;
|
this.yPos = yPos;
|
||||||
|
fontRendererObj = mc.fontRendererObj;
|
||||||
|
initGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyFilters() {
|
public void applyFilters() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public String getDescription() {
|
||||||
super.initGui();
|
return DESCRIPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTitle() {
|
||||||
|
return TITLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||||
|
startMinInput.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
startSecInput.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
startMsInput.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
endMinInput.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
endSecInput.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
endMsInput.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||||
drawString(fontRendererObj, "Start", 30, 10+yPos, Color.WHITE.getRGB());
|
drawString(mc.fontRendererObj, "Start:", 30, yPos+7, Color.WHITE.getRGB());
|
||||||
|
drawString(mc.fontRendererObj, "End:", 30, yPos+7+30, Color.WHITE.getRGB());
|
||||||
|
drawString(mc.fontRendererObj, "m", 105, yPos+7, Color.WHITE.getRGB());
|
||||||
|
drawString(mc.fontRendererObj, "m", 105, yPos+7+30, Color.WHITE.getRGB());
|
||||||
|
drawString(mc.fontRendererObj, "s", 150, yPos+7, Color.WHITE.getRGB());
|
||||||
|
drawString(mc.fontRendererObj, "s", 150, yPos+7+30, Color.WHITE.getRGB());
|
||||||
|
drawString(mc.fontRendererObj, "ms", 200, yPos+7, Color.WHITE.getRGB());
|
||||||
|
drawString(mc.fontRendererObj, "ms", 200, yPos+7+30, Color.WHITE.getRGB());
|
||||||
|
|
||||||
|
startMinInput.drawTextBox();
|
||||||
|
startSecInput.drawTextBox();
|
||||||
|
startMsInput.drawTextBox();
|
||||||
|
endMinInput.drawTextBox();
|
||||||
|
endSecInput.drawTextBox();
|
||||||
|
endMsInput.drawTextBox();
|
||||||
|
|
||||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateScreen() {
|
||||||
|
if(initialized) {
|
||||||
|
startMinInput.updateCursorCounter();
|
||||||
|
startSecInput.updateCursorCounter();
|
||||||
|
startMsInput.updateCursorCounter();
|
||||||
|
endMinInput.updateCursorCounter();
|
||||||
|
endSecInput.updateCursorCounter();
|
||||||
|
endMsInput.updateCursorCounter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void keyTyped(char typedChar, int keyCode) {
|
||||||
|
startMinInput.textboxKeyTyped(typedChar, keyCode);
|
||||||
|
startSecInput.textboxKeyTyped(typedChar, keyCode);
|
||||||
|
startMsInput.textboxKeyTyped(typedChar, keyCode);
|
||||||
|
endMinInput.textboxKeyTyped(typedChar, keyCode);
|
||||||
|
endSecInput.textboxKeyTyped(typedChar, keyCode);
|
||||||
|
endMsInput.textboxKeyTyped(typedChar, keyCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ public class GuiReplayViewer extends GuiScreen implements GuiYesNoCallback {
|
|||||||
}
|
}
|
||||||
else if(button.id == UPLOAD_BUTTON_ID) {
|
else if(button.id == UPLOAD_BUTTON_ID) {
|
||||||
File file = replayFileList.get(replayGuiList.selected).first().first();
|
File file = replayFileList.get(replayGuiList.selected).first().first();
|
||||||
this.mc.displayGuiScreen(new GuiUploadFile(file));
|
this.mc.displayGuiScreen(new GuiUploadFile(file, this));
|
||||||
}
|
}
|
||||||
else if(button.id == FOLDER_BUTTON_ID) {
|
else if(button.id == FOLDER_BUTTON_ID) {
|
||||||
File file1 = new File("./replay_recordings/");
|
File file1 = new File("./replay_recordings/");
|
||||||
|
|||||||
@@ -11,12 +11,7 @@ public class LinearPoint extends LinearInterpolation<Position> {
|
|||||||
if(pair == null) return null;
|
if(pair == null) return null;
|
||||||
|
|
||||||
float perc = pair.first();
|
float perc = pair.first();
|
||||||
//float position = positionIn * (points.size()-1);
|
|
||||||
//int cubicNum = (int)Math.min(points.size()-1, position);
|
|
||||||
//float perc = (position - cubicNum);
|
|
||||||
|
|
||||||
//System.out.println(cubicNum+" | "+perc+" | "+positionIn);
|
|
||||||
|
|
||||||
Position first = pair.second().first();
|
Position first = pair.second().first();
|
||||||
Position second = pair.second().second();
|
Position second = pair.second().second();
|
||||||
|
|
||||||
@@ -28,7 +23,7 @@ public class LinearPoint extends LinearInterpolation<Position> {
|
|||||||
float yaw = (float)getInterpolatedValue(first.getYaw(), second.getYaw(), perc);
|
float yaw = (float)getInterpolatedValue(first.getYaw(), second.getYaw(), perc);
|
||||||
|
|
||||||
Position inter = new Position(x, y, z, pitch, yaw);
|
Position inter = new Position(x, y, z, pitch, yaw);
|
||||||
//System.out.println(position+" | "+cubicNum+" | "+perc+" | "+first+" | "+second+" | "+inter);
|
|
||||||
return inter;
|
return inter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public class ReplayProcess {
|
|||||||
isVideoRecording = record;
|
isVideoRecording = record;
|
||||||
lastPosition = null;
|
lastPosition = null;
|
||||||
motionSpline = null;
|
motionSpline = null;
|
||||||
|
motionLinear = null;
|
||||||
timeLinear = null;
|
timeLinear = null;
|
||||||
calculated = false;
|
calculated = false;
|
||||||
requestFinish = false;
|
requestFinish = false;
|
||||||
@@ -239,14 +240,21 @@ public class ReplayProcess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int currentDiff = nextPosStamp - lastPosStamp;
|
int currentPosDiff = nextPosStamp - lastPosStamp;
|
||||||
int current = curRealReplayTime - lastPosStamp;
|
int currentPos = curRealReplayTime - lastPosStamp;
|
||||||
|
|
||||||
float currentStepPerc = (float)current/(float)currentDiff; //The percentage of the travelled path between the current positions
|
float currentPosStepPerc = (float)currentPos/(float)currentPosDiff; //The percentage of the travelled path between the current positions
|
||||||
if(Float.isInfinite(currentStepPerc)) currentStepPerc = 0;
|
if(Float.isInfinite(currentPosStepPerc)) currentPosStepPerc = 0;
|
||||||
|
|
||||||
|
int currentTimeDiff = nextTimeStamp - lastTimeStamp;
|
||||||
|
int currentTime = curRealReplayTime - lastTimeStamp;
|
||||||
|
|
||||||
|
float currentTimeStepPerc = (float)currentTime/(float)currentTimeDiff; //The percentage of the travelled path between the current timestamps
|
||||||
|
if(Float.isInfinite(currentTimeStepPerc)) currentTimeStepPerc = 0;
|
||||||
|
|
||||||
float splinePos = ((float)ReplayHandler.getKeyframeIndex(lastPos) + currentStepPerc)/(float)(ReplayHandler.getPosKeyframeCount()-1);
|
float splinePos = ((float)ReplayHandler.getKeyframeIndex(lastPos) + currentPosStepPerc)/(float)(ReplayHandler.getPosKeyframeCount()-1);
|
||||||
float timePos = ((float)ReplayHandler.getKeyframeIndex(lastTime) + currentStepPerc)/(float)(ReplayHandler.getTimeKeyframeCount()-1);
|
|
||||||
|
float timePos = ((float)ReplayHandler.getKeyframeIndex(lastTime) + currentTimeStepPerc)/(float)(ReplayHandler.getTimeKeyframeCount()-1);
|
||||||
|
|
||||||
Position pos = null;
|
Position pos = null;
|
||||||
if(!linear) {
|
if(!linear) {
|
||||||
|
|||||||
@@ -396,7 +396,8 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
try {
|
try {
|
||||||
Packet p = ReplayFileIO.deserializePacket(ba);
|
Packet p = ReplayFileIO.deserializePacket(ba);
|
||||||
|
|
||||||
if(hurryToTimestamp && !ReplayHandler.isInPath()) { //If hurrying, ignore some packets
|
//If hurrying, ignore some packets, unless during Replay Path and *not* in initial hurry
|
||||||
|
if(hurryToTimestamp && (!ReplayHandler.isInPath() || (desiredTimeStamp-currentTimeStamp > 1000))) {
|
||||||
if(p instanceof S45PacketTitle ||
|
if(p instanceof S45PacketTitle ||
|
||||||
p instanceof S29PacketSoundEffect ||
|
p instanceof S29PacketSoundEffect ||
|
||||||
p instanceof S2APacketParticles) return;
|
p instanceof S2APacketParticles) return;
|
||||||
|
|||||||
BIN
src/main/resources/assets/replaymod/.DS_Store
vendored
Normal file
BIN
src/main/resources/assets/replaymod/.DS_Store
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user