Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the Comp annotation easier to use #236

Merged
merged 23 commits into from
Oct 3, 2024

Conversation

WaitingIdly
Copy link
Collaborator

changes in this PR:

  • reworks how the @Comp annotation works with the goal of making it easier to write.
  • deprecates the type and value elements of @Comp, and deprecates the valid and requirement elements of @Property.
  • the old format works unchanged from its prior state, so this is not a breaking change.
  • new format changes:
    • instead of an array of @Comp annotations, you now have a single @Comp annotation with multiple elements.
    • information is stored in different elements instead of a single String value element.
    • instead of a single type element, there is a types element.
    • if all of the required different elements have a non-default value, the types element can be omitted.
    • as a result of this, types is not required for any @Comp in our current codebase.
    • instead of using Property#requirement, Comp#unique is used.
    • not and unique elements are a String, the other elements are int.
    • this makes the format significantly less wordy - depending on the situation, it could be over 50% less stuff.
  • joins via serial comma when more than 2 logical chunks are present.
  • don't use Integer.MAX_VALUE in a @Comp, as its redundant in it being an int type.
  • add more lang keys representing formerly value elements that are now migrated to be unique elements.
  • make the Comp.Type enum declare the lang key in full.

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)

@WaitingIdly WaitingIdly added documentation Improvements or additions to documentation refactor Something is rewritten labels Aug 31, 2024
# Conflicts:
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/AtomicReconstructor.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/BallOfFur.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Compost.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Crusher.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/OilGen.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/TreasureChest.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Atomizer.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Combiner.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Dissolver.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Electrolyzer.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Evaporator.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Liquifier.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/ChaliceInteraction.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/Grindstone.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Cauldron.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Crucible.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Hopper.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Kiln.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/MillStone.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Saw.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Turntable.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyArray.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyTable.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/BloodAltar.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/TartaricForge.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Apothecary.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/BrewRecipe.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/ElvenTrade.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/ManaInfusion.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/RuneAltar.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/botanicadditions/GaiaPlate.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AlgorithmSeparator.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AnalysingChamber.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AtomicCalculator.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/BasicCalculator.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ConductorMast.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ExtractionChamber.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/FabricationChamber.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/FlawlessCalculator.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/GlowstoneExtractor.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/HealthProcessor.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/PrecisionChamber.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ProcessingChamber.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ReassemblyChamber.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RedstoneExtractor.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RestorationChamber.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ScientificCalculator.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StarchExtractor.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StoneSeparator.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/compactmachines/Miniaturization.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Dehydrator.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Hydrator.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Melter.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Packager.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Solidifier.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMill.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMillGrinding.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SliceNSplice.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MagicianTable.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/RadiatingChamber.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/WindRune.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/BloodInfuser.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/EnvironmentalAccumulator.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/extrabotany/Pedestal.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/AlloyKiln.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/ArcFurnace.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlastFurnace.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlastFurnaceFuel.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BottlingMachine.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/CokeOven.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Crusher.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Fermenter.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Mixer.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Refinery.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Squeezer.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivepetroleum/Distillation.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Boiler.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/BoilerFuel.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/CoolingTower.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Distiller.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/ElectrolyticCrucibleBattery.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/GasTurbine.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/HeatExchanger.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/HighPressureSteamTurbine.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/MeltingCrucible.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Radiator.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/SolarTower.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/SteamTurbine.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/Cauldron.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/Squeezer.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Aggregator.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Centrifuge.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Energizer.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Etcher.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/mysticalagriculture/Reprocessor.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Explosion.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/HeatFrameCooling.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PlasticMixer.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PressureChamber.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Refinery.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/ThermopneumaticProcessingPlant.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/primaltech/ClayKiln.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/primaltech/StoneAnvil.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/primaltech/WaterSaw.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/primaltech/WoodenBasin.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ExplosionFurnace.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/Alchemy.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/BrewingBarrel.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/CrushingTub.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/EvaporatingBasin.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/theaurorian/MoonlightForge.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/theaurorian/Scrapper.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/Alloying.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingBasin.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingTable.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/Drying.java
#	src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/StygianIronAnvil.java
Copy link
Member

@brachy84 brachy84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably fine

@brachy84 brachy84 merged commit 6134afe into CleanroomMC:master Oct 3, 2024
@WaitingIdly WaitingIdly deleted the improve-comp branch October 3, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation refactor Something is rewritten
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants