3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-20 21:40:06 +01:00
Paper/nms-patches/Convertable.patch

80 Zeilen
4.1 KiB
Diff

2020-06-25 02:00:00 +02:00
--- a/net/minecraft/server/Convertable.java
+++ b/net/minecraft/server/Convertable.java
2020-08-11 23:00:00 +02:00
@@ -73,21 +73,21 @@
Logger logger1 = Convertable.LOGGER;
logger1.getClass();
- IRegistry<DimensionManager> iregistry = (IRegistry) dataresult1.resultOrPartial(SystemUtils.a("Dimension type registry: ", logger1::error)).orElseThrow(() -> {
+ IRegistry<DimensionManager> iregistry = (IRegistry) ((DataResult<IRegistry<DimensionManager>>) dataresult1).resultOrPartial(SystemUtils.a("Dimension type registry: ", logger1::error)).orElseThrow(() -> { // CraftBukkit - decompile error
return new IllegalStateException("Failed to get dimension registry");
});
dataresult1 = RegistryLookupCodec.a(IRegistry.ay).codec().parse(dynamic2);
logger1 = Convertable.LOGGER;
logger1.getClass();
- IRegistry<BiomeBase> iregistry1 = (IRegistry) dataresult1.resultOrPartial(SystemUtils.a("Biome registry: ", logger1::error)).orElseThrow(() -> {
+ IRegistry<BiomeBase> iregistry1 = (IRegistry) ((DataResult<IRegistry<BiomeBase>>) dataresult1).resultOrPartial(SystemUtils.a("Biome registry: ", logger1::error)).orElseThrow(() -> { // CraftBukkit - decompile error
return new IllegalStateException("Failed to get biome registry");
});
dataresult1 = RegistryLookupCodec.a(IRegistry.ar).codec().parse(dynamic2);
logger1 = Convertable.LOGGER;
logger1.getClass();
- IRegistry<GeneratorSettingBase> iregistry2 = (IRegistry) dataresult1.resultOrPartial(SystemUtils.a("Noise settings registry: ", logger1::error)).orElseThrow(() -> {
+ IRegistry<GeneratorSettingBase> iregistry2 = (IRegistry) ((DataResult<IRegistry<GeneratorSettingBase>>) dataresult1).resultOrPartial(SystemUtils.a("Noise settings registry: ", logger1::error)).orElseThrow(() -> { // CraftBukkit - decompile error
return new IllegalStateException("Failed to get noise settings registry");
});
@@ -195,8 +195,10 @@
2020-06-25 02:00:00 +02:00
};
}
- 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 {
2020-08-11 23:00:00 +02:00
@@ -205,8 +207,12 @@
2020-06-25 02:00:00 +02:00
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);
2020-08-11 23:00:00 +02:00
@@ -223,9 +229,23 @@
2020-06-25 02:00:00 +02:00
}
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");