public virtual void OnUpdateNavigation()
        {
            TotalTicks++;

            if (NoPath())
            {
                return;
            }

            if (CanNavigate())
            {
                PathFollow();
            }

            if (NoPath())
            {
                return;
            }

            Vec3D vec3d = CurrentPath.GetCurrentNodeVec3d(TheEntity);

            if (vec3d == null)
            {
                return;
            }
            else
            {
                TheEntity.GetMoveHelper().SetMoveTo(vec3d.XCoord, vec3d.YCoord, vec3d.ZCoord, Speed);
                return;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called when the entity is attacked.
        /// </summary>
        public override bool AttackEntityFrom(DamageSource par1DamageSource, int par2)
        {
            SetBeenAttacked();

            if (par1DamageSource.GetEntity() != null)
            {
                Vec3D vec3d = par1DamageSource.GetEntity().GetLookVec();

                if (vec3d != null)
                {
                    MotionX       = (float)vec3d.XCoord;
                    MotionY       = (float)vec3d.YCoord;
                    MotionZ       = (float)vec3d.ZCoord;
                    AccelerationX = MotionX * 0.10000000000000001F;
                    AccelerationY = MotionY * 0.10000000000000001F;
                    AccelerationZ = MotionZ * 0.10000000000000001F;
                }

                if (par1DamageSource.GetEntity() is EntityLiving)
                {
                    ShootingEntity = (EntityLiving)par1DamageSource.GetEntity();
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        private bool Func_48575_c()
        {
            Vec3D vec3d = Func_48572_a(Field_48577_g, Field_48583_h, Field_48584_i);

            if (vec3d == null)
            {
                return(false);
            }

            EntityZombie entityzombie;

            try
            {
                entityzombie = new EntityZombie(Field_48582_a);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
                return(false);
            }

            entityzombie.SetLocationAndAngles((float)vec3d.XCoord, (float)vec3d.YCoord, (float)vec3d.ZCoord, Field_48582_a.Rand.NextFloat() * 360F, 0.0F);
            Field_48582_a.SpawnEntityInWorld(entityzombie);
            ChunkCoordinates chunkcoordinates = Field_48576_f.GetCenter();

            entityzombie.SetHomeArea(chunkcoordinates.PosX, chunkcoordinates.PosY, chunkcoordinates.PosZ, Field_48576_f.GetVillageRadius());
            return(true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Checks to see if this enderman should be attacking this player
        /// </summary>
        private bool ShouldAttackPlayer(EntityPlayer par1EntityPlayer)
        {
            ItemStack itemstack = par1EntityPlayer.Inventory.ArmorInventory[3];

            if (itemstack != null && itemstack.ItemID == Block.Pumpkin.BlockID)
            {
                return(false);
            }

            Vec3D  vec3d  = par1EntityPlayer.GetLook(1.0F).Normalize();
            Vec3D  vec3d1 = Vec3D.CreateVector(PosX - par1EntityPlayer.PosX, (BoundingBox.MinY + (double)(Height / 2.0F)) - (par1EntityPlayer.PosY + (double)par1EntityPlayer.GetEyeHeight()), PosZ - par1EntityPlayer.PosZ);
            double d      = vec3d1.LengthVector();

            vec3d1 = vec3d1.Normalize();
            double d1 = vec3d.DotProduct(vec3d1);

            if (d1 > 1.0D - 0.025000000000000001D / d)
            {
                return(par1EntityPlayer.CanEntityBeSeen(this));
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Returns whether the EntityAIBase should begin execution.
        /// </summary>
        public override bool ShouldExecute()
        {
            if (!TheWorld.IsDaytime())
            {
                return(false);
            }

            if (!TheCreature.IsBurning())
            {
                return(false);
            }

            if (!TheWorld.CanBlockSeeTheSky(MathHelper2.Floor_double(TheCreature.PosX), (int)TheCreature.BoundingBox.MinY, MathHelper2.Floor_double(TheCreature.PosZ)))
            {
                return(false);
            }

            Vec3D vec3d = FindPossibleShelter();

            if (vec3d == null)
            {
                return(false);
            }
            else
            {
                ShelterX = vec3d.XCoord;
                ShelterY = vec3d.YCoord;
                ShelterZ = vec3d.ZCoord;
                return(true);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Called periodically by VillageCollection
        /// </summary>
        public virtual void Tick(int par1)
        {
            TickCounter = par1;
            RemoveDeadAndOutOfRangeDoors();
            RemoveDeadAndOldAgressors();

            if (par1 % 20 == 0)
            {
                UpdateNumVillagers();
            }

            if (par1 % 30 == 0)
            {
                UpdateNumIronGolems();
            }

            int i = NumVillagers / 16;

            if (NumIronGolems < i && VillageDoorInfoList.Count > 20 && WorldObj.Rand.Next(7000) == 0)
            {
                Vec3D vec3d = TryGetIronGolemSpawningLocation(MathHelper2.Floor_float(Center.PosX), MathHelper2.Floor_float(Center.PosY), MathHelper2.Floor_float(Center.PosZ), 2, 4, 2);

                if (vec3d != null)
                {
                    EntityIronGolem entityirongolem = new EntityIronGolem(WorldObj);
                    entityirongolem.SetPosition((float)vec3d.XCoord, (float)vec3d.YCoord, (float)vec3d.ZCoord);
                    WorldObj.SpawnEntityInWorld(entityirongolem);
                    NumIronGolems++;
                }
            }
        }
        /// <summary>
        /// sets the active path data if path is 100% unique compared to old path, checks to adjust path for sun avoiding
        /// ents and stores end coords
        /// </summary>
        public virtual bool SetPath(PathEntity par1PathEntity, float par2)
        {
            if (par1PathEntity == null)
            {
                CurrentPath = null;
                return(false);
            }

            if (!par1PathEntity.Func_48647_a(CurrentPath))
            {
                CurrentPath = par1PathEntity;
            }

            if (NoSunPathfind)
            {
                RemoveSunnyPath();
            }

            if (CurrentPath.GetCurrentPathLength() == 0)
            {
                return(false);
            }
            else
            {
                Speed = par2;
                Vec3D vec3d = GetEntityPosition();
                TicksAtLastPos      = TotalTicks;
                LastPosCheck.XCoord = vec3d.XCoord;
                LastPosCheck.YCoord = vec3d.YCoord;
                LastPosCheck.ZCoord = vec3d.ZCoord;
                return(true);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// The square of the Euclidean distance between this and the specified vector.
        /// </summary>
        public virtual double SquareDistanceTo(Vec3D par1Vec3D)
        {
            double d  = par1Vec3D.XCoord - XCoord;
            double d1 = par1Vec3D.YCoord - YCoord;
            double d2 = par1Vec3D.ZCoord - ZCoord;

            return(d * d + d1 * d1 + d2 * d2);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Euclidean distance between this and the specified vector, returned as double.
        /// </summary>
        public virtual double DistanceTo(Vec3D par1Vec3D)
        {
            double d  = par1Vec3D.XCoord - XCoord;
            double d1 = par1Vec3D.YCoord - YCoord;
            double d2 = par1Vec3D.ZCoord - ZCoord;

            return((double)MathHelper2.Sqrt_double(d * d + d1 * d1 + d2 * d2));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Can add to the passed in vector for a movement vector to be applied to the entity. Args: x, y, z, entity, vec3d
        /// </summary>
        public override void VelocityToAddToEntity(World par1World, int par2, int par3, int par4, Entity par5Entity, Vec3D par6Vec3D)
        {
            Vec3D vec3d = GetFlowVector(par1World, par2, par3, par4);

            par6Vec3D.XCoord += vec3d.XCoord;
            par6Vec3D.YCoord += vec3d.YCoord;
            par6Vec3D.ZCoord += vec3d.ZCoord;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Returns whether the EntityAIBase should begin execution.
        /// </summary>
        public override bool ShouldExecute()
        {
            if (VillagerObj.GetGrowingAge() >= 0)
            {
                return(false);
            }

            if (VillagerObj.GetRNG().Next(400) != 0)
            {
                return(false);
            }

            List <Entity>        list     = VillagerObj.WorldObj.GetEntitiesWithinAABB(typeof(net.minecraft.src.EntityVillager), VillagerObj.BoundingBox.Expand(6, 3, 6));
            double               d        = double.MaxValue;
            IEnumerator <Entity> iterator = list.GetEnumerator();

            do
            {
                if (!iterator.MoveNext())
                {
                    break;
                }

                Entity entity = iterator.Current;

                if (entity != VillagerObj)
                {
                    EntityVillager entityvillager = (EntityVillager)entity;

                    if (!entityvillager.GetIsPlayingFlag() && entityvillager.GetGrowingAge() < 0)
                    {
                        double d1 = entityvillager.GetDistanceSqToEntity(VillagerObj);

                        if (d1 <= d)
                        {
                            d = d1;
                            TargetVillager = entityvillager;
                        }
                    }
                }
            }while (true);

            if (TargetVillager == null)
            {
                Vec3D vec3d = RandomPositionGenerator.Func_48622_a(VillagerObj, 16, 3);

                if (vec3d == null)
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Returns whether the EntityAIBase should begin execution.
        /// </summary>
        public override bool ShouldExecute()
        {
            if (TargetEntityClass == (typeof(net.minecraft.src.EntityPlayer)))
            {
                if ((TheEntity is EntityTameable) && ((EntityTameable)TheEntity).IsTamed())
                {
                    return(false);
                }

                Field_48240_d = TheEntity.WorldObj.GetClosestPlayerToEntity(TheEntity, Field_48241_e);

                if (Field_48240_d == null)
                {
                    return(false);
                }
            }
            else
            {
                List <Entity> list = TheEntity.WorldObj.GetEntitiesWithinAABB(TargetEntityClass, TheEntity.BoundingBox.Expand(Field_48241_e, 3, Field_48241_e));

                if (list.Count == 0)
                {
                    return(false);
                }

                Field_48240_d = list[0];
            }

            if (!TheEntity.Func_48090_aM().CanSee(Field_48240_d))
            {
                return(false);
            }

            Vec3D vec3d = RandomPositionGenerator.Func_48623_b(TheEntity, 16, 7, Vec3D.CreateVector(Field_48240_d.PosX, Field_48240_d.PosY, Field_48240_d.PosZ));

            if (vec3d == null)
            {
                return(false);
            }

            if (Field_48240_d.GetDistanceSq((float)vec3d.XCoord, (float)vec3d.YCoord, (float)vec3d.ZCoord) < Field_48240_d.GetDistanceSqToEntity(TheEntity))
            {
                return(false);
            }

            Field_48238_f = EntityPathNavigate.GetPathToXYZ(vec3d.XCoord, vec3d.YCoord, vec3d.ZCoord);

            if (Field_48238_f == null)
            {
                return(false);
            }

            return(Field_48238_f.Func_48639_a(vec3d));
        }
 /// <summary>
 /// Checks if the specified vector is within the XZ dimensions of the bounding box. Args: Vec3D
 /// </summary>
 private bool IsVecInXZ(Vec3D par1Vec3D)
 {
     if (par1Vec3D == null)
     {
         return(false);
     }
     else
     {
         return(par1Vec3D.XCoord >= MinX && par1Vec3D.XCoord <= MaxX && par1Vec3D.ZCoord >= MinZ && par1Vec3D.ZCoord <= MaxZ);
     }
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Returns a vector representing the projection along the given entity's view for the given distance
        /// </summary>
        public static Vec3D ProjectViewFromEntity(EntityLiving par0EntityLiving, double par1)
        {
            double d  = par0EntityLiving.PrevPosX + (par0EntityLiving.PosX - par0EntityLiving.PrevPosX) * par1;
            double d1 = par0EntityLiving.PrevPosY + (par0EntityLiving.PosY - par0EntityLiving.PrevPosY) * par1 + (double)par0EntityLiving.GetEyeHeight();
            double d2 = par0EntityLiving.PrevPosZ + (par0EntityLiving.PosZ - par0EntityLiving.PrevPosZ) * par1;
            double d3 = d + (double)(ObjectX * 1.0F);
            double d4 = d1 + (double)(ObjectY * 1.0F);
            double d5 = d2 + (double)(ObjectZ * 1.0F);

            return(Vec3D.CreateVector(d3, d4, d5));
        }
 /// <summary>
 /// Checks if the specified vector is within the XY dimensions of the bounding box. Args: Vec3D
 /// </summary>
 private bool IsVecInXY(Vec3D par1Vec3D)
 {
     if (par1Vec3D == null)
     {
         return(false);
     }
     else
     {
         return(par1Vec3D.XCoord >= MinX && par1Vec3D.XCoord <= MaxX && par1Vec3D.YCoord >= MinY && par1Vec3D.YCoord <= MaxY);
     }
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Teleport the enderman to another entity
        /// </summary>
        protected virtual bool TeleportToEntity(Entity par1Entity)
        {
            Vec3D vec3d = Vec3D.CreateVector(PosX - par1Entity.PosX, ((BoundingBox.MinY + (double)(Height / 2.0F)) - par1Entity.PosY) + (double)par1Entity.GetEyeHeight(), PosZ - par1Entity.PosZ);

            vec3d = vec3d.Normalize();
            float d  = 16;
            float d1 = (PosX + (Rand.NextFloat() - 0.5F) * 8) - (float)vec3d.XCoord * d;
            float d2 = (PosY + (Rand.Next(16) - 8)) - (float)vec3d.YCoord * d;
            float d3 = (PosZ + (Rand.NextFloat() - 0.5F) * 8) - (float)vec3d.ZCoord * d;

            return(TeleportTo(d1, d2, d3));
        }
 public PathNavigate(EntityLiving par1EntityLiving, World par2World, float par3)
 {
     NoSunPathfind            = false;
     LastPosCheck             = Vec3D.CreateVectorHelper(0.0F, 0.0F, 0.0F);
     CanPassOpenWoodenDoors   = true;
     CanPassClosedWoodenDoors = false;
     AvoidsWater     = false;
     CanSwim         = false;
     TheEntity       = par1EntityLiving;
     WorldObj        = par2World;
     PathSearchRange = par3;
 }
        /// <summary>
        /// Returns if the supplied Vec3D is completely inside the bounding box
        /// </summary>
        public bool IsVecInside(Vec3D par1Vec3D)
        {
            if (par1Vec3D.XCoord <= MinX || par1Vec3D.XCoord >= MaxX)
            {
                return(false);
            }

            if (par1Vec3D.YCoord <= MinY || par1Vec3D.YCoord >= MaxY)
            {
                return(false);
            }

            return(par1Vec3D.ZCoord > MinZ && par1Vec3D.ZCoord < MaxZ);
        }
        /// <summary>
        /// Returns whether the EntityAIBase should begin execution.
        /// </summary>
        public override bool ShouldExecute()
        {
            Func_48286_h();

            if (Field_48289_e && TheEntity.WorldObj.IsDaytime())
            {
                return(false);
            }

            Village village = TheEntity.WorldObj.VillageCollectionObj.FindNearestVillage(MathHelper2.Floor_double(TheEntity.PosX), MathHelper2.Floor_double(TheEntity.PosY), MathHelper2.Floor_double(TheEntity.PosZ), 0);

            if (village == null)
            {
                return(false);
            }

            DoorInfo = Func_48284_a(village);

            if (DoorInfo == null)
            {
                return(false);
            }

            bool flag = TheEntity.GetNavigator().Func_48665_b();

            TheEntity.GetNavigator().SetBreakDoors(false);
            Field_48291_c = TheEntity.GetNavigator().GetPathToXYZ(DoorInfo.PosX, DoorInfo.PosY, DoorInfo.PosZ);
            TheEntity.GetNavigator().SetBreakDoors(flag);

            if (Field_48291_c != null)
            {
                return(true);
            }

            Vec3D vec3d = RandomPositionGenerator.Func_48620_a(TheEntity, 10, 7, Vec3D.CreateVector(DoorInfo.PosX, DoorInfo.PosY, DoorInfo.PosZ));

            if (vec3d == null)
            {
                return(false);
            }
            else
            {
                TheEntity.GetNavigator().SetBreakDoors(false);
                Field_48291_c = TheEntity.GetNavigator().GetPathToXYZ(vec3d.XCoord, vec3d.YCoord, vec3d.ZCoord);
                TheEntity.GetNavigator().SetBreakDoors(flag);
                return(Field_48291_c != null);
            }
        }
Ejemplo n.º 20
0
        private Vec3D Func_48572_a(int par1, int par2, int par3)
        {
            for (int i = 0; i < 10; i++)
            {
                int j = (par1 + Field_48582_a.Rand.Next(16)) - 8;
                int k = (par2 + Field_48582_a.Rand.Next(6)) - 3;
                int l = (par3 + Field_48582_a.Rand.Next(16)) - 8;

                if (Field_48576_f.IsInRange(j, k, l) && SpawnerAnimals.CanCreatureTypeSpawnAtLocation(CreatureType.Monster, Field_48582_a, j, k, l))
                {
                    return(Vec3D.CreateVector(j, k, l));
                }
            }

            return(null);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Tries up to 10 times to get a valid spawning location before eventually failing and returning null.
        /// </summary>
        private Vec3D TryGetIronGolemSpawningLocation(int par1, int par2, int par3, int par4, int par5, int par6)
        {
            for (int i = 0; i < 10; i++)
            {
                int j = (par1 + WorldObj.Rand.Next(16)) - 8;
                int k = (par2 + WorldObj.Rand.Next(6)) - 3;
                int l = (par3 + WorldObj.Rand.Next(16)) - 8;

                if (IsInRange(j, k, l) && IsValidIronGolemSpawningLocation(j, k, l, par4, par5, par6))
                {
                    return(Vec3D.CreateVector(j, k, l));
                }
            }

            return(null);
        }
Ejemplo n.º 22
0
        private Vec3D FindPossibleShelter()
        {
            Random random = TheCreature.GetRNG();

            for (int i = 0; i < 10; i++)
            {
                int j = MathHelper2.Floor_double((TheCreature.PosX + (double)random.Next(20)) - 10D);
                int k = MathHelper2.Floor_double((TheCreature.BoundingBox.MinY + (double)random.Next(6)) - 3D);
                int l = MathHelper2.Floor_double((TheCreature.PosZ + (double)random.Next(20)) - 10D);

                if (!TheWorld.CanBlockSeeTheSky(j, k, l) && TheCreature.GetBlockPathWeight(j, k, l) < 0.0F)
                {
                    return(Vec3D.CreateVector(j, k, l));
                }
            }

            return(null);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Returns the block ID at the current camera location (either air or fluid), taking into account the height of
        /// fluid blocks
        /// </summary>
        public static int GetBlockIdAtEntityViewpoint(World par0World, EntityLiving par1EntityLiving, float par2)
        {
            Vec3D         vec3d         = ProjectViewFromEntity(par1EntityLiving, par2);
            ChunkPosition chunkposition = new ChunkPosition(vec3d);
            int           i             = par0World.GetBlockId(chunkposition.x, chunkposition.y, chunkposition.z);

            if (i != 0 && Block.BlocksList[i].BlockMaterial.IsLiquid())
            {
                float f  = BlockFluid.GetFluidHeightPercent(par0World.GetBlockMetadata(chunkposition.x, chunkposition.y, chunkposition.z)) - 0.1111111F;
                float f1 = (float)(chunkposition.y + 1) - f;

                if (vec3d.YCoord >= (double)f1)
                {
                    i = par0World.GetBlockId(chunkposition.x, chunkposition.y + 1, chunkposition.z);
                }
            }

            return(i);
        }
Ejemplo n.º 24
0
        protected virtual MovingObjectPosition GetMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, bool par3)
        {
            float  f      = 1.0F;
            float  f1     = par2EntityPlayer.PrevRotationPitch + (par2EntityPlayer.RotationPitch - par2EntityPlayer.PrevRotationPitch) * f;
            float  f2     = par2EntityPlayer.PrevRotationYaw + (par2EntityPlayer.RotationYaw - par2EntityPlayer.PrevRotationYaw) * f;
            double d      = par2EntityPlayer.PrevPosX + (par2EntityPlayer.PosX - par2EntityPlayer.PrevPosX) * (double)f;
            double d1     = (par2EntityPlayer.PrevPosY + (par2EntityPlayer.PosY - par2EntityPlayer.PrevPosY) * (double)f + 1.6200000000000001D) - (double)par2EntityPlayer.YOffset;
            double d2     = par2EntityPlayer.PrevPosZ + (par2EntityPlayer.PosZ - par2EntityPlayer.PrevPosZ) * (double)f;
            Vec3D  vec3d  = Vec3D.CreateVector(d, d1, d2);
            float  f3     = MathHelper2.Cos(-f2 * 0.01745329F - (float)Math.PI);
            float  f4     = MathHelper2.Sin(-f2 * 0.01745329F - (float)Math.PI);
            float  f5     = -MathHelper2.Cos(-f1 * 0.01745329F);
            float  f6     = MathHelper2.Sin(-f1 * 0.01745329F);
            float  f7     = f4 * f5;
            float  f8     = f6;
            float  f9     = f3 * f5;
            double d3     = 5D;
            Vec3D  vec3d1 = vec3d.AddVector((double)f7 * d3, (double)f8 * d3, (double)f9 * d3);
            MovingObjectPosition movingobjectposition = par1World.RayTraceBlocks_do_do(vec3d, vec3d1, par3, !par3);

            return(movingobjectposition);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Returns a new vector with z value equal to the second parameter, along the line between this vector and the
        /// passed in vector, or null if not possible.
        /// </summary>
        public virtual Vec3D GetIntermediateWithZValue(Vec3D par1Vec3D, double par2)
        {
            double d  = par1Vec3D.XCoord - XCoord;
            double d1 = par1Vec3D.YCoord - YCoord;
            double d2 = par1Vec3D.ZCoord - ZCoord;

            //JAVA TO C# CONVERTER TODO TASK: Octal literals cannot be represented in C#:
            if (d2 * d2 < 1.0000000116860974E-007D)
            {
                return(null);
            }

            double d3 = (par2 - ZCoord) / d2;

            if (d3 < 0.0F || d3 > 1.0D)
            {
                return(null);
            }
            else
            {
                return(CreateVector(XCoord + d * d3, YCoord + d1 * d3, ZCoord + d2 * d3));
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Return Vec3D with biome specific fog color
        /// </summary>
        public virtual Vec3D GetFogColor(float par1, float par2)
        {
            float f = MathHelper2.Cos(par1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F;

            if (f < 0.0F)
            {
                f = 0.0F;
            }

            if (f > 1.0F)
            {
                f = 1.0F;
            }

            float f1 = 0.7529412F;
            float f2 = 0.8470588F;
            float f3 = 1.0F;

            f1 *= f * 0.94F + 0.06F;
            f2 *= f * 0.94F + 0.06F;
            f3 *= f * 0.91F + 0.09F;
            return(Vec3D.CreateVector(f1, f2, f3));
        }
Ejemplo n.º 27
0
        public static double Func_293_a(IBlockAccess par0IBlockAccess, int par1, int par2, int par3, Material par4Material)
        {
            Vec3D vec3d = null;

            if (par4Material == Material.Water)
            {
                vec3d = ((BlockFluid)Block.WaterMoving).GetFlowVector(par0IBlockAccess, par1, par2, par3);
            }

            if (par4Material == Material.Lava)
            {
                vec3d = ((BlockFluid)Block.LavaMoving).GetFlowVector(par0IBlockAccess, par1, par2, par3);
            }

            if (vec3d.XCoord == 0.0F && vec3d.ZCoord == 0.0F)
            {
                return(-1000D);
            }
            else
            {
                return(Math.Atan2(vec3d.ZCoord, vec3d.XCoord) - (Math.PI / 2D));
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Updates the task
        /// </summary>
        public override void UpdateTask()
        {
            Field_48356_d--;

            if (TargetVillager != null)
            {
                if (VillagerObj.GetDistanceSqToEntity(TargetVillager) > 4D)
                {
                    VillagerObj.GetNavigator().Func_48667_a(TargetVillager, Field_48358_c);
                }
            }
            else if (VillagerObj.GetNavigator().NoPath())
            {
                Vec3D vec3d = RandomPositionGenerator.Func_48622_a(VillagerObj, 16, 3);

                if (vec3d == null)
                {
                    return;
                }

                VillagerObj.GetNavigator().Func_48666_a(vec3d.XCoord, vec3d.YCoord, vec3d.ZCoord, Field_48358_c);
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Sets the OpenGL lighting properties to the values used when rendering blocks as items
        /// </summary>
        public static void EnableStandardItemLighting()
        {        /*
                  *     //GL.Enable(EnableCap.Lighting);
                  *     //GL.Enable(EnableCap.Light0);
                  *     //GL.Enable(EnableCap.Light1);
                  *     //GL.Enable(EnableCap.ColorMaterial);
                  *     //GL.ColorMaterial(MaterialFace.FrontAndBack, ColorMaterialParameter.AmbientAndDiffuse);*/
            float f     = 0.4F;
            float f1    = 0.6F;
            float f2    = 0.0F;
            Vec3D vec3d = Vec3D.CreateVector(0.20000000298023224D, 1.0D, -0.69999998807907104D).Normalize();      /*
                                                                                                                   * //GL.Light(LightName.Light0, LightParameter.Position, GetColor(vec3d.XCoord, vec3d.YCoord, vec3d.ZCoord, 0.0F));
                                                                                                                   * //GL.Light(LightName.Light0, LightParameter.Diffuse, GetColor(f1, f1, f1, 1.0F));
                                                                                                                   * //GL.Light(LightName.Light0, LightParameter.Ambient, GetColor(0.0F, 0.0F, 0.0F, 1.0F));
                                                                                                                   * //GL.Light(LightName.Light0, LightParameter.Specular, GetColor(f2, f2, f2, 1.0F));*/

            vec3d = Vec3D.CreateVector(-0.20000000298023224D, 1.0D, 0.69999998807907104D).Normalize();            /*
                                                                                                                   * //GL.Light(LightName.Light1, LightParameter.Position, GetColor(vec3d.XCoord, vec3d.YCoord, vec3d.ZCoord, 0.0F));
                                                                                                                   * //GL.Light(LightName.Light1, LightParameter.Diffuse, GetColor(f1, f1, f1, 1.0F));
                                                                                                                   * //GL.Light(LightName.Light1, LightParameter.Ambient, GetColor(0.0F, 0.0F, 0.0F, 1.0F));
                                                                                                                   * //GL.Light(LightName.Light1, LightParameter.Specular, GetColor(f2, f2, f2, 1.0F));
                                                                                                                   * //GL.ShadeModel(ShadingModel.Flat);
                                                                                                                   * //GL.LightModel(LightModelParameter.LightModelAmbient, GetColor(f, f, f, 1.0F));*/
        }
        /// <summary>
        /// Return Vec3D with biome specific fog color
        /// </summary>
        public override Vec3D GetFogColor(float par1, float par2)
        {
            int   i = 0x8080a0;
            float f = MathHelper2.Cos(par1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F;

            if (f < 0.0F)
            {
                f = 0.0F;
            }

            if (f > 1.0F)
            {
                f = 1.0F;
            }

            float f1 = (float)(i >> 16 & 0xff) / 255F;
            float f2 = (float)(i >> 8 & 0xff) / 255F;
            float f3 = (float)(i & 0xff) / 255F;

            f1 *= f * 0.0F + 0.15F;
            f2 *= f * 0.0F + 0.15F;
            f3 *= f * 0.0F + 0.15F;
            return(Vec3D.CreateVector(f1, f2, f3));
        }