• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CPacketResourcePackStatus类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: validateResourcePackUrl

import net.minecraft.network.play.client.CPacketResourcePackStatus; //导入依赖的package包/类
private boolean validateResourcePackUrl(String p_189688_1_)
{
    try
    {
        URI uri = new URI(p_189688_1_);
        String s = uri.getScheme();
        boolean flag = "level".equals(s);

        if (!"http".equals(s) && !"https".equals(s) && !flag)
        {
            throw new URISyntaxException(p_189688_1_, "Wrong protocol");
        }
        else if (!flag || !p_189688_1_.contains("..") && p_189688_1_.endsWith("/resources.zip"))
        {
            return true;
        }
        else
        {
            throw new URISyntaxException(p_189688_1_, "Invalid levelstorage resourcepack path");
        }
    }
    catch (URISyntaxException var5)
    {
        this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.FAILED_DOWNLOAD));
        return false;
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:28,代码来源:NetHandlerPlayClient.java


示例2: createDownloadCallback

import net.minecraft.network.play.client.CPacketResourcePackStatus; //导入依赖的package包/类
private FutureCallback<Object> createDownloadCallback()
{
    return new FutureCallback<Object>()
    {
        public void onSuccess(@Nullable Object p_onSuccess_1_)
        {
            NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.SUCCESSFULLY_LOADED));
        }
        public void onFailure(Throwable p_onFailure_1_)
        {
            NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.FAILED_DOWNLOAD));
        }
    };
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:15,代码来源:NetHandlerPlayClient.java


示例3: validateResourcePackUrl

import net.minecraft.network.play.client.CPacketResourcePackStatus; //导入依赖的package包/类
private boolean validateResourcePackUrl(String p_189688_1_)
{
    try
    {
        URI uri = new URI(p_189688_1_.replace(' ', '+'));
        String s = uri.getScheme();
        boolean flag = "level".equals(s);

        if (!"http".equals(s) && !"https".equals(s) && !flag)
        {
            throw new URISyntaxException(p_189688_1_, "Wrong protocol");
        }
        else if (!flag || !p_189688_1_.contains("..") && p_189688_1_.endsWith("/resources.zip"))
        {
            return true;
        }
        else
        {
            throw new URISyntaxException(p_189688_1_, "Invalid levelstorage resourcepack path");
        }
    }
    catch (URISyntaxException var5)
    {
        this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.FAILED_DOWNLOAD));
        return false;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:28,代码来源:NetHandlerPlayClient.java


示例4: func_189688_b

import net.minecraft.network.play.client.CPacketResourcePackStatus; //导入依赖的package包/类
private boolean func_189688_b(String p_189688_1_)
{
    try
    {
        URI uri = new URI(p_189688_1_.replace(' ', '+'));
        String s = uri.getScheme();
        boolean flag = "level".equals(s);

        if (!"http".equals(s) && !"https".equals(s) && !flag)
        {
            throw new URISyntaxException(p_189688_1_, "Wrong protocol");
        }
        else if (!flag || !p_189688_1_.contains("..") && p_189688_1_.endsWith("/resources.zip"))
        {
            return true;
        }
        else
        {
            throw new URISyntaxException(p_189688_1_, "Invalid levelstorage resourcepack path");
        }
    }
    catch (URISyntaxException var5)
    {
        this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.FAILED_DOWNLOAD));
        return false;
    }
}
 
开发者ID:BlazeAxtrius,项目名称:ExpandedRailsMod,代码行数:28,代码来源:NetHandlerPlayClient.java


示例5: func_189686_f

import net.minecraft.network.play.client.CPacketResourcePackStatus; //导入依赖的package包/类
private FutureCallback<Object> func_189686_f()
{
    return new FutureCallback<Object>()
    {
        public void onSuccess(@Nullable Object p_onSuccess_1_)
        {
            NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.SUCCESSFULLY_LOADED));
        }
        public void onFailure(Throwable p_onFailure_1_)
        {
            NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.FAILED_DOWNLOAD));
        }
    };
}
 
开发者ID:BlazeAxtrius,项目名称:ExpandedRailsMod,代码行数:15,代码来源:NetHandlerPlayClient.java


示例6: handleResourcePackStatus

import net.minecraft.network.play.client.CPacketResourcePackStatus; //导入依赖的package包/类
public void handleResourcePackStatus(CPacketResourcePackStatus packetIn)
{
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:4,代码来源:NetHandlerPlayServer.java


示例7: handleResourcePack

import net.minecraft.network.play.client.CPacketResourcePackStatus; //导入依赖的package包/类
public void handleResourcePack(SPacketResourcePackSend packetIn)
{
    final String s = packetIn.getURL();
    final String s1 = packetIn.getHash();

    if (this.validateResourcePackUrl(s))
    {
        if (s.startsWith("level://"))
        {
            String s2 = s.substring("level://".length());
            File file1 = new File(this.gameController.mcDataDir, "saves");
            File file2 = new File(file1, s2);

            if (file2.isFile())
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                Futures.addCallback(this.gameController.getResourcePackRepository().setResourcePackInstance(file2), this.createDownloadCallback());
            }
            else
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.FAILED_DOWNLOAD));
            }
        }
        else
        {
            ServerData serverdata = this.gameController.getCurrentServerData();

            if (serverdata != null && serverdata.getResourceMode() == ServerData.ServerResourceMode.ENABLED)
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                Futures.addCallback(this.gameController.getResourcePackRepository().downloadResourcePack(s, s1), this.createDownloadCallback());
            }
            else if (serverdata != null && serverdata.getResourceMode() != ServerData.ServerResourceMode.PROMPT)
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.DECLINED));
            }
            else
            {
                this.gameController.addScheduledTask(new Runnable()
                {
                    public void run()
                    {
                        NetHandlerPlayClient.this.gameController.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
                        {
                            public void confirmClicked(boolean result, int id)
                            {
                                NetHandlerPlayClient.this.gameController = Minecraft.getMinecraft();
                                ServerData serverdata1 = NetHandlerPlayClient.this.gameController.getCurrentServerData();

                                if (result)
                                {
                                    if (serverdata1 != null)
                                    {
                                        serverdata1.setResourceMode(ServerData.ServerResourceMode.ENABLED);
                                    }

                                    NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                                    Futures.addCallback(NetHandlerPlayClient.this.gameController.getResourcePackRepository().downloadResourcePack(s, s1), NetHandlerPlayClient.this.createDownloadCallback());
                                }
                                else
                                {
                                    if (serverdata1 != null)
                                    {
                                        serverdata1.setResourceMode(ServerData.ServerResourceMode.DISABLED);
                                    }

                                    NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.DECLINED));
                                }

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


示例8: handleResourcePackStatus

import net.minecraft.network.play.client.CPacketResourcePackStatus; //导入依赖的package包/类
@Override
public void handleResourcePackStatus(CPacketResourcePackStatus packetIn) {
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:4,代码来源:FakeNetHandlerPlayServer.java


示例9: handleResourcePack

import net.minecraft.network.play.client.CPacketResourcePackStatus; //导入依赖的package包/类
public void handleResourcePack(SPacketResourcePackSend packetIn)
{
    final String s = packetIn.getURL();
    final String s1 = packetIn.getHash();

    if (this.func_189688_b(s))
    {
        if (s.startsWith("level://"))
        {
            String s2 = s.substring("level://".length());
            File file1 = new File(this.gameController.mcDataDir, "saves");
            File file2 = new File(file1, s2);

            if (file2.isFile())
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                Futures.addCallback(this.gameController.getResourcePackRepository().setResourcePackInstance(file2), this.func_189686_f());
            }
            else
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.FAILED_DOWNLOAD));
            }
        }
        else
        {
            ServerData serverdata = this.gameController.getCurrentServerData();

            if (serverdata != null && serverdata.getResourceMode() == ServerData.ServerResourceMode.ENABLED)
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                Futures.addCallback(this.gameController.getResourcePackRepository().downloadResourcePack(s, s1), this.func_189686_f());
            }
            else if (serverdata != null && serverdata.getResourceMode() != ServerData.ServerResourceMode.PROMPT)
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.DECLINED));
            }
            else
            {
                this.gameController.addScheduledTask(new Runnable()
                {
                    public void run()
                    {
                        NetHandlerPlayClient.this.gameController.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
                        {
                            public void confirmClicked(boolean result, int id)
                            {
                                NetHandlerPlayClient.this.gameController = Minecraft.getMinecraft();
                                ServerData serverdata1 = NetHandlerPlayClient.this.gameController.getCurrentServerData();

                                if (result)
                                {
                                    if (serverdata1 != null)
                                    {
                                        serverdata1.setResourceMode(ServerData.ServerResourceMode.ENABLED);
                                    }

                                    NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                                    Futures.addCallback(NetHandlerPlayClient.this.gameController.getResourcePackRepository().downloadResourcePack(s, s1), NetHandlerPlayClient.this.func_189686_f());
                                }
                                else
                                {
                                    if (serverdata1 != null)
                                    {
                                        serverdata1.setResourceMode(ServerData.ServerResourceMode.DISABLED);
                                    }

                                    NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.DECLINED));
                                }

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


示例10: handleResourcePackStatus

import net.minecraft.network.play.client.CPacketResourcePackStatus; //导入依赖的package包/类
@Override
public void handleResourcePackStatus(@Nonnull CPacketResourcePackStatus packetIn) {
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:4,代码来源:FakeNetHandlerPlayServer.java


示例11: handleResourcePackStatus

import net.minecraft.network.play.client.CPacketResourcePackStatus; //导入依赖的package包/类
@Override
public void handleResourcePackStatus(CPacketResourcePackStatus packetIn) {

}
 
开发者ID:p455w0rd,项目名称:DankNull,代码行数:5,代码来源:NetServerHandlerFake.java


示例12: handleResourcePackStatus

import net.minecraft.network.play.client.CPacketResourcePackStatus; //导入依赖的package包/类
void handleResourcePackStatus(CPacketResourcePackStatus packetIn); 
开发者ID:sudofox,项目名称:Backmemed,代码行数:2,代码来源:INetHandlerPlayServer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConsoleUI类代码示例发布时间:2022-05-22
下一篇:
Java EurekaClientConfig类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap