本文整理汇总了Java中net.minecraft.entity.EntityLivingBase.getHeldItemOffhand方法的典型用法代码示例。如果您正苦于以下问题:Java EntityLivingBase.getHeldItemOffhand方法的具体用法?Java EntityLivingBase.getHeldItemOffhand怎么用?Java EntityLivingBase.getHeldItemOffhand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.EntityLivingBase
的用法示例。
在下文中一共展示了EntityLivingBase.getHeldItemOffhand方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getFeignDeathWatch
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public static ItemStack getFeignDeathWatch(EntityLivingBase living) {
ItemStack stack=living.getHeldItemMainhand();
if(stack.getItem() instanceof ItemCloak && ((ItemCloak)stack.getItem()).isFeignDeath(stack, living) && stack.getItemDamage() == 0) {
return stack;
}
else {
stack=living.getHeldItemOffhand();
if(stack.getItem() instanceof ItemCloak && ((ItemCloak)stack.getItem()).isFeignDeath(stack, living) && stack.getItemDamage() == 0) {
return stack;
}
IItemHandler items=living.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
for(int i=0; i<items.getSlots(); i++) {
stack=items.getStackInSlot(i);
if(stack.getItem() instanceof ItemCloak && ((ItemCloak)stack.getItem()).isFeignDeath(stack, living) && stack.getItemDamage() == 0) {
return stack;
}
}
}
return ItemStack.EMPTY;
}
示例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: getChargingShield
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public static ItemStack getChargingShield(EntityLivingBase living) {
if (living.getHeldItemMainhand() != null && living.getHeldItemMainhand().getItem() instanceof ItemChargingTarge)
return living.getHeldItemMainhand();
else if (living.getHeldItemOffhand() != null
&& living.getHeldItemOffhand().getItem() instanceof ItemChargingTarge)
return living.getHeldItemOffhand();
else
return ItemStack.EMPTY;
}
示例5: onUpdate
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public void onUpdate(ItemStack stack, World par2World, Entity par3Entity, int par4, boolean par5) {
super.onUpdate(stack, par2World, par3Entity, par4, par5);
if(stack.isEmpty())
return;
/*
* if(itemProperties.get(par2World.isRemote).get(par3Entity)==null){
* itemProperties.get(par2World.isRemote).put((EntityLivingBase)
* par3Entity, new NBTTagCompound()); }
*/
WeaponsCapability cap = par3Entity.getCapability(TF2weapons.WEAPONS_CAP, null);
WeaponData.WeaponDataCapability stackcap = stack.getCapability(TF2weapons.WEAPONS_DATA_CAP, null);
EntityLivingBase living=(EntityLivingBase) par3Entity;
if (stackcap.active == 0 && par5) {
stackcap.active = 1;
// itemProperties.get(par2World.isRemote).get(par3Entity).setShort("reloadd",
// (short) 800);
if(!par2World.isRemote && living.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.MAX_HEALTH).getModifier(ItemWeapon.HEALTH_MODIFIER)!=null){
float addHealth=(float) living.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.MAX_HEALTH).getModifier(ItemWeapon.HEALTH_MODIFIER).getAmount();
living.setHealth((living.getMaxHealth())/(living.getMaxHealth()-addHealth)*living.getHealth());
}
cap.fire1Cool = this.getDeployTime(stack, living);
cap.fire2Cool = this.getDeployTime(stack, living);
} else if (stackcap.active > 0
&& stack != living.getHeldItemOffhand() && !par5) {
if (stackcap.active == 2 && (cap.state & 3) > 0)
this.endUse(stack, living, par2World, cap.state, 0);
stackcap.active = 0;
this.holster(cap, stack, living, par2World);
}
if (par3Entity.ticksExisted % 5 == 0 && stackcap.active == 2
&& TF2Attribute.getModifier("Mark Death", stack, 0, living) > 0)
living.addPotionEffect(new PotionEffect(TF2weapons.markDeath,
(int) TF2Attribute.getModifier("Mark Death", stack, 0,living) * 20));
}
示例6: damageShield
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
void damageShield(EntityLivingBase attacked, EntityLivingBase attacker, float f)
{
ItemStack shield = null;
if(Prep1_11.isValid(attacked.getHeldItemOffhand()) && attacked.getHeldItemOffhand().getItem() == RegisterItems.wickerShield)
shield = attacked.getHeldItemOffhand();
else if(Prep1_11.isValid(attacked.getHeldItemMainhand()) && attacked.getHeldItemMainhand().getItem() == RegisterItems.wickerShield)
shield = attacked.getHeldItemMainhand();
//Copied from EntityPlayer#damageShield() START
if(Prep1_11.isEmpty(shield)) return;
shield.damageItem(1 + MathHelper.floor(f), attacker);
if (shield.getCount() <= 0)
{
EnumHand enumhand = attacked.getActiveHand();
if(attacked instanceof EntityPlayer) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem((EntityPlayer) attacked, attacked.getActiveItemStack(), enumhand);
if (enumhand == EnumHand.MAIN_HAND)
{
attacked.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, ItemStack.EMPTY);
}
else
{
attacked.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, ItemStack.EMPTY);
}
attacked.resetActiveHand();
attacked.playSound(SoundEvents.ITEM_SHIELD_BREAK, 0.8F, 0.8F + attacked.world.rand.nextFloat() * 0.4F);
}
//Copied from EntityPlayer#damageShield() END
}
示例7: getLightLevel
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public static int getLightLevel(Entity p_getLightLevel_0_)
{
if (p_getLightLevel_0_ == Config.getMinecraft().getRenderViewEntity() && !Config.isDynamicHandLight())
{
return 0;
}
else
{
if (p_getLightLevel_0_ instanceof EntityPlayer)
{
EntityPlayer entityplayer = (EntityPlayer)p_getLightLevel_0_;
if (entityplayer.isSpectator())
{
return 0;
}
}
if (p_getLightLevel_0_.isBurning())
{
return 15;
}
else if (p_getLightLevel_0_ instanceof EntityFireball)
{
return 15;
}
else if (p_getLightLevel_0_ instanceof EntityTNTPrimed)
{
return 15;
}
else if (p_getLightLevel_0_ instanceof EntityBlaze)
{
EntityBlaze entityblaze = (EntityBlaze)p_getLightLevel_0_;
return entityblaze.isCharged() ? 15 : 10;
}
else if (p_getLightLevel_0_ instanceof EntityMagmaCube)
{
EntityMagmaCube entitymagmacube = (EntityMagmaCube)p_getLightLevel_0_;
return (double)entitymagmacube.squishFactor > 0.6D ? 13 : 8;
}
else
{
if (p_getLightLevel_0_ instanceof EntityCreeper)
{
EntityCreeper entitycreeper = (EntityCreeper)p_getLightLevel_0_;
if ((double)entitycreeper.getCreeperFlashIntensity(0.0F) > 0.001D)
{
return 15;
}
}
if (p_getLightLevel_0_ instanceof EntityLivingBase)
{
EntityLivingBase entitylivingbase = (EntityLivingBase)p_getLightLevel_0_;
ItemStack itemstack3 = entitylivingbase.getHeldItemMainhand();
int i = getLightLevel(itemstack3);
ItemStack itemstack1 = entitylivingbase.getHeldItemOffhand();
int j = getLightLevel(itemstack1);
ItemStack itemstack2 = entitylivingbase.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
int k = getLightLevel(itemstack2);
int l = Math.max(i, j);
return Math.max(l, k);
}
else if (p_getLightLevel_0_ instanceof EntityItem)
{
EntityItem entityitem = (EntityItem)p_getLightLevel_0_;
ItemStack itemstack = getItemStack(entityitem);
return getLightLevel(itemstack);
}
else
{
return 0;
}
}
}
}