@SideOnly(Side.CLIENT) @SubscribeEvent public void renderPlayer(RenderPlayerEvent.Pre event) { if(event.getEntity().getDataManager().get(SPIN_TIME)){ event.getRenderer().getMainModel().rightArmPose=ArmPose.BOW_AND_ARROW; GlStateManager.pushMatrix(); ItemStack stack=event.getEntityPlayer().getHeldItemMainhand(); int spinCooldown=this.getSpinCooldown(stack, event.getEntityPlayer()); if(event.getEntityPlayer().getEntityData().getInteger("SpinTime")>this.getDuration(stack, event.getEntityPlayer())-spinCooldown*0.8f){ GlStateManager.rotate((this.getDuration(stack, event.getEntityPlayer())- (event.getEntity().getEntityData().getInteger("SpinTime")-event.getPartialRenderTick()))*-(90/this.getSpinCooldown(stack, event.getEntityPlayer())), 0, 1, 0); } else{ GlStateManager.rotate((this.getDuration(stack, event.getEntityPlayer())- (event.getEntity().getEntityData().getInteger("SpinTime")-event.getPartialRenderTick()))*(360/this.getSpinCooldown(stack, event.getEntityPlayer())), 0, 1, 0); } } }
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; }
@SubscribeEvent public void onEntityLiving(RenderLivingEvent.Pre<EntityPlayer> event){ if(event.getEntity() instanceof EntityPlayer){ EntityPlayer player = (EntityPlayer)event.getEntity(); ItemStack stackMainHand = player.getHeldItemMainhand(); if(stackMainHand != null && stackMainHand.getItem() == CommonProxy.itemCombustibleLemonLauncher){ ModelBiped modelBiped = (ModelBiped)event.getRenderer().getMainModel(); switch(Minecraft.getMinecraft().gameSettings.mainHand){ case LEFT: modelBiped.leftArmPose = ArmPose.BOW_AND_ARROW; break; case RIGHT: modelBiped.rightArmPose = ArmPose.BOW_AND_ARROW; break; default: break; } } } }
@SubscribeEvent public void holding(RenderLivingEvent.Pre event) { Minecraft mc = Minecraft.getMinecraft(); EntityPlayer thePlayer = mc.player; ItemStack stack = thePlayer.getActiveItemStack(); if (!event.isCanceled() && event.getEntity().equals(thePlayer) && stack != null) { if (stack.getItem() instanceof ItemRangedWeapon) { ModelPlayer model = (ModelPlayer) event.getRenderer().getMainModel(); // TODO adapt for left/right handed model.rightArmPose = ArmPose.BOW_AND_ARROW; } } }
@Override @SideOnly(Side.CLIENT) public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped armorModel) { if(itemStack != null){ if(itemStack.getItem() instanceof ItemDreadiumSamuraiArmor){ EntityEquipmentSlot type = ((ItemArmor)itemStack.getItem()).armorType; if(type == EntityEquipmentSlot.FEET || type == EntityEquipmentSlot.CHEST) armorModel = AbyssalCraft.proxy.getArmorModel(0); else armorModel = AbyssalCraft.proxy.getArmorModel(1); } if(armorModel != null){ armorModel.bipedHead.showModel = armorSlot == EntityEquipmentSlot.HEAD; armorModel.bipedHeadwear.showModel = armorSlot == EntityEquipmentSlot.HEAD; armorModel.bipedBody.showModel = armorSlot == EntityEquipmentSlot.CHEST || armorSlot == EntityEquipmentSlot.LEGS; armorModel.bipedRightArm.showModel = armorSlot == EntityEquipmentSlot.CHEST; armorModel.bipedLeftArm.showModel = armorSlot == EntityEquipmentSlot.CHEST; armorModel.bipedRightLeg.showModel = armorSlot == EntityEquipmentSlot.LEGS || armorSlot == EntityEquipmentSlot.FEET; armorModel.bipedLeftLeg.showModel = armorSlot == EntityEquipmentSlot.LEGS || armorSlot == EntityEquipmentSlot.FEET; armorModel.isSneak = entityLiving.isSneaking(); armorModel.isRiding = entityLiving.isRiding(); armorModel.isChild = entityLiving.isChild(); armorModel.rightArmPose = entityLiving.getHeldItemMainhand() != null ? entityLiving.getHeldItemMainhand().getItemUseAction() == EnumAction.BLOCK && entityLiving.getItemInUseCount() > 0 ? ArmPose.BLOCK : entityLiving.getHeldItemMainhand().getItemUseAction() == EnumAction.BOW && entityLiving.getItemInUseCount() > 0 ? ArmPose.BOW_AND_ARROW : ArmPose.ITEM : ArmPose.EMPTY; armorModel.leftArmPose = entityLiving.getHeldItemOffhand() != null ? entityLiving.getHeldItemOffhand().getItemUseAction() == EnumAction.BLOCK && entityLiving.getItemInUseCount() > 0 ? ArmPose.BLOCK : entityLiving.getHeldItemMainhand() != null && entityLiving.getHeldItemMainhand().getItemUseAction() == EnumAction.BOW && entityLiving.getItemInUseCount() > 0 ? ArmPose.BOW_AND_ARROW : ArmPose.ITEM : ArmPose.EMPTY; armorModel.swingProgress = entityLiving.swingProgress; return armorModel; } } return null; }
@SideOnly(Side.CLIENT) @SubscribeEvent public void renderLivingEntity(RenderLivingEvent.Pre<EntityPlayer> event) { if(event.getEntity() instanceof EntityPlayer && event.getEntity().getDataManager().get(SPIN_TIME)) ((ModelPlayer)event.getRenderer().getMainModel()).rightArmPose=ArmPose.BOW_AND_ARROW; }
@Override public void doRender(EntityMerasmus entity, double x, double y, double z, float entityYaw, float partialTicks) { ((ModelMerasmus)this.mainModel).rightArmPose=entity.isBombSpell()?ArmPose.BOW_AND_ARROW:ArmPose.EMPTY; super.doRender(entity, x, y, z, entityYaw, partialTicks); }
private void setModelVisibilities(AbstractClientPlayer clientPlayer) { ModelPlayer modelplayer = render.getMainModel(); if (clientPlayer.isSpectator()) { modelplayer.setVisible(true); modelplayer.bipedHead.showModel = true; modelplayer.bipedHeadwear.showModel = true; } else { ItemStack stackMain = clientPlayer.getHeldItemMainhand(); ItemStack stackOff = clientPlayer.getHeldItemOffhand(); modelplayer.setVisible(false); modelplayer.bipedHeadwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.HAT); modelplayer.bipedBodyWear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.JACKET); modelplayer.bipedLeftLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_PANTS_LEG); modelplayer.bipedRightLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_PANTS_LEG); modelplayer.bipedLeftArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_SLEEVE); modelplayer.bipedRightArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_SLEEVE); modelplayer.isSneak = clientPlayer.isSneaking(); ArmPose poseMain = ArmPose.EMPTY; if (!stackMain.isEmpty()) { poseMain = ArmPose.ITEM; if (clientPlayer.getItemInUseCount() > 0) { EnumAction enumaction = stackMain.getItemUseAction(); if (enumaction == EnumAction.BLOCK) { poseMain = ArmPose.BLOCK; } else if (enumaction == EnumAction.BOW) { poseMain = ArmPose.BOW_AND_ARROW; } } } ArmPose poseOff = ArmPose.EMPTY; if (!stackOff.isEmpty()) { poseOff = ArmPose.ITEM; if (clientPlayer.getItemInUseCount() > 0) { EnumAction enumaction1 = stackOff.getItemUseAction(); if (enumaction1 == EnumAction.BLOCK) { poseOff = ArmPose.BLOCK; } } } if (clientPlayer.getPrimaryHand() == EnumHandSide.RIGHT) { modelplayer.rightArmPose = poseMain; modelplayer.leftArmPose = poseOff; } else { modelplayer.rightArmPose = poseOff; modelplayer.leftArmPose = poseMain; } } }
public ArmPose getPoseForStack (T entity, ItemStack stack) { ModelBiped.ArmPose pose = ModelBiped.ArmPose.EMPTY; if (!stack.isEmpty()) { pose = ModelBiped.ArmPose.ITEM; if (entity.getItemInUseCount() > 0) { final EnumAction actionType = stack.getItemUseAction(); pose = actionType == EnumAction.BLOCK ? ArmPose.BLOCK : actionType == EnumAction.BOW ? ArmPose.BOW_AND_ARROW : ArmPose.EMPTY; } } return pose; }