当前位置: 首页>>代码示例>>Java>>正文


Java AbstractClientPlayer.getActiveHand方法代码示例

本文整理汇总了Java中net.minecraft.client.entity.AbstractClientPlayer.getActiveHand方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractClientPlayer.getActiveHand方法的具体用法?Java AbstractClientPlayer.getActiveHand怎么用?Java AbstractClientPlayer.getActiveHand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.client.entity.AbstractClientPlayer的用法示例。


在下文中一共展示了AbstractClientPlayer.getActiveHand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renderItemInFirstPerson

import net.minecraft.client.entity.AbstractClientPlayer; //导入方法依赖的package包/类
/**
 * Renders the active item in the player's hand when in first person mode.
 */
public void renderItemInFirstPerson(float partialTicks)
{
    AbstractClientPlayer abstractclientplayer = this.mc.player;
    float f = abstractclientplayer.getSwingProgress(partialTicks);
    EnumHand enumhand = (EnumHand)Objects.firstNonNull(abstractclientplayer.swingingHand, EnumHand.MAIN_HAND);
    float f1 = abstractclientplayer.prevRotationPitch + (abstractclientplayer.rotationPitch - abstractclientplayer.prevRotationPitch) * partialTicks;
    float f2 = abstractclientplayer.prevRotationYaw + (abstractclientplayer.rotationYaw - abstractclientplayer.prevRotationYaw) * partialTicks;
    boolean flag = true;
    boolean flag1 = true;

    if (abstractclientplayer.isHandActive())
    {
        ItemStack itemstack = abstractclientplayer.getActiveItemStack();

        if (itemstack != null && itemstack.getItem() == Items.BOW)
        {
            EnumHand enumhand1 = abstractclientplayer.getActiveHand();
            flag = enumhand1 == EnumHand.MAIN_HAND;
            flag1 = !flag;
        }
    }

    this.rotateArroundXAndY(f1, f2);
    this.setLightmap();
    this.rotateArm(partialTicks);
    GlStateManager.enableRescaleNormal();

    if (flag)
    {
        float f3 = enumhand == EnumHand.MAIN_HAND ? f : 0.0F;
        float f5 = 1.0F - (this.prevEquippedProgressMainHand + (this.equippedProgressMainHand - this.prevEquippedProgressMainHand) * partialTicks);

        if (!Reflector.ForgeHooksClient_renderSpecificFirstPersonHand.exists() || !Reflector.callBoolean(Reflector.ForgeHooksClient_renderSpecificFirstPersonHand, new Object[] {EnumHand.MAIN_HAND, Float.valueOf(partialTicks), Float.valueOf(f1), Float.valueOf(f3), Float.valueOf(f5), this.itemStackMainHand}))
        {
            this.renderItemInFirstPerson(abstractclientplayer, partialTicks, f1, EnumHand.MAIN_HAND, f3, this.itemStackMainHand, f5);
        }
    }

    if (flag1)
    {
        float f4 = enumhand == EnumHand.OFF_HAND ? f : 0.0F;
        float f6 = 1.0F - (this.prevEquippedProgressOffHand + (this.equippedProgressOffHand - this.prevEquippedProgressOffHand) * partialTicks);

        if (!Reflector.ForgeHooksClient_renderSpecificFirstPersonHand.exists() || !Reflector.callBoolean(Reflector.ForgeHooksClient_renderSpecificFirstPersonHand, new Object[] {EnumHand.OFF_HAND, Float.valueOf(partialTicks), Float.valueOf(f1), Float.valueOf(f4), Float.valueOf(f6), this.itemStackOffHand}))
        {
            this.renderItemInFirstPerson(abstractclientplayer, partialTicks, f1, EnumHand.OFF_HAND, f4, this.itemStackOffHand, f6);
        }
    }

    GlStateManager.disableRescaleNormal();
    RenderHelper.disableStandardItemLighting();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:56,代码来源:ItemRenderer.java

示例2: renderItemInFirstPerson

import net.minecraft.client.entity.AbstractClientPlayer; //导入方法依赖的package包/类
/**
 * Renders the active item in the player's hand when in first person mode.
 */
public void renderItemInFirstPerson(float partialTicks)
{
    AbstractClientPlayer abstractclientplayer = this.mc.thePlayer;
    float f = abstractclientplayer.getSwingProgress(partialTicks);
    EnumHand enumhand = (EnumHand)Objects.firstNonNull(abstractclientplayer.swingingHand, EnumHand.MAIN_HAND);
    float f1 = abstractclientplayer.prevRotationPitch + (abstractclientplayer.rotationPitch - abstractclientplayer.prevRotationPitch) * partialTicks;
    float f2 = abstractclientplayer.prevRotationYaw + (abstractclientplayer.rotationYaw - abstractclientplayer.prevRotationYaw) * partialTicks;
    boolean flag = true;
    boolean flag1 = true;

    if (abstractclientplayer.isHandActive())
    {
        ItemStack itemstack = abstractclientplayer.getActiveItemStack();

        if (itemstack != null && itemstack.getItem() == Items.BOW) //Forge: Data watcher can desync and cause this to NPE...
        {
            EnumHand enumhand1 = abstractclientplayer.getActiveHand();
            flag = enumhand1 == EnumHand.MAIN_HAND;
            flag1 = !flag;
        }
    }

    this.rotateArroundXAndY(f1, f2);
    this.setLightmap();
    this.rotateArm(partialTicks);
    GlStateManager.enableRescaleNormal();

    if (flag)
    {
        float f3 = enumhand == EnumHand.MAIN_HAND ? f : 0.0F;
        float f5 = 1.0F - (this.prevEquippedProgressMainHand + (this.equippedProgressMainHand - this.prevEquippedProgressMainHand) * partialTicks);
        if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(EnumHand.MAIN_HAND, partialTicks, f1, f3, f5, this.itemStackMainHand))
        this.renderItemInFirstPerson(abstractclientplayer, partialTicks, f1, EnumHand.MAIN_HAND, f3, this.itemStackMainHand, f5);
    }

    if (flag1)
    {
        float f4 = enumhand == EnumHand.OFF_HAND ? f : 0.0F;
        float f6 = 1.0F - (this.prevEquippedProgressOffHand + (this.equippedProgressOffHand - this.prevEquippedProgressOffHand) * partialTicks);
        if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(EnumHand.OFF_HAND, partialTicks, f1, f4, f6, this.itemStackOffHand))
        this.renderItemInFirstPerson(abstractclientplayer, partialTicks, f1, EnumHand.OFF_HAND, f4, this.itemStackOffHand, f6);
    }

    GlStateManager.disableRescaleNormal();
    RenderHelper.disableStandardItemLighting();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:50,代码来源:ItemRenderer.java


注:本文中的net.minecraft.client.entity.AbstractClientPlayer.getActiveHand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。