本文整理汇总了Java中net.minecraft.entity.EntityLivingBase.getPrimaryHand方法的典型用法代码示例。如果您正苦于以下问题:Java EntityLivingBase.getPrimaryHand方法的具体用法?Java EntityLivingBase.getPrimaryHand怎么用?Java EntityLivingBase.getPrimaryHand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.EntityLivingBase
的用法示例。
在下文中一共展示了EntityLivingBase.getPrimaryHand方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doRenderLayer
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
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();
}
}
示例2: setLivingAnimations
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
/**
* 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);
}
示例3: doRenderLayer
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
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();
}
}
示例4: setLivingAnimations
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
/**
* 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);
}
示例5: getMainHand
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
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;
}
}