Minecraft.Coord.AbsolutetoRegion C# (CSharp) Метод

AbsolutetoRegion() публичный Метод

public AbsolutetoRegion ( ) : void
Результат void
        public void AbsolutetoRegion()
        {
            X = (int)Math.Floor(((double)X) / 32.0 / 16.0);
            Z = (int)Math.Floor(((double)Z) / 32.0 / 16.0);
        }

Usage Example

Пример #1
0
        private void btnRegionJump_Click(object sender, EventArgs e)
        {
            if (world == null)
                return;

            String msg = "Type absolute x and z block coordinates (x, z) to load the region that contains the specified point.";
            String input = "0 0";
            while (true)
            {
                input = InputBox.Show(msg, "Load", input);
                if (input.Length == 0)
                    return;

                Match m = Regex.Match(input, @"([-\+]?\d+)(?:[,\s]+)([-\+]?\d+)");
                if (m.Groups.Count < 3)
                {
                    msg = "Unable to parse coordinates. Please try again or click cancel.";
                }
                else
                {
                    int x, z;
                    if (!Int32.TryParse(m.Groups[1].Value, out x) || !Int32.TryParse(m.Groups[2].Value, out z))
                    {
                        msg = "Unable to parse coordinates. Please try again or click cancel.";
                    }
                    else
                    {
                        Coord c = new Coord(x, z);
                        c.AbsolutetoRegion();
                        TrySwitchRegion(c.X, c.Z);
                        return;
                    }
                }
            }
        }