@SubscribeEvent @SuppressWarnings("unused") public void onSkullHover(ItemTooltipEvent e) { if (e.getItemStack().getItem() instanceof ItemSkull && e.getItemStack().getMetadata() == 3) { ItemStack skull = e.getItemStack(); String playerName = ""; if (skull.getTagCompound() != null && skull.getTagCompound().hasKey("SkullOwner", 8)) { playerName = skull.getTagCompound().getString("SkullOwner"); } if (skull.getTagCompound() != null && skull.getTagCompound().hasKey("SkullOwner", 10)) { NBTTagCompound nbttagcompound = skull.getTagCompound().getCompoundTag("SkullOwner"); if (nbttagcompound.hasKey("Name", 8)) { playerName = nbttagcompound.getString("Name"); } } if (ConfigurationHandler.enableSkullOwner) { //TODO When waila updates - Add to tooltip e.getToolTip().remove(0); e.getToolTip().add(0, I18n.translateToLocal("tooltip.littlethings.playerSkull")); e.getToolTip().add(1, I18n.translateToLocalFormatted("tooltip.littlethings.skullOwner", playerName)); } if (Arrays.asList(playerNames).contains(playerName)) { if (ConfigurationHandler.enableColorfulText || !I18n.canTranslate("tooltip.littlethings.skull." + playerName + ".clean")) e.getToolTip().add(2, TextFormatting.ITALIC + I18n.translateToLocalFormatted("tooltip.littlethings.skull." + playerName)); else e.getToolTip().add(2, TextFormatting.ITALIC + I18n.translateToLocalFormatted("tooltip.littlethings.skull." + playerName + ".clean")); } } }
@SubscribeEvent public void onMobKillDropSkull(LivingDropsEvent e) { if (!e.getSource().isExplosion() && !e.getSource().isFireDamage()) { Entity justDied = e.getEntity(); justDied.getArmorInventoryList().forEach((itemStack -> { if (itemStack != null && itemStack.getItem() instanceof ItemSkull && itemStack.getMetadata() == 3) { String playerName = ""; if (itemStack.getTagCompound() != null && itemStack.getTagCompound().hasKey("SkullOwner", 8)) { playerName = itemStack.getTagCompound().getString("SkullOwner"); } if (itemStack.getTagCompound() != null && itemStack.getTagCompound().hasKey("SkullOwner", 10)) { NBTTagCompound nbttagcompound = itemStack.getTagCompound().getCompoundTag("SkullOwner"); if (nbttagcompound.hasKey("Name", 8)) { playerName = nbttagcompound.getString("Name"); } } if (Arrays.asList(playerNames).contains(playerName) || Arrays.asList(otherNames).contains(playerName)) { EntityItem ei = new EntityItem(justDied.worldObj, justDied.posX, justDied.posY, justDied.posZ, itemStack); if (e.getDrops().contains(ei)) e.getDrops().remove(ei); Random rng = new Random(); if (rng.nextDouble() < 0.1) e.getDrops().add(ei); } } })); } }
@SideOnly(Side.CLIENT) /** * Gets the icon name of the ItemBlock corresponding to this block. Used by hoppers. */ public String getItemIconName() { return this.getTextureName() + "_" + ItemSkull.field_94587_a[0]; }
private void renderItem(EntityItemFrame itemFrame) { ItemStack itemstack = itemFrame.getDisplayedItem(); if (itemstack != null) { EntityItem entityitem = new EntityItem(itemFrame.worldObj, 0.0D, 0.0D, 0.0D, itemstack); Item item = entityitem.getEntityItem().getItem(); entityitem.getEntityItem().stackSize = 1; entityitem.hoverStart = 0.0F; GlStateManager.pushMatrix(); GlStateManager.disableLighting(); int i = itemFrame.getRotation(); if (item instanceof net.minecraft.item.ItemMap) { i = i % 4 * 2; } GlStateManager.rotate((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); net.minecraftforge.client.event.RenderItemInFrameEvent event = new net.minecraftforge.client.event.RenderItemInFrameEvent(itemFrame, this); if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) { if (item instanceof net.minecraft.item.ItemMap) { this.renderManager.renderEngine.bindTexture(MAP_BACKGROUND_TEXTURES); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); float f = 0.0078125F; GlStateManager.scale(0.0078125F, 0.0078125F, 0.0078125F); GlStateManager.translate(-64.0F, -64.0F, 0.0F); MapData mapdata = Items.FILLED_MAP.getMapData(entityitem.getEntityItem(), itemFrame.worldObj); GlStateManager.translate(0.0F, 0.0F, -1.0F); if (mapdata != null) { this.mc.entityRenderer.getMapItemRenderer().renderMap(mapdata, true); } } else { GlStateManager.scale(0.5F, 0.5F, 0.5F); if (!this.itemRenderer.shouldRenderItemIn3D(entityitem.getEntityItem()) || item instanceof ItemSkull) { GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); } GlStateManager.pushAttrib(); RenderHelper.enableStandardItemLighting(); this.itemRenderer.renderItem(entityitem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED); RenderHelper.disableStandardItemLighting(); GlStateManager.popAttrib(); } } GlStateManager.enableLighting(); GlStateManager.popMatrix(); } }
public boolean renderItem(ItemStack displayItem){ GlStateManager.pushMatrix(); boolean itemBlock = false; try { final ItemStack sis = displayItem; GlStateManager.disableRescaleNormal(); IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(sis); if(sis.getItem() instanceof ItemBanner){ GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(0.5, 0.5, 0.5); GlStateManager.translate( 0.0f, (-0.14f*2)+0.1, 0 ); } else if(sis.getItem() instanceof ItemBlock && model.isGui3d()){ GlStateManager.scale(0.5, 0.5, 0.5); GlStateManager.scale(1, 1, 0.001F); GlStateManager.rotate(180, 0, 0, 1); GlStateManager.rotate(-210, 1, 0, 0); GlStateManager.rotate(45, 0, 1, 0); itemBlock = true; }else{ GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(0.4, 0.4, 0.4); } if (!Minecraft.getMinecraft().getRenderItem().shouldRenderItemIn3D(sis) || sis.getItem() instanceof ItemSkull) { GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); } GlStateManager.translate( 0.0f, 0.14f, 0 ); if(sis.getItem() instanceof net.minecraft.item.ItemMap){ bindTexture(new ResourceLocation("textures/map/map_background.png")); MapData mapdata = Items.FILLED_MAP.getMapData(sis, CrystalMod.proxy.getClientWorld()); if (mapdata != null) { GlStateManager.rotate(180, 0, 0, 1); GlStateManager.rotate(180, 0, 1, 0); GlStateManager.translate(-1, -0.9, 0); GlStateManager.scale(0.015625F, 0.015625F, 0.015625F); Minecraft.getMinecraft().entityRenderer.getMapItemRenderer().renderMap(mapdata, true); } }else Minecraft.getMinecraft().getRenderItem().renderItem(sis, TransformType.GUI); } catch( final Exception e ) { e.printStackTrace(); } finally { GlStateManager.enableRescaleNormal(); } GlStateManager.popMatrix(); return itemBlock; }
/** * Gets the icon name of the ItemBlock corresponding to this block. Used by hoppers. */ public String getItemIconName() { return this.getTextureName() + "_" + ItemSkull.field_94587_a[0]; }
@SideOnly(Side.CLIENT) public String getItemIconName() { return this.getTextureName() + "_" + ItemSkull.field_94587_a[0]; }
@SideOnly(Side.CLIENT) public String func_94327_t_() { return this.func_111023_E() + "_" + ItemSkull.field_94587_a[0]; }