当前位置: 首页>>代码示例>>Java>>正文


Java ContainerMerchant类代码示例

本文整理汇总了Java中net.minecraft.inventory.ContainerMerchant的典型用法代码示例。如果您正苦于以下问题:Java ContainerMerchant类的具体用法?Java ContainerMerchant怎么用?Java ContainerMerchant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ContainerMerchant类属于net.minecraft.inventory包,在下文中一共展示了ContainerMerchant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onClientUpdate

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
@SubscribeEvent
public static void onClientUpdate(TickEvent.ClientTickEvent event)
{
    if(event.side == Side.CLIENT && event.phase == TickEvent.Phase.END)
    {
        GuiScreen gui = Minecraft.getMinecraft().currentScreen;
        if (gui instanceof GuiMerchant) {
            //IMerchant merchant = ((GuiMerchant) gui).getMerchant();
            ContainerMerchant container = (ContainerMerchant) ((GuiMerchant) gui).inventorySlots;
            if (container != null && (clientContainer == null || clientContainer.container != container)) {
                clientContainer = new ContainerWrapper(container);
            }
            clientContainer.update();
        }
        else
        {
            clientContainer = null;
        }
    }
}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:21,代码来源:VillagerAntimonyHandler.java

示例2: displayVillagerTradeGui

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
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));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:20,代码来源:EntityPlayerMP.java

示例3: displayVillagerTradeGui

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
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));
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:20,代码来源:EntityPlayerMP.java

示例4: containerOpen

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
@SubscribeEvent
public void containerOpen(PlayerContainerEvent.Open event) {
	if(!event.getEntityPlayer().world.isRemote && event.getContainer() instanceof ContainerMercenary) {
		IInventory iinventory = ((ContainerMerchant) event.getContainer()).getMerchantInventory();
        ITextComponent itextcomponent = ((ContainerMercenary) event.getContainer()).mercenary.getDisplayName();
        MerchantRecipeList merchantrecipelist =((ContainerMercenary) event.getContainer()).mercenary.getRecipes(event.getEntityPlayer());

        if (merchantrecipelist != null)
        {
            PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
            packetbuffer.writeInt(event.getContainer().windowId);
            merchantrecipelist.writeToBuf(packetbuffer);
            ((EntityPlayerMP)event.getEntityPlayer()).connection.sendPacket(new SPacketCustomPayload("MC|TrList", packetbuffer));
        }
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:17,代码来源:TF2EventsCommon.java

示例5: displayVillagerTradeGui

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
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));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:EntityPlayerMP.java

示例6: displayGUIMerchant

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:26,代码来源:EntityPlayerMP.java

示例7: func_71030_a

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
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();
      }
   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:22,代码来源:EntityPlayerMP.java

示例8: func_73875_a

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
protected void func_73875_a(GuiButton p_73875_1_) {
   boolean var2 = false;
   if(p_73875_1_ == this.field_74202_p) {
      ++this.field_74200_r;
      var2 = true;
   } else if(p_73875_1_ == this.field_74201_q) {
      --this.field_74200_r;
      var2 = true;
   }

   if(var2) {
      ((ContainerMerchant)this.field_74193_d).func_75175_c(this.field_74200_r);
      ByteArrayOutputStream var3 = new ByteArrayOutputStream();
      DataOutputStream var4 = new DataOutputStream(var3);

      try {
         var4.writeInt(this.field_74200_r);
         this.field_73882_e.func_71391_r().func_72552_c(new Packet250CustomPayload("MC|TrSel", var3.toByteArray()));
      } catch (Exception var6) {
         var6.printStackTrace();
      }
   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:25,代码来源:GuiMerchant.java

示例9: displayGUIMerchant

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
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();
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:27,代码来源:EntityPlayerMP.java

示例10: actionPerformed

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
/**
 * Fired when a control is clicked. This is the equivalent of
 * ActionListener.actionPerformed(ActionEvent e).
 */
@Override
protected void actionPerformed(GuiButton par1GuiButton) {
	boolean flag = false;

	if (par1GuiButton == this.nextRecipeButtonIndex) {
		++this.currentRecipeIndex;
		flag = true;
	} else if (par1GuiButton == this.previousRecipeButtonIndex) {
		--this.currentRecipeIndex;
		flag = true;
	}

	if (flag) {
		((ContainerMerchant) this.inventorySlots).setCurrentRecipeIndex(this.currentRecipeIndex);
		ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
		DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);

		try {
			dataoutputstream.writeInt(this.currentRecipeIndex);
			this.mc.getNetHandler().addToSendQueue(new Packet250CustomPayload("MC|TrSel", bytearrayoutputstream.toByteArray()));
		} catch (Exception exception) {
			exception.printStackTrace();
		}
	}
}
 
开发者ID:DrDew2,项目名称:Amitcraft,代码行数:30,代码来源:GuiPrice.java

示例11: onContainerOpen

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
@SubscribeEvent
public static void onContainerOpen(PlayerContainerEvent.Open event)
{
    Container container = event.getContainer();

    if(container instanceof ContainerMerchant)
    {
        if(!openContainers.containsKey(container))
            openContainers.put((ContainerMerchant) container, new ContainerWrapper((ContainerMerchant) container));
    }
}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:12,代码来源:VillagerAntimonyHandler.java

示例12: onContainerClose

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
@SubscribeEvent
public static void onContainerClose(PlayerContainerEvent.Close event)
{
    Container container = event.getContainer();

    if(container instanceof ContainerMerchant)
    {
        if(openContainers.containsKey(container)) {
            openContainers.get(container).resetList();
            openContainers.remove(container);
        }
    }
}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:14,代码来源:VillagerAntimonyHandler.java

示例13: actionPerformed

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    boolean flag = false;

    if (button == this.nextButton)
    {
        ++this.selectedMerchantRecipe;
        MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.thePlayer);

        if (merchantrecipelist != null && this.selectedMerchantRecipe >= merchantrecipelist.size())
        {
            this.selectedMerchantRecipe = merchantrecipelist.size() - 1;
        }

        flag = true;
    }
    else if (button == this.previousButton)
    {
        --this.selectedMerchantRecipe;

        if (this.selectedMerchantRecipe < 0)
        {
            this.selectedMerchantRecipe = 0;
        }

        flag = true;
    }

    if (flag)
    {
        ((ContainerMerchant)this.inventorySlots).setCurrentRecipeIndex(this.selectedMerchantRecipe);
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.selectedMerchantRecipe);
        this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload("MC|TrSel", packetbuffer));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:40,代码来源:GuiMerchant.java

示例14: actionPerformed

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    boolean flag = false;

    if (button == this.nextButton)
    {
        ++this.selectedMerchantRecipe;
        MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.player);

        if (merchantrecipelist != null && this.selectedMerchantRecipe >= merchantrecipelist.size())
        {
            this.selectedMerchantRecipe = merchantrecipelist.size() - 1;
        }

        flag = true;
    }
    else if (button == this.previousButton)
    {
        --this.selectedMerchantRecipe;

        if (this.selectedMerchantRecipe < 0)
        {
            this.selectedMerchantRecipe = 0;
        }

        flag = true;
    }

    if (flag)
    {
        ((ContainerMerchant)this.inventorySlots).setCurrentRecipeIndex(this.selectedMerchantRecipe);
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.selectedMerchantRecipe);
        this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|TrSel", packetbuffer));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:GuiMerchant.java

示例15: actionPerformed

import net.minecraft.inventory.ContainerMerchant; //导入依赖的package包/类
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    boolean flag = false;

    if (button == this.nextButton)
    {
        ++this.selectedMerchantRecipe;
        MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.thePlayer);

        if (merchantrecipelist != null && this.selectedMerchantRecipe >= merchantrecipelist.size())
        {
            this.selectedMerchantRecipe = merchantrecipelist.size() - 1;
        }

        flag = true;
    }
    else if (button == this.previousButton)
    {
        --this.selectedMerchantRecipe;

        if (this.selectedMerchantRecipe < 0)
        {
            this.selectedMerchantRecipe = 0;
        }

        flag = true;
    }

    if (flag)
    {
        ((ContainerMerchant)this.inventorySlots).setCurrentRecipeIndex(this.selectedMerchantRecipe);
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.selectedMerchantRecipe);
        this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|TrSel", packetbuffer));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:40,代码来源:GuiMerchant.java


注:本文中的net.minecraft.inventory.ContainerMerchant类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。