Update sponge implementation to API 10.0.0

This commit is contained in:
Lukas Rieger (Blue) 2024-06-11 16:17:22 +02:00
parent 5c4fa6d71a
commit ad3c8fec60
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6
2 changed files with 9 additions and 14 deletions

View File

@ -6,7 +6,7 @@ plugins {
id("com.diffplug.spotless") version "6.1.2"
id ("com.github.node-gradle.node") version "3.0.1"
id ("com.github.johnrengelman.shadow") version "8.1.1"
id ("org.spongepowered.gradle.plugin") version "2.0.0"
id ("org.spongepowered.gradle.plugin") version "2.2.0"
id ("com.modrinth.minotaur") version "2.+"
id("org.spongepowered.gradle.ore") version "2.2.0"
}
@ -14,11 +14,7 @@ plugins {
group = "de.bluecolored.bluemap"
version = System.getProperty("bluemap.version") ?: "?" // set by BlueMapCore
val javaTarget = 16
java {
sourceCompatibility = JavaVersion.toVersion(javaTarget)
targetCompatibility = JavaVersion.toVersion(javaTarget)
}
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
repositories {
mavenCentral()
@ -42,7 +38,7 @@ dependencies {
}
sponge {
apiVersion("8.2.0")
apiVersion("10.0.0")
license("MIT")
loader {
name(PluginLoaders.JAVA_PLAIN)
@ -56,7 +52,7 @@ sponge {
description("Lead Developer")
}
dependency("spongeapi") {
version("8.2.0")
version("10.0.0")
optional(false)
}
}
@ -135,7 +131,7 @@ modrinth {
.replace("{version}", project.version.toString()))
uploadFile.set(tasks.findByName("shadowJar"))
loaders.addAll("sponge")
gameVersions.addAll("1.16.5")
gameVersions.addAll("1.19.2", "1.19.3", "1.19.4")
}
tasks.register("publish") {

View File

@ -37,6 +37,7 @@
import org.spongepowered.api.entity.living.player.gamemode.GameMode;
import org.spongepowered.api.entity.living.player.gamemode.GameModes;
import org.spongepowered.api.entity.living.player.server.ServerPlayer;
import org.spongepowered.api.world.LightTypes;
import java.util.*;
@ -48,7 +49,6 @@ public class SpongePlayer implements Player {
GAMEMODE_MAP.put(GameModes.SURVIVAL.get(), Gamemode.SURVIVAL);
GAMEMODE_MAP.put(GameModes.CREATIVE.get(), Gamemode.CREATIVE);
GAMEMODE_MAP.put(GameModes.SPECTATOR.get(), Gamemode.SPECTATOR);
GAMEMODE_MAP.put(GameModes.NOT_SET.get(), Gamemode.SURVIVAL);
}
private final UUID uuid;
@ -130,7 +130,7 @@ public void update() {
ServerPlayer player = Sponge.server().player(uuid).orElse(null);
if (player == null) return;
this.gamemode = GAMEMODE_MAP.get(player.get(Keys.GAME_MODE).orElse(GameModes.NOT_SET.get()));
this.gamemode = GAMEMODE_MAP.get(player.gameMode().get());
if (this.gamemode == null) this.gamemode = Gamemode.SURVIVAL;
boolean invis = false;
@ -149,9 +149,8 @@ public void update() {
this.rotation = SpongePlugin.fromSpongePoweredVector(player.rotation());
this.sneaking = player.get(Keys.IS_SNEAKING).orElse(false);
// not implemented in sponge
this.skyLight = 15; //player.world().light(LightTypes.SKY, player.blockPosition());
this.blockLight = 0; //player.world().light(LightTypes.BLOCK, player.blockPosition());
this.skyLight = player.world().light(LightTypes.SKY, player.blockPosition());
this.blockLight = player.world().light(LightTypes.BLOCK, player.blockPosition());
this.world = SpongePlugin.getInstance().getServerWorld(player.world());
}