Backportat latest changes from master
This commit is contained in:
parent
9183293329
commit
53911dfe91
63 changed files with 1002 additions and 351 deletions
|
@ -32,6 +32,7 @@ import ru.bclib.util.Logger;
|
|||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -570,6 +571,9 @@ public class DataFixerAPI {
|
|||
private static List<File> getAllPlayers(File dir) {
|
||||
List<File> list = new ArrayList<>();
|
||||
dir = new File(dir, "playerdata");
|
||||
if (!dir.exists() || !dir.isDirectory()) {
|
||||
return list;
|
||||
}
|
||||
for (File file : dir.listFiles()) {
|
||||
if (file.isFile() && file.getName().endsWith(".dat")) {
|
||||
list.add(file);
|
||||
|
@ -604,7 +608,7 @@ public class DataFixerAPI {
|
|||
private static CompoundTag readNbt(File file) throws IOException {
|
||||
try {
|
||||
return NbtIo.readCompressed(file);
|
||||
} catch (ZipException e){
|
||||
} catch (ZipException | EOFException e){
|
||||
return NbtIo.read(file);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package ru.bclib.api.datafixer;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import ru.bclib.interfaces.PatchBiFunction;
|
||||
import ru.bclib.interfaces.PatchFunction;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
|
@ -7,6 +7,8 @@ import net.minecraft.nbt.Tag;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
import ru.bclib.BCLib;
|
||||
import ru.bclib.api.WorldDataAPI;
|
||||
import ru.bclib.interfaces.PatchBiFunction;
|
||||
import ru.bclib.interfaces.PatchFunction;
|
||||
import ru.bclib.util.ModUtil;
|
||||
|
||||
import java.io.File;
|
||||
|
|
|
@ -3,6 +3,8 @@ package ru.bclib.api.datafixer;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import ru.bclib.interfaces.PatchBiFunction;
|
||||
import ru.bclib.interfaces.PatchFunction;
|
||||
import ru.bclib.util.ModUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
package ru.bclib.api.datafixer;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface PatchBiFunction<U, V, R> {
|
||||
R apply(U t, V v, MigrationProfile profile) throws PatchDidiFailException;
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package ru.bclib.api.datafixer;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface PatchFunction<T, R> {
|
||||
R apply(T t, MigrationProfile profile) throws PatchDidiFailException;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue