public void doRenderLayer(EntityObj entityObj, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { boolean flag = entityObj.getPrimaryHand() == EnumHandSide.RIGHT; ItemStack itemstack = flag ? entityObj.getHeldItemOffhand() : entityObj.getHeldItemMainhand(); ItemStack itemstack1 = flag ? entityObj.getHeldItemMainhand() : entityObj.getHeldItemOffhand(); if (!itemstack.isEmpty() || !itemstack1.isEmpty()) { GL11.glPushMatrix(); //Basic model fixes GL11.glRotatef(ModelObj.initRotFix, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, ModelObj.offsetFixY, 0.0F); this.renderHeldItem(entityObj, itemstack1, ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, EnumHandSide.RIGHT); this.renderHeldItem(entityObj, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, EnumHandSide.LEFT); GL11.glPopMatrix(); } }
private void renderHeldItem(EntityObj entityObj, ItemStack itemStack, ItemCameraTransforms.TransformType cameraTransforms, EnumHandSide handSide) { if (!itemStack.isEmpty()) { GlStateManager.pushMatrix(); if (entityObj.isSneaking()) { GlStateManager.translate(0.0F, 0.2F, 0.0F); } objRenderer.transformToHandAndRotateAndScale(handSide); GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(-180.0F, 0.0F, 1.0F, 0.0F); boolean flag = handSide == EnumHandSide.LEFT; Minecraft.getMinecraft().getItemRenderer().renderItemSide(entityObj, itemStack, cameraTransforms, flag); GlStateManager.popMatrix(); } }
private static void renderArm(EnumHandSide p_187455_1_) { Minecraft mc = Minecraft.getMinecraft(); mc.getTextureManager().bindTexture(mc.player.getLocationSkin()); Render<AbstractClientPlayer> render = mc.getRenderManager() .<AbstractClientPlayer>getEntityRenderObject(mc.player); RenderPlayer renderplayer = (RenderPlayer) render; GlStateManager.pushMatrix(); float f = p_187455_1_ == EnumHandSide.RIGHT ? 1.0F : -1.0F; GlStateManager.rotate(92.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(f * -41.0F, 0.0F, 0.0F, 1.0F); GlStateManager.translate(f * 0.3F, -1.1F, 0.45F); if (p_187455_1_ == EnumHandSide.RIGHT) { renderplayer.renderRightArm(mc.player); } else { renderplayer.renderLeftArm(mc.player); } GlStateManager.popMatrix(); }
private void renderHeldItem(EntityLivingBase player, ItemStack stack, ItemCameraTransforms.TransformType cameraTransform, EnumHandSide handSide) { if (stack.isEmpty()) return; GlStateManager.pushMatrix(); if (handSide == EnumHandSide.LEFT) GlStateManager.translate(-4.35f / 16.0F, 0.7f, -0.1f); else GlStateManager.translate(4.35f / 16.0F, 0.7f, -0.1f); GlStateManager.rotate(40.0F, 1.0F, 0.0F, 0.0F); float scale = Config.beltItemScale; GlStateManager.scale(scale,scale,scale); Minecraft.getMinecraft().getItemRenderer().renderItemSide(player, stack, cameraTransform, handSide == EnumHandSide.LEFT); GlStateManager.popMatrix(); }
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { boolean flag = entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT; ItemStack itemstack = flag ? entitylivingbaseIn.getHeldItemOffhand() : entitylivingbaseIn.getHeldItemMainhand(); ItemStack itemstack1 = flag ? entitylivingbaseIn.getHeldItemMainhand() : entitylivingbaseIn.getHeldItemOffhand(); if (!itemstack.func_190926_b() || !itemstack1.func_190926_b()) { GlStateManager.pushMatrix(); if (this.livingEntityRenderer.getMainModel().isChild) { float f = 0.5F; GlStateManager.translate(0.0F, 0.75F, 0.0F); GlStateManager.scale(0.5F, 0.5F, 0.5F); } this.renderHeldItem(entitylivingbaseIn, itemstack1, ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, EnumHandSide.RIGHT); this.renderHeldItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, EnumHandSide.LEFT); GlStateManager.popMatrix(); } }
private void renderHeldItem(EntityLivingBase p_188358_1_, ItemStack p_188358_2_, ItemCameraTransforms.TransformType p_188358_3_, EnumHandSide handSide) { if (!p_188358_2_.func_190926_b()) { GlStateManager.pushMatrix(); this.func_191361_a(handSide); if (p_188358_1_.isSneaking()) { GlStateManager.translate(0.0F, 0.2F, 0.0F); } GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); boolean flag = handSide == EnumHandSide.LEFT; GlStateManager.translate((float)(flag ? -1 : 1) / 16.0F, 0.125F, -0.625F); Minecraft.getMinecraft().getItemRenderer().renderItemSide(p_188358_1_, p_188358_2_, p_188358_3_, flag); GlStateManager.popMatrix(); } }
public RenderVindicator(RenderManager p_i47189_1_) { super(p_i47189_1_, new ModelVindicator(0.0F), 0.5F); this.addLayer(new LayerHeldItem(this) { public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { if (((EntityVindicator)entitylivingbaseIn).func_190639_o()) { super.doRenderLayer(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale); } } protected void func_191361_a(EnumHandSide p_191361_1_) { ((ModelIllager)this.livingEntityRenderer.getMainModel()).func_191216_a(p_191361_1_).postRender(0.0625F); } }); }
private void renderArm(EnumHandSide p_187455_1_) { this.mc.getTextureManager().bindTexture(this.mc.player.getLocationSkin()); Render<AbstractClientPlayer> render = this.renderManager.<AbstractClientPlayer>getEntityRenderObject(this.mc.player); RenderPlayer renderplayer = (RenderPlayer)render; GlStateManager.pushMatrix(); float f = p_187455_1_ == EnumHandSide.RIGHT ? 1.0F : -1.0F; GlStateManager.rotate(92.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(f * -41.0F, 0.0F, 0.0F, 1.0F); GlStateManager.translate(f * 0.3F, -1.1F, 0.45F); if (p_187455_1_ == EnumHandSide.RIGHT) { renderplayer.renderRightArm(this.mc.player); } else { renderplayer.renderLeftArm(this.mc.player); } GlStateManager.popMatrix(); }
private void renderMapFirstPersonSide(float p_187465_1_, EnumHandSide p_187465_2_, float p_187465_3_, ItemStack p_187465_4_) { float f = p_187465_2_ == EnumHandSide.RIGHT ? 1.0F : -1.0F; GlStateManager.translate(f * 0.125F, -0.125F, 0.0F); if (!this.mc.player.isInvisible()) { GlStateManager.pushMatrix(); GlStateManager.rotate(f * 10.0F, 0.0F, 0.0F, 1.0F); this.renderArmFirstPerson(p_187465_1_, p_187465_3_, p_187465_2_); GlStateManager.popMatrix(); } GlStateManager.pushMatrix(); GlStateManager.translate(f * 0.51F, -0.08F + p_187465_1_ * -1.2F, -0.75F); float f1 = MathHelper.sqrt(p_187465_3_); float f2 = MathHelper.sin(f1 * (float)Math.PI); float f3 = -0.5F * f2; float f4 = 0.4F * MathHelper.sin(f1 * ((float)Math.PI * 2F)); float f5 = -0.3F * MathHelper.sin(p_187465_3_ * (float)Math.PI); GlStateManager.translate(f * f3, f4 - 0.3F * f2, f5); GlStateManager.rotate(f2 * -45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(f * f2 * -30.0F, 0.0F, 1.0F, 0.0F); this.renderMapFirstPerson(p_187465_4_); GlStateManager.popMatrix(); }
private void transformEatFirstPerson(float p_187454_1_, EnumHandSide p_187454_2_, ItemStack p_187454_3_) { float f = (float)this.mc.player.getItemInUseCount() - p_187454_1_ + 1.0F; float f1 = f / (float)p_187454_3_.getMaxItemUseDuration(); if (f1 < 0.8F) { float f2 = MathHelper.abs(MathHelper.cos(f / 4.0F * (float)Math.PI) * 0.1F); GlStateManager.translate(0.0F, f2, 0.0F); } float f3 = 1.0F - (float)Math.pow((double)f1, 27.0D); int i = p_187454_2_ == EnumHandSide.RIGHT ? 1 : -1; GlStateManager.translate(f3 * 0.6F * (float)i, f3 * -0.5F, f3 * 0.0F); GlStateManager.rotate((float)i * f3 * 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(f3 * 10.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate((float)i * f3 * 30.0F, 0.0F, 0.0F, 1.0F); }
/** * Used for easily adding entity-dependent animations. The second and third float params here are the same second * and third as in the setRotationAngles method. */ public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) { this.rightArmPose = ModelBiped.ArmPose.EMPTY; this.leftArmPose = ModelBiped.ArmPose.EMPTY; ItemStack itemstack = entitylivingbaseIn.getHeldItem(EnumHand.MAIN_HAND); if (itemstack.getItem() == Items.BOW && ((AbstractSkeleton)entitylivingbaseIn).isSwingingArms()) { if (entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT) { this.rightArmPose = ModelBiped.ArmPose.BOW_AND_ARROW; } else { this.leftArmPose = ModelBiped.ArmPose.BOW_AND_ARROW; } } super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime); }
public void postRenderArm(float scale, EnumHandSide side) { ModelRenderer modelrenderer = this.getArmForSide(side); if (this.smallArms) { float f = 0.5F * (float)(side == EnumHandSide.RIGHT ? 1 : -1); modelrenderer.rotationPointX += f; modelrenderer.postRender(scale); modelrenderer.rotationPointX -= f; } else { modelrenderer.postRender(scale); } }
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { boolean flag = entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT; ItemStack itemstack = flag ? entitylivingbaseIn.getHeldItemOffhand() : entitylivingbaseIn.getHeldItemMainhand(); ItemStack itemstack1 = flag ? entitylivingbaseIn.getHeldItemMainhand() : entitylivingbaseIn.getHeldItemOffhand(); if (itemstack != null || itemstack1 != null) { GlStateManager.pushMatrix(); if (this.livingEntityRenderer.getMainModel().isChild) { float f = 0.5F; GlStateManager.translate(0.0F, 0.625F, 0.0F); GlStateManager.rotate(-20.0F, -1.0F, 0.0F, 0.0F); GlStateManager.scale(0.5F, 0.5F, 0.5F); } this.renderHeldItem(entitylivingbaseIn, itemstack1, ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, EnumHandSide.RIGHT); this.renderHeldItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, EnumHandSide.LEFT); GlStateManager.popMatrix(); } }
private void renderHeldItem(EntityLivingBase p_188358_1_, ItemStack p_188358_2_, ItemCameraTransforms.TransformType p_188358_3_, EnumHandSide handSide) { if (p_188358_2_ != null) { GlStateManager.pushMatrix(); if (p_188358_1_.isSneaking()) { GlStateManager.translate(0.0F, 0.2F, 0.0F); } // Forge: moved this call down, fixes incorrect offset while sneaking. ((ModelBiped)this.livingEntityRenderer.getMainModel()).postRenderArm(0.0625F, handSide); GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); boolean flag = handSide == EnumHandSide.LEFT; GlStateManager.translate((float)(flag ? -1 : 1) / 16.0F, 0.125F, -0.625F); Minecraft.getMinecraft().getItemRenderer().renderItemSide(p_188358_1_, p_188358_2_, p_188358_3_, flag); GlStateManager.popMatrix(); } }
private void renderArm(EnumHandSide p_187455_1_) { this.mc.getTextureManager().bindTexture(this.mc.thePlayer.getLocationSkin()); Render<AbstractClientPlayer> render = this.renderManager.<AbstractClientPlayer>getEntityRenderObject(this.mc.thePlayer); RenderPlayer renderplayer = (RenderPlayer)render; GlStateManager.pushMatrix(); float f = p_187455_1_ == EnumHandSide.RIGHT ? 1.0F : -1.0F; GlStateManager.rotate(92.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(f * -41.0F, 0.0F, 0.0F, 1.0F); GlStateManager.translate(f * 0.3F, -1.1F, 0.45F); if (p_187455_1_ == EnumHandSide.RIGHT) { renderplayer.renderRightArm(this.mc.thePlayer); } else { renderplayer.renderLeftArm(this.mc.thePlayer); } GlStateManager.popMatrix(); }
private void renderMapFirstPersonSide(float p_187465_1_, EnumHandSide p_187465_2_, float p_187465_3_, ItemStack p_187465_4_) { float f = p_187465_2_ == EnumHandSide.RIGHT ? 1.0F : -1.0F; GlStateManager.translate(f * 0.125F, -0.125F, 0.0F); if (!this.mc.thePlayer.isInvisible()) { GlStateManager.pushMatrix(); GlStateManager.rotate(f * 10.0F, 0.0F, 0.0F, 1.0F); this.renderArmFirstPerson(p_187465_1_, p_187465_3_, p_187465_2_); GlStateManager.popMatrix(); } GlStateManager.pushMatrix(); GlStateManager.translate(f * 0.51F, -0.08F + p_187465_1_ * -1.2F, -0.75F); float f1 = MathHelper.sqrt_float(p_187465_3_); float f2 = MathHelper.sin(f1 * (float)Math.PI); float f3 = -0.5F * f2; float f4 = 0.4F * MathHelper.sin(f1 * ((float)Math.PI * 2F)); float f5 = -0.3F * MathHelper.sin(p_187465_3_ * (float)Math.PI); GlStateManager.translate(f * f3, f4 - 0.3F * f2, f5); GlStateManager.rotate(f2 * -45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(f * f2 * -30.0F, 0.0F, 1.0F, 0.0F); this.renderMapFirstPerson(p_187465_4_); GlStateManager.popMatrix(); }
private void transformEatFirstPerson(float p_187454_1_, EnumHandSide p_187454_2_, ItemStack p_187454_3_) { float f = (float)this.mc.thePlayer.getItemInUseCount() - p_187454_1_ + 1.0F; float f1 = f / (float)p_187454_3_.getMaxItemUseDuration(); if (f1 < 0.8F) { float f2 = MathHelper.abs(MathHelper.cos(f / 4.0F * (float)Math.PI) * 0.1F); GlStateManager.translate(0.0F, f2, 0.0F); } float f3 = 1.0F - (float)Math.pow((double)f1, 27.0D); int i = p_187454_2_ == EnumHandSide.RIGHT ? 1 : -1; GlStateManager.translate(f3 * 0.6F * (float)i, f3 * -0.5F, f3 * 0.0F); GlStateManager.rotate((float)i * f3 * 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(f3 * 10.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate((float)i * f3 * 30.0F, 0.0F, 0.0F, 1.0F); }
/** * Used for easily adding entity-dependent animations. The second and third float params here are the same second * and third as in the setRotationAngles method. */ public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) { this.rightArmPose = ModelBiped.ArmPose.EMPTY; this.leftArmPose = ModelBiped.ArmPose.EMPTY; ItemStack itemstack = entitylivingbaseIn.getHeldItem(EnumHand.MAIN_HAND); if (itemstack != null && itemstack.getItem() == Items.BOW && ((EntitySkeleton)entitylivingbaseIn).isSwingingArms()) { if (entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT) { this.rightArmPose = ModelBiped.ArmPose.BOW_AND_ARROW; } else { this.leftArmPose = ModelBiped.ArmPose.BOW_AND_ARROW; } } super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime); }
@Override public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) { this.rightArmPose = ModelBiped.ArmPose.EMPTY; this.leftArmPose = ModelBiped.ArmPose.EMPTY; ItemStack itemstack = entitylivingbaseIn.getHeldItem(EnumHand.MAIN_HAND); if (!itemstack.isEmpty() && itemstack.getItem() == Items.BOW && ((EntitySkeletonWarrior) entitylivingbaseIn).isSwingingArms()) { if (entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT) { this.rightArmPose = ModelBiped.ArmPose.BOW_AND_ARROW; } else { this.leftArmPose = ModelBiped.ArmPose.BOW_AND_ARROW; } } super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime); }
private void renderHeldItem(EntityLivingBase p_188358_1_, ItemStack p_188358_2_, ItemCameraTransforms.TransformType p_188358_3_, EnumHandSide handSide) { if (!p_188358_2_.isEmpty()) { GlStateManager.pushMatrix(); if (p_188358_1_.isSneaking()) { GlStateManager.translate(0.0F, 0.2F, 0.0F); } this.translateToHand(handSide); GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); boolean flag = handSide == EnumHandSide.LEFT; GlStateManager.translate((float) (flag ? -1 : 1) / 16.0F, 0.125F, -0.625F); Minecraft.getMinecraft().getItemRenderer().renderItemSide(p_188358_1_, p_188358_2_, p_188358_3_, flag); GlStateManager.popMatrix(); } }
@Override public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) { this.rightArmPose = ArmPose.EMPTY; this.leftArmPose = ArmPose.EMPTY; ItemStack itemstack = entitylivingbaseIn.getHeldItem(EnumHand.MAIN_HAND); if (!itemstack.isEmpty() && itemstack.getItem() == Items.BOW && ((EntityConvertedSkeleton) entitylivingbaseIn).isSwingingArms()) { if (entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT) { this.rightArmPose = ArmPose.BOW_AND_ARROW; } else { this.leftArmPose = ArmPose.BOW_AND_ARROW; } } super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime); }
@SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.HIGHEST) public void onRenderHand(RenderSpecificHandEvent event) { Minecraft.getMinecraft(); AbstractClientPlayer abstractclientplayer = (AbstractClientPlayer) CrystalMod.proxy.getClientPlayer(); ExtendedPlayer ePlayer = ExtendedPlayerProvider.getExtendedPlayer(abstractclientplayer); if(ePlayer !=null && ePlayer.getPlayerDisguiseUUID() !=null) { boolean flag = event.getHand() == EnumHand.MAIN_HAND; EnumHandSide enumhandside = flag ? abstractclientplayer.getPrimaryHand() : abstractclientplayer.getPrimaryHand().opposite(); if (ItemStackTools.isNullStack(event.getItemStack())) { if (flag && !abstractclientplayer.isInvisible()) { event.setCanceled(true); GlStateManager.pushMatrix(); renderArmFirstPerson(event.getEquipProgress(), event.getSwingProgress(), enumhandside, ePlayer.isMini()); GlStateManager.popMatrix(); } } } }
@Override protected void addLayers() { this.addLayer(new LayerHeldPonyItem(this) { @Override public void doPonyRender(EntityLivingBase vindicator, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { if (((EntityVindicator) vindicator).isAggressive()) { super.doPonyRender(vindicator, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale); } } @Override protected void translateToHand(EnumHandSide side) { ((ModelIllagerPony) this.getRenderer().getMainModel()).getArm(side).postRender(0.0625F); } }); }
@Override protected void addLayers() { this.addLayer(new LayerHeldPonyItem(this) { @Override public void doPonyRender(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { if (((EntityIllusionIllager) entitylivingbaseIn).isSpellcasting() || ((EntityIllusionIllager) entitylivingbaseIn).isAggressive()) { super.doPonyRender(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale); } } @Override protected void translateToHand(EnumHandSide p_191361_1_) { ((ModelIllagerPony) this.getRenderer().getMainModel()).getArm(p_191361_1_).postRender(0.0625F); } }); }
private static void renderGloves(AbstractClientPlayer player) { PlayerAether playerAether = PlayerAether.get(player); ItemStack accessoryStack = playerAether.accessories.stacks[6]; if (accessoryStack != null && accessoryStack.getItem() instanceof ItemAccessory && !player.isInvisible()) { GlStateManager.disableCull(); GlStateManager.pushMatrix(); GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); renderArm(playerAether, EnumHandSide.RIGHT, (ItemAccessory) accessoryStack.getItem()); renderArm(playerAether, EnumHandSide.LEFT, (ItemAccessory) accessoryStack.getItem()); GlStateManager.popMatrix(); GlStateManager.enableCull(); } }
/** * Used for easily adding entity-dependent animations. The second and third * float params here are the same second and third as in the * setRotationAngles method. */ public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) { this.rightArmPose = ModelBiped.ArmPose.EMPTY; this.leftArmPose = ModelBiped.ArmPose.EMPTY; ItemStack itemstack = entitylivingbaseIn.getHeldItem(EnumHand.MAIN_HAND); if (itemstack != null && itemstack.getItem() == Items.BOW && ((MobSkeleton) entitylivingbaseIn).isSwingingArms()) { if (entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT) { this.rightArmPose = ModelBiped.ArmPose.BOW_AND_ARROW; } else { this.leftArmPose = ModelBiped.ArmPose.BOW_AND_ARROW; } } super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime); }
/** Draws the temperature icon opposite the player's offhand. */ private static void drawTempIcon(EntityPlayer player, int centreX, int resHeight) { EnumHandSide hand = player.getPrimaryHand(); ResourceLocation icon = player.getCapability(GeoCaps .CAP_PLAYER, null).getTempIcon(); int x = hand == EnumHandSide.LEFT ? centreX + TEMP_OFFSET_X_LEFT : centreX + TEMP_OFFSET_X_RIGHT; int y = resHeight + TEMP_OFFSET_Y; Minecraft.getMinecraft().getTextureManager().bindTexture(icon); Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, TEMP_ICON_SIZE, TEMP_ICON_SIZE, TEMP_ICON_SIZE, TEMP_ICON_SIZE); }
@SubscribeEvent(priority= EventPriority.LOW) public void entityDeathEvent(LivingDeathEvent e){ if(e.getEntity() instanceof EntityPlayer && e.getResult() != Event.Result.DENY && !e.getEntity().getEntityWorld().isRemote) { final EntityPlayer player = (EntityPlayer)e.getEntity(); if(player.isSpectator()) return; Map<ItemStack,EntityEquipmentSlot> cache = equipmentCache.computeIfAbsent(player,(EntityPlayer p)->new HashMap<>()); for(EntityEquipmentSlot slot : EntityLootableBody.EQUIPMENT_SLOTS){ cache.put(player.getItemStackFromSlot(slot),slot); } if(player.getPrimaryHand() == EnumHandSide.LEFT){ // swap main and off hand items (easier than messing with the rendering code) cache.put(player.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND),EntityEquipmentSlot.OFFHAND); cache.put(player.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND),EntityEquipmentSlot.MAINHAND); } } }
public void setModelVisibilities (T entity) { final ModelPlayerMob model = this.getMainModel(); final ItemStack mainhand = entity.getHeldItemMainhand(); final ItemStack offhand = entity.getHeldItemOffhand(); model.setVisible(true); this.setOverlayVisibility(entity, model); model.isSneak = entity.isSneaking(); final ModelBiped.ArmPose mainArm = this.getPoseForStack(entity, mainhand); final ModelBiped.ArmPose offhandArm = this.getPoseForStack(entity, offhand); final boolean isRightHanded = entity.getPrimaryHand() == EnumHandSide.RIGHT; model.rightArmPose = isRightHanded ? mainArm : offhandArm; model.leftArmPose = isRightHanded ? offhandArm : mainArm; }
@Override public void postRenderArm (float scale, EnumHandSide side) { final ModelRenderer modelrenderer = this.getArmForSide(side); if (this.isFeminine) { final float f = 0.5F * (side == EnumHandSide.RIGHT ? 1 : -1); modelrenderer.rotationPointX += f; modelrenderer.postRender(scale); modelrenderer.rotationPointX -= f; } else { modelrenderer.postRender(scale); } }
/** * Updates the pose/state of the model to reflect that of the entity it's attatched to. * * @param entity The entity to sync the model with. * @param partialTicks The partial ticks. */ private void syncModel (Entity entity, float partialTicks) { final EntityLivingBase living = (EntityLivingBase) entity; this.isSneak = living != null ? living.isSneaking() : false; this.isChild = living != null ? living.isChild() : false; if (living != null && living instanceof EntityPlayer) { final EntityPlayer player = (EntityPlayer) living; final ArmPose poseMainhand = this.getArmPose(player.getHeldItemMainhand(), player); final ArmPose poseOffhand = this.getArmPose(player.getHeldItemOffhand(), player); final boolean isRightHanded = player.getPrimaryHand() == EnumHandSide.RIGHT; this.rightArmPose = isRightHanded ? poseMainhand : poseOffhand; this.leftArmPose = isRightHanded ? poseOffhand : poseMainhand; this.swingProgress = player.getSwingProgress(partialTicks); } }
@Override 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) { boolean flag = entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT; ItemStack itemstack = flag ? entitylivingbaseIn.getHeldItemOffhand() : entitylivingbaseIn.getHeldItemMainhand(); ItemStack itemstack1 = flag ? entitylivingbaseIn.getHeldItemMainhand() : entitylivingbaseIn.getHeldItemOffhand(); if (itemstack != null || itemstack1 != null) { GlStateManager.pushMatrix(); if (livingEntityRenderer.getMainModel().isChild) { float f = 0.5F; GlStateManager.translate(0.0F, 0.625F, 0.0F); GlStateManager.rotate(-20.0F, -1.0F, 0.0F, 0.0F); GlStateManager.scale(f, f, f); } renderHeldItem(entitylivingbaseIn, itemstack1, ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, EnumHandSide.RIGHT); renderHeldItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, EnumHandSide.LEFT); GlStateManager.popMatrix(); } }