|
15 | 15 | * Represents various types of options that may be used to create a world. |
16 | 16 | */ |
17 | 17 | public class WorldCreator { |
18 | | - private final NamespacedKey key; // Paper |
| 18 | + private final NamespacedKey key; |
19 | 19 | private final String name; |
20 | 20 | private long seed; |
21 | 21 | private World.Environment environment = World.Environment.NORMAL; |
| 22 | + private @Nullable NamespacedKey customEnvironmentKey = null; |
22 | 23 | private ChunkGenerator generator = null; |
23 | 24 | private BiomeProvider biomeProvider = null; |
24 | 25 | private WorldType type = WorldType.NORMAL; |
@@ -173,6 +174,7 @@ public WorldCreator copy(@NotNull WorldCreator creator) { |
173 | 174 |
|
174 | 175 | seed = creator.seed(); |
175 | 176 | environment = creator.environment(); |
| 177 | + customEnvironmentKey = creator.customEnvironmentKey(); |
176 | 178 | generator = creator.generator(); |
177 | 179 | biomeProvider = creator.biomeProvider(); |
178 | 180 | type = creator.type(); |
@@ -243,6 +245,30 @@ public WorldCreator environment(@NotNull World.Environment env) { |
243 | 245 | return this; |
244 | 246 | } |
245 | 247 |
|
| 248 | + /** |
| 249 | + * Gets the environment key that will be used to create or load the world |
| 250 | + * if {@link #environment()} is {@link World.Environment#CUSTOM CUSTOM}. |
| 251 | + * |
| 252 | + * @return World environment key |
| 253 | + */ |
| 254 | + public @Nullable NamespacedKey customEnvironmentKey() { |
| 255 | + return this.customEnvironmentKey; |
| 256 | + } |
| 257 | + |
| 258 | + /** |
| 259 | + * Sets the environment key that will be used to create or load the world and |
| 260 | + * set the environment to {@link World.Environment#CUSTOM CUSTOM}. |
| 261 | + * |
| 262 | + * @param customEnvironmentKey World environment key |
| 263 | + * @return This object, for chaining |
| 264 | + */ |
| 265 | + public @NotNull WorldCreator customEnvironmentKey(@Nullable NamespacedKey customEnvironmentKey) { |
| 266 | + this.environment = World.Environment.CUSTOM; |
| 267 | + this.customEnvironmentKey = customEnvironmentKey; |
| 268 | + |
| 269 | + return this; |
| 270 | + } |
| 271 | + |
246 | 272 | /** |
247 | 273 | * Gets the type of the world that will be created or loaded |
248 | 274 | * |
|
0 commit comments