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


Java Entity.getEyeHeight方法代码示例

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


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

示例1: setLookPositionWithEntity

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Sets position to look at using entity
 */
public void setLookPositionWithEntity(Entity entityIn, float deltaYaw, float deltaPitch)
{
    this.posX = entityIn.posX;

    if (entityIn instanceof EntityLivingBase)
    {
        this.posY = entityIn.posY + (double)entityIn.getEyeHeight();
    }
    else
    {
        this.posY = (entityIn.getEntityBoundingBox().minY + entityIn.getEntityBoundingBox().maxY) / 2.0D;
    }

    this.posZ = entityIn.posZ;
    this.deltaLookYaw = deltaYaw;
    this.deltaLookPitch = deltaPitch;
    this.isLooking = true;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:EntityLookHelper.java

示例2: faceEntity

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void faceEntity(Entity entity)
  {
double x = entity.posX - Wrapper.getPlayer().posX;
double z = entity.posZ - Wrapper.getPlayer().posZ;
double y = entity.posY + (entity.getEyeHeight()/1.4D) - Wrapper.getPlayer().posY + (Wrapper.getPlayer().getEyeHeight()/1.4D);
double helper = MathHelper.sqrt(x * x + z * z);

float newYaw = (float)((Math.toDegrees(-Math.atan(x / z))));
float newPitch = (float)-Math.toDegrees(Math.atan(y / helper));

if(z < 0 && x < 0) { newYaw = (float)(90D + Math.toDegrees(Math.atan(z / x))); }
else if(z < 0 && x > 0) { newYaw = (float)(-90D + Math.toDegrees(Math.atan(z / x))); }

Wrapper.getPlayer().rotationYaw = newYaw; 
Wrapper.getPlayer().rotationPitch = newPitch;
Wrapper.getPlayer().rotationYawHead = newPitch;
  }
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:KillAura.java

示例3: shouldUpdateGlList

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public boolean shouldUpdateGlList()
{
    if (!this.updated)
    {
        return true;
    }
    else if (this.cloudTickCounter >= this.cloudTickCounterUpdate + 20)
    {
        return true;
    }
    else
    {
        Entity entity = this.mc.getRenderViewEntity();
        boolean flag = this.cloudPlayerY + (double)entity.getEyeHeight() < 128.0D + (double)(this.mc.gameSettings.ofCloudsHeight * 128.0F);
        boolean flag1 = entity.prevPosY + (double)entity.getEyeHeight() < 128.0D + (double)(this.mc.gameSettings.ofCloudsHeight * 128.0F);
        return flag1 != flag;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:19,代码来源:CloudRenderer.java

示例4: getAnglesToPosition

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static float[] getAnglesToPosition(Entity player, double x, double y, double z) {
    double deltaX = x - player.posX;
    double deltaY = y - player.posY - player.getEyeHeight() - 0.3;
    double deltaZ = z - player.posZ;
    double yawToEntity; // tangent degree to entity

    if (deltaZ < 0 && deltaX < 0) { // quadrant 3
        yawToEntity = 90D + Math.toDegrees(Math.atan(deltaZ / deltaX)); // 90
        // degrees
        // forward
    } else if (deltaZ < 0 && deltaX > 0) { // quadrant 4
        yawToEntity = -90D + Math.toDegrees(Math.atan(deltaZ / deltaX)); // 90
        // degrees
        // back
    } else { // quadrants one or two
        yawToEntity = Math.toDegrees(-Math.atan(deltaX / deltaZ));
    }

    double distanceXZ = Math.sqrt(deltaX * deltaX + deltaZ
            * deltaZ); // distance away for calculating pitch
    double pitchToEntity = -Math.toDegrees(Math.atan(deltaY / distanceXZ)); // tangent

    yawToEntity = wrapAngleTo180((float) yawToEntity);
    pitchToEntity = wrapAngleTo180((float) pitchToEntity);

    yawToEntity = isNaN(yawToEntity) ? 0 : yawToEntity;
    pitchToEntity = isNaN(pitchToEntity) ? 0 : pitchToEntity;

    return new float[] { (float) yawToEntity, (float) pitchToEntity };
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:31,代码来源:EntityHelper.java

示例5: attachToEntity

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void attachToEntity(Vector3 pos, Entity e)
{
    attached = true;
    attachedEntity = e;
    attachedX = (float) (pos.x - e.posX);
    attachedY = (float) (pos.y + height/2 - (e.posY - e.getEyeHeight() + e.height/2));
    attachedZ = (float) (pos.z - e.posZ);
    attachedYaw = getEntityRotation();
    
    if(attachedEntity instanceof EntityPlayer)
        attachedPlayerName = attachedEntity.getName();

    moveToEntityExterior();
    RedstoneEtherAddons.server().updateTracker(this);
}
 
开发者ID:TheCBProject,项目名称:WirelessRedstone,代码行数:16,代码来源:EntityWirelessTracker.java

示例6: getSquareDist

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private static double getSquareDist(Entity source, Entity dest) {
    Vec3d lowPosition = new Vec3d(source.posX, source.posY - 1, source.posZ);
    Vec3d position = new Vec3d(source.posX, source.posY, source.posZ);
    Vec3d eyePosition = new Vec3d(source.posX, source.posY + source.getEyeHeight(), source.posZ);
    double d0 = lowPosition.squareDistanceTo(dest.posX, dest.posY, dest.posZ);
    double d1 = position.squareDistanceTo(dest.posX, dest.posY, dest.posZ);
    double d2 = eyePosition.squareDistanceTo(dest.posX, dest.posY, dest.posZ);
    return Math.min(Math.min(d0, d1), d2);
}
 
开发者ID:McJty,项目名称:MeeCreeps,代码行数:10,代码来源:WorkerHelper.java

示例7: getEyePos

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Get entities eye position
 */
public static Vec3d getEyePos(Entity entity) {
    return new Vec3d(
            entity.posX,
            entity.posY + entity.getEyeHeight(),
            entity.posZ
    );
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:11,代码来源:EntityUtils.java

示例8: teleportToEntity

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Teleport the enderman to another entity
 */
protected boolean teleportToEntity(Entity p_70816_1_)
{
    Vec3 vec3 = new Vec3(this.posX - p_70816_1_.posX, this.getEntityBoundingBox().minY + (double)(this.height / 2.0F) - p_70816_1_.posY + (double)p_70816_1_.getEyeHeight(), this.posZ - p_70816_1_.posZ);
    vec3 = vec3.normalize();
    double d0 = 16.0D;
    double d1 = this.posX + (this.rand.nextDouble() - 0.5D) * 8.0D - vec3.xCoord * d0;
    double d2 = this.posY + (double)(this.rand.nextInt(16) - 8) - vec3.yCoord * d0;
    double d3 = this.posZ + (this.rand.nextDouble() - 0.5D) * 8.0D - vec3.zCoord * d0;
    return this.teleportTo(d1, d2, d3);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:14,代码来源:EntityEnderman.java

示例9: teleportToEntity

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Teleport the enderman to another entity
 */
protected boolean teleportToEntity(Entity p_70816_1_)
{
    Vec3d vec3d = new Vec3d(this.posX - p_70816_1_.posX, this.getEntityBoundingBox().minY + (double)(this.height / 2.0F) - p_70816_1_.posY + (double)p_70816_1_.getEyeHeight(), this.posZ - p_70816_1_.posZ);
    vec3d = vec3d.normalize();
    double d0 = 16.0D;
    double d1 = this.posX + (this.rand.nextDouble() - 0.5D) * 8.0D - vec3d.xCoord * 16.0D;
    double d2 = this.posY + (double)(this.rand.nextInt(16) - 8) - vec3d.yCoord * 16.0D;
    double d3 = this.posZ + (this.rand.nextDouble() - 0.5D) * 8.0D - vec3d.zCoord * 16.0D;
    return this.teleportTo(d1, d2, d3);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:14,代码来源:EntityEnderman.java

示例10: HealthBeam

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public HealthBeam(World world, Entity entity, float speed) 
{
    super(world);
    this.doSetup(entity, speed, 0, 0, entity.rotationYaw, entity.rotationPitch);
    
    this.ownerX = entity.posX;
    this.ownerY = entity.posY + entity.getEyeHeight() - 0.2;
    this.ownerZ = entity.posZ;
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:10,代码来源:HealthBeam.java

示例11: runShader

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static void runShader() {
	Minecraft mc = Minecraft.getMinecraft();
	
	//TODO remove
	if (Keyboard.isKeyDown(Keyboard.KEY_NUMPAD5)) {
		destroyShader();
		createShader();
	}
	
	//Use shader program
	GL20.glUseProgram(shader.getShaderProgram());
	
	//TODO third person view
	Entity entity = mc.getRenderViewEntity();
	float partialTicks = mc.getRenderPartialTicks();
	double entityPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks;
       double entityPosY = entity.lastTickPosY + entity.getEyeHeight() + (entity.posY - entity.lastTickPosY) * (double)partialTicks;
       double entityPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks;
       float fov = (float) Math.toRadians(mc.entityRenderer.getFOVModifier(partialTicks, true));
	
	//Set uniform values
	int texUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "tex");
	GL20.glUniform1i(texUniform, 0);
	int cameraPosUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "cameraPos");
	GL20.glUniform3f(cameraPosUniform, (float)entityPosX%16, (float)entityPosY%16, (float)entityPosZ%16);
	int cameraDirUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "cameraDir");
	GL20.glUniform3f(cameraDirUniform, -(float)Math.toRadians(entity.rotationPitch), (float)Math.toRadians(180+entity.rotationYaw), 0);
	int fovyUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "fovy");
	GL20.glUniform1f(fovyUniform, fov);
	int fovxUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "fovx");
	GL20.glUniform1f(fovxUniform, fov*Display.getWidth()/(float)Display.getHeight());
	int sphericalUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "spherical");
	GL20.glUniform1i(sphericalUniform, RayTracerSettings.spherical ? 1 : 0);
	int stereoscopicUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "stereoscopic3d");
	GL20.glUniform1i(stereoscopicUniform, RayTracerSettings.stereoscopic ? 1 : 0);
	int eyeWidthUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "eyeWidth");
	GL20.glUniform1f(eyeWidthUniform, 0.063f); //TODO input eyeWidth option
	
	if (!pauseRendering) {
		if (worldLoader == null) {
			worldLoader = new WorldLoader();
		}
		if (worldLoader.dimension != mc.world.provider.getDimension()) {
			worldLoader.dimension = mc.world.provider.getDimension();
		}
		worldLoader.updateWorld(entityPosX, entityPosY, entityPosZ, shader);

		//Setup view
		GL11.glMatrixMode(GL11.GL_PROJECTION);
		GL11.glPushMatrix();
		GL11.glLoadIdentity();
		GL11.glOrtho(-1, 1, -1, 1, -1, 1);
		GL11.glMatrixMode(GL11.GL_MODELVIEW);
		GL11.glPushMatrix();
		GL11.glLoadIdentity();

		//Bind vbo and texture
		GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, shader.getVbo());
		GL20.glEnableVertexAttribArray(0);
		GL20.glVertexAttribPointer(0, 2, GL11.GL_BYTE, false, 0, 0L);
		GL11.glBindTexture(GL11.GL_TEXTURE_2D, 8);

		//Render
		GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, 6);

		//Reset vbo and texture
		GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
		GL20.glDisableVertexAttribArray(0);
		GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

		//Reset view
		GL11.glMatrixMode(GL11.GL_PROJECTION);
		GL11.glPopMatrix();
		GL11.glMatrixMode(GL11.GL_MODELVIEW);
		GL11.glPopMatrix();
	}
	
	//Stop using shader program
	GL20.glUseProgram(0);
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:81,代码来源:RenderUtil.java

示例12: fromLookVec

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static Vec3d fromLookVec(Entity entity, double range) {
	Vec3d look = entity.getLookVec();
	return new Vec3d(look.x * range, entity.getEyeHeight() + look.y * range, look.z * range);
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:5,代码来源:RayTraceHelper.java

示例13: getRelativeViewVector

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private static Vector3 getRelativeViewVector(Vector3 pos)
{
    Entity renderentity = Minecraft.getMinecraft().getRenderViewEntity();
    return new Vector3((float)renderentity.posX - pos.x, (float)renderentity.posY + renderentity.getEyeHeight() - pos.y, (float)renderentity.posZ - pos.z);
}
 
开发者ID:TheCBProject,项目名称:WirelessRedstone,代码行数:6,代码来源:RenderWirelessBolt.java

示例14: updateRenderer

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Updates the entity renderer
 */
public void updateRenderer()
{
    if (OpenGlHelper.shadersSupported && ShaderLinkHelper.getStaticShaderLinkHelper() == null)
    {
        ShaderLinkHelper.setNewStaticShaderLinkHelper();
    }

    this.updateFovModifierHand();
    this.updateTorchFlicker();
    this.fogColor2 = this.fogColor1;
    this.thirdPersonDistanceTemp = this.thirdPersonDistance;

    if (this.mc.gameSettings.smoothCamera)
    {
        float f = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
        float f1 = f * f * f * 8.0F;
        this.smoothCamFilterX = this.mouseFilterXAxis.smooth(this.smoothCamYaw, 0.05F * f1);
        this.smoothCamFilterY = this.mouseFilterYAxis.smooth(this.smoothCamPitch, 0.05F * f1);
        this.smoothCamPartialTicks = 0.0F;
        this.smoothCamYaw = 0.0F;
        this.smoothCamPitch = 0.0F;
    }
    else
    {
        this.smoothCamFilterX = 0.0F;
        this.smoothCamFilterY = 0.0F;
        this.mouseFilterXAxis.reset();
        this.mouseFilterYAxis.reset();
    }

    if (this.mc.getRenderViewEntity() == null)
    {
        this.mc.setRenderViewEntity(this.mc.thePlayer);
    }

    Entity entity = this.mc.getRenderViewEntity();
    double d0 = entity.posX;
    double d1 = entity.posY + (double)entity.getEyeHeight();
    double d2 = entity.posZ;
    float f3 = this.mc.theWorld.getLightBrightness(new BlockPos(d0, d1, d2));
    float f4 = (float)this.mc.gameSettings.renderDistanceChunks / 16.0F;
    f4 = MathHelper.clamp_float(f4, 0.0F, 1.0F);
    float f2 = f3 * (1.0F - f4) + f4;
    this.fogColor1 += (f2 - this.fogColor1) * 0.1F;
    ++this.rendererUpdateCount;
    this.itemRenderer.updateEquippedItem();
    this.addRainParticles();
    this.bossColorModifierPrev = this.bossColorModifier;

    if (BossStatus.hasColorModifier)
    {
        this.bossColorModifier += 0.05F;

        if (this.bossColorModifier > 1.0F)
        {
            this.bossColorModifier = 1.0F;
        }

        BossStatus.hasColorModifier = false;
    }
    else if (this.bossColorModifier > 0.0F)
    {
        this.bossColorModifier -= 0.0125F;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:69,代码来源:EntityRenderer.java

示例15: updateRenderer

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Updates the entity renderer
 */
public void updateRenderer()
{
    if (OpenGlHelper.shadersSupported && ShaderLinkHelper.getStaticShaderLinkHelper() == null)
    {
        ShaderLinkHelper.setNewStaticShaderLinkHelper();
    }

    this.updateFovModifierHand();
    this.updateTorchFlicker();
    this.fogColor2 = this.fogColor1;
    this.thirdPersonDistancePrev = 4.0F;

    if (this.mc.gameSettings.smoothCamera)
    {
        float f = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
        float f1 = f * f * f * 8.0F;
        this.smoothCamFilterX = this.mouseFilterXAxis.smooth(this.smoothCamYaw, 0.05F * f1);
        this.smoothCamFilterY = this.mouseFilterYAxis.smooth(this.smoothCamPitch, 0.05F * f1);
        this.smoothCamPartialTicks = 0.0F;
        this.smoothCamYaw = 0.0F;
        this.smoothCamPitch = 0.0F;
    }
    else
    {
        this.smoothCamFilterX = 0.0F;
        this.smoothCamFilterY = 0.0F;
        this.mouseFilterXAxis.reset();
        this.mouseFilterYAxis.reset();
    }

    if (this.mc.getRenderViewEntity() == null)
    {
        this.mc.setRenderViewEntity(this.mc.player);
    }

    Entity entity = this.mc.getRenderViewEntity();
    double d2 = entity.posX;
    double d0 = entity.posY + (double)entity.getEyeHeight();
    double d1 = entity.posZ;
    float f2 = this.mc.world.getLightBrightness(new BlockPos(d2, d0, d1));
    float f3 = (float)this.mc.gameSettings.renderDistanceChunks / 16.0F;
    f3 = MathHelper.clamp(f3, 0.0F, 1.0F);
    float f4 = f2 * (1.0F - f3) + f3;
    this.fogColor1 += (f4 - this.fogColor1) * 0.1F;
    ++this.rendererUpdateCount;
    this.itemRenderer.updateEquippedItem();
    this.addRainParticles();
    this.bossColorModifierPrev = this.bossColorModifier;

    if (this.mc.ingameGUI.getBossOverlay().shouldDarkenSky())
    {
        this.bossColorModifier += 0.05F;

        if (this.bossColorModifier > 1.0F)
        {
            this.bossColorModifier = 1.0F;
        }
    }
    else if (this.bossColorModifier > 0.0F)
    {
        this.bossColorModifier -= 0.0125F;
    }

    if (this.field_190567_ac > 0)
    {
        --this.field_190567_ac;

        if (this.field_190567_ac == 0)
        {
            this.field_190566_ab = null;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:77,代码来源:EntityRenderer.java


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