Java 类net.minecraft.inventory.InventoryMerchant 实例源码

项目: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);
        }
    }
}
项目: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    文件: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    文件: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();
        }
    }
}
项目: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 update()
{
    if(merchant.getCustomer() == null)
        return;
    InventoryMerchant inventory = container.getMerchantInventory();
    ItemStack firstStack = inventory.getStackInSlot(0);
    ItemStack secondStack = inventory.getStackInSlot(1);
    MerchantRecipeList currentList = merchant.getRecipes(merchant.getCustomer());
    if(currentList != replacedList && currentList != defaultList) {
        defaultList = currentList; //We have a new default list, mark dirty so we generate a new replacement
        dirty = true;
    }
    if(firstStack.getItem() == Registry.SIGNET_ANTIMONY || secondStack.getItem() == Registry.SIGNET_ANTIMONY)
    {
        if(dirty) {
            replacedList = generateReplacement(defaultList);
            dirty = false;
        }
        if(currentList != replacedList) {
            replaceList(merchant, replacedList);
            container.getMerchantInventory().resetRecipeAndSlots();
        }
    }
    else
    {
        if(currentList != defaultList) {
            replaceList(merchant, defaultList);
            container.getMerchantInventory().resetRecipeAndSlots();
        }
    }
}
项目:Cauldron    文件:EntityPlayerMP.java   
public void displayGUIMerchant(IMerchant p_71030_1_, String p_71030_2_)
{
    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, p_71030_1_, this.worldObj));

    if (container == null)
    {
        return;
    }

    // CraftBukkit end
    this.getNextWindowId();
    this.openContainer = container; // CraftBukkit - Use container we passed to event
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
    InventoryMerchant inventorymerchant = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 6, p_71030_2_ == null ? "" : p_71030_2_, inventorymerchant.getSizeInventory(), p_71030_2_ != null));
    MerchantRecipeList merchantrecipelist = p_71030_1_.getRecipes(this);

    if (merchantrecipelist != null)
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());

        try
        {
            packetbuffer.writeInt(this.currentWindowId);
            merchantrecipelist.func_151391_a(packetbuffer);
            this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|TrList", packetbuffer));
        }
        catch (Exception ioexception)     // CraftBukkit - IOException -> Exception
        {
            logger.error("Couldn\'t send trade list", ioexception);
        }
        finally
        {
            packetbuffer.release();
        }
    }
}
项目:Cauldron    文件:EntityPlayerMP.java   
public void displayGUIMerchant(IMerchant p_71030_1_, String p_71030_2_)
{
    this.getNextWindowId();
    this.openContainer = new ContainerMerchant(this.inventory, p_71030_1_, this.worldObj);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
    InventoryMerchant inventorymerchant = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 6, p_71030_2_ == null ? "" : p_71030_2_, inventorymerchant.getSizeInventory(), p_71030_2_ != null));
    MerchantRecipeList merchantrecipelist = p_71030_1_.getRecipes(this);

    if (merchantrecipelist != null)
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());

        try
        {
            packetbuffer.writeInt(this.currentWindowId);
            merchantrecipelist.func_151391_a(packetbuffer);
            this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|TrList", packetbuffer));
        }
        catch (IOException ioexception)
        {
            logger.error("Couldn\'t send trade list", ioexception);
        }
        finally
        {
            packetbuffer.release();
        }
    }
}
项目:DecompiledMinecraft    文件:NpcMerchant.java   
public NpcMerchant(EntityPlayer p_i45817_1_, IChatComponent p_i45817_2_)
{
    this.customer = p_i45817_1_;
    this.field_175548_d = p_i45817_2_;
    this.theMerchantInventory = new InventoryMerchant(p_i45817_1_, this);
}
项目:BaseClient    文件:NpcMerchant.java   
public NpcMerchant(EntityPlayer p_i45817_1_, IChatComponent p_i45817_2_)
{
    this.customer = p_i45817_1_;
    this.field_175548_d = p_i45817_2_;
    this.theMerchantInventory = new InventoryMerchant(p_i45817_1_, this);
}
项目:BaseClient    文件:NpcMerchant.java   
public NpcMerchant(EntityPlayer p_i45817_1_, IChatComponent p_i45817_2_)
{
    this.customer = p_i45817_1_;
    this.field_175548_d = p_i45817_2_;
    this.theMerchantInventory = new InventoryMerchant(p_i45817_1_, this);
}
项目:Backmemed    文件:NpcMerchant.java   
public NpcMerchant(EntityPlayer customerIn, ITextComponent nameIn)
{
    this.customer = customerIn;
    this.name = nameIn;
    this.theMerchantInventory = new InventoryMerchant(customerIn, this);
}
项目:CustomWorldGen    文件:NpcMerchant.java   
public NpcMerchant(EntityPlayer customerIn, ITextComponent nameIn)
{
    this.customer = customerIn;
    this.name = nameIn;
    this.theMerchantInventory = new InventoryMerchant(customerIn, this);
}
项目:Resilience-Client-Source    文件:NpcMerchant.java   
public NpcMerchant(EntityPlayer par1EntityPlayer)
{
    this.customer = par1EntityPlayer;
    this.theMerchantInventory = new InventoryMerchant(par1EntityPlayer, this);
}
项目:ExpandedRailsMod    文件:NpcMerchant.java   
public NpcMerchant(EntityPlayer customerIn, ITextComponent nameIn)
{
    this.customer = customerIn;
    this.name = nameIn;
    this.theMerchantInventory = new InventoryMerchant(customerIn, this);
}
项目:Cauldron    文件:NpcMerchant.java   
public NpcMerchant(EntityPlayer p_i1746_1_)
{
    this.customer = p_i1746_1_;
    this.theMerchantInventory = new InventoryMerchant(p_i1746_1_, this);
}
项目:Cauldron    文件:NpcMerchant.java   
public NpcMerchant(EntityPlayer p_i1746_1_)
{
    this.customer = p_i1746_1_;
    this.theMerchantInventory = new InventoryMerchant(p_i1746_1_, this);
}
项目:RuneCraftery    文件:NpcMerchant.java   
public NpcMerchant(EntityPlayer p_i1746_1_) {
   this.field_70935_b = p_i1746_1_;
   this.field_70937_a = new InventoryMerchant(p_i1746_1_, this);
}
项目:RuneCraftery    文件:ContainerMerchant.java   
public InventoryMerchant func_75174_d() {
   return this.field_75176_f;
}
项目:RuneCraftery    文件:SlotMerchantResult.java   
public SlotMerchantResult(EntityPlayer p_i1822_1_, IMerchant p_i1822_2_, InventoryMerchant p_i1822_3_, int p_i1822_4_, int p_i1822_5_, int p_i1822_6_) {
   super(p_i1822_3_, p_i1822_4_, p_i1822_5_, p_i1822_6_);
   this.field_75232_b = p_i1822_1_;
   this.field_75234_h = p_i1822_2_;
   this.field_75233_a = p_i1822_3_;
}
项目:RuneCraftery    文件:NpcMerchant.java   
public NpcMerchant(EntityPlayer par1EntityPlayer)
{
    this.customer = par1EntityPlayer;
    this.theMerchantInventory = new InventoryMerchant(par1EntityPlayer, this);
}
项目:BetterNutritionMod    文件:NpcMerchant.java   
public NpcMerchant(EntityPlayer par1EntityPlayer)
{
    this.customer = par1EntityPlayer;
    this.theMerchantInventory = new InventoryMerchant(par1EntityPlayer, this);
}
项目:Amitcraft    文件:ContainerPrice.java   
public InventoryMerchant getMerchantInventory() {
    return this.merchantInventory;
}