mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 01:17:44 +01:00
55 lines
2.2 KiB
Diff
55 lines
2.2 KiB
Diff
--- a/net/minecraft/server/Convertable.java
|
|
+++ b/net/minecraft/server/Convertable.java
|
|
@@ -175,8 +175,10 @@
|
|
};
|
|
}
|
|
|
|
- public Convertable.ConversionSession c(String s) throws IOException {
|
|
- return new Convertable.ConversionSession(s);
|
|
+ // CraftBukkit start
|
|
+ public Convertable.ConversionSession c(String s, ResourceKey<WorldDimension> dimensionType) throws IOException {
|
|
+ return new Convertable.ConversionSession(s, dimensionType);
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
public class ConversionSession implements AutoCloseable {
|
|
@@ -185,8 +187,12 @@
|
|
public final java.nio.file.Path folder;
|
|
private final String levelName;
|
|
private final Map<SavedFile, java.nio.file.Path> e = Maps.newHashMap();
|
|
+ // CraftBukkit start
|
|
+ private final ResourceKey<WorldDimension> dimensionType;
|
|
|
|
- public ConversionSession(String s) throws IOException {
|
|
+ public ConversionSession(String s, ResourceKey<WorldDimension> dimensionType) throws IOException {
|
|
+ this.dimensionType = dimensionType;
|
|
+ // CraftBukkit end
|
|
this.levelName = s;
|
|
this.folder = Convertable.this.universe.resolve(s);
|
|
this.lock = SessionLock.a(this.folder);
|
|
@@ -203,9 +209,23 @@
|
|
}
|
|
|
|
public File a(ResourceKey<World> resourcekey) {
|
|
- return DimensionManager.a(resourcekey, this.folder.toFile());
|
|
+ // CraftBukkit start
|
|
+ return this.getFolder(this.folder.toFile());
|
|
}
|
|
|
|
+ private File getFolder(File file) {
|
|
+ if (dimensionType == WorldDimension.OVERWORLD) {
|
|
+ return file;
|
|
+ } else if (dimensionType == WorldDimension.THE_NETHER) {
|
|
+ return new File(file, "DIM-1");
|
|
+ } else if (dimensionType == WorldDimension.THE_END) {
|
|
+ return new File(file, "DIM1");
|
|
+ } else {
|
|
+ throw new IllegalArgumentException("Unknwon dimension " + this.dimensionType);
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
private void checkSession() {
|
|
if (!this.lock.a()) {
|
|
throw new IllegalStateException("Lock is no longer valid");
|