From f9339a4a36d260bac9e9f241d40eb7d4778a106a Mon Sep 17 00:00:00 2001 From: Maddy Miller Date: Mon, 6 Jul 2026 15:51:40 +1000 Subject: [PATCH] Remove deprecated BiomeData API --- .../accepted-core-public-api-changes.json | 42 +++++++++++ .../worldedit/bukkit/BukkitBiomeRegistry.java | 14 ---- .../coremc/internal/CoreMcBiomeRegistry.java | 28 ------- .../worldedit/world/biome/BiomeData.java | 43 ----------- .../worldedit/world/biome/BiomeName.java | 60 --------------- .../sk89q/worldedit/world/biome/Biomes.java | 75 ------------------- .../world/registry/BiomeRegistry.java | 15 ---- .../world/registry/NullBiomeRegistry.java | 13 ---- .../worldedit/sponge/SpongeBiomeRegistry.java | 33 -------- 9 files changed, 42 insertions(+), 281 deletions(-) delete mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeData.java delete mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java delete mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java diff --git a/verification/src/changes/accepted-core-public-api-changes.json b/verification/src/changes/accepted-core-public-api-changes.json index 0034d07467..0eea898956 100644 --- a/verification/src/changes/accepted-core-public-api-changes.json +++ b/verification/src/changes/accepted-core-public-api-changes.json @@ -67,5 +67,47 @@ "CONSTRUCTOR_REMOVED" ] } + ], + "Removal of deprecated API for WorldEdit 8": [ + { + "type": "com.sk89q.worldedit.world.biome.BiomeData", + "member": "Class com.sk89q.worldedit.world.biome.BiomeData", + "changes": [ + "CLASS_REMOVED", + "ANNOTATION_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.world.biome.BiomeData", + "member": "Method com.sk89q.worldedit.world.biome.BiomeData.getName()", + "changes": [ + "METHOD_REMOVED", + "ANNOTATION_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.world.biome.Biomes", + "member": "Class com.sk89q.worldedit.world.biome.Biomes", + "changes": [ + "CLASS_REMOVED", + "ANNOTATION_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.world.biome.Biomes", + "member": "Method com.sk89q.worldedit.world.biome.Biomes.findBiomeByName(java.util.Collection,java.lang.String,com.sk89q.worldedit.world.registry.BiomeRegistry)", + "changes": [ + "METHOD_REMOVED", + "ANNOTATION_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.world.registry.BiomeRegistry", + "member": "Method com.sk89q.worldedit.world.registry.BiomeRegistry.getData(com.sk89q.worldedit.world.biome.BiomeType)", + "changes": [ + "METHOD_REMOVED", + "ANNOTATION_REMOVED" + ] + } ] } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java index 0655308a26..5103901daf 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java @@ -22,12 +22,8 @@ import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.util.translation.TranslationManager; -import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.registry.BiomeRegistry; -import org.bukkit.block.Biome; - -import javax.annotation.Nullable; /** * A biome registry for Bukkit. @@ -43,14 +39,4 @@ public Component getRichName(BiomeType biomeType) { TranslationManager.makeTranslationKey("biome", biomeType.id()) ); } - - @SuppressWarnings({ "removal" }) - @Deprecated - @Nullable - @Override - public BiomeData getData(BiomeType biome) { - final Biome bukkitBiome = BukkitAdapter.adapt(biome); - return bukkitBiome == null ? null : bukkitBiome::name; - } - } diff --git a/worldedit-core-mc/src/main/java/com/sk89q/worldedit/coremc/internal/CoreMcBiomeRegistry.java b/worldedit-core-mc/src/main/java/com/sk89q/worldedit/coremc/internal/CoreMcBiomeRegistry.java index 818e83502b..55ceb6d8c1 100644 --- a/worldedit-core-mc/src/main/java/com/sk89q/worldedit/coremc/internal/CoreMcBiomeRegistry.java +++ b/worldedit-core-mc/src/main/java/com/sk89q/worldedit/coremc/internal/CoreMcBiomeRegistry.java @@ -21,7 +21,6 @@ import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; -import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.registry.BiomeRegistry; import net.minecraft.resources.Identifier; @@ -36,31 +35,4 @@ public final class CoreMcBiomeRegistry implements BiomeRegistry { public Component getRichName(BiomeType biomeType) { return TranslatableComponent.of(Util.makeDescriptionId("biome", Identifier.parse(biomeType.id()))); } - - @Deprecated - @Override - public BiomeData getData(BiomeType biome) { - return new CoreMcBiomeData(biome); - } - - @Deprecated - private static final class CoreMcBiomeData implements BiomeData { - private final BiomeType biome; - - /** - * Create a new instance. - * - * @param biome the base biome - */ - private CoreMcBiomeData(BiomeType biome) { - this.biome = biome; - } - - @SuppressWarnings("deprecation") - @Override - public String getName() { - return biome.id(); - } - } - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeData.java deleted file mode 100644 index 72307720f6..0000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeData.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.world.biome; - -import com.sk89q.worldedit.world.registry.BiomeRegistry; - -/** - * Provides information about a biome. - * - * @deprecated This no longer returns useful information. - */ -@Deprecated -public interface BiomeData { - - /** - * Get the name of the biome, which does not have to follow any - * particular convention. - * - * @return the biome's name - * @deprecated This method does not work on the server. - * Use {@link BiomeRegistry#getRichName(BiomeType)}. - */ - @Deprecated - String getName(); - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java deleted file mode 100644 index 6c7e338c93..0000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.world.biome; - -import com.google.common.base.Function; -import com.sk89q.worldedit.world.registry.BiomeRegistry; - -import javax.annotation.Nullable; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Returns the name of a biome using a given {@code BiomeRegistry}. - * - * @deprecated for removal, appears to be unused - */ -@Deprecated -class BiomeName implements Function { - - private final BiomeRegistry registry; - - /** - * Create a new instance. - * - * @param registry the biome registry - */ - BiomeName(BiomeRegistry registry) { - checkNotNull(registry); - this.registry = registry; - } - - @Nullable - @Override - public String apply(BiomeType input) { - BiomeData data = registry.getData(input); - if (data != null) { - return data.getName(); - } else { - return null; - } - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java deleted file mode 100644 index 9e0b3fac89..0000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.world.biome; - -import com.google.common.base.Functions; -import com.sk89q.worldedit.util.WeightedChoice; -import com.sk89q.worldedit.util.WeightedChoice.Choice; -import com.sk89q.worldedit.util.function.LevenshteinDistance; -import com.sk89q.worldedit.world.registry.BiomeRegistry; - -import java.util.Collection; -import java.util.Optional; -import java.util.function.Function; -import javax.annotation.Nullable; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Utility methods related to biomes. - * - * @deprecated Only method is being deprecated for removal. - */ -@Deprecated -public final class Biomes { - - private Biomes() { - } - - /** - * Find a biome that matches the given input name. - * - * @param biomes a list of biomes - * @param name the name to test - * @param registry a biome registry - * @return a biome or null - * @deprecated This uses the outdated name system. Find names by comparing with their ID instead. - */ - @Deprecated - @Nullable - public static BiomeType findBiomeByName(Collection biomes, String name, BiomeRegistry registry) { - checkNotNull(biomes); - checkNotNull(name); - checkNotNull(registry); - - Function compare = new LevenshteinDistance(name, false, LevenshteinDistance.STANDARD_CHARS); - WeightedChoice chooser = new WeightedChoice<>(Functions.compose(compare::apply, new BiomeName(registry)), 0); - for (BiomeType biome : biomes) { - chooser.consider(biome); - } - Optional> choice = chooser.getChoice(); - if (choice.isPresent() && choice.get().getScore() <= 1) { - return choice.get().getValue(); - } else { - return null; - } - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java index 3e18c47773..7403583f0d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java @@ -20,11 +20,8 @@ package com.sk89q.worldedit.world.registry; import com.sk89q.worldedit.util.formatting.text.Component; -import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.biome.BiomeType; -import javax.annotation.Nullable; - /** * Provides information on biomes. */ @@ -38,16 +35,4 @@ public interface BiomeRegistry { */ Component getRichName(BiomeType biomeType); - /** - * Get data about a biome. - * - * @param biome the biome - * @return a data object or null if information is not known - * @deprecated This method no longer returns any useful information. - * Use {@link #getRichName(BiomeType)} for the name of the biome. - */ - @Deprecated - @Nullable - BiomeData getData(BiomeType biome); - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java index 9625e6f0fd..c14d5d5d0f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java @@ -22,11 +22,8 @@ import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.util.translation.TranslationManager; -import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.biome.BiomeType; -import javax.annotation.Nullable; - /** * A biome registry that knows nothing. */ @@ -44,14 +41,4 @@ public Component getRichName(BiomeType biomeType) { TranslationManager.makeTranslationKey("biome", biomeType.id()) ); } - - // Suppress InlineMeSuggester: This method cannot be made final due to backwards compatibility - @SuppressWarnings("InlineMeSuggester") - @Deprecated - @Nullable - @Override - public BiomeData getData(BiomeType biome) { - return null; - } - } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java index 66e1b9c427..e91619cc31 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java @@ -22,12 +22,7 @@ import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.util.translation.TranslationManager; -import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.registry.BiomeRegistry; -import org.spongepowered.api.registry.RegistryReference; -import org.spongepowered.api.world.biome.Biome; - -import javax.annotation.Nullable; /** * Provides access to biome data in Sponge. @@ -40,32 +35,4 @@ public Component getRichName(com.sk89q.worldedit.world.biome.BiomeType biomeType TranslationManager.makeTranslationKey("biome", biomeType.id()) ); } - - @Deprecated - @Nullable - @Override - public BiomeData getData(com.sk89q.worldedit.world.biome.BiomeType biome) { - return new SpongeBiomeData(SpongeAdapter.adapt(biome)); - } - - @Deprecated - private static class SpongeBiomeData implements BiomeData { - private final RegistryReference biome; - - /** - * Create a new instance. - * - * @param biome the base biome - */ - private SpongeBiomeData(RegistryReference biome) { - this.biome = biome; - } - - @SuppressWarnings("deprecation") - @Override - public String getName() { - return biome.location().asString(); - } - } - }