118 lines
5.2 KiB
Diff
118 lines
5.2 KiB
Diff
--- a/net/minecraft/world/level/storage/Convertable.java
|
|
+++ b/net/minecraft/world/level/storage/Convertable.java
|
|
@@ -80,6 +80,10 @@
|
|
import net.minecraft.world.level.validation.PathAllowList;
|
|
import org.slf4j.Logger;
|
|
|
|
+// CraftBukkit start
|
|
+import net.minecraft.world.level.dimension.WorldDimension;
|
|
+// CraftBukkit end
|
|
+
|
|
public class Convertable {
|
|
|
|
static final Logger LOGGER = LogUtils.getLogger();
|
|
@@ -169,7 +173,7 @@
|
|
}
|
|
|
|
private static WorldDataConfiguration readDataConfig(Dynamic<?> dynamic) {
|
|
- DataResult dataresult = WorldDataConfiguration.CODEC.parse(dynamic);
|
|
+ DataResult<WorldDataConfiguration> dataresult = WorldDataConfiguration.CODEC.parse(dynamic); // CraftBukkit - decompile error
|
|
Logger logger = Convertable.LOGGER;
|
|
|
|
Objects.requireNonNull(logger);
|
|
@@ -185,7 +189,7 @@
|
|
throw new LevelStorageException(IChatBaseComponent.translatable("selectWorld.load_folder_access"));
|
|
} else {
|
|
try {
|
|
- Stream stream = Files.list(this.baseDir);
|
|
+ Stream<Path> stream = Files.list(this.baseDir); // CraftBukkit - decompile error
|
|
|
|
Convertable.a convertable_a;
|
|
|
|
@@ -343,6 +347,7 @@
|
|
WorldDimensions.b worlddimensions_b = generatorsettings.dimensions().bake(iregistry);
|
|
Lifecycle lifecycle1 = worlddimensions_b.lifecycle().add(lifecycle);
|
|
WorldDataServer worlddataserver = WorldDataServer.parse(dynamic, datafixer, i, nbttagcompound2, worldsettings, levelversion, worlddimensions_b.specialWorldProperty(), generatorsettings.options(), lifecycle1);
|
|
+ worlddataserver.pdc = nbttagcompound1.get("BukkitValues"); // CraftBukkit - Add PDC to world
|
|
|
|
return Pair.of(worlddataserver, worlddimensions_b);
|
|
};
|
|
@@ -441,27 +446,41 @@
|
|
return this.backupDir;
|
|
}
|
|
|
|
- public Convertable.ConversionSession validateAndCreateAccess(String s) throws IOException, ContentValidationException {
|
|
+ public Convertable.ConversionSession validateAndCreateAccess(String s, ResourceKey<WorldDimension> dimensionType) throws IOException, ContentValidationException { // CraftBukkit
|
|
Path path = this.getLevelPath(s);
|
|
List<ForbiddenSymlinkInfo> list = this.worldDirValidator.validateDirectory(path, true);
|
|
|
|
if (!list.isEmpty()) {
|
|
throw new ContentValidationException(path, list);
|
|
} else {
|
|
- return new Convertable.ConversionSession(s, path);
|
|
+ return new Convertable.ConversionSession(s, path, dimensionType); // CraftBukkit
|
|
}
|
|
}
|
|
|
|
- public Convertable.ConversionSession createAccess(String s) throws IOException {
|
|
+ public Convertable.ConversionSession createAccess(String s, ResourceKey<WorldDimension> dimensionType) throws IOException { // CraftBukkit
|
|
Path path = this.getLevelPath(s);
|
|
|
|
- return new Convertable.ConversionSession(s, path);
|
|
+ return new Convertable.ConversionSession(s, path, dimensionType); // CraftBukkit
|
|
}
|
|
|
|
public DirectoryValidator getWorldDirValidator() {
|
|
return this.worldDirValidator;
|
|
}
|
|
|
|
+ // CraftBukkit start
|
|
+ public static Path getStorageFolder(Path path, ResourceKey<WorldDimension> dimensionType) {
|
|
+ if (dimensionType == WorldDimension.OVERWORLD) {
|
|
+ return path;
|
|
+ } else if (dimensionType == WorldDimension.NETHER) {
|
|
+ return path.resolve("DIM-1");
|
|
+ } else if (dimensionType == WorldDimension.END) {
|
|
+ return path.resolve("DIM1");
|
|
+ } else {
|
|
+ return path.resolve("dimensions").resolve(dimensionType.location().getNamespace()).resolve(dimensionType.location().getPath());
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
public static record a(List<Convertable.b> levels) implements Iterable<Convertable.b> {
|
|
|
|
public boolean isEmpty() {
|
|
@@ -513,8 +532,12 @@
|
|
public final Convertable.b levelDirectory;
|
|
private final String levelId;
|
|
private final Map<SavedFile, Path> resources = Maps.newHashMap();
|
|
+ // CraftBukkit start
|
|
+ public final ResourceKey<WorldDimension> dimensionType;
|
|
|
|
- ConversionSession(String s, Path path) throws IOException {
|
|
+ ConversionSession(String s, Path path, ResourceKey<WorldDimension> dimensionType) throws IOException {
|
|
+ this.dimensionType = dimensionType;
|
|
+ // CraftBukkit end
|
|
this.levelId = s;
|
|
this.levelDirectory = new Convertable.b(path);
|
|
this.lock = SessionLock.create(path);
|
|
@@ -529,7 +552,7 @@
|
|
}
|
|
|
|
public Path getLevelPath(SavedFile savedfile) {
|
|
- Map map = this.resources;
|
|
+ Map<SavedFile, Path> map = this.resources; // CraftBukkit - decompile error
|
|
Convertable.b convertable_b = this.levelDirectory;
|
|
|
|
Objects.requireNonNull(this.levelDirectory);
|
|
@@ -537,7 +560,7 @@
|
|
}
|
|
|
|
public Path getDimensionPath(ResourceKey<World> resourcekey) {
|
|
- return DimensionManager.getStorageFolder(resourcekey, this.levelDirectory.path());
|
|
+ return getStorageFolder(this.levelDirectory.path(), this.dimensionType); // CraftBukkit
|
|
}
|
|
|
|
private void checkLock() {
|