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


Java EntityLivingBase.getEyeHeight方法代码示例

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


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

示例1: getFacingFromEntity

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public static EnumFacing getFacingFromEntity(BlockPos pos, EntityLivingBase p_185647_1_)
{
    if (MathHelper.abs((float)p_185647_1_.posX - (float)pos.getX()) < 2.0F && MathHelper.abs((float)p_185647_1_.posZ - (float)pos.getZ()) < 2.0F)
    {
        double d0 = p_185647_1_.posY + (double)p_185647_1_.getEyeHeight();

        if (d0 - (double)pos.getY() > 2.0D)
        {
            return EnumFacing.UP;
        }

        if ((double)pos.getY() - d0 > 0.0D)
        {
            return EnumFacing.DOWN;
        }
    }

    return p_185647_1_.getHorizontalFacing().getOpposite();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:BlockPistonBase.java

示例2: updateAITasks

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
protected void updateAITasks()
{
    if (this.isWet())
    {
        this.attackEntityFrom(DamageSource.drown, 1.0F);
    }

    --this.heightOffsetUpdateTime;

    if (this.heightOffsetUpdateTime <= 0)
    {
        this.heightOffsetUpdateTime = 100;
        this.heightOffset = 0.5F + (float)this.rand.nextGaussian() * 3.0F;
    }

    EntityLivingBase entitylivingbase = this.getAttackTarget();

    if (entitylivingbase != null && entitylivingbase.posY + (double)entitylivingbase.getEyeHeight() > this.posY + (double)this.getEyeHeight() + (double)this.heightOffset)
    {
        this.motionY += (0.30000001192092896D - this.motionY) * 0.30000001192092896D;
        this.isAirBorne = true;
    }

    super.updateAITasks();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:EntityBlaze.java

示例3: updateAITasks

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
protected void updateAITasks()
{
	if (this.isWet())
	{
		this.attackEntityFrom(DamageSource.DROWN, 1.0F);
	}

	--this.heightOffsetUpdateTime;

	if (this.heightOffsetUpdateTime <= 0)
	{
		this.heightOffsetUpdateTime = 100;
		this.heightOffset = 0.5F + (float)this.rand.nextGaussian() * 3.0F;
	}

	EntityLivingBase attackTarget = this.getAttackTarget();
	if (attackTarget != null && attackTarget.posY + (double)attackTarget.getEyeHeight() > this.posY + (double)this.getEyeHeight() + (double)this.heightOffset)
	{
		this.motionY += (0.3D - this.motionY) * 0.3D;
		this.isAirBorne = true;
	}

	super.updateAITasks();
}
 
开发者ID:crazysnailboy,项目名称:Halloween,代码行数:26,代码来源:EntityHaunter.java

示例4: getFacingFromEntity

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn)
{
    if (MathHelper.abs((float)entityIn.posX - (float)clickedBlock.getX()) < 2.0F && MathHelper.abs((float)entityIn.posZ - (float)clickedBlock.getZ()) < 2.0F)
    {
        double d0 = entityIn.posY + (double)entityIn.getEyeHeight();

        if (d0 - (double)clickedBlock.getY() > 2.0D)
        {
            return EnumFacing.UP;
        }

        if ((double)clickedBlock.getY() - d0 > 0.0D)
        {
            return EnumFacing.DOWN;
        }
    }

    return entityIn.getHorizontalFacing().getOpposite();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:20,代码来源:BlockPistonBase.java

示例5: getStartAndEndLookVec

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public static Pair<Vec3d, Vec3d> getStartAndEndLookVec(EntityLivingBase entity, float maxDistance) {
    Vec3d entityVec;
    if (entity.world.isRemote && entity instanceof EntityPlayer) {
        entityVec = new Vec3d(entity.posX, entity.posY + 1.6200000000000001D, entity.posZ);
    } else {
        entityVec = new Vec3d(entity.posX, entity.posY + entity.getEyeHeight() - (entity.isSneaking() ? 0.08 : 0), entity.posZ);
    }
    Vec3d entityLookVec = entity.getLook(1.0F);
    Vec3d maxDistVec = entityVec.addVector(entityLookVec.x * maxDistance, entityLookVec.y * maxDistance, entityLookVec.z * maxDistance);
    return new ImmutablePair<>(entityVec, maxDistVec);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:12,代码来源:PneumaticCraftUtils.java

示例6: PlasmaArrow

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public PlasmaArrow(World worldIn, EntityLivingBase shooter)
{
    this(worldIn, shooter.posX, shooter.posY + (double)shooter.getEyeHeight() - 0.10000000149011612D, shooter.posZ);
    this.shootingEntity = shooter;

    if (shooter instanceof EntityPlayer)
    {
        this.pickupStatus = EntityArrow.PickupStatus.ALLOWED;
    }
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:11,代码来源:PlasmaArrow.java

示例7: attackEntityWithRangedAttack

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
/**
 * Attack the specified entity using a ranged attack.
 *  
 * @param distanceFactor How far the target is, normalized and clamped between 0.1 and 1.0
 */
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor)
{
    if (!this.isDrinkingPotion())
    {
        double d0 = target.posY + (double)target.getEyeHeight() - 1.100000023841858D;
        double d1 = target.posX + target.motionX - this.posX;
        double d2 = d0 - this.posY;
        double d3 = target.posZ + target.motionZ - this.posZ;
        float f = MathHelper.sqrt(d1 * d1 + d3 * d3);
        PotionType potiontype = PotionTypes.HARMING;

        if (f >= 8.0F && !target.isPotionActive(MobEffects.SLOWNESS))
        {
            potiontype = PotionTypes.SLOWNESS;
        }
        else if (target.getHealth() >= 8.0F && !target.isPotionActive(MobEffects.POISON))
        {
            potiontype = PotionTypes.POISON;
        }
        else if (f <= 3.0F && !target.isPotionActive(MobEffects.WEAKNESS) && this.rand.nextFloat() < 0.25F)
        {
            potiontype = PotionTypes.WEAKNESS;
        }

        EntityPotion entitypotion = new EntityPotion(this.world, this, PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), potiontype));
        entitypotion.rotationPitch -= -20.0F;
        entitypotion.setThrowableHeading(d1, d2 + (double)(f * 0.2F), d3, 0.75F, 8.0F);
        this.world.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_WITCH_THROW, this.getSoundCategory(), 1.0F, 0.8F + this.rand.nextFloat() * 0.4F);
        this.world.spawnEntityInWorld(entitypotion);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:37,代码来源:EntityWitch.java

示例8: EntityArrow

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public EntityArrow(World worldIn, EntityLivingBase shooter)
{
    this(worldIn, shooter.posX, shooter.posY + (double)shooter.getEyeHeight() - 0.10000000149011612D, shooter.posZ);
    this.shootingEntity = shooter;

    if (shooter instanceof EntityPlayer)
    {
        this.pickupStatus = EntityArrow.PickupStatus.ALLOWED;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:11,代码来源:EntityArrow.java

示例9: attackEntityWithRangedAttack

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
/**
 * Attack the specified entity using a ranged attack.
 */
public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_)
{
    EntitySnowball entitysnowball = new EntitySnowball(this.worldObj, this);
    double d0 = p_82196_1_.posY + (double)p_82196_1_.getEyeHeight() - 1.100000023841858D;
    double d1 = p_82196_1_.posX - this.posX;
    double d2 = d0 - entitysnowball.posY;
    double d3 = p_82196_1_.posZ - this.posZ;
    float f = MathHelper.sqrt_double(d1 * d1 + d3 * d3) * 0.2F;
    entitysnowball.setThrowableHeading(d1, d2 + (double)f, d3, 1.6F, 12.0F);
    this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
    this.worldObj.spawnEntityInWorld(entitysnowball);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:16,代码来源:EntitySnowman.java

示例10: attackEntityWithRangedAttack

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
/**
 * Attack the specified entity using a ranged attack.
 */
public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_)
{
    if (!this.getAggressive())
    {
        EntityPotion entitypotion = new EntityPotion(this.worldObj, this, 32732);
        double d0 = p_82196_1_.posY + (double)p_82196_1_.getEyeHeight() - 1.100000023841858D;
        entitypotion.rotationPitch -= -20.0F;
        double d1 = p_82196_1_.posX + p_82196_1_.motionX - this.posX;
        double d2 = d0 - this.posY;
        double d3 = p_82196_1_.posZ + p_82196_1_.motionZ - this.posZ;
        float f = MathHelper.sqrt_double(d1 * d1 + d3 * d3);

        if (f >= 8.0F && !p_82196_1_.isPotionActive(Potion.moveSlowdown))
        {
            entitypotion.setPotionDamage(32698);
        }
        else if (p_82196_1_.getHealth() >= 8.0F && !p_82196_1_.isPotionActive(Potion.poison))
        {
            entitypotion.setPotionDamage(32660);
        }
        else if (f <= 3.0F && !p_82196_1_.isPotionActive(Potion.weakness) && this.rand.nextFloat() < 0.25F)
        {
            entitypotion.setPotionDamage(32696);
        }

        entitypotion.setThrowableHeading(d1, d2 + (double)(f * 0.2F), d3, 0.75F, 8.0F);
        this.worldObj.spawnEntityInWorld(entitypotion);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:33,代码来源:EntityWitch.java

示例11: attackEntityWithRangedAttack

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
/**
 * Adapted from {@link net.minecraft.entity.monster.EntityWitch#attackEntityWithRangedAttack(EntityLivingBase, float)}
 */
@Override
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor)
{
	double x = target.posX + target.motionX - this.posX;
	double z = target.posZ + target.motionZ - this.posZ;
	double y = ((target.posY + (double)target.getEyeHeight() - 1.1D) - this.posY) + (double)(MathHelper.sqrt(x * x + z * z) * 0.2F);

	EntityCurseOrb entity = new EntityCurseOrb(this.world, this);
	entity.rotationPitch -= -20.0F;
	entity.setThrowableHeading(x, y, z, 0.75F, 8.0F);

	this.world.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_WITCH_THROW, this.getSoundCategory(), 1.0F, 0.8F + this.rand.nextFloat() * 0.4F);
	this.world.spawnEntity(entity);
}
 
开发者ID:crazysnailboy,项目名称:Halloween,代码行数:18,代码来源:EntityHallowitch.java

示例12: acquireAllLookTargets

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
private List<EntityLivingBase> acquireAllLookTargets(EntityLivingBase seeker, int distance, double radius) {
	
	if (distance < 0 || distance > MAX_DISTANCE) {
		distance = MAX_DISTANCE;
	}
	List<EntityLivingBase> targets = new ArrayList<EntityLivingBase>();
	Vec3d vec3 = seeker.getLookVec();
	double targetX = seeker.posX;
	double targetY = seeker.posY + seeker.getEyeHeight() - 0.10000000149011612D;
	double targetZ = seeker.posZ;
	double distanceTraveled = 0;

	while ((int) distanceTraveled < distance) {
		targetX += vec3.xCoord;
		targetY += vec3.yCoord;
		targetZ += vec3.zCoord;
		distanceTraveled += vec3.lengthVector();
		AxisAlignedBB bb = new AxisAlignedBB(targetX-radius, targetY-radius, targetZ-radius, targetX+radius, targetY+radius, targetZ+radius);
		List<EntityLivingBase> list = seeker.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bb);
		for (EntityLivingBase target : list) {
			if (target != seeker && target.canBeCollidedWith() && isTargetInSight(vec3, seeker, target)) {
				if (!targets.contains(target)) {
					targets.add(target);
				}
			}
		}
	}
	return targets;
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:30,代码来源:ItemEnderSnooker.java

示例13: EntityThrowable

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public EntityThrowable(World worldIn, EntityLivingBase throwerIn)
{
    this(worldIn, throwerIn.posX, throwerIn.posY + (double)throwerIn.getEyeHeight() - 0.10000000149011612D, throwerIn.posZ);
    this.thrower = throwerIn;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:6,代码来源:EntityThrowable.java

示例14: renderBeam

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public static void renderBeam(EntityLivingBase ent, float partialTicks) {
	if (!ent.hasCapability(TF2weapons.WEAPONS_CAP, null))
		return;
	// System.out.println("Drawing");
	Entity healTarget = ent.world.getEntityByID(ent.getCapability(TF2weapons.WEAPONS_CAP, null).getHealTarget());
	if (healTarget != null) {
		Entity camera = Minecraft.getMinecraft().getRenderViewEntity();
		double cameraX = camera.prevPosX + (camera.posX - camera.prevPosX) * partialTicks;
		double cameraY = camera.prevPosY + (camera.posY - camera.prevPosY) * partialTicks;
		double cameraZ = camera.prevPosZ + (camera.posZ - camera.prevPosZ) * partialTicks;
		// System.out.println("rendering");
		double xPos1 = ent.prevPosX + (ent.posX - ent.prevPosX) * partialTicks;
		double yPos1 = ent.prevPosY + (ent.posY - ent.prevPosY) * partialTicks;
		double zPos1 = ent.prevPosZ + (ent.posZ - ent.prevPosZ) * partialTicks;
		double xPos2 = healTarget.prevPosX + (healTarget.posX - healTarget.prevPosX) * partialTicks;
		double yPos2 = healTarget.prevPosY + (healTarget.posY - healTarget.prevPosY) * partialTicks;
		double zPos2 = healTarget.prevPosZ + (healTarget.posZ - healTarget.prevPosZ) * partialTicks;
		double xDist = xPos2 - xPos1;
		double yDist = (yPos2 + (healTarget.getEntityBoundingBox().maxY - healTarget.getEntityBoundingBox().minY) / 2 + 0.1) - (yPos1 + ent.getEyeHeight() - 0.1);
		double zDist = zPos2 - zPos1;
		float f = MathHelper.sqrt(xDist * xDist + zDist * zDist);
		float fullDist = MathHelper.sqrt(xDist * xDist + yDist * yDist + zDist * zDist);
		Tessellator tessellator = Tessellator.getInstance();
		BufferBuilder renderer = tessellator.getBuffer();
		GlStateManager.pushMatrix();
		GlStateManager.translate((float) xPos1 - cameraX, (float) (yPos1 + ent.getEyeHeight() - 0.1) - cameraY, (float) zPos1 - cameraZ);
		GL11.glRotatef((float) (Math.atan2(xDist, zDist) * 180.0D / Math.PI), 0.0F, 1.0F, 0.0F);
		GL11.glRotatef((float) (Math.atan2(yDist, f) * 180.0D / Math.PI) * -1, 1.0F, 0.0F, 0.0F);
		GlStateManager.disableTexture2D();
		GlStateManager.disableLighting();
		GL11.glEnable(GL11.GL_BLEND);
		OpenGlHelper.glBlendFunc(770, 771, 1, 0);
		ClientProxy.setColor(TF2Util.getTeamColor(ent), 0.23f, 0, 0f, 1f);
		/*if (TF2Util.getTeamForDisplay(ent) == 0) {
			GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.23F);
		} else {
			GL11.glColor4f(0.0F, 0.0F, 1.0F, 0.23F);
		}*/
		renderer.begin(7, DefaultVertexFormats.POSITION);
		renderer.pos(-0.04, -0.04, 0).endVertex();
		renderer.pos(0.04, 0.04, 0).endVertex();
		renderer.pos(0.04, 0.04, fullDist).endVertex();
		renderer.pos(-0.04, -0.04, fullDist).endVertex();
		tessellator.draw();
		renderer.begin(7, DefaultVertexFormats.POSITION);
		renderer.pos(-0.04, -0.04, fullDist).endVertex();
		renderer.pos(0.04, 0.04, fullDist).endVertex();
		renderer.pos(0.04, 0.04, 0).endVertex();
		renderer.pos(-0.04, -0.04, 0).endVertex();
		tessellator.draw();
		renderer.begin(7, DefaultVertexFormats.POSITION);
		renderer.pos(0.04, -0.04, 0).endVertex();
		renderer.pos(-0.04, 0.04, 0).endVertex();
		renderer.pos(-0.04, 0.04, fullDist).endVertex();
		renderer.pos(0.04, -0.04, fullDist).endVertex();
		tessellator.draw();
		renderer.begin(7, DefaultVertexFormats.POSITION);
		renderer.pos(0.04, -0.04, fullDist).endVertex();
		renderer.pos(-0.04, 0.04, fullDist).endVertex();
		renderer.pos(-0.04, 0.04, 0).endVertex();
		renderer.pos(0.04, -0.04, 0).endVertex();
		tessellator.draw();
		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
		GL11.glDisable(GL11.GL_BLEND);
		GlStateManager.enableTexture2D();
		GlStateManager.enableLighting();
		GlStateManager.popMatrix();
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:70,代码来源:TF2EventsClient.java


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