本文整理汇总了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));
}
}
示例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));
}
}
示例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));
}
}
示例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);
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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));
}
}
示例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();
}