Java 类net.minecraft.util.Vec3 实例源码

项目:BaseClient    文件:Item.java   
protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids)
{
    float f = playerIn.rotationPitch;
    float f1 = playerIn.rotationYaw;
    double d0 = playerIn.posX;
    double d1 = playerIn.posY + (double)playerIn.getEyeHeight();
    double d2 = playerIn.posZ;
    Vec3 vec3 = new Vec3(d0, d1, d2);
    float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI);
    float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI);
    float f4 = -MathHelper.cos(-f * 0.017453292F);
    float f5 = MathHelper.sin(-f * 0.017453292F);
    float f6 = f3 * f4;
    float f7 = f2 * f4;
    double d3 = 5.0D;
    Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3);
    return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false);
}
项目:BaseClient    文件:ActiveRenderInfo.java   
/**
 * Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode
 */
public static void updateRenderInfo(EntityPlayer entityplayerIn, boolean p_74583_1_)
{
    GlStateManager.getFloat(2982, MODELVIEW);
    GlStateManager.getFloat(2983, PROJECTION);
    GL11.glGetInteger(GL11.GL_VIEWPORT, VIEWPORT);
    float f = (float)((VIEWPORT.get(0) + VIEWPORT.get(2)) / 2);
    float f1 = (float)((VIEWPORT.get(1) + VIEWPORT.get(3)) / 2);
    GLU.gluUnProject(f, f1, 0.0F, MODELVIEW, PROJECTION, VIEWPORT, OBJECTCOORDS);
    position = new Vec3((double)OBJECTCOORDS.get(0), (double)OBJECTCOORDS.get(1), (double)OBJECTCOORDS.get(2));
    int i = p_74583_1_ ? 1 : 0;
    float f2 = entityplayerIn.rotationPitch;
    float f3 = entityplayerIn.rotationYaw;
    rotationX = MathHelper.cos(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationZ = MathHelper.sin(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationYZ = -rotationZ * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationXY = rotationX * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationXZ = MathHelper.cos(f2 * (float)Math.PI / 180.0F);
}
项目:BaseClient    文件:EntityAIFleeSun.java   
private Vec3 findPossibleShelter()
{
    Random random = this.theCreature.getRNG();
    BlockPos blockpos = new BlockPos(this.theCreature.posX, this.theCreature.getEntityBoundingBox().minY, this.theCreature.posZ);

    for (int i = 0; i < 10; ++i)
    {
        BlockPos blockpos1 = blockpos.add(random.nextInt(20) - 10, random.nextInt(6) - 3, random.nextInt(20) - 10);

        if (!this.theWorld.canSeeSky(blockpos1) && this.theCreature.getBlockPathWeight(blockpos1) < 0.0F)
        {
            return new Vec3((double)blockpos1.getX(), (double)blockpos1.getY(), (double)blockpos1.getZ());
        }
    }

    return null;
}
项目:DecompiledMinecraft    文件:EntityAIMoveTowardsRestriction.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (this.theEntity.isWithinHomeDistanceCurrentPosition())
    {
        return false;
    }
    else
    {
        BlockPos blockpos = this.theEntity.getHomePosition();
        Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 16, 7, new Vec3((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ()));

        if (vec3 == null)
        {
            return false;
        }
        else
        {
            this.movePosX = vec3.xCoord;
            this.movePosY = vec3.yCoord;
            this.movePosZ = vec3.zCoord;
            return true;
        }
    }
}
项目:BaseClient    文件:PathNavigateSwimmer.java   
protected void pathFollow()
{
    Vec3 vec3 = this.getEntityPosition();
    float f = this.theEntity.width * this.theEntity.width;
    int i = 6;

    if (vec3.squareDistanceTo(this.currentPath.getVectorFromIndex(this.theEntity, this.currentPath.getCurrentPathIndex())) < (double)f)
    {
        this.currentPath.incrementPathIndex();
    }

    for (int j = Math.min(this.currentPath.getCurrentPathIndex() + i, this.currentPath.getCurrentPathLength() - 1); j > this.currentPath.getCurrentPathIndex(); --j)
    {
        Vec3 vec31 = this.currentPath.getVectorFromIndex(this.theEntity, j);

        if (vec31.squareDistanceTo(vec3) <= 36.0D && this.isDirectPathBetweenPoints(vec3, vec31, 0, 0, 0))
        {
            this.currentPath.setCurrentPathIndex(j);
            break;
        }
    }

    this.checkForStuck(vec3);
}
项目:BaseClient    文件:CustomColorizer.java   
public static Vec3 getWorldSkyColor(Vec3 p_getWorldSkyColor_0_, WorldClient p_getWorldSkyColor_1_, Entity p_getWorldSkyColor_2_, float p_getWorldSkyColor_3_)
{
    int i = p_getWorldSkyColor_1_.provider.getDimensionId();

    switch (i)
    {
        case 0:
            Minecraft minecraft = Minecraft.getMinecraft();
            p_getWorldSkyColor_0_ = getSkyColor(p_getWorldSkyColor_0_, minecraft.theWorld, p_getWorldSkyColor_2_.posX, p_getWorldSkyColor_2_.posY + 1.0D, p_getWorldSkyColor_2_.posZ);
            break;

        case 1:
            p_getWorldSkyColor_0_ = getSkyColorEnd(p_getWorldSkyColor_0_);
    }

    return p_getWorldSkyColor_0_;
}
项目:BaseClient    文件:EntityAIRunAroundLikeCrazy.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (!this.horseHost.isTame() && this.horseHost.riddenByEntity != null)
    {
        Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.horseHost, 5, 4);

        if (vec3 == null)
        {
            return false;
        }
        else
        {
            this.targetX = vec3.xCoord;
            this.targetY = vec3.yCoord;
            this.targetZ = vec3.zCoord;
            return true;
        }
    }
    else
    {
        return false;
    }
}
项目:DecompiledMinecraft    文件:EntityEnderman.java   
/**
 * Checks to see if this enderman should be attacking this player
 */
private boolean shouldAttackPlayer(EntityPlayer player)
{
    ItemStack itemstack = player.inventory.armorInventory[3];

    if (itemstack != null && itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin))
    {
        return false;
    }
    else
    {
        Vec3 vec3 = player.getLook(1.0F).normalize();
        Vec3 vec31 = new Vec3(this.posX - player.posX, this.getEntityBoundingBox().minY + (double)(this.height / 2.0F) - (player.posY + (double)player.getEyeHeight()), this.posZ - player.posZ);
        double d0 = vec31.lengthVector();
        vec31 = vec31.normalize();
        double d1 = vec3.dotProduct(vec31);
        return d1 > 1.0D - 0.025D / d0 ? player.canEntityBeSeen(this) : false;
    }
}
项目:SerenityCE    文件:Trajectories.java   
private static Entity getEntityHit(ProjectileType type, Vec3 source, Vec3 destination) {
    for (Object o : Minecraft.getMinecraft().theWorld.loadedEntityList) {
        if (o == Minecraft.getMinecraft().getRenderViewEntity())
            continue;
        if (o instanceof EntityLivingBase) {
            EntityLivingBase entity = (EntityLivingBase) o;

            double expander = (type == ProjectileType.ARROW) ? 0.2 : 0.125;
            AxisAlignedBB boundingBox = entity.getEntityBoundingBox().expand(expander, expander, expander);

            MovingObjectPosition raytraceResult = boundingBox.calculateIntercept(source, destination);
            if (raytraceResult != null) {
                return entity;
            }
        }
    }

    return null;
}
项目:DecompiledMinecraft    文件:EntityAIRunAroundLikeCrazy.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (!this.horseHost.isTame() && this.horseHost.riddenByEntity != null)
    {
        Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.horseHost, 5, 4);

        if (vec3 == null)
        {
            return false;
        }
        else
        {
            this.targetX = vec3.xCoord;
            this.targetY = vec3.yCoord;
            this.targetZ = vec3.zCoord;
            return true;
        }
    }
    else
    {
        return false;
    }
}
项目:DecompiledMinecraft    文件:EntityAIMoveTowardsRestriction.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (this.theEntity.isWithinHomeDistanceCurrentPosition())
    {
        return false;
    }
    else
    {
        BlockPos blockpos = this.theEntity.getHomePosition();
        Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 16, 7, new Vec3((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ()));

        if (vec3 == null)
        {
            return false;
        }
        else
        {
            this.movePosX = vec3.xCoord;
            this.movePosY = vec3.yCoord;
            this.movePosZ = vec3.zCoord;
            return true;
        }
    }
}
项目:BaseClient    文件:EntityAIPanic.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (this.theEntityCreature.getAITarget() == null && !this.theEntityCreature.isBurning())
    {
        return false;
    }
    else
    {
        Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.theEntityCreature, 5, 4);

        if (vec3 == null)
        {
            return false;
        }
        else
        {
            this.randPosX = vec3.xCoord;
            this.randPosY = vec3.yCoord;
            this.randPosZ = vec3.zCoord;
            return true;
        }
    }
}
项目:DecompiledMinecraft    文件:EntityLivingBase.java   
/**
 * Renders broken item particles using the given ItemStack
 */
public void renderBrokenItemStack(ItemStack stack)
{
    this.playSound("random.break", 0.8F, 0.8F + this.worldObj.rand.nextFloat() * 0.4F);

    for (int i = 0; i < 5; ++i)
    {
        Vec3 vec3 = new Vec3(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
        vec3 = vec3.rotatePitch(-this.rotationPitch * (float)Math.PI / 180.0F);
        vec3 = vec3.rotateYaw(-this.rotationYaw * (float)Math.PI / 180.0F);
        double d0 = (double)(-this.rand.nextFloat()) * 0.6D - 0.3D;
        Vec3 vec31 = new Vec3(((double)this.rand.nextFloat() - 0.5D) * 0.3D, d0, 0.6D);
        vec31 = vec31.rotatePitch(-this.rotationPitch * (float)Math.PI / 180.0F);
        vec31 = vec31.rotateYaw(-this.rotationYaw * (float)Math.PI / 180.0F);
        vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ);
        this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord, new int[] {Item.getIdFromItem(stack.getItem())});
    }
}
项目:BaseClient    文件:CustomColorizer.java   
public static Vec3 getFogColor(Vec3 p_getFogColor_0_, IBlockAccess p_getFogColor_1_, double p_getFogColor_2_, double p_getFogColor_4_, double p_getFogColor_6_)
{
    if (fogColors == null)
    {
        return p_getFogColor_0_;
    }
    else
    {
        int i = getSmoothColor(fogColors, p_getFogColor_1_, p_getFogColor_2_, p_getFogColor_4_, p_getFogColor_6_, 7, 1);
        int j = i >> 16 & 255;
        int k = i >> 8 & 255;
        int l = i & 255;
        float f = (float)j / 255.0F;
        float f1 = (float)k / 255.0F;
        float f2 = (float)l / 255.0F;
        float f3 = (float)p_getFogColor_0_.xCoord / 0.753F;
        float f4 = (float)p_getFogColor_0_.yCoord / 0.8471F;
        float f5 = (float)p_getFogColor_0_.zCoord;
        f = f * f3;
        f1 = f1 * f4;
        f2 = f2 * f5;
        return new Vec3((double)f, (double)f1, (double)f2);
    }
}
项目:DecompiledMinecraft    文件:PathNavigateSwimmer.java   
protected void pathFollow()
{
    Vec3 vec3 = this.getEntityPosition();
    float f = this.theEntity.width * this.theEntity.width;
    int i = 6;

    if (vec3.squareDistanceTo(this.currentPath.getVectorFromIndex(this.theEntity, this.currentPath.getCurrentPathIndex())) < (double)f)
    {
        this.currentPath.incrementPathIndex();
    }

    for (int j = Math.min(this.currentPath.getCurrentPathIndex() + i, this.currentPath.getCurrentPathLength() - 1); j > this.currentPath.getCurrentPathIndex(); --j)
    {
        Vec3 vec31 = this.currentPath.getVectorFromIndex(this.theEntity, j);

        if (vec31.squareDistanceTo(vec3) <= 36.0D && this.isDirectPathBetweenPoints(vec3, vec31, 0, 0, 0))
        {
            this.currentPath.setCurrentPathIndex(j);
            break;
        }
    }

    this.checkForStuck(vec3);
}
项目:DecompiledMinecraft    文件:PathNavigateSwimmer.java   
protected void pathFollow()
{
    Vec3 vec3 = this.getEntityPosition();
    float f = this.theEntity.width * this.theEntity.width;
    int i = 6;

    if (vec3.squareDistanceTo(this.currentPath.getVectorFromIndex(this.theEntity, this.currentPath.getCurrentPathIndex())) < (double)f)
    {
        this.currentPath.incrementPathIndex();
    }

    for (int j = Math.min(this.currentPath.getCurrentPathIndex() + i, this.currentPath.getCurrentPathLength() - 1); j > this.currentPath.getCurrentPathIndex(); --j)
    {
        Vec3 vec31 = this.currentPath.getVectorFromIndex(this.theEntity, j);

        if (vec31.squareDistanceTo(vec3) <= 36.0D && this.isDirectPathBetweenPoints(vec3, vec31, 0, 0, 0))
        {
            this.currentPath.setCurrentPathIndex(j);
            break;
        }
    }

    this.checkForStuck(vec3);
}
项目:DecompiledMinecraft    文件:PathNavigateGround.java   
/**
 * Returns true if an entity does not collide with any solid blocks at the position.
 */
private boolean isPositionClear(int p_179692_1_, int p_179692_2_, int p_179692_3_, int p_179692_4_, int p_179692_5_, int p_179692_6_, Vec3 p_179692_7_, double p_179692_8_, double p_179692_10_)
{
    for (BlockPos blockpos : BlockPos.getAllInBox(new BlockPos(p_179692_1_, p_179692_2_, p_179692_3_), new BlockPos(p_179692_1_ + p_179692_4_ - 1, p_179692_2_ + p_179692_5_ - 1, p_179692_3_ + p_179692_6_ - 1)))
    {
        double d0 = (double)blockpos.getX() + 0.5D - p_179692_7_.xCoord;
        double d1 = (double)blockpos.getZ() + 0.5D - p_179692_7_.zCoord;

        if (d0 * p_179692_8_ + d1 * p_179692_10_ >= 0.0D)
        {
            Block block = this.worldObj.getBlockState(blockpos).getBlock();

            if (!block.isPassable(this.worldObj, blockpos))
            {
                return false;
            }
        }
    }

    return true;
}
项目:Proyecto-DASI    文件:DiscreteMovementCommandsImplementation.java   
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;
}
项目:BaseClient    文件:CustomColorizer.java   
public static Vec3 getWorldFogColor(Vec3 p_getWorldFogColor_0_, WorldClient p_getWorldFogColor_1_, Entity p_getWorldFogColor_2_, float p_getWorldFogColor_3_)
{
    int i = p_getWorldFogColor_1_.provider.getDimensionId();

    switch (i)
    {
        case -1:
            p_getWorldFogColor_0_ = getFogColorNether(p_getWorldFogColor_0_);
            break;

        case 0:
            Minecraft minecraft = Minecraft.getMinecraft();
            p_getWorldFogColor_0_ = getFogColor(p_getWorldFogColor_0_, minecraft.theWorld, p_getWorldFogColor_2_.posX, p_getWorldFogColor_2_.posY + 1.0D, p_getWorldFogColor_2_.posZ);
            break;

        case 1:
            p_getWorldFogColor_0_ = getFogColorEnd(p_getWorldFogColor_0_);
    }

    return p_getWorldFogColor_0_;
}
项目:DecompiledMinecraft    文件:WorldServer.java   
/**
 * returns a new explosion. Does initiation (at time of writing Explosion is not finished)
 */
public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking)
{
    Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking);
    explosion.doExplosionA();
    explosion.doExplosionB(false);

    if (!isSmoking)
    {
        explosion.func_180342_d();
    }

    for (EntityPlayer entityplayer : this.playerEntities)
    {
        if (entityplayer.getDistanceSq(x, y, z) < 4096.0D)
        {
            ((EntityPlayerMP)entityplayer).playerNetServerHandler.sendPacket(new S27PacketExplosion(x, y, z, strength, explosion.getAffectedBlockPositions(), (Vec3)explosion.getPlayerKnockbackMap().get(entityplayer)));
        }
    }

    return explosion;
}
项目:BaseClient    文件:EntityEnderman.java   
/**
 * Checks to see if this enderman should be attacking this player
 */
private boolean shouldAttackPlayer(EntityPlayer player)
{
    ItemStack itemstack = player.inventory.armorInventory[3];

    if (itemstack != null && itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin))
    {
        return false;
    }
    else
    {
        Vec3 vec3 = player.getLook(1.0F).normalize();
        Vec3 vec31 = new Vec3(this.posX - player.posX, this.getEntityBoundingBox().minY + (double)(this.height / 2.0F) - (player.posY + (double)player.getEyeHeight()), this.posZ - player.posZ);
        double d0 = vec31.lengthVector();
        vec31 = vec31.normalize();
        double d1 = vec3.dotProduct(vec31);
        return d1 > 1.0D - 0.025D / d0 ? player.canEntityBeSeen(this) : false;
    }
}
项目:BaseClient    文件:WorldProviderEnd.java   
/**
 * Return Vec3D with biome specific fog color
 */
public Vec3 getFogColor(float p_76562_1_, float p_76562_2_)
{
    int i = 10518688;
    float f = MathHelper.cos(p_76562_1_ * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
    f = MathHelper.clamp_float(f, 0.0F, 1.0F);
    float f1 = (float)(i >> 16 & 255) / 255.0F;
    float f2 = (float)(i >> 8 & 255) / 255.0F;
    float f3 = (float)(i & 255) / 255.0F;
    f1 = f1 * (f * 0.0F + 0.15F);
    f2 = f2 * (f * 0.0F + 0.15F);
    f3 = f3 * (f * 0.0F + 0.15F);
    return new Vec3((double)f1, (double)f2, (double)f3);
}
项目:BaseClient    文件:EntityAIFleeSun.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (!this.theWorld.isDaytime())
    {
        return false;
    }
    else if (!this.theCreature.isBurning())
    {
        return false;
    }
    else if (!this.theWorld.canSeeSky(new BlockPos(this.theCreature.posX, this.theCreature.getEntityBoundingBox().minY, this.theCreature.posZ)))
    {
        return false;
    }
    else
    {
        Vec3 vec3 = this.findPossibleShelter();

        if (vec3 == null)
        {
            return false;
        }
        else
        {
            this.shelterX = vec3.xCoord;
            this.shelterY = vec3.yCoord;
            this.shelterZ = vec3.zCoord;
            return true;
        }
    }
}
项目:DecompiledMinecraft    文件:EntityFireball.java   
/**
 * Called when the entity is attacked.
 */
public boolean attackEntityFrom(DamageSource source, float amount)
{
    if (this.isEntityInvulnerable(source))
    {
        return false;
    }
    else
    {
        this.setBeenAttacked();

        if (source.getEntity() != null)
        {
            Vec3 vec3 = source.getEntity().getLookVec();

            if (vec3 != null)
            {
                this.motionX = vec3.xCoord;
                this.motionY = vec3.yCoord;
                this.motionZ = vec3.zCoord;
                this.accelerationX = this.motionX * 0.1D;
                this.accelerationY = this.motionY * 0.1D;
                this.accelerationZ = this.motionZ * 0.1D;
            }

            if (source.getEntity() instanceof EntityLivingBase)
            {
                this.shootingEntity = (EntityLivingBase)source.getEntity();
            }

            return true;
        }
        else
        {
            return false;
        }
    }
}
项目:BaseClient    文件:Entity.java   
/**
 * Creates a Vec3 using the pitch and yaw of the entities rotation.
 */
protected final Vec3 getVectorForRotation(float pitch, float yaw)
{
    float f = MathHelper.cos(-yaw * 0.017453292F - (float)Math.PI);
    float f1 = MathHelper.sin(-yaw * 0.017453292F - (float)Math.PI);
    float f2 = -MathHelper.cos(-pitch * 0.017453292F);
    float f3 = MathHelper.sin(-pitch * 0.017453292F);
    return new Vec3((double)(f1 * f2), (double)f3, (double)(f * f2));
}
项目:BaseClient    文件:Entity.java   
/**
 * interpolated look vector
 */
public Vec3 getLook(float partialTicks)
{
    if (partialTicks == 1.0F)
    {
        return this.getVectorForRotation(this.rotationPitch, this.rotationYaw);
    }
    else
    {
        float f = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * partialTicks;
        float f1 = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * partialTicks;
        return this.getVectorForRotation(f, f1);
    }
}
项目:DecompiledMinecraft    文件:EntityAIWander.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (!this.mustUpdate)
    {
        if (this.entity.getAge() >= 100)
        {
            return false;
        }

        if (this.entity.getRNG().nextInt(this.executionChance) != 0)
        {
            return false;
        }
    }

    Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.entity, 10, 7);

    if (vec3 == null)
    {
        return false;
    }
    else
    {
        this.xPosition = vec3.xCoord;
        this.yPosition = vec3.yCoord;
        this.zPosition = vec3.zCoord;
        this.mustUpdate = false;
        return true;
    }
}
项目:BaseClient    文件:PathNavigate.java   
/**
 * Checks if entity haven't been moved when last checked and if so, clears current {@link
 * net.minecraft.pathfinding.PathEntity}
 */
protected void checkForStuck(Vec3 positionVec3)
{
    if (this.totalTicks - this.ticksAtLastPos > 100)
    {
        if (positionVec3.squareDistanceTo(this.lastPosCheck) < 2.25D)
        {
            this.clearPathEntity();
        }

        this.ticksAtLastPos = this.totalTicks;
        this.lastPosCheck = positionVec3;
    }
}
项目:BaseClient    文件:RenderManager.java   
/**
 * 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);
}
项目:BaseClient    文件:RenderGuardian.java   
public boolean shouldRender(EntityGuardian livingEntity, ICamera camera, double camX, double camY, double camZ)
{
    if (super.shouldRender(livingEntity, camera, camX, camY, camZ))
    {
        return true;
    }
    else
    {
        if (livingEntity.hasTargetedEntity())
        {
            EntityLivingBase entitylivingbase = livingEntity.getTargetedEntity();

            if (entitylivingbase != null)
            {
                Vec3 vec3 = this.func_177110_a(entitylivingbase, (double)entitylivingbase.height * 0.5D, 1.0F);
                Vec3 vec31 = this.func_177110_a(livingEntity, (double)livingEntity.getEyeHeight(), 1.0F);

                if (camera.isBoundingBoxInFrustum(AxisAlignedBB.fromBounds(vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord, vec3.zCoord)))
                {
                    return true;
                }
            }
        }

        return false;
    }
}
项目:DecompiledMinecraft    文件:S27PacketExplosion.java   
public S27PacketExplosion(double p_i45193_1_, double y, double z, float strengthIn, List<BlockPos> affectedBlocksIn, Vec3 p_i45193_9_)
{
    this.posX = p_i45193_1_;
    this.posY = y;
    this.posZ = z;
    this.strength = strengthIn;
    this.affectedBlockPositions = Lists.newArrayList(affectedBlocksIn);

    if (p_i45193_9_ != null)
    {
        this.field_149152_f = (float)p_i45193_9_.xCoord;
        this.field_149153_g = (float)p_i45193_9_.yCoord;
        this.field_149159_h = (float)p_i45193_9_.zCoord;
    }
}
项目:BaseClient    文件:EntityAIFleeSun.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (!this.theWorld.isDaytime())
    {
        return false;
    }
    else if (!this.theCreature.isBurning())
    {
        return false;
    }
    else if (!this.theWorld.canSeeSky(new BlockPos(this.theCreature.posX, this.theCreature.getEntityBoundingBox().minY, this.theCreature.posZ)))
    {
        return false;
    }
    else
    {
        Vec3 vec3 = this.findPossibleShelter();

        if (vec3 == null)
        {
            return false;
        }
        else
        {
            this.shelterX = vec3.xCoord;
            this.shelterY = vec3.yCoord;
            this.shelterZ = vec3.zCoord;
            return true;
        }
    }
}
项目:DecompiledMinecraft    文件:EntityAIAvoidEntity.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    List<T> list = this.theEntity.worldObj.<T>getEntitiesWithinAABB(this.field_181064_i, this.theEntity.getEntityBoundingBox().expand((double)this.avoidDistance, 3.0D, (double)this.avoidDistance), Predicates.and(new Predicate[] {EntitySelectors.NOT_SPECTATING, this.canBeSeenSelector, this.avoidTargetSelector}));

    if (list.isEmpty())
    {
        return false;
    }
    else
    {
        this.closestLivingEntity = list.get(0);
        Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockAwayFrom(this.theEntity, 16, 7, new Vec3(this.closestLivingEntity.posX, this.closestLivingEntity.posY, this.closestLivingEntity.posZ));

        if (vec3 == null)
        {
            return false;
        }
        else if (this.closestLivingEntity.getDistanceSq(vec3.xCoord, vec3.yCoord, vec3.zCoord) < this.closestLivingEntity.getDistanceSqToEntity(this.theEntity))
        {
            return false;
        }
        else
        {
            this.entityPathEntity = this.entityPathNavigate.getPathToXYZ(vec3.xCoord, vec3.yCoord, vec3.zCoord);
            return this.entityPathEntity == null ? false : this.entityPathEntity.isDestinationSame(vec3);
        }
    }
}
项目:ExtraAcC    文件:WindAssault.java   
@Listener(channel=MSG_PERFORM2, side=Side.CLIENT)
public void s_perform2()  {
    Vec3 vec = player.getLookVec().normalize();
    double vx = spd * vec.xCoord;
    double vy = spd * vec.yCoord;
    double vz = spd * vec.zCoord;
    player.addVelocity(vx, vy, vz); 
    terminate();
}
项目:ExtraAcC    文件:EntitySand.java   
public EntitySand(World world, EntityPlayer thrower, float _exp, Vec3 _dir) {
    super(world, thrower, thrower.posX, thrower.posY + thrower.eyeHeight, thrower.posZ, getSize(_exp), getSize(_exp), getAge(_exp));
    this.setGravity(0.01f);
    this.setDecrease(0.98F);
    this.exp = _exp;
    this.direc = _dir;
    this.setVelocity(_dir, getVelocity(_exp));
}
项目:minecraft-quiverbow    文件:Sabot_Rocket.java   
@Override
public boolean attackEntityFrom(DamageSource source, float par2) // Big rockets can be swatted out of the way with a bit of expertise
{
    if (this.isEntityInvulnerable()) { return false; }
    else    // Not invulnerable
    {
        this.setBeenAttacked();

        if (source.getEntity() != null)     // Damaged by a entity
        {
            Vec3 vec3 = source.getEntity().getLookVec();    // Which is looking that way...

            if (vec3 != null) 
            {
                this.motionX = vec3.xCoord;
                this.motionY = vec3.yCoord;
                this.motionZ = vec3.zCoord;
            }

            if (source.getEntity() instanceof EntityLivingBase) { this.shootingEntity = (EntityLivingBase)source.getEntity(); }

            return true;
        }
        // else, not damaged by an entity
    }

    return false;
}
项目:BaseClient    文件:EntityGhast.java   
public void updateTask()
{
    EntityLivingBase entitylivingbase = this.parentEntity.getAttackTarget();
    double d0 = 64.0D;

    if (entitylivingbase.getDistanceSqToEntity(this.parentEntity) < d0 * d0 && this.parentEntity.canEntityBeSeen(entitylivingbase))
    {
        World world = this.parentEntity.worldObj;
        ++this.attackTimer;

        if (this.attackTimer == 10)
        {
            world.playAuxSFXAtEntity((EntityPlayer)null, 1007, new BlockPos(this.parentEntity), 0);
        }

        if (this.attackTimer == 20)
        {
            double d1 = 4.0D;
            Vec3 vec3 = this.parentEntity.getLook(1.0F);
            double d2 = entitylivingbase.posX - (this.parentEntity.posX + vec3.xCoord * d1);
            double d3 = entitylivingbase.getEntityBoundingBox().minY + (double)(entitylivingbase.height / 2.0F) - (0.5D + this.parentEntity.posY + (double)(this.parentEntity.height / 2.0F));
            double d4 = entitylivingbase.posZ - (this.parentEntity.posZ + vec3.zCoord * d1);
            world.playAuxSFXAtEntity((EntityPlayer)null, 1008, new BlockPos(this.parentEntity), 0);
            EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.parentEntity, d2, d3, d4);
            entitylargefireball.explosionPower = this.parentEntity.getFireballStrength();
            entitylargefireball.posX = this.parentEntity.posX + vec3.xCoord * d1;
            entitylargefireball.posY = this.parentEntity.posY + (double)(this.parentEntity.height / 2.0F) + 0.5D;
            entitylargefireball.posZ = this.parentEntity.posZ + vec3.zCoord * d1;
            world.spawnEntityInWorld(entitylargefireball);
            this.attackTimer = -40;
        }
    }
    else if (this.attackTimer > 0)
    {
        --this.attackTimer;
    }

    this.parentEntity.setAttacking(this.attackTimer > 10);
}
项目:BaseClient    文件:VillageSiege.java   
private Vec3 func_179867_a(BlockPos p_179867_1_)
{
    for (int i = 0; i < 10; ++i)
    {
        BlockPos blockpos = p_179867_1_.add(this.worldObj.rand.nextInt(16) - 8, this.worldObj.rand.nextInt(6) - 3, this.worldObj.rand.nextInt(16) - 8);

        if (this.theVillage.func_179866_a(blockpos) && SpawnerAnimals.canCreatureTypeSpawnAtLocation(EntityLiving.SpawnPlacementType.ON_GROUND, this.worldObj, blockpos))
        {
            return new Vec3((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ());
        }
    }

    return null;
}
项目:DecompiledMinecraft    文件:World.java   
public MovingObjectPosition rayTraceBlocks(Vec3 start, Vec3 end, boolean stopOnLiquid)
{
    return this.rayTraceBlocks(start, end, stopOnLiquid, false, false);
}
项目:ExtraAcC    文件:EntityFlying.java   
public void setVelocity(Vec3 vDir, float v) {
    vDir.normalize();
    this.setVelocity(v * vDir.xCoord, v * vDir.yCoord, v * vDir.zCoord );
}