use of org.spongepowered.common.event.tracking.context.transaction.inventory.ClickMenuTransaction in project SpongeCommon by SpongePowered.
the class TransactionSink method logClickContainer.
default EffectTransactor logClickContainer(final AbstractContainerMenu menu, final int slotNum, final int buttonNum, final ClickType clickType, final Player player) {
@Nullable Slot slot = null;
if (buttonNum >= 0) {
// Try to get valid slot - might not be present e.g. for drag-events
slot = ((InventoryAdapter) menu).inventoryAdapter$getSlot(slotNum).orElse(null);
}
final ClickMenuTransaction transaction = new ClickMenuTransaction(player, menu, slotNum, buttonNum, clickType, slot, ItemStackUtil.snapshotOf(player.inventory.getCarried()));
this.logTransaction(transaction);
return this.pushEffect(new ResultingTransactionBySideEffect(InventoryEffect.getInstance()));
}
Aggregations