本文整理了Java中net.minecraft.entity.Entity.getLookVec()
方法的一些代码示例,展示了Entity.getLookVec()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getLookVec()
方法的具体详情如下:
包路径:net.minecraft.entity.Entity
类名称:Entity
方法名:getLookVec
暂无
代码示例来源:origin: Vazkii/Psi
public static void blink(SpellContext context, Entity e, double dist) throws SpellRuntimeException {
context.verifyEntity(e);
if(!context.isInRadius(e))
throw new SpellRuntimeException(SpellRuntimeException.OUTSIDE_RADIUS);
Vec3d look = e.getLookVec();
if(look == null)
throw new SpellRuntimeException(SpellRuntimeException.NULL_VECTOR);
double x = e.posX += look.x * dist;
double y = e.posY += Math.max(0, look.y * dist);
double z = e.posZ += look.z * dist;
if(e instanceof EntityPlayerMP) {
if(e == context.caster) {
EntityPlayerMP mp = (EntityPlayerMP) e;
mp.connection.setPlayerLocation(x, y, z, e.rotationYaw, e.rotationPitch);
}
} else e.setPosition(x, y, z);
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
float headPosY = (float) (posY + 0.5 * getRenderSize() * 0.3F);
this.playSound(ModSounds.FIREDRAGON_BREATH, 4, 1);
double d2 = controller.getLookVec().x;
double d3 = controller.getLookVec().y;
double d4 = controller.getLookVec().z;
EntityDragonFireCharge entitylargefireball = new EntityDragonFireCharge(world, this, d2, d3, d4);
float size = this.isChild() ? 0.4F : this.isAdult() ? 1.3F : 0.8F;
float headPosZ = (float) (posZ + 1.8F * getRenderSize() * 0.3F * Math.sin((rotationYaw + 90) * Math.PI / 180));
float headPosY = (float) (posY + 0.5 * getRenderSize() * 0.3F);
double d2 = controller.getLookVec().x;
double d3 = controller.getLookVec().y;
double d4 = controller.getLookVec().z;
EntityDragonFire entitylargefireball = new EntityDragonFire(world, this, d2, d3, d4);
this.playSound(ModSounds.FIREDRAGON_BREATH, 4, 1);
代码示例来源:origin: Alex-the-666/Ice_and_Fire
float headPosY = (float) (posY + 0.5 * getRenderSize() * 0.3F);
this.playSound(ModSounds.ICEDRAGON_BREATH, 4, 1);
double d2 = controller.getLookVec().x;
double d3 = controller.getLookVec().y;
double d4 = controller.getLookVec().z;
EntityDragonIceCharge entitylargefireball = new EntityDragonIceCharge(world, this, d2, d3, d4);
float size = this.isChild() ? 0.4F : this.isAdult() ? 1.3F : 0.8F;
float headPosZ = (float) (posZ + 1.8F * getRenderSize() * 0.3F * Math.sin((rotationYaw + 90) * Math.PI / 180));
float headPosY = (float) (posY + 0.5 * getRenderSize() * 0.3F);
double d2 = controller.getLookVec().x;
double d3 = controller.getLookVec().y;
double d4 = controller.getLookVec().z;
EntityDragonIceProjectile entitylargefireball = new EntityDragonIceProjectile(world, this, d2, d3, d4);
this.playSound(ModSounds.ICEDRAGON_BREATH, 4, 1);
代码示例来源:origin: Vazkii/Psi
public static RayTraceResult raycast(Entity e, double len) throws SpellRuntimeException {
Vector3 vec = Vector3.fromEntity(e);
if(e instanceof EntityPlayer)
vec.add(0, e.getEyeHeight(), 0);
Vec3d look = e.getLookVec();
if(look == null)
throw new SpellRuntimeException(SpellRuntimeException.NULL_VECTOR);
return raycast(e.getEntityWorld(), vec, new Vector3(look), len);
}
代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped
/**
* Called when the entity is attacked.
*/
public boolean attackEntityFrom(DamageSource source, float amount) {
if (this.isEntityInvulnerable(source)) {
return false;
} else {
this.markVelocityChanged();
if (source.getImmediateSource() != null) {
Vec3d vec3d = source.getImmediateSource().getLookVec();
if (vec3d != null) {
this.motionX = vec3d.x;
this.motionY = vec3d.y;
this.motionZ = vec3d.z;
this.accelerationX = this.motionX * 0.1D;
this.accelerationY = this.motionY * 0.1D;
this.accelerationZ = this.motionZ * 0.1D;
}
if (source.getImmediateSource() instanceof EntityLivingBase) {
this.shootingEntity = (EntityLivingBase) source.getImmediateSource();
}
return true;
} else {
return false;
}
}
}
代码示例来源:origin: ForestryMC/ForestryMC
private static void addSmoke(ItemStack stack, World world, Entity entity, int distance) {
if (distance <= 0) {
return;
}
Vec3d look = entity.getLookVec();
EnumHandSide handSide = getHandSide(stack, entity);
Vec3d handOffset;
if (handSide == EnumHandSide.RIGHT) {
handOffset = look.crossProduct(new Vec3d(0, 1, 0));
} else {
handOffset = look.crossProduct(new Vec3d(0, -1, 0));
}
Vec3d lookDistance = new Vec3d(look.x * distance, look.y * distance, look.z * distance);
Vec3d scaledOffset = handOffset.scale(1.0 / distance);
Vec3d smokePos = lookDistance.add(entity.getPositionVector()).add(scaledOffset);
if (world.isRemote) {
ParticleRender.addEntitySmokeFX(world, smokePos.x, smokePos.y + 1, smokePos.z);
}
BlockPos blockPos = new BlockPos(smokePos.x, smokePos.y + 1, smokePos.z);
TileUtil.actOnTile(world, blockPos, IHiveTile.class, IHiveTile::calmBees);
}
代码示例来源:origin: Electrical-Age/ElectricalAge
double x = entity.posX, y = entity.posY + 1.62 - yOffset, z = entity.posZ;
Vec3 v = entity.getLookVec();
代码示例来源:origin: Vazkii/Psi
distance = pos.hitVec.distanceTo(positionVector);
Vec3d lookVector = e.getLookVec();
Vec3d reachVector = positionVector.addVector(lookVector.x * finalDistance, lookVector.y * finalDistance, lookVector.z * finalDistance);
内容来源于网络,如有侵权,请联系作者删除!