Skip to content

Commit

Permalink
Migrate different stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHell228 committed Sep 16, 2024
1 parent e2d8085 commit 47299e1
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
24 changes: 15 additions & 9 deletions src/main/java/org/spongepowered/api/advancement/DisplayInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.spongepowered.api.Sponge;
import org.spongepowered.api.item.ItemType;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.item.inventory.ItemStackLike;
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
import org.spongepowered.api.util.CopyableBuilder;

Expand Down Expand Up @@ -164,24 +165,29 @@ default Builder icon(ItemType itemType) {
}

/**
* Sets the icon of the advancement with the
* specified {@link ItemStack}.
*
* @param itemStack The item stack
* @return This builder, for chaining
* @deprecated Use {@link #icon(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
default Builder icon(ItemStack itemStack) {
return this.icon(itemStack.asImmutable());
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 ItemStackSnapshot}.
* specified {@link ItemStackLike}.
*
* @param itemStackSnapshot The item stack snapshot
* @param itemStack The item stack snapshot
* @return This builder, for chaining
*/
Builder icon(ItemStackSnapshot itemStackSnapshot);
Builder icon(ItemStackLike itemStack);

/**
* Sets whether a toast should be shown. This is the notification
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/org/spongepowered/api/block/entity/Jukebox.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
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 @@ -59,10 +60,18 @@ 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.
*
* @param disc The music disc item to insert
*/
void insert(ItemStack disc);
void insert(ItemStackLike disc);
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.spongepowered.api.item.ItemTypes;
import org.spongepowered.api.item.enchantment.Enchantment;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.item.inventory.ItemStackLike;
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
import org.spongepowered.api.util.CopyableBuilder;

Expand Down Expand Up @@ -162,13 +163,24 @@ public Builder group(final String group) {
return this;
}

/**
* @deprecated Use {@link #item(ItemStackLike)} instead.
*/
@Deprecated(forRemoval = true)
public Builder item(final ItemStack itemStack) {
this.item(java.util.Objects.requireNonNull(itemStack, "ItemStack").asImmutable());
return this;
return this.item((ItemStackLike) itemStack);
}

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

public Builder item(final ItemStackLike item) {
this.snapshot = java.util.Objects.requireNonNull(item, "item").asImmutable();
return this;
}

Expand Down

0 comments on commit 47299e1

Please sign in to comment.