use of net.minecraft.world.inventory.ResultSlot in project SpongeCommon by SpongePowered.
the class AbstractContainerMenuMixin_Inventory method impl$transferStackInSlot.
// ClickType.QUICK_MOVE (for Crafting) -------------------------
// Called when Shift-Crafting - 2 Injection points
// Crafting continues until the returned ItemStack is empty OR the returned ItemStack is not the same as the item in the output slot
@Redirect(method = "doClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/inventory/AbstractContainerMenu;quickMoveStack(Lnet/minecraft/world/entity/player/Player;I)Lnet/minecraft/world/item/ItemStack;"))
private ItemStack impl$transferStackInSlot(final AbstractContainerMenu thisContainer, final Player player, final int slotId) {
final ItemStack result = thisContainer.quickMoveStack(player, slotId);
// Crafting on Serverside?
if (((LevelBridge) player.level).bridge$isFake() || !(thisContainer.getSlot(slotId) instanceof ResultSlot)) {
return result;
}
this.bridge$detectAndSendChanges(true);
final PhaseContext<@NonNull ?> context = PhaseTracker.SERVER.getPhaseContext();
// ClickContainerEvent -> CraftEvent -> PreviewEvent
TrackingUtil.processBlockCaptures(context);
// result is modified by the ClickMenuTransaction
return result;
}
Aggregations