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


Java IMerchant.setRecipes方法代码示例

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


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

示例1: replaceList

import net.minecraft.entity.IMerchant; //导入方法依赖的package包/类
public void replaceList(IMerchant merchant, MerchantRecipeList list)
{
    if(merchant instanceof EntityVillager)
    {
        replaceTradeList((EntityVillager) merchant,list);
    }
    else
    {
        merchant.setRecipes(list);
    }
}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:12,代码来源:VillagerAntimonyHandler.java

示例2: handleCustomPayload

import net.minecraft.entity.IMerchant; //导入方法依赖的package包/类
/**
 * Handles packets that have room for a channel specification. Vanilla
 * implemented channels are "MC|TrList" to acquire a MerchantRecipeList trades
 * for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate
 * the identifier of the default server resourcepack for the client to load.
 */
public void handleCustomPayload(S3FPacketCustomPayload packetIn) {
	PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

	if ("MC|TrList".equals(packetIn.getChannelName())) {
		PacketBuffer packetbuffer = packetIn.getBufferData();

		try {
			int i = packetbuffer.readInt();
			GuiScreen guiscreen = this.gameController.currentScreen;

			if (guiscreen != null && guiscreen instanceof GuiMerchant
					&& i == this.gameController.thePlayer.openContainer.windowId) {
				IMerchant imerchant = ((GuiMerchant) guiscreen).getMerchant();
				MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer);
				imerchant.setRecipes(merchantrecipelist);
			}
		} catch (IOException ioexception) {
			logger.error((String) "Couldn\'t load trade info", (Throwable) ioexception);
		} finally {
			packetbuffer.release();
		}
	} else if ("MC|Brand".equals(packetIn.getChannelName())) {
		this.gameController.thePlayer.setClientBrand(packetIn.getBufferData().readStringFromBuffer(32767));
	} else if ("MC|BOpen".equals(packetIn.getChannelName())) {
		ItemStack itemstack = this.gameController.thePlayer.getCurrentEquippedItem();

		if (itemstack != null && itemstack.getItem() == Items.written_book) {
			this.gameController
					.displayGuiScreen(new GuiScreenBook(this.gameController.thePlayer, itemstack, false));
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:40,代码来源:NetHandlerPlayClient.java

示例3: handleVanilla250Packet

import net.minecraft.entity.IMerchant; //导入方法依赖的package包/类
public void handleVanilla250Packet(Packet250CustomPayload par1Packet250CustomPayload)
{
    if ("MC|TrList".equals(par1Packet250CustomPayload.channel))
    {
        DataInputStream datainputstream = new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data));

        try
        {
            int i = datainputstream.readInt();
            GuiScreen guiscreen = this.mc.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.mc.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).getIMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readRecipiesFromStream(datainputstream);
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            ioexception.printStackTrace();
        }
    }
    else if ("MC|Brand".equals(par1Packet250CustomPayload.channel))
    {
        this.mc.thePlayer.func_142020_c(new String(par1Packet250CustomPayload.data, Charsets.UTF_8));
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:29,代码来源:NetClientHandler.java

示例4: handleCustomPayload

import net.minecraft.entity.IMerchant; //导入方法依赖的package包/类
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(S3FPacketCustomPayload packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if ("MC|TrList".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer = packetIn.getBufferData();

        try
        {
            int i = packetbuffer.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).getMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer);
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            logger.error((String)"Couldn\'t load trade info", (Throwable)ioexception);
        }
        finally
        {
            packetbuffer.release();
        }
    }
    else if ("MC|Brand".equals(packetIn.getChannelName()))
    {
        this.gameController.thePlayer.setClientBrand(packetIn.getBufferData().readStringFromBuffer(32767));
    }
    else if ("MC|BOpen".equals(packetIn.getChannelName()))
    {
        ItemStack itemstack = this.gameController.thePlayer.getCurrentEquippedItem();

        if (itemstack != null && itemstack.getItem() == Items.written_book)
        {
            this.gameController.displayGuiScreen(new GuiScreenBook(this.gameController.thePlayer, itemstack, false));
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:50,代码来源:NetHandlerPlayClient.java

示例5: handleCustomPayload

import net.minecraft.entity.IMerchant; //导入方法依赖的package包/类
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(SPacketCustomPayload packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if ("MC|TrList".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer = packetIn.getBufferData();

        try
        {
            int i = packetbuffer.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.player.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).getMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer);
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t load trade info", (Throwable)ioexception);
        }
        finally
        {
            packetbuffer.release();
        }
    }
    else if ("MC|Brand".equals(packetIn.getChannelName()))
    {
        this.gameController.player.setServerBrand(packetIn.getBufferData().readStringFromBuffer(32767));
    }
    else if ("MC|BOpen".equals(packetIn.getChannelName()))
    {
        EnumHand enumhand = (EnumHand)packetIn.getBufferData().readEnumValue(EnumHand.class);
        ItemStack itemstack = enumhand == EnumHand.OFF_HAND ? this.gameController.player.getHeldItemOffhand() : this.gameController.player.getHeldItemMainhand();

        if (itemstack.getItem() == Items.WRITTEN_BOOK)
        {
            this.gameController.displayGuiScreen(new GuiScreenBook(this.gameController.player, itemstack, false));
        }
    }
    else if ("MC|DebugPath".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer1 = packetIn.getBufferData();
        int j = packetbuffer1.readInt();
        float f = packetbuffer1.readFloat();
        Path path = Path.read(packetbuffer1);
        ((DebugRendererPathfinding)this.gameController.debugRenderer.debugRendererPathfinding).addPath(j, path, f);
    }
    else if ("MC|StopSound".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer2 = packetIn.getBufferData();
        String s = packetbuffer2.readStringFromBuffer(32767);
        String s1 = packetbuffer2.readStringFromBuffer(256);
        this.gameController.getSoundHandler().stop(s1, SoundCategory.getByName(s));
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:66,代码来源:NetHandlerPlayClient.java

示例6: handleCustomPayload

import net.minecraft.entity.IMerchant; //导入方法依赖的package包/类
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(SPacketCustomPayload packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if ("MC|TrList".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer = packetIn.getBufferData();

        try
        {
            int i = packetbuffer.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.player.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).getMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer);
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t load trade info", (Throwable)ioexception);
        }
        finally
        {
            packetbuffer.release();
        }
    }
    else if ("MC|Brand".equals(packetIn.getChannelName()))
    {
        this.gameController.player.setServerBrand(packetIn.getBufferData().readStringFromBuffer(32767));
    }
    else if ("MC|BOpen".equals(packetIn.getChannelName()))
    {
        EnumHand enumhand = (EnumHand)packetIn.getBufferData().readEnumValue(EnumHand.class);
        ItemStack itemstack = enumhand == EnumHand.OFF_HAND ? this.gameController.player.getHeldItemOffhand() : this.gameController.player.getHeldItemMainhand();

        if (itemstack.getItem() == Items.WRITTEN_BOOK)
        {
            this.gameController.displayGuiScreen(new GuiScreenBook(this.gameController.player, itemstack, false));
        }
    }
    else if ("MC|DebugPath".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer1 = packetIn.getBufferData();
        int j = packetbuffer1.readInt();
        float f = packetbuffer1.readFloat();
        Path path = Path.read(packetbuffer1);
        ((DebugRendererPathfinding)this.gameController.debugRenderer.debugRendererPathfinding).addPath(j, path, f);
    }
    else if ("MC|DebugNeighborsUpdate".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer2 = packetIn.getBufferData();
        long k = packetbuffer2.readVarLong();
        BlockPos blockpos = packetbuffer2.readBlockPos();
        ((DebugRendererNeighborsUpdate)this.gameController.debugRenderer.field_191557_f).func_191553_a(k, blockpos);
    }
    else if ("MC|StopSound".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer3 = packetIn.getBufferData();
        String s = packetbuffer3.readStringFromBuffer(32767);
        String s1 = packetbuffer3.readStringFromBuffer(256);
        this.gameController.getSoundHandler().stop(s1, SoundCategory.getByName(s));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:73,代码来源:NetHandlerPlayClient.java

示例7: handleCustomPayload

import net.minecraft.entity.IMerchant; //导入方法依赖的package包/类
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(SPacketCustomPayload packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if ("MC|TrList".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer = packetIn.getBufferData();

        try
        {
            int i = packetbuffer.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).getMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer);
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t load trade info", (Throwable)ioexception);
        }
        finally
        {
            packetbuffer.release();
        }
    }
    else if ("MC|Brand".equals(packetIn.getChannelName()))
    {
        this.gameController.thePlayer.setServerBrand(packetIn.getBufferData().readStringFromBuffer(32767));
    }
    else if ("MC|BOpen".equals(packetIn.getChannelName()))
    {
        EnumHand enumhand = (EnumHand)packetIn.getBufferData().readEnumValue(EnumHand.class);
        ItemStack itemstack = enumhand == EnumHand.OFF_HAND ? this.gameController.thePlayer.getHeldItemOffhand() : this.gameController.thePlayer.getHeldItemMainhand();

        if (itemstack != null && itemstack.getItem() == Items.WRITTEN_BOOK)
        {
            this.gameController.displayGuiScreen(new GuiScreenBook(this.gameController.thePlayer, itemstack, false));
        }
    }
    else if ("MC|DebugPath".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer1 = packetIn.getBufferData();
        int j = packetbuffer1.readInt();
        float f = packetbuffer1.readFloat();
        Path path = Path.read(packetbuffer1);
        ((DebugRendererPathfinding)this.gameController.debugRenderer.debugRendererPathfinding).addPath(j, path, f);
    }
    else if ("MC|StopSound".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer2 = packetIn.getBufferData();
        String s = packetbuffer2.readStringFromBuffer(32767);
        String s1 = packetbuffer2.readStringFromBuffer(256);
        this.gameController.getSoundHandler().stop(s1, SoundCategory.getByName(s));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:66,代码来源:NetHandlerPlayClient.java

示例8: handleCustomPayload

import net.minecraft.entity.IMerchant; //导入方法依赖的package包/类
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(S3FPacketCustomPayload p_147240_1_)
{
    if ("MC|TrList".equals(p_147240_1_.func_149169_c()))
    {
        ByteBuf var2 = Unpooled.wrappedBuffer(p_147240_1_.func_149168_d());

        try
        {
            int var3 = var2.readInt();
            GuiScreen var4 = this.gameController.currentScreen;

            if (var4 != null && var4 instanceof GuiMerchant && var3 == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant var5 = ((GuiMerchant)var4).func_147035_g();
                MerchantRecipeList var6 = MerchantRecipeList.func_151390_b(new PacketBuffer(var2));
                var5.setRecipes(var6);
            }
        }
        catch (IOException var7)
        {
            logger.error("Couldn\'t load trade info", var7);
        }
    }
    else if ("MC|Brand".equals(p_147240_1_.func_149169_c()))
    {
        this.gameController.thePlayer.func_142020_c(new String(p_147240_1_.func_149168_d(), Charsets.UTF_8));
    }
    else if ("MC|RPack".equals(p_147240_1_.func_149169_c()))
    {
        final String var8 = new String(p_147240_1_.func_149168_d(), Charsets.UTF_8);

        if (this.gameController.gameSettings.serverTextures)
        {
            if (this.gameController.func_147104_D() != null && this.gameController.func_147104_D().func_147408_b())
            {
                this.gameController.getResourcePackRepository().func_148526_a(var8);
            }
            else if (this.gameController.func_147104_D() == null || this.gameController.func_147104_D().func_147410_c())
            {
                this.gameController.displayGuiScreen(new GuiYesNo(new GuiScreen()
                {
                    private static final String __OBFID = "CL_00000879";
                    public void confirmClicked(boolean par1, int par2)
                    {
                        this.mc = Minecraft.getMinecraft();

                        if (this.mc.func_147104_D() != null)
                        {
                            this.mc.func_147104_D().setAcceptsTextures(par1);
                            ServerList.func_147414_b(this.mc.func_147104_D());
                        }

                        if (par1)
                        {
                            this.mc.getResourcePackRepository().func_148526_a(var8);
                        }

                        this.mc.displayGuiScreen((GuiScreen)null);
                    }
                }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0));
            }
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:71,代码来源:NetHandlerPlayClient.java

示例9: handleCustomPayload

import net.minecraft.entity.IMerchant; //导入方法依赖的package包/类
public void handleCustomPayload(S3FPacketCustomPayload p_147240_1_)
{
    if ("MC|TrList".equals(p_147240_1_.func_149169_c()))
    {
        ByteBuf bytebuf = Unpooled.wrappedBuffer(p_147240_1_.func_149168_d());

        try
        {
            int i = bytebuf.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).func_147035_g();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.func_151390_b(new PacketBuffer(bytebuf));
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            logger.error("Couldn\'t load trade info", ioexception);
        }
        finally
        {
            bytebuf.release();
        }
    }
    else if ("MC|Brand".equals(p_147240_1_.func_149169_c()))
    {
        this.gameController.thePlayer.func_142020_c(new String(p_147240_1_.func_149168_d(), Charsets.UTF_8));
    }
    else if ("MC|RPack".equals(p_147240_1_.func_149169_c()))
    {
        final String s = new String(p_147240_1_.func_149168_d(), Charsets.UTF_8);

        if (this.gameController.func_147104_D() != null && this.gameController.func_147104_D().func_152586_b() == ServerData.ServerResourceMode.ENABLED)
        {
            this.gameController.getResourcePackRepository().func_148526_a(s);
        }
        else if (this.gameController.func_147104_D() == null || this.gameController.func_147104_D().func_152586_b() == ServerData.ServerResourceMode.PROMPT)
        {
            this.gameController.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
            {
                private static final String __OBFID = "CL_00000879";
                public void confirmClicked(boolean p_73878_1_, int p_73878_2_)
                {
                    NetHandlerPlayClient.this.gameController = Minecraft.getMinecraft();

                    if (NetHandlerPlayClient.this.gameController.func_147104_D() != null)
                    {
                        NetHandlerPlayClient.this.gameController.func_147104_D().func_152584_a(ServerData.ServerResourceMode.ENABLED);
                        ServerList.func_147414_b(NetHandlerPlayClient.this.gameController.func_147104_D());
                    }

                    if (p_73878_1_)
                    {
                        NetHandlerPlayClient.this.gameController.getResourcePackRepository().func_148526_a(s);
                    }

                    NetHandlerPlayClient.this.gameController.displayGuiScreen((GuiScreen)null);
                }
            }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0));
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:66,代码来源:NetHandlerPlayClient.java


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