Java Code Examples for net.minecraft.tileentity.TileEntitySkull#updateGameprofile()
The following examples show how to use
net.minecraft.tileentity.TileEntitySkull#updateGameprofile() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CraftMetaSkull.java From Kettle with GNU General Public License v3.0 | 5 votes |
@Override void applyToItem(NBTTagCompound tag) { super.applyToItem(tag); if (profile != null) { // Fill in textures profile = TileEntitySkull.updateGameprofile(profile); NBTTagCompound owner = new NBTTagCompound(); NBTUtil.writeGameProfile(owner, profile); tag.setTag(SKULL_OWNER.NBT, owner); } }
Example 2
Source File: MixinTileEntityItemStackRenderer.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
/** * @author CCBlueX */ @Overwrite public void renderByItem(ItemStack itemStackIn) { if(itemStackIn.getItem() == Items.banner) { this.banner.setItemValues(itemStackIn); TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F); }else if(itemStackIn.getItem() == Items.skull) { GameProfile gameprofile = null; if(itemStackIn.hasTagCompound()) { NBTTagCompound nbttagcompound = itemStackIn.getTagCompound(); try { if(nbttagcompound.hasKey("SkullOwner", 10)) { gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner")); }else if(nbttagcompound.hasKey("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) { GameProfile lvt_2_2_ = new GameProfile(null, nbttagcompound.getString("SkullOwner")); gameprofile = TileEntitySkull.updateGameprofile(lvt_2_2_); nbttagcompound.removeTag("SkullOwner"); nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile)); } }catch(Exception ignored) { } } if(TileEntitySkullRenderer.instance != null) { GlStateManager.pushMatrix(); GlStateManager.translate(-0.5F, 0.0F, -0.5F); GlStateManager.scale(2.0F, 2.0F, 2.0F); GlStateManager.disableCull(); TileEntitySkullRenderer.instance.renderSkull(0.0F, 0.0F, 0.0F, EnumFacing.UP, 0.0F, itemStackIn.getMetadata(), gameprofile, -1); GlStateManager.enableCull(); GlStateManager.popMatrix(); } }else{ Block block = Block.getBlockFromItem(itemStackIn.getItem()); if(block == Blocks.ender_chest) { TileEntityRendererDispatcher.instance.renderTileEntityAt(this.enderChest, 0.0D, 0.0D, 0.0D, 0.0F); }else if(block == Blocks.trapped_chest) { TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); }else if(block != Blocks.chest) net.minecraftforge.client.ForgeHooksClient.renderTileItem(itemStackIn.getItem(), itemStackIn.getMetadata()); else{ TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F); } } }
Example 3
Source File: MixinTileEntityItemStackRenderer.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
/** * @author CCBlueX */ @Overwrite public void renderByItem(ItemStack itemStackIn) { if(itemStackIn.getItem() == Items.banner) { this.banner.setItemValues(itemStackIn); TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F); }else if(itemStackIn.getItem() == Items.skull) { GameProfile gameprofile = null; if(itemStackIn.hasTagCompound()) { NBTTagCompound nbttagcompound = itemStackIn.getTagCompound(); try { if(nbttagcompound.hasKey("SkullOwner", 10)) { gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner")); }else if(nbttagcompound.hasKey("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) { GameProfile lvt_2_2_ = new GameProfile(null, nbttagcompound.getString("SkullOwner")); gameprofile = TileEntitySkull.updateGameprofile(lvt_2_2_); nbttagcompound.removeTag("SkullOwner"); nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile)); } }catch(Exception ignored) { } } if(TileEntitySkullRenderer.instance != null) { GlStateManager.pushMatrix(); GlStateManager.translate(-0.5F, 0.0F, -0.5F); GlStateManager.scale(2.0F, 2.0F, 2.0F); GlStateManager.disableCull(); TileEntitySkullRenderer.instance.renderSkull(0.0F, 0.0F, 0.0F, EnumFacing.UP, 0.0F, itemStackIn.getMetadata(), gameprofile, -1); GlStateManager.enableCull(); GlStateManager.popMatrix(); } }else{ Block block = Block.getBlockFromItem(itemStackIn.getItem()); if(block == Blocks.ender_chest) { TileEntityRendererDispatcher.instance.renderTileEntityAt(this.enderChest, 0.0D, 0.0D, 0.0D, 0.0F); }else if(block == Blocks.trapped_chest) { TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); }else{ TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F); } } }