Exemple #1
0
 public static String getDurationString(PotionEffect p_76389_0_) {
   if (p_76389_0_.getIsPotionDurationMax()) {
     return "**:**";
   } else {
     int var1 = p_76389_0_.getDuration();
     return StringUtils.ticksToElapsedTime(var1);
   }
 }
  protected void renderHUDText(int width, int height) {
    mc.mcProfiler.startSection("forgeHudText");
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
    ArrayList<String> listL = new ArrayList<String>();
    ArrayList<String> listR = new ArrayList<String>();

    if (mc.isDemo()) {
      long time = mc.theWorld.getTotalWorldTime();
      if (time >= 120500L) {
        listR.add(I18n.format("demo.demoExpired"));
      } else {
        listR.add(
            I18n.format(
                "demo.remainingTime", StringUtils.ticksToElapsedTime((int) (120500L - time))));
      }
    }

    if (this.mc.gameSettings.showDebugInfo && !pre(DEBUG)) {
      listL.addAll(debugOverlay.getLeft());
      listR.addAll(debugOverlay.getRight());
      post(DEBUG);
    }

    RenderGameOverlayEvent.Text event = new RenderGameOverlayEvent.Text(eventParent, listL, listR);
    if (!MinecraftForge.EVENT_BUS.post(event)) {
      int top = 2;
      for (String msg : listL) {
        if (msg == null) continue;
        drawRect(
            1,
            top - 1,
            2 + fontrenderer.getStringWidth(msg) + 1,
            top + fontrenderer.FONT_HEIGHT - 1,
            -1873784752);
        fontrenderer.drawString(msg, 2, top, 14737632);
        top += fontrenderer.FONT_HEIGHT;
      }

      top = 2;
      for (String msg : listR) {
        if (msg == null) continue;
        int w = fontrenderer.getStringWidth(msg);
        int left = width - 2 - w;
        drawRect(left - 1, top - 1, left + w + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752);
        fontrenderer.drawString(msg, left, top, 14737632);
        top += fontrenderer.FONT_HEIGHT;
      }
    }

    mc.mcProfiler.endSection();
    post(TEXT);
  }
  public EntityPlayerSP(Minecraft par1Minecraft, World par2World, Session par3Session, int par4) {
    super(par2World);
    this.mc = par1Minecraft;
    this.dimension = par4;

    if (par3Session != null && par3Session.username != null && par3Session.username.length() > 0) {
      this.skinUrl =
          "http://skins.minecraft.net/MinecraftSkins/"
              + StringUtils.stripControlCodes(par3Session.username)
              + ".png";
    }

    this.username = par3Session.username;
  }
  private void bindPlayerHead(GCCoreEntityFlag e) {
    final String s1 =
        "http://skins.minecraft.net/MinecraftSkins/"
            + StringUtils.stripControlCodes(e.getOwner())
            + ".png";

    if (!FMLClientHandler.instance().getClient().renderEngine.hasImageData(s1)) {
      FMLClientHandler.instance()
          .getClient()
          .renderEngine
          .obtainImageData(s1, new ImageBufferDownload());
    }

    this.bindTextureByURL(s1, "/mob/char.png");
  }
Exemple #5
0
  public void func_175185_b(ScaledResolution p_175185_1_) {
    this.mc.mcProfiler.startSection("demo");
    String var2 = "";

    if (this.mc.theWorld.getTotalWorldTime() >= 120500L) {
      var2 = I18n.format("demo.demoExpired", new Object[0]);
    } else {
      var2 =
          I18n.format(
              "demo.remainingTime",
              new Object[] {
                StringUtils.ticksToElapsedTime(
                    (int) (120500L - this.mc.theWorld.getTotalWorldTime()))
              });
    }

    int var3 = this.func_175179_f().getStringWidth(var2);
    this.func_175179_f()
        .func_175063_a(var2, (float) (p_175185_1_.getScaledWidth() - var3 - 10), 5.0F, 16777215);
    this.mc.mcProfiler.endSection();
  }
  // 独自の手に持ったアイテムの描画(ModelBiped)
  private void renderEquippedItems(EntityLiving par1Entity, float par2) {
    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    super.renderEquippedItems(par1Entity, par2);
    ItemStack itemstack = par1Entity.getHeldItem();
    ItemStack itemstack1 = par1Entity.func_130225_q(3);
    Item item;
    float f1;

    if (itemstack1 != null) {
      GL11.glPushMatrix();
      // this.modelBipedMain.bipedHead.postRender( 0.0625F );
      item = itemstack1.getItem();

      IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED);
      boolean is3D =
          (customRenderer != null
              && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D));

      if (item instanceof ItemBlock) {
        if (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType())) {
          f1 = 0.625F;
          GL11.glTranslatef(0.0F, -0.25F, 0.0F);
          GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
          GL11.glScalef(f1, -f1, -f1);
        }

        this.renderManager.itemRenderer.renderItem(par1Entity, itemstack1, 0);
      } else if (item == Items.skull) {
        f1 = 1.0625F;
        GL11.glScalef(f1, -f1, -f1);
        GameProfile gameprofile = null;

        if (itemstack1.hasTagCompound()) {
          NBTTagCompound nbttagcompound = itemstack1.getTagCompound();

          if (nbttagcompound.hasKey("SkullOwner", 10)) {
            gameprofile = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("SkullOwner"));
          } else if (nbttagcompound.hasKey("SkullOwner", 8)
              && !StringUtils.isNullOrEmpty(nbttagcompound.getString("SkullOwner"))) {
            gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner"));
          }
        }

        TileEntitySkullRenderer.field_147536_b.func_152674_a(
            -0.5F, 0.0F, -0.5F, 1, 180.0F, itemstack1.getItemDamage(), gameprofile);
      }

      GL11.glPopMatrix();
    }

    if (itemstack != null && itemstack.getItem() != null) {
      item = itemstack.getItem();
      GL11.glPushMatrix();

      if (this.mainModel.isChild) {
        f1 = 0.5F;
        GL11.glTranslatef(0.0F, 0.625F, 0.0F);
        GL11.glRotatef(-20.0F, -1.0F, 0.0F, 0.0F);
        GL11.glScalef(f1, f1, f1);
      }

      this.modelLivingChestMain.rightArm.postRender(0.0625F);
      GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);

      IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
      boolean is3D =
          (customRenderer != null
              && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));

      if (item instanceof ItemBlock
          && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType()))) {
        f1 = 0.5F;
        GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
        f1 *= 0.75F;
        GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(-f1, -f1, f1);
      } else if (item == Items.bow) {
        f1 = 0.625F;
        GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
        GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(f1, -f1, f1);
        GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
      } else if (item.isFull3D()) {
        f1 = 0.625F;

        if (item.shouldRotateAroundWhenRendering()) {
          GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
          GL11.glTranslatef(0.0F, -0.125F, 0.0F);
        }

        this.func_82422_c();
        GL11.glScalef(f1, -f1, f1);
        GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
      } else {
        f1 = 0.375F;
        GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
        GL11.glScalef(f1, f1, f1);
        GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
      }

      float f2;
      float f3;
      int i;

      if (itemstack.getItem().requiresMultipleRenderPasses()) {
        for (i = 0; i < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++i) {
          int j = itemstack.getItem().getColorFromItemStack(itemstack, i);
          f2 = (j >> 16 & 255) / 255.0F;
          f3 = (j >> 8 & 255) / 255.0F;
          float f4 = (j & 255) / 255.0F;
          GL11.glColor4f(f2, f3, f4, 1.0F);
          this.renderManager.itemRenderer.renderItem(par1Entity, itemstack, i);
        }
      } else {
        i = itemstack.getItem().getColorFromItemStack(itemstack, 0);
        float f5 = (i >> 16 & 255) / 255.0F;
        f2 = (i >> 8 & 255) / 255.0F;
        f3 = (i & 255) / 255.0F;
        GL11.glColor4f(f5, f2, f3, 1.0F);
        this.renderManager.itemRenderer.renderItem(par1Entity, itemstack, 0);
      }

      GL11.glPopMatrix();
    }
  }
 @SideOnly(Side.CLIENT)
 public void BuildLayeredName() {
   LayeredName = "pzskins/" + StringUtils.stripControlCodes(getPigZombieName()) + "/pigzombie";
 }
 @SideOnly(Side.CLIENT)
 public ResourceLocation func_110305_h(String par0Str) {
   return new ResourceLocation("pzskull/" + StringUtils.stripControlCodes(par0Str));
 }
 @SideOnly(Side.CLIENT)
 public ResourceLocation func_110299_g(String par0Str) {
   return new ResourceLocation("pzcloaks/" + StringUtils.stripControlCodes(par0Str));
 }
 @SideOnly(Side.CLIENT)
 private String getSkinName(String par0Str) {
   return "pzskins/" + StringUtils.stripControlCodes(par0Str);
 }
 public void updateCloak() {
   this.cloakUrl =
       "http://skins.minecraft.net/MinecraftCloaks/"
           + StringUtils.stripControlCodes(this.username)
           + ".png";
 }
 public void sendChatToPlayer(String par1Str) {
   this.func_98033_al().func_98233_a(StringUtils.stripControlCodes(par1Str));
 }
 public static ResourceLocation getLocationSkin(String par0Str) {
   return new ResourceLocation("skins/" + StringUtils.stripControlCodes(par0Str));
 }
 public static String getCapeUrl(String par0Str) {
   return String.format(
       "http://skins.minecraft.net/MinecraftCloaks/%s.png",
       new Object[] {StringUtils.stripControlCodes(par0Str)});
 }
 public static ResourceLocation getLocationCape2(String par0Str) {
   return new ResourceLocation("cloaksGC/" + StringUtils.stripControlCodes(par0Str));
 }
  public void func_82393_a(
      float par1, float par2, float par3, int par4, float par5, int par6, String par7Str) {
    ModelSkeletonHead var8 = this.field_82396_c;

    switch (par6) {
      case 0:
      default:
        this.bindTextureByName("/mob/skeleton.png");
        break;
      case 1:
        this.bindTextureByName("/mob/skeleton_wither.png");
        break;
      case 2:
        this.bindTextureByName("/mob/zombie.png");
        var8 = this.field_82395_d;
        break;
      case 3:
        if (par7Str != null && par7Str.length() > 0) {
          String var9 =
              "http://skins.minecraft.net/MinecraftSkins/"
                  + StringUtils.stripControlCodes(par7Str)
                  + ".png";

          if (!skullRenderer.tileEntityRenderer.renderEngine.hasImageData(var9)) {
            skullRenderer.tileEntityRenderer.renderEngine.obtainImageData(
                var9, new ImageBufferDownload());
          }

          this.func_82392_a(var9, "/mob/char.png");
        } else {
          this.bindTextureByName("/mob/char.png");
        }

        break;
      case 4:
        this.bindTextureByName("/mob/creeper.png");
    }

    GL11.glPushMatrix();
    GL11.glDisable(GL11.GL_CULL_FACE);

    if (par4 != 1) {
      switch (par4) {
        case 2:
          GL11.glTranslatef(par1 + 0.5F, par2 + 0.25F, par3 + 0.74F);
          break;
        case 3:
          GL11.glTranslatef(par1 + 0.5F, par2 + 0.25F, par3 + 0.26F);
          par5 = 180.0F;
          break;
        case 4:
          GL11.glTranslatef(par1 + 0.74F, par2 + 0.25F, par3 + 0.5F);
          par5 = 270.0F;
          break;
        case 5:
        default:
          GL11.glTranslatef(par1 + 0.26F, par2 + 0.25F, par3 + 0.5F);
          par5 = 90.0F;
      }
    } else {
      GL11.glTranslatef(par1 + 0.5F, par2, par3 + 0.5F);
    }

    float var10 = 0.0625F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glScalef(-1.0F, -1.0F, 1.0F);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    var8.render((Entity) null, 0.0F, 0.0F, 0.0F, par5, 0.0F, var10);
    GL11.glPopMatrix();
  }
 @SideOnly(Side.CLIENT)
 public String func_110308_e(String par0Str) {
   return String.format(
       "http://skins.minecraft.net/MinecraftCloaks/%s.png",
       new Object[] {StringUtils.stripControlCodes(par0Str)});
 }