Remove ChangeInventoryEvent.Transfer.Post as it is not possible to implement this for mods
*/
package org.spongepowered.api.event.item.inventory;
+import org.spongepowered.api.data.Transaction;
+import org.spongepowered.api.data.Transaction;
import org.spongepowered.api.entity.Item;
import org.spongepowered.api.entity.living.Living;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
import org.spongepowered.api.item.inventory.Slot;
+import org.spongepowered.api.item.inventory.transaction.SlotTransaction;
+import org.spongepowered.api.item.inventory.transaction.SlotTransaction;
import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod;
import java.util.List;
Inventory getSourceInventory();
/**
- * Fired before an {@link Inventory} attempts to transfer items.
+ * Gets the target {@link Inventory} of this {@link Event}.
+ *
+ * @return The target {@link Inventory}
*/
- interface Pre extends Event, Cancellable {
+ Inventory getTargetInventory();
/**
- * Gets the source {@link Inventory} of this {@link Event}.
- *
- * @return The source {@link Inventory}
+ * Fired before an {@link Inventory} attempts to transfer any items.
*/
- Inventory getSourceInventory();
+ interface Pre extends Transfer, Cancellable {
+
+ }
/**
- * Gets the target {@link Inventory} of this {@link Event}.
+ * Fires before an {@link Inventory} attempts to transfer an item.
*
- * @return The target {@link Inventory}
+ * <p>The event will be automatically cancelled when the modified {@link #transferredItem()} cannot fit the target inventory.</p>
+ *
+ * <p>When this event is cancelled a transfer is attempted for the remaining source slots.</p>
*/
- Inventory getTargetInventory();
- }
+ interface PreItem extends Transfer, Cancellable {
/**
- * Fires after an {@link Inventory} transferred an item.
+ * The item getting transferred.
+ *
+ * @return The item getting transferred
*/
- interface Post extends Transfer {
+ Transaction<ItemStackSnapshot> transferredItem();
+ /**
+ * Returns the source slot transaction for this item transfer.
+ *
+ * @return The source slot transaction for this item transfer
+ */
+ SlotTransaction sourceSlot();
}
}
