Compare commits
2 Commits
1.11-2.0.0
...
1.11.2-2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cda8493df1 | ||
|
|
33cb1405d5 |
@@ -7,6 +7,7 @@ pipeline:
|
|||||||
commands:
|
commands:
|
||||||
- curl --fail --create-dirs -o $HOME/.gradle/init.d/mirror.gradle https://maven.johni0702.de/config/gradle
|
- curl --fail --create-dirs -o $HOME/.gradle/init.d/mirror.gradle https://maven.johni0702.de/config/gradle
|
||||||
- curl --fail --create-dirs -o $HOME/.m2/settings.xml https://maven.johni0702.de/config/maven
|
- curl --fail --create-dirs -o $HOME/.m2/settings.xml https://maven.johni0702.de/config/maven
|
||||||
|
- JAVA_OPTS=-Xmx1516M ./gradlew setupDecompWorkspace
|
||||||
- ./gradlew :build
|
- ./gradlew :build
|
||||||
archive:
|
archive:
|
||||||
image: plugins/s3
|
image: plugins/s3
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
eyJhbGciOiJIUzI1NiJ9.cGlwZWxpbmU6CiAgY2xvbmU6CiAgICBpbWFnZTogcGx1Z2lucy9naXQKICAgIHRhZ3M6IHRydWUKICBidWlsZDoKICAgIGltYWdlOiBtYXZlbjozLjMuOS1qZGstOAogICAgY29tbWFuZHM6CiAgICAgIC0gY3VybCAtLWZhaWwgLS1jcmVhdGUtZGlycyAtbyAkSE9NRS8uZ3JhZGxlL2luaXQuZC9taXJyb3IuZ3JhZGxlIGh0dHBzOi8vbWF2ZW4uam9obmkwNzAyLmRlL2NvbmZpZy9ncmFkbGUKICAgICAgLSBjdXJsIC0tZmFpbCAtLWNyZWF0ZS1kaXJzIC1vICRIT01FLy5tMi9zZXR0aW5ncy54bWwgaHR0cHM6Ly9tYXZlbi5qb2huaTA3MDIuZGUvY29uZmlnL21hdmVuCiAgICAgIC0gLi9ncmFkbGV3IDpidWlsZAogIGFyY2hpdmU6CiAgICBpbWFnZTogcGx1Z2lucy9zMwogICAgYWNsOiBwdWJsaWMtcmVhZAogICAgcmVnaW9uOiAidXMtZWFzdC0xIgogICAgYnVja2V0OiAicmVwbGF5bW9kIgogICAgcGF0aF9zdHlsZTogdHJ1ZQogICAgc291cmNlOiBidWlsZC9saWJzLyoKICAgIHN0cmlwX3ByZWZpeDogYnVpbGQvbGlicy8KICAgIHRhcmdldDogLwo.Z6rpaLplJKQ4pzB8AjCnplgci42qEu7L4LeS0fGm4SY
|
eyJhbGciOiJIUzI1NiJ9.cGlwZWxpbmU6CiAgY2xvbmU6CiAgICBpbWFnZTogcGx1Z2lucy9naXQKICAgIHRhZ3M6IHRydWUKICBidWlsZDoKICAgIGltYWdlOiBtYXZlbjozLjMuOS1qZGstOAogICAgY29tbWFuZHM6CiAgICAgIC0gY3VybCAtLWZhaWwgLS1jcmVhdGUtZGlycyAtbyAkSE9NRS8uZ3JhZGxlL2luaXQuZC9taXJyb3IuZ3JhZGxlIGh0dHBzOi8vbWF2ZW4uam9obmkwNzAyLmRlL2NvbmZpZy9ncmFkbGUKICAgICAgLSBjdXJsIC0tZmFpbCAtLWNyZWF0ZS1kaXJzIC1vICRIT01FLy5tMi9zZXR0aW5ncy54bWwgaHR0cHM6Ly9tYXZlbi5qb2huaTA3MDIuZGUvY29uZmlnL21hdmVuCiAgICAgIC0gSkFWQV9PUFRTPS1YbXgxNTE2TSAuL2dyYWRsZXcgc2V0dXBEZWNvbXBXb3Jrc3BhY2UKICAgICAgLSAuL2dyYWRsZXcgOmJ1aWxkCiAgYXJjaGl2ZToKICAgIGltYWdlOiBwbHVnaW5zL3MzCiAgICBhY2w6IHB1YmxpYy1yZWFkCiAgICByZWdpb246ICJ1cy1lYXN0LTEiCiAgICBidWNrZXQ6ICJyZXBsYXltb2QiCiAgICBwYXRoX3N0eWxlOiB0cnVlCiAgICBzb3VyY2U6IGJ1aWxkL2xpYnMvKgogICAgc3RyaXBfcHJlZml4OiBidWlsZC9saWJzLwogICAgdGFyZ2V0OiAvCg.nzPW0_TpMIjnFZZ5Ci439QDKlaDo1a3DCH-VCYUgpx8
|
||||||
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -5,7 +5,3 @@
|
|||||||
[submodule "ReplayStudio"]
|
[submodule "ReplayStudio"]
|
||||||
path = ReplayStudio
|
path = ReplayStudio
|
||||||
url = https://github.com/ReplayMod/ReplayStudio
|
url = https://github.com/ReplayMod/ReplayStudio
|
||||||
|
|
||||||
[submodule "src/main/resources/assets/replaymod/lang"]
|
|
||||||
path = src/main/resources/assets/replaymod/lang
|
|
||||||
url = https://github.com/ReplayMod/Translations
|
|
||||||
|
|||||||
Submodule ReplayStudio updated: 12b4fdd40e...f778f556a7
111
build.gradle
111
build.gradle
@@ -1,5 +1,7 @@
|
|||||||
import groovy.json.JsonOutput
|
import groovy.json.JsonOutput
|
||||||
|
|
||||||
|
import java.util.zip.ZipInputStream
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -34,9 +36,9 @@ archivesBaseName = "replaymod"
|
|||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
coreMod = 'com.replaymod.core.LoadingPlugin'
|
coreMod = 'com.replaymod.core.LoadingPlugin'
|
||||||
version = '1.11-13.19.1.2188'
|
version = '1.11.2-13.20.0.2216'
|
||||||
runDir = "eclipse"
|
runDir = "eclipse"
|
||||||
mappings = "snapshot_20161111"
|
mappings = "snapshot_20161220"
|
||||||
replace '@MOD_VERSION@', project.version
|
replace '@MOD_VERSION@', project.version
|
||||||
replace '@MC_VERSION@', project.minecraft.version
|
replace '@MC_VERSION@', project.minecraft.version
|
||||||
}
|
}
|
||||||
@@ -59,7 +61,7 @@ configurations {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compile 'org.projectlombok:lombok:1.16.4'
|
compile 'org.projectlombok:lombok:1.16.4'
|
||||||
|
|
||||||
compile 'org.spongepowered:mixin:0.6.8-SNAPSHOT'
|
compile 'org.spongepowered:mixin:0.6.4-SNAPSHOT'
|
||||||
shade 'com.googlecode.mp4parser:isoparser:1.1.7'
|
shade 'com.googlecode.mp4parser:isoparser:1.1.7'
|
||||||
shade 'org.apache.commons:commons-exec:1.3'
|
shade 'org.apache.commons:commons-exec:1.3'
|
||||||
shade 'com.google.apis:google-api-services-youtube:v3-rev178-1.22.0'
|
shade 'com.google.apis:google-api-services-youtube:v3-rev178-1.22.0'
|
||||||
@@ -101,6 +103,27 @@ jar {
|
|||||||
}
|
}
|
||||||
from noticeDir
|
from noticeDir
|
||||||
|
|
||||||
|
def langDir = file("$buildDir/languages")
|
||||||
|
doFirst {
|
||||||
|
try {
|
||||||
|
langDir.deleteDir()
|
||||||
|
langDir.mkdirs()
|
||||||
|
def dir = new File(langDir, 'assets/replaymod/lang/')
|
||||||
|
dir.mkdirs()
|
||||||
|
def zip = new ZipInputStream(new URL('http://replaymod.com/api/grab_languages').openStream())
|
||||||
|
def e;
|
||||||
|
while ((e = zip.nextEntry) != null) {
|
||||||
|
new File(dir, e.getName()) << zip
|
||||||
|
zip.closeEntry()
|
||||||
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
from (langDir) {
|
||||||
|
exclude '**/en_US.lang'
|
||||||
|
}
|
||||||
|
|
||||||
from ({shade().collect { it.isDirectory() ? it : zipTree(it) }}) {
|
from ({shade().collect { it.isDirectory() ? it : zipTree(it) }}) {
|
||||||
exclude '**/NOTICE*'
|
exclude '**/NOTICE*'
|
||||||
// exclude everything taken in from jGui for running the mod in a dev environment
|
// exclude everything taken in from jGui for running the mod in a dev environment
|
||||||
@@ -166,13 +189,6 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
refMap = "mixins.replaymod.refmap.json"
|
refMap = "mixins.replaymod.refmap.json"
|
||||||
}
|
}
|
||||||
integrationTest {
|
|
||||||
compileClasspath += main.runtimeClasspath + main.output
|
|
||||||
java {
|
|
||||||
srcDir file('src/integration-test/java')
|
|
||||||
}
|
|
||||||
resources.srcDir file('src/integration-test/resources')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task copySrg(type: Copy, dependsOn: 'genSrgs') {
|
task copySrg(type: Copy, dependsOn: 'genSrgs') {
|
||||||
@@ -184,81 +200,6 @@ setupDecompWorkspace.dependsOn copySrg
|
|||||||
setupDevWorkspace.dependsOn copySrg
|
setupDevWorkspace.dependsOn copySrg
|
||||||
project.tasks.idea.dependsOn copySrg
|
project.tasks.idea.dependsOn copySrg
|
||||||
|
|
||||||
|
|
||||||
import org.objectweb.asm.*
|
|
||||||
|
|
||||||
import java.util.zip.ZipEntry
|
|
||||||
import java.util.zip.ZipFile
|
|
||||||
import java.util.zip.ZipOutputStream
|
|
||||||
|
|
||||||
import static org.objectweb.asm.Opcodes.ASM5
|
|
||||||
|
|
||||||
// MC binaries were complied with a java version that produces invalid class files under certain circumstances
|
|
||||||
// This causes setupCIWorkspace to be insufficient for compiling.
|
|
||||||
// Related JDK bug: https://bugs.openjdk.java.net/browse/JDK-8066725
|
|
||||||
// As a workaround, to use setupCIWorkspace on Drone, we modify the bin jar in-place and remove all parameter annotations.
|
|
||||||
// WARNING: This piece of code ignores any and all gradle conventions and will probably fail horribly when run outside
|
|
||||||
// of a single-use environment (e.g. Drone). Use setupDecompWorkspace for normal use.
|
|
||||||
tasks.deobfMcMCP.doLast {
|
|
||||||
println "Applying RuntimeInvisibleParameterAnnotations workaround..."
|
|
||||||
File jar = getOutJar()
|
|
||||||
File tmp = new File((File) getTemporaryDir(), "workaround.jar")
|
|
||||||
tmp.withOutputStream {
|
|
||||||
new ZipOutputStream(it).withStream { dst ->
|
|
||||||
new ZipFile(jar).withCloseable { src ->
|
|
||||||
src.entries().each {
|
|
||||||
if (it.name.startsWith("net/minecraft/") && it.name.endsWith(".class")) {
|
|
||||||
def cw = new ClassWriter(0)
|
|
||||||
def cv = new ClassVisitor(ASM5, cw) {
|
|
||||||
@Override
|
|
||||||
MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
|
||||||
return new MethodVisitor(ASM5, cv.visitMethod(access, name, desc, signature, exceptions)) {
|
|
||||||
@Override
|
|
||||||
AnnotationVisitor visitParameterAnnotation(int parameter, String pdesc, boolean visible) {
|
|
||||||
return null // Strip all parameter annotations
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
new ClassReader(src.getInputStream(it)).accept(cv, 0)
|
|
||||||
dst.putNextEntry(new ZipEntry(it.name))
|
|
||||||
dst.write(cw.toByteArray())
|
|
||||||
} else {
|
|
||||||
dst.putNextEntry(it)
|
|
||||||
dst.write(src.getInputStream(it).bytes)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
jar.delete()
|
|
||||||
tmp.renameTo(jar)
|
|
||||||
}
|
|
||||||
|
|
||||||
task runIntegrationTest(type: JavaExec, dependsOn: ["makeStart", "jar"]) {
|
|
||||||
main = 'GradleStart'
|
|
||||||
standardOutput = System.out
|
|
||||||
errorOutput = System.err
|
|
||||||
workingDir file(minecraft.runDir)
|
|
||||||
|
|
||||||
def testDir = new File(minecraft.runDir, "integration-test")
|
|
||||||
doFirst {
|
|
||||||
testDir.deleteDir()
|
|
||||||
testDir.mkdirs()
|
|
||||||
}
|
|
||||||
|
|
||||||
doLast {
|
|
||||||
testDir.deleteDir()
|
|
||||||
}
|
|
||||||
|
|
||||||
afterEvaluate {
|
|
||||||
def runClient = tasks.getByName("runClient")
|
|
||||||
runIntegrationTest.jvmArgs = runClient.jvmArgs + "-Dfml.noGrab=true"
|
|
||||||
runIntegrationTest.args = runClient.args + "--gameDir" + testDir.canonicalPath
|
|
||||||
runIntegrationTest.classpath runClient.classpath + sourceSets.integrationTest.output
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def generateVersionsJson() {
|
def generateVersionsJson() {
|
||||||
// List all tags
|
// List all tags
|
||||||
def stdout = new ByteArrayOutputStream()
|
def stdout = new ByteArrayOutputStream()
|
||||||
|
|||||||
2
jGui
2
jGui
Submodule jGui updated: e2bd90628e...97566db8ed
@@ -1,30 +0,0 @@
|
|||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Entry point for running integration tests from within the IDE.
|
|
||||||
* This is <b>not</b> called when running integration tests directly from gradle.
|
|
||||||
*/
|
|
||||||
public class IntegrationTest {
|
|
||||||
public static void main(String[] args) throws Throwable {
|
|
||||||
// Prevent MC from grabbing our mouse during the test (it's not needed)
|
|
||||||
System.setProperty("fml.noGrab", "true");
|
|
||||||
|
|
||||||
// Make sure the test folder exists and is fresh
|
|
||||||
File gameDir = new File(System.getProperty("user.dir"), "integration-test");
|
|
||||||
if (gameDir.exists()) {
|
|
||||||
FileUtils.forceDelete(gameDir);
|
|
||||||
}
|
|
||||||
FileUtils.forceMkdir(gameDir);
|
|
||||||
|
|
||||||
// Set game dir to test folder and call regular entry point
|
|
||||||
List<String> argsList = new ArrayList<>(Arrays.asList(args));
|
|
||||||
argsList.add("--gameDir");
|
|
||||||
argsList.add(gameDir.getCanonicalPath());
|
|
||||||
GradleStart.main(argsList.toArray(new String[argsList.size()]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,340 +0,0 @@
|
|||||||
package com.replaymod.core;
|
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
import com.google.common.util.concurrent.SettableFuture;
|
|
||||||
import de.johni0702.minecraft.gui.container.AbstractGuiOverlay;
|
|
||||||
import de.johni0702.minecraft.gui.container.AbstractGuiScreen;
|
|
||||||
import de.johni0702.minecraft.gui.container.GuiContainer;
|
|
||||||
import de.johni0702.minecraft.gui.container.GuiOverlay;
|
|
||||||
import de.johni0702.minecraft.gui.container.GuiScreen;
|
|
||||||
import de.johni0702.minecraft.gui.element.GuiButton;
|
|
||||||
import de.johni0702.minecraft.gui.element.GuiElement;
|
|
||||||
import de.johni0702.minecraft.gui.element.GuiTexturedButton;
|
|
||||||
import de.johni0702.minecraft.gui.popup.AbstractGuiPopup;
|
|
||||||
import de.johni0702.minecraft.gui.utils.Consumer;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
|
||||||
import org.lwjgl.input.Keyboard;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.NoSuchElementException;
|
|
||||||
import java.util.concurrent.TimeoutException;
|
|
||||||
|
|
||||||
import static com.replaymod.core.ReplayModIntegrationTest.LOGGER;
|
|
||||||
import static com.replaymod.core.utils.Utils.addCallback;
|
|
||||||
|
|
||||||
public abstract class AbstractTask implements Task {
|
|
||||||
public static Task create(Consumer<AbstractTask> init) {
|
|
||||||
return new AbstractTask() {
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
init.consume(this);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Minecraft mc = Minecraft.getMinecraft();
|
|
||||||
public final ReplayMod core = ReplayMod.instance;
|
|
||||||
public SettableFuture<Void> future;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ListenableFuture<Void> execute() {
|
|
||||||
future = SettableFuture.create();
|
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
|
||||||
addCallback(future, success -> {
|
|
||||||
MinecraftForge.EVENT_BUS.unregister(this);
|
|
||||||
}, error -> {});
|
|
||||||
|
|
||||||
init();
|
|
||||||
|
|
||||||
return future;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void init() {}
|
|
||||||
|
|
||||||
protected void runLater(Runnable runnable) {
|
|
||||||
core.runLater(() -> {
|
|
||||||
try {
|
|
||||||
runnable.run();
|
|
||||||
} catch (Throwable t) {
|
|
||||||
future.setException(t);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void expectGuiClosed(Runnable onClosed) {
|
|
||||||
expectGuiClosed0(10, onClosed);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void expectGuiClosed(int timeout, Runnable onClosed) {
|
|
||||||
expectGuiClosed0(timeout, onClosed);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void expectGuiClosed0(int timeout, Runnable onClosed) {
|
|
||||||
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
|
||||||
class EventHandler {
|
|
||||||
final net.minecraft.client.gui.GuiScreen currentScreen = mc.currentScreen;
|
|
||||||
int framesPassed;
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onGuiOpen(TickEvent.RenderTickEvent event) {
|
|
||||||
if (event.phase != TickEvent.Phase.START) return;
|
|
||||||
if (currentScreen != mc.currentScreen) {
|
|
||||||
MinecraftForge.EVENT_BUS.unregister(this);
|
|
||||||
onClosed.run();
|
|
||||||
} else {
|
|
||||||
if (framesPassed < timeout) {
|
|
||||||
framesPassed++;
|
|
||||||
} else {
|
|
||||||
Object gui = (gui = GuiScreen.from(currentScreen)) == null ? currentScreen : gui;
|
|
||||||
Exception e = new TimeoutException("Timeout while waiting for " + gui + " to be closed.");
|
|
||||||
e.setStackTrace(Arrays.copyOfRange(stackTrace, 3, stackTrace.length));
|
|
||||||
future.setException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void expectPopupClosed(Runnable onClosed) {
|
|
||||||
expectPopupClosed0(10, onClosed);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void expectPopupClosed(int timeout, Runnable onClosed) {
|
|
||||||
expectPopupClosed0(timeout, onClosed);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void expectPopupClosed0(int timeout, Runnable onClosed) {
|
|
||||||
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
|
||||||
AbstractGuiPopup popup = getPopup(mc.currentScreen);
|
|
||||||
if (popup == null) {
|
|
||||||
throw new IllegalStateException("No popup found.");
|
|
||||||
}
|
|
||||||
class EventHandler {
|
|
||||||
int framesPassed;
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onGuiOpen(TickEvent.RenderTickEvent event) {
|
|
||||||
if (event.phase != TickEvent.Phase.START) return;
|
|
||||||
if (getPopup(mc.currentScreen) != popup) {
|
|
||||||
MinecraftForge.EVENT_BUS.unregister(this);
|
|
||||||
onClosed.run();
|
|
||||||
} else {
|
|
||||||
if (framesPassed < timeout) {
|
|
||||||
framesPassed++;
|
|
||||||
} else {
|
|
||||||
Exception e = new TimeoutException("Timeout while waiting for " + popup + " to be closed.");
|
|
||||||
e.setStackTrace(Arrays.copyOfRange(stackTrace, 3, stackTrace.length));
|
|
||||||
future.setException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
|
||||||
}
|
|
||||||
|
|
||||||
private AbstractGuiPopup getPopup(net.minecraft.client.gui.GuiScreen minecraft) {
|
|
||||||
GuiContainer<?> container = GuiOverlay.from(minecraft);
|
|
||||||
if (container == null) {
|
|
||||||
container = GuiScreen.from(minecraft);
|
|
||||||
}
|
|
||||||
if (container != null) {
|
|
||||||
while (container.getContainer() != null) {
|
|
||||||
container = container.getContainer();
|
|
||||||
}
|
|
||||||
GuiElement popup = Iterables.getLast(container.getChildren());
|
|
||||||
if (popup instanceof AbstractGuiPopup) {
|
|
||||||
return (AbstractGuiPopup) popup;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> void expectGui(Class<T> guiClass, Consumer<T> onOpen) {
|
|
||||||
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
|
||||||
class EventHandler {
|
|
||||||
net.minecraft.client.gui.GuiScreen currentScreen;
|
|
||||||
int framesPassed;
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onGuiOpen(TickEvent.RenderTickEvent event) {
|
|
||||||
if (event.phase != TickEvent.Phase.START) return;
|
|
||||||
if (currentScreen != mc.currentScreen) {
|
|
||||||
currentScreen = mc.currentScreen;
|
|
||||||
framesPassed = 0;
|
|
||||||
}
|
|
||||||
if (framesPassed < 10) {
|
|
||||||
framesPassed++;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.unregister(this);
|
|
||||||
|
|
||||||
Object foundGui = null;
|
|
||||||
if (AbstractGuiScreen.class.isAssignableFrom(guiClass)) {
|
|
||||||
AbstractGuiScreen guiScreen = GuiScreen.from(currentScreen);
|
|
||||||
if (guiClass.isInstance(guiScreen)) {
|
|
||||||
onOpen.consume(guiClass.cast(guiScreen));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
foundGui = guiScreen;
|
|
||||||
} else if (AbstractGuiOverlay.class.isAssignableFrom(guiClass)) {
|
|
||||||
AbstractGuiOverlay guiScreen = GuiOverlay.from(currentScreen);
|
|
||||||
if (guiClass.isInstance(guiScreen)) {
|
|
||||||
onOpen.consume(guiClass.cast(guiScreen));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
foundGui = guiScreen;
|
|
||||||
} else if (AbstractGuiPopup.class.isAssignableFrom(guiClass)) {
|
|
||||||
AbstractGuiPopup popup = getPopup(currentScreen);
|
|
||||||
if (guiClass.isInstance(popup)) {
|
|
||||||
onOpen.consume(guiClass.cast(popup));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (guiClass.isInstance(currentScreen)) {
|
|
||||||
onOpen.consume(guiClass.cast(currentScreen));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
class UnexpectedGuiException extends Exception {
|
|
||||||
UnexpectedGuiException(Object foundGui) {
|
|
||||||
super("Expected instance of " + guiClass + " but found " + foundGui);
|
|
||||||
setStackTrace(Arrays.copyOfRange(stackTrace, 2, stackTrace.length));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
future.setException(new UnexpectedGuiException(foundGui == null ? currentScreen : foundGui));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clickNow(int x, int y) {
|
|
||||||
try {
|
|
||||||
Method method = net.minecraft.client.gui.GuiScreen.class
|
|
||||||
.getDeclaredMethod("mouseClicked", int.class, int.class, int.class);
|
|
||||||
method.setAccessible(true);
|
|
||||||
method.invoke(mc.currentScreen, x, y, 0);
|
|
||||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
|
||||||
future.setException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void click(int x, int y) {
|
|
||||||
runLater(() -> {
|
|
||||||
LOGGER.info("Clicking at {}/{}", x, y);
|
|
||||||
clickNow(x, y);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dragNow(int x, int y) {
|
|
||||||
try {
|
|
||||||
Method method = net.minecraft.client.gui.GuiScreen.class
|
|
||||||
.getDeclaredMethod("mouseClickMove", int.class, int.class, int.class, long.class);
|
|
||||||
method.setAccessible(true);
|
|
||||||
method.invoke(mc.currentScreen, x, y, 0, 0);
|
|
||||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
|
||||||
future.setException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void drag(int x, int y) {
|
|
||||||
runLater(() -> {
|
|
||||||
LOGGER.info("Dragging to {}/{}", x, y);
|
|
||||||
dragNow(x, y);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void click(GuiButton button) {
|
|
||||||
runLater(() -> {
|
|
||||||
if (!button.isEnabled()) {
|
|
||||||
future.setException(new IllegalStateException("Button is disabled: " + button.getLabel()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LOGGER.info("Clicking button {}", button.getLabel());
|
|
||||||
button.onClick();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void click(GuiTexturedButton button) {
|
|
||||||
runLater(() -> {
|
|
||||||
if (!button.isEnabled()) {
|
|
||||||
future.setException(new IllegalStateException("Button is disabled: " + button.getTexture()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LOGGER.info("Clicking textured button {}", button.getTexture());
|
|
||||||
button.onClick();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void click(String buttonText) {
|
|
||||||
runLater(() -> {
|
|
||||||
LOGGER.info("Clicking button {}", buttonText);
|
|
||||||
try {
|
|
||||||
Field field = net.minecraft.client.gui.GuiScreen.class.getDeclaredField("buttonList");
|
|
||||||
field.setAccessible(true);
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<net.minecraft.client.gui.GuiButton> buttonList = (List)
|
|
||||||
field.get(mc.currentScreen);
|
|
||||||
|
|
||||||
net.minecraft.client.gui.GuiButton button = null;
|
|
||||||
for (net.minecraft.client.gui.GuiButton guiButton : buttonList) {
|
|
||||||
if (guiButton.displayString.equals(buttonText)) {
|
|
||||||
button = guiButton;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (button == null) {
|
|
||||||
future.setException(new NoSuchElementException("No button with label: " + buttonText));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
clickNow(button.xPosition + 5, button.yPosition + 5);
|
|
||||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
|
||||||
future.setException(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void type(String string) {
|
|
||||||
for (char c : string.toCharArray()) {
|
|
||||||
press(c, Keyboard.getKeyIndex(String.valueOf(c).toUpperCase()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void press(int keyCode) {
|
|
||||||
String keyName = Keyboard.getKeyName(keyCode);
|
|
||||||
char character = keyName.length() == 1 ? keyName.charAt(0) : '\0';
|
|
||||||
press(character, keyCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void press(char character, int keyCode) {
|
|
||||||
runLater(() -> {
|
|
||||||
LOGGER.info("Pressing key {}", Keyboard.getKeyName(keyCode));
|
|
||||||
if (mc.currentScreen == null || mc.currentScreen.allowUserInput) {
|
|
||||||
KeyBinding.onTick(keyCode);
|
|
||||||
FMLCommonHandler.instance().fireKeyInput();
|
|
||||||
}
|
|
||||||
if (mc.currentScreen != null) {
|
|
||||||
try {
|
|
||||||
Method method = net.minecraft.client.gui.GuiScreen.class
|
|
||||||
.getDeclaredMethod("keyTyped", char.class, int.class);
|
|
||||||
method.setAccessible(true);
|
|
||||||
method.invoke(mc.currentScreen, character, keyCode);
|
|
||||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
|
||||||
future.setException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
package com.replaymod.core;
|
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
import com.google.common.util.concurrent.SettableFuture;
|
|
||||||
|
|
||||||
import static com.replaymod.core.ReplayModIntegrationTest.LOGGER;
|
|
||||||
import static com.replaymod.core.utils.Utils.addCallback;
|
|
||||||
|
|
||||||
public class CompositeTask implements Task {
|
|
||||||
private SettableFuture<Void> future;
|
|
||||||
protected final Task[] children;
|
|
||||||
|
|
||||||
public CompositeTask(Task[] children) {
|
|
||||||
this.children = children;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ListenableFuture<Void> execute() {
|
|
||||||
future = SettableFuture.create();
|
|
||||||
executeChild(0);
|
|
||||||
return future;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void executeChild(int childIndex) {
|
|
||||||
if (future.isDone()) return;
|
|
||||||
if (childIndex < children.length) {
|
|
||||||
ReplayMod.instance.runLater(() -> {
|
|
||||||
try {
|
|
||||||
Task task = children[childIndex];
|
|
||||||
LOGGER.info("Running task {}", task);
|
|
||||||
ListenableFuture<Void> childFuture = task.execute();
|
|
||||||
addCallback(childFuture, done -> executeChild(childIndex + 1), err -> future.setException(err));
|
|
||||||
} catch (Throwable t) {
|
|
||||||
future.setException(t);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
future.set(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
package com.replaymod.core;
|
|
||||||
|
|
||||||
import com.replaymod.core.regression.RegressionTest60;
|
|
||||||
import com.replaymod.core.regression.RegressionTest61;
|
|
||||||
import com.replaymod.core.regression.RegressionTest62;
|
|
||||||
import com.replaymod.extra.DownloadOpenEye;
|
|
||||||
import com.replaymod.online.SkipLogin;
|
|
||||||
import com.replaymod.recording.CreateSPWorld;
|
|
||||||
import com.replaymod.recording.ExitSPWorld;
|
|
||||||
import com.replaymod.replay.ExitReplay;
|
|
||||||
import com.replaymod.replay.LoadReplay;
|
|
||||||
import com.replaymod.replay.OpenReplayViewer;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
|
|
||||||
import static com.replaymod.core.AbstractTask.mc;
|
|
||||||
import static com.replaymod.core.ReplayModIntegrationTest.MOD_ID;
|
|
||||||
import static com.replaymod.core.utils.Utils.addCallback;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper mod that initiates the integration tests.
|
|
||||||
*/
|
|
||||||
@Mod(modid = MOD_ID)
|
|
||||||
public class ReplayModIntegrationTest {
|
|
||||||
public static final String MOD_ID = "replaymod-integration-test";
|
|
||||||
|
|
||||||
public static Logger LOGGER;
|
|
||||||
|
|
||||||
@Mod.EventHandler
|
|
||||||
public void init(FMLPreInitializationEvent event) {
|
|
||||||
LOGGER = event.getModLog();
|
|
||||||
|
|
||||||
// Make sure the game window doesn't have to remain in focus during the test
|
|
||||||
mc.gameSettings.pauseOnLostFocus = false;
|
|
||||||
|
|
||||||
runTasks(
|
|
||||||
new SkipLogin(),
|
|
||||||
new DownloadOpenEye(),
|
|
||||||
new CreateSPWorld(),
|
|
||||||
new Wait(5000),
|
|
||||||
new ExitSPWorld(),
|
|
||||||
new OpenReplayViewer(),
|
|
||||||
new LoadReplay(),
|
|
||||||
|
|
||||||
new RegressionTest60(),
|
|
||||||
new RegressionTest61(),
|
|
||||||
new RegressionTest62(),
|
|
||||||
|
|
||||||
// new AbstractTask() {}, // Uncomment to not exit on success (useful for writing more tests)
|
|
||||||
new ExitReplay()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void runTasks(Task... tests) {
|
|
||||||
addCallback(new CompositeTask(tests).execute(), success -> {
|
|
||||||
if (!Minecraft.getMinecraft().hasCrashed) {
|
|
||||||
LOGGER.info("===================================================");
|
|
||||||
LOGGER.info("= ALL TESTS PASSED =");
|
|
||||||
LOGGER.info("===================================================");
|
|
||||||
FMLCommonHandler.instance().exitJava(0, false);
|
|
||||||
}
|
|
||||||
}, error -> {
|
|
||||||
LOGGER.error("Failed task:", error);
|
|
||||||
LOGGER.error("===================================================");
|
|
||||||
LOGGER.error("= TEST FAILED =");
|
|
||||||
LOGGER.error("===================================================");
|
|
||||||
FMLCommonHandler.instance().exitJava(1, false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.replaymod.core;
|
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
|
|
||||||
public interface Task {
|
|
||||||
ListenableFuture<Void> execute();
|
|
||||||
|
|
||||||
static Task click(int x, int y) {
|
|
||||||
return AbstractTask.create(task -> {
|
|
||||||
task.click(x, y);
|
|
||||||
task.runLater(() -> task.future.set(null));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
static Task drag(int x, int y) {
|
|
||||||
return AbstractTask.create(task -> {
|
|
||||||
task.drag(x, y);
|
|
||||||
task.runLater(() -> task.future.set(null));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
static Task pressKey(int keyCode) {
|
|
||||||
return AbstractTask.create(task -> {
|
|
||||||
task.press(keyCode);
|
|
||||||
task.runLater(() -> task.future.set(null));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
static Task pressKey(char character, int keyCode) {
|
|
||||||
return AbstractTask.create(task -> {
|
|
||||||
task.press(character, keyCode);
|
|
||||||
task.runLater(() -> task.future.set(null));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package com.replaymod.core;
|
|
||||||
|
|
||||||
public class Utils {
|
|
||||||
public static void times(int x, Runnable runnable) {
|
|
||||||
for (int i = 0; i < x; i++) {
|
|
||||||
runnable.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.replaymod.core;
|
|
||||||
|
|
||||||
public class Wait extends AbstractTask {
|
|
||||||
private final int duration;
|
|
||||||
|
|
||||||
public Wait(int duration) {
|
|
||||||
this.duration = duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
Thread.sleep(duration);
|
|
||||||
runLater(() -> future.set(null));
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
runLater(() -> future.setException(e));
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
package com.replaymod.core.regression;
|
|
||||||
|
|
||||||
import com.replaymod.core.AbstractTask;
|
|
||||||
import com.replaymod.core.CompositeTask;
|
|
||||||
import com.replaymod.core.Task;
|
|
||||||
import com.replaymod.replay.SpectatePlayer;
|
|
||||||
import com.replaymod.replay.overlay.OverlayGui;
|
|
||||||
import com.replaymod.simplepathing.GuiPathingTasks;
|
|
||||||
import com.replaymod.simplepathing.gui.GuiEditKeyframe;
|
|
||||||
import org.lwjgl.input.Keyboard;
|
|
||||||
|
|
||||||
import static com.replaymod.core.AbstractTask.mc;
|
|
||||||
import static com.replaymod.core.Utils.times;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Regression test: #60 Crash in path preview when two spectator keyframes are closer than 50ms
|
|
||||||
*/
|
|
||||||
public class RegressionTest60 extends CompositeTask {
|
|
||||||
public RegressionTest60() {
|
|
||||||
super(new Task[]{
|
|
||||||
new SpectatePlayer(),
|
|
||||||
OverlayGui.whileOpened(
|
|
||||||
// Place first spectator keyframe
|
|
||||||
new GuiPathingTasks.ClickPositionKeyframeButton(),
|
|
||||||
// Place second spectator keyframe
|
|
||||||
Task.click(130, 50),
|
|
||||||
new GuiPathingTasks.ClickPositionKeyframeButton(),
|
|
||||||
// Move second keyframe to 20ms on the keyframe timeline
|
|
||||||
AbstractTask.create(task -> {
|
|
||||||
// Double click keyframe
|
|
||||||
task.click(130, 50);
|
|
||||||
task.click(130, 50);
|
|
||||||
task.expectGui(GuiEditKeyframe.Spectator.class, gui -> {
|
|
||||||
// Set ms field to 20
|
|
||||||
task.click(mc.currentScreen.width / 2 + 80, mc.currentScreen.height / 2);
|
|
||||||
times(4, () -> task.press(Keyboard.KEY_BACK));
|
|
||||||
task.type("20");
|
|
||||||
// Set other fields to 0
|
|
||||||
times(2, () -> {
|
|
||||||
task.press(Keyboard.KEY_TAB);
|
|
||||||
times(4, () -> task.press(Keyboard.KEY_BACK));
|
|
||||||
task.press(Keyboard.KEY_0);
|
|
||||||
});
|
|
||||||
task.click(gui.saveButton);
|
|
||||||
task.expectPopupClosed(() -> task.future.set(null));
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
// Place second spectator keyframe
|
|
||||||
new GuiPathingTasks.ClickPositionKeyframeButton()
|
|
||||||
),
|
|
||||||
// Stop spectating player
|
|
||||||
new SpectatePlayer.End(),
|
|
||||||
// Enable path preview
|
|
||||||
Task.pressKey(Keyboard.KEY_H),
|
|
||||||
new GuiPathingTasks.ClearKeyframeTimeline(),
|
|
||||||
Task.pressKey(Keyboard.KEY_H),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.replaymod.core.regression;
|
|
||||||
|
|
||||||
import com.replaymod.core.AbstractTask;
|
|
||||||
import com.replaymod.core.CompositeTask;
|
|
||||||
import com.replaymod.core.Task;
|
|
||||||
import com.replaymod.replay.overlay.OverlayGui;
|
|
||||||
import com.replaymod.simplepathing.GuiPathingTasks;
|
|
||||||
import com.replaymod.simplepathing.gui.GuiEditKeyframe;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Regression test: #61 NPE when saving in edit keyframe gui of last keyframe
|
|
||||||
*/
|
|
||||||
public class RegressionTest61 extends CompositeTask {
|
|
||||||
public RegressionTest61() {
|
|
||||||
super(new Task[]{
|
|
||||||
OverlayGui.whileOpened(
|
|
||||||
// Place keyframe
|
|
||||||
Task.click(130, 50),
|
|
||||||
new GuiPathingTasks.ClickPositionKeyframeButton(),
|
|
||||||
AbstractTask.create(task -> {
|
|
||||||
// Double click keyframe
|
|
||||||
task.click(130, 50);
|
|
||||||
task.click(130, 50);
|
|
||||||
task.expectGui(GuiEditKeyframe.Position.class, gui -> {
|
|
||||||
task.click(gui.saveButton);
|
|
||||||
task.expectPopupClosed(() -> task.future.set(null));
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
// Place second spectator keyframe
|
|
||||||
new GuiPathingTasks.ClickPositionKeyframeButton()
|
|
||||||
),
|
|
||||||
new GuiPathingTasks.ClearKeyframeTimeline(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
package com.replaymod.core.regression;
|
|
||||||
|
|
||||||
import com.replaymod.core.CompositeTask;
|
|
||||||
import com.replaymod.core.Task;
|
|
||||||
import com.replaymod.replay.overlay.OverlayGui;
|
|
||||||
import com.replaymod.simplepathing.GuiPathingTasks;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Regression test: #62 Swapping the only two existing keyframes causes NPE
|
|
||||||
*/
|
|
||||||
public class RegressionTest62 extends CompositeTask {
|
|
||||||
public RegressionTest62() {
|
|
||||||
super(new Task[]{
|
|
||||||
OverlayGui.whileOpened(
|
|
||||||
// Place first keyframe
|
|
||||||
Task.click(130, 50),
|
|
||||||
new GuiPathingTasks.ClickPositionKeyframeButton(),
|
|
||||||
// Place second keyframe
|
|
||||||
Task.click(150, 50),
|
|
||||||
new GuiPathingTasks.ClickPositionKeyframeButton(),
|
|
||||||
// Move first keyframe past second keyframe
|
|
||||||
Task.click(130,50),
|
|
||||||
Task.drag(170,50)
|
|
||||||
),
|
|
||||||
new GuiPathingTasks.ClearKeyframeTimeline()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package com.replaymod.extra;
|
|
||||||
|
|
||||||
import com.replaymod.core.AbstractTask;
|
|
||||||
import com.replaymod.extras.OpenEyeExtra;
|
|
||||||
import net.minecraftforge.fml.common.Loader;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.nio.file.NoSuchFileException;
|
|
||||||
|
|
||||||
public class DownloadOpenEye extends AbstractTask {
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
expectGui(OpenEyeExtra.OfferGui.class, offerGui -> {
|
|
||||||
click(offerGui.yesButton);
|
|
||||||
expectGuiClosed(20 * 1000, () -> {
|
|
||||||
File targetFile = new File(mc.mcDataDir, "mods/" + Loader.MC_VERSION + "/OpenEye.jar");
|
|
||||||
if (!targetFile.exists()) {
|
|
||||||
future.setException(new NoSuchFileException(targetFile.getAbsolutePath()));
|
|
||||||
} else {
|
|
||||||
future.set(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.replaymod.online;
|
|
||||||
|
|
||||||
import com.replaymod.core.AbstractTask;
|
|
||||||
import com.replaymod.online.gui.GuiLoginPrompt;
|
|
||||||
|
|
||||||
public class SkipLogin extends AbstractTask {
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
expectGui(GuiLoginPrompt.class, gui -> {
|
|
||||||
click(gui.cancelButton);
|
|
||||||
expectGuiClosed(() -> future.set(null));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package com.replaymod.recording;
|
|
||||||
|
|
||||||
import com.replaymod.core.AbstractTask;
|
|
||||||
import net.minecraft.client.gui.GuiCreateWorld;
|
|
||||||
import net.minecraft.client.gui.GuiMainMenu;
|
|
||||||
import net.minecraft.client.gui.GuiWorldSelection;
|
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
|
|
||||||
public class CreateSPWorld extends AbstractTask {
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
expectGui(GuiMainMenu.class, mainMenu -> {
|
|
||||||
click("Singleplayer");
|
|
||||||
expectGui(GuiWorldSelection.class, selectWorld -> {
|
|
||||||
click("Create New World");
|
|
||||||
expectGui(GuiCreateWorld.class, createWorld -> {
|
|
||||||
click("Create New World");
|
|
||||||
class EventHandler {
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onRenderIngame(RenderGameOverlayEvent.Pre event) {
|
|
||||||
MinecraftForge.EVENT_BUS.unregister(this);
|
|
||||||
runLater(() -> future.set(null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package com.replaymod.recording;
|
|
||||||
|
|
||||||
import com.replaymod.core.AbstractTask;
|
|
||||||
import net.minecraft.client.gui.GuiIngameMenu;
|
|
||||||
import net.minecraft.client.gui.GuiMainMenu;
|
|
||||||
import org.apache.commons.io.filefilter.DirectoryFileFilter;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class ExitSPWorld extends AbstractTask {
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
mc.displayInGameMenu();
|
|
||||||
expectGui(GuiIngameMenu.class, ingameMenu -> {
|
|
||||||
click("Save and Quit to Title");
|
|
||||||
expectGui(GuiMainMenu.class, mainMenu -> new Thread(() -> {
|
|
||||||
try {
|
|
||||||
while (true) {
|
|
||||||
String[] dirs = core.getReplayFolder().list(DirectoryFileFilter.DIRECTORY);
|
|
||||||
if (dirs == null) {
|
|
||||||
future.setException(new NullPointerException("dirs is null"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (dirs.length == 0) {
|
|
||||||
runLater(() -> future.set(null));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Thread.sleep(10);
|
|
||||||
}
|
|
||||||
} catch (IOException | InterruptedException e) {
|
|
||||||
future.setException(e);
|
|
||||||
}
|
|
||||||
}).start());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.replaymod.replay;
|
|
||||||
|
|
||||||
import com.replaymod.core.AbstractTask;
|
|
||||||
import net.minecraft.client.gui.GuiIngameMenu;
|
|
||||||
import net.minecraft.client.gui.GuiMainMenu;
|
|
||||||
|
|
||||||
public class ExitReplay extends AbstractTask {
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
mc.displayInGameMenu();
|
|
||||||
expectGui(GuiIngameMenu.class, ingameMenu -> {
|
|
||||||
click("Exit Replay");
|
|
||||||
expectGui(GuiMainMenu.class, mainMenu -> future.set(null));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package com.replaymod.replay;
|
|
||||||
|
|
||||||
import com.replaymod.core.AbstractTask;
|
|
||||||
import com.replaymod.replay.gui.screen.GuiReplayViewer;
|
|
||||||
import de.johni0702.minecraft.gui.function.Clickable;
|
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import org.lwjgl.util.Point;
|
|
||||||
import org.lwjgl.util.ReadableDimension;
|
|
||||||
|
|
||||||
public class LoadReplay extends AbstractTask {
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
expectGui(GuiReplayViewer.class, replayViewer -> runLater(() -> {
|
|
||||||
ReadableDimension size = replayViewer.getMaxSize();
|
|
||||||
// Select first entry
|
|
||||||
replayViewer.forEach(Clickable.class).mouseClick(new Point(size.getWidth() / 2, 40), 0);
|
|
||||||
// Load first replay
|
|
||||||
click(replayViewer.loadButton);
|
|
||||||
|
|
||||||
class EventHandler {
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onRenderIngame(RenderGameOverlayEvent.Pre event) {
|
|
||||||
MinecraftForge.EVENT_BUS.unregister(this);
|
|
||||||
runLater(() -> future.set(null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.replaymod.replay;
|
|
||||||
|
|
||||||
import com.replaymod.core.AbstractTask;
|
|
||||||
import com.replaymod.replay.gui.screen.GuiReplayViewer;
|
|
||||||
import net.minecraft.client.gui.GuiMainMenu;
|
|
||||||
|
|
||||||
public class OpenReplayViewer extends AbstractTask {
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
expectGui(GuiMainMenu.class, mainMenu -> {
|
|
||||||
click("Replay Viewer");
|
|
||||||
expectGui(GuiReplayViewer.class, replayViewer -> future.set(null));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package com.replaymod.replay;
|
|
||||||
|
|
||||||
import com.replaymod.core.AbstractTask;
|
|
||||||
import com.replaymod.extras.playeroverview.PlayerOverviewGui;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
|
||||||
import org.lwjgl.input.Keyboard;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeoutException;
|
|
||||||
|
|
||||||
public class SpectatePlayer extends AbstractTask {
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
press(Keyboard.KEY_B);
|
|
||||||
expectGui(PlayerOverviewGui.class, overview -> {
|
|
||||||
click(overview.getMaxSize().getWidth() / 2 - 60, 60);
|
|
||||||
press(Keyboard.KEY_ESCAPE);
|
|
||||||
expectGuiClosed(() -> future.set(null));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class End extends AbstractTask {
|
|
||||||
private int timeout;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
runLater(() -> press(Keyboard.KEY_LSHIFT));
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onTick(TickEvent.RenderTickEvent event) {
|
|
||||||
if (event.phase != TickEvent.Phase.START) return;
|
|
||||||
if (timeout++ > 20) {
|
|
||||||
future.setException(new TimeoutException("Camera hasn't stopped spectating."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mc.getRenderViewEntity() == mc.thePlayer) {
|
|
||||||
future.set(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package com.replaymod.replay.overlay;
|
|
||||||
|
|
||||||
import com.replaymod.core.AbstractTask;
|
|
||||||
import com.replaymod.core.CompositeTask;
|
|
||||||
import com.replaymod.core.Task;
|
|
||||||
import com.replaymod.replay.gui.overlay.GuiReplayOverlay;
|
|
||||||
import org.lwjgl.input.Keyboard;
|
|
||||||
|
|
||||||
public class OverlayGui {
|
|
||||||
public static Task whileOpened(Task...tasks) {
|
|
||||||
Task[] nTasks = new Task[tasks.length + 2];
|
|
||||||
System.arraycopy(tasks, 0, nTasks, 1, tasks.length);
|
|
||||||
nTasks[0] = new Open();
|
|
||||||
nTasks[tasks.length + 1] = new Close();
|
|
||||||
return new CompositeTask(nTasks);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Open extends AbstractTask {
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
press(Keyboard.KEY_T);
|
|
||||||
expectGui(GuiReplayOverlay.class, done -> future.set(null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Close extends AbstractTask {
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
press(Keyboard.KEY_ESCAPE);
|
|
||||||
expectGuiClosed(() -> future.set(null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.replaymod.simplepathing;
|
|
||||||
|
|
||||||
import com.replaymod.core.AbstractTask;
|
|
||||||
import com.replaymod.replay.gui.overlay.GuiReplayOverlay;
|
|
||||||
import com.replaymod.simplepathing.gui.GuiPathing;
|
|
||||||
import de.johni0702.minecraft.gui.popup.GuiYesNoPopup;
|
|
||||||
import org.lwjgl.input.Keyboard;
|
|
||||||
|
|
||||||
public abstract class GuiPathingTasks extends AbstractTask {
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
expectGui(GuiReplayOverlay.class, ign -> init0(ReplayModSimplePathing.instance.getGuiPathing()));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void init0(GuiPathing guiPathing);
|
|
||||||
|
|
||||||
public static class ClickPositionKeyframeButton extends GuiPathingTasks {
|
|
||||||
@Override
|
|
||||||
protected void init0(GuiPathing guiPathing) {
|
|
||||||
click(guiPathing.positionKeyframeButton);
|
|
||||||
runLater(() -> future.set(null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ClearKeyframeTimeline extends AbstractTask {
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
press(Keyboard.KEY_C);
|
|
||||||
expectGui(GuiYesNoPopup.class, popup -> {
|
|
||||||
click(popup.getYesButton());
|
|
||||||
expectGuiClosed(() -> future.set(null));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,7 @@ public class Restrictions {
|
|||||||
public String handle(SPacketCustomPayload packet) {
|
public String handle(SPacketCustomPayload packet) {
|
||||||
PacketBuffer buffer = packet.getBufferData();
|
PacketBuffer buffer = packet.getBufferData();
|
||||||
while (buffer.isReadable()) {
|
while (buffer.isReadable()) {
|
||||||
String name = buffer.readStringFromBuffer(64);
|
String name = buffer.readString(64);
|
||||||
boolean active = buffer.readBoolean();
|
boolean active = buffer.readBoolean();
|
||||||
// if ("no_xray".equals(name)) {
|
// if ("no_xray".equals(name)) {
|
||||||
// noXray = active;
|
// noXray = active;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.replaymod.core.utils;
|
|||||||
|
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import com.google.common.util.concurrent.Futures;
|
import com.google.common.util.concurrent.Futures;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
import de.johni0702.minecraft.gui.GuiRenderer;
|
import de.johni0702.minecraft.gui.GuiRenderer;
|
||||||
import de.johni0702.minecraft.gui.RenderInfo;
|
import de.johni0702.minecraft.gui.RenderInfo;
|
||||||
import de.johni0702.minecraft.gui.container.AbstractGuiScrollable;
|
import de.johni0702.minecraft.gui.container.AbstractGuiScrollable;
|
||||||
@@ -26,7 +25,6 @@ import org.lwjgl.input.Keyboard;
|
|||||||
import org.lwjgl.util.Dimension;
|
import org.lwjgl.util.Dimension;
|
||||||
import org.lwjgl.util.ReadableDimension;
|
import org.lwjgl.util.ReadableDimension;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
@@ -47,7 +45,6 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
import static net.minecraft.client.Minecraft.getMinecraft;
|
import static net.minecraft.client.Minecraft.getMinecraft;
|
||||||
|
|
||||||
@@ -152,20 +149,6 @@ public class Utils {
|
|||||||
return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
|
return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void addCallback(ListenableFuture<T> future, Consumer<T> onSuccess, Consumer<Throwable> onFailure) {
|
|
||||||
Futures.addCallback(future, new FutureCallback<T>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(@Nullable T result) {
|
|
||||||
onSuccess.accept(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(@Nonnull Throwable t) {
|
|
||||||
onFailure.accept(t);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GuiInfoPopup error(Logger logger, GuiContainer container, CrashReport crashReport, Runnable onClose) {
|
public static GuiInfoPopup error(Logger logger, GuiContainer container, CrashReport crashReport, Runnable onClose) {
|
||||||
// Convert crash report to string
|
// Convert crash report to string
|
||||||
String crashReportStr = crashReport.getCompleteReport();
|
String crashReportStr = crashReport.getCompleteReport();
|
||||||
|
|||||||
@@ -59,9 +59,6 @@ public class GuiReplayEditor extends GuiScreen {
|
|||||||
public GuiButton currentTabButton;
|
public GuiButton currentTabButton;
|
||||||
public GuiPanel currentTabPanel;
|
public GuiPanel currentTabPanel;
|
||||||
|
|
||||||
public final GuiLabel warningLabel = new GuiLabel(this).setColor(Colors.RED)
|
|
||||||
.setI18nText("replaymod.gui.editor.disclaimer");
|
|
||||||
|
|
||||||
public final GuiPanel tabButtons = new GuiPanel(this).setLayout(new GridLayout().setSpacingX(5));
|
public final GuiPanel tabButtons = new GuiPanel(this).setLayout(new GridLayout().setSpacingX(5));
|
||||||
public final List<GuiPanel> tabPanels = new ArrayList<>();
|
public final List<GuiPanel> tabPanels = new ArrayList<>();
|
||||||
|
|
||||||
@@ -87,18 +84,15 @@ public class GuiReplayEditor extends GuiScreen {
|
|||||||
// Move all inactive panels aside
|
// Move all inactive panels aside
|
||||||
tabPanels.forEach(e -> pos(e, Integer.MIN_VALUE, Integer.MIN_VALUE));
|
tabPanels.forEach(e -> pos(e, Integer.MIN_VALUE, Integer.MIN_VALUE));
|
||||||
|
|
||||||
pos(warningLabel, 10, 22);
|
|
||||||
size(warningLabel, width - 20, 10);
|
|
||||||
|
|
||||||
pos(tabButtons, 10, y(warningLabel) + height(warningLabel) + 2);
|
|
||||||
size(tabButtons, width - 20, 20);
|
|
||||||
|
|
||||||
pos(buttonPanel, width - 10 - width(buttonPanel), height - 10 - height(buttonPanel));
|
pos(buttonPanel, width - 10 - width(buttonPanel), height - 10 - height(buttonPanel));
|
||||||
|
|
||||||
if (currentTabPanel != null) {
|
if (currentTabPanel != null) {
|
||||||
pos(currentTabPanel, 10, y(tabButtons) + height(tabButtons) + 10);
|
pos(currentTabPanel, 10, 50);
|
||||||
size(currentTabPanel, width - 20, y(buttonPanel) - 10 - y(currentTabPanel));
|
size(currentTabPanel, width - 20, y(buttonPanel) - 10 - y(currentTabPanel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pos(tabButtons, 10, 20);
|
||||||
|
size(tabButtons, width - 20, 20);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,106 +1,102 @@
|
|||||||
package com.replaymod.extras;
|
package com.replaymod.extras;
|
||||||
|
|
||||||
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.replaymod.core.ReplayMod;
|
import com.replaymod.core.ReplayMod;
|
||||||
|
import com.replaymod.online.ReplayModOnline;
|
||||||
|
import com.replaymod.online.api.ApiClient;
|
||||||
|
import com.replaymod.online.api.ApiException;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.resources.IResourcePack;
|
import net.minecraft.client.resources.IResourcePack;
|
||||||
import net.minecraft.client.resources.data.IMetadataSection;
|
import net.minecraft.client.resources.data.IMetadataSection;
|
||||||
import net.minecraft.client.resources.data.MetadataSerializer;
|
import net.minecraft.client.resources.data.MetadataSerializer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.ConnectException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipInputStream;
|
|
||||||
|
|
||||||
import static com.replaymod.extras.ReplayModExtras.LOGGER;
|
|
||||||
|
|
||||||
public class LocalizationExtra implements Extra {
|
public class LocalizationExtra implements Extra {
|
||||||
private static final String ZIP_FILE_URL = "https://github.com/ReplayMod/Translations/archive/master.zip";
|
private ReplayModOnline module;
|
||||||
private static final String LANG_PREFIX = "Translations-master/";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(ReplayMod mod) throws Exception {
|
public void register(ReplayMod mod) throws Exception {
|
||||||
final Minecraft mc = mod.getMinecraft();
|
this.module = ReplayModOnline.instance;
|
||||||
if (Boolean.parseBoolean(System.getProperty("replaymod.offline", "false"))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Thread localizedResourcePackLoader = new Thread(() -> {
|
|
||||||
try {
|
|
||||||
// Download zip of lang files
|
|
||||||
LOGGER.debug("Downloading languages from {}", ZIP_FILE_URL);
|
|
||||||
Map<String, byte[]> languages = new HashMap<>();
|
|
||||||
try (InputStream urlIn = new URL(ZIP_FILE_URL).openStream();
|
|
||||||
ZipInputStream in = new ZipInputStream(urlIn)) {
|
|
||||||
ZipEntry entry;
|
|
||||||
while ((entry = in.getNextEntry()) != null) {
|
|
||||||
String name = entry.getName();
|
|
||||||
if (!name.startsWith(LANG_PREFIX) || !name.endsWith(".lang")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
name = name.substring(LANG_PREFIX.length());
|
|
||||||
languages.put(name, IOUtils.toByteArray(in));
|
|
||||||
LOGGER.debug("Added language file {}", name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LOGGER.debug("Downloaded {} languages", languages.size());
|
|
||||||
|
|
||||||
// Add lang files as resource pack
|
final Minecraft mc = mod.getMinecraft();
|
||||||
mc.addScheduledTask(() -> {
|
Thread localizedResourcePackLoader = new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<IResourcePack> defaultResourcePacks = mc.defaultResourcePacks;
|
List<IResourcePack> defaultResourcePacks = mc.defaultResourcePacks;
|
||||||
defaultResourcePacks.add(new LocalizedResourcePack(languages));
|
defaultResourcePacks.add(new LocalizedResourcePack(module.getApiClient()));
|
||||||
mc.getLanguageManager().onResourceManagerReload(mc.getResourceManager());
|
mc.addScheduledTask(new Runnable() {
|
||||||
LOGGER.debug("Added language files to resource packs and reloaded LanguageManager");
|
@Override
|
||||||
});
|
public void run() {
|
||||||
} catch (Throwable t) {
|
mc.refreshResources();
|
||||||
LOGGER.error("Loading localized resource pack:", t);
|
}
|
||||||
|
});
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, "localizedResourcePackLoader");
|
}, "localizedResourcePackLoader");
|
||||||
localizedResourcePackLoader.setDaemon(true);
|
|
||||||
localizedResourcePackLoader.start();
|
localizedResourcePackLoader.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
public static class LocalizedResourcePack implements IResourcePack {
|
public static class LocalizedResourcePack implements IResourcePack {
|
||||||
private final Pattern LANG_PATTERN = Pattern.compile("^lang/([.+].lang)$");
|
private final ApiClient apiClient;
|
||||||
private final Map<String, byte[]> languages;
|
private Map<String, String> availableLanguages = new HashMap<>();
|
||||||
|
private boolean websiteAvailable = true;
|
||||||
public LocalizedResourcePack(Map<String, byte[]> languages) {
|
|
||||||
this.languages = languages;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream getInputStream(ResourceLocation loc) {
|
public InputStream getInputStream(ResourceLocation loc) {
|
||||||
if (!"replaymod".equals(loc.getResourceDomain())) return null;
|
if(!loc.getResourcePath().endsWith(".lang")) return null;
|
||||||
Matcher matcher = LANG_PATTERN.matcher(loc.getResourcePath());
|
String langcode = loc.getResourcePath().split("/")[1].split("\\.")[0];
|
||||||
if (matcher.matches()) {
|
if(availableLanguages.containsKey(langcode)) return new ByteArrayInputStream(availableLanguages.get(langcode).getBytes(Charsets.UTF_8));
|
||||||
byte[] bytes = languages.get(matcher.group());
|
|
||||||
if (bytes != null) {
|
|
||||||
return new ByteArrayInputStream(bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean resourceExists(ResourceLocation loc) {
|
public boolean resourceExists(ResourceLocation loc) {
|
||||||
// Assumes that getInputStream returns a ByteArrayInputStream that doesn't need to be closed
|
if(!(loc.getResourcePath().endsWith(".lang"))) return false;
|
||||||
return getInputStream(loc) != null;
|
String langcode = loc.getResourcePath().split("/")[1].split("\\.")[0];
|
||||||
|
if(availableLanguages.containsKey(langcode)) return true;
|
||||||
|
if(!websiteAvailable) return false;
|
||||||
|
try {
|
||||||
|
if (Boolean.parseBoolean(System.getProperty("replaymod.offline", "false"))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String lang = apiClient.getTranslation(langcode);
|
||||||
|
String prop = StringEscapeUtils.unescapeHtml4(lang);
|
||||||
|
availableLanguages.put(langcode, prop);
|
||||||
|
return true;
|
||||||
|
} catch (ApiException e) {
|
||||||
|
if (e.getError() == null || e.getError().getId() != 16) { // This language has not been translated
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} catch(ConnectException ce) {
|
||||||
|
websiteAvailable = false;
|
||||||
|
ce.printStackTrace();
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getResourceDomains() {
|
public Set<String> getResourceDomains() {
|
||||||
return ImmutableSet.of("replaymod");
|
return ImmutableSet.of("minecraft", "replaymod");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class OpenEyeExtra implements Extra {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OfferGui extends AbstractGuiScreen<OfferGui> {
|
private class OfferGui extends AbstractGuiScreen<OfferGui> {
|
||||||
public final GuiScreen parent;
|
public final GuiScreen parent;
|
||||||
public final GuiPanel textPanel = new GuiPanel().setLayout(new VerticalLayout().setSpacing(3))
|
public final GuiPanel textPanel = new GuiPanel().setLayout(new VerticalLayout().setSpacing(3))
|
||||||
.addElements(new VerticalLayout.Data(0.5),
|
.addElements(new VerticalLayout.Data(0.5),
|
||||||
@@ -69,7 +69,7 @@ public class OpenEyeExtra implements Extra {
|
|||||||
GuiPopup popup = new GuiPopup(OfferGui.this);
|
GuiPopup popup = new GuiPopup(OfferGui.this);
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
File targetFile = new File(mod.getMinecraft().mcDataDir, "mods/" + Loader.MC_VERSION + "/OpenEye.jar");
|
File targetFile = new File("mods/" + Loader.MC_VERSION, "OpenEye.jar");
|
||||||
FileUtils.forceMkdir(targetFile.getParentFile());
|
FileUtils.forceMkdir(targetFile.getParentFile());
|
||||||
|
|
||||||
HttpsURLConnection connection = (HttpsURLConnection) new URL(DOWNLOAD_URL).openConnection();
|
HttpsURLConnection connection = (HttpsURLConnection) new URL(DOWNLOAD_URL).openConnection();
|
||||||
@@ -107,7 +107,7 @@ public class OpenEyeExtra implements Extra {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class GuiPopup extends AbstractGuiPopup<GuiPopup> {
|
private static final class GuiPopup extends AbstractGuiPopup<GuiPopup> {
|
||||||
GuiPopup(GuiContainer container) {
|
GuiPopup(GuiContainer container) {
|
||||||
super(container);
|
super(container);
|
||||||
popup.addElements(null, new GuiIndicator().setColor(Colors.BLACK));
|
popup.addElements(null, new GuiIndicator().setColor(Colors.BLACK));
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ public class ReplayModExtras {
|
|||||||
OpenEyeExtra.class
|
OpenEyeExtra.class
|
||||||
);
|
);
|
||||||
|
|
||||||
public static Logger LOGGER;
|
private Logger logger;
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
LOGGER = event.getModLog();
|
logger = event.getModLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
@@ -46,7 +46,7 @@ public class ReplayModExtras {
|
|||||||
Extra extra = cls.newInstance();
|
Extra extra = cls.newInstance();
|
||||||
extra.register(ReplayMod.instance);
|
extra.register(ReplayMod.instance);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
LOGGER.warn("Failed to load extra " + cls.getName() + ": ", t);
|
logger.warn("Failed to load extra " + cls.getName() + ": ", t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class PlayerOverview implements Extra {
|
|||||||
public void run() {
|
public void run() {
|
||||||
if (module.getReplayHandler() != null) {
|
if (module.getReplayHandler() != null) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<EntityPlayer> players = mod.getMinecraft().theWorld.getPlayers(EntityPlayer.class, new Predicate() {
|
List<EntityPlayer> players = mod.getMinecraft().world.getPlayers(EntityPlayer.class, new Predicate() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Object input) {
|
public boolean apply(Object input) {
|
||||||
return !(input instanceof CameraEntity); // Exclude the camera entity
|
return !(input instanceof CameraEntity); // Exclude the camera entity
|
||||||
|
|||||||
@@ -4,15 +4,10 @@ import com.replaymod.core.utils.Utils;
|
|||||||
import com.replaymod.replay.ReplayModReplay;
|
import com.replaymod.replay.ReplayModReplay;
|
||||||
import de.johni0702.minecraft.gui.GuiRenderer;
|
import de.johni0702.minecraft.gui.GuiRenderer;
|
||||||
import de.johni0702.minecraft.gui.RenderInfo;
|
import de.johni0702.minecraft.gui.RenderInfo;
|
||||||
import de.johni0702.minecraft.gui.container.GuiClickable;
|
import de.johni0702.minecraft.gui.container.*;
|
||||||
import de.johni0702.minecraft.gui.container.GuiContainer;
|
|
||||||
import de.johni0702.minecraft.gui.container.GuiPanel;
|
|
||||||
import de.johni0702.minecraft.gui.container.GuiScreen;
|
|
||||||
import de.johni0702.minecraft.gui.container.GuiVerticalList;
|
|
||||||
import de.johni0702.minecraft.gui.element.GuiCheckbox;
|
import de.johni0702.minecraft.gui.element.GuiCheckbox;
|
||||||
import de.johni0702.minecraft.gui.element.GuiImage;
|
import de.johni0702.minecraft.gui.element.GuiImage;
|
||||||
import de.johni0702.minecraft.gui.element.GuiLabel;
|
import de.johni0702.minecraft.gui.element.GuiLabel;
|
||||||
import de.johni0702.minecraft.gui.element.GuiTooltip;
|
|
||||||
import de.johni0702.minecraft.gui.element.IGuiCheckbox;
|
import de.johni0702.minecraft.gui.element.IGuiCheckbox;
|
||||||
import de.johni0702.minecraft.gui.function.Closeable;
|
import de.johni0702.minecraft.gui.function.Closeable;
|
||||||
import de.johni0702.minecraft.gui.layout.CustomLayout;
|
import de.johni0702.minecraft.gui.layout.CustomLayout;
|
||||||
@@ -42,7 +37,6 @@ public class PlayerOverviewGui extends GuiScreen implements Closeable {
|
|||||||
public final GuiVerticalList playersScrollable = new GuiVerticalList(contentPanel)
|
public final GuiVerticalList playersScrollable = new GuiVerticalList(contentPanel)
|
||||||
.setDrawSlider(true).setDrawShadow(true);
|
.setDrawSlider(true).setDrawShadow(true);
|
||||||
public final GuiCheckbox saveCheckbox = new GuiCheckbox(contentPanel)
|
public final GuiCheckbox saveCheckbox = new GuiCheckbox(contentPanel)
|
||||||
.setTooltip(new GuiTooltip().setI18nText("replaymod.gui.playeroverview.remembersettings.description"))
|
|
||||||
.setI18nLabel("replaymod.gui.playeroverview.remembersettings");
|
.setI18nLabel("replaymod.gui.playeroverview.remembersettings");
|
||||||
public final GuiCheckbox checkAll = new GuiCheckbox(contentPanel){
|
public final GuiCheckbox checkAll = new GuiCheckbox(contentPanel){
|
||||||
@Override
|
@Override
|
||||||
@@ -50,14 +44,14 @@ public class PlayerOverviewGui extends GuiScreen implements Closeable {
|
|||||||
getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
||||||
playersScrollable.forEach(IGuiCheckbox.class).setChecked(true);
|
playersScrollable.forEach(IGuiCheckbox.class).setChecked(true);
|
||||||
}
|
}
|
||||||
}.setLabel("").setChecked(true).setTooltip(new GuiTooltip().setI18nText("replaymod.gui.playeroverview.showall"));
|
}.setLabel("").setChecked(true);
|
||||||
public final GuiCheckbox uncheckAll = new GuiCheckbox(contentPanel){
|
public final GuiCheckbox uncheckAll = new GuiCheckbox(contentPanel){
|
||||||
@Override
|
@Override
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
||||||
playersScrollable.forEach(IGuiCheckbox.class).setChecked(false);
|
playersScrollable.forEach(IGuiCheckbox.class).setChecked(false);
|
||||||
}
|
}
|
||||||
}.setLabel("").setChecked(false).setTooltip(new GuiTooltip().setI18nText("replaymod.gui.playeroverview.hideall"));
|
}.setLabel("").setChecked(false);
|
||||||
|
|
||||||
{
|
{
|
||||||
setBackground(Background.NONE);
|
setBackground(Background.NONE);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class ReplayModOnline {
|
|||||||
// Initial login prompt
|
// Initial login prompt
|
||||||
if (!core.getSettingsRegistry().get(Setting.SKIP_LOGIN_PROMPT)) {
|
if (!core.getSettingsRegistry().get(Setting.SKIP_LOGIN_PROMPT)) {
|
||||||
if (!isLoggedIn()) {
|
if (!isLoggedIn()) {
|
||||||
core.runLater(() -> new GuiLoginPrompt(apiClient, GuiScreen.wrap(getMinecraft().currentScreen), null, false).display());
|
new GuiLoginPrompt(apiClient, null, null, false).display();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ public enum MinecraftVersion {
|
|||||||
MC_1_8("Minecraft 1.8", "1.8"),
|
MC_1_8("Minecraft 1.8", "1.8"),
|
||||||
MC_1_9_4("Minecraft 1.9.4", "1.9.4"),
|
MC_1_9_4("Minecraft 1.9.4", "1.9.4"),
|
||||||
MC_1_10_2("Minecraft 1.10.2", "1.10.2"),
|
MC_1_10_2("Minecraft 1.10.2", "1.10.2"),
|
||||||
MC_1_11("Minecraft 1.11", "1.11");
|
MC_1_11("Minecraft 1.11", "1.11"),
|
||||||
|
MC_1_11_2("Minecraft 1.11.2", "1.11.2");
|
||||||
|
|
||||||
private String niceName, apiName;
|
private String niceName, apiName;
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class GuiLoginPrompt extends AbstractGuiScreen<GuiLoginPrompt> {
|
|||||||
private GuiLabel noAccountLabel = new GuiLabel(this).setI18nText("replaymod.gui.login.noacc");
|
private GuiLabel noAccountLabel = new GuiLabel(this).setI18nText("replaymod.gui.login.noacc");
|
||||||
private GuiLabel statusLabel = new GuiLabel(this);
|
private GuiLabel statusLabel = new GuiLabel(this);
|
||||||
private GuiButton loginButton = new GuiButton(this).setI18nLabel("replaymod.gui.login").setSize(150, 20).setEnabled(false);
|
private GuiButton loginButton = new GuiButton(this).setI18nLabel("replaymod.gui.login").setSize(150, 20).setEnabled(false);
|
||||||
public GuiButton cancelButton = new GuiButton(this).setI18nLabel("replaymod.gui.cancel").setSize(150, 20);
|
private GuiButton cancelButton = new GuiButton(this).setI18nLabel("replaymod.gui.cancel").setSize(150, 20);
|
||||||
private GuiButton registerButton = new GuiButton(this).setI18nLabel("replaymod.gui.register").setSize(150, 20);
|
private GuiButton registerButton = new GuiButton(this).setI18nLabel("replaymod.gui.register").setSize(150, 20);
|
||||||
private GuiTextField username = new GuiTextField(this).setSize(145, 20).setMaxLength(16).setFocused(true);
|
private GuiTextField username = new GuiTextField(this).setSize(145, 20).setMaxLength(16).setFocused(true);
|
||||||
private GuiPasswordField password = new GuiPasswordField(this).setSize(145, 20)
|
private GuiPasswordField password = new GuiPasswordField(this).setSize(145, 20)
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import de.johni0702.minecraft.gui.container.GuiScreen;
|
|||||||
import de.johni0702.minecraft.gui.element.GuiButton;
|
import de.johni0702.minecraft.gui.element.GuiButton;
|
||||||
import de.johni0702.minecraft.gui.element.GuiImage;
|
import de.johni0702.minecraft.gui.element.GuiImage;
|
||||||
import de.johni0702.minecraft.gui.element.GuiLabel;
|
import de.johni0702.minecraft.gui.element.GuiLabel;
|
||||||
import de.johni0702.minecraft.gui.element.GuiTooltip;
|
|
||||||
import de.johni0702.minecraft.gui.element.IGuiButton;
|
import de.johni0702.minecraft.gui.element.IGuiButton;
|
||||||
import de.johni0702.minecraft.gui.element.advanced.GuiResourceLoadingList;
|
import de.johni0702.minecraft.gui.element.advanced.GuiResourceLoadingList;
|
||||||
import de.johni0702.minecraft.gui.layout.CustomLayout;
|
import de.johni0702.minecraft.gui.layout.CustomLayout;
|
||||||
@@ -110,7 +109,6 @@ public class GuiReplayCenter extends GuiScreen {
|
|||||||
public void run() {
|
public void run() {
|
||||||
GuiReplayEntry selected = list.getSelected();
|
GuiReplayEntry selected = list.getSelected();
|
||||||
replayButtonPanel.forEach(IGuiButton.class).setEnabled(selected != null);
|
replayButtonPanel.forEach(IGuiButton.class).setEnabled(selected != null);
|
||||||
replayButtonPanel.forEach(IGuiButton.class).setTooltip(null);
|
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
int replayId = selected.fileInfo.getId();
|
int replayId = selected.fileInfo.getId();
|
||||||
boolean favorited = favoritedReplays.contains(replayId);
|
boolean favorited = favoritedReplays.contains(replayId);
|
||||||
@@ -125,22 +123,10 @@ public class GuiReplayCenter extends GuiScreen {
|
|||||||
favoriteButton.setI18nLabel("replaymod.gui.center." + (favorited ? "unfavorite" : "favorite"));
|
favoriteButton.setI18nLabel("replaymod.gui.center." + (favorited ? "unfavorite" : "favorite"));
|
||||||
// Only allow button usage for either unfavorite or favorite after they've actually downloaded it
|
// Only allow button usage for either unfavorite or favorite after they've actually downloaded it
|
||||||
favoriteButton.setEnabled(favorited || selected.downloaded);
|
favoriteButton.setEnabled(favorited || selected.downloaded);
|
||||||
if (favoriteButton.isEnabled()) {
|
|
||||||
favoriteButton.setTooltip(null);
|
|
||||||
} else {
|
|
||||||
favoriteButton.setTooltip(new GuiTooltip().setI18nText("replaymod.gui.center.downloadrequired"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Similar for like/dislike buttons
|
// Similar for like/dislike buttons
|
||||||
likeButton.setEnabled(selected.downloaded);
|
likeButton.setEnabled(selected.downloaded);
|
||||||
dislikeButton.setEnabled(selected.downloaded);
|
dislikeButton.setEnabled(selected.downloaded);
|
||||||
if (likeButton.isEnabled()) {
|
|
||||||
likeButton.setTooltip(null);
|
|
||||||
dislikeButton.setTooltip(null);
|
|
||||||
} else {
|
|
||||||
likeButton.setTooltip(new GuiTooltip().setI18nText("replaymod.gui.center.downloadrequired"));
|
|
||||||
dislikeButton.setTooltip(new GuiTooltip().setI18nText("replaymod.gui.center.downloadrequired"));
|
|
||||||
}
|
|
||||||
likeButton.setI18nLabel("replaymod.gui." + (liked ? "removelike" : "like"));
|
likeButton.setI18nLabel("replaymod.gui." + (liked ? "removelike" : "like"));
|
||||||
dislikeButton.setI18nLabel("replaymod.gui." + (disliked ? "removedislike" : "dislike"));
|
dislikeButton.setI18nLabel("replaymod.gui." + (disliked ? "removedislike" : "dislike"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,7 @@ import com.replaymod.replaystudio.studio.ReplayStudio;
|
|||||||
import de.johni0702.minecraft.gui.container.GuiContainer;
|
import de.johni0702.minecraft.gui.container.GuiContainer;
|
||||||
import de.johni0702.minecraft.gui.container.GuiPanel;
|
import de.johni0702.minecraft.gui.container.GuiPanel;
|
||||||
import de.johni0702.minecraft.gui.container.GuiScreen;
|
import de.johni0702.minecraft.gui.container.GuiScreen;
|
||||||
import de.johni0702.minecraft.gui.element.GuiButton;
|
import de.johni0702.minecraft.gui.element.*;
|
||||||
import de.johni0702.minecraft.gui.element.GuiCheckbox;
|
|
||||||
import de.johni0702.minecraft.gui.element.GuiImage;
|
|
||||||
import de.johni0702.minecraft.gui.element.GuiLabel;
|
|
||||||
import de.johni0702.minecraft.gui.element.GuiTextField;
|
|
||||||
import de.johni0702.minecraft.gui.element.GuiTooltip;
|
|
||||||
import de.johni0702.minecraft.gui.element.advanced.GuiDropdownMenu;
|
import de.johni0702.minecraft.gui.element.advanced.GuiDropdownMenu;
|
||||||
import de.johni0702.minecraft.gui.element.advanced.GuiProgressBar;
|
import de.johni0702.minecraft.gui.element.advanced.GuiProgressBar;
|
||||||
import de.johni0702.minecraft.gui.element.advanced.GuiTextArea;
|
import de.johni0702.minecraft.gui.element.advanced.GuiTextArea;
|
||||||
@@ -239,8 +234,6 @@ public class GuiUploadReplay extends GuiScreen {
|
|||||||
});
|
});
|
||||||
|
|
||||||
validateInputs();
|
validateInputs();
|
||||||
name.onTextChanged(s -> validateInputs());
|
|
||||||
tags.onTextChanged(s -> validateInputs());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validateInputs() {
|
public void validateInputs() {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.google.common.util.concurrent.FutureCallback;
|
|||||||
import com.google.common.util.concurrent.Futures;
|
import com.google.common.util.concurrent.Futures;
|
||||||
import com.google.common.util.concurrent.SettableFuture;
|
import com.google.common.util.concurrent.SettableFuture;
|
||||||
import com.replaymod.core.ReplayMod;
|
import com.replaymod.core.ReplayMod;
|
||||||
import com.replaymod.core.utils.Utils;
|
|
||||||
import com.replaymod.replay.ReplayModReplay;
|
import com.replaymod.replay.ReplayModReplay;
|
||||||
import com.replaymod.replaystudio.pathing.PathingRegistry;
|
import com.replaymod.replaystudio.pathing.PathingRegistry;
|
||||||
import com.replaymod.replaystudio.pathing.path.Path;
|
import com.replaymod.replaystudio.pathing.path.Path;
|
||||||
@@ -12,11 +11,7 @@ import com.replaymod.replaystudio.pathing.path.Timeline;
|
|||||||
import com.replaymod.replaystudio.replay.ReplayFile;
|
import com.replaymod.replaystudio.replay.ReplayFile;
|
||||||
import de.johni0702.minecraft.gui.GuiRenderer;
|
import de.johni0702.minecraft.gui.GuiRenderer;
|
||||||
import de.johni0702.minecraft.gui.RenderInfo;
|
import de.johni0702.minecraft.gui.RenderInfo;
|
||||||
import de.johni0702.minecraft.gui.container.AbstractGuiClickableContainer;
|
import de.johni0702.minecraft.gui.container.*;
|
||||||
import de.johni0702.minecraft.gui.container.GuiContainer;
|
|
||||||
import de.johni0702.minecraft.gui.container.GuiPanel;
|
|
||||||
import de.johni0702.minecraft.gui.container.GuiScreen;
|
|
||||||
import de.johni0702.minecraft.gui.container.GuiVerticalList;
|
|
||||||
import de.johni0702.minecraft.gui.element.GuiButton;
|
import de.johni0702.minecraft.gui.element.GuiButton;
|
||||||
import de.johni0702.minecraft.gui.element.GuiLabel;
|
import de.johni0702.minecraft.gui.element.GuiLabel;
|
||||||
import de.johni0702.minecraft.gui.element.GuiTextField;
|
import de.johni0702.minecraft.gui.element.GuiTextField;
|
||||||
@@ -46,16 +41,9 @@ public class GuiKeyframeRepository extends GuiScreen implements Closeable {
|
|||||||
public final GuiButton overwriteButton = new GuiButton(buttonPanel).onClick(new Runnable() {
|
public final GuiButton overwriteButton = new GuiButton(buttonPanel).onClick(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GuiYesNoPopup popup = GuiYesNoPopup.open(GuiKeyframeRepository.this,
|
timelines.put(selectedEntry.name, currentTimeline);
|
||||||
new GuiLabel().setI18nText("replaymod.gui.keyframerepo.overwrite").setColor(Colors.BLACK)
|
overwriteButton.setDisabled();
|
||||||
).setYesI18nLabel("gui.yes").setNoI18nLabel("gui.no");
|
save();
|
||||||
Utils.addCallback(popup.getFuture(), doIt -> {
|
|
||||||
if (doIt) {
|
|
||||||
timelines.put(selectedEntry.name, currentTimeline);
|
|
||||||
overwriteButton.setDisabled();
|
|
||||||
save();
|
|
||||||
}
|
|
||||||
}, Throwable::printStackTrace);
|
|
||||||
}
|
}
|
||||||
}).setSize(75, 20).setI18nLabel("replaymod.gui.overwrite").setDisabled();
|
}).setSize(75, 20).setI18nLabel("replaymod.gui.overwrite").setDisabled();
|
||||||
public final GuiButton saveAsButton = new GuiButton(buttonPanel).onClick(new Runnable() {
|
public final GuiButton saveAsButton = new GuiButton(buttonPanel).onClick(new Runnable() {
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import com.replaymod.core.ReplayMod;
|
|||||||
import com.replaymod.core.utils.Restrictions;
|
import com.replaymod.core.utils.Restrictions;
|
||||||
import com.replaymod.recording.handler.ConnectionEventHandler;
|
import com.replaymod.recording.handler.ConnectionEventHandler;
|
||||||
import com.replaymod.recording.packet.PacketListener;
|
import com.replaymod.recording.packet.PacketListener;
|
||||||
import io.netty.channel.ChannelDuplexHandler;
|
|
||||||
import io.netty.channel.ChannelHandler;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
@@ -56,12 +54,9 @@ public class ReplayModRecording {
|
|||||||
EventBus bus = MinecraftForge.EVENT_BUS;
|
EventBus bus = MinecraftForge.EVENT_BUS;
|
||||||
bus.register(connectionEventHandler = new ConnectionEventHandler(logger, core));
|
bus.register(connectionEventHandler = new ConnectionEventHandler(logger, core));
|
||||||
|
|
||||||
NetworkRegistry.INSTANCE.newChannel(Restrictions.PLUGIN_CHANNEL, new RestrictionsChannelHandler());
|
NetworkRegistry.INSTANCE.newSimpleChannel(Restrictions.PLUGIN_CHANNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ChannelHandler.Sharable
|
|
||||||
private static class RestrictionsChannelHandler extends ChannelDuplexHandler {}
|
|
||||||
|
|
||||||
public void initiateRecording(NetworkManager networkManager) {
|
public void initiateRecording(NetworkManager networkManager) {
|
||||||
connectionEventHandler.onConnectedToServerEvent(networkManager);
|
connectionEventHandler.onConnectedToServerEvent(networkManager);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class RecordingEventHandler {
|
|||||||
|
|
||||||
public void onPlayerJoin() {
|
public void onPlayerJoin() {
|
||||||
try {
|
try {
|
||||||
packetListener.save(new SPacketSpawnPlayer(mc.thePlayer));
|
packetListener.save(new SPacketSpawnPlayer(mc.player));
|
||||||
} catch(Exception e1) {
|
} catch(Exception e1) {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ public class RecordingEventHandler {
|
|||||||
|
|
||||||
public void onPlayerRespawn() {
|
public void onPlayerRespawn() {
|
||||||
try {
|
try {
|
||||||
packetListener.save(new SPacketSpawnPlayer(mc.thePlayer));
|
packetListener.save(new SPacketSpawnPlayer(mc.player));
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ public class RecordingEventHandler {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPlayerTick(PlayerTickEvent e) {
|
public void onPlayerTick(PlayerTickEvent e) {
|
||||||
try {
|
try {
|
||||||
if(e.player != mc.thePlayer) return;
|
if(e.player != mc.player) return;
|
||||||
|
|
||||||
boolean force = false;
|
boolean force = false;
|
||||||
if(lastX == null || lastY == null || lastZ == null) {
|
if(lastX == null || lastY == null || lastZ == null) {
|
||||||
@@ -168,62 +168,62 @@ public class RecordingEventHandler {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Inventory Handling
|
//Inventory Handling
|
||||||
if (playerItems[0] != mc.thePlayer.getHeldItem(EnumHand.MAIN_HAND)) {
|
if (playerItems[0] != mc.player.getHeldItem(EnumHand.MAIN_HAND)) {
|
||||||
playerItems[0] = mc.thePlayer.getHeldItem(EnumHand.MAIN_HAND);
|
playerItems[0] = mc.player.getHeldItem(EnumHand.MAIN_HAND);
|
||||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.MAINHAND, playerItems[0]));
|
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.MAINHAND, playerItems[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerItems[1] != mc.thePlayer.getHeldItem(EnumHand.OFF_HAND)) {
|
if (playerItems[1] != mc.player.getHeldItem(EnumHand.OFF_HAND)) {
|
||||||
playerItems[1] = mc.thePlayer.getHeldItem(EnumHand.OFF_HAND);
|
playerItems[1] = mc.player.getHeldItem(EnumHand.OFF_HAND);
|
||||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.OFFHAND, playerItems[1]));
|
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.OFFHAND, playerItems[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerItems[2] != mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.FEET)) {
|
if (playerItems[2] != mc.player.getItemStackFromSlot(EntityEquipmentSlot.FEET)) {
|
||||||
playerItems[2] = mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.FEET);
|
playerItems[2] = mc.player.getItemStackFromSlot(EntityEquipmentSlot.FEET);
|
||||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.FEET, playerItems[2]));
|
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.FEET, playerItems[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerItems[3] != mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.LEGS)) {
|
if (playerItems[3] != mc.player.getItemStackFromSlot(EntityEquipmentSlot.LEGS)) {
|
||||||
playerItems[3] = mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.LEGS);
|
playerItems[3] = mc.player.getItemStackFromSlot(EntityEquipmentSlot.LEGS);
|
||||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.LEGS, playerItems[3]));
|
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.LEGS, playerItems[3]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerItems[4] != mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.CHEST)) {
|
if (playerItems[4] != mc.player.getItemStackFromSlot(EntityEquipmentSlot.CHEST)) {
|
||||||
playerItems[4] = mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
playerItems[4] = mc.player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.CHEST, playerItems[4]));
|
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.CHEST, playerItems[4]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerItems[5] != mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.HEAD)) {
|
if (playerItems[5] != mc.player.getItemStackFromSlot(EntityEquipmentSlot.HEAD)) {
|
||||||
playerItems[5] = mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
playerItems[5] = mc.player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
||||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.HEAD, playerItems[5]));
|
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.HEAD, playerItems[5]));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Leaving Ride
|
//Leaving Ride
|
||||||
|
|
||||||
if((!mc.thePlayer.isRiding() && lastRiding != -1) ||
|
if((!mc.player.isRiding() && lastRiding != -1) ||
|
||||||
(mc.thePlayer.isRiding() && lastRiding != mc.thePlayer.getRidingEntity().getEntityId())) {
|
(mc.player.isRiding() && lastRiding != mc.player.getRidingEntity().getEntityId())) {
|
||||||
if(!mc.thePlayer.isRiding()) {
|
if(!mc.player.isRiding()) {
|
||||||
lastRiding = -1;
|
lastRiding = -1;
|
||||||
} else {
|
} else {
|
||||||
lastRiding = mc.thePlayer.getRidingEntity().getEntityId();
|
lastRiding = mc.player.getRidingEntity().getEntityId();
|
||||||
}
|
}
|
||||||
packetListener.save(new SPacketEntityAttach(e.player, e.player.getRidingEntity()));
|
packetListener.save(new SPacketEntityAttach(e.player, e.player.getRidingEntity()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sleeping
|
//Sleeping
|
||||||
if(!mc.thePlayer.isPlayerSleeping() && wasSleeping) {
|
if(!mc.player.isPlayerSleeping() && wasSleeping) {
|
||||||
packetListener.save(new SPacketAnimation(e.player, 2));
|
packetListener.save(new SPacketAnimation(e.player, 2));
|
||||||
wasSleeping = false;
|
wasSleeping = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Active hand (e.g. eating, drinking, blocking)
|
// Active hand (e.g. eating, drinking, blocking)
|
||||||
if (mc.thePlayer.isHandActive() ^ wasHandActive || mc.thePlayer.getActiveHand() != lastActiveHand) {
|
if (mc.player.isHandActive() ^ wasHandActive || mc.player.getActiveHand() != lastActiveHand) {
|
||||||
wasHandActive = mc.thePlayer.isHandActive();
|
wasHandActive = mc.player.isHandActive();
|
||||||
lastActiveHand = mc.thePlayer.getActiveHand();
|
lastActiveHand = mc.player.getActiveHand();
|
||||||
EntityDataManager dataManager = new EntityDataManager(null);
|
EntityDataManager dataManager = new EntityDataManager(null);
|
||||||
int state = (wasHandActive ? 1 : 0) | (lastActiveHand == EnumHand.OFF_HAND ? 2 : 0);
|
int state = (wasHandActive ? 1 : 0) | (lastActiveHand == EnumHand.OFF_HAND ? 2 : 0);
|
||||||
dataManager.register(EntityLiving.HAND_STATES, (byte) state);
|
dataManager.register(EntityLiving.HAND_STATES, (byte) state);
|
||||||
packetListener.save(new SPacketEntityMetadata(mc.thePlayer.getEntityId(), dataManager, true));
|
packetListener.save(new SPacketEntityMetadata(mc.player.getEntityId(), dataManager, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(Exception e1) {
|
} catch(Exception e1) {
|
||||||
@@ -244,7 +244,7 @@ public class RecordingEventHandler {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onSleep(PlayerSleepInBedEvent event) {
|
public void onSleep(PlayerSleepInBedEvent event) {
|
||||||
try {
|
try {
|
||||||
if (event.getEntityPlayer() != mc.thePlayer) {
|
if (event.getEntityPlayer() != mc.player) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +260,7 @@ public class RecordingEventHandler {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void enterMinecart(MinecartInteractEvent event) {
|
public void enterMinecart(MinecartInteractEvent event) {
|
||||||
try {
|
try {
|
||||||
if(event.getEntity() != mc.thePlayer) {
|
if(event.getEntity() != mc.player) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ public class RecordingEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onBlockBreakAnim(int breakerId, BlockPos pos, int progress) {
|
public void onBlockBreakAnim(int breakerId, BlockPos pos, int progress) {
|
||||||
EntityPlayer thePlayer = mc.thePlayer;
|
EntityPlayer thePlayer = mc.player;
|
||||||
if (thePlayer != null && breakerId == thePlayer.getEntityId()) {
|
if (thePlayer != null && breakerId == thePlayer.getEntityId()) {
|
||||||
packetListener.save(new SPacketBlockBreakAnim(breakerId, pos, progress));
|
packetListener.save(new SPacketBlockBreakAnim(breakerId, pos, progress));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,14 +37,14 @@ public abstract class MixinNetHandlerPlayClient {
|
|||||||
*/
|
*/
|
||||||
@Inject(method = "handlePlayerListItem", at=@At("HEAD"))
|
@Inject(method = "handlePlayerListItem", at=@At("HEAD"))
|
||||||
public void recordOwnJoin(SPacketPlayerListItem packet, CallbackInfo ci) {
|
public void recordOwnJoin(SPacketPlayerListItem packet, CallbackInfo ci) {
|
||||||
if (gameController.thePlayer == null) return;
|
if (gameController.player == null) return;
|
||||||
|
|
||||||
RecordingEventHandler handler = getRecordingEventHandler();
|
RecordingEventHandler handler = getRecordingEventHandler();
|
||||||
if (handler != null && packet.getAction() == SPacketPlayerListItem.Action.ADD_PLAYER) {
|
if (handler != null && packet.getAction() == SPacketPlayerListItem.Action.ADD_PLAYER) {
|
||||||
for (SPacketPlayerListItem.AddPlayerData data : packet.getEntries()) {
|
for (SPacketPlayerListItem.AddPlayerData data : packet.getEntries()) {
|
||||||
if (data.getProfile() == null || data.getProfile().getId() == null) continue;
|
if (data.getProfile() == null || data.getProfile().getId() == null) continue;
|
||||||
// Only add spawn packet for our own player and only if he isn't known yet
|
// Only add spawn packet for our own player and only if he isn't known yet
|
||||||
if (data.getProfile().getId().equals(Minecraft.getMinecraft().thePlayer.getGameProfile().getId())
|
if (data.getProfile().getId().equals(Minecraft.getMinecraft().player.getGameProfile().getId())
|
||||||
&& !playerInfoMap.containsKey(data.getProfile().getId())) {
|
&& !playerInfoMap.containsKey(data.getProfile().getId())) {
|
||||||
handler.onPlayerJoin();
|
handler.onPlayerJoin();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ public abstract class MixinPlayerControllerMP implements RecordingEventHandler.R
|
|||||||
@Redirect(method = "onPlayerDestroyBlock", at = @At(value = "INVOKE",
|
@Redirect(method = "onPlayerDestroyBlock", at = @At(value = "INVOKE",
|
||||||
target = "Lnet/minecraft/world/World;playEvent(ILnet/minecraft/util/math/BlockPos;I)V"))
|
target = "Lnet/minecraft/world/World;playEvent(ILnet/minecraft/util/math/BlockPos;I)V"))
|
||||||
public void replayModRecording_playEvent_fixed(World world, int type, BlockPos pos, int data) {
|
public void replayModRecording_playEvent_fixed(World world, int type, BlockPos pos, int data) {
|
||||||
world.playEvent(mc.thePlayer, type, pos, data);
|
world.playEvent(mc.player, type, pos, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
|
|||||||
@Inject(method = "playSound", at = @At("HEAD"))
|
@Inject(method = "playSound", at = @At("HEAD"))
|
||||||
public void replayModRecording_recordClientSound(EntityPlayer player, double x, double y, double z, SoundEvent sound, SoundCategory category,
|
public void replayModRecording_recordClientSound(EntityPlayer player, double x, double y, double z, SoundEvent sound, SoundCategory category,
|
||||||
float volume, float pitch, CallbackInfo ci) {
|
float volume, float pitch, CallbackInfo ci) {
|
||||||
if (player == mc.thePlayer) {
|
if (player == mc.player) {
|
||||||
RecordingEventHandler handler = replayModRecording_getRecordingEventHandler();
|
RecordingEventHandler handler = replayModRecording_getRecordingEventHandler();
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
handler.onClientSound(sound, category, x, y, z, volume, pitch);
|
handler.onClientSound(sound, category, x, y, z, volume, pitch);
|
||||||
@@ -50,7 +50,7 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
|
|||||||
// These are handled in the World class, so we override the method in WorldClient and add our special handling.
|
// These are handled in the World class, so we override the method in WorldClient and add our special handling.
|
||||||
@Override
|
@Override
|
||||||
public void playEvent(EntityPlayer player, int type, BlockPos pos, int data) {
|
public void playEvent(EntityPlayer player, int type, BlockPos pos, int data) {
|
||||||
if (player == mc.thePlayer) {
|
if (player == mc.player) {
|
||||||
// We caused this event, the server won't send it to us
|
// We caused this event, the server won't send it to us
|
||||||
RecordingEventHandler handler = replayModRecording_getRecordingEventHandler();
|
RecordingEventHandler handler = replayModRecording_getRecordingEventHandler();
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
|
|||||||
@@ -155,8 +155,8 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
|||||||
Packet packet = (Packet) msg;
|
Packet packet = (Packet) msg;
|
||||||
|
|
||||||
if(packet instanceof SPacketCollectItem) {
|
if(packet instanceof SPacketCollectItem) {
|
||||||
if(mc.thePlayer != null ||
|
if(mc.player != null ||
|
||||||
((SPacketCollectItem) packet).getEntityID() == mc.thePlayer.getEntityId()) {
|
((SPacketCollectItem) packet).getEntityID() == mc.player.getEntityId()) {
|
||||||
super.channelRead(ctx, msg);
|
super.channelRead(ctx, msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -228,7 +228,7 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
|||||||
}
|
}
|
||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
PacketBuffer packetBuffer = new PacketBuffer(byteBuf);
|
PacketBuffer packetBuffer = new PacketBuffer(byteBuf);
|
||||||
packetBuffer.writeVarIntToBuffer(packetId);
|
packetBuffer.writeVarInt(packetId);
|
||||||
packet.writePacketData(packetBuffer);
|
packet.writePacketData(packetBuffer);
|
||||||
|
|
||||||
byteBuf.readerIndex(0);
|
byteBuf.readerIndex(0);
|
||||||
|
|||||||
@@ -110,12 +110,12 @@ public class ReplayHandler {
|
|||||||
|
|
||||||
channel.close().awaitUninterruptibly();
|
channel.close().awaitUninterruptibly();
|
||||||
|
|
||||||
if (mc.thePlayer instanceof CameraEntity) {
|
if (mc.player instanceof CameraEntity) {
|
||||||
mc.thePlayer.setDead();
|
mc.player.setDead();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mc.theWorld != null) {
|
if (mc.world != null) {
|
||||||
mc.theWorld.sendQuittingDisconnectingPacket();
|
mc.world.sendQuittingDisconnectingPacket();
|
||||||
mc.loadWorld(null);
|
mc.loadWorld(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,9 +209,6 @@ public class ReplayHandler {
|
|||||||
*/
|
*/
|
||||||
public void spectateEntity(Entity e) {
|
public void spectateEntity(Entity e) {
|
||||||
CameraEntity cameraEntity = getCameraEntity();
|
CameraEntity cameraEntity = getCameraEntity();
|
||||||
if (cameraEntity == null) {
|
|
||||||
return; // Cannot spectate if we have no camera
|
|
||||||
}
|
|
||||||
if (e == null || e == cameraEntity) {
|
if (e == null || e == cameraEntity) {
|
||||||
spectating = null;
|
spectating = null;
|
||||||
e = cameraEntity;
|
e = cameraEntity;
|
||||||
@@ -244,7 +241,7 @@ public class ReplayHandler {
|
|||||||
* @return {@code true} if the camera is the view entity, {@code false} otherwise
|
* @return {@code true} if the camera is the view entity, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isCameraView() {
|
public boolean isCameraView() {
|
||||||
return mc.thePlayer instanceof CameraEntity && mc.thePlayer == mc.getRenderViewEntity();
|
return mc.player instanceof CameraEntity && mc.player == mc.getRenderViewEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -252,7 +249,7 @@ public class ReplayHandler {
|
|||||||
* @return The camera entity or {@code null} if it does not yet exist
|
* @return The camera entity or {@code null} if it does not yet exist
|
||||||
*/
|
*/
|
||||||
public CameraEntity getCameraEntity() {
|
public CameraEntity getCameraEntity() {
|
||||||
return mc.thePlayer instanceof CameraEntity ? (CameraEntity) mc.thePlayer : null;
|
return mc.player instanceof CameraEntity ? (CameraEntity) mc.player : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getSpectatedUUID() {
|
public UUID getSpectatedUUID() {
|
||||||
@@ -332,7 +329,7 @@ public class ReplayHandler {
|
|||||||
replaySender.setReplaySpeed(0);
|
replaySender.setReplaySpeed(0);
|
||||||
|
|
||||||
mc.getConnection().getNetworkManager().processReceivedPackets();
|
mc.getConnection().getNetworkManager().processReceivedPackets();
|
||||||
for (Entity entity : mc.theWorld.loadedEntityList) {
|
for (Entity entity : mc.world.loadedEntityList) {
|
||||||
if (entity instanceof EntityOtherPlayerMP) {
|
if (entity instanceof EntityOtherPlayerMP) {
|
||||||
EntityOtherPlayerMP e = (EntityOtherPlayerMP) entity;
|
EntityOtherPlayerMP e = (EntityOtherPlayerMP) entity;
|
||||||
e.setPosition(e.otherPlayerMPX, e.otherPlayerMPY, e.otherPlayerMPZ);
|
e.setPosition(e.otherPlayerMPX, e.otherPlayerMPY, e.otherPlayerMPZ);
|
||||||
|
|||||||
@@ -6,11 +6,7 @@ import com.google.common.util.concurrent.Futures;
|
|||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.replaymod.core.ReplayMod;
|
import com.replaymod.core.ReplayMod;
|
||||||
import com.replaymod.core.utils.ModCompat;
|
import com.replaymod.core.utils.ModCompat;
|
||||||
import com.replaymod.replay.camera.CameraController;
|
import com.replaymod.replay.camera.*;
|
||||||
import com.replaymod.replay.camera.CameraControllerRegistry;
|
|
||||||
import com.replaymod.replay.camera.CameraEntity;
|
|
||||||
import com.replaymod.replay.camera.ClassicCameraController;
|
|
||||||
import com.replaymod.replay.camera.VanillaCameraController;
|
|
||||||
import com.replaymod.replay.gui.overlay.GuiMarkerTimeline;
|
import com.replaymod.replay.gui.overlay.GuiMarkerTimeline;
|
||||||
import com.replaymod.replay.gui.screen.GuiModCompatWarning;
|
import com.replaymod.replay.gui.screen.GuiModCompatWarning;
|
||||||
import com.replaymod.replay.handler.GuiHandler;
|
import com.replaymod.replay.handler.GuiHandler;
|
||||||
@@ -103,7 +99,6 @@ public class ReplayModReplay {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(NoGuiScreenshot result) {
|
public void onSuccess(NoGuiScreenshot result) {
|
||||||
try {
|
try {
|
||||||
core.printInfoToChat("replaymod.chat.savingthumb");
|
|
||||||
replayHandler.getReplayFile().writeThumb(result.getImage());
|
replayHandler.getReplayFile().writeThumb(result.getImage());
|
||||||
core.printInfoToChat("replaymod.chat.savedthumb");
|
core.printInfoToChat("replaymod.chat.savedthumb");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -114,7 +109,6 @@ public class ReplayModReplay {
|
|||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable t) {
|
public void onFailure(Throwable t) {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
core.printWarningToChat("replaymod.chat.failedthumb");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,8 +257,8 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
// Entity#addedToChunk is not set and it is therefore not updated every tick.
|
// Entity#addedToChunk is not set and it is therefore not updated every tick.
|
||||||
// To counteract this, we need to manually update it's position if it hasn't been added
|
// To counteract this, we need to manually update it's position if it hasn't been added
|
||||||
// to any chunk yet.
|
// to any chunk yet.
|
||||||
if (mc.theWorld != null) {
|
if (mc.world != null) {
|
||||||
for (EntityPlayer playerEntity : mc.theWorld.playerEntities) {
|
for (EntityPlayer playerEntity : mc.world.playerEntities) {
|
||||||
if (!playerEntity.addedToChunk && playerEntity instanceof EntityOtherPlayerMP) {
|
if (!playerEntity.addedToChunk && playerEntity instanceof EntityOtherPlayerMP) {
|
||||||
playerEntity.onLivingUpdate();
|
playerEntity.onLivingUpdate();
|
||||||
}
|
}
|
||||||
@@ -292,7 +292,7 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
// If we do not give minecraft time to tick, there will be dead entity artifacts left in the world
|
// If we do not give minecraft time to tick, there will be dead entity artifacts left in the world
|
||||||
// Therefore we have to remove all loaded, dead entities manually if we are in sync mode.
|
// Therefore we have to remove all loaded, dead entities manually if we are in sync mode.
|
||||||
// We do this after every SpawnX packet and after the destroy entities packet.
|
// We do this after every SpawnX packet and after the destroy entities packet.
|
||||||
if (!asyncMode && mc.theWorld != null) {
|
if (!asyncMode && mc.world != null) {
|
||||||
if (p instanceof SPacketSpawnPlayer
|
if (p instanceof SPacketSpawnPlayer
|
||||||
|| p instanceof SPacketSpawnObject
|
|| p instanceof SPacketSpawnObject
|
||||||
|| p instanceof SPacketSpawnMob
|
|| p instanceof SPacketSpawnMob
|
||||||
@@ -300,7 +300,7 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
|| p instanceof SPacketSpawnPainting
|
|| p instanceof SPacketSpawnPainting
|
||||||
|| p instanceof SPacketSpawnExperienceOrb
|
|| p instanceof SPacketSpawnExperienceOrb
|
||||||
|| p instanceof SPacketDestroyEntities) {
|
|| p instanceof SPacketDestroyEntities) {
|
||||||
World world = mc.theWorld;
|
World world = mc.world;
|
||||||
for (int i = 0; i < world.loadedEntityList.size(); ++i) {
|
for (int i = 0; i < world.loadedEntityList.size(); ++i) {
|
||||||
Entity entity = world.loadedEntityList.get(i);
|
Entity entity = world.loadedEntityList.get(i);
|
||||||
if (entity.isDead) {
|
if (entity.isDead) {
|
||||||
@@ -331,7 +331,7 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
ByteBuf bb = Unpooled.wrappedBuffer(bytes);
|
ByteBuf bb = Unpooled.wrappedBuffer(bytes);
|
||||||
PacketBuffer pb = new PacketBuffer(bb);
|
PacketBuffer pb = new PacketBuffer(bb);
|
||||||
|
|
||||||
int i = pb.readVarIntFromBuffer();
|
int i = pb.readVarInt();
|
||||||
|
|
||||||
Packet p = EnumConnectionState.PLAY.getPacket(EnumPacketDirection.CLIENTBOUND, i);
|
Packet p = EnumConnectionState.PLAY.getPacket(EnumPacketDirection.CLIENTBOUND, i);
|
||||||
p.readPacketData(pb);
|
p.readPacketData(pb);
|
||||||
@@ -460,7 +460,7 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Void call() {
|
public Void call() {
|
||||||
if (mc.theWorld == null || !mc.isCallingFromMinecraftThread()) {
|
if (mc.world == null || !mc.isCallingFromMinecraftThread()) {
|
||||||
synchronized(mc.scheduledTasks) {
|
synchronized(mc.scheduledTasks) {
|
||||||
mc.scheduledTasks.add(ListenableFutureTask.create(this));
|
mc.scheduledTasks.add(ListenableFutureTask.create(this));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import java.util.function.Function;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The camera entity used as the main player entity during replay viewing.
|
* The camera entity used as the main player entity during replay viewing.
|
||||||
* During a replay {@link Minecraft#thePlayer} should be an instance of this class.
|
* During a replay {@link Minecraft#player} should be an instance of this class.
|
||||||
* Camera movement is controlled by a separate {@link CameraController}.
|
* Camera movement is controlled by a separate {@link CameraController}.
|
||||||
*/
|
*/
|
||||||
public class CameraEntity extends EntityPlayerSP {
|
public class CameraEntity extends EntityPlayerSP {
|
||||||
@@ -156,9 +156,9 @@ public class CameraEntity extends EntityPlayerSP {
|
|||||||
// entity is recreated and we have to spectate a new entity
|
// entity is recreated and we have to spectate a new entity
|
||||||
UUID spectating = ReplayModReplay.instance.getReplayHandler().getSpectatedUUID();
|
UUID spectating = ReplayModReplay.instance.getReplayHandler().getSpectatedUUID();
|
||||||
if (spectating != null && (view.getUniqueID() != spectating
|
if (spectating != null && (view.getUniqueID() != spectating
|
||||||
|| view.worldObj != worldObj)
|
|| view.world != world)
|
||||||
|| worldObj.getEntityByID(view.getEntityId()) != view) {
|
|| world.getEntityByID(view.getEntityId()) != view) {
|
||||||
view = worldObj.getPlayerEntityByUUID(spectating);
|
view = world.getPlayerEntityByUUID(spectating);
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
mc.setRenderViewEntity(view);
|
mc.setRenderViewEntity(view);
|
||||||
} else {
|
} else {
|
||||||
@@ -177,17 +177,17 @@ public class CameraEntity extends EntityPlayerSP {
|
|||||||
@Override
|
@Override
|
||||||
public void preparePlayerToSpawn() {
|
public void preparePlayerToSpawn() {
|
||||||
// Make sure our world is up-to-date in case of world changes
|
// Make sure our world is up-to-date in case of world changes
|
||||||
if (mc.theWorld != null) {
|
if (mc.world != null) {
|
||||||
worldObj = mc.theWorld;
|
world = mc.world;
|
||||||
}
|
}
|
||||||
super.preparePlayerToSpawn();
|
super.preparePlayerToSpawn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAngles(float yaw, float pitch) {
|
public void setRotation(float yaw, float pitch) {
|
||||||
if (mc.getRenderViewEntity() == this) {
|
if (mc.getRenderViewEntity() == this) {
|
||||||
// Only update camera rotation when the camera is the view
|
// Only update camera rotation when the camera is the view
|
||||||
super.setAngles(yaw, pitch);
|
super.setRotation(yaw, pitch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,8 +448,8 @@ public class CameraEntity extends EntityPlayerSP {
|
|||||||
mc.entityRenderer.itemRenderer.itemStackOffHand = player.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
mc.entityRenderer.itemRenderer.itemStackOffHand = player.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
||||||
|
|
||||||
|
|
||||||
mc.thePlayer.renderArmYaw = mc.thePlayer.prevRenderArmYaw = player.rotationYaw;
|
mc.player.renderArmYaw = mc.player.prevRenderArmYaw = player.rotationYaw;
|
||||||
mc.thePlayer.renderArmPitch = mc.thePlayer.prevRenderArmPitch = player.rotationPitch;
|
mc.player.renderArmPitch = mc.player.prevRenderArmPitch = player.rotationPitch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class GuiMarkerTimeline extends AbstractGuiTimeline<GuiMarkerTimeline> im
|
|||||||
|
|
||||||
protected void drawMarker(GuiRenderer renderer, ReadableDimension size, Marker marker) {
|
protected void drawMarker(GuiRenderer renderer, ReadableDimension size, Marker marker) {
|
||||||
int visibleLength = (int) (getLength() * getZoom());
|
int visibleLength = (int) (getLength() * getZoom());
|
||||||
int markerPos = MathHelper.clamp_int(marker.getTime(), getOffset(), getOffset() + visibleLength);
|
int markerPos = MathHelper.clamp(marker.getTime(), getOffset(), getOffset() + visibleLength);
|
||||||
double positionInVisible = markerPos - getOffset();
|
double positionInVisible = markerPos - getOffset();
|
||||||
double fractionOfVisible = positionInVisible / visibleLength;
|
double fractionOfVisible = positionInVisible / visibleLength;
|
||||||
int markerX = (int) (BORDER_LEFT + fractionOfVisible * (size.getWidth() - BORDER_LEFT - BORDER_RIGHT));
|
int markerX = (int) (BORDER_LEFT + fractionOfVisible * (size.getWidth() - BORDER_LEFT - BORDER_RIGHT));
|
||||||
@@ -99,7 +99,7 @@ public class GuiMarkerTimeline extends AbstractGuiTimeline<GuiMarkerTimeline> im
|
|||||||
int visibleLength = (int) (getLength() * getZoom());
|
int visibleLength = (int) (getLength() * getZoom());
|
||||||
int contentWidth = lastSize.getWidth() - BORDER_LEFT - BORDER_RIGHT;
|
int contentWidth = lastSize.getWidth() - BORDER_LEFT - BORDER_RIGHT;
|
||||||
for (Marker marker : replayHandler.getMarkers()) {
|
for (Marker marker : replayHandler.getMarkers()) {
|
||||||
int markerPos = MathHelper.clamp_int(marker.getTime(), getOffset(), getOffset() + visibleLength);
|
int markerPos = MathHelper.clamp(marker.getTime(), getOffset(), getOffset() + visibleLength);
|
||||||
double positionInVisible = markerPos - getOffset();
|
double positionInVisible = markerPos - getOffset();
|
||||||
double fractionOfVisible = positionInVisible / visibleLength;
|
double fractionOfVisible = positionInVisible / visibleLength;
|
||||||
int markerX = (int) (BORDER_LEFT + fractionOfVisible * contentWidth);
|
int markerX = (int) (BORDER_LEFT + fractionOfVisible * contentWidth);
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class GuiHandler {
|
public class GuiHandler {
|
||||||
private static final int BUTTON_EXIT_SERVER = 1;
|
private static final int BUTTON_EXIT_SERVER = 1;
|
||||||
|
private static final int BUTTON_RETURN_TO_GAME = 4;
|
||||||
private static final int BUTTON_ACHIEVEMENTS = 5;
|
private static final int BUTTON_ACHIEVEMENTS = 5;
|
||||||
private static final int BUTTON_STATS = 6;
|
private static final int BUTTON_STATS = 6;
|
||||||
private static final int BUTTON_OPEN_TO_LAN = 7;
|
private static final int BUTTON_OPEN_TO_LAN = 7;
|
||||||
@@ -46,9 +46,7 @@ public class GuiHandler {
|
|||||||
// Pause replay when menu is opened
|
// Pause replay when menu is opened
|
||||||
mod.getReplayHandler().getReplaySender().setReplaySpeed(0);
|
mod.getReplayHandler().getReplaySender().setReplaySpeed(0);
|
||||||
|
|
||||||
GuiButton achievements = null, stats = null, openToLan = null;
|
for(GuiButton b : new ArrayList<>(event.getButtonList())) {
|
||||||
List<GuiButton> buttonList = event.getButtonList();
|
|
||||||
for(GuiButton b : new ArrayList<>(buttonList)) {
|
|
||||||
switch (b.id) {
|
switch (b.id) {
|
||||||
// Replace "Exit Server" button with "Exit Replay" button
|
// Replace "Exit Server" button with "Exit Replay" button
|
||||||
case BUTTON_EXIT_SERVER:
|
case BUTTON_EXIT_SERVER:
|
||||||
@@ -57,38 +55,14 @@ public class GuiHandler {
|
|||||||
break;
|
break;
|
||||||
// Remove "Achievements", "Stats" and "Open to LAN" buttons
|
// Remove "Achievements", "Stats" and "Open to LAN" buttons
|
||||||
case BUTTON_ACHIEVEMENTS:
|
case BUTTON_ACHIEVEMENTS:
|
||||||
buttonList.remove(achievements = b);
|
|
||||||
break;
|
|
||||||
case BUTTON_STATS:
|
case BUTTON_STATS:
|
||||||
buttonList.remove(stats = b);
|
|
||||||
break;
|
|
||||||
case BUTTON_OPEN_TO_LAN:
|
case BUTTON_OPEN_TO_LAN:
|
||||||
buttonList.remove(openToLan = b);
|
event.getButtonList().remove(b);
|
||||||
break;
|
}
|
||||||
|
// Move all buttons except the "Return to game" button upwards
|
||||||
|
if (b.id != BUTTON_RETURN_TO_GAME) {
|
||||||
|
b.yPosition -= 48;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (achievements != null && stats != null) {
|
|
||||||
moveAllButtonsDirectlyBelowUpwards(buttonList, achievements.yPosition,
|
|
||||||
achievements.xPosition, stats.xPosition + stats.width);
|
|
||||||
}
|
|
||||||
if (openToLan != null) {
|
|
||||||
moveAllButtonsDirectlyBelowUpwards(buttonList, openToLan.yPosition,
|
|
||||||
openToLan.xPosition, openToLan.xPosition + openToLan.width);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Moves all buttons that are within a rectangle below a certain y coordinate upwards by 24 units.
|
|
||||||
* @param buttons List of buttons
|
|
||||||
* @param belowY The Y limit
|
|
||||||
* @param xStart Left x limit of the rectangle
|
|
||||||
* @param xEnd Right x limit of the rectangle
|
|
||||||
*/
|
|
||||||
private void moveAllButtonsDirectlyBelowUpwards(List<GuiButton> buttons, int belowY, int xStart, int xEnd) {
|
|
||||||
for (GuiButton button : buttons) {
|
|
||||||
if (button.yPosition >= belowY && button.xPosition <= xEnd && button.xPosition + button.width >= xStart) {
|
|
||||||
button.yPosition -= 24;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public abstract class MixinGuiSpectator {
|
|||||||
@Inject(method = "onHotbarSelected", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "onHotbarSelected", at = @At("HEAD"), cancellable = true)
|
||||||
public void isInReplay(int i, CallbackInfo ci) {
|
public void isInReplay(int i, CallbackInfo ci) {
|
||||||
// Prevent spectator gui from opening while in a replay
|
// Prevent spectator gui from opening while in a replay
|
||||||
if (mc.thePlayer instanceof CameraEntity) {
|
if (mc.player instanceof CameraEntity) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ public abstract class MixinPlayerControllerMP {
|
|||||||
|
|
||||||
@Inject(method = "isSpectator", at=@At("HEAD"), cancellable = true)
|
@Inject(method = "isSpectator", at=@At("HEAD"), cancellable = true)
|
||||||
private void replayModReplay_isSpectator(CallbackInfoReturnable<Boolean> ci) {
|
private void replayModReplay_isSpectator(CallbackInfoReturnable<Boolean> ci) {
|
||||||
if (mc.thePlayer instanceof CameraEntity) { // this check should in theory not be required
|
if (mc.player instanceof CameraEntity) { // this check should in theory not be required
|
||||||
ci.setReturnValue(mc.thePlayer.isSpectator());
|
ci.setReturnValue(mc.player.isSpectator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||||||
public abstract class MixinRenderArmorStand {
|
public abstract class MixinRenderArmorStand {
|
||||||
@Inject(method = "canRenderName", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "canRenderName", at = @At("HEAD"), cancellable = true)
|
||||||
private void replayModReplay_canRenderInvisibleName(EntityArmorStand entity, CallbackInfoReturnable<Boolean> ci) {
|
private void replayModReplay_canRenderInvisibleName(EntityArmorStand entity, CallbackInfoReturnable<Boolean> ci) {
|
||||||
EntityPlayer thePlayer = Minecraft.getMinecraft().thePlayer;
|
EntityPlayer thePlayer = Minecraft.getMinecraft().player;
|
||||||
if (thePlayer instanceof CameraEntity && entity.isInvisible()) {
|
if (thePlayer instanceof CameraEntity && entity.isInvisible()) {
|
||||||
ci.setReturnValue(false);
|
ci.setReturnValue(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||||||
public abstract class MixinRenderLivingBase {
|
public abstract class MixinRenderLivingBase {
|
||||||
@Inject(method = "canRenderName", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "canRenderName", at = @At("HEAD"), cancellable = true)
|
||||||
private void replayModReplay_canRenderInvisibleName(EntityLivingBase entity, CallbackInfoReturnable<Boolean> ci) {
|
private void replayModReplay_canRenderInvisibleName(EntityLivingBase entity, CallbackInfoReturnable<Boolean> ci) {
|
||||||
EntityPlayer thePlayer = Minecraft.getMinecraft().thePlayer;
|
EntityPlayer thePlayer = Minecraft.getMinecraft().player;
|
||||||
if (thePlayer instanceof CameraEntity && entity.isInvisible()) {
|
if (thePlayer instanceof CameraEntity && entity.isInvisible()) {
|
||||||
ci.setReturnValue(false);
|
ci.setReturnValue(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public abstract class MixinViewFrustum {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = MathHelper.floor_double(viewEntityX) - 8;
|
int i = MathHelper.floor(viewEntityX) - 8;
|
||||||
int j = MathHelper.floor_double(viewEntityZ) - 8;
|
int j = MathHelper.floor(viewEntityZ) - 8;
|
||||||
int k = this.countChunksX * 16;
|
int k = this.countChunksX * 16;
|
||||||
|
|
||||||
for (int l = 0; l < this.countChunksX; ++l) {
|
for (int l = 0; l < this.countChunksX; ++l) {
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import net.minecraftforge.fml.common.Mod;
|
|||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.lwjgl.input.Keyboard;
|
|
||||||
|
|
||||||
@Mod(modid = ReplayModSimplePathing.MOD_ID,
|
@Mod(modid = ReplayModSimplePathing.MOD_ID,
|
||||||
version = "@MOD_VERSION@",
|
version = "@MOD_VERSION@",
|
||||||
@@ -23,9 +22,6 @@ import org.lwjgl.input.Keyboard;
|
|||||||
public class ReplayModSimplePathing {
|
public class ReplayModSimplePathing {
|
||||||
public static final String MOD_ID = "replaymod-simplepathing";
|
public static final String MOD_ID = "replaymod-simplepathing";
|
||||||
|
|
||||||
@Mod.Instance(MOD_ID)
|
|
||||||
public static ReplayModSimplePathing instance;
|
|
||||||
|
|
||||||
private ReplayMod core;
|
private ReplayMod core;
|
||||||
|
|
||||||
public static Logger LOGGER;
|
public static Logger LOGGER;
|
||||||
@@ -43,24 +39,11 @@ public class ReplayModSimplePathing {
|
|||||||
|
|
||||||
PathPreview pathPreview = new PathPreview(this);
|
PathPreview pathPreview = new PathPreview(this);
|
||||||
pathPreview.register();
|
pathPreview.register();
|
||||||
|
|
||||||
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.keyframerepository", Keyboard.KEY_X, () -> {
|
|
||||||
if (guiPathing != null) guiPathing.keyframeRepoButtonPressed();
|
|
||||||
});
|
|
||||||
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.clearkeyframes", Keyboard.KEY_C, () -> {
|
|
||||||
if (guiPathing != null) guiPathing.clearKeyframesButtonPressed();
|
|
||||||
});
|
|
||||||
core.getKeyBindingRegistry().registerRepeatedKeyBinding("replaymod.input.synctimeline", Keyboard.KEY_V, () -> {
|
|
||||||
if (guiPathing != null) guiPathing.syncTimeButtonPressed();
|
|
||||||
});
|
|
||||||
core.getKeyBindingRegistry().registerRaw(Keyboard.KEY_DELETE, () -> {
|
|
||||||
if (guiPathing != null) guiPathing.deleteButtonPressed();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void postReplayOpen(ReplayOpenEvent.Post event) {
|
public void postReplayOpen(ReplayOpenEvent.Post event) {
|
||||||
clearCurrentTimeline();
|
currentTimeline = new SPTimeline();
|
||||||
guiPathing = new GuiPathing(core, this, event.getReplayHandler());
|
guiPathing = new GuiPathing(core, this, event.getReplayHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,11 +82,11 @@ public class ReplayModSimplePathing {
|
|||||||
public void setCurrentTimeline(SPTimeline newTimeline) {
|
public void setCurrentTimeline(SPTimeline newTimeline) {
|
||||||
selectedPath = null;
|
selectedPath = null;
|
||||||
currentTimeline = newTimeline;
|
currentTimeline = newTimeline;
|
||||||
updateDefaultInterpolatorType();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearCurrentTimeline() {
|
public void clearCurrentTimeline() {
|
||||||
setCurrentTimeline(new SPTimeline());
|
setCurrentTimeline(new SPTimeline());
|
||||||
|
updateDefaultInterpolatorType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SPTimeline getCurrentTimeline() {
|
public SPTimeline getCurrentTimeline() {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class SPTimeline implements PathingRegistry {
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private EntityPositionTracker entityTracker;
|
private EntityPositionTracker entityTracker;
|
||||||
private InterpolatorType defaultInterpolatorType;
|
private InterpolatorType defaultInterpolatorType = InterpolatorType.fromString("invalid string returns default");
|
||||||
|
|
||||||
public SPTimeline() {
|
public SPTimeline() {
|
||||||
this(createInitialTimeline());
|
this(createInitialTimeline());
|
||||||
@@ -340,15 +340,13 @@ public class SPTimeline implements PathingRegistry {
|
|||||||
Optional<Interpolator> firstInterpolator =
|
Optional<Interpolator> firstInterpolator =
|
||||||
path.getSegments().stream().findFirst().map(PathSegment::getInterpolator);
|
path.getSegments().stream().findFirst().map(PathSegment::getInterpolator);
|
||||||
|
|
||||||
// The interpolator that will be lost once we remove the old keyframe and has to be restored afterwards
|
// The interpolator of the previous segment
|
||||||
Optional<Interpolator> lostInterpolator = path.getSegments().stream().filter(s -> {
|
Optional<Interpolator> interpolatorBefore =
|
||||||
// If this is the last keyframe,
|
path.getSegments().stream().filter(s -> s.getEndKeyframe() == keyframe).findFirst().map(PathSegment::getInterpolator);
|
||||||
if (Iterables.getLast(path.getKeyframes()) == keyframe) {
|
|
||||||
return s.getEndKeyframe() == keyframe; // the previous interpolator will be lost
|
// The interpolator of the following segment
|
||||||
} else { // otherwise
|
Optional<Interpolator> interpolatorAfter =
|
||||||
return s.getStartKeyframe() == keyframe; // the following interpolator will be lost
|
path.getSegments().stream().filter(s -> s.getStartKeyframe() == keyframe).findFirst().map(PathSegment::getInterpolator);
|
||||||
}
|
|
||||||
}).findFirst().map(PathSegment::getInterpolator);
|
|
||||||
|
|
||||||
// First remove the old keyframe
|
// First remove the old keyframe
|
||||||
Change removeChange = create(path, keyframe);
|
Change removeChange = create(path, keyframe);
|
||||||
@@ -371,27 +369,18 @@ public class SPTimeline implements PathingRegistry {
|
|||||||
Keyframe newKf = path.getKeyframe(newTime);
|
Keyframe newKf = path.getKeyframe(newTime);
|
||||||
if (Iterables.getLast(path.getKeyframes()) != newKf) { // Unless this is the last keyframe
|
if (Iterables.getLast(path.getKeyframes()) != newKf) { // Unless this is the last keyframe
|
||||||
// the interpolator of the following segment has been lost and needs to be restored
|
// the interpolator of the following segment has been lost and needs to be restored
|
||||||
restoreInterpolatorChange = lostInterpolator.<Change>flatMap(interpolator ->
|
restoreInterpolatorChange = interpolatorAfter.<Change>flatMap(interpolator ->
|
||||||
path.getSegments().stream().filter(s -> s.getStartKeyframe() == newKf).findFirst().map(segment ->
|
path.getSegments().stream().filter(s -> s.getStartKeyframe() == newKf).findFirst().map(segment ->
|
||||||
SetInterpolator.create(segment, interpolator)
|
SetInterpolator.create(segment, interpolator)
|
||||||
)
|
)
|
||||||
).orElseGet(CombinedChange::create);
|
).orElseGet(CombinedChange::create);
|
||||||
} else { // If it is the last keyframe however,
|
} else { // If it is the last keyframe however,
|
||||||
// the interpolator of the previous segment has been lost and needs to be restored
|
// the interpolator of the previous segment has been lost and needs to be restored
|
||||||
restoreInterpolatorChange = path.getSegments().stream().filter(s -> s.getEndKeyframe() == newKf)
|
restoreInterpolatorChange = interpolatorBefore.<Change>flatMap(interpolator ->
|
||||||
.findFirst().flatMap(segment -> lostInterpolator.map(interpolator -> {
|
path.getSegments().stream().filter(s -> s.getEndKeyframe() == newKf).findFirst().map(segment ->
|
||||||
// additionally, if the interpolation of this keyframe was set to explicit, that property
|
SetInterpolator.create(segment, interpolator)
|
||||||
// has to be transferred to the start keyframe of the new segment
|
)
|
||||||
if (newKf.getValue(ExplicitInterpolationProperty.PROPERTY).isPresent()) {
|
).orElseGet(CombinedChange::create);
|
||||||
return CombinedChange.create(
|
|
||||||
SetInterpolator.create(segment, interpolator),
|
|
||||||
UpdateKeyframeProperties.create(path, segment.getStartKeyframe())
|
|
||||||
.setValue(ExplicitInterpolationProperty.PROPERTY, ObjectUtils.NULL).done()
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return SetInterpolator.create(segment, interpolator);
|
|
||||||
}
|
|
||||||
})).orElseGet(CombinedChange::create);
|
|
||||||
}
|
}
|
||||||
restoreInterpolatorChange.apply(timeline);
|
restoreInterpolatorChange.apply(timeline);
|
||||||
|
|
||||||
|
|||||||
@@ -109,9 +109,6 @@ public abstract class GuiEditKeyframe<T extends GuiEditKeyframe<T>> extends Abst
|
|||||||
if (newTime != time) {
|
if (newTime != time) {
|
||||||
change = CombinedChange.createFromApplied(change,
|
change = CombinedChange.createFromApplied(change,
|
||||||
gui.getMod().getCurrentTimeline().moveKeyframe(path, time, newTime));
|
gui.getMod().getCurrentTimeline().moveKeyframe(path, time, newTime));
|
||||||
if (gui.getMod().getSelectedPath() == path && gui.getMod().getSelectedTime() == time) {
|
|
||||||
gui.getMod().setSelected(path, newTime);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
gui.getMod().getCurrentTimeline().getTimeline().pushChange(change);
|
gui.getMod().getCurrentTimeline().getTimeline().pushChange(change);
|
||||||
close();
|
close();
|
||||||
@@ -255,10 +252,6 @@ public abstract class GuiEditKeyframe<T extends GuiEditKeyframe<T>> extends Abst
|
|||||||
xField.getDouble(), yField.getDouble(), zField.getDouble(),
|
xField.getDouble(), yField.getDouble(), zField.getDouble(),
|
||||||
yawField.getFloat(), pitchField.getFloat(), rollField.getFloat()
|
yawField.getFloat(), pitchField.getFloat(), rollField.getFloat()
|
||||||
);
|
);
|
||||||
if (interpolationPanel.getSettingsPanel() == null) {
|
|
||||||
// The last keyframe doesn't have interpolator settings because there is no segment following it
|
|
||||||
return positionChange;
|
|
||||||
}
|
|
||||||
Interpolator interpolator = interpolationPanel.getSettingsPanel().createInterpolator();
|
Interpolator interpolator = interpolationPanel.getSettingsPanel().createInterpolator();
|
||||||
if (interpolationPanel.getInterpolatorType() == InterpolatorType.DEFAULT) {
|
if (interpolationPanel.getInterpolatorType() == InterpolatorType.DEFAULT) {
|
||||||
return CombinedChange.createFromApplied(positionChange, timeline.setInterpolatorToDefault(time),
|
return CombinedChange.createFromApplied(positionChange, timeline.setInterpolatorToDefault(time),
|
||||||
@@ -310,7 +303,6 @@ public abstract class GuiEditKeyframe<T extends GuiEditKeyframe<T>> extends Abst
|
|||||||
dropdown.setSelected(type); // trigger the callback once to display settings panel
|
dropdown.setSelected(type); // trigger the callback once to display settings panel
|
||||||
} else {
|
} else {
|
||||||
setSettingsPanel(InterpolatorType.DEFAULT);
|
setSettingsPanel(InterpolatorType.DEFAULT);
|
||||||
type = InterpolatorType.DEFAULT;
|
|
||||||
}
|
}
|
||||||
if (getInterpolatorTypeNoDefault(type).getInterpolatorClass().isInstance(interpolator)) {
|
if (getInterpolatorTypeNoDefault(type).getInterpolatorClass().isInstance(interpolator)) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
package com.replaymod.simplepathing.gui;
|
package com.replaymod.simplepathing.gui;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import com.google.common.util.concurrent.Futures;
|
import com.google.common.util.concurrent.Futures;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.SettableFuture;
|
import com.google.common.util.concurrent.SettableFuture;
|
||||||
import com.replaymod.core.ReplayMod;
|
import com.replaymod.core.ReplayMod;
|
||||||
import com.replaymod.core.utils.Utils;
|
|
||||||
import com.replaymod.pathing.gui.GuiKeyframeRepository;
|
import com.replaymod.pathing.gui.GuiKeyframeRepository;
|
||||||
import com.replaymod.pathing.player.RealtimeTimelinePlayer;
|
import com.replaymod.pathing.player.RealtimeTimelinePlayer;
|
||||||
import com.replaymod.pathing.properties.CameraProperties;
|
import com.replaymod.pathing.properties.CameraProperties;
|
||||||
@@ -257,7 +255,6 @@ public class GuiPathing {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final ReplayMod core;
|
|
||||||
private final ReplayModSimplePathing mod;
|
private final ReplayModSimplePathing mod;
|
||||||
private final ReplayHandler replayHandler;
|
private final ReplayHandler replayHandler;
|
||||||
private final RealtimeTimelinePlayer player;
|
private final RealtimeTimelinePlayer player;
|
||||||
@@ -267,7 +264,6 @@ public class GuiPathing {
|
|||||||
private SettableFuture<Void> entityTrackerFuture;
|
private SettableFuture<Void> entityTrackerFuture;
|
||||||
|
|
||||||
public GuiPathing(final ReplayMod core, final ReplayModSimplePathing mod, final ReplayHandler replayHandler) {
|
public GuiPathing(final ReplayMod core, final ReplayModSimplePathing mod, final ReplayHandler replayHandler) {
|
||||||
this.core = core;
|
|
||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
this.replayHandler = replayHandler;
|
this.replayHandler = replayHandler;
|
||||||
this.player = new RealtimeTimelinePlayer(replayHandler);
|
this.player = new RealtimeTimelinePlayer(replayHandler);
|
||||||
@@ -304,15 +300,9 @@ public class GuiPathing {
|
|||||||
ListenableFuture<Void> future = player.start(mod.getCurrentTimeline().getTimeline(), startTime);
|
ListenableFuture<Void> future = player.start(mod.getCurrentTimeline().getTimeline(), startTime);
|
||||||
overlay.setCloseable(false);
|
overlay.setCloseable(false);
|
||||||
overlay.setMouseVisible(true);
|
overlay.setMouseVisible(true);
|
||||||
core.printInfoToChat("replaymod.chat.pathstarted");
|
|
||||||
Futures.addCallback(future, new FutureCallback<Void>() {
|
Futures.addCallback(future, new FutureCallback<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(@Nullable Void result) {
|
public void onSuccess(@Nullable Void result) {
|
||||||
if (future.isCancelled()) {
|
|
||||||
core.printInfoToChat("replaymod.chat.pathinterrupted");
|
|
||||||
} else {
|
|
||||||
core.printInfoToChat("replaymod.chat.pathfinished");
|
|
||||||
}
|
|
||||||
overlay.setCloseable(true);
|
overlay.setCloseable(true);
|
||||||
timePath.setActive(true);
|
timePath.setActive(true);
|
||||||
}
|
}
|
||||||
@@ -403,90 +393,94 @@ public class GuiPathing {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
startLoadingEntityTracker();
|
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.keyframerepository", Keyboard.KEY_X, new Runnable() {
|
||||||
}
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (!overlay.isVisible()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
GuiKeyframeRepository gui = new GuiKeyframeRepository(
|
||||||
|
mod.getCurrentTimeline(), replayHandler.getReplayFile(), mod.getCurrentTimeline().getTimeline());
|
||||||
|
Futures.addCallback(gui.getFuture(), new FutureCallback<Timeline>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Timeline result) {
|
||||||
|
if (result != null) {
|
||||||
|
mod.setCurrentTimeline(new SPTimeline(result));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void keyframeRepoButtonPressed() {
|
@Override
|
||||||
try {
|
public void onFailure(Throwable t) {
|
||||||
GuiKeyframeRepository gui = new GuiKeyframeRepository(
|
t.printStackTrace();
|
||||||
mod.getCurrentTimeline(), replayHandler.getReplayFile(), mod.getCurrentTimeline().getTimeline());
|
core.printWarningToChat("Error loading timeline: " + t.getMessage());
|
||||||
Futures.addCallback(gui.getFuture(), new FutureCallback<Timeline>() {
|
}
|
||||||
|
});
|
||||||
|
gui.display();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
core.printWarningToChat("Error loading timeline: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.clearkeyframes", Keyboard.KEY_C, () -> {
|
||||||
|
GuiYesNoPopup popup = GuiYesNoPopup.open(overlay,
|
||||||
|
new GuiLabel().setI18nText("replaymod.gui.clearcallback.title").setColor(Colors.BLACK)
|
||||||
|
).setYesI18nLabel("gui.yes").setNoI18nLabel("gui.no");
|
||||||
|
Futures.addCallback(popup.getFuture(), new FutureCallback<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Timeline result) {
|
public void onSuccess(Boolean delete) {
|
||||||
if (result != null) {
|
if (delete) {
|
||||||
mod.setCurrentTimeline(new SPTimeline(result));
|
mod.clearCurrentTimeline();
|
||||||
|
if (entityTracker != null) {
|
||||||
|
mod.getCurrentTimeline().setEntityTracker(entityTracker);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable t) {
|
public void onFailure(Throwable t) {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
core.printWarningToChat("Error loading timeline: " + t.getMessage());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
gui.display();
|
});
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
core.printWarningToChat("Error loading timeline: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearKeyframesButtonPressed() {
|
core.getKeyBindingRegistry().registerRepeatedKeyBinding("replaymod.input.synctimeline", Keyboard.KEY_V, () -> {
|
||||||
GuiYesNoPopup popup = GuiYesNoPopup.open(replayHandler.getOverlay(),
|
// Current replay time
|
||||||
new GuiLabel().setI18nText("replaymod.gui.clearcallback.title").setColor(Colors.BLACK)
|
int time = replayHandler.getReplaySender().currentTimeStamp();
|
||||||
).setYesI18nLabel("gui.yes").setNoI18nLabel("gui.no");
|
// Position of the cursor
|
||||||
Futures.addCallback(popup.getFuture(), new FutureCallback<Boolean>() {
|
int cursor = timeline.getCursorPosition();
|
||||||
@Override
|
// Get the last time keyframe before the cursor
|
||||||
public void onSuccess(Boolean delete) {
|
mod.getCurrentTimeline().getTimePath().getKeyframes().stream()
|
||||||
if (delete) {
|
.filter(it -> it.getTime() <= cursor).reduce((__, last) -> last).ifPresent(keyframe -> {
|
||||||
mod.clearCurrentTimeline();
|
// Cursor position at the keyframe
|
||||||
if (entityTracker != null) {
|
int keyframeCursor = (int) keyframe.getTime();
|
||||||
mod.getCurrentTimeline().setEntityTracker(entityTracker);
|
// Replay time at the keyframe
|
||||||
}
|
// This is a keyframe from the time path, so it _should_ always have a time property
|
||||||
}
|
int keyframeTime = keyframe.getValue(TimestampProperty.PROPERTY).get();
|
||||||
|
// Replay time passed
|
||||||
|
int timePassed = time - keyframeTime;
|
||||||
|
// Speed (set to 1 when shift is held)
|
||||||
|
double speed = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 1 : overlay.getSpeedSliderValue();
|
||||||
|
// Cursor time passed
|
||||||
|
int cursorPassed = (int) (timePassed / speed);
|
||||||
|
// Move cursor to new position
|
||||||
|
timeline.setCursorPosition(keyframeCursor + cursorPassed);
|
||||||
|
// Deselect keyframe to allow the user to add a new one right away
|
||||||
|
mod.setSelected(null, 0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
core.getKeyBindingRegistry().registerRaw(Keyboard.KEY_DELETE, () -> {
|
||||||
|
if (!overlay.isVisible()) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
if (mod.getSelectedPath() != null) {
|
||||||
@Override
|
updateKeyframe(mod.getSelectedPath());
|
||||||
public void onFailure(Throwable t) {
|
|
||||||
t.printStackTrace();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
public void syncTimeButtonPressed() {
|
|
||||||
// Current replay time
|
|
||||||
int time = replayHandler.getReplaySender().currentTimeStamp();
|
|
||||||
// Position of the cursor
|
|
||||||
int cursor = timeline.getCursorPosition();
|
|
||||||
// Get the last time keyframe before the cursor
|
|
||||||
mod.getCurrentTimeline().getTimePath().getKeyframes().stream()
|
|
||||||
.filter(it -> it.getTime() <= cursor).reduce((__, last) -> last).ifPresent(keyframe -> {
|
|
||||||
// Cursor position at the keyframe
|
|
||||||
int keyframeCursor = (int) keyframe.getTime();
|
|
||||||
// Replay time at the keyframe
|
|
||||||
// This is a keyframe from the time path, so it _should_ always have a time property
|
|
||||||
int keyframeTime = keyframe.getValue(TimestampProperty.PROPERTY).get();
|
|
||||||
// Replay time passed
|
|
||||||
int timePassed = time - keyframeTime;
|
|
||||||
// Speed (set to 1 when shift is held)
|
|
||||||
double speed = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 1 : replayHandler.getOverlay().getSpeedSliderValue();
|
|
||||||
// Cursor time passed
|
|
||||||
int cursorPassed = (int) (timePassed / speed);
|
|
||||||
// Move cursor to new position
|
|
||||||
timeline.setCursorPosition(keyframeCursor + cursorPassed);
|
|
||||||
// Deselect keyframe to allow the user to add a new one right away
|
|
||||||
mod.setSelected(null, 0);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteButtonPressed() {
|
|
||||||
if (mod.getSelectedPath() != null) {
|
|
||||||
updateKeyframe(mod.getSelectedPath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startLoadingEntityTracker() {
|
|
||||||
Preconditions.checkState(entityTrackerFuture == null);
|
|
||||||
// Start loading entity tracker
|
// Start loading entity tracker
|
||||||
entityTrackerFuture = SettableFuture.create();
|
entityTrackerFuture = SettableFuture.create();
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
@@ -499,13 +493,12 @@ public class GuiPathing {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
logger.info("Loaded entity tracker in " + (System.currentTimeMillis() - start) + "ms");
|
logger.info("Loaded entity tracker in " + (System.currentTimeMillis() - start) + "ms");
|
||||||
} catch (Throwable e) {
|
} catch (IOException e) {
|
||||||
logger.error("Loading entity tracker:", e);
|
logger.error("Loading entity tracker:", e);
|
||||||
mod.getCore().runLater(() -> {
|
mod.getCore().runLater(() -> {
|
||||||
mod.getCore().printWarningToChat("Error loading entity tracker: %s", e.getLocalizedMessage());
|
mod.getCore().printWarningToChat("Error loading entity tracker: %s", e.getLocalizedMessage());
|
||||||
entityTrackerFuture.setException(e);
|
entityTrackerFuture.setException(e);
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
entityTracker = tracker;
|
entityTracker = tracker;
|
||||||
mod.getCore().runLater(() -> {
|
mod.getCore().runLater(() -> {
|
||||||
@@ -564,9 +557,7 @@ public class GuiPathing {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@Nonnull Throwable t) {
|
public void onFailure(@Nonnull Throwable t) {
|
||||||
String message = "Failed to load entity tracker, pathing will be unavailable.";
|
popup.close();
|
||||||
GuiReplayOverlay overlay = replayHandler.getOverlay();
|
|
||||||
Utils.error(LOGGER, overlay, CrashReport.makeCrashReport(t, message), popup::close);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Submodule src/main/resources/assets/replaymod/lang deleted from da6f6f8d12
539
src/main/resources/assets/replaymod/lang/en_US.lang
Normal file
539
src/main/resources/assets/replaymod/lang/en_US.lang
Normal file
@@ -0,0 +1,539 @@
|
|||||||
|
replaymod.title=Replay Mod
|
||||||
|
|
||||||
|
#Website API translations
|
||||||
|
replaymod.api.parammissing=Required parameter missing: %1$s
|
||||||
|
replaymod.api.invalidvalue=Invalid value passed for parameter %1$s - Possible values: %2$s
|
||||||
|
replaymod.api.invalidlogin=Invalid login data provided
|
||||||
|
replaymod.api.invalidauthkey=Invalid authentication key provided
|
||||||
|
replaymod.api.notenoughspace=Not enough space left to upload this file. Consider purchasing Premium on ReplayMod.com
|
||||||
|
replaymod.api.invalidfile=This file is invalid
|
||||||
|
replaymod.api.fileduplicate=This file has already been uploaded
|
||||||
|
replaymod.api.filenoexist=This file does not exist
|
||||||
|
replaymod.api.nopermissions=You don't have permission to access this file
|
||||||
|
replaymod.api.alreadyrated=You already rated this file
|
||||||
|
replaymod.api.usernoexist=This user does not exist
|
||||||
|
replaymod.api.invalidcategory=Invalid file category
|
||||||
|
replaymod.api.nofilesuploaded=No files uploaded
|
||||||
|
replaymod.api.toomanyvalues=Too many values passed for %1$s
|
||||||
|
replaymod.api.noparameters=At least one parameter required. Parameters: %1$s
|
||||||
|
replaymod.api.invalidfilename=File name must be between 5 and 30 characters long
|
||||||
|
replaymod.api.unknownlang=This language has not been translated
|
||||||
|
replaymod.api.zippingerror=An error occured while zipping the language files
|
||||||
|
replaymod.api.usernameexists=This username is already taken
|
||||||
|
replaymod.api.mailexists=This Email address is already linked to an account
|
||||||
|
replaymod.api.invalidmail=Invalid Email Address
|
||||||
|
replaymod.api.nopermissions=You don't have permission to do this
|
||||||
|
replaymod.api.authfailed=Authentication to the Minecraft Session Servers failed
|
||||||
|
replaymod.api.mcuserexists=A ReplayMod account is already associated with this Minecraft account
|
||||||
|
replaymod.api.filetoobig=The uploaded file is too big
|
||||||
|
replaymod.api.usernametoolong=The username is too long
|
||||||
|
replaymod.api.descriptiontoolong=The description is too long
|
||||||
|
replaymod.api.passwordlength=The password has to be between 5 and 1024 characters long
|
||||||
|
replaymod.api.suspended=Your account has been suspended
|
||||||
|
|
||||||
|
#All of the chat messages
|
||||||
|
replaymod.chat.recordingstarted=Recording started
|
||||||
|
replaymod.chat.recordingfailed=Failed to start recording
|
||||||
|
|
||||||
|
replaymod.chat.savingthumb=Saving Thumbnail...
|
||||||
|
replaymod.chat.savedthumb=Thumbnail has been successfully saved
|
||||||
|
replaymod.chat.failedthumb=Thumbnail could not be saved
|
||||||
|
|
||||||
|
replaymod.chat.addedmarker=Event Marker has been added
|
||||||
|
|
||||||
|
#Chat messages displayed in Replay Viewer
|
||||||
|
replaymod.chat.morekeyframes=At least 2 position keyframes and 2 time keyframes required
|
||||||
|
replaymod.chat.negativetime=Camera Paths can't play time backwards. Please consult your nearest time lord for assistance.
|
||||||
|
replaymod.chat.pathstarted=Camera Path started
|
||||||
|
replaymod.chat.pathfinished=Camera Path finished
|
||||||
|
replaymod.chat.pathinterrupted=Camera Path canceled
|
||||||
|
|
||||||
|
#Replay Categories
|
||||||
|
replaymod.category=Category
|
||||||
|
replaymod.category.survival=Survival
|
||||||
|
replaymod.category.minigame=Minigame
|
||||||
|
replaymod.category.build=Build
|
||||||
|
replaymod.category.misc=Miscellaneous
|
||||||
|
|
||||||
|
#Common GUI-related strings
|
||||||
|
replaymod.gui.replay=Replay
|
||||||
|
replaymod.gui.login=Login
|
||||||
|
replaymod.gui.logout=Logout
|
||||||
|
replaymod.gui.cancel=Cancel
|
||||||
|
replaymod.gui.username=Username
|
||||||
|
replaymod.gui.password=Password
|
||||||
|
replaymod.gui.back=Back
|
||||||
|
replaymod.gui.duration=Duration
|
||||||
|
replaymod.gui.load=Load
|
||||||
|
replaymod.gui.download=Download
|
||||||
|
replaymod.gui.like=Like
|
||||||
|
replaymod.gui.dislike=Dislike
|
||||||
|
replaymod.gui.removelike=Remove Like
|
||||||
|
replaymod.gui.removedislike=Remove Dislike
|
||||||
|
replaymod.gui.save=Save
|
||||||
|
replaymod.gui.upload=Upload
|
||||||
|
replaymod.gui.rename=Rename
|
||||||
|
replaymod.gui.remove=Remove
|
||||||
|
replaymod.gui.add=Add
|
||||||
|
replaymod.gui.start=Start
|
||||||
|
replaymod.gui.end=End
|
||||||
|
replaymod.gui.delete=Delete
|
||||||
|
replaymod.gui.recording=Recording
|
||||||
|
replaymod.gui.speed=Speed
|
||||||
|
replaymod.gui.register=Register
|
||||||
|
replaymod.gui.mail=Email Address
|
||||||
|
replaymod.gui.loading=Loading
|
||||||
|
replaymod.gui.pleasewait=Please wait
|
||||||
|
replaymod.gui.render=Render
|
||||||
|
replaymod.gui.iphidden=Server IP Hidden
|
||||||
|
replaymod.gui.overwrite=Overwrite
|
||||||
|
replaymod.gui.saveas=Save as ...
|
||||||
|
replaymod.gui.done=Done
|
||||||
|
replaymod.gui.close=Close
|
||||||
|
replaymod.gui.notagain=Don't show again
|
||||||
|
|
||||||
|
replaymod.gui.renderdonetitle=Video rendered
|
||||||
|
replaymod.gui.openfolder=Open Video Folder
|
||||||
|
replaymod.gui.youtubeupload=Upload to YouTube
|
||||||
|
replaymod.gui.renderdone1=Your video was successfully rendered.
|
||||||
|
replaymod.gui.renderdone2=How would you like to proceed?
|
||||||
|
replaymod.gui.videotitle=Title
|
||||||
|
replaymod.gui.videodescription=Description
|
||||||
|
replaymod.gui.videotags=Tags,Tags,Tags
|
||||||
|
replaymod.gui.videothumbnail=Video Thumbnail
|
||||||
|
replaymod.gui.videovisibility.private=Private
|
||||||
|
replaymod.gui.videovisibility.unlisted=Unlisted
|
||||||
|
replaymod.gui.videovisibility.public=Public
|
||||||
|
replaymod.gui.ytuploadprogress.auth=[1/4] Authorization
|
||||||
|
replaymod.gui.ytuploadprogress.prepare_video=[2/4] Preparing video: %%d%%%%
|
||||||
|
replaymod.gui.ytuploadprogress.upload=[3/4] Uploading: %%d%%%%
|
||||||
|
replaymod.gui.ytuploadprogress.cleanup=[4/4] Cleanup
|
||||||
|
replaymod.gui.ytuploadprogress.done=Done: %s
|
||||||
|
replaymod.gui.titleempty=Title cannot be empty
|
||||||
|
replaymod.gui.videothumbnailtoolarge=Thumbnail size exceeds 2MB
|
||||||
|
replaymod.gui.videothumbnailformat=Thumbnail has to be either JPEG or PNG format
|
||||||
|
|
||||||
|
replaymod.gui.original=Original
|
||||||
|
replaymod.gui.modified=Modified
|
||||||
|
|
||||||
|
replaymod.gui.outdated=There is a newer Replay Mod version available. Please download it from replaymod.com
|
||||||
|
|
||||||
|
replaymod.gui.hours=h
|
||||||
|
replaymod.gui.minutes=min
|
||||||
|
replaymod.gui.seconds=sec
|
||||||
|
replaymod.gui.milliseconds=ms
|
||||||
|
|
||||||
|
replaymod.gui.pitch=Pitch
|
||||||
|
replaymod.gui.yaw=Yaw
|
||||||
|
replaymod.gui.roll=Roll
|
||||||
|
|
||||||
|
replaymod.gui.camera=Camera
|
||||||
|
replaymod.gui.position=Position
|
||||||
|
|
||||||
|
replaymod.gui.unknownerror=An unknown error occured
|
||||||
|
|
||||||
|
replaymod.gui.exit=Exit Replay
|
||||||
|
replaymod.gui.java=Java 1.7 or newer required
|
||||||
|
replaymod.gui.morereplays=At least one Replay required
|
||||||
|
|
||||||
|
replaymod.gui.loggedin=LOGGED IN
|
||||||
|
replaymod.gui.loggedout=LOGGED OUT
|
||||||
|
|
||||||
|
replaymod.gui.mainmenu=Main Menu
|
||||||
|
replaymod.gui.settings=Settings
|
||||||
|
|
||||||
|
replaymod.gui.keyframerepo.delete=Are you sure you want to delete these keyframes?
|
||||||
|
|
||||||
|
replaymod.gui.restorereplay1=It seems like Minecraft has not quit normally.
|
||||||
|
replaymod.gui.restorereplay2=The Replay "%1$s" was not saved correctly.
|
||||||
|
replaymod.gui.restorereplay3=Do you wish to recover it?
|
||||||
|
|
||||||
|
replaymod.gui.loadentitytracker=Loading entity positions: %%d%%%%
|
||||||
|
|
||||||
|
#Only change these if it's neccessary
|
||||||
|
replaymod.gui.replayviewer=Replay Viewer
|
||||||
|
replaymod.gui.replaycenter=Replay Center
|
||||||
|
replaymod.gui.replaysettings=Replay Settings
|
||||||
|
replaymod.gui.replayeditor=Replay Editor
|
||||||
|
|
||||||
|
#Login GUI
|
||||||
|
replaymod.gui.login.title=Login to ReplayMod.com
|
||||||
|
replaymod.gui.login.logging=Logging in...
|
||||||
|
replaymod.gui.login.incorrect=Incorrect username or password
|
||||||
|
replaymod.gui.login.connectionerror=Could not connect to ReplayMod.com
|
||||||
|
|
||||||
|
replaymod.gui.login.skip=Skip
|
||||||
|
|
||||||
|
replaymod.gui.register.title=Register on ReplayMod.com
|
||||||
|
replaymod.gui.register.confirmpw=Confirm Password
|
||||||
|
|
||||||
|
replaymod.gui.register.disclaimer=By registering an account, you agree to the Replay Mod's Terms of Service: https://replaymod.com/legal/terms
|
||||||
|
|
||||||
|
replaymod.gui.register.error.nomatch=Passwords don't match
|
||||||
|
replaymod.gui.register.error.shortusername=Username has to be at least 5 characters long
|
||||||
|
replaymod.gui.register.error.invalidname=Username may only contain letters and numbers
|
||||||
|
replaymod.gui.register.error.shortpw=Password has to be at least 5 characters long
|
||||||
|
replaymod.gui.register.error.longpw=Password has to be at most 1024 characters long
|
||||||
|
replaymod.gui.register.error.authfailed=Could not authenticate your Minecraft account
|
||||||
|
|
||||||
|
#Replay Viewer GUI
|
||||||
|
replaymod.gui.viewer.rename.title=Rename Replay
|
||||||
|
replaymod.gui.viewer.rename.name=Replay Name
|
||||||
|
replaymod.gui.viewer.replayfolder=Open Replay Folder...
|
||||||
|
replaymod.gui.viewer.noauth=Log in to upload a Replay
|
||||||
|
replaymod.gui.viewer.alreadyuploaded=This Replay has already been uploaded
|
||||||
|
|
||||||
|
replaymod.gui.viewer.delete.linea=Are you sure you want to delete this replay?
|
||||||
|
replaymod.gui.viewer.delete.failed1=Your OS did not allow us to move the replay. There is
|
||||||
|
replaymod.gui.viewer.delete.failed2=nothing we can do about this. You have to do it yourself.
|
||||||
|
replaymod.gui.viewer.delete.lineb='%1$s' will be lost forever! (a long time!)
|
||||||
|
|
||||||
|
replaymod.gui.viewer.download.title=Downloading Replay File...
|
||||||
|
replaymod.gui.viewer.download.message=Please wait while "%1$s" is being downloaded.
|
||||||
|
|
||||||
|
replaymod.gui.viewer.chooser.title=Choose Replay File
|
||||||
|
replaymod.gui.viewer.chooser.message=You have a modified version of "%1$s" on your computer. Which Replay do you want to load?
|
||||||
|
|
||||||
|
replaymod.gui.login.noacc=Don't have an account yet?
|
||||||
|
|
||||||
|
#Replay Center GUI
|
||||||
|
replaymod.gui.center.logoutcallback=Do you really want to log out?
|
||||||
|
replaymod.gui.center.top.recent=Recent
|
||||||
|
replaymod.gui.center.top.best=Best
|
||||||
|
replaymod.gui.center.top.downloaded=Downloaded
|
||||||
|
replaymod.gui.center.top.favorited=Favorited
|
||||||
|
replaymod.gui.center.top.search=Search
|
||||||
|
|
||||||
|
replaymod.gui.center.search.filters=Search Filters
|
||||||
|
replaymod.gui.center.search.gametype=Gametype
|
||||||
|
replaymod.gui.center.search.order=Sort by
|
||||||
|
replaymod.gui.center.search.order.best=Best
|
||||||
|
replaymod.gui.center.search.order.recent=Recent
|
||||||
|
replaymod.gui.center.search.name=Replay Name
|
||||||
|
replaymod.gui.center.search.server=Server IP (Multiplayer only)
|
||||||
|
replaymod.gui.center.search.category=Filter by Category
|
||||||
|
replaymod.gui.center.search.version=Filter by Version
|
||||||
|
|
||||||
|
replaymod.gui.center.downloadrequired=Download the Replay to rate or favorite it
|
||||||
|
|
||||||
|
replaymod.gui.center.favorite=Favorite
|
||||||
|
replaymod.gui.center.unfavorite=Unfavorite
|
||||||
|
replaymod.gui.center.favorites=Favorites
|
||||||
|
|
||||||
|
replaymod.gui.center.author=by %1$s%2$s
|
||||||
|
|
||||||
|
#Upload GUI
|
||||||
|
replaymod.gui.upload.title=Upload File
|
||||||
|
replaymod.gui.upload.start=Start Upload
|
||||||
|
replaymod.gui.upload.cancel=Cancel Upload
|
||||||
|
replaymod.gui.upload.tagshint=Tags separated by comma
|
||||||
|
replaymod.gui.upload.namehint=Replay Title
|
||||||
|
replaymod.gui.upload.descriptionhint=Description
|
||||||
|
replaymod.gui.upload.duration=Duration: %02dm%02ds
|
||||||
|
replaymod.gui.upload.uploading=Uploading...
|
||||||
|
replaymod.gui.upload.success=File has been successfully uploaded
|
||||||
|
replaymod.gui.upload.canceled=Upload has been canceled
|
||||||
|
replaymod.gui.upload.hideip2=Hide Server IP (%s)
|
||||||
|
replaymod.gui.upload.nothumbnail=Missing Thumbnail. Please create a Thumbnail in the Replay using the %1$s key.
|
||||||
|
replaymod.gui.upload.tryagain=Try again?
|
||||||
|
|
||||||
|
replaymod.gui.upload.error.name.length=The Replay Name has to be between 5 and 30 characters long
|
||||||
|
replaymod.gui.upload.error.name=The Replay Name may not contain special characters
|
||||||
|
replaymod.gui.upload.error.tags=Tags may only contain letters and are separated using a comma
|
||||||
|
|
||||||
|
#Replay Editor
|
||||||
|
replaymod.gui.editor.replayfile=Replay File
|
||||||
|
|
||||||
|
replaymod.gui.editor.savemode.override=Replace Source File
|
||||||
|
replaymod.gui.editor.savemode.newfile=Save to new File
|
||||||
|
|
||||||
|
replaymod.gui.editor.trim.title=Trim Replay
|
||||||
|
replaymod.gui.editor.connect.title=Connect Replays
|
||||||
|
replaymod.gui.editor.modify.title=Modify Replay
|
||||||
|
|
||||||
|
replaymod.gui.editor.trim.description=Removes the beginning and end of a Replay File, only keeping the Replay between the given timestamps
|
||||||
|
replaymod.gui.editor.connect.description=Connects multiple Replays in the specified order
|
||||||
|
replaymod.gui.editor.modify.description=Provides several filters to modify Replay Files
|
||||||
|
|
||||||
|
replaymod.gui.editor.trim.marker=Select Event Marker
|
||||||
|
|
||||||
|
replaymod.gui.editor.progress.title=Editing Replay File...
|
||||||
|
replaymod.gui.editor.progress.pleasewait=Please wait while the Replay is being edited.
|
||||||
|
|
||||||
|
replaymod.gui.editor.progress.status.initializing=Initializing
|
||||||
|
replaymod.gui.editor.progress.status.writing.raw=Rewriting Replay...
|
||||||
|
replaymod.gui.editor.progress.status.writing.final=Writing File to disk...
|
||||||
|
replaymod.gui.editor.progress.status.finished=Finished Editing!
|
||||||
|
|
||||||
|
replaymod.gui.editor.disclaimer=The Replay Editor is an experimental feature and may contain bugs.
|
||||||
|
|
||||||
|
#Cancel Replay GUI
|
||||||
|
replaymod.gui.cancelrender.title=Cancel Rendering
|
||||||
|
replaymod.gui.cancelrender.message=Are you sure that you want to cancel the current rendering process?
|
||||||
|
#Saving Replay GUI
|
||||||
|
replaymod.gui.replaysaving.title=Saving Replay File...
|
||||||
|
replaymod.gui.replaysaving.message=Please wait while your recent Replay is being saved.
|
||||||
|
replaymod.gui.replaymodified.message=Replay was modified. Would you like to save the changes?
|
||||||
|
replaymod.gui.replaymodified.yes=Save Modified Replay
|
||||||
|
replaymod.gui.replaymodified.no=Discard Changes
|
||||||
|
replaymod.gui.replaymodified.warning1=A Replay named "%1$s" already exists.
|
||||||
|
replaymod.gui.replaymodified.warning2=Are you sure you want to replace it?
|
||||||
|
|
||||||
|
#Player Overview GUI
|
||||||
|
replaymod.gui.playeroverview.visible=Visible
|
||||||
|
replaymod.gui.playeroverview.hideall=Hide all
|
||||||
|
replaymod.gui.playeroverview.showall=Show all
|
||||||
|
replaymod.gui.playeroverview.spectate=Spectate Player
|
||||||
|
replaymod.gui.playeroverview.remembersettings=Remember Hidden Players
|
||||||
|
replaymod.gui.playeroverview.remembersettings.description=Saves Player Visibility in Replay File
|
||||||
|
|
||||||
|
#Replay Mod Settings GUI
|
||||||
|
replaymod.gui.settings.title=Replay Mod Settings
|
||||||
|
|
||||||
|
replaymod.gui.settings.interpolation.linear=Linear
|
||||||
|
replaymod.gui.settings.interpolation.cubic=Cubic
|
||||||
|
replaymod.gui.settings.interpolation.catmullrom=Catmull Rom
|
||||||
|
|
||||||
|
replaymod.gui.settings.bitrate=Video Bitrate
|
||||||
|
replaymod.gui.settings.framerate=Video Framerate
|
||||||
|
replaymod.gui.settings.notifications=Enable Notifications
|
||||||
|
replaymod.gui.settings.recordserver=Record Server
|
||||||
|
replaymod.gui.settings.recordsingleplayer=Record Singleplayer
|
||||||
|
replaymod.gui.settings.indicator=Recording Indicator
|
||||||
|
replaymod.gui.settings.lighting=Ambient Lighting
|
||||||
|
replaymod.gui.settings.forcechunks=Force Render Chunks
|
||||||
|
replaymod.gui.settings.resources=Server Resource Packs
|
||||||
|
replaymod.gui.settings.interpolation=Path Interpolation
|
||||||
|
replaymod.gui.settings.linearinterpolation=Linear Path Interpolation
|
||||||
|
replaymod.gui.settings.pathpreview=Show Path Preview
|
||||||
|
replaymod.gui.settings.keyframecleancallback=Clear Confirmation
|
||||||
|
replaymod.gui.settings.renderinvisible=Render invisible Entities
|
||||||
|
replaymod.gui.settings.camera=Camera
|
||||||
|
replaymod.gui.settings.showchat=Show Chat
|
||||||
|
replaymod.gui.settings.interpolator=Default Interpolator
|
||||||
|
|
||||||
|
replaymod.gui.settings.warning.linea=WARNING: Recording settings will be
|
||||||
|
replaymod.gui.settings.warning.lineb=applied the next time you join a world.
|
||||||
|
|
||||||
|
#Replay Mod Keybindings
|
||||||
|
replaymod.input.lighting=Toggle Lighting
|
||||||
|
replaymod.input.thumbnail=Capture Thumbnail
|
||||||
|
replaymod.input.playeroverview=Player Overview
|
||||||
|
replaymod.input.clearkeyframes=Clear Keyframes
|
||||||
|
replaymod.input.synctimeline=Synchronize Timeline
|
||||||
|
replaymod.input.keyframerepository=Open Keyframe Presets
|
||||||
|
replaymod.input.rollclockwise=Roll Clockwise
|
||||||
|
replaymod.input.rollcounterclockwise=Roll Counterclockwise
|
||||||
|
replaymod.input.resettilt=Reset Camera Tilt
|
||||||
|
replaymod.input.playpause=Play/Pause Replay
|
||||||
|
replaymod.input.marker=Add Event Marker
|
||||||
|
replaymod.input.pathpreview=Toggle Path Preview
|
||||||
|
replaymod.input.assetmanager=Asset Manager
|
||||||
|
replaymod.input.objectmanager=Object Manager
|
||||||
|
replaymod.input.interpolation=Toggle Interpolation
|
||||||
|
replaymod.input.settings=ReplayMod Settings
|
||||||
|
|
||||||
|
# CameraControllers
|
||||||
|
replaymod.camera.classic=Classic
|
||||||
|
replaymod.camera.vanilla=Vanilla-ish
|
||||||
|
|
||||||
|
#Keyframe Presets GUI
|
||||||
|
replaymod.gui.keyframerepository.title=Keyframe Repository
|
||||||
|
replaymod.gui.keyframerepository.presets=Keyframe Presets
|
||||||
|
replaymod.gui.keyframerepository.positionkeyframes=Position Keyframes
|
||||||
|
replaymod.gui.keyframerepository.timekeyframes=Time Keyframes
|
||||||
|
|
||||||
|
replaymod.gui.keyframerepository.savecurrent=Save current Path
|
||||||
|
|
||||||
|
replaymod.gui.keyframerepository.noentries=No Presets available
|
||||||
|
|
||||||
|
replaymod.gui.keyframerepository.preset.defaultname=New Keyframe Preset
|
||||||
|
replaymod.gui.keyframerepository.duplicate=This Preset already exists
|
||||||
|
|
||||||
|
#Edit Keyframe GUI
|
||||||
|
replaymod.gui.editkeyframe.title.pos=Edit Position Keyframe
|
||||||
|
replaymod.gui.editkeyframe.title.time=Edit Time Keyframe
|
||||||
|
replaymod.gui.editkeyframe.title.marker=Edit Event Marker
|
||||||
|
replaymod.gui.editkeyframe.title.spec=Edit Spectator Keyframe
|
||||||
|
replaymod.gui.editkeyframe.xpos=X Position
|
||||||
|
replaymod.gui.editkeyframe.ypos=Y Position
|
||||||
|
replaymod.gui.editkeyframe.zpos=Z Position
|
||||||
|
replaymod.gui.editkeyframe.campitch=Camera Pitch
|
||||||
|
replaymod.gui.editkeyframe.camyaw=Camera Yaw
|
||||||
|
replaymod.gui.editkeyframe.camroll=Camera Roll
|
||||||
|
replaymod.gui.editkeyframe.timelineposition=Timeline Position
|
||||||
|
replaymod.gui.editkeyframe.markername=Event Marker Name
|
||||||
|
replaymod.gui.editkeyframe.timestamp=Time Index
|
||||||
|
|
||||||
|
replaymod.gui.editkeyframe.spec.method=Spectating Method
|
||||||
|
replaymod.gui.editkeyframe.spec.method.firstperson=First Person
|
||||||
|
replaymod.gui.editkeyframe.spec.method.shoulder=Shoulder Camera
|
||||||
|
|
||||||
|
replaymod.gui.editkeyframe.spec.method.shoulder.distance=Camera Distance
|
||||||
|
replaymod.gui.editkeyframe.spec.method.shoulder.pitch=Pitch Offset
|
||||||
|
replaymod.gui.editkeyframe.spec.method.shoulder.yaw=Rotation Angle
|
||||||
|
replaymod.gui.editkeyframe.spec.method.shoulder.smoothness=Path Smoothness
|
||||||
|
|
||||||
|
replaymod.gui.editkeyframe.interpolator=Interpolator
|
||||||
|
replaymod.gui.editkeyframe.interpolator.default.name=Default Interpolator
|
||||||
|
replaymod.gui.editkeyframe.interpolator.default.desc=Uses the default interpolator defined in the Replay Mod Settings.
|
||||||
|
replaymod.gui.editkeyframe.interpolator.catmullrom.name=Catmull Rom Spline Interpolator
|
||||||
|
replaymod.gui.editkeyframe.interpolator.catmullrom.desc=Calculates a catmull rom spline with customizable alpha value for precise tightness and smoothness of the camera path.
|
||||||
|
replaymod.gui.editkeyframe.interpolator.catmullrom.alpha=Alpha:
|
||||||
|
replaymod.gui.editkeyframe.interpolator.cubic.name=Cubic Spline Interpolator
|
||||||
|
replaymod.gui.editkeyframe.interpolator.cubic.desc=Calculates a cubic equation matrix for all points for a smooth camera path.
|
||||||
|
replaymod.gui.editkeyframe.interpolator.linear.name=Linear Interpolator
|
||||||
|
replaymod.gui.editkeyframe.interpolator.linear.desc=Draws straight lines between the keyframes.
|
||||||
|
|
||||||
|
#Render Settings GUI
|
||||||
|
replaymod.gui.rendersettings.title=Rendering Options
|
||||||
|
replaymod.gui.rendersettings.renderer=Rendering Method
|
||||||
|
|
||||||
|
replaymod.gui.rendersettings.renderer.default=Default Rendering
|
||||||
|
replaymod.gui.rendersettings.renderer.tiled=Tiled Rendering
|
||||||
|
replaymod.gui.rendersettings.renderer.stereoscopic=Stereoscopic Rendering
|
||||||
|
replaymod.gui.rendersettings.renderer.cubic=Cubic Rendering
|
||||||
|
replaymod.gui.rendersettings.renderer.equirectangular=Equirectangular Rendering
|
||||||
|
replaymod.gui.rendersettings.renderer.ods=ODS Rendering
|
||||||
|
|
||||||
|
replaymod.gui.rendersettings.renderer.default.description=Renders the video in the specified resolution. Fastest Rendering Option.
|
||||||
|
replaymod.gui.rendersettings.renderer.stereoscopic.description=Renders the video as a stereoscopic (side-by-side) 3D movie, usable by different 3D technologies. The image for one eye is half the width of the video
|
||||||
|
replaymod.gui.rendersettings.renderer.cubic.description=Renders the video with a 360 degree panoramic view, using Cubic Projection. This is usable by several 360 degree video players (and the Oculus Rift), for example VR Player.
|
||||||
|
replaymod.gui.rendersettings.renderer.equirectangular.description=Renders the video with a 360 degree panoramic view, using Equirectangular Projection. This is usable by YouTube's new 360 degree video function, and several video players (and the Oculus Rift), for example VR Player.
|
||||||
|
replaymod.gui.rendersettings.renderer.ods.description=Renders the video with a stereoscopic 3D 360 degree panoramic view, also called VR Video. This is usable by YouTube's new VR video function.
|
||||||
|
|
||||||
|
replaymod.gui.rendersettings.customresolution=Video Resolution
|
||||||
|
replaymod.gui.rendersettings.customresolution.warning.cubic=Cubic Rendering requires an aspect ratio of 4:3
|
||||||
|
replaymod.gui.rendersettings.customresolution.warning.equirectangular=Equirectangular Rendering requires an aspect ratio of 2:1
|
||||||
|
replaymod.gui.rendersettings.customresolution.warning.yuv420=For this preset, the width and height values need to be even numbers
|
||||||
|
replaymod.gui.rendersettings.customresolution.warning.ods=ODS Rendering requires an aspect ratio of 1:1
|
||||||
|
replaymod.gui.rendersettings.resolution=Video Resolution
|
||||||
|
replaymod.gui.rendersettings.interpolation=Path Interpolation
|
||||||
|
replaymod.gui.rendersettings.forcechunks=Force Render Chunks
|
||||||
|
replaymod.gui.rendersettings.framerate=Video Framerate
|
||||||
|
replaymod.gui.rendersettings.quality=Video Quality
|
||||||
|
replaymod.gui.rendersettings.chromakey=Chroma Keying
|
||||||
|
replaymod.gui.rendersettings.skycolor=Sky Color
|
||||||
|
replaymod.gui.rendersettings.nametags=Render Name Tags
|
||||||
|
replaymod.gui.rendersettings.outputfile=Output File
|
||||||
|
replaymod.gui.rendersettings.360metadata=Inject 360° Metadata
|
||||||
|
replaymod.gui.rendersettings.360metadata.error=360° Metadata can only be added to Equirectangular videos in MP4 format
|
||||||
|
|
||||||
|
replaymod.gui.rendersettings.command=Command
|
||||||
|
replaymod.gui.rendersettings.arguments=Command Line Arguments
|
||||||
|
replaymod.gui.rendersettings.ffmpeg.description=If you are an advanced user, you can customize the command line parameters used to export the video. For more information, check http://replaymod.com/docs
|
||||||
|
|
||||||
|
replaymod.gui.rendersettings.stabilizecamera=Stabilize Camera
|
||||||
|
replaymod.gui.rendersettings.exportyoutube=Export for YouTube
|
||||||
|
|
||||||
|
replaymod.gui.rendersettings.video=Video Settings
|
||||||
|
replaymod.gui.rendersettings.advanced=Advanced Settings
|
||||||
|
replaymod.gui.rendersettings.commandline=Command Line Settings
|
||||||
|
|
||||||
|
replaymod.gui.rendersettings.presets=Encoding Presets
|
||||||
|
replaymod.gui.rendersettings.presets.mp4.custom=MP4 - Custom Bitrate
|
||||||
|
replaymod.gui.rendersettings.presets.mp4.high=MP4 - High Quality
|
||||||
|
replaymod.gui.rendersettings.presets.mp4.default=MP4 - Default Quality
|
||||||
|
replaymod.gui.rendersettings.presets.mp4.potato=MP4 - Potato Quality
|
||||||
|
replaymod.gui.rendersettings.presets.webm.custom=WEBM - Custom Bitrate
|
||||||
|
replaymod.gui.rendersettings.presets.mkv.lossless=MKV - Lossless
|
||||||
|
replaymod.gui.rendersettings.presets.png=PNG Sequence
|
||||||
|
|
||||||
|
replaymod.gui.rendersettings.antialiasing=Anti-Aliasing
|
||||||
|
replaymod.gui.rendersettings.antialiasing.none=None
|
||||||
|
replaymod.gui.rendersettings.antialiasing.x2=2x
|
||||||
|
replaymod.gui.rendersettings.antialiasing.x4=4x
|
||||||
|
replaymod.gui.rendersettings.antialiasing.x8=8x
|
||||||
|
|
||||||
|
#Render Queue GUI
|
||||||
|
replaymod.gui.renderqueue.title=Render Queue
|
||||||
|
replaymod.gui.renderqueue.open=Open Queue
|
||||||
|
replaymod.gui.renderqueue.jobname=Job Name:
|
||||||
|
replaymod.gui.renderqueue.add=Add current configuration
|
||||||
|
|
||||||
|
#Rendering GUI
|
||||||
|
replaymod.gui.rendering.title=Rendering Video
|
||||||
|
replaymod.gui.rendering.pause=Pause Rendering
|
||||||
|
replaymod.gui.rendering.resume=Resume Rendering
|
||||||
|
replaymod.gui.rendering.cancel=Cancel Rendering
|
||||||
|
replaymod.gui.rendering.cancel.callback=Are you sure?
|
||||||
|
replaymod.gui.rendering.preview=Show Preview (Performance might suffer)
|
||||||
|
replaymod.gui.rendering.progress=Frames rendered: %1$d / %2$d
|
||||||
|
replaymod.gui.rendering.timetaken=Render Time
|
||||||
|
replaymod.gui.rendering.timeleft=Time Left
|
||||||
|
|
||||||
|
#Render Errors
|
||||||
|
replaymod.gui.rendering.error.title=Rendering Failed
|
||||||
|
replaymod.gui.rendering.error.optifine=Please uninstall Optifine before rendering.
|
||||||
|
replaymod.gui.rendering.error.message=To render a video, you need to have ffmpeg installed. http://ffmpeg.org
|
||||||
|
|
||||||
|
#Ingame Menu
|
||||||
|
replaymod.gui.ingame.menu.addposkeyframe=Add Position Keyframe
|
||||||
|
replaymod.gui.ingame.menu.removeposkeyframe=Remove Position Keyframe
|
||||||
|
replaymod.gui.ingame.menu.addspeckeyframe=Add Spectator Keyframe
|
||||||
|
replaymod.gui.ingame.menu.removespeckeyframe=Remove Spectator Keyframe
|
||||||
|
replaymod.gui.ingame.menu.addtimekeyframe=Add Time Keyframe
|
||||||
|
replaymod.gui.ingame.menu.removetimekeyframe=Remove Time Keyframe
|
||||||
|
replaymod.gui.ingame.menu.pause=Pause Replay
|
||||||
|
replaymod.gui.ingame.menu.unpause=Unpause Replay
|
||||||
|
replaymod.gui.ingame.menu.renderpath=Render Camera Path
|
||||||
|
replaymod.gui.ingame.menu.playpath=Play Camera Path from Cursor Position
|
||||||
|
replaymod.gui.ingame.menu.playpathfromstart=Play Camera Path from Start
|
||||||
|
replaymod.gui.ingame.menu.pausepath=Pause Camera Path
|
||||||
|
replaymod.gui.ingame.menu.zoomin=Zoom in
|
||||||
|
replaymod.gui.ingame.menu.zoomout=Zoom out
|
||||||
|
|
||||||
|
replaymod.gui.ingame.unnamedmarker=Unnamed Event Marker
|
||||||
|
|
||||||
|
#Clear Keyframe Callback
|
||||||
|
replaymod.gui.clearcallback.title=Clear all Keyframes?
|
||||||
|
replaymod.gui.clearcallback.message=This Callback can be disabled in the Replay Settings.
|
||||||
|
|
||||||
|
#Asset Manager Gui
|
||||||
|
replaymod.gui.assets.title=Asset Manager
|
||||||
|
replaymod.gui.assets.filechooser=Asset File
|
||||||
|
replaymod.gui.assets.defaultname=New Asset
|
||||||
|
replaymod.gui.assets.emptylist=No Assets available
|
||||||
|
replaymod.gui.assets.namehint=Asset Name
|
||||||
|
replaymod.gui.assets.changefile=Change Asset File
|
||||||
|
replaymod.gui.assets.noselection=No Asset selected
|
||||||
|
|
||||||
|
#Object Manager Gui
|
||||||
|
replaymod.gui.objects.properties.anchor=Anchor Point
|
||||||
|
replaymod.gui.objects.properties.position=Position
|
||||||
|
replaymod.gui.objects.properties.scale=Scale
|
||||||
|
replaymod.gui.objects.properties.orientation=Orientation
|
||||||
|
replaymod.gui.objects.properties.opacity=Opacity
|
||||||
|
replaymod.gui.objects.properties.name=Object Name
|
||||||
|
replaymod.gui.objects.empty=No Objects added
|
||||||
|
replaymod.gui.objects.defaultname=New Object
|
||||||
|
replaymod.gui.objects=Custom Objects
|
||||||
|
|
||||||
|
#Errors
|
||||||
|
replaymod.error.unknownrestriction1=This replay cannot be played with your current version.
|
||||||
|
replaymod.error.unknownrestriction2=It tried to enforce %s which is unknown.
|
||||||
|
replaymod.error.negativetime1=Some of your time keyframes are out of order.
|
||||||
|
replaymod.error.negativetime2=Going backwards in time is not supported.
|
||||||
|
replaymod.error.negativetime3=The invalid parts are marked in red.
|
||||||
|
|
||||||
|
#Replay Mod Incompatibility Warning
|
||||||
|
replaymod.gui.modwarning.title=Incompatibility detected
|
||||||
|
replaymod.gui.modwarning.message1=A possible incompatibility between your current
|
||||||
|
replaymod.gui.modwarning.message2=Minecraft version and this Replay has been detected.
|
||||||
|
replaymod.gui.modwarning.message3=Loading this Replay may result in errors or a crash.
|
||||||
|
replaymod.gui.modwarning.name=Mod Name:
|
||||||
|
replaymod.gui.modwarning.id=Mod Id:
|
||||||
|
replaymod.gui.modwarning.missing=Missing Mods
|
||||||
|
replaymod.gui.modwarning.version=Different Mod Versions
|
||||||
|
replaymod.gui.modwarning.version.expected=Expected
|
||||||
|
replaymod.gui.modwarning.version.found=Found
|
||||||
|
|
||||||
|
#OpenEye
|
||||||
|
replaymod.gui.offeropeneye1=Do you want to install OpenEye?
|
||||||
|
replaymod.gui.offeropeneye2=OpenEye is a mod that collects anonymous information
|
||||||
|
replaymod.gui.offeropeneye3=about the mods being run and any crashes that happen.
|
||||||
|
replaymod.gui.offeropeneye4=
|
||||||
|
replaymod.gui.offeropeneye5=OpenEye can be disabled at any time and is completely optional.
|
||||||
|
replaymod.gui.offeropeneye6=More information is available at https://openeye.openmods.info/faq
|
||||||
|
replaymod.gui.offeropeneye7=Clicking Yes will download OpenEye and place it in your mods folder.
|
||||||
|
replaymod.gui.offeropeneye8=It will then be active the next time you start Minecraft.
|
||||||
@@ -473,27 +473,6 @@ public class SPTimelineTest {
|
|||||||
impl.setInterpolatorToDefault(0);
|
impl.setInterpolatorToDefault(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testMoveKeyframeSimple() {
|
|
||||||
addPosition(0, 0);
|
|
||||||
addPosition(1, 1);
|
|
||||||
setInterpolator(0, new LinearInterpolator(), 1);
|
|
||||||
assertIsLinear(0);
|
|
||||||
|
|
||||||
impl.moveKeyframe(SPPath.POSITION, 0, 2);
|
|
||||||
assertValidInterpolators(SPPath.POSITION, 1);
|
|
||||||
assertIsLinear(0);
|
|
||||||
impl.moveKeyframe(SPPath.POSITION, 2, 0);
|
|
||||||
assertValidInterpolators(SPPath.POSITION, 1);
|
|
||||||
assertIsLinear(0);
|
|
||||||
|
|
||||||
addPosition(2, 1);
|
|
||||||
impl.moveKeyframe(SPPath.POSITION, 0, 3);
|
|
||||||
assertValidInterpolators(SPPath.POSITION, 1);
|
|
||||||
assertIsLinear(0);
|
|
||||||
assertIsLinear(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMoveKeyframe() {
|
public void testMoveKeyframe() {
|
||||||
addPosition(1, 0);
|
addPosition(1, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user