本文整理汇总了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;
}
示例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);
}
示例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;
}