public override void StartClientSide(ICoreClientAPI api) { capi = api; WaypointClassifications.Clear(); api.Event.LevelFinalize += () => { foreach (var block in api.World.Blocks) { if (block.Code == null) { continue; } string col = ColorUtil.Int2Hex(~block.GetColor(api, new BlockPos())); col = col.Insert(1, "FF"); AssetLocation loc = GetClassifiedAssetLocation(block.Code, "block"); WaypointClassifications[loc] = new WaypointClassification() { Name = Lang.GetMatching(loc.ToString()), Color = col }; } foreach (var entity in api.World.EntityTypes) { if (entity.Code == null) { continue; } AssetLocation loc = GetClassifiedAssetLocation(entity.Code, "item-creature"); WaypointClassifications[loc] = new WaypointClassification() { Name = Lang.GetMatching(loc.ToString()), Color = "#FFFF0000" }; } }; api.Input.RegisterHotKey("vshud.markwaypoint", "(VSHUD) Mark Waypoint", GlKeys.BackSlash); api.Input.SetHotKeyHandler("vshud.markwaypoint", (a) => { MarkWPForSelection(api.World.Player); return(true); }); }
public void MarkWP(WaypointClassification wp, Vec3d pos) { string str = string.Format(System.Globalization.CultureInfo.InvariantCulture, "/waypoint addati {0} ={1} ={2} ={3} {4} #{5} {6}", wp.Icon ?? "star1", pos.X, pos.Y, pos.Z, false, wp.Color, wp.Name); capi.SendChatMessage(str); }