diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitItemRegistry.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitItemRegistry.java index c528a5b790..462b5a4c83 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitItemRegistry.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitItemRegistry.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.registry.BundledItemRegistry; +@SuppressWarnings("deprecation") class BukkitItemRegistry extends BundledItemRegistry { @Override public Component getRichName(ItemType itemType) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java index 246c736c84..391ea2ab98 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -71,7 +71,6 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.registry.BundledBlockData; -import com.sk89q.worldedit.world.registry.BundledItemData; import com.sk89q.worldedit.world.registry.LegacyMapper; import org.apache.logging.log4j.Logger; @@ -405,8 +404,7 @@ private boolean checkFilename(String filename) { */ public void loadMappings() { BundledBlockData.getInstance(); // Load block registry - BundledItemData.getInstance(); // Load item registry - LegacyMapper.getInstance(); // Load item registry + LegacyMapper.getInstance(); // Load legacy mappings } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java index 29e44fd916..3590ffae7f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java @@ -51,7 +51,7 @@ public class ItemType implements Keyed { WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS) .getRegistries().getItemRegistry().getRichName(this) ); - @SuppressWarnings("this-escape") + @SuppressWarnings("removal") private final LazyReference itemMaterial = LazyReference.from(() -> WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS) .getRegistries().getItemRegistry().getMaterial(this) @@ -109,7 +109,10 @@ public BlockType getBlockType() { * Get the material for this ItemType. * * @return The material + * @deprecated Deprecated without alternative */ + @Deprecated + @SuppressWarnings("removal") public ItemMaterial getMaterial() { return itemMaterial.getValue(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java index 1397d7c68a..21f7eea6e3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java @@ -46,7 +46,10 @@ *

The data is read from a JSON file that is bundled with WorldEdit. If * reading fails (which occurs when this class is first instantiated), then * the methods will return {@code null}s for all items.

+ * + * @deprecated Deprecated without replacement. */ +@Deprecated public final class BundledItemData { private static final Logger LOGGER = LogManagerCompat.getLogger(); @@ -91,6 +94,7 @@ private void loadFromResource() throws IOException { * @return the entry, or null */ @Nullable + @Deprecated public ItemEntry findById(String id) { // If it has no namespace, assume minecraft. if (!id.contains(":")) { @@ -104,8 +108,11 @@ public ItemEntry findById(String id) { * * @param id the string ID * @return the material's properties, or null + * @deprecated Deprecated without alternative */ @Nullable + @Deprecated + @SuppressWarnings("removal") public ItemMaterial getMaterialById(String id) { ItemEntry entry = findById(id); if (entry != null) { @@ -121,6 +128,7 @@ public ItemMaterial getMaterialById(String id) { * * @return the instance */ + @Deprecated public static BundledItemData getInstance() { if (INSTANCE == null) { INSTANCE = new BundledItemData(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java index dcf95ff1d6..a2889c8eee 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java @@ -30,7 +30,10 @@ /** * A item registry that uses {@link BundledItemRegistry} to serve information * about items. + * + * @deprecated Use the platform Item Registries */ +@Deprecated public class BundledItemRegistry implements ItemRegistry { private BundledItemData.ItemEntry getEntryById(ItemType itemType) { @@ -73,6 +76,8 @@ public String getName(ItemType itemType) { @Nullable @Override + @Deprecated + @SuppressWarnings("removal") public ItemMaterial getMaterial(ItemType itemType) { return new PassthroughItemMaterial(BundledItemData.getInstance().getMaterialById(itemType.id())); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledRegistries.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledRegistries.java index 389ca8f998..787ed46ba0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledRegistries.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledRegistries.java @@ -65,6 +65,7 @@ static URL loadRegistry(String name) throws IOException { } private final BundledBlockRegistry blockRegistry = new BundledBlockRegistry(); + @SuppressWarnings("deprecation") private final BundledItemRegistry itemRegistry = new BundledItemRegistry(); private final NullEntityRegistry entityRegistry = new NullEntityRegistry(); private final NullBiomeRegistry biomeRegistry = new NullBiomeRegistry(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemMaterial.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemMaterial.java index 8ff10496a1..9b94461cc7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemMaterial.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemMaterial.java @@ -22,6 +22,7 @@ import com.sk89q.worldedit.internal.util.DeprecationUtil; import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility; +@Deprecated(forRemoval = true) public interface ItemMaterial { /** * Gets the the maximum quantity of this item that can be in a single stack. @@ -38,7 +39,9 @@ default int getMaxStackSize() { * Gets the the maximum quantity of this item that can be in a single stack. * * @return the maximum quantity + * @deprecated Deprecated with no alternative */ + @Deprecated(forRemoval = true) @NonAbstractForCompatibility(delegateName = "getMaxStackSize", delegateParams = {}) default int maxStackSize() { DeprecationUtil.checkDelegatingOverride(getClass()); @@ -60,7 +63,9 @@ default int getMaxDamage() { * Gets the the maximum damage this item can take before being broken. * * @return the maximum damage, or 0 if not applicable + * @deprecated Deprecated with no alternative */ + @Deprecated(forRemoval = true) @NonAbstractForCompatibility(delegateName = "getMaxDamage", delegateParams = {}) default int maxDamage() { DeprecationUtil.checkDelegatingOverride(getClass()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java index 5035dae504..8f2c432e78 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java @@ -63,7 +63,10 @@ default String getName(ItemType itemType) { * * @param itemType the item * @return the material, or null if the material information is not known + * @deprecated ItemMaterial is deprecated with no alternative. */ + @Deprecated(forRemoval = true) @Nullable + @SuppressWarnings("removal") ItemMaterial getMaterial(ItemType itemType); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughItemMaterial.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughItemMaterial.java index 7ded7c5baf..589d7e36f2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughItemMaterial.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughItemMaterial.java @@ -23,6 +23,8 @@ import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull; +@Deprecated(forRemoval = true) +@SuppressWarnings("removal") public class PassthroughItemMaterial implements ItemMaterial { private static final ItemMaterial DEFAULT_MATERIAL = new SimpleItemMaterial(0, 0); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleItemMaterial.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleItemMaterial.java index cf2b7dc155..72a1fa8159 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleItemMaterial.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleItemMaterial.java @@ -19,5 +19,7 @@ package com.sk89q.worldedit.world.registry; +@Deprecated(forRemoval = true) +@SuppressWarnings("removal") public record SimpleItemMaterial(int maxStackSize, int maxDamage) implements ItemMaterial { } diff --git a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricItemRegistry.java b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricItemRegistry.java index bd3d74c40b..5abe115fba 100644 --- a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricItemRegistry.java +++ b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricItemRegistry.java @@ -25,6 +25,7 @@ import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.registry.BundledItemRegistry; +@SuppressWarnings("deprecation") public class FabricItemRegistry extends BundledItemRegistry { @Override diff --git a/worldedit-neoforge/src/main/java/com/sk89q/worldedit/neoforge/NeoForgeItemRegistry.java b/worldedit-neoforge/src/main/java/com/sk89q/worldedit/neoforge/NeoForgeItemRegistry.java index 7b9d2a9baf..214198d84e 100644 --- a/worldedit-neoforge/src/main/java/com/sk89q/worldedit/neoforge/NeoForgeItemRegistry.java +++ b/worldedit-neoforge/src/main/java/com/sk89q/worldedit/neoforge/NeoForgeItemRegistry.java @@ -25,6 +25,7 @@ import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.registry.BundledItemRegistry; +@SuppressWarnings("deprecation") public class NeoForgeItemRegistry extends BundledItemRegistry { @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..b57be8d4a0 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 @@ -29,6 +29,7 @@ import org.spongepowered.api.Sponge; import org.spongepowered.api.registry.RegistryTypes; +@SuppressWarnings("deprecation") public class SpongeItemRegistry extends BundledItemRegistry { @Override