|
9 | 9 | return Pair.of(primaryleveldata, worlddimensions$complete);
|
10 | 10 | };
|
11 | 11 | }
|
12 |
| -@@ -334,24 +_,46 @@ |
| 12 | +@@ -334,24 +_,52 @@ |
13 | 13 | }
|
14 | 14 |
|
15 | 15 | public LevelStorageSource.LevelStorageAccess validateAndCreateAccess(String p_289980_) throws IOException, ContentValidationException {
|
|
26 | 26 | + return new LevelStorageSource.LevelStorageAccess(p_289980_, path, dimensionType); // CraftBukkit
|
27 | 27 | }
|
28 | 28 | }
|
| 29 | ++ |
| 30 | ++ //Ketting start - try merging both world systems |
| 31 | ++ public LevelStorageSource.LevelStorageAccess deriveFromSource(LevelStorageSource.LevelStorageAccess source, ResourceKey<LevelStem> dimensionType) throws IOException { |
| 32 | ++ return new LevelStorageSource.LevelStorageAccess(source, dimensionType); |
| 33 | ++ } |
| 34 | ++ //Ketting end |
29 | 35 |
|
30 | 36 | public LevelStorageSource.LevelStorageAccess createAccess(String p_78261_) throws IOException {
|
31 | 37 | + return this.createAccess(p_78261_, null);
|
|
58 | 64 | public static record LevelCandidates(List<LevelStorageSource.LevelDirectory> levels) implements Iterable<LevelStorageSource.LevelDirectory> {
|
59 | 65 | public boolean isEmpty() {
|
60 | 66 | return this.levels.isEmpty();
|
61 |
| -@@ -397,8 +_,18 @@ |
| 67 | +@@ -397,9 +_,34 @@ |
62 | 68 | public final LevelStorageSource.LevelDirectory levelDirectory;
|
63 | 69 | private final String levelId;
|
64 | 70 | private final Map<LevelResource, Path> resources = Maps.newHashMap();
|
|
68 | 74 | + public ResourceKey<LevelStem> dimensionType;
|
69 | 75 | +
|
70 | 76 | + //Ketting start
|
| 77 | ++ public final Path dimensionPath; |
| 78 | ++ |
71 | 79 | + public void setDimensionType(ResourceKey<LevelStem> dimensionType) {
|
72 | 80 | + this.dimensionType = dimensionType;
|
73 | 81 | + }
|
74 | 82 | + //Ketting end
|
75 | 83 | +
|
| 84 | ++ //Ketting start |
| 85 | ++ LevelStorageAccess(LevelStorageAccess original, ResourceKey<LevelStem> dimensionType) { |
| 86 | ++ this.dimensionType = dimensionType; |
| 87 | ++ |
| 88 | ++ this.levelId = original.levelId; |
| 89 | ++ this.dimensionPath = original.dimensionPath; |
| 90 | ++ this.levelDirectory = original.levelDirectory; |
| 91 | ++ this.lock = original.lock; |
| 92 | ++ this.resources.putAll(original.resources); |
| 93 | ++ } |
| 94 | ++ //Ketting end |
| 95 | ++ |
76 | 96 | + LevelStorageAccess(String p_289967_, Path p_289988_, ResourceKey<LevelStem> dimensionType) throws IOException {
|
77 | 97 | + this.dimensionType = dimensionType;
|
78 | 98 | + // CraftBukkit end
|
79 | 99 | this.levelId = p_289967_;
|
| 100 | ++ this.dimensionPath = p_289988_; //Ketting |
80 | 101 | this.levelDirectory = new LevelStorageSource.LevelDirectory(p_289988_);
|
81 | 102 | this.lock = DirectoryLock.create(p_289988_);
|
| 103 | + } |
82 | 104 | @@ -413,7 +_,7 @@
|
83 | 105 | }
|
84 | 106 |
|
|
117 | 139 | try {
|
118 | 140 | File file2 = File.createTempFile("level", ".dat", file1);
|
119 | 141 | NbtIo.writeCompressed(compoundtag1, file2);
|
120 |
| -@@ -469,6 +_,10 @@ |
121 |
| - |
122 |
| - public Optional<Path> getIconFile() { |
| 142 | +@@ -471,6 +_,10 @@ |
123 | 143 | return !this.lock.isValid() ? Optional.empty() : Optional.of(this.levelDirectory.iconFile());
|
124 |
| -+ } |
125 |
| -+ |
126 |
| -+ public Path getWorldDir() { |
127 |
| -+ return baseDir; |
128 | 144 | }
|
129 | 145 |
|
| 146 | ++ public Path getWorldDir() { |
| 147 | ++ return baseDir; |
| 148 | ++ } |
| 149 | ++ |
130 | 150 | public void deleteLevel() throws IOException {
|
| 151 | + this.checkLock(); |
| 152 | + final Path path = this.levelDirectory.lockFile(); |
| 153 | +@@ -569,6 +_,12 @@ |
| 154 | + |
| 155 | + public void close() throws IOException { |
| 156 | + this.lock.close(); |
| 157 | ++ } |
| 158 | ++ |
| 159 | ++ //Ketting start |
| 160 | ++ public @Nullable LevelStorageSource reference; |
| 161 | ++ public void setReference(LevelStorageSource levelstoragesource) { |
| 162 | ++ this.reference = levelstoragesource; |
| 163 | + } |
| 164 | + } |
| 165 | + } |
0 commit comments