Пример #1
0
 public static Texture getTextureFromUrl(String url) {
   Texture tex = getTextureFromUrl(null, url);
   if (tex == null) {
     CustomTextureManager.downloadTexture(url, true);
     tex =
         CustomTextureManager.getTextureFromPath(
             FileUtil.getAssetsDir().getPath() + "/block/spout.png");
   }
   return tex;
 }
Пример #2
0
  public void render(int x, int y, int width, int height) {
    MCRenderDelegate r = (MCRenderDelegate) SpoutClient.getInstance().getRenderDelegate();
    FontRenderer font = SpoutClient.getHandle().fontRenderer;

    String sResolution = resolution + "x";
    int sWidth = font.getStringWidth(sResolution);
    font.drawStringWithShadow(sResolution, x + width - sWidth - 2, y + 2, 0xffaaaaaa);

    String name = r.getFittingText(getName(), width - 29 - sWidth - 2 - x);
    font.drawStringWithShadow(name, x + 29, y + 2, 0xffffffff);

    String sStatus = "";
    if (size > 1024 * 1024 * 9000) {
      sStatus = ChatColor.RED + "It's over 9000! ";
    }
    if (size > 1024 * 1024) {
      sStatus += size / (1024 * 1024) + " MB";
    } else if (size > 1024) {
      sStatus = size / 1024 + " KB";
    } else {
      sStatus = size + " Bytes";
    }
    if (isDownloading()) {
      sStatus = "Downloading: " + ChatColor.WHITE + download.getProgress() + "%";
    }
    if (downloadFail != null) {
      sStatus = downloadFail;
    }
    if (installed) {
      sStatus = ChatColor.GREEN + "Installed";
    }
    if (sStatus != null) {
      sWidth = font.getStringWidth(sStatus);
      font.drawStringWithShadow(sStatus, x + width - sWidth - 2, y + 11, 0xffaaaaaa);
    }

    String author = "by " + ChatColor.WHITE + getAuthor();
    author = r.getFittingText(author, width - 29 - sWidth - 2 - x);
    font.drawStringWithShadow(author, x + 29, y + 11, 0xffaaaaaa);

    String desc = r.getFittingText(getDescription(), width - 2 - 29);
    font.drawStringWithShadow(desc, x + 29, y + 20, 0xffaaaaaa);

    String iconUrl = getIconUrl();
    Texture icon = CustomTextureManager.getTextureFromUrl(iconUrl);
    if (icon == null) {
      CustomTextureManager.downloadTexture(iconUrl, true);
    } else {
      GL11.glPushMatrix();
      GL11.glTranslated(x + 2, y + 2, 0);
      r.drawTexture(icon, 25, 25);
      GL11.glPopMatrix();
    }
  }
 public static void downloadTexture(String plugin, String url) {
   downloadTexture(plugin, url, false);
 }
 public static void downloadTexture(String url, boolean ignoreEnding) {
   downloadTexture(null, url, ignoreEnding);
 }
 public static void downloadTexture(String url) {
   downloadTexture(null, url, false);
 }