本文整理匯總了Java中net.minecraft.entity.Entity.getLook方法的典型用法代碼示例。如果您正苦於以下問題:Java Entity.getLook方法的具體用法?Java Entity.getLook怎麽用?Java Entity.getLook使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.Entity
的用法示例。
在下文中一共展示了Entity.getLook方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: renderDebugBoundingBox
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
* Renders the bounding box around an entity when F3+B is pressed
*/
private void renderDebugBoundingBox(Entity entityIn, double p_85094_2_, double p_85094_4_, double p_85094_6_, float p_85094_8_, float p_85094_9_)
{
GlStateManager.depthMask(false);
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GlStateManager.disableCull();
GlStateManager.disableBlend();
float f = entityIn.width / 2.0F;
AxisAlignedBB axisalignedbb = entityIn.getEntityBoundingBox();
AxisAlignedBB axisalignedbb1 = new AxisAlignedBB(axisalignedbb.minX - entityIn.posX + p_85094_2_, axisalignedbb.minY - entityIn.posY + p_85094_4_, axisalignedbb.minZ - entityIn.posZ + p_85094_6_, axisalignedbb.maxX - entityIn.posX + p_85094_2_, axisalignedbb.maxY - entityIn.posY + p_85094_4_, axisalignedbb.maxZ - entityIn.posZ + p_85094_6_);
RenderGlobal.func_181563_a(axisalignedbb1, 255, 255, 255, 255);
if (entityIn instanceof EntityLivingBase)
{
float f1 = 0.01F;
RenderGlobal.func_181563_a(new AxisAlignedBB(p_85094_2_ - (double)f, p_85094_4_ + (double)entityIn.getEyeHeight() - 0.009999999776482582D, p_85094_6_ - (double)f, p_85094_2_ + (double)f, p_85094_4_ + (double)entityIn.getEyeHeight() + 0.009999999776482582D, p_85094_6_ + (double)f), 255, 0, 0, 255);
}
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
Vec3 vec3 = entityIn.getLook(p_85094_9_);
worldrenderer.begin(3, DefaultVertexFormats.POSITION_COLOR);
worldrenderer.pos(p_85094_2_, p_85094_4_ + (double)entityIn.getEyeHeight(), p_85094_6_).color(0, 0, 255, 255).endVertex();
worldrenderer.pos(p_85094_2_ + vec3.xCoord * 2.0D, p_85094_4_ + (double)entityIn.getEyeHeight() + vec3.yCoord * 2.0D, p_85094_6_ + vec3.zCoord * 2.0D).color(0, 0, 255, 255).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.enableCull();
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
}
示例3: renderDebugBoundingBox
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
* Renders the bounding box around an entity when F3+B is pressed
*/
private void renderDebugBoundingBox(Entity entityIn, double x, double y, double z, float entityYaw, float partialTicks)
{
GlStateManager.depthMask(false);
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GlStateManager.disableCull();
GlStateManager.disableBlend();
float f = entityIn.width / 2.0F;
AxisAlignedBB axisalignedbb = entityIn.getEntityBoundingBox();
RenderGlobal.drawBoundingBox(axisalignedbb.minX - entityIn.posX + x, axisalignedbb.minY - entityIn.posY + y, axisalignedbb.minZ - entityIn.posZ + z, axisalignedbb.maxX - entityIn.posX + x, axisalignedbb.maxY - entityIn.posY + y, axisalignedbb.maxZ - entityIn.posZ + z, 1.0F, 1.0F, 1.0F, 1.0F);
if (entityIn instanceof EntityLivingBase)
{
float f1 = 0.01F;
RenderGlobal.drawBoundingBox(x - (double)f, y + (double)entityIn.getEyeHeight() - 0.009999999776482582D, z - (double)f, x + (double)f, y + (double)entityIn.getEyeHeight() + 0.009999999776482582D, z + (double)f, 1.0F, 0.0F, 0.0F, 1.0F);
}
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
Vec3d vec3d = entityIn.getLook(partialTicks);
vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
vertexbuffer.pos(x, y + (double)entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex();
vertexbuffer.pos(x + vec3d.xCoord * 2.0D, y + (double)entityIn.getEyeHeight() + vec3d.yCoord * 2.0D, z + vec3d.zCoord * 2.0D).color(0, 0, 255, 255).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.enableCull();
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
}
示例4: 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);
}
示例5: 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;
}
示例6: getLookVector
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public static Vec3d getLookVector(Entity ent, float delta) {
return ent.getLook(delta);
}
示例7: renderDebugBoundingBox
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
* Renders the bounding box around an entity when F3+B is pressed
*/
private void renderDebugBoundingBox(Entity entityIn, double x, double y, double z, float entityYaw, float partialTicks)
{
GlStateManager.depthMask(false);
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GlStateManager.disableCull();
GlStateManager.disableBlend();
float f = entityIn.width / 2.0F;
AxisAlignedBB axisalignedbb = entityIn.getEntityBoundingBox();
RenderGlobal.drawBoundingBox(axisalignedbb.minX - entityIn.posX + x, axisalignedbb.minY - entityIn.posY + y, axisalignedbb.minZ - entityIn.posZ + z, axisalignedbb.maxX - entityIn.posX + x, axisalignedbb.maxY - entityIn.posY + y, axisalignedbb.maxZ - entityIn.posZ + z, 1.0F, 1.0F, 1.0F, 1.0F);
Entity[] aentity = entityIn.getParts();
if (aentity != null)
{
for (Entity entity : aentity)
{
double d0 = (entity.posX - entity.prevPosX) * (double)partialTicks;
double d1 = (entity.posY - entity.prevPosY) * (double)partialTicks;
double d2 = (entity.posZ - entity.prevPosZ) * (double)partialTicks;
AxisAlignedBB axisalignedbb1 = entity.getEntityBoundingBox();
RenderGlobal.drawBoundingBox(axisalignedbb1.minX - this.renderPosX + d0, axisalignedbb1.minY - this.renderPosY + d1, axisalignedbb1.minZ - this.renderPosZ + d2, axisalignedbb1.maxX - this.renderPosX + d0, axisalignedbb1.maxY - this.renderPosY + d1, axisalignedbb1.maxZ - this.renderPosZ + d2, 0.25F, 1.0F, 0.0F, 1.0F);
}
}
if (entityIn instanceof EntityLivingBase)
{
float f1 = 0.01F;
RenderGlobal.drawBoundingBox(x - (double)f, y + (double)entityIn.getEyeHeight() - 0.009999999776482582D, z - (double)f, x + (double)f, y + (double)entityIn.getEyeHeight() + 0.009999999776482582D, z + (double)f, 1.0F, 0.0F, 0.0F, 1.0F);
}
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
Vec3d vec3d = entityIn.getLook(partialTicks);
vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
vertexbuffer.pos(x, y + (double)entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex();
vertexbuffer.pos(x + vec3d.xCoord * 2.0D, y + (double)entityIn.getEyeHeight() + vec3d.yCoord * 2.0D, z + vec3d.zCoord * 2.0D).color(0, 0, 255, 255).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.enableCull();
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
}