public static PortalRange CalculateRange(Portal portal) { PortalRange range = new PortalRange(0, 0, 0, 0, 0, 0); foreach (Vector3I block in portal.AffectedBlocks) { if (range.Xmin == 0) { range.Xmin = block.X; } else { if (block.X < range.Xmin) { range.Xmin = block.X; } } if (range.Xmax == 0) { range.Xmax = block.X; } else { if (block.X > range.Xmax) { range.Xmax = block.X; } } if (range.Ymin == 0) { range.Ymin = block.Y; } else { if (block.Y < range.Ymin) { range.Ymin = block.Y; } } if (range.Ymax == 0) { range.Ymax = block.Y; } else { if (block.Y > range.Ymax) { range.Ymax = block.Y; } } if (range.Zmin == 0) { range.Zmin = block.Z; } else { if (block.Z < range.Zmin) { range.Zmin = block.Z; } } if (range.Zmax == 0) { range.Zmax = block.Z; } else { if (block.Z > range.Zmax) { range.Zmax = block.Z; } } } return range; }
public Portal(string world, PortalRange range, string name, string creator, string place, Position teleportPos) { World = world; Range = range; Name = name; Creator = creator; Created = DateTime.Now; Place = place; TeleportPosX = teleportPos.X; TeleportPosY = teleportPos.Y; TeleportPosZ = teleportPos.Z; TeleportPosR = teleportPos.R; TeleportPosL = teleportPos.L; }
public static PortalRange CalculateRange(Portal portal) { PortalRange range = new PortalRange(0, 0, 0, 0, 0, 0); foreach (Vector3I block in portal.AffectedBlocks) { if (range.Xmin == 0) { range.Xmin = block.X; } else { if (block.X < range.Xmin) { range.Xmin = block.X; } } if (range.Xmax == 0) { range.Xmax = block.X; } else { if (block.X > range.Xmax) { range.Xmax = block.X; } } if (range.Ymin == 0) { range.Ymin = block.Y; } else { if (block.Y < range.Ymin) { range.Ymin = block.Y; } } if (range.Ymax == 0) { range.Ymax = block.Y; } else { if (block.Y > range.Ymax) { range.Ymax = block.Y; } } if (range.Zmin == 0) { range.Zmin = block.Z; } else { if (block.Z < range.Zmin) { range.Zmin = block.Z; } } if (range.Zmax == 0) { range.Zmax = block.Z; } else { if (block.Z > range.Zmax) { range.Zmax = block.Z; } } } return(range); }