20w19a update

This commit is contained in:
Szum123321 2020-05-08 22:35:12 +02:00
parent d4f38b2ebe
commit c8c370cec0
6 changed files with 36 additions and 12 deletions

View File

@ -1,12 +1,12 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
minecraft_version=1.15.2
yarn_mappings=1.15.2+build.15
minecraft_version=20w19a
yarn_mappings=20w19a+build.6
loader_version=0.8.2+build.194
#Fabric api
fabric_version=0.5.1+build.294-1.15
fabric_version=0.10.7+build.344-1.16
# Mod Properties
mod_version = 1.2.0-1.15

View File

@ -21,8 +21,8 @@ package net.szum123321.textile_backup.commands;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.world.dimension.DimensionType;
import net.szum123321.textile_backup.core.BackupHelper;
import net.szum123321.textile_backup.core.Utilities;
public class CleanupCommand {
public static LiteralArgumentBuilder<ServerCommandSource> register(){
@ -31,7 +31,8 @@ public class CleanupCommand {
}
private static int execute(ServerCommandSource source){
BackupHelper.executeFileLimit(source, source.getMinecraftServer().getWorld(DimensionType.OVERWORLD).getLevelProperties().getLevelName());
BackupHelper.executeFileLimit(source, Utilities.getLevelName(source.getMinecraftServer()));
return 1;
}

View File

@ -18,6 +18,7 @@
package net.szum123321.textile_backup.core;
import net.minecraft.class_5218;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.world.dimension.DimensionType;
@ -25,6 +26,7 @@ import net.szum123321.textile_backup.TextileBackup;
import net.szum123321.textile_backup.core.compressors.GenericTarCompressor;
import net.szum123321.textile_backup.core.compressors.ParallelBZip2Compressor;
import net.szum123321.textile_backup.core.compressors.ParallelZipCompressor;
import net.szum123321.textile_backup.mixin.MinecraftServerSessionAccessor;
import org.anarres.parallelgzip.ParallelGZIPOutputStream;
import org.apache.commons.compress.compressors.xz.XZCompressorOutputStream;
import org.at4j.comp.bzip2.BZip2OutputStream;
@ -46,13 +48,12 @@ public class MakeBackupThread implements Runnable {
@Override
public void run() {
File world = server
.getWorld(DimensionType.OVERWORLD)
.getSaveHandler()
.getWorldDir();
File world = ((MinecraftServerSessionAccessor)server)
.getSession()
.getDirectory(class_5218.field_24188).toFile();
File outFile = BackupHelper
.getBackupRootPath(server.getWorld(DimensionType.OVERWORLD).getLevelProperties().getLevelName())
.getBackupRootPath(Utilities.getLevelName(server))
.toPath()
.resolve(getFileName())
.toFile();
@ -89,7 +90,7 @@ public class MakeBackupThread implements Runnable {
break;
}
BackupHelper.executeFileLimit(ctx, server.getWorld(DimensionType.OVERWORLD).getLevelProperties().getLevelName());
BackupHelper.executeFileLimit(ctx, Utilities.getLevelName(server));
Utilities.log("Done!", ctx);
}

View File

@ -1,13 +1,22 @@
package net.szum123321.textile_backup.core;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.dedicated.MinecraftDedicatedServer;
import net.minecraft.server.integrated.IntegratedServer;
import net.minecraft.text.LiteralText;
import net.szum123321.textile_backup.TextileBackup;
import net.szum123321.textile_backup.mixin.MinecraftServerSessionAccessor;
import java.nio.file.Path;
import java.time.format.DateTimeFormatter;
public class Utilities {
public static String getLevelName(MinecraftServer server) {
return ((MinecraftServerSessionAccessor)server).getSession().readLevelProperties().getLevelName();
}
public static boolean isWindows(){
String os = System.getProperty("os.name");
return os.toLowerCase().startsWith("win");

View File

@ -0,0 +1,12 @@
package net.szum123321.textile_backup.mixin;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.level.storage.LevelStorage;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(MinecraftServer.class)
public interface MinecraftServerSessionAccessor {
@Accessor
LevelStorage.Session getSession();
}

View File

@ -3,7 +3,8 @@
"package": "net.szum123321.textile_backup.mixin",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MinecraftServerMixin"
"MinecraftServerMixin",
"MinecraftServerSessionAccessor"
],
"client": [
],