Skip to content

Commit

Permalink
feat!: remove deprecated ItemStack methods
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Harris-Rouquette <[email protected]>
  • Loading branch information
gabizou committed Oct 10, 2024
1 parent 5d4ba2d commit 2a43df0
Show file tree
Hide file tree
Showing 33 changed files with 165 additions and 658 deletions.
16 changes: 0 additions & 16 deletions src/main/java/org/spongepowered/api/advancement/DisplayInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,6 @@ default Builder icon(ItemType itemType) {
return this.icon(ItemStack.of(itemType, 1));
}

/**
* @deprecated Use {@link #icon(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default Builder icon(ItemStack itemStack) {
return this.icon((ItemStackLike) itemStack);
}

/**
* @deprecated Use {@link #icon(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default Builder icon(ItemStackSnapshot itemStackSnapshot) {
return this.icon((ItemStackLike) itemStackSnapshot);
}

/**
* Sets the icon of the advancement with the
* specified {@link ItemStackLike}.
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/org/spongepowered/api/block/entity/Jukebox.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.item.inventory.ItemStackLike;
import org.spongepowered.api.item.inventory.ItemStackSnapshot;

Expand Down Expand Up @@ -60,14 +59,6 @@ default Value.Mutable<ItemStackSnapshot> item() {
*/
void eject();

/**
* @deprecated Use {@link #insert(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default void insert(ItemStack disc) {
this.insert((ItemStackLike) disc);
}

/**
* Ejects the current music disc item in this Jukebox and inserts the given one.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,6 @@ public Builder group(final String group) {
return this;
}

/**
* @deprecated Use {@link #item(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
public Builder item(final ItemStack itemStack) {
return this.item((ItemStackLike) itemStack);
}

/**
* @deprecated Use {@link #item(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
public Builder item(final ItemStackSnapshot snapshot) {
return this.item((ItemStackLike) snapshot);
}

public Builder item(final ItemStackLike item) {
this.snapshot = java.util.Objects.requireNonNull(item, "item").asImmutable();
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import net.kyori.adventure.text.ComponentLike;
import org.spongepowered.api.block.entity.EnchantmentTable;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.item.inventory.ItemStackLike;
import org.spongepowered.api.registry.DefaultedRegistryValue;
import org.spongepowered.api.tag.EnchantmenTypeTags;
Expand Down Expand Up @@ -82,14 +81,6 @@ public interface EnchantmentType extends DefaultedRegistryValue, ComponentLike,
*/
int maximumEnchantabilityForLevel(int level);

/**
* @deprecated Use {@link #canBeAppliedToStack(ItemStackLike)} instead,
*/
@Deprecated(forRemoval = true)
default boolean canBeAppliedToStack(ItemStack stack) {
return this.canBeAppliedToStack((ItemStackLike) stack);
}

/**
* Test if this enchantment type can be applied to an {@link ItemStackLike}.
*
Expand All @@ -98,14 +89,6 @@ default boolean canBeAppliedToStack(ItemStack stack) {
*/
boolean canBeAppliedToStack(ItemStackLike stack);

/**
* @deprecated Use {@link #canBeAppliedToStack(ItemStackLike)} instead,
*/
@Deprecated(forRemoval = true)
default boolean canBeAppliedByTable(ItemStack stack) {
return this.canBeAppliedByTable((ItemStackLike) stack);
}

/**
* Test if this enchantment type can be applied to an {@link ItemStackLike} by
* the {@link EnchantmentTable}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ public interface ArmorEquipable extends Equipable {
*/
ItemStack head();

/**
* @deprecated Use {@link #setHead(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default void setHead(ItemStack head) {
this.setHead((ItemStackLike) head);
}

/**
* Sets the head.
*
Expand All @@ -68,14 +60,6 @@ default void setHead(ItemStack head) {
*/
ItemStack chest();

/**
* @deprecated Use {@link #setChest(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default void setChest(ItemStack chest) {
this.setChest((ItemStackLike) chest);
}

/**
* Sets the chest.
*
Expand All @@ -90,14 +74,6 @@ default void setChest(ItemStack chest) {
*/
ItemStack legs();

/**
* @deprecated Use {@link #setLegs(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default void setLegs(ItemStack legs) {
this.setLegs((ItemStackLike) legs);
}

/**
* Sets the legs.
*
Expand All @@ -112,14 +88,6 @@ default void setLegs(ItemStack legs) {
*/
ItemStack feet();

/**
* @deprecated Use {@link #setFeet(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default void setFeet(ItemStack feet) {
this.setFeet((ItemStackLike) feet);
}

/**
* Sets the feet.
*
Expand All @@ -145,14 +113,6 @@ default ItemStack itemInHand(Supplier<? extends HandType> handType) {
*/
ItemStack itemInHand(HandType handType);

/**
* @deprecated Use {@link #setItemInHand(Supplier, ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default void setItemInHand(Supplier<? extends HandType> handType, ItemStack itemInHand) {
this.setItemInHand(handType, (ItemStackLike) itemInHand);
}

/**
* Sets the equipped item in hand.
*
Expand All @@ -163,14 +123,6 @@ default void setItemInHand(Supplier<? extends HandType> handType, ItemStackLike
this.setItemInHand(handType.get(), itemInHand);
}

/**
* @deprecated Use {@link #setItemInHand(HandType, ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default void setItemInHand(HandType handType, ItemStack itemInHand) {
this.setItemInHand(handType, (ItemStackLike) itemInHand);
}

/**
* Sets the equipped item in hand.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,6 @@ public interface Container extends Inventory {
*/
List<Inventory> viewed();

/**
* @deprecated Use {@link #setCursor(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default boolean setCursor(ItemStack item) {
return this.setCursor((ItemStackLike) item);
}

/**
* Sets the viewing players cursor item.
* <p>Returns false when the container is no longer open.</p>
Expand Down
32 changes: 0 additions & 32 deletions src/main/java/org/spongepowered/api/item/inventory/Equipable.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ default boolean canEquip(final Supplier<? extends EquipmentType> type) {
return this.canEquip(type.get());
}

/**
* @deprecated Use {@link #canEquip(EquipmentType, ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default boolean canEquip(EquipmentType type, ItemStack equipment) {
return this.canEquip(type, (ItemStackLike) equipment);
}

/**
* Gets whether this {@link Equipable} can equip the supplied equipment in its slot of
* the specified type (eg. whether calling {@link #equip} with the specified
Expand All @@ -75,14 +67,6 @@ default boolean canEquip(EquipmentType type, ItemStack equipment) {
*/
boolean canEquip(EquipmentType type, ItemStackLike equipment);

/**
* @deprecated Use {@link #canEquip(Supplier, ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default boolean canEquip(final Supplier<? extends EquipmentType> type, final ItemStack equipment) {
return this.canEquip(type, (ItemStackLike) equipment);
}

default boolean canEquip(final Supplier<? extends EquipmentType> type, final ItemStackLike equipment) {
return this.canEquip(type.get(), equipment);
}
Expand All @@ -100,14 +84,6 @@ default Optional<ItemStack> equipped(final Supplier<? extends EquipmentType> typ
return this.equipped(type.get());
}

/**
* @deprecated Use {@link #equip(EquipmentType, ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default boolean equip(EquipmentType type, ItemStack equipment) {
return this.equip(type, (ItemStackLike) equipment);
}

/**
* Sets the item currently equipped by the {@link Equipable} in the specified slot, if
* the equipable has such a slot.
Expand All @@ -121,14 +97,6 @@ default boolean equip(EquipmentType type, ItemStack equipment) {
*/
boolean equip(EquipmentType type, ItemStackLike equipment);

/**
* @deprecated Use {@link #equip(Supplier, ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default boolean equip(final Supplier<? extends EquipmentType> type, final ItemStack equipment) {
return this.equip(type, (ItemStackLike) equipment);
}

default boolean equip(final Supplier<? extends EquipmentType> type, final ItemStackLike equipment) {
return this.equip(type.get(), equipment);
}
Expand Down
48 changes: 0 additions & 48 deletions src/main/java/org/spongepowered/api/item/inventory/Inventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,6 @@ static Builder builder() {
*/
ItemStack peek();

/**
* @deprecated Use {@link #offer(ItemStackLike...)} instead.
*/
@Deprecated(forRemoval = true)
default InventoryTransactionResult offer(ItemStack... stacks) {
return this.offer((ItemStackLike[]) stacks);
}

/**
* Adds one or more ItemStacks to this inventory.
*
Expand All @@ -160,14 +152,6 @@ default InventoryTransactionResult offer(ItemStack... stacks) {
*/
InventoryTransactionResult offer(ItemStackLike... stacks);

/**
* @deprecated Use {@link #canFit(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default boolean canFit(ItemStack stack) {
return this.canFit((ItemStackLike) stack);
}

/**
* Returns true if the entire stack can fit in this inventory.
*
Expand Down Expand Up @@ -214,14 +198,6 @@ default boolean canFit(ItemStack stack) {
*/
Optional<ItemStack> peekAt(int index);

/**
* @deprecated Use {@link #offer(int, ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default InventoryTransactionResult offer(int index, ItemStack stack) {
return this.offer(index, (ItemStackLike) stack);
}

/**
* Adds an ItemStack to the slot at given index.
* Returns a {@link InventoryTransactionResult.Type#SUCCESS} only if the entire {@link ItemStackLike} fits the slot.
Expand All @@ -234,14 +210,6 @@ default InventoryTransactionResult offer(int index, ItemStack stack) {
*/
InventoryTransactionResult offer(int index, ItemStackLike stack);

/**
* @deprecated Use {@link #set(int, ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default InventoryTransactionResult set(int index, ItemStack stack) {
return this.set(index, (ItemStackLike) stack);
}

/**
* Adds the ItemStack to the slot at given index overwriting the existing item.
*
Expand Down Expand Up @@ -292,14 +260,6 @@ default InventoryTransactionResult set(int index, ItemStack stack) {
*/
int capacity();

/**
* @deprecated Use {@link #contains(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default boolean contains(ItemStack stack) {
return this.contains((ItemStackLike) stack);
}

/**
* Checks whether the stacks quantity or more of given stack is contained in this Inventory.
* To check if an inventory contains any amount use {@link #containsAny(ItemStackLike)}.
Expand All @@ -319,14 +279,6 @@ default boolean contains(ItemStack stack) {
*/
boolean contains(ItemType type);

/**
* @deprecated Use {@link #containsAny(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default boolean containsAny(ItemStack stack) {
return this.containsAny((ItemStackLike) stack);
}

/**
* Checks whether the given stack is contained in this Inventory.
* The stack size is ignored.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ static ItemStack of(ItemType itemType) {
*/
void setQuantity(int quantity) throws IllegalArgumentException;

/**
* @deprecated Use {@link #asImmutable()} instead.
*/
@Deprecated(forRemoval = true)
default ItemStackSnapshot createSnapshot() {
return this.asImmutable();
}

/**
* Returns true if the specified {@link ItemStack} has the same stack
* size, {@link ItemType}, and data. Note that this method is not an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ static ItemStackSnapshot empty() {
return Sponge.game().factoryProvider().provide(Factory.class).empty();
}

/**
* @deprecated Use {@link #asMutable()} or {@link #asMutableCopy()} instead.
*/
@Deprecated(forRemoval = true)
default ItemStack createStack() {
return this.asMutable();
}

interface Factory {

ItemStackSnapshot empty();
Expand Down
Loading

0 comments on commit 2a43df0

Please sign in to comment.