CleanroomMC / GroovyScript

A scripting mod for Minecraft without the issues of other scripting mods.
GNU Lesser General Public License v3.0
40 stars 28 forks source link

Make the Comp annotation easier to use #236

Closed WaitingIdly closed 1 month ago

WaitingIdly commented 2 months ago

changes in this PR:

some examples of what this looks like

-@Property(property = "input", valid = @Comp("1"))
+@Property(property = "input", comp = @Comp(eq = 1))
-@Property(property = "input", valid = {@Comp(value = "4", type = Comp.Type.GTE), @Comp(value = "5", type = Comp.Type.LTE)})
+@Property(property = "input", comp = @Comp(gte = 4, lte = 5))
-@Property(valid = {@Comp(type = Comp.Type.GTE, value = "0"), @Comp(type = Comp.Type.LTE, value = "1")})
+@Property(comp = @Comp(gte = 0, lte = 1))
-@Property(value = "groovyscript.wiki.craftingrecipe.ingredientMatrix.value", requirement = "groovyscript.wiki.craftingrecipe.matrix.required", valid = {@Comp(value = "1", type = Comp.Type.GTE), @Comp(value = "9", type = Comp.Type.LTE)}, priority = 200, hierarchy = 20)
+@Property(value = "groovyscript.wiki.craftingrecipe.ingredientMatrix.value", comp = @Comp(gte = 1, lte = 9, unique = "groovyscript.wiki.craftingrecipe.matrix.required"), priority = 200, hierarchy = 20)