java.lang.Object
org.cloudburstmc.server.inventory.transaction.action.InventoryAction
org.cloudburstmc.server.inventory.transaction.action.ItemStackAction
Direct Known Subclasses:
ConsumeItemAction, CraftCreativeAction, CraftRecipeAction, DropItemStackAction, MoveItemStackAction, SwapItemStackAction

public abstract class ItemStackAction extends InventoryAction
  • Constructor Details

    • ItemStackAction

      public ItemStackAction(int reqId, @Nullable com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData sourceData, @Nullable com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData targetData)
  • Method Details

    • onAddToTransaction

      public void onAddToTransaction(InventoryTransaction transaction)
      Description copied from class: InventoryAction
      Called when the action is added to the specified InventoryTransaction.
      Overrides:
      onAddToTransaction in class InventoryAction
      Parameters:
      transaction - to add
    • onExecuteSuccess

      public void onExecuteSuccess(CloudPlayer source)
      Description copied from class: InventoryAction
      Performs additional actions when this inventory-action completed successfully.
      Specified by:
      onExecuteSuccess in class InventoryAction
      Parameters:
      source - player
    • onExecuteFail

      public void onExecuteFail(CloudPlayer source)
      Description copied from class: InventoryAction
      Performs additional actions when this inventory-action did not complete successfully.
      Specified by:
      onExecuteFail in class InventoryAction
      Parameters:
      source - player
    • getSourceSlot

      protected int getSourceSlot()
    • getTargetSlot

      protected int getTargetSlot()
    • getSourceInventory

      protected @Nullable BaseInventory getSourceInventory(CloudPlayer source)
    • getTargetInventory

      protected @Nullable BaseInventory getTargetInventory(CloudPlayer source)
    • getSourceItem

      public CloudItemStack getSourceItem()
      Description copied from class: InventoryAction
      Returns the item that was present before the action took place.
      Overrides:
      getSourceItem in class InventoryAction
      Returns:
      source item
    • getTargetItem

      public CloudItemStack getTargetItem()
      Description copied from class: InventoryAction
      Returns the item that the action attempted to replace the source item with.
      Overrides:
      getTargetItem in class InventoryAction
      Returns:
      target item
    • getContainers

      protected abstract List<com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.ContainerEntry> getContainers(CloudPlayer source)