Пример #1
0
  @Override
  public void readFromNBT(NBTTagCompound nbttagcompound) {
    super.readFromNBT(nbttagcompound);

    if (nbttagcompound.hasKey("moniker")) {
      moniker = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("moniker"));
    }
  }
Пример #2
0
  public void onBlockPlacedBy(
      World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
    TileEntity te = world.getTileEntity(x, y, z);
    if (te != null && te instanceof TileEntityMannequin) {
      int l = MathHelper.floor_double((double) (player.rotationYaw * 16.0F / 360.0F) + 0.5D) & 15;
      ((TileEntityMannequin) te).setRotation(l);

      if (stack.hasTagCompound()) {
        NBTTagCompound compound = stack.getTagCompound();
        GameProfile gameProfile = null;
        if (compound.hasKey(TAG_OWNER, 10)) {
          gameProfile = NBTUtil.func_152459_a(compound.getCompoundTag(TAG_OWNER));
          ((TileEntityMannequin) te).setGameProfile(gameProfile);
        }
      }
    }
  }
Пример #3
0
  // 独自の手に持ったアイテムの描画(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();
    }
  }