Fixed build issues in MigrationProfile
This commit is contained in:
parent
c0f5db13c0
commit
1e492f7e83
1 changed files with 9 additions and 7 deletions
|
@ -6,13 +6,11 @@ import org.betterx.bclib.interfaces.PatchFunction;
|
||||||
import org.betterx.worlds.together.util.ModUtil;
|
import org.betterx.worlds.together.util.ModUtil;
|
||||||
import org.betterx.worlds.together.world.WorldConfig;
|
import org.betterx.worlds.together.world.WorldConfig;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.*;
|
||||||
import net.minecraft.nbt.ListTag;
|
|
||||||
import net.minecraft.nbt.NbtIo;
|
|
||||||
import net.minecraft.nbt.Tag;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -87,7 +85,7 @@ public class MigrationProfile {
|
||||||
nbts.parallelStream().forEach((file) -> {
|
nbts.parallelStream().forEach((file) -> {
|
||||||
DataFixerAPI.LOGGER.info("Loading NBT " + file);
|
DataFixerAPI.LOGGER.info("Loading NBT " + file);
|
||||||
try {
|
try {
|
||||||
CompoundTag root = NbtIo.readCompressed(file);
|
CompoundTag root = NbtIo.readCompressed(file.toPath(), NbtAccounter.unlimitedHeap());
|
||||||
boolean[] changed = {false};
|
boolean[] changed = {false};
|
||||||
int spawnerIdx = -1;
|
int spawnerIdx = -1;
|
||||||
if (root.contains("palette")) {
|
if (root.contains("palette")) {
|
||||||
|
@ -155,7 +153,7 @@ public class MigrationProfile {
|
||||||
|
|
||||||
if (changed[0]) {
|
if (changed[0]) {
|
||||||
DataFixerAPI.LOGGER.info("Writing NBT " + file);
|
DataFixerAPI.LOGGER.info("Writing NBT " + file);
|
||||||
NbtIo.writeCompressed(root, file);
|
NbtIo.writeCompressed(root, file.toPath());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -192,6 +190,10 @@ public class MigrationProfile {
|
||||||
return new File(levelBaseDir, "level.dat");
|
return new File(levelBaseDir, "level.dat");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final public Path getLevelDatPath() {
|
||||||
|
return getLevelDatFile().toPath();
|
||||||
|
}
|
||||||
|
|
||||||
final public Exception getPrePatchException() {
|
final public Exception getPrePatchException() {
|
||||||
return prePatchException;
|
return prePatchException;
|
||||||
}
|
}
|
||||||
|
@ -213,7 +215,7 @@ public class MigrationProfile {
|
||||||
|
|
||||||
private boolean runPreLevelPatches(File levelDat) {
|
private boolean runPreLevelPatches(File levelDat) {
|
||||||
try {
|
try {
|
||||||
level = NbtIo.readCompressed(levelDat);
|
level = NbtIo.readCompressed(levelDat.toPath(), NbtAccounter.unlimitedHeap());
|
||||||
|
|
||||||
boolean changed = patchLevelDat(level);
|
boolean changed = patchLevelDat(level);
|
||||||
return changed;
|
return changed;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue