當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。