Java Code Examples for net.minecraft.entity.EntityLivingBase#getHeldItemOffhand()
The following examples show how to use
net.minecraft.entity.EntityLivingBase#getHeldItemOffhand() .
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 |
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 2
Source File: EntityUtils.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
public static ItemStack getHeldItemOfType(EntityLivingBase entity, Item item) { ItemStack stack = entity.getHeldItemMainhand(); if (stack.isEmpty() == false && stack.getItem() == item) { return stack; } stack = entity.getHeldItemOffhand(); if (stack.isEmpty() == false && stack.getItem() == item) { return stack; } return ItemStack.EMPTY; }
Example 3
Source File: EntityUtils.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
public static ItemStack getHeldItemOfType(EntityLivingBase entity, Class<?> clazz) { ItemStack stack = entity.getHeldItemMainhand(); if (stack.isEmpty() == false) { if (clazz.isAssignableFrom(stack.getItem().getClass())) { return stack; } } stack = entity.getHeldItemOffhand(); if (stack.isEmpty() == false) { if (clazz.isAssignableFrom(stack.getItem().getClass())) { return stack; } } return ItemStack.EMPTY; }
Example 4
Source File: ItemKimono.java From Sakura_mod with MIT License | 4 votes |
@SideOnly(Side.CLIENT) public static ModelBiped getKimonoModel(EntityLivingBase entityLiving, ItemStack itemStack,ModelBiped model) { if (model != null) { model.setVisible(true); model.isSneak = entityLiving.isSneaking(); model.isRiding = entityLiving.isRiding(); model.isChild = entityLiving.isChild(); ItemStack itemstack = entityLiving.getHeldItemMainhand(); ItemStack itemstack1 = entityLiving.getHeldItemOffhand(); ModelBiped.ArmPose modelbiped$armpose = ModelBiped.ArmPose.EMPTY; ModelBiped.ArmPose modelbiped$armpose1 = ModelBiped.ArmPose.EMPTY; if ((itemstack != null) && (!itemstack.isEmpty())) { modelbiped$armpose = ModelBiped.ArmPose.ITEM; if (entityLiving.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) && (!itemstack1.isEmpty())) { modelbiped$armpose1 = ModelBiped.ArmPose.ITEM; if (entityLiving.getItemInUseCount() > 0) { EnumAction enumaction1 = itemstack1.getItemUseAction(); if (enumaction1 == EnumAction.BLOCK) { modelbiped$armpose1 = ModelBiped.ArmPose.BLOCK; } } } if (entityLiving.getPrimaryHand() == EnumHandSide.RIGHT) { model.rightArmPose = modelbiped$armpose; model.leftArmPose = modelbiped$armpose1; } else { model.rightArmPose = modelbiped$armpose1; model.leftArmPose = modelbiped$armpose; } } return model; }