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