@Redirect( method = "renderSkull", at = @At( value = "INVOKE", target = "Lnet/minecraft/client/renderer/tileentity/TileEntitySkullRenderer;bindTexture(Lnet/minecraft/util/ResourceLocation;)V", ordinal = 4)) private void onBindTexture(TileEntitySkullRenderer tesr, ResourceLocation rl, float x, float y, float z, EnumFacing facing, float rotation, int meta, @Nullable GameProfile profile, int p_180543_8_, float ticks) { if (profile != null) { Optional<ResourceLocation> skin = HDSkinManager.INSTANCE.getSkinLocation(profile, Type.SKIN, true); if (skin.isPresent()) // rebind bindTexture(skin.get()); else bindTexture(rl); } else bindTexture(rl); }
private TileEntityRenderer() { this.field_76966_m.put(TileEntitySign.class, new TileEntitySignRenderer()); this.field_76966_m.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); this.field_76966_m.put(TileEntityPiston.class, new TileEntityRendererPiston()); this.field_76966_m.put(TileEntityChest.class, new TileEntityChestRenderer()); this.field_76966_m.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.field_76966_m.put(TileEntityEnchantmentTable.class, new RenderEnchantmentTable()); this.field_76966_m.put(TileEntityEndPortal.class, new RenderEndPortal()); this.field_76966_m.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.field_76966_m.put(TileEntitySkull.class, new TileEntitySkullRenderer()); Iterator var1 = this.field_76966_m.values().iterator(); while(var1.hasNext()) { TileEntitySpecialRenderer var2 = (TileEntitySpecialRenderer)var1.next(); var2.func_76893_a(this); } }
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) { ItemStack itemstack = entitylivingbaseIn.getCurrentArmor(3); if (itemstack != null && itemstack.getItem() != null) { Item item = itemstack.getItem(); Minecraft minecraft = Minecraft.getMinecraft(); GlStateManager.pushMatrix(); if (entitylivingbaseIn.isSneaking()) { GlStateManager.translate(0.0F, 0.2F, 0.0F); } boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombie && ((EntityZombie)entitylivingbaseIn).isVillager(); if (!flag && entitylivingbaseIn.isChild()) { float f = 2.0F; float f1 = 1.4F; GlStateManager.scale(f1 / f, f1 / f, f1 / f); GlStateManager.translate(0.0F, 16.0F * scale, 0.0F); } this.field_177209_a.postRender(0.0625F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); if (item instanceof ItemBlock) { float f2 = 0.625F; GlStateManager.translate(0.0F, -0.25F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(f2, -f2, -f2); if (flag) { GlStateManager.translate(0.0F, 0.1875F, 0.0F); } minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.HEAD); } else if (item == Items.skull) { float f3 = 1.1875F; GlStateManager.scale(f3, -f3, -f3); if (flag) { GlStateManager.translate(0.0F, 0.0625F, 0.0F); } GameProfile gameprofile = null; if (itemstack.hasTagCompound()) { NBTTagCompound nbttagcompound = itemstack.getTagCompound(); if (nbttagcompound.hasKey("SkullOwner", 10)) { gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner")); } else if (nbttagcompound.hasKey("SkullOwner", 8)) { String s = nbttagcompound.getString("SkullOwner"); if (!StringUtils.isNullOrEmpty(s)) { gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s)); nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile)); } } } TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), gameprofile, -1); } GlStateManager.popMatrix(); } }
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.HEAD); if (!itemstack.func_190926_b()) { Item item = itemstack.getItem(); Minecraft minecraft = Minecraft.getMinecraft(); GlStateManager.pushMatrix(); if (entitylivingbaseIn.isSneaking()) { GlStateManager.translate(0.0F, 0.2F, 0.0F); } boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombieVillager; if (entitylivingbaseIn.isChild() && !(entitylivingbaseIn instanceof EntityVillager)) { float f = 2.0F; float f1 = 1.4F; GlStateManager.translate(0.0F, 0.5F * scale, 0.0F); GlStateManager.scale(0.7F, 0.7F, 0.7F); GlStateManager.translate(0.0F, 16.0F * scale, 0.0F); } this.modelRenderer.postRender(0.0625F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); if (item == Items.SKULL) { float f2 = 1.1875F; GlStateManager.scale(1.1875F, -1.1875F, -1.1875F); if (flag) { GlStateManager.translate(0.0F, 0.0625F, 0.0F); } GameProfile gameprofile = null; if (itemstack.hasTagCompound()) { NBTTagCompound nbttagcompound = itemstack.getTagCompound(); if (nbttagcompound.hasKey("SkullOwner", 10)) { gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner")); } else if (nbttagcompound.hasKey("SkullOwner", 8)) { String s = nbttagcompound.getString("SkullOwner"); if (!StringUtils.isBlank(s)) { gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s)); nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile)); } } } TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), gameprofile, -1, limbSwing); } else if (!(item instanceof ItemArmor) || ((ItemArmor)item).getEquipmentSlot() != EntityEquipmentSlot.HEAD) { float f3 = 0.625F; GlStateManager.translate(0.0F, -0.25F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(0.625F, -0.625F, -0.625F); if (flag) { GlStateManager.translate(0.0F, 0.1875F, 0.0F); } minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.HEAD); } GlStateManager.popMatrix(); } }
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.HEAD); if (itemstack != null && itemstack.getItem() != null) { Item item = itemstack.getItem(); Minecraft minecraft = Minecraft.getMinecraft(); GlStateManager.pushMatrix(); if (entitylivingbaseIn.isSneaking()) { GlStateManager.translate(0.0F, 0.2F, 0.0F); } boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombie && ((EntityZombie)entitylivingbaseIn).isVillager(); if (entitylivingbaseIn.isChild() && !(entitylivingbaseIn instanceof EntityVillager)) { float f = 2.0F; float f1 = 1.4F; GlStateManager.translate(0.0F, 0.5F * scale, 0.0F); GlStateManager.scale(0.7F, 0.7F, 0.7F); GlStateManager.translate(0.0F, 16.0F * scale, 0.0F); } this.modelRenderer.postRender(0.0625F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); if (item == Items.SKULL) { float f2 = 1.1875F; GlStateManager.scale(1.1875F, -1.1875F, -1.1875F); if (flag) { GlStateManager.translate(0.0F, 0.0625F, 0.0F); } GameProfile gameprofile = null; if (itemstack.hasTagCompound()) { NBTTagCompound nbttagcompound = itemstack.getTagCompound(); if (nbttagcompound.hasKey("SkullOwner", 10)) { gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner")); } else if (nbttagcompound.hasKey("SkullOwner", 8)) { String s = nbttagcompound.getString("SkullOwner"); if (!StringUtils.isNullOrEmpty(s)) { gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s)); nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile)); } } } TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), gameprofile, -1, limbSwing); } else if (!(item instanceof ItemArmor) || ((ItemArmor)item).getEquipmentSlot() != EntityEquipmentSlot.HEAD) { float f3 = 0.625F; GlStateManager.translate(0.0F, -0.25F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(0.625F, -0.625F, -0.625F); if (flag) { GlStateManager.translate(0.0F, 0.1875F, 0.0F); } minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.HEAD); } GlStateManager.popMatrix(); } }
/** * Render the layer * * This method is responsible for rendering either skull with player's name * or an item (i.e. block or something) on custom model's head. Hardcoded * to vanilla player model. */ @Override public void doRenderLayer(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.HEAD); if (itemstack != null && itemstack.getItem() != null) { Item item = itemstack.getItem(); Minecraft minecraft = Minecraft.getMinecraft(); GlStateManager.pushMatrix(); if (entity.isSneaking()) { GlStateManager.translate(0.0F, 0.2F, 0.0F); } if (entity.isChild() && !(entity instanceof EntityVillager)) { GlStateManager.translate(0.0F, 0.5F * scale, 0.0F); GlStateManager.scale(0.7F, 0.7F, 0.7F); GlStateManager.translate(0.0F, 16.0F * scale, 0.0F); } this.model.setLivingAnimations(entity, limbSwing, limbSwingAmount, partialTicks); this.model.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entity); this.model.bipedHead.postRender(0.0625F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); /* Player skull rendering */ if (item == Items.SKULL) { GlStateManager.scale(1.1875F, -1.1875F, -1.1875F); GameProfile gameprofile = null; if (itemstack.hasTagCompound()) { NBTTagCompound nbttagcompound = itemstack.getTagCompound(); if (nbttagcompound.hasKey("SkullOwner", 10)) { gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner")); } else if (nbttagcompound.hasKey("SkullOwner", 8)) { String s = nbttagcompound.getString("SkullOwner"); if (!StringUtils.isNullOrEmpty(s)) { gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID) null, s)); nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile)); } } } TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), gameprofile, -1, limbSwing); } else if (!(item instanceof ItemArmor) || ((ItemArmor) item).getEquipmentSlot() != EntityEquipmentSlot.HEAD) { /* Custom block rendering */ GlStateManager.translate(0.0F, -0.25F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(0.625F, -0.625F, -0.625F); minecraft.getItemRenderer().renderItem(entity, itemstack, ItemCameraTransforms.TransformType.HEAD); } GlStateManager.popMatrix(); } }
/** * Method for adding special render rules */ protected void renderSpecials(EntityStatuePlayer player, float par2) { float f1 = 1.0F; GL11.glColor3f(f1, f1, f1); super.renderEquippedItems(player, par2); super.renderArrowsStuckInEntity(player, par2); ItemStack stack = player.inventory.armorItemInSlot(3); if (stack != null) { GL11.glPushMatrix(); modelBipedMain.bipedHead.postRender(0.0625F); float f2; if (stack != null && stack.getItem() instanceof ItemBlock) { IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(stack, EQUIPPED); boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, stack, BLOCK_3D)); if (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) { f2 = 0.625F; GL11.glTranslatef(0.0F, -0.25F, 0.0F); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(f2, -f2, -f2); } renderManager.itemRenderer.renderItem(player, stack, 0); } else if (stack.getItem().equals(Items.skull)) { f2 = 1.0625F; GL11.glScalef(f2, -f2, -f2); GameProfile s = null; if (stack.hasTagCompound() && stack.getTagCompound().hasKey("Owner")) { s = NBTUtil.func_152459_a(stack.getTagCompound().getCompoundTag("Owner")); } TileEntitySkullRenderer.field_147536_b.func_152674_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, stack.getItemDamage(), s); } GL11.glPopMatrix(); } renderItemInRightArm(player); renderItemInLeftArm(player); }