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