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


Java Entity.getPositionEyes方法代码示例

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


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

示例1: getObjectMouseOver

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private MovingObjectPosition getObjectMouseOver(DiscreteMovementCommand command)
{
    MovingObjectPosition mop = null;
    if (command.equals(DiscreteMovementCommand.USE))
        mop = Minecraft.getMinecraft().objectMouseOver;
    else if (command.equals(DiscreteMovementCommand.JUMPUSE))
    {
        long partialTicks = 0;  //Minecraft.timer.renderPartialTicks
        Entity viewer = Minecraft.getMinecraft().thePlayer;
        double blockReach = Minecraft.getMinecraft().playerController.getBlockReachDistance();
        Vec3 eyePos = viewer.getPositionEyes(partialTicks);
        Vec3 lookVec = viewer.getLook(partialTicks);
        int yOffset = 1;    // For the jump
        Vec3 searchVec = eyePos.addVector(lookVec.xCoord * blockReach, yOffset + lookVec.yCoord * blockReach, lookVec.zCoord * blockReach);
        mop = Minecraft.getMinecraft().theWorld.rayTraceBlocks(eyePos, searchVec, false, false, false);
    }
    return mop;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:19,代码来源:DiscreteMovementCommandsImplementation.java

示例2: rayTraceEntity

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static RayTraceResult rayTraceEntity(Entity e, double blockReachDistance) {
    Vec3d eyes = e.getPositionEyes(1);
    Vec3d look = e.getLook(1);
    Vec3d end = eyes.addVector(look.x * blockReachDistance, look.y * blockReachDistance, look.z * blockReachDistance);
    return e.world.rayTraceBlocks(eyes, end, false, false, true);
}
 
开发者ID:kenzierocks,项目名称:HardVox,代码行数:7,代码来源:RayTraceHelper.java

示例3: 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


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