Class ItemStackAction
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
-
Field Summary
Fields inherited from class org.cloudburstmc.server.inventory.transaction.action.InventoryAction
sourceItem, targetItem -
Constructor Summary
ConstructorsConstructorDescriptionItemStackAction(int reqId, @Nullable com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData sourceData, @Nullable com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData targetData) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract List<com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.ContainerEntry>getContainers(CloudPlayer source)protected @Nullable BaseInventorygetSourceInventory(CloudPlayer source)Returns the item that was present before the action took place.protected intprotected @Nullable BaseInventorygetTargetInventory(CloudPlayer source)Returns the item that the action attempted to replace the source item with.protected intvoidonAddToTransaction(InventoryTransaction transaction)Called when the action is added to the specified InventoryTransaction.voidonExecuteFail(CloudPlayer source)Performs additional actions when this inventory-action did not complete successfully.voidonExecuteSuccess(CloudPlayer source)Performs additional actions when this inventory-action completed successfully.Methods inherited from class org.cloudburstmc.server.inventory.transaction.action.InventoryAction
execute, getCreationTime, isValid, onPreExecute
-
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
Description copied from class:InventoryActionCalled when the action is added to the specified InventoryTransaction.- Overrides:
onAddToTransactionin classInventoryAction- Parameters:
transaction- to add
-
onExecuteSuccess
Description copied from class:InventoryActionPerforms additional actions when this inventory-action completed successfully.- Specified by:
onExecuteSuccessin classInventoryAction- Parameters:
source- player
-
onExecuteFail
Description copied from class:InventoryActionPerforms additional actions when this inventory-action did not complete successfully.- Specified by:
onExecuteFailin classInventoryAction- Parameters:
source- player
-
getSourceSlot
protected int getSourceSlot() -
getTargetSlot
protected int getTargetSlot() -
getSourceInventory
-
getTargetInventory
-
getSourceItem
Description copied from class:InventoryActionReturns the item that was present before the action took place.- Overrides:
getSourceItemin classInventoryAction- Returns:
- source item
-
getTargetItem
Description copied from class:InventoryActionReturns the item that the action attempted to replace the source item with.- Overrides:
getTargetItemin classInventoryAction- Returns:
- target item
-
getContainers
protected abstract List<com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.ContainerEntry> getContainers(CloudPlayer source)
-