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


Java Entity.canRiderInteract方法代码示例

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


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

示例1: getMouseOverServer

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static RayTraceResult getMouseOverServer(EntityLivingBase lookingEntity, double range) {

        RayTraceResult mop = raytraceEntityBlocks(lookingEntity, range);
        double d1 = range;
        Pair<Vec3d, Vec3d> startAndEnd = getStartAndEndLookVec(lookingEntity, (float) range);
        Vec3d vec3 = startAndEnd.getLeft();

        if (mop != null) {
            d1 = mop.hitVec.distanceTo(vec3);
        }

        Vec3d vec31 = lookingEntity.getLookVec();
        Vec3d vec32 = startAndEnd.getRight();
        Entity pointedEntity = null;
        Vec3d vec33 = null;
        float f1 = 1.0F;
        List<Entity> list = lookingEntity.world.getEntitiesWithinAABBExcludingEntity(lookingEntity, lookingEntity.getEntityBoundingBox()
                .grow(vec31.x * range, vec31.y * range, vec31.z * range).grow(f1, f1, f1));
        double d2 = d1;

        for (Entity entity : list) {
            if (entity.canBeCollidedWith()) {
                float f2 = entity.getCollisionBorderSize();
                AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox().grow(f2, f2, f2);
                RayTraceResult movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32);

                if (axisalignedbb.contains(vec3)) {
                    if (0.0D < d2 || d2 == 0.0D) {
                        pointedEntity = entity;
                        vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec;
                        d2 = 0.0D;
                    }
                } else if (movingobjectposition != null) {
                    double d3 = vec3.distanceTo(movingobjectposition.hitVec);

                    if (d3 < d2 || d2 == 0.0D) {
                        if (entity == entity.getRidingEntity() && !entity.canRiderInteract()) {
                            if (d2 == 0.0D) {
                                pointedEntity = entity;
                                vec33 = movingobjectposition.hitVec;
                            }
                        } else {
                            pointedEntity = entity;
                            vec33 = movingobjectposition.hitVec;
                            d2 = d3;
                        }
                    }
                }
            }
        }

        if (pointedEntity != null && (d2 < d1 || mop == null)) {
            mop = new RayTraceResult(pointedEntity, vec33);
        }
        return mop;
    }
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:57,代码来源:PneumaticCraftUtils.java

示例2: actualRayTrace

import net.minecraft.entity.Entity; //导入方法依赖的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

示例3: getEntity

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static Object[] getEntity(double reach, double expand, float partialTicks) {
    if (Wrapper.getMinecraft().field_71451_h != null && Wrapper.theWorld() != null) {
        Entity entity = null;
        Vec3 var6 = Wrapper.getMinecraft().field_71451_h.func_70666_h(partialTicks);
        Vec3 var7 = Wrapper.getMinecraft().field_71451_h.func_70676_i(partialTicks);
        Vec3 var8 = var6.func_72441_c(var7.field_72450_a * reach, var7.field_72448_b * reach,
                var7.field_72449_c * reach);
        Vec3 var9 = null;
        float var10 = 1.0f;
        @SuppressWarnings("unchecked")
        List<Entity> var11 = Wrapper.theWorld().func_72839_b(Wrapper.getMinecraft().field_71451_h,
                Wrapper.getMinecraft().field_71451_h.field_70121_D
                        .func_72321_a(var7.field_72450_a * reach, var7.field_72448_b * reach,
                                var7.field_72449_c * reach)
                        .func_72314_b((double) var10, (double) var10, (double) var10));
        double var12 = reach;
        for (int var13 = 0; var13 < var11.size(); ++var13) {
            Entity var14 = (Entity) var11.get(var13);
            if (var14.func_70067_L()) {
                float var15 = var14.func_70111_Y();
                AxisAlignedBB var16 = var14.field_70121_D.func_72314_b(var15, var15, var15);
                var16 = var16.func_72314_b(expand, expand, expand);
                MovingObjectPosition var17 = var16.func_72327_a(var6, var8);
                if (var16.func_72318_a(var6)) {
                    if (0.0 < var12 || var12 == 0.0) {
                        entity = var14;
                        var9 = ((var17 == null) ? var6 : var17.field_72307_f);
                        var12 = 0.0;
                    }
                } else if (var17 != null) {
                    double var18 = var6.func_72438_d(var17.field_72307_f);
                    if (var18 < var12 || var12 == 0.0) {
                        if (var14 == Wrapper.getMinecraft().field_71451_h.field_70154_o && !var14.canRiderInteract()) {
                            if (var12 == 0.0) {
                                entity = var14;
                                var9 = var17.field_72307_f;
                            }
                        } else {
                            entity = var14;
                            var9 = var17.field_72307_f;
                            var12 = var18;
                        }
                    }
                }
            }
        }
        if (var12 < reach && entity instanceof EntityLivingBase) {
            return new Object[]{entity, var9};
        }
    }
    return null;
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:53,代码来源:EntityUtil.java


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