Update to MC 1.14 / Fabric

This commit is contained in:
Jonas Herzig
2019-05-04 14:37:00 +02:00
parent 17fe5b345f
commit 3d009e45c7
151 changed files with 3963 additions and 1455 deletions

View File

@@ -1,5 +1,6 @@
package com.replaymod.online.gui;
import com.replaymod.core.ReplayMod;
import com.replaymod.online.api.ApiClient;
import de.johni0702.minecraft.gui.container.AbstractGuiScreen;
import de.johni0702.minecraft.gui.container.GuiScreen;
@@ -44,12 +45,7 @@ public class GuiLoginPrompt extends AbstractGuiScreen<GuiLoginPrompt> {
switch (apiClient.login(username.getText(), password.getText())) {
case SUCCESS:
statusLabel.setText("");
getMinecraft().addScheduledTask(new Runnable() {
@Override
public void run() {
successScreen.display();
}
});
ReplayMod.instance.runLater(successScreen::display);
break;
case INVALID_DATA:
statusLabel.setI18nText("replaymod.gui.login.incorrect");

View File

@@ -1,6 +1,7 @@
package com.replaymod.online.gui;
import com.mojang.authlib.exceptions.AuthenticationException;
import com.replaymod.core.ReplayMod;
import com.replaymod.online.api.ApiClient;
import com.replaymod.online.api.ApiException;
import de.johni0702.minecraft.gui.container.AbstractGuiScreen;
@@ -82,12 +83,7 @@ public class GuiRegister extends AbstractGuiScreen<GuiRegister> {
String password = passwordInput.getText();
apiClient.register(username, mail, password);
getMinecraft().addScheduledTask(new Runnable() {
@Override
public void run() {
parent.getSuccessScreen().display();
}
});
ReplayMod.instance.runLater(parent.getSuccessScreen()::display);
} catch (ApiException ae) {
statusLabel.setText(ae.getLocalizedMessage());
} catch (AuthenticationException aue) {

View File

@@ -5,7 +5,6 @@ import com.google.common.base.Supplier;
import com.google.common.primitives.Ints;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.mojang.realmsclient.gui.ChatFormatting;
import com.replaymod.core.utils.Utils;
import com.replaymod.online.ReplayModOnline;
import com.replaymod.online.api.ApiClient;
@@ -40,6 +39,7 @@ import de.johni0702.minecraft.gui.utils.Consumer;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import org.apache.commons.lang3.StringUtils;
import net.minecraft.util.text.TextFormatting;
import java.awt.image.BufferedImage;
import java.io.IOException;
@@ -417,9 +417,9 @@ public class GuiReplayCenter extends GuiScreen {
this.downloaded = downloaded;
ReplayMetaData metaData = fileInfo.getMetadata();
name.setText(ChatFormatting.UNDERLINE + Utils.fileNameToReplayName(fileInfo.getName()));
name.setText(TextFormatting.UNDERLINE + Utils.fileNameToReplayName(fileInfo.getName()));
author.setI18nText("replaymod.gui.center.author",
"" + ChatFormatting.GRAY + ChatFormatting.ITALIC, fileInfo.getOwner());
"" + TextFormatting.GRAY + TextFormatting.ITALIC, fileInfo.getOwner());
if (StringUtils.isEmpty(metaData.getServerName())) {
server.setI18nText("replaymod.gui.iphidden").setColor(Colors.DARK_RED);
} else {
@@ -443,7 +443,7 @@ public class GuiReplayCenter extends GuiScreen {
favorites.setText("" + fileInfo.getFavorites());
likes.setText("" + fileInfo.getRatings().getPositive());
dislikes.setText("" + fileInfo.getRatings().getNegative());
category.setText(ChatFormatting.ITALIC + Optional.fromNullable(Category.fromId(fileInfo.getCategory()))
category.setText(TextFormatting.ITALIC + Optional.fromNullable(Category.fromId(fileInfo.getCategory()))
.or(Category.MISCELLANEOUS).toNiceString());
addElements(null, durationPanel, downloadsPanel);

View File

@@ -1,6 +1,6 @@
package com.replaymod.online.gui;
import com.mojang.realmsclient.gui.ChatFormatting;
import com.replaymod.core.ReplayMod;
import com.replaymod.online.ReplayModOnline;
import com.replaymod.online.api.ApiClient;
import com.replaymod.online.api.ApiException;
@@ -10,6 +10,7 @@ import de.johni0702.minecraft.gui.element.GuiButton;
import de.johni0702.minecraft.gui.element.GuiLabel;
import de.johni0702.minecraft.gui.element.advanced.GuiProgressBar;
import de.johni0702.minecraft.gui.layout.CustomLayout;
import net.minecraft.util.text.TextFormatting;
import java.io.File;
import java.io.IOException;
@@ -33,7 +34,7 @@ public class GuiReplayDownloading extends AbstractGuiScreen<GuiReplayDownloading
this.apiClient = mod.getApiClient();
setTitle(new GuiLabel().setI18nText("replaymod.gui.viewer.download.title"));
final GuiLabel subTitle = new GuiLabel(this).setI18nText("replaymod.gui.viewer.download.message",
ChatFormatting.UNDERLINE + name + ChatFormatting.RESET);
TextFormatting.UNDERLINE + name + TextFormatting.RESET);
setLayout(new CustomLayout<GuiReplayDownloading>() {
@Override
protected void layout(GuiReplayDownloading container, int width, int height) {
@@ -53,14 +54,11 @@ public class GuiReplayDownloading extends AbstractGuiScreen<GuiReplayDownloading
try {
apiClient.downloadFile(replayId, replayFile, progressBar::setProgress);
if (replayFile.exists()) {
getMinecraft().addScheduledTask(new Runnable() {
@Override
public void run() {
try {
mod.startReplay(replayId, null, null);
} catch (IOException e) {
e.printStackTrace();
}
ReplayMod.instance.runLater(() -> {
try {
mod.startReplay(replayId, null, null);
} catch (IOException e) {
e.printStackTrace();
}
});
}