From d0ffab9339de0994e588f50236c236a17e8e97cf Mon Sep 17 00:00:00 2001 From: IzzyBizzy Date: Fri, 10 Jun 2022 14:08:46 +1000 Subject: [PATCH] 1.19 Changes --- build.gradle | 12 ++++++------ gradle.properties | 14 +++++++------- .../szum123321/textile_backup/TextileBackup.java | 4 ++-- .../szum123321/textile_backup/TextileLogger.java | 10 +++++----- .../commands/CommandExceptions.java | 4 ++-- .../szum123321/textile_backup/core/Utilities.java | 15 ++++++--------- .../textile_backup/core/create/BackupHelper.java | 1 - .../core/create/MakeBackupRunnable.java | 1 - .../core/restore/RestoreHelper.java | 1 - src/main/resources/fabric.mod.json | 7 ++++--- 10 files changed, 32 insertions(+), 37 deletions(-) diff --git a/build.gradle b/build.gradle index b446a05..03c7edc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.10-SNAPSHOT' + id 'fabric-loom' version '0.12-SNAPSHOT' id 'maven-publish' } @@ -10,8 +10,7 @@ archivesBaseName = project.archives_base_name version = "${project.mod_version}-${getMcMinor(project.minecraft_version)}" group = project.maven_group -minecraft { -} + repositories{ maven { url 'https://jitpack.io' } @@ -55,9 +54,10 @@ dependencies { include "com.github.shevek:parallelgzip:${project.pgzip_commit_hash}" // Lazy DFU makes the dev env start up much faster by loading DataFixerUpper lazily, which would otherwise take a long time. We rarely need it anyway. - modRuntime("com.github.astei:lazydfu:${project.lazydfu_version}") { - exclude(module: "fabric-loader") - } + // I couldn't get this working in my environment - IzzyBizzy + //modRuntime("com.github.astei:lazydfu:${project.lazydfu_version}") { + // exclude(module: "fabric-loader") + //} } processResources { diff --git a/gradle.properties b/gradle.properties index 1819db9..4c0481b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,18 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G -minecraft_version=1.18.1 -yarn_mappings=1.18.1+build.11 -loader_version=0.12.12 +minecraft_version=1.19 +yarn_mappings=1.19+build.1 +loader_version=0.14.6 #Fabric api -fabric_version=0.45.0+1.18 +fabric_version=0.55.1+1.19 #Cloth Config -cloth_version=6.0.42 +cloth_version=7.0.69 #ModMenu -modmenu_version=3.0.0 +modmenu_version=4.0.0 #Lazy DFU for faster dev start lazydfu_version=0.1.2 @@ -21,6 +21,6 @@ lazydfu_version=0.1.2 pgzip_commit_hash=af5f5c297e735f3f2df7aa4eb0e19a5810b8aff6 # Mod Properties -mod_version = 2.3.1-a +mod_version = 2.3.2 maven_group = net.szum123321 archives_base_name = textile_backup \ No newline at end of file diff --git a/src/main/java/net/szum123321/textile_backup/TextileBackup.java b/src/main/java/net/szum123321/textile_backup/TextileBackup.java index 787e023..f609182 100644 --- a/src/main/java/net/szum123321/textile_backup/TextileBackup.java +++ b/src/main/java/net/szum123321/textile_backup/TextileBackup.java @@ -23,7 +23,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import me.shedaniel.autoconfig.AutoConfig; import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer; import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; +import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; import net.minecraft.server.command.ServerCommandSource; @@ -82,7 +82,7 @@ public class TextileBackup implements ModInitializer { } }); - CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> dispatcher.register( + CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher.register( LiteralArgumentBuilder.literal("backup") .requires((ctx) -> { try { diff --git a/src/main/java/net/szum123321/textile_backup/TextileLogger.java b/src/main/java/net/szum123321/textile_backup/TextileLogger.java index 90c0a8e..29b6202 100644 --- a/src/main/java/net/szum123321/textile_backup/TextileLogger.java +++ b/src/main/java/net/szum123321/textile_backup/TextileLogger.java @@ -20,7 +20,7 @@ package net.szum123321.textile_backup; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import net.minecraft.text.MutableText; import net.minecraft.util.Formatting; import net.szum123321.textile_backup.core.create.BackupContext; @@ -54,11 +54,11 @@ public class TextileLogger { this.messageFactory = ParameterizedMessageFactory.INSTANCE; this.logger = LogManager.getLogger(StackLocatorUtil.getCallerClass(2), messageFactory); this.prefix = "[" + prefix + "]" + " "; - this.prefixText = new LiteralText(this.prefix).styled(style -> style.withColor(0x5B23DA)); + this.prefixText = Text.literal(this.prefix).styled(style -> style.withColor(0x5B23DA)); } public MutableText getPrefixText() { - return prefixText.shallowCopy(); + return prefixText.copy(); } public void log(Level level, String msg, Object... data) { @@ -91,13 +91,13 @@ public class TextileLogger { boolean sendFeedback(Level level, ServerCommandSource source, String msg, Object... args) { if(source != null && source.getEntity() instanceof PlayerEntity) { - LiteralText text = new LiteralText(messageFactory.newMessage(msg, args).getFormattedMessage()); + MutableText text = Text.literal(messageFactory.newMessage(msg, args).getFormattedMessage()); if(level.intLevel() == Level.TRACE.intLevel()) text.formatted(Formatting.GREEN); else if(level.intLevel() <= Level.WARN.intLevel()) text.formatted(Formatting.RED); else text.formatted(Formatting.WHITE); - source.sendFeedback(prefixText.shallowCopy().append(text), false); + source.sendFeedback(prefixText.copy().append(text), false); return true; } else { diff --git a/src/main/java/net/szum123321/textile_backup/commands/CommandExceptions.java b/src/main/java/net/szum123321/textile_backup/commands/CommandExceptions.java index 42accf0..3c31542 100644 --- a/src/main/java/net/szum123321/textile_backup/commands/CommandExceptions.java +++ b/src/main/java/net/szum123321/textile_backup/commands/CommandExceptions.java @@ -19,7 +19,7 @@ package net.szum123321.textile_backup.commands; import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; -import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import net.minecraft.text.MutableText; import java.time.format.DateTimeParseException; @@ -28,7 +28,7 @@ public class CommandExceptions { public static final DynamicCommandExceptionType DATE_TIME_PARSE_COMMAND_EXCEPTION_TYPE = new DynamicCommandExceptionType(o -> { DateTimeParseException e = (DateTimeParseException)o; - MutableText message = new LiteralText("An exception occurred while trying to parse:\n") + MutableText message = Text.literal("An exception occurred while trying to parse:\n") .append(e.getParsedString()) .append("\n"); diff --git a/src/main/java/net/szum123321/textile_backup/core/Utilities.java b/src/main/java/net/szum123321/textile_backup/core/Utilities.java index f02b901..8a5d466 100644 --- a/src/main/java/net/szum123321/textile_backup/core/Utilities.java +++ b/src/main/java/net/szum123321/textile_backup/core/Utilities.java @@ -18,11 +18,11 @@ package net.szum123321.textile_backup.core; -import net.minecraft.network.MessageType; +import net.minecraft.network.message.MessageType; import net.minecraft.server.MinecraftServer; import net.minecraft.server.world.ServerWorld; -import net.minecraft.text.LiteralText; import net.minecraft.text.MutableText; +import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.world.World; import net.szum123321.textile_backup.TextileBackup; @@ -32,6 +32,7 @@ import net.szum123321.textile_backup.config.ConfigPOJO; import net.szum123321.textile_backup.Statics; import net.szum123321.textile_backup.mixin.MinecraftServerSessionAccessor; import org.apache.commons.io.FileUtils; +import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.IOException; @@ -48,15 +49,11 @@ public class Utilities { private final static ConfigHelper config = ConfigHelper.INSTANCE; private final static TextileLogger log = new TextileLogger(TextileBackup.MOD_NAME); - public static void notifyPlayers(MinecraftServer server, UUID sender, String msg) { + public static void notifyPlayers(@NotNull MinecraftServer server, String msg) { MutableText message = log.getPrefixText(); - message.append(new LiteralText(msg).formatted(Formatting.WHITE)); + message.append(Text.literal(msg).formatted(Formatting.WHITE)); - server.getPlayerManager().broadcast( - message, - MessageType.SYSTEM, - sender - ); + server.getPlayerManager().broadcast(message, MessageType.SYSTEM); } public static String getLevelName(MinecraftServer server) { diff --git a/src/main/java/net/szum123321/textile_backup/core/create/BackupHelper.java b/src/main/java/net/szum123321/textile_backup/core/create/BackupHelper.java index 14efded..864f231 100644 --- a/src/main/java/net/szum123321/textile_backup/core/create/BackupHelper.java +++ b/src/main/java/net/szum123321/textile_backup/core/create/BackupHelper.java @@ -39,7 +39,6 @@ public class BackupHelper { public static Runnable create(BackupContext ctx) { if(config.get().broadcastBackupStart) { Utilities.notifyPlayers(ctx.getServer(), - ctx.getInitiatorUUID(), "Warning! Server backup will begin shortly. You may experience some lag." ); } else { diff --git a/src/main/java/net/szum123321/textile_backup/core/create/MakeBackupRunnable.java b/src/main/java/net/szum123321/textile_backup/core/create/MakeBackupRunnable.java index ba215cb..436b713 100644 --- a/src/main/java/net/szum123321/textile_backup/core/create/MakeBackupRunnable.java +++ b/src/main/java/net/szum123321/textile_backup/core/create/MakeBackupRunnable.java @@ -118,7 +118,6 @@ public class MakeBackupRunnable implements Runnable { if(config.get().broadcastBackupDone) { Utilities.notifyPlayers( context.getServer(), - context.getInitiatorUUID(), "Done!" ); } else { diff --git a/src/main/java/net/szum123321/textile_backup/core/restore/RestoreHelper.java b/src/main/java/net/szum123321/textile_backup/core/restore/RestoreHelper.java index 489b811..a55c1d9 100644 --- a/src/main/java/net/szum123321/textile_backup/core/restore/RestoreHelper.java +++ b/src/main/java/net/szum123321/textile_backup/core/restore/RestoreHelper.java @@ -59,7 +59,6 @@ public class RestoreHelper { Utilities.notifyPlayers( ctx.server(), - ctx.getInitiatorUUID(), "Warning! The server is going to shut down in " + config.get().restoreDelay + " seconds!" ); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 035ac64..c217d71 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -12,7 +12,8 @@ "1a2s3d4f1", "pm709", "Harveykang", - "66Leo66" + "66Leo66", + "IzzyBizzy45" ], "contact": { "homepage": "https://www.curseforge.com/minecraft/mc-mods/textile-backup", @@ -37,9 +38,9 @@ ], "depends": { - "fabricloader": ">=0.11", + "fabricloader": ">=0.14.6", "fabric": "*", - "minecraft": "1.18.*", + "minecraft": "~1.19", "cloth-config2": "*", "java": ">=16" },