Java 类net.minecraft.entity.IMerchant 实例源码

项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
public void displayVillagerTradeGui(IMerchant villager)
{
    this.getNextWindowId();
    this.openContainer = new ContainerMerchant(this.inventory, villager, this.worldObj);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.onCraftGuiOpened(this);
    IInventory iinventory = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    IChatComponent ichatcomponent = villager.getDisplayName();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "minecraft:villager", ichatcomponent, iinventory.getSizeInventory()));
    MerchantRecipeList merchantrecipelist = villager.getRecipes(this);

    if (merchantrecipelist != null)
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.currentWindowId);
        merchantrecipelist.writeToBuf(packetbuffer);
        this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|TrList", packetbuffer));
    }
}
项目:DecompiledMinecraft    文件:ContainerMerchant.java   
public ContainerMerchant(InventoryPlayer playerInventory, IMerchant merchant, World worldIn)
{
    this.theMerchant = merchant;
    this.theWorld = worldIn;
    this.merchantInventory = new InventoryMerchant(playerInventory.player, merchant);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(playerInventory.player, merchant, this.merchantInventory, 2, 120, 53));

    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (int k = 0; k < 9; ++k)
    {
        this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
    }
}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
public void displayVillagerTradeGui(IMerchant villager)
{
    this.getNextWindowId();
    this.openContainer = new ContainerMerchant(this.inventory, villager, this.worldObj);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.onCraftGuiOpened(this);
    IInventory iinventory = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    IChatComponent ichatcomponent = villager.getDisplayName();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "minecraft:villager", ichatcomponent, iinventory.getSizeInventory()));
    MerchantRecipeList merchantrecipelist = villager.getRecipes(this);

    if (merchantrecipelist != null)
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.currentWindowId);
        merchantrecipelist.writeToBuf(packetbuffer);
        this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|TrList", packetbuffer));
    }
}
项目:DecompiledMinecraft    文件:ContainerMerchant.java   
public ContainerMerchant(InventoryPlayer playerInventory, IMerchant merchant, World worldIn)
{
    this.theMerchant = merchant;
    this.theWorld = worldIn;
    this.merchantInventory = new InventoryMerchant(playerInventory.player, merchant);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(playerInventory.player, merchant, this.merchantInventory, 2, 120, 53));

    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (int k = 0; k < 9; ++k)
    {
        this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
    }
}
项目:BaseClient    文件:EntityPlayerMP.java   
public void displayVillagerTradeGui(IMerchant villager)
{
    this.getNextWindowId();
    this.openContainer = new ContainerMerchant(this.inventory, villager, this.worldObj);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.onCraftGuiOpened(this);
    IInventory iinventory = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    IChatComponent ichatcomponent = villager.getDisplayName();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "minecraft:villager", ichatcomponent, iinventory.getSizeInventory()));
    MerchantRecipeList merchantrecipelist = villager.getRecipes(this);

    if (merchantrecipelist != null)
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.currentWindowId);
        merchantrecipelist.writeToBuf(packetbuffer);
        this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|TrList", packetbuffer));
    }
}
项目:BaseClient    文件:ContainerMerchant.java   
public ContainerMerchant(InventoryPlayer playerInventory, IMerchant merchant, World worldIn)
{
    this.theMerchant = merchant;
    this.theWorld = worldIn;
    this.merchantInventory = new InventoryMerchant(playerInventory.player, merchant);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(playerInventory.player, merchant, this.merchantInventory, 2, 120, 53));

    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (int k = 0; k < 9; ++k)
    {
        this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
    }
}
项目:BaseClient    文件:EntityPlayerMP.java   
public void displayVillagerTradeGui(IMerchant villager)
{
    this.getNextWindowId();
    this.openContainer = new ContainerMerchant(this.inventory, villager, this.worldObj);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.onCraftGuiOpened(this);
    IInventory iinventory = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    IChatComponent ichatcomponent = villager.getDisplayName();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "minecraft:villager", ichatcomponent, iinventory.getSizeInventory()));
    MerchantRecipeList merchantrecipelist = villager.getRecipes(this);

    if (merchantrecipelist != null)
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.currentWindowId);
        merchantrecipelist.writeToBuf(packetbuffer);
        this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|TrList", packetbuffer));
    }
}
项目:BaseClient    文件:ContainerMerchant.java   
public ContainerMerchant(InventoryPlayer playerInventory, IMerchant merchant, World worldIn)
{
    this.theMerchant = merchant;
    this.theWorld = worldIn;
    this.merchantInventory = new InventoryMerchant(playerInventory.player, merchant);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(playerInventory.player, merchant, this.merchantInventory, 2, 120, 53));

    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (int k = 0; k < 9; ++k)
    {
        this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
    }
}
项目:Zombe-Modpack    文件:EntityPlayerMP.java   
public void displayVillagerTradeGui(IMerchant villager)
{
    this.getNextWindowId();
    this.openContainer = new ContainerMerchant(this.inventory, villager, this.world);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addListener(this);
    IInventory iinventory = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    ITextComponent itextcomponent = villager.getDisplayName();
    this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, "minecraft:villager", itextcomponent, iinventory.getSizeInventory()));
    MerchantRecipeList merchantrecipelist = villager.getRecipes(this);

    if (merchantrecipelist != null)
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.currentWindowId);
        merchantrecipelist.writeToBuf(packetbuffer);
        this.connection.sendPacket(new SPacketCustomPayload("MC|TrList", packetbuffer));
    }
}
项目:Backmemed    文件:EntityPlayerMP.java   
public void displayVillagerTradeGui(IMerchant villager)
{
    this.getNextWindowId();
    this.openContainer = new ContainerMerchant(this.inventory, villager, this.world);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addListener(this);
    IInventory iinventory = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    ITextComponent itextcomponent = villager.getDisplayName();
    this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, "minecraft:villager", itextcomponent, iinventory.getSizeInventory()));
    MerchantRecipeList merchantrecipelist = villager.getRecipes(this);

    if (merchantrecipelist != null)
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.currentWindowId);
        merchantrecipelist.writeToBuf(packetbuffer);
        this.connection.sendPacket(new SPacketCustomPayload("MC|TrList", packetbuffer));
    }
}
项目:Backmemed    文件:EntityVillager.java   
public void func_190888_a(IMerchant p_190888_1_, MerchantRecipeList p_190888_2_, Random p_190888_3_)
{
    Enchantment enchantment = (Enchantment)Enchantment.REGISTRY.getRandomObject(p_190888_3_);
    int i = MathHelper.getInt(p_190888_3_, enchantment.getMinLevel(), enchantment.getMaxLevel());
    ItemStack itemstack = Items.ENCHANTED_BOOK.getEnchantedItemStack(new EnchantmentData(enchantment, i));
    int j = 2 + p_190888_3_.nextInt(5 + i * 10) + 3 * i;

    if (enchantment.isTreasureEnchantment())
    {
        j *= 2;
    }

    if (j > 64)
    {
        j = 64;
    }

    p_190888_2_.add(new MerchantRecipe(new ItemStack(Items.BOOK), new ItemStack(Items.EMERALD, j), itemstack));
}
项目:Backmemed    文件:ContainerMerchant.java   
public ContainerMerchant(InventoryPlayer playerInventory, IMerchant merchant, World worldIn)
{
    this.theMerchant = merchant;
    this.theWorld = worldIn;
    this.merchantInventory = new InventoryMerchant(playerInventory.player, merchant);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(playerInventory.player, merchant, this.merchantInventory, 2, 120, 53));

    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (int k = 0; k < 9; ++k)
    {
        this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
    }
}
项目:CustomWorldGen    文件:EntityPlayerMP.java   
public void displayVillagerTradeGui(IMerchant villager)
{
    this.getNextWindowId();
    this.openContainer = new ContainerMerchant(this.inventory, villager, this.worldObj);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addListener(this);
    net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.openContainer));
    IInventory iinventory = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    ITextComponent itextcomponent = villager.getDisplayName();
    this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, "minecraft:villager", itextcomponent, iinventory.getSizeInventory()));
    MerchantRecipeList merchantrecipelist = villager.getRecipes(this);

    if (merchantrecipelist != null)
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.currentWindowId);
        merchantrecipelist.writeToBuf(packetbuffer);
        this.connection.sendPacket(new SPacketCustomPayload("MC|TrList", packetbuffer));
    }
}
项目:CustomWorldGen    文件:ContainerMerchant.java   
public ContainerMerchant(InventoryPlayer playerInventory, IMerchant merchant, World worldIn)
{
    this.theMerchant = merchant;
    this.theWorld = worldIn;
    this.merchantInventory = new InventoryMerchant(playerInventory.player, merchant);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(playerInventory.player, merchant, this.merchantInventory, 2, 120, 53));

    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (int k = 0; k < 9; ++k)
    {
        this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
    }
}
项目:ExtraUtilities    文件:TileEntityTradingPost.java   
public XUPacketBase getTradePacket(final EntityPlayer player) {
    final List<IMerchant> traders = this.getVillagers();
    if (traders == null || traders.size() == 0) {
        return null;
    }
    final NBTTagCompound pkt = new NBTTagCompound();
    int n = 0;
    pkt.setInteger("player_id", player.getEntityId());
    for (int i = 0; i < traders.size(); ++i) {
        final IMerchant v = traders.get(i);
        pkt.setInteger("i" + i, ((EntityLiving)v).getEntityId());
        pkt.setTag("t" + i, (NBTBase)v.getRecipes((EntityPlayer)null).getRecipiesAsTags());
        ++n;
    }
    if (n == 0) {
        return null;
    }
    pkt.setInteger("n", n);
    return new PacketVillager(this.xCoord, this.yCoord, this.zCoord, pkt);
}
项目:Count-Armours    文件:TokensToItems.java   
@Override
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random rand) {
    int i = 1;

    if (this.priceInfo != null) {
        i = this.priceInfo.getPrice(rand);
    }

    ItemStack itemstack;
    ItemStack itemstack1;

    if (i < 0) {
        itemstack = new ItemStack(ModItems.trading_token);
        itemstack1 = new ItemStack(this.itemToBuy.getItem(), abs(i), this.itemToBuy.getMetadata());
    } else {
        itemstack = new ItemStack(ModItems.trading_token, i);
        itemstack1 = new ItemStack(this.itemToBuy.getItem(), 1, this.itemToBuy.getMetadata());
    }

    recipeList.add(new MerchantRecipe(itemstack, itemstack1));
}
项目:Count-Armours    文件:ContainerTrading.java   
public ContainerTrading(InventoryPlayer playerInventory, IMerchant merchant, World worldIn) {
    this.theMerchant = merchant;
    this.world = worldIn;
    this.merchantInventory = new InventoryMerchant(playerInventory.player, merchant);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(playerInventory.player, merchant, this.merchantInventory, 2, 120, 53));

    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 9; ++j) {
            this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (int k = 0; k < 9; ++k) {
        this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
    }
}
项目:Resilience-Client-Source    文件:EntityPlayerMP.java   
public void displayGUIMerchant(IMerchant par1IMerchant, String par2Str)
{
    this.getNextWindowId();
    this.openContainer = new ContainerMerchant(this.inventory, par1IMerchant, this.worldObj);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
    InventoryMerchant var3 = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 6, par2Str == null ? "" : par2Str, var3.getSizeInventory(), par2Str != null));
    MerchantRecipeList var4 = par1IMerchant.getRecipes(this);

    if (var4 != null)
    {
        try
        {
            PacketBuffer var5 = new PacketBuffer(Unpooled.buffer());
            var5.writeInt(this.currentWindowId);
            var4.func_151391_a(var5);
            this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|TrList", var5));
        }
        catch (IOException var6)
        {
            logger.error("Couldn\'t send trade list", var6);
        }
    }
}
项目:Resilience-Client-Source    文件:ContainerMerchant.java   
public ContainerMerchant(InventoryPlayer par1InventoryPlayer, IMerchant par2IMerchant, World par3World)
{
    this.theMerchant = par2IMerchant;
    this.theWorld = par3World;
    this.merchantInventory = new InventoryMerchant(par1InventoryPlayer.player, par2IMerchant);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(par1InventoryPlayer.player, par2IMerchant, this.merchantInventory, 2, 120, 53));
    int var4;

    for (var4 = 0; var4 < 3; ++var4)
    {
        for (int var5 = 0; var5 < 9; ++var5)
        {
            this.addSlotToContainer(new Slot(par1InventoryPlayer, var5 + var4 * 9 + 9, 8 + var5 * 18, 84 + var4 * 18));
        }
    }

    for (var4 = 0; var4 < 9; ++var4)
    {
        this.addSlotToContainer(new Slot(par1InventoryPlayer, var4, 8 + var4 * 18, 142));
    }
}
项目:ExpandedRailsMod    文件:EntityPlayerMP.java   
public void displayVillagerTradeGui(IMerchant villager)
{
    this.getNextWindowId();
    this.openContainer = new ContainerMerchant(this.inventory, villager, this.worldObj);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addListener(this);
    net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.openContainer));
    IInventory iinventory = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    ITextComponent itextcomponent = villager.getDisplayName();
    this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, "minecraft:villager", itextcomponent, iinventory.getSizeInventory()));
    MerchantRecipeList merchantrecipelist = villager.getRecipes(this);

    if (merchantrecipelist != null)
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.currentWindowId);
        merchantrecipelist.writeToBuf(packetbuffer);
        this.connection.sendPacket(new SPacketCustomPayload("MC|TrList", packetbuffer));
    }
}
项目:ExpandedRailsMod    文件:ContainerMerchant.java   
public ContainerMerchant(InventoryPlayer playerInventory, IMerchant merchant, World worldIn)
{
    this.theMerchant = merchant;
    this.theWorld = worldIn;
    this.merchantInventory = new InventoryMerchant(playerInventory.player, merchant);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(playerInventory.player, merchant, this.merchantInventory, 2, 120, 53));

    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (int k = 0; k < 9; ++k)
    {
        this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
    }
}
项目:Cauldron    文件:ContainerMerchant.java   
public ContainerMerchant(InventoryPlayer p_i1821_1_, IMerchant p_i1821_2_, World p_i1821_3_)
{
    this.theMerchant = p_i1821_2_;
    this.theWorld = p_i1821_3_;
    this.merchantInventory = new InventoryMerchant(p_i1821_1_.player, p_i1821_2_);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(p_i1821_1_.player, p_i1821_2_, this.merchantInventory, 2, 120, 53));
    int i;

    for (i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(p_i1821_1_, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (i = 0; i < 9; ++i)
    {
        this.addSlotToContainer(new Slot(p_i1821_1_, i, 8 + i * 18, 142));
    }
}
项目:Cauldron    文件:ContainerMerchant.java   
public ContainerMerchant(InventoryPlayer p_i1821_1_, IMerchant p_i1821_2_, World p_i1821_3_)
{
    this.theMerchant = p_i1821_2_;
    this.theWorld = p_i1821_3_;
    this.merchantInventory = new InventoryMerchant(p_i1821_1_.player, p_i1821_2_);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(p_i1821_1_.player, p_i1821_2_, this.merchantInventory, 2, 120, 53));
    int i;

    for (i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(p_i1821_1_, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (i = 0; i < 9; ++i)
    {
        this.addSlotToContainer(new Slot(p_i1821_1_, i, 8 + i * 18, 142));
    }
}
项目:RuneCraftery    文件:EntityPlayerMP.java   
public void func_71030_a(IMerchant p_71030_1_, String p_71030_2_) {
   this.func_71117_bO();
   this.field_71070_bA = new ContainerMerchant(this.field_71071_by, p_71030_1_, this.field_70170_p);
   this.field_71070_bA.field_75152_c = this.field_71139_cq;
   this.field_71070_bA.func_75132_a(this);
   InventoryMerchant var3 = ((ContainerMerchant)this.field_71070_bA).func_75174_d();
   this.field_71135_a.func_72567_b(new Packet100OpenWindow(this.field_71139_cq, 6, p_71030_2_ == null?"":p_71030_2_, var3.func_70302_i_(), p_71030_2_ != null));
   MerchantRecipeList var4 = p_71030_1_.func_70934_b(this);
   if(var4 != null) {
      try {
         ByteArrayOutputStream var5 = new ByteArrayOutputStream();
         DataOutputStream var6 = new DataOutputStream(var5);
         var6.writeInt(this.field_71139_cq);
         var4.func_77200_a(var6);
         this.field_71135_a.func_72567_b(new Packet250CustomPayload("MC|TrList", var5.toByteArray()));
      } catch (IOException var7) {
         var7.printStackTrace();
      }
   }

}
项目:RuneCraftery    文件:ContainerMerchant.java   
public ContainerMerchant(InventoryPlayer p_i1821_1_, IMerchant p_i1821_2_, World p_i1821_3_) {
   this.field_75178_e = p_i1821_2_;
   this.field_75177_g = p_i1821_3_;
   this.field_75176_f = new InventoryMerchant(p_i1821_1_.field_70458_d, p_i1821_2_);
   this.func_75146_a(new Slot(this.field_75176_f, 0, 36, 53));
   this.func_75146_a(new Slot(this.field_75176_f, 1, 62, 53));
   this.func_75146_a(new SlotMerchantResult(p_i1821_1_.field_70458_d, p_i1821_2_, this.field_75176_f, 2, 120, 53));

   int var4;
   for(var4 = 0; var4 < 3; ++var4) {
      for(int var5 = 0; var5 < 9; ++var5) {
         this.func_75146_a(new Slot(p_i1821_1_, var5 + var4 * 9 + 9, 8 + var5 * 18, 84 + var4 * 18));
      }
   }

   for(var4 = 0; var4 < 9; ++var4) {
      this.func_75146_a(new Slot(p_i1821_1_, var4, 8 + var4 * 18, 142));
   }

}
项目:RuneCraftery    文件:NetClientHandler.java   
public void func_72501_a(Packet250CustomPayload p_72501_1_) {
   if("MC|TrList".equals(p_72501_1_.field_73630_a)) {
      DataInputStream var2 = new DataInputStream(new ByteArrayInputStream(p_72501_1_.field_73629_c));

      try {
         int var3 = var2.readInt();
         GuiScreen var4 = this.field_72563_h.field_71462_r;
         if(var4 != null && var4 instanceof GuiMerchant && var3 == this.field_72563_h.field_71439_g.field_71070_bA.field_75152_c) {
            IMerchant var5 = ((GuiMerchant)var4).func_74199_h();
            MerchantRecipeList var6 = MerchantRecipeList.func_77204_a(var2);
            var5.func_70930_a(var6);
         }
      } catch (IOException var7) {
         var7.printStackTrace();
      }
   } else if("MC|Brand".equals(p_72501_1_.field_73630_a)) {
      this.field_72563_h.field_71439_g.func_142020_c(new String(p_72501_1_.field_73629_c, Charsets.UTF_8));
   }

}
项目:RuneCraftery    文件:EntityPlayerMP.java   
public void displayGUIMerchant(IMerchant par1IMerchant, String par2Str)
{
    this.incrementWindowID();
    this.openContainer = new ContainerMerchant(this.inventory, par1IMerchant, this.worldObj);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
    InventoryMerchant inventorymerchant = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 6, par2Str == null ? "" : par2Str, inventorymerchant.getSizeInventory(), par2Str != null));
    MerchantRecipeList merchantrecipelist = par1IMerchant.getRecipes(this);

    if (merchantrecipelist != null)
    {
        try
        {
            ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
            DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
            dataoutputstream.writeInt(this.currentWindowId);
            merchantrecipelist.writeRecipiesToStream(dataoutputstream);
            this.playerNetServerHandler.sendPacketToPlayer(new Packet250CustomPayload("MC|TrList", bytearrayoutputstream.toByteArray()));
        }
        catch (IOException ioexception)
        {
            ioexception.printStackTrace();
        }
    }
}
项目:RuneCraftery    文件:ContainerMerchant.java   
public ContainerMerchant(InventoryPlayer par1InventoryPlayer, IMerchant par2IMerchant, World par3World)
{
    this.theMerchant = par2IMerchant;
    this.theWorld = par3World;
    this.merchantInventory = new InventoryMerchant(par1InventoryPlayer.player, par2IMerchant);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(par1InventoryPlayer.player, par2IMerchant, this.merchantInventory, 2, 120, 53));
    int i;

    for (i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(par1InventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (i = 0; i < 9; ++i)
    {
        this.addSlotToContainer(new Slot(par1InventoryPlayer, i, 8 + i * 18, 142));
    }
}
项目:BetterNutritionMod    文件:EntityPlayerMP.java   
public void displayGUIMerchant(IMerchant par1IMerchant, String par2Str)
{
    this.incrementWindowID();
    this.openContainer = new ContainerMerchant(this.inventory, par1IMerchant, this.worldObj);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
    InventoryMerchant inventorymerchant = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 6, par2Str == null ? "" : par2Str, inventorymerchant.getSizeInventory(), par2Str != null));
    MerchantRecipeList merchantrecipelist = par1IMerchant.getRecipes(this);

    if (merchantrecipelist != null)
    {
        try
        {
            ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
            DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
            dataoutputstream.writeInt(this.currentWindowId);
            merchantrecipelist.writeRecipiesToStream(dataoutputstream);
            this.playerNetServerHandler.sendPacketToPlayer(new Packet250CustomPayload("MC|TrList", bytearrayoutputstream.toByteArray()));
        }
        catch (IOException ioexception)
        {
            ioexception.printStackTrace();
        }
    }
}
项目:BetterNutritionMod    文件:ContainerMerchant.java   
public ContainerMerchant(InventoryPlayer par1InventoryPlayer, IMerchant par2IMerchant, World par3World)
{
    this.theMerchant = par2IMerchant;
    this.theWorld = par3World;
    this.merchantInventory = new InventoryMerchant(par1InventoryPlayer.player, par2IMerchant);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(par1InventoryPlayer.player, par2IMerchant, this.merchantInventory, 2, 120, 53));
    int i;

    for (i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(par1InventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (i = 0; i < 9; ++i)
    {
        this.addSlotToContainer(new Slot(par1InventoryPlayer, i, 8 + i * 18, 142));
    }
}
项目:McMod-CubicVillager    文件:ClientGuiHandler.java   
@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
    switch(id)
    {
    case 0:
    case 1:
        TileEntity villagerBlock = world.getTileEntity(new BlockPos(x, y, z));
        if((villagerBlock != null) && (villagerBlock instanceof TileEntityVillager))
        {
            if(id == 0)
            {
                return new GuiAutoMerchant(player.inventory, (TileEntityVillager)villagerBlock, world);
            }
            else
            {
                return new GuiMerchantEditor((IMerchant)villagerBlock, player.inventory);
            }
        }
        break;
    }
    return null;
}
项目:McMod-CubicVillager    文件:GuiHandler.java   
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
    switch(id)
    {
    case 0:
    case 1:
        TileEntity villagerBlock = world.getTileEntity(new BlockPos(x, y, z));
        if(villagerBlock == null)
            break;
        if(!(villagerBlock instanceof TileEntityVillager))
            break;
        if(id == 0)
            return new ContainerAutoMerchant(player.inventory, (TileEntityVillager)villagerBlock, world);
        else
            return new ContainerMerchantEditor((IMerchant)villagerBlock, player.inventory);
    }
    return null;
}
项目:McMod-CubicVillager    文件:TileEntityVillager.java   
public TileEntityVillager(World world)
{
    this.world = world;
    EntityVillager dummyVillager = new EntityVillager(world);
    VillagerRegistry.setRandomProfession(dummyVillager, dummyVillager.getRNG());

    this.profession = dummyVillager.getProfessionForge().getRegistryName().toString();
    this.career = dummyVillager.careerId;
    this.love = dummyVillager.careerLevel;
    this.tradeList = ((IMerchant)dummyVillager).getRecipes(null);

    for(int i = 0; i < 3; i++)
        this.tradeInventory[i] = ItemStack.EMPTY;
    for(int i = 0; i < 8; i++)
        this.inventory[i] = ItemStack.EMPTY;
}
项目:HoloInventory    文件:EntityRequest.java   
@Override
public ResponseMessage onMessage(EntityRequest message, MessageContext ctx)
{
    World world = DimensionManager.getWorld(message.dim);
    if (world == null) return null;
    Entity entity = world.getEntityByID(message.id);
    if (entity == null) return null;

    if (entity instanceof IInventory) return new PlainInventory(message.id, (IInventory) entity);
    else if (entity instanceof IMerchant) return new MerchantRecipes(message.id, (IMerchant) entity, ctx.getServerHandler().player);
    else if (entity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null))
    {
        return new PlainInventory(message.id, entity.getName(), entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null));
    }

    return null;
}
项目:Amitcraft    文件:ContainerPrice.java   
public ContainerPrice(InventoryPlayer par1InventoryPlayer, IMerchant par2IMerchant, World par3World) {
    this.theMerchant = par2IMerchant;
    this.theWorld = par3World;
    this.merchantInventory = new InventoryMerchant(par1InventoryPlayer.player, par2IMerchant);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(par1InventoryPlayer.player, par2IMerchant, this.merchantInventory, 2, 120, 53));
    int var4;

    for (var4 = 0; var4 < 3; ++var4)
        for (int var5 = 0; var5 < 9; ++var5)
            this.addSlotToContainer(new Slot(par1InventoryPlayer, var5 + var4 * 9 + 9, 8 + var5 * 18, 84 + var4 * 18));

    for (var4 = 0; var4 < 9; ++var4)
        this.addSlotToContainer(new Slot(par1InventoryPlayer, var4, 8 + var4 * 18, 142));
}
项目:Soot    文件:VillagerAntimonyHandler.java   
public void replaceList(IMerchant merchant, MerchantRecipeList list)
{
    if(merchant instanceof EntityVillager)
    {
        replaceTradeList((EntityVillager) merchant,list);
    }
    else
    {
        merchant.setRecipes(list);
    }
}
项目:BetterThanWeagles    文件:VillagerTradeItemForItem.java   
@Override
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random)
{
    int buyingPrice = this.buyingPriceInfo.getPrice(random);
    int sellingPrice = this.sellingPriceInfo.getPrice(random);

    ItemStack buying = buyingItemStack.copy();
    buying.setCount(buyingPrice);

    ItemStack selling = sellingItemStack.copy();
    selling.setCount(sellingPrice);

    MerchantRecipe tradeRecipe = new MerchantRecipe(buying, selling);
    recipeList.add(tradeRecipe);
}
项目:DecompiledMinecraft    文件:SlotMerchantResult.java   
public SlotMerchantResult(EntityPlayer player, IMerchant merchant, InventoryMerchant merchantInventory, int slotIndex, int xPosition, int yPosition)
{
    super(merchantInventory, slotIndex, xPosition, yPosition);
    this.thePlayer = player;
    this.theMerchant = merchant;
    this.theMerchantInventory = merchantInventory;
}
项目:DecompiledMinecraft    文件:SlotMerchantResult.java   
public SlotMerchantResult(EntityPlayer player, IMerchant merchant, InventoryMerchant merchantInventory, int slotIndex, int xPosition, int yPosition)
{
    super(merchantInventory, slotIndex, xPosition, yPosition);
    this.thePlayer = player;
    this.theMerchant = merchant;
    this.theMerchantInventory = merchantInventory;
}
项目:BaseClient    文件:SlotMerchantResult.java   
public SlotMerchantResult(EntityPlayer player, IMerchant merchant, InventoryMerchant merchantInventory, int slotIndex, int xPosition, int yPosition)
{
    super(merchantInventory, slotIndex, xPosition, yPosition);
    this.thePlayer = player;
    this.theMerchant = merchant;
    this.theMerchantInventory = merchantInventory;
}