net.minecraft.util.EnumHandSide Java Examples
The following examples show how to use
net.minecraft.util.EnumHandSide.
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: LayerTofunianHeldItem.java From TofuCraftReload with MIT License | 6 votes |
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); } // Forge: moved this call down, fixes incorrect offset while sneaking. 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) / 60.0F, 0.125F, -0.25F); Minecraft.getMinecraft().getItemRenderer().renderItemSide(p_188358_1_, p_188358_2_, p_188358_3_, flag); GlStateManager.popMatrix(); } }
Example #2
Source File: RenderPlayerCyberware.java From Cyberware with MIT License | 6 votes |
@Override public void renderLeftArm(AbstractClientPlayer clientPlayer) { Minecraft.getMinecraft().getTextureManager().bindTexture(robo); super.renderLeftArm(clientPlayer); if (CyberwareAPI.isCyberwareInstalled(clientPlayer, new ItemStack(CyberwareContent.handUpgrades, 1, 1)) && CyberwareAPI.isCyberwareInstalled(clientPlayer, new ItemStack(CyberwareContent.cyberlimbs, 1, 0)) && Minecraft.getMinecraft().gameSettings.mainHand == EnumHandSide.LEFT && clientPlayer.getHeldItemMainhand() == null && EnableDisableHelper.isEnabled(CyberwareAPI.getCyberware(clientPlayer, new ItemStack(CyberwareContent.handUpgrades, 1, 1)))) { GL11.glPushMatrix(); float percent = ((Minecraft.getMinecraft().thePlayer.ticksExisted + Minecraft.getMinecraft().getRenderPartialTicks() - ItemHandUpgrade.clawsTime) / 4F); percent = Math.min(1.0F, percent); percent = Math.max(0F, percent); percent = (float) Math.sin(percent * Math.PI / 2F); claws.claw1.rotateAngleY = 0.00F; claws.claw1.rotateAngleZ = 0.07F; claws.claw1.rotateAngleX = 0.00F; claws.claw1.setRotationPoint(-5.0F, -5.0F + (7F * percent), 0.0F); claws.claw1.render(0.0625F); GL11.glPopMatrix(); } }
Example #3
Source File: RenderPlayerCyberware.java From Cyberware with MIT License | 6 votes |
@Override public void renderRightArm(AbstractClientPlayer clientPlayer) { Minecraft.getMinecraft().getTextureManager().bindTexture(robo); super.renderRightArm(clientPlayer); if (CyberwareAPI.isCyberwareInstalled(clientPlayer, new ItemStack(CyberwareContent.handUpgrades, 1, 1)) && CyberwareAPI.isCyberwareInstalled(clientPlayer, new ItemStack(CyberwareContent.cyberlimbs, 1, 1)) && Minecraft.getMinecraft().gameSettings.mainHand == EnumHandSide.RIGHT && clientPlayer.getHeldItemMainhand() == null && EnableDisableHelper.isEnabled(CyberwareAPI.getCyberware(clientPlayer, new ItemStack(CyberwareContent.handUpgrades, 1, 1)))) { GL11.glPushMatrix(); float percent = ((Minecraft.getMinecraft().thePlayer.ticksExisted + Minecraft.getMinecraft().getRenderPartialTicks() - ItemHandUpgrade.clawsTime) / 4F); percent = Math.min(1.0F, percent); percent = Math.max(0F, percent); percent = (float) Math.sin(percent * Math.PI / 2F); claws.claw1.rotateAngleY = 0.00F; claws.claw1.rotateAngleZ = 0.07F; claws.claw1.rotateAngleX = 0.00F; claws.claw1.setRotationPoint(-5.0F, -5.0F + (7F * percent), 0.0F); claws.claw1.render(0.0625F); GL11.glPopMatrix(); } }
Example #4
Source File: RenderCodex.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
private static void renderItemInFirstPerson(AbstractClientPlayer player, EnumHand hand, float swingProgress, ItemStack stack, float equipProgress) { // Cherry picked from ItemRenderer.renderItemInFirstPerson boolean flag = hand == EnumHand.MAIN_HAND; EnumHandSide enumhandside = flag ? player.getPrimaryHand() : player.getPrimaryHand().opposite(); GlStateManager.pushMatrix(); boolean flag1 = enumhandside == EnumHandSide.RIGHT; float f = -0.4F * MathHelper.sin(MathHelper.sqrt(swingProgress) * (float) Math.PI); float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt(swingProgress) * ((float) Math.PI * 2F)); float f2 = -0.2F * MathHelper.sin(swingProgress * (float) Math.PI); int i = flag1 ? 1 : -1; GlStateManager.translate(i * f, f1, f2); transformSideFirstPerson(enumhandside, equipProgress); transformFirstPerson(enumhandside, swingProgress); RenderCodex.INSTANCE.doRender(enumhandside, stack); GlStateManager.popMatrix(); }
Example #5
Source File: RenderCyberlimbHand.java From Cyberware with MIT License | 6 votes |
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(); }
Example #6
Source File: RenderCyberlimbHand.java From Cyberware with MIT License | 6 votes |
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); }
Example #7
Source File: RenderSamuraiIllager.java From Sakura_mod with MIT License | 6 votes |
public RenderSamuraiIllager(RenderManager p_i47477_1_) { super(p_i47477_1_, new ModelSamuraiIllager(0.0F, 0.0F, 64, 64), 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 ((((EntitySamuraiIllager) entitylivingbaseIn).isAggressive())) { super.doRenderLayer(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale); } } protected void translateToHand(EnumHandSide p_191361_1_) { ((ModelIllager) this.livingEntityRenderer.getMainModel()).getArm(p_191361_1_).postRender(0.0625F); } }); ((ModelIllager) this.getMainModel()).hat.showModel = false; }
Example #8
Source File: RenderCyberlimbHand.java From Cyberware with MIT License | 6 votes |
private void renderArm(EnumHandSide p_187455_1_) { this.mc.getTextureManager().bindTexture(this.mc.thePlayer.getLocationSkin()); Render<AbstractClientPlayer> render = getEntityRenderObject(this.mc.thePlayer, p_187455_1_); 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(); }
Example #9
Source File: RenderCyberlimbHand.java From Cyberware with MIT License | 6 votes |
private RenderPlayer getEntityRenderObject(AbstractClientPlayer p, EnumHandSide side) { if (side == EnumHandSide.RIGHT) { if (rightRobot) { return EssentialsMissingHandlerClient.renderF; } } else { if (leftRobot) { return EssentialsMissingHandlerClient.renderF; } } return (RenderPlayer) this.renderManager.<AbstractClientPlayer>getEntityRenderObject(p); }
Example #10
Source File: ItemHandUpgrade.java From Cyberware with MIT License | 6 votes |
@SubscribeEvent public void handleMining(HarvestCheck event) { EntityPlayer p = event.getEntityPlayer(); ItemStack test = new ItemStack(this, 1, 2); boolean rightArm = (p.getPrimaryHand() == EnumHandSide.RIGHT ? (CyberwareAPI.isCyberwareInstalled(p, new ItemStack(CyberwareContent.cyberlimbs, 1, 1))) : (CyberwareAPI.isCyberwareInstalled(p, new ItemStack(CyberwareContent.cyberlimbs, 1, 0)))); if (rightArm && CyberwareAPI.isCyberwareInstalled(p, test) && p.getHeldItemMainhand() == null) { ItemStack pick = new ItemStack(Items.STONE_PICKAXE); if (pick.canHarvestBlock(event.getTargetBlock())) { event.setCanHarvest(true); } } }
Example #11
Source File: LayerTofunianHeldItem.java From TofuCraftReload with MIT License | 6 votes |
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.isEmpty() || !itemstack1.isEmpty()) { GlStateManager.pushMatrix(); if (this.livingEntityRenderer.getMainModel().isChild) { 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(); } }
Example #12
Source File: ModelTofuMindCore.java From TofuCraftReload with MIT License | 5 votes |
protected EnumHandSide getMainHand(Entity entityIn) { if (entityIn instanceof EntityLivingBase) { EntityLivingBase entitylivingbase = (EntityLivingBase) entityIn; EnumHandSide enumhandside = entitylivingbase.getPrimaryHand(); return entitylivingbase.swingingHand == EnumHand.MAIN_HAND ? enumhandside : enumhandside.opposite(); } else { return EnumHandSide.RIGHT; } }
Example #13
Source File: ItemHandUpgrade.java From Cyberware with MIT License | 5 votes |
@SubscribeEvent(priority=EventPriority.NORMAL) public void handleLivingUpdate(CyberwareUpdateEvent event) { EntityLivingBase e = event.getEntityLiving(); ItemStack test = new ItemStack(this, 1, 1); if (CyberwareAPI.isCyberwareInstalled(e, test)) { boolean last = getLastClaws(e); boolean isEquipped = e.getHeldItemMainhand() == null && (e.getPrimaryHand() == EnumHandSide.RIGHT ? (CyberwareAPI.isCyberwareInstalled(e, new ItemStack(CyberwareContent.cyberlimbs, 1, 1))) : (CyberwareAPI.isCyberwareInstalled(e, new ItemStack(CyberwareContent.cyberlimbs, 1, 0)))); if (isEquipped && EnableDisableHelper.isEnabled(CyberwareAPI.getCyberware(e, test))) { this.addUnarmedDamage(e, test); lastClaws.put(e.getEntityId(), true); if (!last) { if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { updateHand(e, true); } } } else { this.removeUnarmedDamage(e, test); lastClaws.put(e.getEntityId(), false); } } else { lastClaws.put(e.getEntityId(), false); } }
Example #14
Source File: RenderCyberlimbHand.java From Cyberware with MIT License | 5 votes |
private void renderArms() { if (!this.mc.thePlayer.isInvisible()) { GlStateManager.disableCull(); GlStateManager.pushMatrix(); GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); this.renderArm(EnumHandSide.RIGHT); this.renderArm(EnumHandSide.LEFT); GlStateManager.popMatrix(); GlStateManager.enableCull(); } }
Example #15
Source File: ItemHandUpgrade.java From Cyberware with MIT License | 5 votes |
@SubscribeEvent public void handleMineSpeed(BreakSpeed event) { EntityPlayer p = event.getEntityPlayer(); ItemStack test = new ItemStack(this, 1, 2); boolean rightArm = (p.getPrimaryHand() == EnumHandSide.RIGHT ? (CyberwareAPI.isCyberwareInstalled(p, new ItemStack(CyberwareContent.cyberlimbs, 1, 1))) : (CyberwareAPI.isCyberwareInstalled(p, new ItemStack(CyberwareContent.cyberlimbs, 1, 0)))); if (rightArm && CyberwareAPI.isCyberwareInstalled(p, test) && p.getHeldItemMainhand() == null) { ItemStack pick = new ItemStack(Items.STONE_PICKAXE); event.setNewSpeed(event.getNewSpeed() * pick.getStrVsBlock(p.worldObj.getBlockState(event.getPos()))); } }
Example #16
Source File: EssentialsMissingHandler.java From Cyberware with MIT License | 5 votes |
private void processEvent(Event event, EnumHand hand, EntityPlayer p, ICyberwareUserData cyberware) { EnumHandSide mainHand = p.getPrimaryHand(); EnumHandSide offHand = ((mainHand == EnumHandSide.LEFT) ? EnumHandSide.RIGHT : EnumHandSide.LEFT); EnumSide correspondingMainHand = ((mainHand == EnumHandSide.RIGHT) ? EnumSide.RIGHT : EnumSide.LEFT); EnumSide correspondingOffHand = ((offHand == EnumHandSide.RIGHT) ? EnumSide.RIGHT : EnumSide.LEFT); boolean leftUnpowered = false; ItemStack armLeft = cyberware.getCyberware(new ItemStack(CyberwareContent.cyberlimbs, 1, 0)); if (armLeft != null && !ItemCyberlimb.isPowered(armLeft)) { leftUnpowered = true; } boolean rightUnpowered = false; ItemStack armRight = cyberware.getCyberware(new ItemStack(CyberwareContent.cyberlimbs, 1, 1)); if (armRight != null && !ItemCyberlimb.isPowered(armRight)) { rightUnpowered = true; } if (hand == EnumHand.MAIN_HAND && (!cyberware.hasEssential(EnumSlot.ARM, correspondingMainHand) || leftUnpowered)) { event.setCanceled(true); } else if (hand == EnumHand.OFF_HAND && (!cyberware.hasEssential(EnumSlot.ARM, correspondingOffHand) || rightUnpowered)) { event.setCanceled(true); } }
Example #17
Source File: RenderCyberlimbHand.java From Cyberware with MIT License | 5 votes |
private void transformFirstPerson(EnumHandSide p_187453_1_, float p_187453_2_) { int i = p_187453_1_ == EnumHandSide.RIGHT ? 1 : -1; float f = MathHelper.sin(p_187453_2_ * p_187453_2_ * (float)Math.PI); GlStateManager.rotate((float)i * (45.0F + f * -20.0F), 0.0F, 1.0F, 0.0F); float f1 = MathHelper.sin(MathHelper.sqrt_float(p_187453_2_) * (float)Math.PI); GlStateManager.rotate((float)i * f1 * -20.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(f1 * -80.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate((float)i * -45.0F, 0.0F, 1.0F, 0.0F); }
Example #18
Source File: RenderCodex.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
private static void transformFirstPerson(EnumHandSide p_187453_1_, float p_187453_2_) { int i = p_187453_1_ == EnumHandSide.RIGHT ? 1 : -1; // Botania - added GlStateManager.translate(p_187453_1_ == EnumHandSide.RIGHT ? 0.2F : 0.52F, -0.125F, p_187453_1_ == EnumHandSide.RIGHT ? 0.6F : 0.25F); GlStateManager.rotate(p_187453_1_ == EnumHandSide.RIGHT ? 60F : 120F, 0F, 1F, 0F); GlStateManager.rotate(30F, 0F, 0F, -1F); // End add float f = MathHelper.sin(p_187453_2_ * p_187453_2_ * (float) Math.PI); GlStateManager.rotate(i * (45.0F + f * -20.0F), 0.0F, 1.0F, 0.0F); float f1 = MathHelper.sin(MathHelper.sqrt(p_187453_2_) * (float) Math.PI); GlStateManager.rotate(i * f1 * -20.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(f1 * -80.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(i * -45.0F, 0.0F, 1.0F, 0.0F); }
Example #19
Source File: RenderCyberlimbHand.java From Cyberware with MIT License | 5 votes |
private void renderArmFirstPerson(float p_187456_1_, float p_187456_2_, EnumHandSide p_187456_3_) { boolean flag = p_187456_3_ != EnumHandSide.LEFT; float f = flag ? 1.0F : -1.0F; float f1 = MathHelper.sqrt_float(p_187456_2_); float f2 = -0.3F * MathHelper.sin(f1 * (float)Math.PI); float f3 = 0.4F * MathHelper.sin(f1 * ((float)Math.PI * 2F)); float f4 = -0.4F * MathHelper.sin(p_187456_2_ * (float)Math.PI); GlStateManager.translate(f * (f2 + 0.64000005F), f3 + -0.6F + p_187456_1_ * -0.6F, f4 + -0.71999997F); GlStateManager.rotate(f * 45.0F, 0.0F, 1.0F, 0.0F); float f5 = MathHelper.sin(p_187456_2_ * p_187456_2_ * (float)Math.PI); float f6 = MathHelper.sin(f1 * (float)Math.PI); GlStateManager.rotate(f * f6 * 70.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(f * f5 * -20.0F, 0.0F, 0.0F, 1.0F); AbstractClientPlayer abstractclientplayer = this.mc.thePlayer; this.mc.getTextureManager().bindTexture(abstractclientplayer.getLocationSkin()); GlStateManager.translate(f * -1.0F, 3.6F, 3.5F); GlStateManager.rotate(f * 120.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(200.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(f * -135.0F, 0.0F, 1.0F, 0.0F); GlStateManager.translate(f * 5.6F, 0.0F, 0.0F); RenderPlayer renderplayer = getEntityRenderObject(this.mc.thePlayer, p_187456_3_); GlStateManager.disableCull(); if (flag) { renderplayer.renderRightArm(abstractclientplayer); } else { renderplayer.renderLeftArm(abstractclientplayer); } GlStateManager.enableCull(); }
Example #20
Source File: EssentialsMissingHandlerClient.java From Cyberware with MIT License | 4 votes |
@SubscribeEvent(priority=EventPriority.LOWEST) public void handleMissingEssentials(LivingUpdateEvent event) { EntityLivingBase e = event.getEntityLiving(); if (e != null && e == Minecraft.getMinecraft().thePlayer) { ICyberwareUserData cyberware = CyberwareAPI.getCapability(e); GameSettings settings = Minecraft.getMinecraft().gameSettings; boolean stillMissingArm = false; boolean stillMissingSecondArm = false; boolean leftUnpowered = false; ItemStack armLeft = cyberware.getCyberware(new ItemStack(CyberwareContent.cyberlimbs, 1, 0)); if (armLeft != null && !ItemCyberlimb.isPowered(armLeft)) { leftUnpowered = true; } boolean rightUnpowered = false; ItemStack armRight = cyberware.getCyberware(new ItemStack(CyberwareContent.cyberlimbs, 1, 1)); if (armRight != null && !ItemCyberlimb.isPowered(armRight)) { rightUnpowered = true; } boolean hasSkin = cyberware.isCyberwareInstalled(new ItemStack(CyberwareContent.skinUpgrades, 1, 2)); hasRoboLeft = armLeft != null && !hasSkin; hasRoboRight = armRight != null && !hasSkin; boolean hasRightArm = cyberware.hasEssential(EnumSlot.ARM, EnumSide.RIGHT) && !rightUnpowered; boolean hasLeftArm = cyberware.hasEssential(EnumSlot.ARM, EnumSide.LEFT) && !leftUnpowered; if (!hasRightArm) { if (settings.mainHand != EnumHandSide.LEFT) { oldHand = settings.mainHand; settings.mainHand = EnumHandSide.LEFT; settings.sendSettingsToServer(); } if (!missingArm) { missingArm = true; } stillMissingArm = true; if (!hasLeftArm) { if (!missingSecondArm) { missingSecondArm = true; } stillMissingSecondArm = true; } } else if (!hasLeftArm) { if (settings.mainHand != EnumHandSide.RIGHT) { oldHand = settings.mainHand; settings.mainHand = EnumHandSide.RIGHT; settings.sendSettingsToServer(); } if (!missingArm) { missingArm = true; } stillMissingArm = true; if (!hasRightArm) { if (!missingSecondArm) { missingSecondArm = true; } stillMissingSecondArm = true; } } if (!stillMissingArm && oldHand != null) { missingArm = false; settings.mainHand = oldHand; settings.sendSettingsToServer(); } if (!stillMissingSecondArm) { missingSecondArm = false; } } }
Example #21
Source File: RenderCyberlimbHand.java From Cyberware with MIT License | 4 votes |
private void transformSideFirstPerson(EnumHandSide p_187459_1_, float p_187459_2_) { int i = p_187459_1_ == EnumHandSide.RIGHT ? 1 : -1; GlStateManager.translate((float)i * 0.56F, -0.52F + p_187459_2_ * -0.6F, -0.72F); }
Example #22
Source File: RendererBackpack.java From WearableBackpacks with MIT License | 4 votes |
public void doRenderLayer(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { IBackpack backpack; RenderOptions renderOptions; if (_overrideBackpack != null) { backpack = _overrideBackpack; renderOptions = _overrideRenderOptions; } else { backpack = BackpackHelper.getBackpack(entity); BackpackEntityEntry entry = BackpackRegistry.getEntityEntry(entity.getClass()); renderOptions = (entry != null) ? entry.renderOptions : null; } if ((backpack == null) || (renderOptions == null)) return; GlStateManager.pushMatrix(); if (entity.isChild()) { GlStateManager.scale(0.5F, 0.5F, 0.5F); GlStateManager.translate(0.0F, 24.0F * scale, 0.0F); } ModelBase modelBase = this.livingEntityRenderer.getMainModel(); if (modelBase instanceof ModelBiped) { ModelRenderer bipedBody = ((ModelBiped) modelBase).bipedBody; if (entity.isSneaking()) { // FIXME: Can be sneaking while flying with the elytra, then backpack is misaligned..? GlStateManager.translate(0.0F, 0.2F, 0.0F); } bipedBody.postRender(scale); } else { // Fallback to the custom way of transforming the backpack. // Make backpack swing with body as players swing their arms. float swingProgress = entity.getSwingProgress(partialTicks); float swingAngle = MathHelper.sin(MathHelper.sqrt(swingProgress) * ((float)Math.PI * 2.0F)) * 0.2F; if ((entity.swingingHand == EnumHand.OFF_HAND) ^ (entity.getPrimaryHand() == EnumHandSide.LEFT)) swingAngle *= -1; if (swingAngle != 0) GlStateManager.rotate((float)Math.toDegrees(swingAngle), 0.0F, 1.0F, 0.0F); // Rotate backpack if entity is sneaking. if (entity.isSneaking()) { // FIXME: Can be sneaking while flying with the elytra, then backpack is misaligned..? GlStateManager.translate(0.0F, 0.2F, 0.0F); GlStateManager.rotate(90.0F / (float)Math.PI, 1.0F, 0.0F, 0.0F); } } GlStateManager.scale(renderOptions.scale, renderOptions.scale, renderOptions.scale); GlStateManager.translate(8.0F * scale, renderOptions.y * scale, renderOptions.z * scale); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate((float)renderOptions.rotate, 1.0F, 0.0F, 0.0F); GlStateManager.translate(0, ProxyClient.MODEL_BACKPACK_BOX.maxY * scale * -16, ProxyClient.MODEL_BACKPACK_BOX.minZ * scale * -16); renderBackpack(backpack, entity.ticksExisted + partialTicks, false); GlStateManager.popMatrix(); }
Example #23
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(); }
Example #24
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 #25
Source File: RenderGuard.java From ToroQuest with GNU General Public License v3.0 | 4 votes |
private void setModelVisibilities(EntityGuard clientPlayer) { ModelGuard modelplayer = (ModelGuard) this.getMainModel(); ItemStack itemstack = clientPlayer.getHeldItemMainhand(); ItemStack itemstack1 = clientPlayer.getHeldItemOffhand(); modelplayer.setVisible(true); 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 #26
Source File: HudRenderer.java From Wizardry with GNU Lesser General Public License v3.0 | 4 votes |
@SubscribeEvent public static void renderHud(Post event) { ScaledResolution resolution = event.getResolution(); int width = resolution.getScaledWidth(); int height = resolution.getScaledHeight(); EntityPlayer player = Minecraft.getMinecraft().player; ItemStack stack = BaublesSupport.getItem(player, ModItems.FAKE_HALO, ModItems.CREATIVE_HALO, ModItems.REAL_HALO); if (stack.isEmpty()) return; if (event.getType() == ElementType.EXPERIENCE) { int barSide = Minecraft.getMinecraft().gameSettings.mainHand == EnumHandSide.RIGHT ? 1 : -1; barSide *= Minecraft.getMinecraft().gameSettings.attackIndicator == 2 ? -1 : 1; int right = ((width / 2) - (100 / 2)) + 155 * barSide; int top = height - 17; HUD_TEXTURE.bind(); GlStateManager.pushMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F); emptyManaBar.draw(ClientTickHandler.getTicks(), right, top); emptyBurnoutBar.draw(ClientTickHandler.getTicks(), right, top + 6); GlStateManager.popMatrix(); try (ManaManager.CapManagerBuilder mgr = ManaManager.forObject(player)) { double mana = mgr.getMana(); double burnout = mgr.getBurnout(); double maxMana = mgr.getMaxMana(); double maxBurnout = mgr.getMaxBurnout(); GlStateManager.pushMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F); int visualManaLength = 0; if (mana > 0) visualManaLength = (int) (((mana * 100) / maxMana) % 101); fullManaBar.draw(ClientTickHandler.getTicks(), right, top, visualManaLength, 5); GlStateManager.color(1.0F, 1.0F, 1.0F); int visualBurnoutLength = 0; if (burnout > 0) visualBurnoutLength = (int) (((burnout * 100) / maxBurnout) % 101); fullBurnoutBar.draw(ClientTickHandler.getTicks(), right, top + 6, visualBurnoutLength, 5); GlStateManager.popMatrix(); } } }
Example #27
Source File: RenderCodex.java From Wizardry with GNU Lesser General Public License v3.0 | 4 votes |
private static void transformSideFirstPerson(EnumHandSide p_187459_1_, float p_187459_2_) { int i = p_187459_1_ == EnumHandSide.RIGHT ? 1 : -1; GlStateManager.translate(i * 0.56F, -0.44F + p_187459_2_ * -0.8F, -0.72F); }
Example #28
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 #29
Source File: CraftHumanEntity.java From Kettle with GNU General Public License v3.0 | 4 votes |
public MainHand getMainHand() { return getHandle().getPrimaryHand() == EnumHandSide.LEFT ? MainHand.LEFT : MainHand.RIGHT; }
Example #30
Source File: ModelSamuraiIllager.java From Sakura_mod with MIT License | 4 votes |
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { this.head.rotateAngleY = netHeadYaw * 0.017453292F; this.head.rotateAngleX = headPitch * 0.017453292F; this.arms.rotationPointY = 3.0F; this.arms.rotationPointZ = -1.0F; this.arms.rotateAngleX = -0.75F; this.leg0.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount * 0.5F; this.leg1.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount * 0.5F; this.leg0.rotateAngleY = 0.0F; this.leg1.rotateAngleY = 0.0F; AbstractIllager.IllagerArmPose abstractillager$illagerarmpose = ((AbstractIllager) entityIn).getArmPose(); if (abstractillager$illagerarmpose == AbstractIllager.IllagerArmPose.ATTACKING) { float f = MathHelper.sin(this.swingProgress * (float) Math.PI); float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float) Math.PI); this.rightArm.rotateAngleZ = -0.3363323129985824F; this.leftArm.rotateAngleZ = 0.3363323129985824F; this.rightArm.rotateAngleY = -0.3363323129985824F; this.leftArm.rotateAngleY = 0.3363323129985824F; if (((EntityLivingBase) entityIn).getPrimaryHand() == EnumHandSide.RIGHT) { this.rightArm.rotateAngleX = -1.4849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F; this.leftArm.rotateAngleX = -1.4849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F; this.rightArm.rotateAngleX += f * 2.2F - f1 * 0.4F; this.leftArm.rotateAngleX += f * 2.2F - f1 * 0.4F; } else { this.rightArm.rotateAngleX = -1.4849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F; this.leftArm.rotateAngleX = -1.4849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F; this.rightArm.rotateAngleX += f * 2.2F - f1 * 0.4F; this.leftArm.rotateAngleX += f * 2.2F - f1 * 0.4F; } this.rightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; this.leftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; this.rightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.09F) * 0.05F; this.leftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.09F) * 0.05F; } else if (abstractillager$illagerarmpose == AbstractIllager.IllagerArmPose.SPELLCASTING) { this.rightArm.rotationPointZ = 0.0F; this.rightArm.rotationPointX = -5.0F; this.leftArm.rotationPointZ = 0.0F; this.leftArm.rotationPointX = 5.0F; this.rightArm.rotateAngleX = MathHelper.cos(ageInTicks * 0.6662F) * 0.25F; this.leftArm.rotateAngleX = MathHelper.cos(ageInTicks * 0.6662F) * 0.25F; this.rightArm.rotateAngleZ = 2.3561945F; this.leftArm.rotateAngleZ = -2.3561945F; this.rightArm.rotateAngleY = 0.0F; this.leftArm.rotateAngleY = 0.0F; } else if (abstractillager$illagerarmpose == AbstractIllager.IllagerArmPose.BOW_AND_ARROW) { this.rightArm.rotateAngleY = -0.1F + this.head.rotateAngleY; this.rightArm.rotateAngleX = -((float) Math.PI / 2F) + this.head.rotateAngleX; this.leftArm.rotateAngleX = -0.9424779F + this.head.rotateAngleX; this.leftArm.rotateAngleY = this.head.rotateAngleY - 0.4F; this.leftArm.rotateAngleZ = ((float) Math.PI / 2F); } }