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


Java IMerchant.getRecipes方法代码示例

本文整理汇总了Java中net.minecraft.entity.IMerchant.getRecipes方法的典型用法代码示例。如果您正苦于以下问题:Java IMerchant.getRecipes方法的具体用法?Java IMerchant.getRecipes怎么用?Java IMerchant.getRecipes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.IMerchant的用法示例。


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

示例1: displayVillagerTradeGui

import net.minecraft.entity.IMerchant; //导入方法依赖的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

示例2: displayVillagerTradeGui

import net.minecraft.entity.IMerchant; //导入方法依赖的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

示例3: displayVillagerTradeGui

import net.minecraft.entity.IMerchant; //导入方法依赖的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

示例4: displayGUIMerchant

import net.minecraft.entity.IMerchant; //导入方法依赖的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

示例5: displayGUIMerchant

import net.minecraft.entity.IMerchant; //导入方法依赖的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

示例6: displayGUIMerchant

import net.minecraft.entity.IMerchant; //导入方法依赖的package包/类
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();
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:40,代码来源:EntityPlayerMP.java

示例7: displayGUIMerchant

import net.minecraft.entity.IMerchant; //导入方法依赖的package包/类
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();
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:31,代码来源:EntityPlayerMP.java

示例8: ContainerMerchantEditor

import net.minecraft.entity.IMerchant; //导入方法依赖的package包/类
public ContainerMerchantEditor(IMerchant merchant, InventoryPlayer playerInventory)
{
	this.wrapper = CubicVillager.proxy.simpleNetWrapper;
	this.merchant = merchant;
	this.player = playerInventory.player;

	MerchantRecipeList trades = merchant.getRecipes(playerInventory.player);
	if(trades != null)
	{
		for(Object recipe : trades)
		{
			this.tradeList.add(new TradeInfo((MerchantRecipe)recipe));
		}
	}
	this.loadTradeAt(0);

	this.addSlotToContainer(new SlotVirtual(this.inventory, 0, 36, 24));
	this.addSlotToContainer(new SlotVirtual(this.inventory, 1, 62, 24));
	this.addSlotToContainer(new SlotVirtual(this.inventory, 2, 120, 24));

	for(byte i = 0; i < 3; i++)
	{
		for(byte j = 0; j < 9; j++)
		{
			int slotIndex = 9 + (9 * i) + j;
			this.addSlotToContainer(new Slot(playerInventory, slotIndex, 8 + (j * 18), 78 + (i * 18)));
		}
	}
	for(byte i = 0; i < 9; i++)
	{
		this.addSlotToContainer(new Slot(playerInventory, i, 8 + (i * 18), 136));
	}
}
 
开发者ID:a1lic,项目名称:McMod-CubicVillager,代码行数:34,代码来源:ContainerMerchantEditor.java

示例9: MerchantRecipes

import net.minecraft.entity.IMerchant; //导入方法依赖的package包/类
public MerchantRecipes(int id, IMerchant entity, EntityPlayerMP player)
{
    super(id);
    name = entity.getDisplayName().getFormattedText();
    MerchantRecipeList recipes = entity.getRecipes(player);
    if (recipes == null) recipes = new MerchantRecipeList();
    tag = recipes.getRecipiesAsTags();
}
 
开发者ID:dries007,项目名称:HoloInventory,代码行数:9,代码来源:MerchantRecipes.java


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