Skip to content

Commit

Permalink
Whoops forgot to update blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Tides committed Jun 7, 2024
1 parent 3f8b497 commit 69b8319
Show file tree
Hide file tree
Showing 5 changed files with 5,364 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ private static void CreateStateBuilders(Block[] blocks, SourceProductionContext
//TODO THIS NEEDS TO BE MOVED SOMEWHERE
if (blockName == "TrialSpawner")
blockName = "TrialSpawnerBlock";
if (blockName == "Vault")
blockName = "VaultBlock";

var fullName = $"{blockName}StateBuilder";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ private static void CreateBlockStates(Block[] blocks, SourceProductionContext ct
//TODO THIS NEEDS TO BE MOVED SOMEWHERE
if (blockName == "TrialSpawner")
blockName = "TrialSpawnerBlock";
if (blockName == "Vault")
blockName = "VaultBlock";

var builder = new CodeBuilder()
.Namespace("Obsidian.API.BlockStates")
Expand Down
2 changes: 2 additions & 0 deletions Obsidian.SourceGenerators/Registry/BlocksGenerator.Blocks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ private static void GenerateBlocks(Block[] blocks, SourceProductionContext ctx)
blockName = "ObsidianBlock";
if (blockName == "TrialSpawner")
blockName = "TrialSpawnerBlock";
if (blockName == "Vault")
blockName = "VaultBlock";

var builder = new CodeBuilder()
.Using("Obsidian.API")
Expand Down
4 changes: 4 additions & 0 deletions Obsidian.SourceGenerators/Registry/BlocksGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Obsidian.SourceGenerators.Registry.Models;
using System.Collections.Immutable;
using System.Diagnostics;
using System.IO;

namespace Obsidian.SourceGenerators.Registry;
Expand All @@ -9,6 +10,9 @@ public sealed partial class BlocksGenerator : IIncrementalGenerator
{
public void Initialize(IncrementalGeneratorInitializationContext context)
{
//if (!Debugger.IsAttached)
// Debugger.Launch();

var jsonFiles = context.AdditionalTextsProvider
.Where(file => file.Path.EndsWith(".json"))
.Select(static (file, ct) => (name: Path.GetFileNameWithoutExtension(file.Path), content: file.GetText(ct)!.ToString()));
Expand Down
Loading

0 comments on commit 69b8319

Please sign in to comment.