Skip to content

Conversation

@TheMrZZ
Copy link
Collaborator

@TheMrZZ TheMrZZ commented Aug 3, 2025

This PR is huge (wayy to big - I should have split it). It adds several improvements to Sandstone.

New formatter

I removed ESLint + Prettier in favor of BiomeJS. It's much faster, handles all rules gracefully, and sorts imports.

Integration tests

This PR adds a new integration tests framework for Sandstone, that allows us to compare the actual & expected results of Sandstone commands.

The following tests are currently implemented:

  • All commands are tested, as well as most of their subcommands - it's likely some have been missed
  • If/Else If/Else commands are tested
  • Score operations are tested

Relative MCFunction names

MCFunctions can now have a "relative" name, if their name starts with ./:

MCFunction('test', () => {
  // ⬇️ will be named default:test/foo
  MCFunction('./foo', () => ...)

  // especially useful in execute.run
  execute.as('@a').run('./callback', () => ...)
  // ⬆️ will be named default:test/callback
})

_.if conditions

This re-implements the previously existing _. conditions: _.block, _.blocks, _.biome, _.dimension...

Improved commands JSDoc with examples

This PR adds documentation with real-life examples for all commands. This should hopefully help people get the hang of how all commands work.

More exports

This adds several missing exports to the top sandstone export (missing commands, some useful arguments)

Lazy MCMetaCache & Smithed

MCMetaCache & Smithed properties of SandstoneCore were doing HTTP calls, which should not IMO happen on a pure build process. The previous getters have been transformed to cached functions - the HTTP calls will only happen if the user explicitly calls them.

Removed: namespaced objectives

Objectives were forcefully namespaced, a decision I understand but disagree with. IMO we should add a 3d argument to Objective.create (& a 2nd to Objective.get) to enable/disable namespacing.

In the meantime, I removed this feature.

Bug fixes

This PR fixes a lot of bugs:

  • within some subcommands (discovered with the tests)
  • nested ifs not working
  • _.or did not work when created outside a MCFunction => this was solved by introducing a dedicated Visitor

@TheMrZZ TheMrZZ force-pushed the fernst/improvements branch from b102c45 to f40f838 Compare August 3, 2025 15:12
@TheMrZZ TheMrZZ merged commit 7e05f08 into master Aug 17, 2025
4 checks passed
@TheMrZZ TheMrZZ deleted the fernst/improvements branch August 17, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants