Java 类net.minecraft.network.play.client.CPacketResourcePackStatus 实例源码

项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
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;
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
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));
        }
    };
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
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;
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
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));
        }
    };
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
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;
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
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));
        }
    };
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
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;
    }
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
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));
        }
    };
}
项目:Zombe-Modpack    文件:NetHandlerPlayServer.java   
public void handleResourcePackStatus(CPacketResourcePackStatus packetIn)
{
}
项目:Backmemed    文件:NetHandlerPlayServer.java   
public void handleResourcePackStatus(CPacketResourcePackStatus packetIn)
{
}
项目:CustomWorldGen    文件:NetHandlerPlayServer.java   
public void handleResourcePackStatus(CPacketResourcePackStatus packetIn)
{
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
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));
                    }
                });
            }
        }
    }
}
项目:CrystalMod    文件:FakeNetHandlerPlayServer.java   
@Override
public void handleResourcePackStatus(CPacketResourcePackStatus packetIn) {
}
项目:ExpandedRailsMod    文件:NetHandlerPlayServer.java   
public void handleResourcePackStatus(CPacketResourcePackStatus packetIn)
{
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
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));
                    }
                });
            }
        }
    }
}
项目:EnderIO    文件:FakeNetHandlerPlayServer.java   
@Override
public void handleResourcePackStatus(@Nonnull CPacketResourcePackStatus packetIn) {
}
项目:DankNull    文件:NetServerHandlerFake.java   
@Override
public void handleResourcePackStatus(CPacketResourcePackStatus packetIn) {

}
项目:Backmemed    文件:INetHandlerPlayServer.java   
void handleResourcePackStatus(CPacketResourcePackStatus packetIn);
项目:CustomWorldGen    文件:INetHandlerPlayServer.java   
void handleResourcePackStatus(CPacketResourcePackStatus packetIn);