NpcMerchant .java

net.minecraft.entity.NpcMerchant (class): members: field_175548_d, recipeList, customer, theMerchantInventory, verifySellingItem, getCustomer, setCustomer.

net.minecraft.entityclass70 linescommon2.0 KB

Implements

API Surface (7)

EntityPlayer getCustomer()
void setCustomer(EntityPlayer p_70932_1_)
MerchantRecipeList getRecipes(EntityPlayer p_70934_1_)
void setRecipes(MerchantRecipeList recipeList)
void useRecipe(MerchantRecipe recipe)
void verifySellingItem(ItemStack stack)
IChatComponent getDisplayName()

Fields & Constants (4)

theMerchantInventory
customer
recipeList
field_175548_d

String literals (1)

"entity.Villager.name"

Full Source

NpcMerchant.java70 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.entity;
2
3
import net.minecraft.entity.player.EntityPlayer;
4
import net.minecraft.inventory.InventoryMerchant;
5
import net.minecraft.item.ItemStack;
6
import net.minecraft.util.ChatComponentTranslation;
7
import net.minecraft.util.IChatComponent;
8
import net.minecraft.village.MerchantRecipe;
9
import net.minecraft.village.MerchantRecipeList;
10
11
public class NpcMerchant implements IMerchant
12
{
13
    /** Instance of Merchants Inventory. */
14
    private InventoryMerchant theMerchantInventory;
15
16
    /** This merchant's current player customer. */
17
    private EntityPlayer customer;
18
19
    /** The MerchantRecipeList instance. */
20
    private MerchantRecipeList recipeList;
21
    private IChatComponent field_175548_d;
22
23
    public NpcMerchant(EntityPlayer p_i45817_1_, IChatComponent p_i45817_2_)
24
    {
25
        this.customer = p_i45817_1_;
26
        this.field_175548_d = p_i45817_2_;
27
        this.theMerchantInventory = new InventoryMerchant(p_i45817_1_, this);
28
    }
29
30
    public EntityPlayer getCustomer()
31
    {
32
        return this.customer;
33
    }
34
35
    public void setCustomer(EntityPlayer p_70932_1_)
36
    {
37
    }
38
39
    public MerchantRecipeList getRecipes(EntityPlayer p_70934_1_)
40
    {
41
        return this.recipeList;
42
    }
43
44
    public void setRecipes(MerchantRecipeList recipeList)
45
    {
46
        this.recipeList = recipeList;
47
    }
48
49
    public void useRecipe(MerchantRecipe recipe)
50
    {
51
        recipe.incrementToolUses();
52
    }
53
54
    /**
55
     * Notifies the merchant of a possible merchantrecipe being fulfilled or not. Usually, this is just a sound byte
56
     * being played depending if the suggested itemstack is not null.
57
     */
58
    public void verifySellingItem(ItemStack stack)
59
    {
60
    }
61
62
    /**
63
     * Get the formatted ChatComponent that will be used for the sender's username in chat
64
     */
65
    public IChatComponent getDisplayName()
66
    {
67
        return (IChatComponent)(this.field_175548_d != null ? this.field_175548_d : new ChatComponentTranslation("entity.Villager.name", new Object[0]));
68
    }
69
}
70

Deobfuscated MCP 1.8.9 source of NpcMerchant from Marcelektro/MavenMCP-1.8.9 (net/minecraft/entity/NpcMerchant.java), stored verbatim.