Skip to content

Commit

Permalink
replace: createStack() -> asMutable() & createSnapshot() -> asImmutab…
Browse files Browse the repository at this point in the history
…le()
  • Loading branch information
MrHell228 committed Sep 10, 2024
1 parent cf82a24 commit 2bc0eec
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ default Builder icon(ItemType itemType) {
* @return This builder, for chaining
*/
default Builder icon(ItemStack itemStack) {
return this.icon(itemStack.createSnapshot());
return this.icon(itemStack.asImmutable());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public Builder group(final String group) {
}

public Builder item(final ItemStack itemStack) {
this.item(java.util.Objects.requireNonNull(itemStack, "ItemStack").createSnapshot());
this.item(java.util.Objects.requireNonNull(itemStack, "ItemStack").asImmutable());
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public interface AffectItemStackEvent extends Event, Cancellable {
*/
default List<? extends Transaction<ItemStackSnapshot>> filter(Predicate<ItemStack> predicate) {
final List<Transaction<ItemStackSnapshot>> invalidatedTransactions = new ArrayList<>();
this.transactions().stream().filter(transaction -> !predicate.test(transaction.finalReplacement().createStack())).forEach(transaction -> {
this.transactions().stream().filter(transaction -> !predicate.test(transaction.finalReplacement().asMutable())).forEach(transaction -> {
transaction.setValid(false);
invalidatedTransactions.add(transaction);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public interface AffectSlotEvent extends AffectItemStackEvent {
@Override
default List<SlotTransaction> filter(Predicate<ItemStack> predicate) {
final List<SlotTransaction> invalidatedTransactions = new ArrayList<>();
this.transactions().stream().filter(transaction -> !predicate.test(transaction.finalReplacement().createStack())).forEach(transaction -> {
this.transactions().stream().filter(transaction -> !predicate.test(transaction.finalReplacement().asMutable())).forEach(transaction -> {
transaction.setValid(false);
invalidatedTransactions.add(transaction);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public SlotTransaction(Slot slot, ItemStackSnapshot original, ItemStackSnapshot
* @param stack The stack
*/
public void setCustom(ItemStack stack) {
this.setCustom(Objects.requireNonNull(stack, "ItemStack was null").createSnapshot());
this.setCustom(Objects.requireNonNull(stack, "ItemStack was null").asImmutable());
}

/**
Expand Down

0 comments on commit 2bc0eec

Please sign in to comment.