Mojira Archive
MC-108074

Receiving item from villager counts as crafting

The bug

When you trade an item with a villager the crafting stat for the received item increases.

How to reproduce

  1. Summon a villager
    /summon villager ~ ~ ~ {NoAI:1b,Offers:{Recipes:[{buy:{id:"stone",Count:1b},sell:{id:"stone",Count:1b},maxUses:2147483647}]}}
    
  2. Setup the scoreboard objective
    /scoreboard objectives add craftedStone minecraft.crafted:minecraft.stone
    /scoreboard objectives setdisplay sidebar craftedStone
    
  3. Trade with the villager
    → The score increases

The reason

The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.

The method net.minecraft.inventory.SlotMerchantResult.onCrafting(ItemStack) calls the method net.minecraft.item.ItemStack.onCrafting(World, EntityPlayer, int).