1.19 Changes

This commit is contained in:
IzzyBizzy 2022-06-10 14:08:46 +10:00
parent 18b7c2b9ae
commit d0ffab9339
10 changed files with 32 additions and 37 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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.<ServerCommandSource>literal("backup")
.requires((ctx) -> {
try {

View File

@ -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 {

View File

@ -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");

View File

@ -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) {

View File

@ -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 {

View File

@ -118,7 +118,6 @@ public class MakeBackupRunnable implements Runnable {
if(config.get().broadcastBackupDone) {
Utilities.notifyPlayers(
context.getServer(),
context.getInitiatorUUID(),
"Done!"
);
} else {

View File

@ -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!"
);

View File

@ -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"
},