SpyglassMC / Spyglass

Development tools for vanilla Minecraft: Java Edition data pack developers.
https://spyglassmc.com
MIT License
273 stars 29 forks source link

Add `#[warning]` attribute to mcdoc #1376

Open jacobsjo opened 2 weeks ago

jacobsjo commented 2 weeks ago

A #[warning] attribute to mark values that aren't forbidden by the game, but should be avoided anyways. Examples include values for the dust particle, and pre 1.17 weights in template pools.

Would probably want to have a way to specify a warning message - as doc comment or using #[warning=""], maybe.

misode commented 2 weeks ago

How would this look in the mcdoc source? Would we add another union member with the invalid range that has this attribute?

jacobsjo commented 2 weeks ago

Thats what I had in mind, so turn

weight: (
    #[until="1.17"] int @ 1.. |
    #[since="1.17"] int @ 1..150 |
),

into

weight: (
    int @ 1..150 |
    #[until="1.17"] #[warning] int @ 151.. |
),