From c5821197b1d841f0b24a864ef59da5f7649b3a37 Mon Sep 17 00:00:00 2001 From: Octavia Togami Date: Tue, 22 Oct 2024 22:09:33 -0700 Subject: [PATCH] [Sponge] 1.21.2 --- gradle/libs.versions.toml | 9 +++++---- worldedit-sponge/build.gradle.kts | 8 ++++---- .../sk89q/worldedit/sponge/SpongeEntityProperties.java | 4 ++-- .../com/sk89q/worldedit/sponge/SpongeItemRegistry.java | 10 +++++++--- .../java/com/sk89q/worldedit/sponge/SpongeWorld.java | 4 ++-- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0f25398549..0465076cbb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -15,17 +15,17 @@ fabric-api = "0.106.1+1.21.2" neogradle = "7.0.165" neoforge-minecraft = "1.21.2" -sponge-minecraft = "1.21" +sponge-minecraft = "1.21.2" # https://repo.spongepowered.org/service/rest/repository/browse/maven-public/org/spongepowered/spongeapi/ -sponge-api = "12.0.0-20240616.151530-3" -sponge-api-major = "12" +sponge-api = "13.0.0-20241022.030956-1" +sponge-api-major = "13" # https://parchmentmc.org/docs/getting-started; note that we use older MC versions some times which is OK parchment-minecraft = "1.21" parchment-mappings = "2024.07.28" # https://repo.spongepowered.org/service/rest/repository/browse/maven-public/org/spongepowered/vanillagradle/ -sponge-vanillagradle = "0.2.1-20240617.053350-83" +sponge-vanillagradle = "0.2.1-20241006.183638-89" # Minimum versions we apply to make dependencies support newer Java minimumAsm = "9.7" @@ -81,6 +81,7 @@ paperLib = "io.papermc:paperlib:1.0.8" dummypermscompat = "com.sk89q:dummypermscompat:1.10" bstats-bukkit = "org.bstats:bstats-bukkit:2.2.1" +bstats-sponge = "org.bstats:bstats-sponge:3.0.0" trueZip = "de.schlichtherle:truezip:6.8.4" rhino = "org.mozilla:rhino-runtime:1.7.13" diff --git a/worldedit-sponge/build.gradle.kts b/worldedit-sponge/build.gradle.kts index 56518fa73b..420720dca9 100644 --- a/worldedit-sponge/build.gradle.kts +++ b/worldedit-sponge/build.gradle.kts @@ -63,13 +63,13 @@ dependencies { "api"(project(":worldedit-core")) "api"(project(":worldedit-libs:sponge")) - "api"("org.apache.logging.log4j:log4j-api") - "implementation"("org.bstats:bstats-sponge:3.0.0") - "implementation"("it.unimi.dsi:fastutil") + "api"(libs.log4j.api) + "implementation"(libs.bstats.sponge) + "implementation"(libs.fastutil) "testImplementation"(libs.mockito.core) // Silence some warnings, since apparently this isn't on the compile classpath like it should be. - "compileOnly"("com.google.errorprone:error_prone_annotations:2.11.0") + "compileOnly"(libs.errorprone.annotations) } configure { diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntityProperties.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntityProperties.java index f7b0269a7f..7cc4774c6c 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntityProperties.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntityProperties.java @@ -37,10 +37,10 @@ import org.spongepowered.api.entity.living.aquatic.Aquatic; import org.spongepowered.api.entity.living.golem.Golem; import org.spongepowered.api.entity.living.player.Player; -import org.spongepowered.api.entity.living.trader.Trader; import org.spongepowered.api.entity.projectile.Projectile; import org.spongepowered.api.entity.vehicle.Boat; import org.spongepowered.api.entity.vehicle.minecart.Minecart; +import org.spongepowered.api.item.merchant.Merchant; import static com.google.common.base.Preconditions.checkNotNull; @@ -120,7 +120,7 @@ public boolean isAmbient() { @Override public boolean isNPC() { - return entity instanceof Trader; + return entity instanceof Merchant; } @Override diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeItemRegistry.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeItemRegistry.java index 23936cbb2e..9e7429c02e 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeItemRegistry.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeItemRegistry.java @@ -21,9 +21,10 @@ import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.util.formatting.text.Component; -import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; +import com.sk89q.worldedit.util.formatting.text.serializer.gson.GsonComponentSerializer; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.registry.BundledItemRegistry; +import net.minecraft.server.MinecraftServer; import net.minecraft.world.item.ItemStack; import org.spongepowered.api.ResourceKey; import org.spongepowered.api.Sponge; @@ -39,8 +40,11 @@ public Component getRichName(ItemType itemType) { @Override public Component getRichName(BaseItemStack itemStack) { - return TranslatableComponent.of( - ((ItemStack) (Object) SpongeAdapter.adapt(itemStack)).getDescriptionId() + return GsonComponentSerializer.INSTANCE.deserialize( + net.minecraft.network.chat.Component.Serializer.toJson( + ((ItemStack) (Object) SpongeAdapter.adapt(itemStack)).getItemName(), + ((MinecraftServer) Sponge.server()).registryAccess() + ) ); } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java index ed15b87888..698c7242d9 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java @@ -329,7 +329,7 @@ public boolean regenerate(Region region, Extent extent, RegenOptions options) { public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) { ServerLevel world = (ServerLevel) getWorld(); ConfiguredFeature generator = Optional.ofNullable(createTreeFeatureGenerator(type)) - .map(k -> world.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).get(k)) + .map(k -> world.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE).getValue(k)) .orElse(null); return generator != null && generator.place( world, world.getChunkSource().getGenerator(), random, @@ -387,7 +387,7 @@ public void dropItem(Vector3 position, BaseItemStack item) { ); itemEntity.item().set( - SpongeAdapter.adapt(item).createSnapshot() + SpongeAdapter.adapt(item).asImmutable() ); getWorld().spawnEntity(itemEntity); }