コード例 #1
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++;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Renders all the overlays that are in first person mode. Args: partialTickTime
        /// </summary>
        public virtual void RenderOverlays(float par1)
        {
            //GL.Disable(EnableCap.AlphaTest);

            if (Mc.ThePlayer.IsBurning())
            {
                int i = Mc.RenderEngineOld.GetTexture("/terrain.png");
                //GL.BindTexture(TextureTarget.Texture2D, i);
                RenderFireInFirstPerson(par1);
            }

            if (Mc.ThePlayer.IsEntityInsideOpaqueBlock())
            {
                int j  = MathHelper2.Floor_double(Mc.ThePlayer.PosX);
                int l  = MathHelper2.Floor_double(Mc.ThePlayer.PosY);
                int i1 = MathHelper2.Floor_double(Mc.ThePlayer.PosZ);
                int j1 = Mc.RenderEngineOld.GetTexture("/terrain.png");
                //GL.BindTexture(TextureTarget.Texture2D, j1);
                int k1 = Mc.TheWorld.GetBlockId(j, l, i1);

                if (Mc.TheWorld.IsBlockNormalCube(j, l, i1))
                {
                    RenderInsideOfBlock(par1, Block.BlocksList[k1].GetBlockTextureFromSide(2));
                }
                else
                {
                    for (int l1 = 0; l1 < 8; l1++)
                    {
                        float f  = ((float)((l1 >> 0) % 2) - 0.5F) * Mc.ThePlayer.Width * 0.9F;
                        float f1 = ((float)((l1 >> 1) % 2) - 0.5F) * Mc.ThePlayer.Height * 0.2F;
                        float f2 = ((float)((l1 >> 2) % 2) - 0.5F) * Mc.ThePlayer.Width * 0.9F;
                        int   i2 = MathHelper2.Floor_float((float)j + f);
                        int   j2 = MathHelper2.Floor_float((float)l + f1);
                        int   k2 = MathHelper2.Floor_float((float)i1 + f2);

                        if (Mc.TheWorld.IsBlockNormalCube(i2, j2, k2))
                        {
                            k1 = Mc.TheWorld.GetBlockId(i2, j2, k2);
                        }
                    }
                }

                if (Block.BlocksList[k1] != null)
                {
                    RenderInsideOfBlock(par1, Block.BlocksList[k1].GetBlockTextureFromSide(2));
                }
            }

            if (Mc.ThePlayer.IsInsideOfMaterial(Material.Water))
            {
                int k = Mc.RenderEngineOld.GetTexture("/misc/water.png");
                //GL.BindTexture(TextureTarget.Texture2D, k);
                RenderWarpedTextureOverlay(par1);
            }

            //GL.Enable(EnableCap.AlphaTest);
        }