I get an Invalid Cast exception when pasting a base with AdvancedChristmasLights.
The error is when the software tries to convert the dictionary entries normal and point in Vector3 objects.
I changed the code to
var lights = entity as AdvancedChristmasLights;
if (lights != null)
{
if (data.ContainsKey("points"))
{
var pointEntry = new Dictionary<string, Vector3>();
Dictionary<string, object> pValues;
var points = data["points"] as List<object>;
foreach (Dictionary<string, object> pointsItem in points)
{
pointEntry.Clear();
if (pointsItem.ContainsKey("normal") && pointsItem.ContainsKey("point"))
{
pValues = pointsItem["normal"] as Dictionary<string, object>;
pointEntry.Add("normal",new Vector3(Convert.ToSingle(pValues["x"]),
Convert.ToSingle(pValues["y"]),
Convert.ToSingle(pValues["z"])));
pValues = pointsItem["point"] as Dictionary<string, object>;
pointEntry.Add("point", new Vector3(Convert.ToSingle(pValues["x"]),
Convert.ToSingle(pValues["y"]),
Convert.ToSingle(pValues["z"])));
lights.points.Add(new AdvancedChristmasLights.pointEntry { normal = pointEntry["normal"], point = pointEntry["point"] });
}
}
}
if (data.ContainsKey("animationStyle"))
{
lights.animationStyle = (AdvancedChristmasLights.AnimationType)data["animationStyle"];
}
}