本文整理汇总了Java中net.minecraft.entity.ai.EntityLookHelper.getLookPosZ方法的典型用法代码示例。如果您正苦于以下问题:Java EntityLookHelper.getLookPosZ方法的具体用法?Java EntityLookHelper.getLookPosZ怎么用?Java EntityLookHelper.getLookPosZ使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.ai.EntityLookHelper
的用法示例。
在下文中一共展示了EntityLookHelper.getLookPosZ方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpdateMoveHelper
import net.minecraft.entity.ai.EntityLookHelper; //导入方法依赖的package包/类
public void onUpdateMoveHelper()
{
if (this.update && !this.entityGuardian.getNavigator().noPath())
{
double d0 = this.posX - this.entityGuardian.posX;
double d1 = this.posY - this.entityGuardian.posY;
double d2 = this.posZ - this.entityGuardian.posZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
d3 = (double)MathHelper.sqrt_double(d3);
d1 = d1 / d3;
float f = (float)(MathHelper.func_181159_b(d2, d0) * 180.0D / Math.PI) - 90.0F;
this.entityGuardian.rotationYaw = this.limitAngle(this.entityGuardian.rotationYaw, f, 30.0F);
this.entityGuardian.renderYawOffset = this.entityGuardian.rotationYaw;
float f1 = (float)(this.speed * this.entityGuardian.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue());
this.entityGuardian.setAIMoveSpeed(this.entityGuardian.getAIMoveSpeed() + (f1 - this.entityGuardian.getAIMoveSpeed()) * 0.125F);
double d4 = Math.sin((double)(this.entityGuardian.ticksExisted + this.entityGuardian.getEntityId()) * 0.5D) * 0.05D;
double d5 = Math.cos((double)(this.entityGuardian.rotationYaw * (float)Math.PI / 180.0F));
double d6 = Math.sin((double)(this.entityGuardian.rotationYaw * (float)Math.PI / 180.0F));
this.entityGuardian.motionX += d4 * d5;
this.entityGuardian.motionZ += d4 * d6;
d4 = Math.sin((double)(this.entityGuardian.ticksExisted + this.entityGuardian.getEntityId()) * 0.75D) * 0.05D;
this.entityGuardian.motionY += d4 * (d6 + d5) * 0.25D;
this.entityGuardian.motionY += (double)this.entityGuardian.getAIMoveSpeed() * d1 * 0.1D;
EntityLookHelper entitylookhelper = this.entityGuardian.getLookHelper();
double d7 = this.entityGuardian.posX + d0 / d3 * 2.0D;
double d8 = (double)this.entityGuardian.getEyeHeight() + this.entityGuardian.posY + d1 / d3 * 1.0D;
double d9 = this.entityGuardian.posZ + d2 / d3 * 2.0D;
double d10 = entitylookhelper.getLookPosX();
double d11 = entitylookhelper.getLookPosY();
double d12 = entitylookhelper.getLookPosZ();
if (!entitylookhelper.getIsLooking())
{
d10 = d7;
d11 = d8;
d12 = d9;
}
this.entityGuardian.getLookHelper().setLookPosition(d10 + (d7 - d10) * 0.125D, d11 + (d8 - d11) * 0.125D, d12 + (d9 - d12) * 0.125D, 10.0F, 40.0F);
this.entityGuardian.func_175476_l(true);
}
else
{
this.entityGuardian.setAIMoveSpeed(0.0F);
this.entityGuardian.func_175476_l(false);
}
}
示例2: onUpdateMoveHelper
import net.minecraft.entity.ai.EntityLookHelper; //导入方法依赖的package包/类
public void onUpdateMoveHelper()
{
if (this.action == EntityMoveHelper.Action.MOVE_TO && !this.entityGuardian.getNavigator().noPath())
{
double d0 = this.posX - this.entityGuardian.posX;
double d1 = this.posY - this.entityGuardian.posY;
double d2 = this.posZ - this.entityGuardian.posZ;
double d3 = (double)MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
d1 = d1 / d3;
float f = (float)(MathHelper.atan2(d2, d0) * (180D / Math.PI)) - 90.0F;
this.entityGuardian.rotationYaw = this.limitAngle(this.entityGuardian.rotationYaw, f, 90.0F);
this.entityGuardian.renderYawOffset = this.entityGuardian.rotationYaw;
float f1 = (float)(this.speed * this.entityGuardian.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue());
this.entityGuardian.setAIMoveSpeed(this.entityGuardian.getAIMoveSpeed() + (f1 - this.entityGuardian.getAIMoveSpeed()) * 0.125F);
double d4 = Math.sin((double)(this.entityGuardian.ticksExisted + this.entityGuardian.getEntityId()) * 0.5D) * 0.05D;
double d5 = Math.cos((double)(this.entityGuardian.rotationYaw * 0.017453292F));
double d6 = Math.sin((double)(this.entityGuardian.rotationYaw * 0.017453292F));
this.entityGuardian.motionX += d4 * d5;
this.entityGuardian.motionZ += d4 * d6;
d4 = Math.sin((double)(this.entityGuardian.ticksExisted + this.entityGuardian.getEntityId()) * 0.75D) * 0.05D;
this.entityGuardian.motionY += d4 * (d6 + d5) * 0.25D;
this.entityGuardian.motionY += (double)this.entityGuardian.getAIMoveSpeed() * d1 * 0.1D;
EntityLookHelper entitylookhelper = this.entityGuardian.getLookHelper();
double d7 = this.entityGuardian.posX + d0 / d3 * 2.0D;
double d8 = (double)this.entityGuardian.getEyeHeight() + this.entityGuardian.posY + d1 / d3;
double d9 = this.entityGuardian.posZ + d2 / d3 * 2.0D;
double d10 = entitylookhelper.getLookPosX();
double d11 = entitylookhelper.getLookPosY();
double d12 = entitylookhelper.getLookPosZ();
if (!entitylookhelper.getIsLooking())
{
d10 = d7;
d11 = d8;
d12 = d9;
}
this.entityGuardian.getLookHelper().setLookPosition(d10 + (d7 - d10) * 0.125D, d11 + (d8 - d11) * 0.125D, d12 + (d9 - d12) * 0.125D, 10.0F, 40.0F);
this.entityGuardian.setMoving(true);
}
else
{
this.entityGuardian.setAIMoveSpeed(0.0F);
this.entityGuardian.setMoving(false);
}
}
示例3: onUpdateMoveHelper
import net.minecraft.entity.ai.EntityLookHelper; //导入方法依赖的package包/类
public void onUpdateMoveHelper()
{
if (this.action == EntityMoveHelper.Action.MOVE_TO && !this.entityGuardian.getNavigator().noPath())
{
double d0 = this.posX - this.entityGuardian.posX;
double d1 = this.posY - this.entityGuardian.posY;
double d2 = this.posZ - this.entityGuardian.posZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
d3 = (double)MathHelper.sqrt_double(d3);
d1 = d1 / d3;
float f = (float)(MathHelper.atan2(d2, d0) * (180D / Math.PI)) - 90.0F;
this.entityGuardian.rotationYaw = this.limitAngle(this.entityGuardian.rotationYaw, f, 90.0F);
this.entityGuardian.renderYawOffset = this.entityGuardian.rotationYaw;
float f1 = (float)(this.speed * this.entityGuardian.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue());
this.entityGuardian.setAIMoveSpeed(this.entityGuardian.getAIMoveSpeed() + (f1 - this.entityGuardian.getAIMoveSpeed()) * 0.125F);
double d4 = Math.sin((double)(this.entityGuardian.ticksExisted + this.entityGuardian.getEntityId()) * 0.5D) * 0.05D;
double d5 = Math.cos((double)(this.entityGuardian.rotationYaw * 0.017453292F));
double d6 = Math.sin((double)(this.entityGuardian.rotationYaw * 0.017453292F));
this.entityGuardian.motionX += d4 * d5;
this.entityGuardian.motionZ += d4 * d6;
d4 = Math.sin((double)(this.entityGuardian.ticksExisted + this.entityGuardian.getEntityId()) * 0.75D) * 0.05D;
this.entityGuardian.motionY += d4 * (d6 + d5) * 0.25D;
this.entityGuardian.motionY += (double)this.entityGuardian.getAIMoveSpeed() * d1 * 0.1D;
EntityLookHelper entitylookhelper = this.entityGuardian.getLookHelper();
double d7 = this.entityGuardian.posX + d0 / d3 * 2.0D;
double d8 = (double)this.entityGuardian.getEyeHeight() + this.entityGuardian.posY + d1 / d3;
double d9 = this.entityGuardian.posZ + d2 / d3 * 2.0D;
double d10 = entitylookhelper.getLookPosX();
double d11 = entitylookhelper.getLookPosY();
double d12 = entitylookhelper.getLookPosZ();
if (!entitylookhelper.getIsLooking())
{
d10 = d7;
d11 = d8;
d12 = d9;
}
this.entityGuardian.getLookHelper().setLookPosition(d10 + (d7 - d10) * 0.125D, d11 + (d8 - d11) * 0.125D, d12 + (d9 - d12) * 0.125D, 10.0F, 40.0F);
this.entityGuardian.setMoving(true);
}
else
{
this.entityGuardian.setAIMoveSpeed(0.0F);
this.entityGuardian.setMoving(false);
}
}
示例4: onUpdateMoveHelper
import net.minecraft.entity.ai.EntityLookHelper; //导入方法依赖的package包/类
@Override
public void onUpdateMoveHelper() {
if (!entity.getNavigator().noPath()) {
double xDelta = posX - entity.posX;
double yDelta = posY - entity.posY;
double zDelta = posZ - entity.posZ;
float moveFactor = 1;
float moveSpeed = (float) (speed * entity.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue());
entity.setAIMoveSpeed(entity.getAIMoveSpeed() + (moveSpeed - entity.getAIMoveSpeed()) * moveFactor);
double distSq = xDelta * xDelta + yDelta * yDelta + zDelta * zDelta;
double dist = MathHelper.sqrt(distSq);
yDelta = yDelta / dist;
if (yDelta > 0) {
// Ensure enough lift to get up to the target
yDelta = Math.max(0.1, yDelta);
}
double yMove = entity.getAIMoveSpeed() * yDelta * mob.getMaxClimbRate();
entity.motionY += yMove;
// Limit max downward speed
if (!entity.isDead && !entity.onGround && entity.motionY < -maxDescentSpeed) {
entity.motionY = -maxDescentSpeed;
}
// Limit crazy spinning when going straight down
float tr = mob.getMaxTurnRate();
if (yMove < -0.12) {
tr = 10;
}
float yawAngle = (float) (MathHelper.atan2(zDelta, xDelta) * 180.0D / Math.PI) - 90.0F;
entity.rotationYaw = limitAngle(entity.rotationYaw, yawAngle, tr);
entity.renderYawOffset = entity.rotationYaw;
// Look
double d7 = entity.posX + (xDelta / dist * 2.0D);
double d8 = entity.getEyeHeight() + entity.posY + (yDelta / dist * 1.0D);
double d9 = entity.posZ + (zDelta / dist * 2.0D);
EntityLookHelper entitylookhelper = entity.getLookHelper();
double lookX = entitylookhelper.getLookPosX();
double lookY = entitylookhelper.getLookPosY();
double lookZ = entitylookhelper.getLookPosZ();
if (!entitylookhelper.getIsLooking()) {
lookX = d7;
lookY = d8;
lookZ = d9;
}
entity.getLookHelper().setLookPosition(lookX + (d7 - lookX) * 0.125D, lookY + (d8 - lookY) * 0.125D, lookZ + (d9 - lookZ) * 0.125D, 10.0F, 40.0F);
} else {
entity.setAIMoveSpeed(0.0F);
}
}