--- 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 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 e = Maps.newHashMap(); + // CraftBukkit start + private final ResourceKey dimensionType; - public ConversionSession(String s) throws IOException { + public ConversionSession(String s, ResourceKey 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 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");