protected void renderEquippedItems(EntityLiving var1, float var2) { super.renderEquippedItems(var1, var2); ItemStack var3 = var1.getHeldItem(); if (var3 != null) { GL11.glPushMatrix(); this.modelBipedMain.bipedRightArm.postRender(0.0625F); GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F); IItemRenderer var5 = MinecraftForgeClient.getItemRenderer(var3, IItemRenderer.ItemRenderType.EQUIPPED); boolean var6 = var5 != null && var5.shouldUseRenderHelper( IItemRenderer.ItemRenderType.EQUIPPED, var3, IItemRenderer.ItemRendererHelper.BLOCK_3D); float var4; if (var3.getItem() instanceof ItemBlock && (var6 || RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))) { var4 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); var4 *= 0.75F; GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(var4, -var4, var4); } else if (Item.itemsList[var3.itemID].isFull3D()) { var4 = 0.625F; GL11.glTranslatef(0.0F, 0.1875F, 0.0F); GL11.glScalef(var4, -var4, var4); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); } else { var4 = 0.375F; GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); GL11.glScalef(var4, var4, var4); 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); } this.renderManager.itemRenderer.renderItem(var1, var3, 0); if (var3.getItem().requiresMultipleRenderPasses()) { for (int var7 = 1; var7 < var3.getItem().getRenderPasses(var3.getItemDamage()); ++var7) { this.renderManager.itemRenderer.renderItem(var1, var3, var7); } } GL11.glPopMatrix(); } }
private EnumDamageType getDamageType(DamageSource source) { // 4.1 Determine the source of the damage and get the appropriate Damage Type if (source.getSourceOfDamage() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) source.getSourceOfDamage(); if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ICausesDamage) { return ((ICausesDamage) player.getCurrentEquippedItem().getItem()).getDamageType(); } } if (source.getSourceOfDamage() instanceof EntityLiving) { EntityLiving el = (EntityLiving) source.getSourceOfDamage(); if (el.getHeldItem() != null && el.getHeldItem().getItem() instanceof ICausesDamage) { return ((ICausesDamage) el.getHeldItem().getItem()).getDamageType(); } } if (source.getSourceOfDamage() instanceof ICausesDamage) { return ((ICausesDamage) source.getSourceOfDamage()).getDamageType(); } return EnumDamageType.GENERIC; }
public void doRenderLiving( EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) { float f2 = 1.0F; GL11.glColor3f(f2, f2, f2); ItemStack itemstack = par1EntityLiving.getHeldItem(); this.func_82420_a(par1EntityLiving, itemstack); double d3 = par4 - (double) par1EntityLiving.yOffset; if (par1EntityLiving.isSneaking() && !(par1EntityLiving instanceof EntityPlayerSP)) { d3 -= 0.125D; } super.doRenderLiving(par1EntityLiving, par2, d3, par6, par8, par9); this.field_82423_g.aimedBow = this.field_82425_h.aimedBow = this.modelBipedMain.aimedBow = false; this.field_82423_g.isSneak = this.field_82425_h.isSneak = this.modelBipedMain.isSneak = false; this.field_82423_g.heldItemRight = this.field_82425_h.heldItemRight = this.modelBipedMain.heldItemRight = 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(); } }
protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2) { float f1 = 1.0F; GL11.glColor3f(f1, f1, f1); super.renderEquippedItems(par1EntityLiving, par2); ItemStack itemstack = par1EntityLiving.getHeldItem(); ItemStack itemstack1 = par1EntityLiving.getCurrentArmor(3); float f2; if (itemstack1 != null) { GL11.glPushMatrix(); this.modelBipedMain.bipedHead.postRender(0.0625F); IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED); boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D)); if (itemstack1.getItem() instanceof ItemBlock) { if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].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); } this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack1, 0); } else if (itemstack1.getItem().itemID == Item.skull.itemID) { f2 = 1.0625F; GL11.glScalef(f2, -f2, -f2); String s = ""; if (itemstack1.hasTagCompound() && itemstack1.getTagCompound().hasKey("SkullOwner")) { s = itemstack1.getTagCompound().getString("SkullOwner"); } TileEntitySkullRenderer.skullRenderer.func_82393_a( -0.5F, 0.0F, -0.5F, 1, 180.0F, itemstack1.getItemDamage(), s); } GL11.glPopMatrix(); } if (itemstack != null) { GL11.glPushMatrix(); if (this.mainModel.isChild) { f2 = 0.5F; GL11.glTranslatef(0.0F, 0.625F, 0.0F); GL11.glRotatef(-20.0F, -1.0F, 0.0F, 0.0F); GL11.glScalef(f2, f2, f2); } this.modelBipedMain.bipedRightArm.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 (itemstack.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))) { f2 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); f2 *= 0.75F; GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f2, -f2, f2); } else if (itemstack.itemID == Item.bow.itemID) { f2 = 0.625F; GL11.glTranslatef(0.0F, 0.125F, 0.3125F); GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(f2, -f2, f2); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); } else if (Item.itemsList[itemstack.itemID].isFull3D()) { f2 = 0.625F; if (Item.itemsList[itemstack.itemID].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(f2, -f2, f2); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); } else { f2 = 0.375F; GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); GL11.glScalef(f2, f2, f2); 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); } this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 0); if (itemstack.getItem().requiresMultipleRenderPasses()) { for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) { this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, x); } } GL11.glPopMatrix(); } }