Java Code Examples for net.minecraft.client.entity.AbstractClientPlayer#getItemInUseCount()
The following examples show how to use
net.minecraft.client.entity.AbstractClientPlayer#getItemInUseCount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MixinItemRenderer.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
/** * @author CCBlueX */ @Overwrite public void renderItemInFirstPerson(float partialTicks) { float f = 1.0F - (this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTicks); AbstractClientPlayer abstractclientplayer = this.mc.thePlayer; float f1 = abstractclientplayer.getSwingProgress(partialTicks); float f2 = abstractclientplayer.prevRotationPitch + (abstractclientplayer.rotationPitch - abstractclientplayer.prevRotationPitch) * partialTicks; float f3 = abstractclientplayer.prevRotationYaw + (abstractclientplayer.rotationYaw - abstractclientplayer.prevRotationYaw) * partialTicks; this.rotateArroundXAndY(f2, f3); this.setLightMapFromPlayer(abstractclientplayer); this.rotateWithPlayerRotations((EntityPlayerSP) abstractclientplayer, partialTicks); GlStateManager.enableRescaleNormal(); GlStateManager.pushMatrix(); if(this.itemToRender != null) { final KillAura killAura = (KillAura) LiquidBounce.moduleManager.getModule(KillAura.class); if(this.itemToRender.getItem() instanceof net.minecraft.item.ItemMap) { this.renderItemMap(abstractclientplayer, f2, f, f1); } else if (abstractclientplayer.getItemInUseCount() > 0 || (itemToRender.getItem() instanceof ItemSword && killAura.getBlockingStatus())) { EnumAction enumaction = killAura.getBlockingStatus() ? EnumAction.BLOCK : this.itemToRender.getItemUseAction(); switch(enumaction) { case NONE: this.transformFirstPersonItem(f, 0.0F); break; case EAT: case DRINK: this.performDrinking(abstractclientplayer, partialTicks); this.transformFirstPersonItem(f, f1); break; case BLOCK: this.transformFirstPersonItem(f + 0.1F, f1); this.doBlockTransformations(); GlStateManager.translate(-0.5F, 0.2F, 0.0F); break; case BOW: this.transformFirstPersonItem(f, f1); this.doBowTransformations(partialTicks, abstractclientplayer); } }else{ if (!LiquidBounce.moduleManager.getModule(SwingAnimation.class).getState()) this.doItemUsedTransformations(f1); this.transformFirstPersonItem(f, f1); } this.renderItem(abstractclientplayer, this.itemToRender, ItemCameraTransforms.TransformType.FIRST_PERSON); }else if(!abstractclientplayer.isInvisible()) { this.renderPlayerArm(abstractclientplayer, f, f1); } GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); RenderHelper.disableStandardItemLighting(); }
Example 2
Source File: MixinItemRenderer.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
/** * @author CCBlueX */ @Overwrite public void renderItemInFirstPerson(float partialTicks) { float f = 1.0F - (this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTicks); AbstractClientPlayer abstractclientplayer = this.mc.thePlayer; float f1 = abstractclientplayer.getSwingProgress(partialTicks); float f2 = abstractclientplayer.prevRotationPitch + (abstractclientplayer.rotationPitch - abstractclientplayer.prevRotationPitch) * partialTicks; float f3 = abstractclientplayer.prevRotationYaw + (abstractclientplayer.rotationYaw - abstractclientplayer.prevRotationYaw) * partialTicks; this.rotateArroundXAndY(f2, f3); this.setLightMapFromPlayer(abstractclientplayer); this.rotateWithPlayerRotations((EntityPlayerSP) abstractclientplayer, partialTicks); GlStateManager.enableRescaleNormal(); GlStateManager.pushMatrix(); if(this.itemToRender != null) { final KillAura killAura = (KillAura) LiquidBounce.moduleManager.getModule(KillAura.class); if(this.itemToRender.getItem() instanceof net.minecraft.item.ItemMap) { this.renderItemMap(abstractclientplayer, f2, f, f1); } else if (abstractclientplayer.getItemInUseCount() > 0 || (itemToRender.getItem() instanceof ItemSword && killAura.getBlockingStatus())) { EnumAction enumaction = killAura.getBlockingStatus() ? EnumAction.BLOCK : this.itemToRender.getItemUseAction(); switch(enumaction) { case NONE: this.transformFirstPersonItem(f, 0.0F); break; case EAT: case DRINK: this.performDrinking(abstractclientplayer, partialTicks); this.transformFirstPersonItem(f, f1); break; case BLOCK: this.transformFirstPersonItem(f + 0.1F, f1); this.doBlockTransformations(); GlStateManager.translate(-0.5F, 0.2F, 0.0F); break; case BOW: this.transformFirstPersonItem(f, f1); this.doBowTransformations(partialTicks, abstractclientplayer); } }else{ if (!LiquidBounce.moduleManager.getModule(SwingAnimation.class).getState()) this.doItemUsedTransformations(f1); this.transformFirstPersonItem(f, f1); } this.renderItem(abstractclientplayer, this.itemToRender, ItemCameraTransforms.TransformType.FIRST_PERSON); }else if(!abstractclientplayer.isInvisible()) { this.renderPlayerArm(abstractclientplayer, f, f1); } GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); RenderHelper.disableStandardItemLighting(); }
Example 3
Source File: BloodRenderLayer.java From Wizardry with GNU Lesser General Public License v3.0 | 4 votes |
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; } } }
Example 4
Source File: RenderPlayerCyberware.java From Cyberware with MIT License | 4 votes |
private void setModelVisibilities(AbstractClientPlayer clientPlayer) { ModelPlayer modelplayer = this.getMainModel(); if (clientPlayer.isSpectator()) { modelplayer.setInvisible(false); modelplayer.bipedHead.showModel = true; modelplayer.bipedHeadwear.showModel = true; } else { ItemStack itemstack = clientPlayer.getHeldItemMainhand(); ItemStack itemstack1 = clientPlayer.getHeldItemOffhand(); modelplayer.setInvisible(true); modelplayer.bipedHeadwear.showModel = modelplayer.bipedHead.isHidden ? false : clientPlayer.isWearing(EnumPlayerModelParts.HAT); modelplayer.bipedBodyWear.showModel = modelplayer.bipedBody.isHidden ? false : clientPlayer.isWearing(EnumPlayerModelParts.JACKET); modelplayer.bipedLeftLegwear.showModel = modelplayer.bipedLeftLeg.isHidden ? false : clientPlayer.isWearing(EnumPlayerModelParts.LEFT_PANTS_LEG); modelplayer.bipedRightLegwear.showModel = modelplayer.bipedRightLeg.isHidden ? false : clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_PANTS_LEG); modelplayer.bipedLeftArmwear.showModel = modelplayer.bipedLeftArm.isHidden ? false : clientPlayer.isWearing(EnumPlayerModelParts.LEFT_SLEEVE); modelplayer.bipedRightArmwear.showModel = modelplayer.bipedRightArm.isHidden ? false :clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_SLEEVE); modelplayer.isSneak = clientPlayer.isSneaking(); ModelBiped.ArmPose modelbiped$armpose = ModelBiped.ArmPose.EMPTY; ModelBiped.ArmPose modelbiped$armpose1 = ModelBiped.ArmPose.EMPTY; if (itemstack != null) { modelbiped$armpose = ModelBiped.ArmPose.ITEM; if (clientPlayer.getItemInUseCount() > 0) { EnumAction enumaction = itemstack.getItemUseAction(); if (enumaction == EnumAction.BLOCK) { modelbiped$armpose = ModelBiped.ArmPose.BLOCK; } else if (enumaction == EnumAction.BOW) { modelbiped$armpose = ModelBiped.ArmPose.BOW_AND_ARROW; } } } if (itemstack1 != null) { modelbiped$armpose1 = ModelBiped.ArmPose.ITEM; if (clientPlayer.getItemInUseCount() > 0) { EnumAction enumaction1 = itemstack1.getItemUseAction(); if (enumaction1 == EnumAction.BLOCK) { modelbiped$armpose1 = ModelBiped.ArmPose.BLOCK; } } } if (clientPlayer.getPrimaryHand() == EnumHandSide.RIGHT) { modelplayer.rightArmPose = modelbiped$armpose; modelplayer.leftArmPose = modelbiped$armpose1; } else { modelplayer.rightArmPose = modelbiped$armpose1; modelplayer.leftArmPose = modelbiped$armpose; } } }
Example 5
Source File: RenderCyberlimbHand.java From Cyberware with MIT License | 4 votes |
public void renderItemInFirstPerson(AbstractClientPlayer p_187457_1_, float p_187457_2_, float p_187457_3_, EnumHand p_187457_4_, float p_187457_5_, @Nullable ItemStack p_187457_6_, float p_187457_7_) { boolean flag = p_187457_4_ == EnumHand.MAIN_HAND; EnumHandSide enumhandside = flag ? p_187457_1_.getPrimaryHand() : p_187457_1_.getPrimaryHand().opposite(); GlStateManager.pushMatrix(); if (p_187457_6_ == null) { if (flag && !p_187457_1_.isInvisible()) { this.renderArmFirstPerson(p_187457_7_, p_187457_5_, enumhandside); } } else if (p_187457_6_.getItem() instanceof net.minecraft.item.ItemMap) { if (flag && itemStackOffHand == null) { this.renderMapFirstPerson(p_187457_3_, p_187457_7_, p_187457_5_); } else { this.renderMapFirstPersonSide(p_187457_7_, enumhandside, p_187457_5_, p_187457_6_); } } else { boolean flag1 = enumhandside == EnumHandSide.RIGHT; if (p_187457_1_.isHandActive() && p_187457_1_.getItemInUseCount() > 0 && p_187457_1_.getActiveHand() == p_187457_4_) { int j = flag1 ? 1 : -1; switch (p_187457_6_.getItemUseAction()) { case NONE: this.transformSideFirstPerson(enumhandside, p_187457_7_); break; case EAT: case DRINK: this.transformEatFirstPerson(p_187457_2_, enumhandside, p_187457_6_); this.transformSideFirstPerson(enumhandside, p_187457_7_); break; case BLOCK: this.transformSideFirstPerson(enumhandside, p_187457_7_); break; case BOW: this.transformSideFirstPerson(enumhandside, p_187457_7_); GlStateManager.translate((float)j * -0.2785682F, 0.18344387F, 0.15731531F); GlStateManager.rotate(-13.935F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate((float)j * 35.3F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate((float)j * -9.785F, 0.0F, 0.0F, 1.0F); float f5 = (float)p_187457_6_.getMaxItemUseDuration() - ((float)this.mc.thePlayer.getItemInUseCount() - p_187457_2_ + 1.0F); float f6 = f5 / 20.0F; f6 = (f6 * f6 + f6 * 2.0F) / 3.0F; if (f6 > 1.0F) { f6 = 1.0F; } if (f6 > 0.1F) { float f7 = MathHelper.sin((f5 - 0.1F) * 1.3F); float f3 = f6 - 0.1F; float f4 = f7 * f3; GlStateManager.translate(f4 * 0.0F, f4 * 0.004F, f4 * 0.0F); } GlStateManager.translate(f6 * 0.0F, f6 * 0.0F, f6 * 0.04F); GlStateManager.scale(1.0F, 1.0F, 1.0F + f6 * 0.2F); GlStateManager.rotate((float)j * 45.0F, 0.0F, -1.0F, 0.0F); } } else { float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(p_187457_5_) * (float)Math.PI); float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(p_187457_5_) * ((float)Math.PI * 2F)); float f2 = -0.2F * MathHelper.sin(p_187457_5_ * (float)Math.PI); int i = flag1 ? 1 : -1; GlStateManager.translate((float)i * f, f1, f2); this.transformSideFirstPerson(enumhandside, p_187457_7_); this.transformFirstPerson(enumhandside, p_187457_5_); } this.renderItemSide(p_187457_1_, p_187457_6_, flag1 ? ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND : ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, !flag1); } GlStateManager.popMatrix(); }