public void loadResourcePack(String url, String hash) { this.connection.sendPacket(new SPacketResourcePackSend(url, hash)); }
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)); } }); } } } }
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)); } }); } } } }
void handleResourcePack(SPacketResourcePackSend packetIn);