Esempio n. 1
0
        public static void OnTick(int par0)
        {
            KeyBinding keybinding = (KeyBinding)Hash.Lookup(par0);

            if (keybinding != null)
            {
                keybinding.PressTime++;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Returns a new instance of the specified Packet class.
        /// </summary>
        public static Packet GetNewPacket(int par0)
        {
            try
            {
                Type class1 = (Type)PacketIdToClassMap.Lookup(par0);

                if (class1 == null)
                {
                    return(null);
                }
                else
                {
                    return((Packet)Activator.CreateInstance(class1));
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
            }

            Console.WriteLine((new StringBuilder()).Append("Skipping packet with id ").Append(par0).ToString());
            return(null);
        }
 /// <summary>
 /// Lookup and return an Entity based on its ID
 /// </summary>
 public virtual Entity GetEntityByID(int par1)
 {
     return((Entity)EntityHashSet.Lookup(par1));
 }
        /// <summary>
        /// Call setupTexture on all currently-loaded textures again to account for changes in rendering options
        /// </summary>
        public void RefreshTextures()
        {
            TexturePackBase texturepackbase = TexturePack.SelectedTexturePack;
            int             i;
            Bitmap          bufferedimage;

            for (IEnumerator <int> iterator = TextureNameToImageMap.GetKeySet().GetEnumerator(); iterator.MoveNext(); SetupTexture(bufferedimage, i))
            {
                i             = iterator.Current;
                bufferedimage = (Bitmap)TextureNameToImageMap.Lookup(i);
            }
            for (IEnumerator <ThreadedImageDownloader> iterator1 = UrlToImageDataMap.Values.GetEnumerator(); iterator1.MoveNext();)
            {
                ThreadedImageDownloader threaddownloadimagedata = iterator1.Current;
                threaddownloadimagedata.TextureSetupComplete = false;
            }
            for (IEnumerator <string> iterator2 = TextureMap.Keys.GetEnumerator(); iterator2.MoveNext();)
            {
                string s = (string)iterator2.Current;
                try
                {
                    Bitmap bufferedimage1;
                    if (s.StartsWith("##"))
                    {
                        bufferedimage1 = UnwrapImageByColumns(ReadTextureImage(texturepackbase.GetResourceAsStream(s.Substring(2))));
                    }
                    else if (s.StartsWith("%clamp%"))
                    {
                        ClampTexture   = true;
                        bufferedimage1 = ReadTextureImage(texturepackbase.GetResourceAsStream(s.Substring(7)));
                    }
                    else if (s.StartsWith("%blur%"))
                    {
                        BlurTexture    = true;
                        bufferedimage1 = ReadTextureImage(texturepackbase.GetResourceAsStream(s.Substring(6)));
                    }
                    else if (s.StartsWith("%blurclamp%"))
                    {
                        BlurTexture    = true;
                        ClampTexture   = true;
                        bufferedimage1 = ReadTextureImage(texturepackbase.GetResourceAsStream(s.Substring(11)));
                    }
                    else
                    {
                        bufferedimage1 = ReadTextureImage(texturepackbase.GetResourceAsStream(s));
                    }
                    int j = TextureMap[s];
                    SetupTexture(bufferedimage1, j);
                    BlurTexture  = false;
                    ClampTexture = false;
                }
                catch (IOException ioexception)
                {
                    Utilities.LogException(ioexception);
                }
            }
            for (IEnumerator <string> iterator3 = TextureContentsMap.Keys.GetEnumerator(); iterator3.MoveNext();)
            {
                string s1 = (string)iterator3.Current;
                try
                {
                    Bitmap bufferedimage2;
                    if (s1.StartsWith("##"))
                    {
                        bufferedimage2 = UnwrapImageByColumns(ReadTextureImage(texturepackbase.GetResourceAsStream(s1.Substring(2))));
                    }
                    else if (s1.StartsWith("%clamp%"))
                    {
                        ClampTexture   = true;
                        bufferedimage2 = ReadTextureImage(texturepackbase.GetResourceAsStream(s1.Substring(7)));
                    }
                    else if (s1.StartsWith("%blur%"))
                    {
                        BlurTexture    = true;
                        bufferedimage2 = ReadTextureImage(texturepackbase.GetResourceAsStream(s1.Substring(6)));
                    }
                    else
                    {
                        bufferedimage2 = ReadTextureImage(texturepackbase.GetResourceAsStream(s1));
                    }
                    GetImageContents(bufferedimage2, (int[])TextureContentsMap[s1]);
                    BlurTexture  = false;
                    ClampTexture = false;
                }
                catch (IOException ioexception1)
                {
                    Utilities.LogException(ioexception1);
                }
            }
        }