public void ReadMobDataFromJson() { var unit = new CodeCompileUnit(); unit.Namespaces.Add(new CodeNamespace { Imports = { new CodeNamespaceImport("MiNET.Entities.Behaviors") } }); var ns = new CodeNamespace("MiNET.Generated"); ns.Comments.Add(new CodeCommentStatement("Types generated from bedrock component JSON")); unit.Namespaces.Add(ns); var files = Directory.EnumerateFileSystemEntries(@"D:\Downloads\bedrock-server-1.11.4.2\behavior_packs\vanilla\entities\", "*.json"); foreach (var file in files) { CreateEntity(ns, file); } CodeTypeDeclarationCollection types = ns.Types; CodeTypeDeclaration[] t = new CodeTypeDeclaration[types.Count]; types.CopyTo(t, 0); ns.Types.Clear(); var g = t.GroupBy(ctd => ctd.Name); foreach (var gg in g) { ns.Types.Add(gg.First()); } GenerateCSharpCode(unit); }