Ejemplo n.º 1
0
        /// <summary>
        /// Sets the models various rotation angles.
        /// </summary>
        public override void SetRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6)
        {
            float f = par3 * (float)Math.PI * -0.1F;

            for (int i = 0; i < 4; i++)
            {
                Field_40323_a[i].RotationPointY = -2F + MathHelper2.Cos(((float)(i * 2) + par3) * 0.25F);
                Field_40323_a[i].RotationPointX = MathHelper2.Cos(f) * 9F;
                Field_40323_a[i].RotationPointZ = MathHelper2.Sin(f) * 9F;
                f += ((float)Math.PI / 2F);
            }

            f = ((float)Math.PI / 4F) + par3 * (float)Math.PI * 0.03F;

            for (int j = 4; j < 8; j++)
            {
                Field_40323_a[j].RotationPointY = 2.0F + MathHelper2.Cos(((float)(j * 2) + par3) * 0.25F);
                Field_40323_a[j].RotationPointX = MathHelper2.Cos(f) * 7F;
                Field_40323_a[j].RotationPointZ = MathHelper2.Sin(f) * 7F;
                f += ((float)Math.PI / 2F);
            }

            f = 0.4712389F + par3 * (float)Math.PI * -0.05F;

            for (int k = 8; k < 12; k++)
            {
                Field_40323_a[k].RotationPointY = 11F + MathHelper2.Cos(((float)k * 1.5F + par3) * 0.5F);
                Field_40323_a[k].RotationPointX = MathHelper2.Cos(f) * 5F;
                Field_40323_a[k].RotationPointZ = MathHelper2.Sin(f) * 5F;
                f += ((float)Math.PI / 2F);
            }

            Field_40322_b.RotateAngleY = par4 / (180F / (float)Math.PI);
            Field_40322_b.RotateAngleX = par5 / (180F / (float)Math.PI);
        }
        /// <summary>
        /// Called when the block is placed in the world.
        /// </summary>
        public override void OnBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving)
        {
            int i = MathHelper2.Floor_double((double)((par5EntityLiving.RotationYaw * 4F) / 360F) + 0.5D) & 3;
            int j = par1World.GetBlockMetadata(par2, par3, par4) & 4;

            if (i == 0)
            {
                par1World.SetBlockMetadataWithNotify(par2, par3, par4, 2 | j);
            }

            if (i == 1)
            {
                par1World.SetBlockMetadataWithNotify(par2, par3, par4, 1 | j);
            }

            if (i == 2)
            {
                par1World.SetBlockMetadataWithNotify(par2, par3, par4, 3 | j);
            }

            if (i == 3)
            {
                par1World.SetBlockMetadataWithNotify(par2, par3, par4, 0 | j);
            }
        }
Ejemplo n.º 3
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.º 4
0
        public virtual double[] GenerateNoiseOctaves(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7, double par8, double par10, double par12)
        {
            if (par1ArrayOfDouble == null)
            {
                par1ArrayOfDouble = new double[par5 * par6 * par7];
            }
            else
            {
                for (int i = 0; i < par1ArrayOfDouble.Length; i++)
                {
                    par1ArrayOfDouble[i] = 0.0F;
                }
            }

            double d = 1.0D;

            for (int j = 0; j < Octaves; j++)
            {
                double d1 = (double)par2 * d * par8;
                double d2 = (double)par3 * d * par10;
                double d3 = (double)par4 * d * par12;
                long   l  = MathHelper2.Floor_double_long(d1);
                long   l1 = MathHelper2.Floor_double_long(d3);
                d1 -= l;
                d3 -= l1;
                l  %= 0x1000000L;
                l1 %= 0x1000000L;
                d1 += l;
                d3 += l1;
                GeneratorCollection[j].Func_805_a(par1ArrayOfDouble, d1, d2, d3, par5, par6, par7, par8 * d, par10 * d, par12 * d, d);
                d /= 2D;
            }

            return(par1ArrayOfDouble);
        }
        public virtual void DoRenderArrow(EntityArrow par1EntityArrow, double par2, double par4, double par6, float par8, float par9)
        {
            LoadTexture("/item/arrows.png");
            //GL.PushMatrix();
            //GL.Translate((float)par2, (float)par4, (float)par6);
            //GL.Rotate((par1EntityArrow.PrevRotationYaw + (par1EntityArrow.RotationYaw - par1EntityArrow.PrevRotationYaw) * par9) - 90F, 0.0F, 1.0F, 0.0F);
            //GL.Rotate(par1EntityArrow.PrevRotationPitch + (par1EntityArrow.RotationPitch - par1EntityArrow.PrevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
            Tessellator tessellator = Tessellator.Instance;
            int         i           = 0;
            float       f           = 0.0F;
            float       f1          = 0.5F;
            float       f2          = (float)(0 + i * 10) / 32F;
            float       f3          = (float)(5 + i * 10) / 32F;
            float       f4          = 0.0F;
            float       f5          = 0.15625F;
            float       f6          = (float)(5 + i * 10) / 32F;
            float       f7          = (float)(10 + i * 10) / 32F;
            float       f8          = 0.05625F;
            //GL.Enable(EnableCap.RescaleNormal);
            float f9 = (float)par1EntityArrow.ArrowShake - par9;

            if (f9 > 0.0F)
            {
                float f10 = -MathHelper2.Sin(f9 * 3F) * f9;
                //GL.Rotate(f10, 0.0F, 0.0F, 1.0F);
            }

            //GL.Rotate(45F, 1.0F, 0.0F, 0.0F);
            //GL.Scale(f8, f8, f8);
            //GL.Translate(-4F, 0.0F, 0.0F);
            //GL.Normal3(f8, 0.0F, 0.0F);
            tessellator.StartDrawingQuads();
            tessellator.AddVertexWithUV(-7D, -2D, -2D, f4, f6);
            tessellator.AddVertexWithUV(-7D, -2D, 2D, f5, f6);
            tessellator.AddVertexWithUV(-7D, 2D, 2D, f5, f7);
            tessellator.AddVertexWithUV(-7D, 2D, -2D, f4, f7);
            tessellator.Draw();
            //GL.Normal3(-f8, 0.0F, 0.0F);
            tessellator.StartDrawingQuads();
            tessellator.AddVertexWithUV(-7D, 2D, -2D, f4, f6);
            tessellator.AddVertexWithUV(-7D, 2D, 2D, f5, f6);
            tessellator.AddVertexWithUV(-7D, -2D, 2D, f5, f7);
            tessellator.AddVertexWithUV(-7D, -2D, -2D, f4, f7);
            tessellator.Draw();

            for (int j = 0; j < 4; j++)
            {
                //GL.Rotate(90F, 1.0F, 0.0F, 0.0F);
                //GL.Normal3(0.0F, 0.0F, f8);
                tessellator.StartDrawingQuads();
                tessellator.AddVertexWithUV(-8D, -2D, 0.0F, f, f2);
                tessellator.AddVertexWithUV(8D, -2D, 0.0F, f1, f2);
                tessellator.AddVertexWithUV(8D, 2D, 0.0F, f1, f3);
                tessellator.AddVertexWithUV(-8D, 2D, 0.0F, f, f3);
                tessellator.Draw();
            }

            //GL.Disable(EnableCap.RescaleNormal);
            //GL.PopMatrix();
        }
        public override void RenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
        {
            float f = ((float)Age + par2) / (float)MaxAge;

            f *= f;
            double d  = EntityToPickUp.PosX;
            double d1 = EntityToPickUp.PosY;
            double d2 = EntityToPickUp.PosZ;
            double d3 = EntityPickingUp.LastTickPosX + (EntityPickingUp.PosX - EntityPickingUp.LastTickPosX) * (double)par2;
            double d4 = EntityPickingUp.LastTickPosY + (EntityPickingUp.PosY - EntityPickingUp.LastTickPosY) * (double)par2 + (double)YOffs;
            double d5 = EntityPickingUp.LastTickPosZ + (EntityPickingUp.PosZ - EntityPickingUp.LastTickPosZ) * (double)par2;
            double d6 = d + (d3 - d) * (double)f;
            double d7 = d1 + (d4 - d1) * (double)f;
            double d8 = d2 + (d5 - d2) * (double)f;
            int    i  = MathHelper2.Floor_double(d6);
            int    j  = MathHelper2.Floor_double(d7 + (double)(YOffset / 2.0F));
            int    k  = MathHelper2.Floor_double(d8);
            int    l  = GetBrightnessForRender(par2);
            int    i1 = l % 0x10000;
            int    j1 = l / 0x10000;

            OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)i1 / 1.0F, (float)j1 / 1.0F);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            d6 -= InterpPosX;
            d7 -= InterpPosY;
            d8 -= InterpPosZ;
            RenderManager.Instance.RenderEntityWithPosYaw(EntityToPickUp, (float)d6, (float)d7, (float)d8, EntityToPickUp.RotationYaw, par2);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Sets the listener of sounds
        /// </summary>
        public void SetListener(EntityLiving par1EntityLiving, float par2)
        {
            if (!Loaded || Options.SoundVolume == 0.0F)
            {
                return;
            }

            if (par1EntityLiving == null)
            {
                return;
            }
            else
            {
                float  f  = par1EntityLiving.PrevRotationYaw + (par1EntityLiving.RotationYaw - par1EntityLiving.PrevRotationYaw) * par2;
                double d  = par1EntityLiving.PrevPosX + (par1EntityLiving.PosX - par1EntityLiving.PrevPosX) * (double)par2;
                double d1 = par1EntityLiving.PrevPosY + (par1EntityLiving.PosY - par1EntityLiving.PrevPosY) * (double)par2;
                double d2 = par1EntityLiving.PrevPosZ + (par1EntityLiving.PosZ - par1EntityLiving.PrevPosZ) * (double)par2;
                float  f1 = MathHelper2.Cos(-f * 0.01745329F - (float)Math.PI);
                float  f2 = MathHelper2.Sin(-f * 0.01745329F - (float)Math.PI);
                float  f3 = -f2;
                float  f4 = 0.0F;
                float  f5 = -f1;
                float  f6 = 0.0F;
                float  f7 = 1.0F;
                float  f8 = 0.0F;               /*
                                                 * SndSystem.setListenerPosition((float)d, (float)d1, (float)d2);
                                                 * SndSystem.setListenerOrientation(f3, f4, f5, f6, f7, f8);*/
                return;
            }
        }
        /// <summary>
        /// Returns whether the EntityAIBase should begin execution.
        /// </summary>
        public override bool ShouldExecute()
        {
            if (VillagerObj.GetGrowingAge() != 0)
            {
                return(false);
            }

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

            VillageObj = WorldObj.VillageCollectionObj.FindNearestVillage(MathHelper2.Floor_double(VillagerObj.PosX), MathHelper2.Floor_double(VillagerObj.PosY), MathHelper2.Floor_double(VillagerObj.PosZ), 0);

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

            if (!CheckSufficientDoorsPresentForNewVillager())
            {
                return(false);
            }

            Entity entity = WorldObj.FindNearestEntityWithinAABB(typeof(net.minecraft.src.EntityVillager), VillagerObj.BoundingBox.Expand(8, 3, 8), VillagerObj);

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

            Mate = (EntityVillager)entity;
            return(Mate.GetGrowingAge() == 0);
        }
        /// <summary>
        /// Sets the models various rotation angles.
        /// </summary>
        public override void SetRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6)
        {
            Field_48220_g.RotateAngleX = par5 / (180F / (float)Math.PI);
            Field_48220_g.RotateAngleY = par4 / (180F / (float)Math.PI);

            if (Field_48227_o != 3)
            {
                Field_48226_n.RotateAngleX = ((float)Math.PI / 2F);

                if (Field_48227_o == 2)
                {
                    Field_48225_a.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F) * 1.0F * par2;
                    Field_48223_b.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + 0.3F) * 1.0F * par2;
                    Field_48224_c.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + (float)Math.PI + 0.3F) * 1.0F * par2;
                    Field_48221_d.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + (float)Math.PI) * 1.0F * par2;
                    Field_48219_f.RotateAngleX = 1.727876F + ((float)Math.PI / 10F) * MathHelper2.Cos(par1) * par2;
                }
                else
                {
                    Field_48225_a.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F) * 1.0F * par2;
                    Field_48223_b.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + (float)Math.PI) * 1.0F * par2;
                    Field_48224_c.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + (float)Math.PI) * 1.0F * par2;
                    Field_48221_d.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F) * 1.0F * par2;

                    if (Field_48227_o == 1)
                    {
                        Field_48219_f.RotateAngleX = 1.727876F + ((float)Math.PI / 4F) * MathHelper2.Cos(par1) * par2;
                    }
                    else
                    {
                        Field_48219_f.RotateAngleX = 1.727876F + 0.4712389F * MathHelper2.Cos(par1) * par2;
                    }
                }
            }
        }
        /// <summary>
        /// Called to update the entity's position/logic.
        /// </summary>
        public override void OnUpdate()
        {
            Field_22062_y = 0.0F;
            base.OnUpdate();
            Field_705_Q = Field_704_R;
            double d  = PosX - PrevPosX;
            double d1 = PosZ - PrevPosZ;
            float  f  = MathHelper2.Sqrt_double(d * d + d1 * d1) * 4F;

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

            Field_704_R += (f - Field_704_R) * 0.4F;
            Field_703_S += Field_704_R;

            if (!IsItemInUse && IsEating() && Inventory.MainInventory[Inventory.CurrentItem] != null)
            {
                ItemStack itemstack = Inventory.MainInventory[Inventory.CurrentItem];
                SetItemInUse(Inventory.MainInventory[Inventory.CurrentItem], Item.ItemsList[itemstack.ItemID].GetMaxItemUseDuration(itemstack));
                IsItemInUse = true;
            }
            else if (IsItemInUse && !IsEating())
            {
                ClearItemInUse();
                IsItemInUse = false;
            }
        }
        /// <summary>
        /// Provides the basic foliage color based on the biome temperature and rainfall
        /// </summary>
        public virtual int GetBiomeFoliageColor()
        {
            double d  = MathHelper2.Clamp_float(GetFloatTemperature(), 0.0F, 1.0F);
            double d1 = MathHelper2.Clamp_float(GetFloatRainfall(), 0.0F, 1.0F);

            return(ColorizerFoliage.GetFoliageColor(d, d1));
        }
Ejemplo n.º 12
0
        public EntityFishHook(World par1World, EntityPlayer par2EntityPlayer) : base(par1World)
        {
            XTile              = -1;
            YTile              = -1;
            ZTile              = -1;
            InTile             = 0;
            InGround           = false;
            Shake              = 0;
            TicksInAir         = 0;
            TicksCatchable     = 0;
            Bobber             = null;
            IgnoreFrustumCheck = true;
            Angler             = par2EntityPlayer;
            Angler.FishEntity  = this;
            SetSize(0.25F, 0.25F);
            SetLocationAndAngles(par2EntityPlayer.PosX, (par2EntityPlayer.PosY + 1.6200000000000001F) - par2EntityPlayer.YOffset, par2EntityPlayer.PosZ, par2EntityPlayer.RotationYaw, par2EntityPlayer.RotationPitch);
            PosX -= MathHelper2.Cos((RotationYaw / 180F) * (float)Math.PI) * 0.16F;
            PosY -= 0.10000000149011612F;
            PosZ -= MathHelper2.Sin((RotationYaw / 180F) * (float)Math.PI) * 0.16F;
            SetPosition(PosX, PosY, PosZ);
            YOffset = 0.0F;
            float f = 0.4F;

            MotionX = -MathHelper2.Sin((RotationYaw / 180F) * (float)Math.PI) * MathHelper2.Cos((RotationPitch / 180F) * (float)Math.PI) * f;
            MotionZ = MathHelper2.Cos((RotationYaw / 180F) * (float)Math.PI) * MathHelper2.Cos((RotationPitch / 180F) * (float)Math.PI) * f;
            MotionY = -MathHelper2.Sin((RotationPitch / 180F) * (float)Math.PI) * f;
            CalculateVelocity(MotionX, MotionY, MotionZ, 1.5F, 1.0F);
        }
        /// <summary>
        /// Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack.
        /// </summary>
        protected override void AttackEntity(Entity par1Entity, float par2)
        {
            float f = GetBrightness(1.0F);

            if (f > 0.5F && Rand.Next(100) == 0)
            {
                EntityToAttack = null;
                return;
            }

            if (par2 > 2.0F && par2 < 6F && Rand.Next(10) == 0)
            {
                if (OnGround)
                {
                    float d  = par1Entity.PosX - PosX;
                    float d1 = par1Entity.PosZ - PosZ;
                    float f1 = MathHelper2.Sqrt_double(d * d + d1 * d1);
                    MotionX = (d / f1) * 0.5F * 0.80000001192092896F + MotionX * 0.20000000298023224F;
                    MotionZ = (d1 / f1) * 0.5F * 0.80000001192092896F + MotionZ * 0.20000000298023224F;
                    MotionY = 0.40000000596046448F;
                }
            }
            else
            {
                base.AttackEntity(par1Entity, par2);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Time remaining during which the Animal is sped up and flees.
        /// </summary>
        protected virtual void UpdateWanderPath()
        {
            Profiler.StartSection("stroll");
            bool  flag = false;
            int   i    = -1;
            int   j    = -1;
            int   k    = -1;
            float f    = -99999F;

            for (int l = 0; l < 10; l++)
            {
                int   i1 = MathHelper2.Floor_double((PosX + (double)Rand.Next(13)) - 6D);
                int   j1 = MathHelper2.Floor_double((PosY + (double)Rand.Next(7)) - 3D);
                int   k1 = MathHelper2.Floor_double((PosZ + (double)Rand.Next(13)) - 6D);
                float f1 = GetBlockPathWeight(i1, j1, k1);

                if (f1 > f)
                {
                    f    = f1;
                    i    = i1;
                    j    = j1;
                    k    = k1;
                    flag = true;
                }
            }

            if (flag)
            {
                PathToEntity = WorldObj.GetEntityPathToXYZ(this, i, j, k, 10F, true, false, false, true);
            }

            Profiler.EndSection();
        }
Ejemplo n.º 15
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>
        /// Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
        /// use this to react to sunlight and start to burn.
        /// </summary>
        public override void OnLivingUpdate()
        {
            base.OnLivingUpdate();

            if (Field_48120_c > 0)
            {
                Field_48120_c--;
            }

            if (Field_48118_d > 0)
            {
                Field_48118_d--;
            }

            //JAVA TO C# CONVERTER TODO TASK: Octal literals cannot be represented in C#:
            if (MotionX * MotionX + MotionZ * MotionZ > 2.5000002779052011E-007D && Rand.Next(5) == 0)
            {
                int i = MathHelper2.Floor_double(PosX);
                int j = MathHelper2.Floor_double(PosY - 0.20000000298023224D - (double)YOffset);
                int k = MathHelper2.Floor_double(PosZ);
                int l = WorldObj.GetBlockId(i, j, k);

                if (l > 0)
                {
                    WorldObj.SpawnParticle((new StringBuilder()).Append("tilecrack_").Append(l).ToString(), PosX + ((double)Rand.NextFloat() - 0.5D) * (double)Width, BoundingBox.MinY + 0.10000000000000001D, PosZ + ((double)Rand.NextFloat() - 0.5D) * (double)Width, 4D * ((double)Rand.NextFloat() - 0.5D), 0.5D, ((double)Rand.NextFloat() - 0.5D) * 4D);
                }
            }
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Sets the models various rotation angles.
 /// </summary>
 public override void SetRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6)
 {
     for (int i = 0; i < Tentacles.Length; i++)
     {
         Tentacles[i].RotateAngleX = 0.2F * MathHelper2.Sin(par3 * 0.3F + (float)i) + 0.4F;
     }
 }
Ejemplo n.º 18
0
        public override void RenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
        {
            float f = ((float)Field_27018_a + par2) / (float)Field_27020_o;

            f *= f;
            float f1 = 2.0F - f * 2.0F;

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

            f1 *= 0.2F;
            //GL.Disable(EnableCap.Lighting);
            float f2 = 0.125F;
            float f3 = (float)(PosX - InterpPosX);
            float f4 = (float)(PosY - InterpPosY);
            float f5 = (float)(PosZ - InterpPosZ);
            float f6 = WorldObj.GetLightBrightness(MathHelper2.Floor_double(PosX), MathHelper2.Floor_double(PosY), MathHelper2.Floor_double(PosZ));

            //CurrentFootSteps.BindTexture(CurrentFootSteps.GetTexture("/misc/footprint.png"));
            CurrentFootSteps.BindTexture("misc.footprint.png");
            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            par1Tessellator.StartDrawingQuads();
            par1Tessellator.SetColorRGBA_F(f6, f6, f6, f1);
            par1Tessellator.AddVertexWithUV(f3 - f2, f4, f5 + f2, 0.0F, 1.0D);
            par1Tessellator.AddVertexWithUV(f3 + f2, f4, f5 + f2, 1.0D, 1.0D);
            par1Tessellator.AddVertexWithUV(f3 + f2, f4, f5 - f2, 1.0D, 0.0F);
            par1Tessellator.AddVertexWithUV(f3 - f2, f4, f5 - f2, 0.0F, 0.0F);
            par1Tessellator.Draw();
            //GL.Disable(EnableCap.Blend);
            //GL.Enable(EnableCap.Lighting);
        }
        private VillageDoorInfo Func_48284_a(Village par1Village)
        {
            VillageDoorInfo               villagedoorinfo = null;
            int                           i        = 0x7fffffff;
            List <VillageDoorInfo>        list     = par1Village.GetVillageDoorInfoList();
            IEnumerator <VillageDoorInfo> iterator = list.GetEnumerator();

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

                VillageDoorInfo villagedoorinfo1 = iterator.Current;
                int             j = villagedoorinfo1.GetDistanceSquared(MathHelper2.Floor_double(TheEntity.PosX), MathHelper2.Floor_double(TheEntity.PosY), MathHelper2.Floor_double(TheEntity.PosZ));

                if (j < i && !Func_48285_a(villagedoorinfo1))
                {
                    villagedoorinfo = villagedoorinfo1;
                    i = j;
                }
            }while (true);

            return(villagedoorinfo);
        }
        private void Func_160_a(EntityPainting par1EntityPainting, float par2, float par3)
        {
            int i = MathHelper2.Floor_double(par1EntityPainting.PosX);
            int j = MathHelper2.Floor_double(par1EntityPainting.PosY + (double)(par3 / 16F));
            int k = MathHelper2.Floor_double(par1EntityPainting.PosZ);

            if (par1EntityPainting.Direction == 0)
            {
                i = MathHelper2.Floor_double(par1EntityPainting.PosX + (double)(par2 / 16F));
            }

            if (par1EntityPainting.Direction == 1)
            {
                k = MathHelper2.Floor_double(par1EntityPainting.PosZ - (double)(par2 / 16F));
            }

            if (par1EntityPainting.Direction == 2)
            {
                i = MathHelper2.Floor_double(par1EntityPainting.PosX - (double)(par2 / 16F));
            }

            if (par1EntityPainting.Direction == 3)
            {
                k = MathHelper2.Floor_double(par1EntityPainting.PosZ + (double)(par2 / 16F));
            }

            int l  = RenderManager.WorldObj.GetLightBrightnessForSkyBlocks(i, j, k, 0);
            int i1 = l % 0x10000;
            int j1 = l / 0x10000;

            OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, i1, j1);
            //GL.Color3(1.0F, 1.0F, 1.0F);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode
        /// </summary>
        public static void UpdateRenderInfo(EntityPlayer par0EntityPlayer, bool par1)
        {
            //GL.GetFloat(GetPName.ModelviewMatrix, out Modelview);
            //GL.GetFloat(GetPName.ProjectionMatrix, out Projection);
            int[] viewints = new int[4];
            //GL.GetInteger(GetPName.Viewport, viewints);
            Viewport = new Rectangle(viewints[0], viewints[1], viewints[2], viewints[3]);
            float f  = (Viewport.X + Viewport.Width) / 2;
            float f1 = (Viewport.Y + Viewport.Height) / 2;

            //OpenGlHelper.UnProject(f, f1, 0.0F, Modelview, Projection, Viewport.Size, ObjectCoords);
            ObjectX = ObjectCoords.X;
            ObjectY = ObjectCoords.Y;
            ObjectZ = ObjectCoords.Z;
            int   i  = par1 ? 1 : 0;
            float f2 = par0EntityPlayer.RotationPitch;
            float f3 = par0EntityPlayer.RotationYaw;

            RotationX  = MathHelper2.Cos((f3 * (float)Math.PI) / 180F) * (float)(1 - i * 2);
            RotationZ  = MathHelper2.Sin((f3 * (float)Math.PI) / 180F) * (float)(1 - i * 2);
            RotationYZ = -RotationZ *MathHelper2.Sin((f2 * (float)Math.PI) / 180F) * (float)(1 - i * 2);

            RotationXY = RotationX * MathHelper2.Sin((f2 * (float)Math.PI) / 180F) * (float)(1 - i * 2);
            RotationXZ = MathHelper2.Cos((f2 * (float)Math.PI) / 180F);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Checks if the entity's current position is a valid location to spawn this entity.
        /// </summary>
        public override bool GetCanSpawnHere()
        {
            if (WorldObj.Rand.Next(3) == 0)
            {
                return(false);
            }

            if (WorldObj.CheckIfAABBIsClear(BoundingBox) && WorldObj.GetCollidingBoundingBoxes(this, BoundingBox).Count == 0 && !WorldObj.IsAnyLiquid(BoundingBox))
            {
                int i = MathHelper2.Floor_double(PosX);
                int j = MathHelper2.Floor_double(BoundingBox.MinY);
                int k = MathHelper2.Floor_double(PosZ);

                if (j < 63)
                {
                    return(false);
                }

                int l = WorldObj.GetBlockId(i, j - 1, k);

                if (l == Block.Grass.BlockID || l == Block.Leaves.BlockID)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Caches the current frame's active render info, including the current World, RenderEngine, GameSettings and
        /// FontRenderer settings, as well as interpolated player position, pitch and yaw.
        /// </summary>
        public virtual void CacheActiveRenderInfo(World par1World, RenderEngine par2RenderEngine, FontRenderer par3FontRenderer, EntityLiving par4EntityLiving, GameSettings par5GameSettings, float par6)
        {
            WorldObj     = par1World;
            RenderEngine = par2RenderEngine;
            Options      = par5GameSettings;
            LivingPlayer = par4EntityLiving;
            FontRenderer = par3FontRenderer;

            if (par4EntityLiving.IsPlayerSleeping())
            {
                int i = par1World.GetBlockId(MathHelper2.Floor_double(par4EntityLiving.PosX), MathHelper2.Floor_double(par4EntityLiving.PosY), MathHelper2.Floor_double(par4EntityLiving.PosZ));

                if (i == Block.Bed.BlockID)
                {
                    int j = par1World.GetBlockMetadata(MathHelper2.Floor_double(par4EntityLiving.PosX), MathHelper2.Floor_double(par4EntityLiving.PosY), MathHelper2.Floor_double(par4EntityLiving.PosZ));
                    int k = j & 3;
                    PlayerViewY = k * 90 + 180;
                    PlayerViewX = 0.0F;
                }
            }
            else
            {
                PlayerViewY = par4EntityLiving.PrevRotationYaw + (par4EntityLiving.RotationYaw - par4EntityLiving.PrevRotationYaw) * par6;
                PlayerViewX = par4EntityLiving.PrevRotationPitch + (par4EntityLiving.RotationPitch - par4EntityLiving.PrevRotationPitch) * par6;
            }

            if (par5GameSettings.ThirdPersonView == 2)
            {
                PlayerViewY += 180F;
            }

            Field_1222_l = par4EntityLiving.LastTickPosX + (par4EntityLiving.PosX - par4EntityLiving.LastTickPosX) * (double)par6;
            Field_1221_m = par4EntityLiving.LastTickPosY + (par4EntityLiving.PosY - par4EntityLiving.LastTickPosY) * (double)par6;
            Field_1220_n = par4EntityLiving.LastTickPosZ + (par4EntityLiving.PosZ - par4EntityLiving.LastTickPosZ) * (double)par6;
        }
Ejemplo n.º 24
0
 public EntityArrow(World par1World, EntityLiving par2EntityLiving, float par3) : base(par1World)
 {
     XTile    = -1;
     YTile    = -1;
     ZTile    = -1;
     InTile   = 0;
     InData   = 0;
     InGround = false;
     DoesArrowBelongToPlayer = false;
     ArrowShake              = 0;
     TicksInAir              = 0;
     Damage                  = 2D;
     ArrowCritical           = false;
     ShootingEntity          = par2EntityLiving;
     DoesArrowBelongToPlayer = par2EntityLiving is EntityPlayer;
     SetSize(0.5F, 0.5F);
     SetLocationAndAngles(par2EntityLiving.PosX, par2EntityLiving.PosY + par2EntityLiving.GetEyeHeight(), par2EntityLiving.PosZ, par2EntityLiving.RotationYaw, par2EntityLiving.RotationPitch);
     PosX -= MathHelper2.Cos((RotationYaw / 180F) * (float)Math.PI) * 0.16F;
     PosY -= 0.10000000149011612F;
     PosZ -= MathHelper2.Sin((RotationYaw / 180F) * (float)Math.PI) * 0.16F;
     SetPosition(PosX, PosY, PosZ);
     YOffset = 0.0F;
     MotionX = -MathHelper2.Sin((RotationYaw / 180F) * (float)Math.PI) * MathHelper2.Cos((RotationPitch / 180F) * (float)Math.PI);
     MotionZ = MathHelper2.Cos((RotationYaw / 180F) * (float)Math.PI) * MathHelper2.Cos((RotationPitch / 180F) * (float)Math.PI);
     MotionY = -MathHelper2.Sin((RotationPitch / 180F) * (float)Math.PI);
     SetArrowHeading(MotionX, MotionY, MotionZ, par3 * 1.5F, 1.0F);
 }
Ejemplo n.º 25
0
		/// <summary>
		/// Returns the linear distance to another path point
		/// </summary>
		public virtual float DistanceTo(PathPoint par1PathPoint)
		{
			float f = par1PathPoint.XCoord - XCoord;
			float f1 = par1PathPoint.YCoord - YCoord;
			float f2 = par1PathPoint.ZCoord - ZCoord;
			return MathHelper2.Sqrt_float(f * f + f1 * f1 + f2 * f2);
		}
Ejemplo n.º 26
0
        /// <summary>
        /// Adds an entity to the chunk. Args: entity
        /// </summary>
        public virtual void AddEntity(Entity par1Entity)
        {
            HasEntities = true;
            int i = MathHelper2.Floor_double(par1Entity.PosX / 16D);
            int j = MathHelper2.Floor_double(par1Entity.PosZ / 16D);

            if (i != XPosition || j != ZPosition)
            {
                Console.WriteLine((new StringBuilder()).Append("Wrong location! ").Append(par1Entity).ToString());
                //Thread.DumpStack();
            }

            int k = MathHelper2.Floor_double(par1Entity.PosY / 16D);

            if (k < 0)
            {
                k = 0;
            }

            if (k >= EntityLists.Length)
            {
                k = EntityLists.Length - 1;
            }

            par1Entity.AddedToChunk = true;
            par1Entity.ChunkCoordX  = XPosition;
            par1Entity.ChunkCoordY  = k;
            par1Entity.ChunkCoordZ  = ZPosition;
            EntityLists[k].Add(par1Entity);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// The actual render method that is used in doRender
        /// </summary>
        public virtual void DoRenderFallingSand(EntityFallingSand par1EntityFallingSand, double par2, double par4, double par6, float par8, float par9)
        {
            //GL.PushMatrix();
            //GL.Translate((float)par2, (float)par4, (float)par6);
            LoadTexture("/terrain.png");
            Block block = Block.BlocksList[par1EntityFallingSand.BlockID];
            World world = par1EntityFallingSand.GetWorld();

            //GL.Disable(EnableCap.Lighting);

            if (block == Block.DragonEgg)
            {
                RenderBlocks.BlockAccess = world;
                Tessellator tessellator = Tessellator.Instance;
                tessellator.StartDrawingQuads();
                tessellator.SetTranslation((float)(-MathHelper2.Floor_double(par1EntityFallingSand.PosX)) - 0.5F, (float)(-MathHelper2.Floor_double(par1EntityFallingSand.PosY)) - 0.5F, (float)(-MathHelper2.Floor_double(par1EntityFallingSand.PosZ)) - 0.5F);
                RenderBlocks.RenderBlockByRenderType(block, MathHelper2.Floor_double(par1EntityFallingSand.PosX), MathHelper2.Floor_double(par1EntityFallingSand.PosY), MathHelper2.Floor_double(par1EntityFallingSand.PosZ));
                tessellator.SetTranslation(0.0F, 0.0F, 0.0F);
                tessellator.Draw();
            }
            else
            {
                RenderBlocks.RenderBlockFallingSand(block, world, MathHelper2.Floor_double(par1EntityFallingSand.PosX), MathHelper2.Floor_double(par1EntityFallingSand.PosY), MathHelper2.Floor_double(par1EntityFallingSand.PosZ));
            }

            //GL.Enable(EnableCap.Lighting);
            //GL.PopMatrix();
        }
        public virtual void OnUpdateMoveHelper()
        {
            Entity.SetMoveForward(0.0F);

            if (!Field_46036_f)
            {
                return;
            }

            Field_46036_f = false;
            int    i  = MathHelper2.Floor_double(Entity.BoundingBox.MinY + 0.5D);
            double d  = PosX - Entity.PosX;
            double d1 = PosZ - Entity.PosZ;
            double d2 = PosY - (double)i;
            double d3 = d * d + d2 * d2 + d1 * d1;

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

            float f = (float)((Math.Atan2(d1, d) * 180D) / Math.PI) - 90F;

            Entity.RotationYaw = Func_48185_a(Entity.RotationYaw, f, 30F);
            Entity.Func_48098_g(Speed);

            if (d2 > 0.0F && d * d + d1 * d1 < 1.0D)
            {
                Entity.GetJumpHelper().SetJumping();
            }
        }
Ejemplo n.º 29
0
        public EntityLightningBolt(World par1World, float par2, float par4, float par6)
            : base(par1World)
        {
            BoltVertex = 0L;
            SetLocationAndAngles(par2, par4, par6, 0.0F, 0.0F);
            LightningState = 2;
            BoltVertex     = Rand.Next();
            BoltLivingTime = Rand.Next(3) + 1;

            if (par1World.DifficultySetting >= 2 && par1World.DoChunksNearChunkExist(MathHelper2.Floor_double(par2), MathHelper2.Floor_double(par4), MathHelper2.Floor_double(par6), 10))
            {
                int i  = MathHelper2.Floor_double(par2);
                int k  = MathHelper2.Floor_double(par4);
                int i1 = MathHelper2.Floor_double(par6);

                if (par1World.GetBlockId(i, k, i1) == 0 && Block.Fire.CanPlaceBlockAt(par1World, i, k, i1))
                {
                    par1World.SetBlockWithNotify(i, k, i1, Block.Fire.BlockID);
                }

                for (int j = 0; j < 4; j++)
                {
                    int l  = (MathHelper2.Floor_double(par2) + Rand.Next(3)) - 1;
                    int j1 = (MathHelper2.Floor_double(par4) + Rand.Next(3)) - 1;
                    int k1 = (MathHelper2.Floor_double(par6) + Rand.Next(3)) - 1;

                    if (par1World.GetBlockId(l, j1, k1) == 0 && Block.Fire.CanPlaceBlockAt(par1World, l, j1, k1))
                    {
                        par1World.SetBlockWithNotify(l, j1, k1, Block.Fire.BlockID);
                    }
                }
            }
        }
        protected override void DrawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator)
        {
            SaveFormatComparator saveformatcomparator = (SaveFormatComparator)GuiSelectWorld.GetSize(ParentWorldGui)[par1];
            string s = saveformatcomparator.GetDisplayName();

            if (s == null || MathHelper2.StringNullOrLengthZero(s))
            {
                s = (new StringBuilder()).Append(GuiSelectWorld.GetLocalizedWorldName(ParentWorldGui)).Append(" ").Append(par1 + 1).ToString();
            }

            string s1 = saveformatcomparator.GetFileName();

            s1 = (new StringBuilder()).Append(s1).Append(" (").Append(new DateTime(saveformatcomparator.GetLastTimePlayed())).ToString();
            s1 = (new StringBuilder()).Append(s1).Append(")").ToString();
            string s2 = "";

            if (saveformatcomparator.RequiresConversion())
            {
                s2 = (new StringBuilder()).Append(GuiSelectWorld.GetLocalizedMustConvert(ParentWorldGui)).Append(" ").Append(s2).ToString();
            }
            else
            {
                s2 = GuiSelectWorld.GetLocalizedGameMode(ParentWorldGui)[saveformatcomparator.GetGameType()];

                if (saveformatcomparator.IsHardcoreModeEnabled())
                {
                    s2 = (new StringBuilder()).Append(FontRenderer.SpecialChar).Append("4").Append(StatCollector.TranslateToLocal("gameMode.hardcore")).Append(FontRenderer.SpecialChar).Append("8").ToString();
                }
            }

            ParentWorldGui.DrawString(ParentWorldGui.FontRenderer, s, par2 + 2, par3 + 1, 0xffffff);
            ParentWorldGui.DrawString(ParentWorldGui.FontRenderer, s1, par2 + 2, par3 + 12, 0x808080);
            ParentWorldGui.DrawString(ParentWorldGui.FontRenderer, s2, par2 + 2, par3 + 12 + 10, 0x808080);
        }