Skip to content

Commit

Permalink
finalize migrating item package
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHell228 committed Sep 15, 2024
1 parent 67f317f commit 3fbcd80
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion SpongeAPI
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static void handleSlotRestore(@Nullable final Player player, final @Nulla
final org.spongepowered.api.item.inventory.Slot slot = slotTransaction.slot();
final ItemStackSnapshot snapshot = eventCancelled || !slotTransaction.isValid() ? slotTransaction.original() : slotTransaction.custom().get();
if (containerMenu == null || slot.viewedSlot() instanceof Slot) {
slot.set(snapshot.asMutable());
slot.set(snapshot);
} else if (player instanceof ServerPlayer serverPlayer
&& containerMenu != player.inventoryMenu && serverPlayer.inventory().containsInventory(slot)) {
final org.spongepowered.api.item.inventory.ItemStack stack = snapshot.asMutable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.checkerframework.checker.nullness.qual.Nullable;
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.item.inventory.transaction.InventoryTransactionResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static InventoryTransactionResult.Poll pollSequential(Fabric fabric, @Nul
removedType.setQuantity(totalPolled);
}

return result.poll(removedType.asImmutable()).build();
return result.poll(removedType).build();
}

public static Optional<ItemStack> peekSequential(Fabric fabric, @Nullable Lens lens) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.spongepowered.api.item.inventory.transaction.InventoryTransactionResult;
import org.spongepowered.common.inventory.fabric.Fabric;
import org.spongepowered.common.inventory.lens.impl.slot.FilteringSlotLens;
import org.spongepowered.common.item.util.ItemStackUtil;

public class FilteringSlotAdapter extends SlotAdapter implements FilteringSlot {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@

import org.spongepowered.api.item.ItemType;
import org.spongepowered.api.item.inventory.Inventory;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.item.inventory.ItemStackLike;
import org.spongepowered.api.item.inventory.equipment.EquipmentType;
import org.spongepowered.api.item.inventory.slot.EquipmentSlot;
import org.spongepowered.api.item.inventory.transaction.InventoryTransactionResult;
import org.spongepowered.common.inventory.fabric.Fabric;
import org.spongepowered.common.inventory.lens.impl.slot.HeldHandSlotLens;
import org.spongepowered.common.item.util.ItemStackUtil;

import java.util.function.Predicate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private static FilteringSlotLens.ItemStackFilter equipmentTypeFilter(EquipmentTy
if (item.isEmpty()) {
return true;
}
final var equipable = Equipable.get(ItemStackUtil.toNative(item));
final var equipable = Equipable.get(ItemStackUtil.fromLikeToNative(item));
final var itemSlotType = equipable != null ? equipable.getEquipmentSlot() : EquipmentSlot.MAINHAND;
return itemSlotType == (Object) type;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import net.minecraft.world.Container;
import org.spongepowered.api.item.inventory.Inventory;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.item.inventory.ItemStackLike;
import org.spongepowered.api.item.inventory.Slot;
import org.spongepowered.common.bridge.world.inventory.InventoryBridge;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import net.minecraft.core.Holder;
import net.minecraft.world.item.enchantment.Enchantment;
import org.spongepowered.api.item.enchantment.EnchantmentType;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.item.inventory.ItemStackLike;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import net.minecraft.world.Container;
import net.minecraft.world.inventory.Slot;
import org.spongepowered.api.item.inventory.Inventory;
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.item.inventory.transaction.InventoryTransactionResult;
Expand Down

0 comments on commit 3fbcd80

Please sign in to comment.