public void renderByItem(ItemStack itemStackIn)
{
Item item = itemStackIn.getItem();
if (item == Items.BANNER)
{
this.banner.setItemValues(itemStackIn, false);
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F);
}
else if (item == Items.SHIELD)
{
if (itemStackIn.getSubCompound("BlockEntityTag") != null)
{
this.banner.setItemValues(itemStackIn, true);
Minecraft.getMinecraft().getTextureManager().bindTexture(BannerTextures.SHIELD_DESIGNS.getResourceLocation(this.banner.getPatternResourceLocation(), this.banner.getPatternList(), this.banner.getColorList()));
}
else
{
Minecraft.getMinecraft().getTextureManager().bindTexture(BannerTextures.SHIELD_BASE_TEXTURE);
}
GlStateManager.pushMatrix();
GlStateManager.scale(1.0F, -1.0F, -1.0F);
this.modelShield.render();
GlStateManager.popMatrix();
}
else if (item == Items.SKULL)
{
GameProfile gameprofile = null;
if (itemStackIn.hasTagCompound())
{
NBTTagCompound nbttagcompound = itemStackIn.getTagCompound();
if (nbttagcompound.hasKey("SkullOwner", 10))
{
gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
}
else if (nbttagcompound.hasKey("SkullOwner", 8) && !StringUtils.isBlank(nbttagcompound.getString("SkullOwner")))
{
GameProfile gameprofile1 = new GameProfile((UUID)null, nbttagcompound.getString("SkullOwner"));
gameprofile = TileEntitySkull.updateGameprofile(gameprofile1);
nbttagcompound.removeTag("SkullOwner");
nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
}
}
if (TileEntitySkullRenderer.instance != null)
{
GlStateManager.pushMatrix();
GlStateManager.disableCull();
TileEntitySkullRenderer.instance.renderSkull(0.0F, 0.0F, 0.0F, EnumFacing.UP, 180.0F, itemStackIn.getMetadata(), gameprofile, -1, 0.0F);
GlStateManager.enableCull();
GlStateManager.popMatrix();
}
}
else if (item == Item.getItemFromBlock(Blocks.ENDER_CHEST))
{
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.enderChest, 0.0D, 0.0D, 0.0D, 0.0F);
}
else if (item == Item.getItemFromBlock(Blocks.TRAPPED_CHEST))
{
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chestTrap, 0.0D, 0.0D, 0.0D, 0.0F);
}
else if (Block.getBlockFromItem(item) instanceof BlockShulkerBox)
{
TileEntityRendererDispatcher.instance.renderTileEntityAt(field_191274_b[BlockShulkerBox.func_190955_b(item).getMetadata()], 0.0D, 0.0D, 0.0D, 0.0F);
}
else
{
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chestBasic, 0.0D, 0.0D, 0.0D, 0.0F);
}
}
TileEntityItemStackRenderer.java 文件源码
java
阅读 16
收藏 0
点赞 0
评论 0
项目:Backmemed
作者:
评论列表
文章目录