mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
refactor: Fabric 1.20.4, Sponge API v10, Java 17, Platform APIs (#562)
* deps: bump dependencies * refactor: bukkit 1.17.1, Sponge v10, fabric 1.20.4 * refactor: release platform-specific API modules * fix: checkstyle javadoc comment * docs: update API docs * docs: mention API platforms in events api docs
This commit is contained in:
1 parent
c0e079c46c
commit
f8ad215b76
24 files changed
+227
-159
No files matched your search
@@ -25,7 +25,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.api.ResourceKey;
|
||||
import org.spongepowered.api.Sponge;
|
||||
import org.spongepowered.api.world.WorldTypeTemplate;
|
||||
import org.spongepowered.api.registry.DefaultedRegistryType;
|
||||
import org.spongepowered.api.world.WorldType;
|
||||
import org.spongepowered.api.world.WorldTypes;
|
||||
import org.spongepowered.api.world.server.ServerLocation;
|
||||
import org.spongepowered.api.world.server.ServerWorld;
|
||||
import org.spongepowered.api.world.server.WorldManager;
|
||||
@@ -75,13 +77,18 @@ public final class SpongeAdapter {
|
||||
if (world == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
final String worldType = world.properties().worldType().asTemplate().key().asString();
|
||||
|
||||
// Get the world type from the world properties
|
||||
final DefaultedRegistryType<WorldType> registry = WorldTypes.registry().type().asDefaultedType(world::engine);
|
||||
return Optional.of(World.from(
|
||||
world.key().toString(), world.uniqueId(),
|
||||
(worldType.equals(WorldTypeTemplate.theNether().key().toString()) ? World.Environment.NETHER
|
||||
: worldType.equals(WorldTypeTemplate.theEnd().key().toString()) ? World.Environment.THE_END
|
||||
: worldType.equals(WorldTypeTemplate.overworld().key().toString()) ? World.Environment.OVERWORLD
|
||||
: World.Environment.CUSTOM)
|
||||
world.key().toString(),
|
||||
world.uniqueId(),
|
||||
switch (world.properties().worldType().key(registry).asString()) {
|
||||
case "minecraft:overworld" -> World.Environment.OVERWORLD;
|
||||
case "minecraft:the_nether" -> World.Environment.NETHER;
|
||||
case "minecraft:the_end" -> World.Environment.THE_END;
|
||||
default -> World.Environment.CUSTOM;
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user