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


Java AxisAlignedBB.calculateIntercept方法代码示例

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


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

示例1: faceEntityClient

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
public static boolean faceEntityClient(Entity entity)
{
	// get position & rotation
	Vec3d eyesPos = getEyesPos();
	Vec3d lookVec = getServerLookVec();
	
	// try to face center of boundingBox
	AxisAlignedBB bb = entity.boundingBox;
	if(faceVectorClient(bb.getCenter()))
		return true;
	
	// if not facing center, check if facing anything in boundingBox
	return bb.calculateIntercept(eyesPos,
		eyesPos.add(lookVec.scale(6))) != null;
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:16,代码来源:RotationUtils.java

示例2: faceEntityPacket

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
public static boolean faceEntityPacket(Entity entity)
{
	// get position & rotation
	Vec3d eyesPos = getEyesPos();
	Vec3d lookVec = getServerLookVec();
	
	// try to face center of boundingBox
	AxisAlignedBB bb = entity.boundingBox;
	if(faceVectorPacket(bb.getCenter()))
		return true;
	
	// if not facing center, check if facing anything in boundingBox
	return bb.calculateIntercept(eyesPos,
		eyesPos.add(lookVec.scale(6))) != null;
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:16,代码来源:RotationUtils.java

示例3: rayTraceAABB

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
@Nullable
public static RayTraceResult rayTraceAABB(AxisAlignedBB box, BlockPos pos, Vec3d start, Vec3d end) {
	double x = pos.getX();
	double y = pos.getY();
	double z = pos.getZ();
	Vec3d a = start.subtract(x, y, z);
	Vec3d b = end.subtract(x, y, z);
	RayTraceResult result = box.calculateIntercept(a, b);
	if(result != null && result.typeOfHit == RayTraceResult.Type.BLOCK) {
		return result;
	}
	return null;
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:14,代码来源:RayTraceHelper.java

示例4: faceEntityPacket

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
public static boolean faceEntityPacket(IEntity entity) {
	Vec3d eyesPos = getEyesPos();
	Vec3d lookVec = getServerLookVec();

	AxisAlignedBB bb = entity.getEntity().boundingBox;
	if (faceVectorPacket(bb.getCenter()))
		return true;

	return bb.calculateIntercept(eyesPos, eyesPos.add(lookVec.scale(6))) != null;
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:11,代码来源:RotUtils.java

示例5: faceEntityClient

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
public static boolean faceEntityClient(IEntity entity) {
	Vec3d eyesPos = getEyesPos();
	Vec3d lookVec = getServerLookVec();

	AxisAlignedBB bb = entity.getEntity().boundingBox;
	if (faceVectorClient(bb.getCenter()))
		return true;

	return bb.calculateIntercept(eyesPos, eyesPos.add(lookVec.scale(6))) != null;
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:11,代码来源:RotUtils.java

示例6: func_190538_a

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
@Nullable
private Entity func_190538_a(Vec3d p_190538_1_, Vec3d p_190538_2_)
{
    Entity entity = null;
    List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expandXyz(1.0D));
    double d0 = 0.0D;

    for (Entity entity1 : list)
    {
        if (entity1 != this.field_190539_a)
        {
            AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expandXyz(0.30000001192092896D);
            RayTraceResult raytraceresult = axisalignedbb.calculateIntercept(p_190538_1_, p_190538_2_);

            if (raytraceresult != null)
            {
                double d1 = p_190538_1_.squareDistanceTo(raytraceresult.hitVec);

                if (d1 < d0 || d0 == 0.0D)
                {
                    entity = entity1;
                    d0 = d1;
                }
            }
        }
    }

    return entity;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:30,代码来源:EntityLlamaSpit.java

示例7: findEntityOnPath

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
@Nullable
protected Entity findEntityOnPath(Vec3d start, Vec3d end)
{
    Entity entity = null;
    List<Entity> list = this.world.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expandXyz(1.0D), ARROW_TARGETS);
    double d0 = 0.0D;

    for (int i = 0; i < list.size(); ++i)
    {
        Entity entity1 = (Entity)list.get(i);

        if (entity1 != this.shootingEntity || this.ticksInAir >= 5)
        {
            AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expandXyz(0.30000001192092896D);
            RayTraceResult raytraceresult = axisalignedbb.calculateIntercept(start, end);

            if (raytraceresult != null)
            {
                double d1 = start.squareDistanceTo(raytraceresult.hitVec);

                if (d1 < d0 || d0 == 0.0D)
                {
                    entity = entity1;
                    d0 = d1;
                }
            }
        }
    }

    return entity;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:32,代码来源:EntityArrow.java

示例8: rayTrace

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
@Nullable
protected RayTraceResult rayTrace(BlockPos pos, Vec3d start, Vec3d end, AxisAlignedBB boundingBox)
{
    Vec3d vec3d = start.subtract((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
    Vec3d vec3d1 = end.subtract((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
    RayTraceResult raytraceresult = boundingBox.calculateIntercept(vec3d, vec3d1);
    return raytraceresult == null ? null : new RayTraceResult(raytraceresult.hitVec.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ()), raytraceresult.sideHit, pos);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:9,代码来源:Block.java

示例9: getBlockDensity

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
public float getBlockDensity(Vec3d origin, AxisAlignedBB p_72842_2_) {
	double d0 = 1.0D / ((p_72842_2_.maxX - p_72842_2_.minX) * 2.0D + 1.0D);
	double d1 = 1.0D / ((p_72842_2_.maxY - p_72842_2_.minY) * 2.0D + 1.0D);
	double d2 = 1.0D / ((p_72842_2_.maxZ - p_72842_2_.minZ) * 2.0D + 1.0D);
	List<AxisAlignedBB> collisionBoxes = this.world.getCollisionBoxes(null,p_72842_2_.grow(1, 1, 1));
	if (d0 >= 0.0D && d1 >= 0.0D && d2 >= 0.0D) {
		int i = 0;
		int j = 0;

		for (float f = 0.0F; f <= 1.0F; f = (float) (f + d0))
			for (float f1 = 0.0F; f1 <= 1.0F; f1 = (float) (f1 + d1))
				for (float f2 = 0.0F; f2 <= 1.0F; f2 = (float) (f2 + d2)) {
					double d3 = p_72842_2_.minX + (p_72842_2_.maxX - p_72842_2_.minX) * f;
					double d4 = p_72842_2_.minY + (p_72842_2_.maxY - p_72842_2_.minY) * f1;
					double d5 = p_72842_2_.minZ + (p_72842_2_.maxZ - p_72842_2_.minZ) * f2;
					Vec3d start = new Vec3d(d3, d4, d5);
					boolean free = true;
					for (AxisAlignedBB box : collisionBoxes)
						if (box.calculateIntercept(start, origin) != null) {
							free = false;
							break;
						}
					// RayTraceResult mop=//this.world.getCo(new
					// Vec3d(d3, d4, d5), p_72842_1_, false, true, false);
					if (free)
						++i;

					++j;
				}
		// System.out.println("Explosion power: "+((float)i/j));
		return (float) i / (float) j;
	} else
		return 0.0F;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:35,代码来源:TF2Explosion.java

示例10: findEntityOnPath

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
@Nullable
protected Entity findEntityOnPath(Vec3d start, Vec3d end)
{
    Entity entity = null;
    List<Entity> list = this.worldObj.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expandXyz(1.0D), ARROW_TARGETS);
    double d0 = 0.0D;

    for (int i = 0; i < list.size(); ++i)
    {
        Entity entity1 = (Entity)list.get(i);

        if (entity1 != this.shootingEntity || this.ticksInAir >= 5)
        {
            AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expandXyz(0.30000001192092896D);
            RayTraceResult raytraceresult = axisalignedbb.calculateIntercept(start, end);

            if (raytraceresult != null)
            {
                double d1 = start.squareDistanceTo(raytraceresult.hitVec);

                if (d1 < d0 || d0 == 0.0D)
                {
                    entity = entity1;
                    d0 = d1;
                }
            }
        }
    }

    return entity;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:32,代码来源:EntityArrow.java

示例11: actualRayTrace

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
public static Entity actualRayTrace(Entity entity, double dist)
{
    Vec3d vec3d = entity.getPositionEyes(1.0F);
    Vec3d vec3d1 = entity.getLook(1.0F);
    Vec3d vec3d2 = vec3d.addVector(vec3d1.xCoord * dist, vec3d1.yCoord * dist, vec3d1.zCoord * dist);

    Entity pointedEntity = null;
    List<Entity> list = entity.worldObj.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(vec3d1.xCoord * dist, vec3d1.yCoord * dist, vec3d1.zCoord * dist).expand(1.0D, 1.0D, 1.0D), Predicates.and(EntitySelectors.NOT_SPECTATING, new Predicate<Entity>()
    {
        public boolean apply(@Nullable Entity p_apply_1_)
        {
            return p_apply_1_ != null && p_apply_1_.canBeCollidedWith();
        }
    }));


    for (int j = 0; j < list.size(); ++j)
    {
        Entity entity1 = (Entity)list.get(j);
        AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expandXyz((double)entity1.getCollisionBorderSize());
        RayTraceResult raytraceresult = axisalignedbb.calculateIntercept(vec3d, vec3d2);

        if (axisalignedbb.isVecInside(vec3d))
        {
            if (dist >= 0.0D)
            {
                pointedEntity = entity1;
                dist = 0.0D;
            }
        }
        else if (raytraceresult != null)
        {
            double d3 = vec3d.distanceTo(raytraceresult.hitVec);

            if (d3 < dist || dist == 0.0D)
            {
                if (entity1.getLowestRidingEntity() == entity.getLowestRidingEntity() && !entity.canRiderInteract())
                {
                    if (dist == 0.0D)
                    {
                        pointedEntity = entity1;
                    }
                }
                else
                {
                    pointedEntity = entity1;
                    dist = d3;
                }
            }
        }
    }

    return pointedEntity;


}
 
开发者ID:Drazuam,项目名称:RunicArcana,代码行数:57,代码来源:DustSymbolSight.java

示例12: onLivingUpdate

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
@Override
public void onLivingUpdate() {
	super.onLivingUpdate();
	if (!this.world.isRemote) {
		this.jumpCooldown--;

		if (this.getAttackTarget() == null)
			this.heal(0.35f);

		this.bossInfo.setPercent(this.getHealth() / this.getMaxHealth());
		// System.out.println("Has path: "+this.getNavigator().noPath());
		List<AxisAlignedBB> boxes = this.world.getCollisionBoxes(this, getEntityBoundingBox().grow(1, 0, 1));
		boolean obscuredView = false;
		for (AxisAlignedBB box : boxes)
			if (box.calculateIntercept(this.getPositionVector().addVector(0, this.getEyeHeight(), 0),
					this.getPositionVector().add(this.getVectorForRotation(0, this.rotationYawHead).addVector(0,
							this.getEyeHeight(), 0))) != null) {
				obscuredView = true;
				break;
			}

		if (this.getAttackTarget() != null && this.getAttackTarget().isEntityAlive() && obscuredView) {
			this.superJump = true;
			this.jump();
		}
		if (this.rage > 1) {
			List<EntityLivingBase> list = this.world.getEntitiesWithinAABB(EntityLivingBase.class,
					this.getEntityBoundingBox().grow(12, 12, 12), new Predicate<EntityLivingBase>() {

						@Override
						public boolean apply(EntityLivingBase input) {
							// TODO Auto-generated method stub
							return !(input instanceof EntitySaxtonHale)
									&& !(input instanceof EntityPlayer && ((EntityPlayer) input).isCreative())
									&& input.getDistanceSqToEntity(EntitySaxtonHale.this) < 144;
						}

					});
			if (!list.isEmpty()) {
				this.rage = 0;
				this.playSound(TF2Sounds.MOB_SAXTON_RAGE, 2.5F, 1F);
				for (EntityLivingBase living : list)
					TF2Util.stun(living, 160, false);
				this.superJump = true;
				this.jump();
			}
		}
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:50,代码来源:EntitySaxtonHale.java


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