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


Java S3FPacketCustomPayload.func_149168_d方法代码示例

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


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

示例1: FMLProxyPacket

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入方法依赖的package包/类
public FMLProxyPacket(S3FPacketCustomPayload original)
{
    this(original.func_149168_d(), original.func_149169_c());
    this.target = Side.CLIENT;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:6,代码来源:FMLProxyPacket.java

示例2: handleCustomPayload

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入方法依赖的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

示例3: handleCustomPayload

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入方法依赖的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.network.play.server.S3FPacketCustomPayload.func_149168_d方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。