From 1ba78922e1d2c42f2932bd328c435cf48b1c66e1 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 10 Oct 2025 05:27:25 -0700 Subject: [PATCH 01/92] dont log twice if flags are true --- .../documentation/Documentation.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java index c97f45c13..62829abd6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java @@ -31,12 +31,17 @@ public class Documentation { public static final IFormat DEFAULT_FORMAT = OutputFormat.VITEPRESS; public static void generate() { - if (GenerationFlags.GENERATE_EXAMPLES) generateExamples(); - if (GenerationFlags.GENERATE_WIKI) generateWiki(); + if (GenerationFlags.GENERATE_EXAMPLES) generateExamples(false); + if (GenerationFlags.GENERATE_WIKI) generateWiki(false); + logMissing(); if (GenerationFlags.GENERATE_AND_CRASH) FMLCommonHandler.instance().exitJava(0, false); } public static void generateExamples() { + generateExamples(true); + } + + private static void generateExamples(boolean log) { try { Files.createDirectories(EXAMPLES.toPath()); for (LoadStage stage : LoadStage.getLoadStages()) { @@ -51,10 +56,15 @@ public static void generateExamples() { } catch (IOException e) { GroovyScript.LOGGER.throwing(e); } - logMissing(); + if (log) logMissing(); } public static void generateWiki() { + generateWiki(true); + } + + + private static void generateWiki(boolean log) { try { Files.createDirectories(WIKI.toPath()); for (GroovyContainer mod : ModSupport.getAllContainers()) { @@ -69,7 +79,7 @@ public static void generateWiki() { } catch (IOException e) { GroovyScript.LOGGER.throwing(e); } - logMissing(); + if (log) logMissing(); } private static void logMissing() { From f4a878dfdd34589b644ec15eb7fc435bd707fd1b Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 10 Oct 2025 05:51:19 -0700 Subject: [PATCH 02/92] use LoadStage enum for annotation --- .../annotations/RegistryDescription.java | 6 ++++-- .../groovyscript/documentation/Documentation.java | 2 +- .../groovyscript/documentation/Exporter.java | 13 +++++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java index 93aff28e3..c8a26e2fc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java @@ -1,5 +1,7 @@ package com.cleanroommc.groovyscript.api.documentation.annotations; +import com.cleanroommc.groovyscript.sandbox.LoadStage; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -71,10 +73,10 @@ String linkGenerator() default ""; /** - * @return the name of the stage all the compat with the registry uses. Defaults to {@code "postInit"} + * @return the stage all the compat with the registry uses. Defaults to {@link LoadStage#POST_INIT} * @see com.cleanroommc.groovyscript.sandbox.LoadStage */ - String location() default "postInit"; + LoadStage location() default LoadStage.POST_INIT; /** * An override to {@link MethodDescription} or {@link RecipeBuilderDescription} declarations, diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java index 62829abd6..cac614cd6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java @@ -50,7 +50,7 @@ private static void generateExamples(boolean log) { for (GroovyContainer mod : ModSupport.getAllContainers()) { if (!mod.isLoaded()) continue; - Exporter.generateExamples(stage.getName(), mod); + Exporter.generateExamples(stage, mod); } } } catch (IOException e) { diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index 571dd97b1..ea5fdd368 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -8,6 +8,7 @@ import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; import com.cleanroommc.groovyscript.documentation.format.IFormat; import com.cleanroommc.groovyscript.documentation.helper.ComparisonHelper; +import com.cleanroommc.groovyscript.sandbox.LoadStage; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.client.resources.I18n; @@ -105,7 +106,7 @@ public static void generateWiki(IFormat format, File folder, GroovyContainer mod) { + public static void generateExamples(LoadStage target, GroovyContainer mod) { StringBuilder header = new StringBuilder(); StringBuilder body = new StringBuilder(); @@ -125,10 +126,10 @@ public static void generateExamples(String target, GroovyContainer Date: Fri, 10 Oct 2025 05:55:35 -0700 Subject: [PATCH 03/92] remove IFormat parameter from gen wiki --- .../groovyscript/documentation/Documentation.java | 2 +- .../groovyscript/documentation/Exporter.java | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java index cac614cd6..5ecae8e4d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java @@ -71,7 +71,7 @@ private static void generateWiki(boolean log) { if (!mod.isLoaded()) continue; File target = new File(WIKI, mod.getModId()); if (target.exists() || Files.createDirectories(target.toPath()) != null) { - Exporter.generateWiki(DEFAULT_FORMAT, target, mod); + Exporter.generateWiki(target, mod); } else { GroovyLog.get().error("Error creating file at {} to generate wiki files in", target); } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index ea5fdd368..027f92c6b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -6,7 +6,6 @@ import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.compat.mods.GroovyContainer; import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; -import com.cleanroommc.groovyscript.documentation.format.IFormat; import com.cleanroommc.groovyscript.documentation.helper.ComparisonHelper; import com.cleanroommc.groovyscript.sandbox.LoadStage; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; @@ -25,7 +24,7 @@ public class Exporter { private static final Map> SKIPPED_CLASSES = new Object2ObjectOpenHashMap<>(); - public static void generateWiki(IFormat format, File folder, GroovyContainer mod) { + public static void generateWiki(File targetFolder, GroovyContainer mod) { List fileLinks = new ArrayList<>(); Set registries = new HashSet<>(); @@ -47,7 +46,7 @@ public static void generateWiki(IFormat format, File folder, GroovyContainer Date: Fri, 10 Oct 2025 05:56:54 -0700 Subject: [PATCH 04/92] add targetFile to generateExamples --- .../groovyscript/documentation/Documentation.java | 3 ++- .../com/cleanroommc/groovyscript/documentation/Exporter.java | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java index 5ecae8e4d..9b04c423b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java @@ -50,7 +50,8 @@ private static void generateExamples(boolean log) { for (GroovyContainer mod : ModSupport.getAllContainers()) { if (!mod.isLoaded()) continue; - Exporter.generateExamples(stage, mod); + File file = new File(new File(Documentation.EXAMPLES, target.getName()), mod.getModId() + ".groovy"); + Exporter.generateExamples(file, stage, mod); } } } catch (IOException e) { diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index 027f92c6b..e8ccb181b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -105,7 +105,7 @@ public static void generateWiki(File targetFolder, GroovyContainer mod) { + public static void generateExamples(File targetFile, LoadStage target, GroovyContainer mod) { StringBuilder header = new StringBuilder(); StringBuilder body = new StringBuilder(); @@ -153,8 +153,7 @@ public static void generateExamples(LoadStage target, GroovyContainer Date: Fri, 10 Oct 2025 06:03:16 -0700 Subject: [PATCH 05/92] move examples to "generated" subfolder --- .../postInit/{ => generated}/actuallyadditions.groovy | 0 examples/postInit/{ => generated}/advancedmortars.groovy | 0 examples/postInit/{ => generated}/advancedrocketry.groovy | 0 examples/postInit/{ => generated}/aether_legacy.groovy | 0 examples/postInit/{ => generated}/alchemistry.groovy | 0 .../postInit/{ => generated}/appliedenergistics2.groovy | 0 examples/postInit/{ => generated}/arcanearchives.groovy | 0 examples/postInit/{ => generated}/arcaneworld.groovy | 0 examples/postInit/{ => generated}/armorplus.groovy | 0 examples/postInit/{ => generated}/astralsorcery.groovy | 0 examples/postInit/{ => generated}/atum.groovy | 0 examples/postInit/{ => generated}/avaritia.groovy | 0 examples/postInit/{ => generated}/betterwithaddons.groovy | 0 examples/postInit/{ => generated}/betterwithmods.groovy | 0 examples/postInit/{ => generated}/bewitchment.groovy | 0 examples/postInit/{ => generated}/bloodarsenal.groovy | 0 examples/postInit/{ => generated}/bloodmagic.groovy | 0 examples/postInit/{ => generated}/botania.groovy | 0 examples/postInit/{ => generated}/botania_tweaks.groovy | 0 examples/postInit/{ => generated}/botanicadds.groovy | 0 examples/postInit/{ => generated}/calculator.groovy | 0 examples/postInit/{ => generated}/chisel.groovy | 0 examples/postInit/{ => generated}/compactmachines3.groovy | 0 examples/postInit/{ => generated}/cyclicmagic.groovy | 0 .../postInit/{ => generated}/draconicevolution.groovy | 0 examples/postInit/{ => generated}/enderio.groovy | 0 examples/postInit/{ => generated}/erebus.groovy | 0 examples/postInit/{ => generated}/essentialcraft.groovy | 0 examples/postInit/{ => generated}/evilcraft.groovy | 0 examples/postInit/{ => generated}/extendedcrafting.groovy | 0 examples/postInit/{ => generated}/extrabotany.groovy | 0 examples/postInit/{ => generated}/extrautils2.groovy | 0 examples/postInit/{ => generated}/factorytech.groovy | 0 examples/postInit/{ => generated}/futuremc.groovy | 0 examples/postInit/{ => generated}/horsepower.groovy | 0 examples/postInit/{ => generated}/iceandfire.groovy | 0 .../postInit/{ => generated}/immersiveengineering.groovy | 0 .../postInit/{ => generated}/immersivepetroleum.groovy | 0 examples/postInit/{ => generated}/immersivetech.groovy | 0 .../postInit/{ => generated}/industrialforegoing.groovy | 0 examples/postInit/{ => generated}/inspirations.groovy | 0 .../postInit/{ => generated}/integrateddynamics.groovy | 0 examples/postInit/{ => generated}/jei.groovy | 0 examples/postInit/{ => generated}/magneticraft.groovy | 0 examples/postInit/{ => generated}/mekanism.groovy | 0 examples/postInit/{ => generated}/minecraft.groovy | 0 .../postInit/{ => generated}/mysticalagriculture.groovy | 0 examples/postInit/{ => generated}/naturesaura.groovy | 0 examples/postInit/{ => generated}/pneumaticcraft.groovy | 0 examples/postInit/{ => generated}/primal_tech.groovy | 0 examples/postInit/{ => generated}/prodigytech.groovy | 0 examples/postInit/{ => generated}/projecte.groovy | 0 examples/postInit/{ => generated}/pyrotech.groovy | 0 examples/postInit/{ => generated}/quarryplus.groovy | 0 examples/postInit/{ => generated}/randomthings.groovy | 0 examples/postInit/{ => generated}/roots.groovy | 0 examples/postInit/{ => generated}/rustic.groovy | 0 examples/postInit/{ => generated}/silentgems.groovy | 0 examples/postInit/{ => generated}/tconstruct.groovy | 0 examples/postInit/{ => generated}/techreborn.groovy | 0 examples/postInit/{ => generated}/thaumcraft.groovy | 0 examples/postInit/{ => generated}/theaurorian.groovy | 0 examples/postInit/{ => generated}/thebetweenlands.groovy | 0 examples/postInit/{ => generated}/thermalexpansion.groovy | 0 examples/postInit/{ => generated}/threng.groovy | 0 examples/postInit/{ => generated}/woot.groovy | 0 .../groovyscript/documentation/Documentation.java | 8 +++++--- 67 files changed, 5 insertions(+), 3 deletions(-) rename examples/postInit/{ => generated}/actuallyadditions.groovy (100%) rename examples/postInit/{ => generated}/advancedmortars.groovy (100%) rename examples/postInit/{ => generated}/advancedrocketry.groovy (100%) rename examples/postInit/{ => generated}/aether_legacy.groovy (100%) rename examples/postInit/{ => generated}/alchemistry.groovy (100%) rename examples/postInit/{ => generated}/appliedenergistics2.groovy (100%) rename examples/postInit/{ => generated}/arcanearchives.groovy (100%) rename examples/postInit/{ => generated}/arcaneworld.groovy (100%) rename examples/postInit/{ => generated}/armorplus.groovy (100%) rename examples/postInit/{ => generated}/astralsorcery.groovy (100%) rename examples/postInit/{ => generated}/atum.groovy (100%) rename examples/postInit/{ => generated}/avaritia.groovy (100%) rename examples/postInit/{ => generated}/betterwithaddons.groovy (100%) rename examples/postInit/{ => generated}/betterwithmods.groovy (100%) rename examples/postInit/{ => generated}/bewitchment.groovy (100%) rename examples/postInit/{ => generated}/bloodarsenal.groovy (100%) rename examples/postInit/{ => generated}/bloodmagic.groovy (100%) rename examples/postInit/{ => generated}/botania.groovy (100%) rename examples/postInit/{ => generated}/botania_tweaks.groovy (100%) rename examples/postInit/{ => generated}/botanicadds.groovy (100%) rename examples/postInit/{ => generated}/calculator.groovy (100%) rename examples/postInit/{ => generated}/chisel.groovy (100%) rename examples/postInit/{ => generated}/compactmachines3.groovy (100%) rename examples/postInit/{ => generated}/cyclicmagic.groovy (100%) rename examples/postInit/{ => generated}/draconicevolution.groovy (100%) rename examples/postInit/{ => generated}/enderio.groovy (100%) rename examples/postInit/{ => generated}/erebus.groovy (100%) rename examples/postInit/{ => generated}/essentialcraft.groovy (100%) rename examples/postInit/{ => generated}/evilcraft.groovy (100%) rename examples/postInit/{ => generated}/extendedcrafting.groovy (100%) rename examples/postInit/{ => generated}/extrabotany.groovy (100%) rename examples/postInit/{ => generated}/extrautils2.groovy (100%) rename examples/postInit/{ => generated}/factorytech.groovy (100%) rename examples/postInit/{ => generated}/futuremc.groovy (100%) rename examples/postInit/{ => generated}/horsepower.groovy (100%) rename examples/postInit/{ => generated}/iceandfire.groovy (100%) rename examples/postInit/{ => generated}/immersiveengineering.groovy (100%) rename examples/postInit/{ => generated}/immersivepetroleum.groovy (100%) rename examples/postInit/{ => generated}/immersivetech.groovy (100%) rename examples/postInit/{ => generated}/industrialforegoing.groovy (100%) rename examples/postInit/{ => generated}/inspirations.groovy (100%) rename examples/postInit/{ => generated}/integrateddynamics.groovy (100%) rename examples/postInit/{ => generated}/jei.groovy (100%) rename examples/postInit/{ => generated}/magneticraft.groovy (100%) rename examples/postInit/{ => generated}/mekanism.groovy (100%) rename examples/postInit/{ => generated}/minecraft.groovy (100%) rename examples/postInit/{ => generated}/mysticalagriculture.groovy (100%) rename examples/postInit/{ => generated}/naturesaura.groovy (100%) rename examples/postInit/{ => generated}/pneumaticcraft.groovy (100%) rename examples/postInit/{ => generated}/primal_tech.groovy (100%) rename examples/postInit/{ => generated}/prodigytech.groovy (100%) rename examples/postInit/{ => generated}/projecte.groovy (100%) rename examples/postInit/{ => generated}/pyrotech.groovy (100%) rename examples/postInit/{ => generated}/quarryplus.groovy (100%) rename examples/postInit/{ => generated}/randomthings.groovy (100%) rename examples/postInit/{ => generated}/roots.groovy (100%) rename examples/postInit/{ => generated}/rustic.groovy (100%) rename examples/postInit/{ => generated}/silentgems.groovy (100%) rename examples/postInit/{ => generated}/tconstruct.groovy (100%) rename examples/postInit/{ => generated}/techreborn.groovy (100%) rename examples/postInit/{ => generated}/thaumcraft.groovy (100%) rename examples/postInit/{ => generated}/theaurorian.groovy (100%) rename examples/postInit/{ => generated}/thebetweenlands.groovy (100%) rename examples/postInit/{ => generated}/thermalexpansion.groovy (100%) rename examples/postInit/{ => generated}/threng.groovy (100%) rename examples/postInit/{ => generated}/woot.groovy (100%) diff --git a/examples/postInit/actuallyadditions.groovy b/examples/postInit/generated/actuallyadditions.groovy similarity index 100% rename from examples/postInit/actuallyadditions.groovy rename to examples/postInit/generated/actuallyadditions.groovy diff --git a/examples/postInit/advancedmortars.groovy b/examples/postInit/generated/advancedmortars.groovy similarity index 100% rename from examples/postInit/advancedmortars.groovy rename to examples/postInit/generated/advancedmortars.groovy diff --git a/examples/postInit/advancedrocketry.groovy b/examples/postInit/generated/advancedrocketry.groovy similarity index 100% rename from examples/postInit/advancedrocketry.groovy rename to examples/postInit/generated/advancedrocketry.groovy diff --git a/examples/postInit/aether_legacy.groovy b/examples/postInit/generated/aether_legacy.groovy similarity index 100% rename from examples/postInit/aether_legacy.groovy rename to examples/postInit/generated/aether_legacy.groovy diff --git a/examples/postInit/alchemistry.groovy b/examples/postInit/generated/alchemistry.groovy similarity index 100% rename from examples/postInit/alchemistry.groovy rename to examples/postInit/generated/alchemistry.groovy diff --git a/examples/postInit/appliedenergistics2.groovy b/examples/postInit/generated/appliedenergistics2.groovy similarity index 100% rename from examples/postInit/appliedenergistics2.groovy rename to examples/postInit/generated/appliedenergistics2.groovy diff --git a/examples/postInit/arcanearchives.groovy b/examples/postInit/generated/arcanearchives.groovy similarity index 100% rename from examples/postInit/arcanearchives.groovy rename to examples/postInit/generated/arcanearchives.groovy diff --git a/examples/postInit/arcaneworld.groovy b/examples/postInit/generated/arcaneworld.groovy similarity index 100% rename from examples/postInit/arcaneworld.groovy rename to examples/postInit/generated/arcaneworld.groovy diff --git a/examples/postInit/armorplus.groovy b/examples/postInit/generated/armorplus.groovy similarity index 100% rename from examples/postInit/armorplus.groovy rename to examples/postInit/generated/armorplus.groovy diff --git a/examples/postInit/astralsorcery.groovy b/examples/postInit/generated/astralsorcery.groovy similarity index 100% rename from examples/postInit/astralsorcery.groovy rename to examples/postInit/generated/astralsorcery.groovy diff --git a/examples/postInit/atum.groovy b/examples/postInit/generated/atum.groovy similarity index 100% rename from examples/postInit/atum.groovy rename to examples/postInit/generated/atum.groovy diff --git a/examples/postInit/avaritia.groovy b/examples/postInit/generated/avaritia.groovy similarity index 100% rename from examples/postInit/avaritia.groovy rename to examples/postInit/generated/avaritia.groovy diff --git a/examples/postInit/betterwithaddons.groovy b/examples/postInit/generated/betterwithaddons.groovy similarity index 100% rename from examples/postInit/betterwithaddons.groovy rename to examples/postInit/generated/betterwithaddons.groovy diff --git a/examples/postInit/betterwithmods.groovy b/examples/postInit/generated/betterwithmods.groovy similarity index 100% rename from examples/postInit/betterwithmods.groovy rename to examples/postInit/generated/betterwithmods.groovy diff --git a/examples/postInit/bewitchment.groovy b/examples/postInit/generated/bewitchment.groovy similarity index 100% rename from examples/postInit/bewitchment.groovy rename to examples/postInit/generated/bewitchment.groovy diff --git a/examples/postInit/bloodarsenal.groovy b/examples/postInit/generated/bloodarsenal.groovy similarity index 100% rename from examples/postInit/bloodarsenal.groovy rename to examples/postInit/generated/bloodarsenal.groovy diff --git a/examples/postInit/bloodmagic.groovy b/examples/postInit/generated/bloodmagic.groovy similarity index 100% rename from examples/postInit/bloodmagic.groovy rename to examples/postInit/generated/bloodmagic.groovy diff --git a/examples/postInit/botania.groovy b/examples/postInit/generated/botania.groovy similarity index 100% rename from examples/postInit/botania.groovy rename to examples/postInit/generated/botania.groovy diff --git a/examples/postInit/botania_tweaks.groovy b/examples/postInit/generated/botania_tweaks.groovy similarity index 100% rename from examples/postInit/botania_tweaks.groovy rename to examples/postInit/generated/botania_tweaks.groovy diff --git a/examples/postInit/botanicadds.groovy b/examples/postInit/generated/botanicadds.groovy similarity index 100% rename from examples/postInit/botanicadds.groovy rename to examples/postInit/generated/botanicadds.groovy diff --git a/examples/postInit/calculator.groovy b/examples/postInit/generated/calculator.groovy similarity index 100% rename from examples/postInit/calculator.groovy rename to examples/postInit/generated/calculator.groovy diff --git a/examples/postInit/chisel.groovy b/examples/postInit/generated/chisel.groovy similarity index 100% rename from examples/postInit/chisel.groovy rename to examples/postInit/generated/chisel.groovy diff --git a/examples/postInit/compactmachines3.groovy b/examples/postInit/generated/compactmachines3.groovy similarity index 100% rename from examples/postInit/compactmachines3.groovy rename to examples/postInit/generated/compactmachines3.groovy diff --git a/examples/postInit/cyclicmagic.groovy b/examples/postInit/generated/cyclicmagic.groovy similarity index 100% rename from examples/postInit/cyclicmagic.groovy rename to examples/postInit/generated/cyclicmagic.groovy diff --git a/examples/postInit/draconicevolution.groovy b/examples/postInit/generated/draconicevolution.groovy similarity index 100% rename from examples/postInit/draconicevolution.groovy rename to examples/postInit/generated/draconicevolution.groovy diff --git a/examples/postInit/enderio.groovy b/examples/postInit/generated/enderio.groovy similarity index 100% rename from examples/postInit/enderio.groovy rename to examples/postInit/generated/enderio.groovy diff --git a/examples/postInit/erebus.groovy b/examples/postInit/generated/erebus.groovy similarity index 100% rename from examples/postInit/erebus.groovy rename to examples/postInit/generated/erebus.groovy diff --git a/examples/postInit/essentialcraft.groovy b/examples/postInit/generated/essentialcraft.groovy similarity index 100% rename from examples/postInit/essentialcraft.groovy rename to examples/postInit/generated/essentialcraft.groovy diff --git a/examples/postInit/evilcraft.groovy b/examples/postInit/generated/evilcraft.groovy similarity index 100% rename from examples/postInit/evilcraft.groovy rename to examples/postInit/generated/evilcraft.groovy diff --git a/examples/postInit/extendedcrafting.groovy b/examples/postInit/generated/extendedcrafting.groovy similarity index 100% rename from examples/postInit/extendedcrafting.groovy rename to examples/postInit/generated/extendedcrafting.groovy diff --git a/examples/postInit/extrabotany.groovy b/examples/postInit/generated/extrabotany.groovy similarity index 100% rename from examples/postInit/extrabotany.groovy rename to examples/postInit/generated/extrabotany.groovy diff --git a/examples/postInit/extrautils2.groovy b/examples/postInit/generated/extrautils2.groovy similarity index 100% rename from examples/postInit/extrautils2.groovy rename to examples/postInit/generated/extrautils2.groovy diff --git a/examples/postInit/factorytech.groovy b/examples/postInit/generated/factorytech.groovy similarity index 100% rename from examples/postInit/factorytech.groovy rename to examples/postInit/generated/factorytech.groovy diff --git a/examples/postInit/futuremc.groovy b/examples/postInit/generated/futuremc.groovy similarity index 100% rename from examples/postInit/futuremc.groovy rename to examples/postInit/generated/futuremc.groovy diff --git a/examples/postInit/horsepower.groovy b/examples/postInit/generated/horsepower.groovy similarity index 100% rename from examples/postInit/horsepower.groovy rename to examples/postInit/generated/horsepower.groovy diff --git a/examples/postInit/iceandfire.groovy b/examples/postInit/generated/iceandfire.groovy similarity index 100% rename from examples/postInit/iceandfire.groovy rename to examples/postInit/generated/iceandfire.groovy diff --git a/examples/postInit/immersiveengineering.groovy b/examples/postInit/generated/immersiveengineering.groovy similarity index 100% rename from examples/postInit/immersiveengineering.groovy rename to examples/postInit/generated/immersiveengineering.groovy diff --git a/examples/postInit/immersivepetroleum.groovy b/examples/postInit/generated/immersivepetroleum.groovy similarity index 100% rename from examples/postInit/immersivepetroleum.groovy rename to examples/postInit/generated/immersivepetroleum.groovy diff --git a/examples/postInit/immersivetech.groovy b/examples/postInit/generated/immersivetech.groovy similarity index 100% rename from examples/postInit/immersivetech.groovy rename to examples/postInit/generated/immersivetech.groovy diff --git a/examples/postInit/industrialforegoing.groovy b/examples/postInit/generated/industrialforegoing.groovy similarity index 100% rename from examples/postInit/industrialforegoing.groovy rename to examples/postInit/generated/industrialforegoing.groovy diff --git a/examples/postInit/inspirations.groovy b/examples/postInit/generated/inspirations.groovy similarity index 100% rename from examples/postInit/inspirations.groovy rename to examples/postInit/generated/inspirations.groovy diff --git a/examples/postInit/integrateddynamics.groovy b/examples/postInit/generated/integrateddynamics.groovy similarity index 100% rename from examples/postInit/integrateddynamics.groovy rename to examples/postInit/generated/integrateddynamics.groovy diff --git a/examples/postInit/jei.groovy b/examples/postInit/generated/jei.groovy similarity index 100% rename from examples/postInit/jei.groovy rename to examples/postInit/generated/jei.groovy diff --git a/examples/postInit/magneticraft.groovy b/examples/postInit/generated/magneticraft.groovy similarity index 100% rename from examples/postInit/magneticraft.groovy rename to examples/postInit/generated/magneticraft.groovy diff --git a/examples/postInit/mekanism.groovy b/examples/postInit/generated/mekanism.groovy similarity index 100% rename from examples/postInit/mekanism.groovy rename to examples/postInit/generated/mekanism.groovy diff --git a/examples/postInit/minecraft.groovy b/examples/postInit/generated/minecraft.groovy similarity index 100% rename from examples/postInit/minecraft.groovy rename to examples/postInit/generated/minecraft.groovy diff --git a/examples/postInit/mysticalagriculture.groovy b/examples/postInit/generated/mysticalagriculture.groovy similarity index 100% rename from examples/postInit/mysticalagriculture.groovy rename to examples/postInit/generated/mysticalagriculture.groovy diff --git a/examples/postInit/naturesaura.groovy b/examples/postInit/generated/naturesaura.groovy similarity index 100% rename from examples/postInit/naturesaura.groovy rename to examples/postInit/generated/naturesaura.groovy diff --git a/examples/postInit/pneumaticcraft.groovy b/examples/postInit/generated/pneumaticcraft.groovy similarity index 100% rename from examples/postInit/pneumaticcraft.groovy rename to examples/postInit/generated/pneumaticcraft.groovy diff --git a/examples/postInit/primal_tech.groovy b/examples/postInit/generated/primal_tech.groovy similarity index 100% rename from examples/postInit/primal_tech.groovy rename to examples/postInit/generated/primal_tech.groovy diff --git a/examples/postInit/prodigytech.groovy b/examples/postInit/generated/prodigytech.groovy similarity index 100% rename from examples/postInit/prodigytech.groovy rename to examples/postInit/generated/prodigytech.groovy diff --git a/examples/postInit/projecte.groovy b/examples/postInit/generated/projecte.groovy similarity index 100% rename from examples/postInit/projecte.groovy rename to examples/postInit/generated/projecte.groovy diff --git a/examples/postInit/pyrotech.groovy b/examples/postInit/generated/pyrotech.groovy similarity index 100% rename from examples/postInit/pyrotech.groovy rename to examples/postInit/generated/pyrotech.groovy diff --git a/examples/postInit/quarryplus.groovy b/examples/postInit/generated/quarryplus.groovy similarity index 100% rename from examples/postInit/quarryplus.groovy rename to examples/postInit/generated/quarryplus.groovy diff --git a/examples/postInit/randomthings.groovy b/examples/postInit/generated/randomthings.groovy similarity index 100% rename from examples/postInit/randomthings.groovy rename to examples/postInit/generated/randomthings.groovy diff --git a/examples/postInit/roots.groovy b/examples/postInit/generated/roots.groovy similarity index 100% rename from examples/postInit/roots.groovy rename to examples/postInit/generated/roots.groovy diff --git a/examples/postInit/rustic.groovy b/examples/postInit/generated/rustic.groovy similarity index 100% rename from examples/postInit/rustic.groovy rename to examples/postInit/generated/rustic.groovy diff --git a/examples/postInit/silentgems.groovy b/examples/postInit/generated/silentgems.groovy similarity index 100% rename from examples/postInit/silentgems.groovy rename to examples/postInit/generated/silentgems.groovy diff --git a/examples/postInit/tconstruct.groovy b/examples/postInit/generated/tconstruct.groovy similarity index 100% rename from examples/postInit/tconstruct.groovy rename to examples/postInit/generated/tconstruct.groovy diff --git a/examples/postInit/techreborn.groovy b/examples/postInit/generated/techreborn.groovy similarity index 100% rename from examples/postInit/techreborn.groovy rename to examples/postInit/generated/techreborn.groovy diff --git a/examples/postInit/thaumcraft.groovy b/examples/postInit/generated/thaumcraft.groovy similarity index 100% rename from examples/postInit/thaumcraft.groovy rename to examples/postInit/generated/thaumcraft.groovy diff --git a/examples/postInit/theaurorian.groovy b/examples/postInit/generated/theaurorian.groovy similarity index 100% rename from examples/postInit/theaurorian.groovy rename to examples/postInit/generated/theaurorian.groovy diff --git a/examples/postInit/thebetweenlands.groovy b/examples/postInit/generated/thebetweenlands.groovy similarity index 100% rename from examples/postInit/thebetweenlands.groovy rename to examples/postInit/generated/thebetweenlands.groovy diff --git a/examples/postInit/thermalexpansion.groovy b/examples/postInit/generated/thermalexpansion.groovy similarity index 100% rename from examples/postInit/thermalexpansion.groovy rename to examples/postInit/generated/thermalexpansion.groovy diff --git a/examples/postInit/threng.groovy b/examples/postInit/generated/threng.groovy similarity index 100% rename from examples/postInit/threng.groovy rename to examples/postInit/generated/threng.groovy diff --git a/examples/postInit/woot.groovy b/examples/postInit/generated/woot.groovy similarity index 100% rename from examples/postInit/woot.groovy rename to examples/postInit/generated/woot.groovy diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java index 9b04c423b..90c5eae57 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java @@ -45,12 +45,14 @@ private static void generateExamples(boolean log) { try { Files.createDirectories(EXAMPLES.toPath()); for (LoadStage stage : LoadStage.getLoadStages()) { - File target = new File(EXAMPLES, stage.getName()); - Files.createDirectories(target.toPath()); + File stageFolder = new File(EXAMPLES, stage.getName()); + File generatedFolder = new File(stageFolder, "generated"); + Files.createDirectories(stageFolder.toPath()); + Files.createDirectories(generatedFolder.toPath()); for (GroovyContainer mod : ModSupport.getAllContainers()) { if (!mod.isLoaded()) continue; - File file = new File(new File(Documentation.EXAMPLES, target.getName()), mod.getModId() + ".groovy"); + File file = new File(generatedFolder, mod.getModId() + ".groovy"); Exporter.generateExamples(file, stage, mod); } } From 6930f69b33247058ba1b767f0393258f534fb7a0 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 10 Oct 2025 06:05:34 -0700 Subject: [PATCH 06/92] generate wiki in wiki/mods folder --- .../cleanroommc/groovyscript/documentation/Documentation.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java index 90c5eae57..e3509d744 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java @@ -27,6 +27,7 @@ public class Documentation { public static final File EXAMPLES = new File(GroovyScript.getScriptPath()); public static final File WIKI = new File(new File(GroovyScript.getScriptFile().getParentFile(), "build"), "wiki"); + public static final File MODS = new File(WIKI, "mods"); public static final IFormat DEFAULT_FORMAT = OutputFormat.VITEPRESS; @@ -70,11 +71,12 @@ public static void generateWiki() { private static void generateWiki(boolean log) { try { Files.createDirectories(WIKI.toPath()); + Files.createDirectories(MODS.toPath()); for (GroovyContainer mod : ModSupport.getAllContainers()) { if (!mod.isLoaded()) continue; - File target = new File(WIKI, mod.getModId()); if (target.exists() || Files.createDirectories(target.toPath()) != null) { Exporter.generateWiki(target, mod); + File target = new File(MODS, mod.getModId()); } else { GroovyLog.get().error("Error creating file at {} to generate wiki files in", target); } From d56c49b87491107149c3fe2b5cb78ed56815877c Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 10 Oct 2025 06:13:52 -0700 Subject: [PATCH 07/92] add IContainerDocumentation --- .../IContainerDocumentation.java | 31 +++++++++++++++++++ .../documentation/Documentation.java | 17 +++++++--- 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/cleanroommc/groovyscript/api/documentation/IContainerDocumentation.java diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/IContainerDocumentation.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/IContainerDocumentation.java new file mode 100644 index 000000000..2e1248dff --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/IContainerDocumentation.java @@ -0,0 +1,31 @@ +package com.cleanroommc.groovyscript.api.documentation; + +import com.cleanroommc.groovyscript.compat.mods.GroovyContainer; +import com.cleanroommc.groovyscript.sandbox.LoadStage; + +import java.io.File; + +/** + * Implementing this interface on something extending {@link GroovyContainer} + * will allow overriding the default documentation generation + * for the container. + */ +public interface IContainerDocumentation { + + /** + * Generate an example file for the given load stage. + * + * @param suggestedFile the default file that the example code is suggested to be generated in. + * @param stage the load stage the examples are being generated for. + * @see com.cleanroommc.groovyscript.documentation.Exporter#generateExamples(File, LoadStage, GroovyContainer) + */ + void generateExamples(File suggestedFile, LoadStage stage); + + /** + * Generate pages for the wiki in this method. + * + * @param suggestedFolder the default folder that the wiki is suggested to be generated in. + * @see com.cleanroommc.groovyscript.documentation.Exporter#generateWiki(File, GroovyContainer) + */ + void generateWiki(File suggestedFolder); +} diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java index e3509d744..d197441e1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java @@ -2,6 +2,7 @@ import com.cleanroommc.groovyscript.GroovyScript; import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.documentation.IContainerDocumentation; import com.cleanroommc.groovyscript.compat.mods.GroovyContainer; import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; import com.cleanroommc.groovyscript.compat.mods.ModSupport; @@ -54,7 +55,11 @@ private static void generateExamples(boolean log) { for (GroovyContainer mod : ModSupport.getAllContainers()) { if (!mod.isLoaded()) continue; File file = new File(generatedFolder, mod.getModId() + ".groovy"); - Exporter.generateExamples(file, stage, mod); + if (mod instanceof IContainerDocumentation doc) { + doc.generateExamples(file, stage); + } else { + Exporter.generateExamples(file, stage, mod); + } } } } catch (IOException e) { @@ -74,11 +79,15 @@ private static void generateWiki(boolean log) { Files.createDirectories(MODS.toPath()); for (GroovyContainer mod : ModSupport.getAllContainers()) { if (!mod.isLoaded()) continue; - if (target.exists() || Files.createDirectories(target.toPath()) != null) { - Exporter.generateWiki(target, mod); File target = new File(MODS, mod.getModId()); + if (mod instanceof IContainerDocumentation doc) { + doc.generateWiki(target); } else { - GroovyLog.get().error("Error creating file at {} to generate wiki files in", target); + if (target.exists() || Files.createDirectories(target.toPath()) != null) { + Exporter.generateWiki(target, mod); + } else { + GroovyLog.get().error("Error creating file at {} to generate wiki files in", target); + } } } } catch (IOException e) { From b31bea25a72936d4be86eff08536d3bca614cb28 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 10 Oct 2025 06:14:28 -0700 Subject: [PATCH 08/92] change vanilla wiki to generate in separate folder --- .../compat/mods/MinecraftModContainer.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java index 649b96c32..86073f7d6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java @@ -1,16 +1,24 @@ package com.cleanroommc.groovyscript.compat.mods; +import com.cleanroommc.groovyscript.GroovyScript; +import com.cleanroommc.groovyscript.api.documentation.IContainerDocumentation; import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; +import com.cleanroommc.groovyscript.documentation.Documentation; +import com.cleanroommc.groovyscript.documentation.Exporter; +import com.cleanroommc.groovyscript.sandbox.LoadStage; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.NotNull; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; import java.util.Collection; import java.util.Collections; import java.util.Set; -public final class MinecraftModContainer extends GroovyContainer { +public final class MinecraftModContainer extends GroovyContainer implements IContainerDocumentation { private static final String modId = "minecraft"; private static final String containerName = "Minecraft"; @@ -58,4 +66,20 @@ public VanillaModule get() { @Override public void onCompatLoaded(GroovyContainer container) {} + + @Override + public void generateExamples(File suggestedFile, LoadStage stage) { + Exporter.generateExamples(suggestedFile, stage, this); + } + + @Override + public void generateWiki(File suggestedFolder) { + var minecraftCompatFolder = new File(new File(Documentation.WIKI, "minecraft"), "helpers"); + try { + Files.createDirectories(minecraftCompatFolder.toPath()); + } catch (IOException e) { + GroovyScript.LOGGER.throwing(e); + } + Exporter.generateWiki(minecraftCompatFolder, this); + } } From 632c8fe1c2c4e2c58f8c4e036d1a7f980a562339 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 10 Oct 2025 06:44:02 -0700 Subject: [PATCH 09/92] add the ability to export files directly --- .../groovyscript/documentation/Exporter.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index e8ccb181b..a930b0370 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -12,7 +12,9 @@ import net.minecraft.client.resources.I18n; import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; import java.nio.file.Files; import java.util.*; @@ -159,6 +161,16 @@ public static void generateExamples(File targetFile, LoadStage target, GroovyCon } } + public static void exportFile(File file, String resource) throws IOException { + try (InputStream inputStream = Exporter.class.getClassLoader().getResourceAsStream(resource); + FileOutputStream outputStream = new FileOutputStream(file)) { + int i; + while ((i = inputStream.read()) != -1) { + outputStream.write(i); + } + } + } + public static void logSkippedClasses() { if (SKIPPED_CLASSES.isEmpty()) return; GroovyLog.Msg log = GroovyLog.msg("Skipped documenting the following potentially valid locations (this may be the correct behavior!)"); From 4dc5404cb5b487263165fec5f05f806d2d53f3b9 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 10 Oct 2025 06:44:14 -0700 Subject: [PATCH 10/92] add vanilla index file to export directly --- .../compat/mods/MinecraftModContainer.java | 3 ++- src/main/resources/wiki/vanilla/index.md | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/wiki/vanilla/index.md diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java index 86073f7d6..732ce32db 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java @@ -77,9 +77,10 @@ public void generateWiki(File suggestedFolder) { var minecraftCompatFolder = new File(new File(Documentation.WIKI, "minecraft"), "helpers"); try { Files.createDirectories(minecraftCompatFolder.toPath()); + Exporter.generateWiki(minecraftCompatFolder, this); + Exporter.exportFile(new File(minecraftCompatFolder, "index.md"), "wiki/vanilla/index.md"); } catch (IOException e) { GroovyScript.LOGGER.throwing(e); } - Exporter.generateWiki(minecraftCompatFolder, this); } } diff --git a/src/main/resources/wiki/vanilla/index.md b/src/main/resources/wiki/vanilla/index.md new file mode 100644 index 000000000..a66c207dd --- /dev/null +++ b/src/main/resources/wiki/vanilla/index.md @@ -0,0 +1,25 @@ +--- +aside: false +order: 700 +--- + + +# Registries + +## Categories + +Has 7 subcategories. + +* [Custom Commands](./command.md) + +* [Crafting Table](./crafting.md) + +* [Furnace](./furnace.md) + +* [Default GameRules](./game_rule.md) + +* [Ore Dictionary](./ore_dict.md) + +* [Starting Inventory](./player.md) + +* [Rarity](./rarity.md) \ No newline at end of file From 42dc0052bd5609fbc01ba3c608ae60e608c33359 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 10 Oct 2025 06:47:02 -0700 Subject: [PATCH 11/92] log.info into log --- examples/postInit/generated/actuallyadditions.groovy | 2 +- examples/postInit/generated/advancedmortars.groovy | 2 +- examples/postInit/generated/advancedrocketry.groovy | 2 +- examples/postInit/generated/aether_legacy.groovy | 2 +- examples/postInit/generated/alchemistry.groovy | 2 +- examples/postInit/generated/appliedenergistics2.groovy | 2 +- examples/postInit/generated/arcanearchives.groovy | 2 +- examples/postInit/generated/arcaneworld.groovy | 2 +- examples/postInit/generated/armorplus.groovy | 2 +- examples/postInit/generated/astralsorcery.groovy | 2 +- examples/postInit/generated/atum.groovy | 2 +- examples/postInit/generated/avaritia.groovy | 2 +- examples/postInit/generated/betterwithaddons.groovy | 2 +- examples/postInit/generated/betterwithmods.groovy | 2 +- examples/postInit/generated/bewitchment.groovy | 2 +- examples/postInit/generated/bloodarsenal.groovy | 2 +- examples/postInit/generated/bloodmagic.groovy | 2 +- examples/postInit/generated/botania.groovy | 2 +- examples/postInit/generated/botania_tweaks.groovy | 2 +- examples/postInit/generated/botanicadds.groovy | 2 +- examples/postInit/generated/calculator.groovy | 2 +- examples/postInit/generated/chisel.groovy | 2 +- examples/postInit/generated/compactmachines3.groovy | 2 +- examples/postInit/generated/cyclicmagic.groovy | 2 +- examples/postInit/generated/draconicevolution.groovy | 2 +- examples/postInit/generated/enderio.groovy | 2 +- examples/postInit/generated/erebus.groovy | 2 +- examples/postInit/generated/essentialcraft.groovy | 2 +- examples/postInit/generated/evilcraft.groovy | 2 +- examples/postInit/generated/extendedcrafting.groovy | 2 +- examples/postInit/generated/extrabotany.groovy | 2 +- examples/postInit/generated/extrautils2.groovy | 2 +- examples/postInit/generated/factorytech.groovy | 2 +- examples/postInit/generated/futuremc.groovy | 2 +- examples/postInit/generated/horsepower.groovy | 2 +- examples/postInit/generated/iceandfire.groovy | 2 +- examples/postInit/generated/immersiveengineering.groovy | 2 +- examples/postInit/generated/immersivepetroleum.groovy | 2 +- examples/postInit/generated/immersivetech.groovy | 2 +- examples/postInit/generated/industrialforegoing.groovy | 2 +- examples/postInit/generated/inspirations.groovy | 2 +- examples/postInit/generated/integrateddynamics.groovy | 2 +- examples/postInit/generated/jei.groovy | 2 +- examples/postInit/generated/magneticraft.groovy | 2 +- examples/postInit/generated/mekanism.groovy | 2 +- examples/postInit/generated/minecraft.groovy | 2 +- examples/postInit/generated/mysticalagriculture.groovy | 2 +- examples/postInit/generated/naturesaura.groovy | 2 +- examples/postInit/generated/pneumaticcraft.groovy | 2 +- examples/postInit/generated/primal_tech.groovy | 2 +- examples/postInit/generated/prodigytech.groovy | 2 +- examples/postInit/generated/projecte.groovy | 2 +- examples/postInit/generated/pyrotech.groovy | 2 +- examples/postInit/generated/quarryplus.groovy | 2 +- examples/postInit/generated/randomthings.groovy | 2 +- examples/postInit/generated/roots.groovy | 2 +- examples/postInit/generated/rustic.groovy | 2 +- examples/postInit/generated/silentgems.groovy | 2 +- examples/postInit/generated/tconstruct.groovy | 2 +- examples/postInit/generated/techreborn.groovy | 2 +- examples/postInit/generated/thaumcraft.groovy | 2 +- examples/postInit/generated/theaurorian.groovy | 2 +- examples/postInit/generated/thebetweenlands.groovy | 2 +- examples/postInit/generated/thermalexpansion.groovy | 2 +- examples/postInit/generated/threng.groovy | 2 +- examples/postInit/generated/woot.groovy | 2 +- .../com/cleanroommc/groovyscript/documentation/Exporter.java | 2 +- 67 files changed, 67 insertions(+), 67 deletions(-) diff --git a/examples/postInit/generated/actuallyadditions.groovy b/examples/postInit/generated/actuallyadditions.groovy index f3c955cb2..7ec0c34f7 100644 --- a/examples/postInit/generated/actuallyadditions.groovy +++ b/examples/postInit/generated/actuallyadditions.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: actuallyadditions -log.info 'mod \'actuallyadditions\' detected, running script' +log 'mod \'actuallyadditions\' detected, running script' // Atomic Reconstructor: // The Atomic Reconstructor is a block which uses energy to convert a block or item in front of it into other items. diff --git a/examples/postInit/generated/advancedmortars.groovy b/examples/postInit/generated/advancedmortars.groovy index fc232ba64..1046adcf9 100644 --- a/examples/postInit/generated/advancedmortars.groovy +++ b/examples/postInit/generated/advancedmortars.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: advancedmortars -log.info 'mod \'advancedmortars\' detected, running script' +log 'mod \'advancedmortars\' detected, running script' // Mortar: // Uses any number of specific types of Mortars to convert multiple items into a single output with a possible chance diff --git a/examples/postInit/generated/advancedrocketry.groovy b/examples/postInit/generated/advancedrocketry.groovy index b2c1354d4..265e96be1 100644 --- a/examples/postInit/generated/advancedrocketry.groovy +++ b/examples/postInit/generated/advancedrocketry.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: advancedrocketry -log.info 'mod \'advancedrocketry\' detected, running script' +log 'mod \'advancedrocketry\' detected, running script' // Centrifuge: // Converts an input fluid into up to 12 output items and up to 4 output fluids, consuming RF. diff --git a/examples/postInit/generated/aether_legacy.groovy b/examples/postInit/generated/aether_legacy.groovy index 84742272a..76d1c2b4a 100644 --- a/examples/postInit/generated/aether_legacy.groovy +++ b/examples/postInit/generated/aether_legacy.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: aether_legacy -log.info 'mod \'aether_legacy\' detected, running script' +log 'mod \'aether_legacy\' detected, running script' // Accessory: // The Aether Accessory system. diff --git a/examples/postInit/generated/alchemistry.groovy b/examples/postInit/generated/alchemistry.groovy index 52acf4e7c..1a0b33c76 100644 --- a/examples/postInit/generated/alchemistry.groovy +++ b/examples/postInit/generated/alchemistry.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: alchemistry -log.info 'mod \'alchemistry\' detected, running script' +log 'mod \'alchemistry\' detected, running script' // Atomizer: // Converts a non-element into its component elements. diff --git a/examples/postInit/generated/appliedenergistics2.groovy b/examples/postInit/generated/appliedenergistics2.groovy index 91e12c6c0..7eae0998a 100644 --- a/examples/postInit/generated/appliedenergistics2.groovy +++ b/examples/postInit/generated/appliedenergistics2.groovy @@ -4,7 +4,7 @@ import appeng.capabilities.Capabilities -log.info 'mod \'appliedenergistics2\' detected, running script' +log 'mod \'appliedenergistics2\' detected, running script' // P2P Attunement: // Controls using specific items, any items from a mod, or any items with a Capability to convert a P2P into a specific diff --git a/examples/postInit/generated/arcanearchives.groovy b/examples/postInit/generated/arcanearchives.groovy index 08c218e4e..9cad96163 100644 --- a/examples/postInit/generated/arcanearchives.groovy +++ b/examples/postInit/generated/arcanearchives.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: arcanearchives -log.info 'mod \'arcanearchives\' detected, running script' +log 'mod \'arcanearchives\' detected, running script' // Gem Cutting Table: // Converts any number of itemstacks into a single output itemstack via selecting the desired output itemstack in the GUI. diff --git a/examples/postInit/generated/arcaneworld.groovy b/examples/postInit/generated/arcaneworld.groovy index fc901398b..02feef567 100644 --- a/examples/postInit/generated/arcaneworld.groovy +++ b/examples/postInit/generated/arcaneworld.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: arcaneworld -log.info 'mod \'arcaneworld\' detected, running script' +log 'mod \'arcaneworld\' detected, running script' // Ritual: // Converts up to 5 input itemstacks into a wide number of possible effects, including spawning entities, opening a portal diff --git a/examples/postInit/generated/armorplus.groovy b/examples/postInit/generated/armorplus.groovy index dfda95f60..5b8054402 100644 --- a/examples/postInit/generated/armorplus.groovy +++ b/examples/postInit/generated/armorplus.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: armorplus -log.info 'mod \'armorplus\' detected, running script' +log 'mod \'armorplus\' detected, running script' // Champion Bench: // A normal crafting recipe, but with a 9x9 grid and in the Champion Bench. diff --git a/examples/postInit/generated/astralsorcery.groovy b/examples/postInit/generated/astralsorcery.groovy index a420202c4..8a29c0fe4 100644 --- a/examples/postInit/generated/astralsorcery.groovy +++ b/examples/postInit/generated/astralsorcery.groovy @@ -5,7 +5,7 @@ import hellfirepvp.astralsorcery.common.constellation.MoonPhase import net.minecraft.util.math.MathHelper -log.info 'mod \'astralsorcery\' detected, running script' +log 'mod \'astralsorcery\' detected, running script' // Chalice Interaction: // When two chalices containing different fluids are placed nearby, fluid may be consumed to produce an output itemstack. diff --git a/examples/postInit/generated/atum.groovy b/examples/postInit/generated/atum.groovy index 4661d0c53..a3285175b 100644 --- a/examples/postInit/generated/atum.groovy +++ b/examples/postInit/generated/atum.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: atum -log.info 'mod \'atum\' detected, running script' +log 'mod \'atum\' detected, running script' // Kiln: // Smelts an input item into an output itemstack and giving experience similar to a Furnace, but can process up to 4 stacks diff --git a/examples/postInit/generated/avaritia.groovy b/examples/postInit/generated/avaritia.groovy index 78ff97c12..e3d3a7b91 100644 --- a/examples/postInit/generated/avaritia.groovy +++ b/examples/postInit/generated/avaritia.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: avaritia -log.info 'mod \'avaritia\' detected, running script' +log 'mod \'avaritia\' detected, running script' // Compressor: // Converts any number of a single item into an output itemstack. diff --git a/examples/postInit/generated/betterwithaddons.groovy b/examples/postInit/generated/betterwithaddons.groovy index 76f8849b1..3dd02d980 100644 --- a/examples/postInit/generated/betterwithaddons.groovy +++ b/examples/postInit/generated/betterwithaddons.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: betterwithaddons -log.info 'mod \'betterwithaddons\' detected, running script' +log 'mod \'betterwithaddons\' detected, running script' // Drying Unit: // Converts an input item into an output itemstack if placed within the appropriate multiblock. The multiblock is Sandstone diff --git a/examples/postInit/generated/betterwithmods.groovy b/examples/postInit/generated/betterwithmods.groovy index 1b529fe68..470a5fd65 100644 --- a/examples/postInit/generated/betterwithmods.groovy +++ b/examples/postInit/generated/betterwithmods.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: betterwithmods -log.info 'mod \'betterwithmods\' detected, running script' +log 'mod \'betterwithmods\' detected, running script' // Anvil Crafting: // Similar to a normal crafting table, but 4x4 instead. diff --git a/examples/postInit/generated/bewitchment.groovy b/examples/postInit/generated/bewitchment.groovy index bf5e34422..94cbbaa8e 100644 --- a/examples/postInit/generated/bewitchment.groovy +++ b/examples/postInit/generated/bewitchment.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: bewitchment -log.info 'mod \'bewitchment\' detected, running script' +log 'mod \'bewitchment\' detected, running script' // Altar Upgrades: // Controls the valid upgrades placed atop the Witches' Altar, a multiblock that gain Magic Power from nearby plants and diff --git a/examples/postInit/generated/bloodarsenal.groovy b/examples/postInit/generated/bloodarsenal.groovy index fd974a264..684a93f7d 100644 --- a/examples/postInit/generated/bloodarsenal.groovy +++ b/examples/postInit/generated/bloodarsenal.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: bloodarsenal -log.info 'mod \'bloodarsenal\' detected, running script' +log 'mod \'bloodarsenal\' detected, running script' // Sanguine Infusion: // Converts an input infusion itemstack and up to 8 input surrounding itemstacks into an output itemstack, consuming Life diff --git a/examples/postInit/generated/bloodmagic.groovy b/examples/postInit/generated/bloodmagic.groovy index cb86e01f1..bbef377af 100644 --- a/examples/postInit/generated/bloodmagic.groovy +++ b/examples/postInit/generated/bloodmagic.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: bloodmagic -log.info 'mod \'bloodmagic\' detected, running script' +log 'mod \'bloodmagic\' detected, running script' // Alchemy Array: // Converts two items into an output itemstack by using Arcane Ashes in-world. Has a configurable texture for the diff --git a/examples/postInit/generated/botania.groovy b/examples/postInit/generated/botania.groovy index 7f9e61f2c..0153a6fef 100644 --- a/examples/postInit/generated/botania.groovy +++ b/examples/postInit/generated/botania.groovy @@ -4,7 +4,7 @@ import net.minecraft.util.text.TextFormatting -log.info 'mod \'botania\' detected, running script' +log 'mod \'botania\' detected, running script' // Petal Apothecary: // Converts item inputs into an item output consuming water and a seed. diff --git a/examples/postInit/generated/botania_tweaks.groovy b/examples/postInit/generated/botania_tweaks.groovy index 173b2868d..e140848ed 100644 --- a/examples/postInit/generated/botania_tweaks.groovy +++ b/examples/postInit/generated/botania_tweaks.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: botania_tweaks -log.info 'mod \'botania_tweaks\' detected, running script' +log 'mod \'botania_tweaks\' detected, running script' // Agglomeration Plate: // Converts any number of input itemstacks into an item output, consuming mana to do so. Occurs in-world above a diff --git a/examples/postInit/generated/botanicadds.groovy b/examples/postInit/generated/botanicadds.groovy index 63d504dde..fc9efc54c 100644 --- a/examples/postInit/generated/botanicadds.groovy +++ b/examples/postInit/generated/botanicadds.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: botanicadds -log.info 'mod \'botanicadds\' detected, running script' +log 'mod \'botanicadds\' detected, running script' // Gaia Plate: // Converts an number of input items into an output itemstack, consuming a given amount of mana when dropped in-world atop diff --git a/examples/postInit/generated/calculator.groovy b/examples/postInit/generated/calculator.groovy index e2dd81d1f..4474036f9 100644 --- a/examples/postInit/generated/calculator.groovy +++ b/examples/postInit/generated/calculator.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: calculator -log.info 'mod \'calculator\' detected, running script' +log 'mod \'calculator\' detected, running script' // Algorithm Separator: // Converts an input itemstack into two output itemstacks. diff --git a/examples/postInit/generated/chisel.groovy b/examples/postInit/generated/chisel.groovy index 45de7143c..32205168a 100644 --- a/examples/postInit/generated/chisel.groovy +++ b/examples/postInit/generated/chisel.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: chisel -log.info 'mod \'chisel\' detected, running script' +log 'mod \'chisel\' detected, running script' // Carving: // Sets a group of items any item can be converted between freely, in world and in a GUI. diff --git a/examples/postInit/generated/compactmachines3.groovy b/examples/postInit/generated/compactmachines3.groovy index 3f9797e14..b4681a8e5 100644 --- a/examples/postInit/generated/compactmachines3.groovy +++ b/examples/postInit/generated/compactmachines3.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: compactmachines3 -log.info 'mod \'compactmachines3\' detected, running script' +log 'mod \'compactmachines3\' detected, running script' // Miniaturization: // Consumes a 3d structure in-world based on keys when an item is thrown into the field. diff --git a/examples/postInit/generated/cyclicmagic.groovy b/examples/postInit/generated/cyclicmagic.groovy index d721b40cd..188252686 100644 --- a/examples/postInit/generated/cyclicmagic.groovy +++ b/examples/postInit/generated/cyclicmagic.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: cyclicmagic -log.info 'mod \'cyclicmagic\' detected, running script' +log 'mod \'cyclicmagic\' detected, running script' // DeHydrator: // Converts an input itemstack into an output itemstack. diff --git a/examples/postInit/generated/draconicevolution.groovy b/examples/postInit/generated/draconicevolution.groovy index 36c0e832a..3a0c0660e 100644 --- a/examples/postInit/generated/draconicevolution.groovy +++ b/examples/postInit/generated/draconicevolution.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: draconicevolution -log.info 'mod \'draconicevolution\' detected, running script' +log 'mod \'draconicevolution\' detected, running script' // Energy Core: // A multiblock with 8 tiers for storing large amounts of energy. diff --git a/examples/postInit/generated/enderio.groovy b/examples/postInit/generated/enderio.groovy index e338ee8d3..7174cf237 100644 --- a/examples/postInit/generated/enderio.groovy +++ b/examples/postInit/generated/enderio.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: enderio -log.info 'mod \'enderio\' detected, running script' +log 'mod \'enderio\' detected, running script' // Alloy Smelter: // Convert up to 3 itemstack inputs into an itemstack output, using energy and giving XP. Can be restricted to require a diff --git a/examples/postInit/generated/erebus.groovy b/examples/postInit/generated/erebus.groovy index ce766c6e0..4119337a8 100644 --- a/examples/postInit/generated/erebus.groovy +++ b/examples/postInit/generated/erebus.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: erebus -log.info 'mod \'erebus\' detected, running script' +log 'mod \'erebus\' detected, running script' // Organic Composter: // Converts valid items into compost. The Blacklist blocks all ItemStacks on it from being used, the Material list allows diff --git a/examples/postInit/generated/essentialcraft.groovy b/examples/postInit/generated/essentialcraft.groovy index 0c47a4e35..6604c9b22 100644 --- a/examples/postInit/generated/essentialcraft.groovy +++ b/examples/postInit/generated/essentialcraft.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: essentialcraft -log.info 'mod \'essentialcraft\' detected, running script' +log 'mod \'essentialcraft\' detected, running script' // Demon Trade: // Adds an item that can be sold to Demons to obtain Ackronite. Note that each demon that spawns has a random item that it diff --git a/examples/postInit/generated/evilcraft.groovy b/examples/postInit/generated/evilcraft.groovy index 944fa1af0..0ccc05914 100644 --- a/examples/postInit/generated/evilcraft.groovy +++ b/examples/postInit/generated/evilcraft.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: evilcraft -log.info 'mod \'evilcraft\' detected, running script' +log 'mod \'evilcraft\' detected, running script' // Blood Infuser: // Consumes an item, some fluid, and requires a given tier of Promise of Tenacity to produce the output and some experience diff --git a/examples/postInit/generated/extendedcrafting.groovy b/examples/postInit/generated/extendedcrafting.groovy index 95ab7fb07..0db3c0803 100644 --- a/examples/postInit/generated/extendedcrafting.groovy +++ b/examples/postInit/generated/extendedcrafting.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: extendedcrafting -log.info 'mod \'extendedcrafting\' detected, running script' +log 'mod \'extendedcrafting\' detected, running script' // Combination Crafting: // Converts one main item and any number of additional items into an output itemstack, with a configurable rf cost and diff --git a/examples/postInit/generated/extrabotany.groovy b/examples/postInit/generated/extrabotany.groovy index 0e764f377..36214f473 100644 --- a/examples/postInit/generated/extrabotany.groovy +++ b/examples/postInit/generated/extrabotany.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: extrabotany -log.info 'mod \'extrabotany\' detected, running script' +log 'mod \'extrabotany\' detected, running script' // Livingrock Pedestal: // Converts an input item into an output itemstack when placed inside a Livingrock Pedestal and interacted with by an Extra diff --git a/examples/postInit/generated/extrautils2.groovy b/examples/postInit/generated/extrautils2.groovy index a8d84edcb..089bac062 100644 --- a/examples/postInit/generated/extrautils2.groovy +++ b/examples/postInit/generated/extrautils2.groovy @@ -5,7 +5,7 @@ import com.rwtema.extrautils2.power.IWorldPowerMultiplier import com.rwtema.extrautils2.tile.TilePassiveGenerator -log.info 'mod \'extrautils2\' detected, running script' +log 'mod \'extrautils2\' detected, running script' // Crusher: // Converts an input itemstack into an output itemstack with a chance of an additional itemstack output, consuming energy. diff --git a/examples/postInit/generated/factorytech.groovy b/examples/postInit/generated/factorytech.groovy index 9e26dae09..885a48c6b 100644 --- a/examples/postInit/generated/factorytech.groovy +++ b/examples/postInit/generated/factorytech.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: factorytech -log.info 'mod \'factorytech\' detected, running script' +log 'mod \'factorytech\' detected, running script' // Fluid Agitator: // Converts either one or two input fluidstacks and up to one input itemstack into an output itemstack, output fluidstack, diff --git a/examples/postInit/generated/futuremc.groovy b/examples/postInit/generated/futuremc.groovy index ca93e4f02..dca27c043 100644 --- a/examples/postInit/generated/futuremc.groovy +++ b/examples/postInit/generated/futuremc.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: futuremc -log.info 'mod \'futuremc\' detected, running script' +log 'mod \'futuremc\' detected, running script' // Blast Furnace: // Converts an input itemstack into an output itemstack at the cost of burnable fuel. diff --git a/examples/postInit/generated/horsepower.groovy b/examples/postInit/generated/horsepower.groovy index 7713bf2ae..e3f515a6a 100644 --- a/examples/postInit/generated/horsepower.groovy +++ b/examples/postInit/generated/horsepower.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: horsepower -log.info 'mod \'horsepower\' detected, running script' +log 'mod \'horsepower\' detected, running script' // Horse Chopping Block: // Converts an itemstack input into an itemstack output, with the chance of an additional output after a configurable diff --git a/examples/postInit/generated/iceandfire.groovy b/examples/postInit/generated/iceandfire.groovy index 1870b1761..2f7f088f0 100644 --- a/examples/postInit/generated/iceandfire.groovy +++ b/examples/postInit/generated/iceandfire.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: iceandfire -log.info 'mod \'iceandfire\' detected, running script' +log 'mod \'iceandfire\' detected, running script' // Fire Dragonforge: // Converts two input itemstacks into an output itemstack in a multiblock Dragonforge Fire Multiblock while there is a diff --git a/examples/postInit/generated/immersiveengineering.groovy b/examples/postInit/generated/immersiveengineering.groovy index 11e67ff60..89d32530e 100644 --- a/examples/postInit/generated/immersiveengineering.groovy +++ b/examples/postInit/generated/immersiveengineering.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: immersiveengineering -log.info 'mod \'immersiveengineering\' detected, running script' +log 'mod \'immersiveengineering\' detected, running script' // Alloy Kiln: // Converts two input itemstacks into an output itemstack, consuming fuel (based on burn time). diff --git a/examples/postInit/generated/immersivepetroleum.groovy b/examples/postInit/generated/immersivepetroleum.groovy index f1202856b..4b936a7cb 100644 --- a/examples/postInit/generated/immersivepetroleum.groovy +++ b/examples/postInit/generated/immersivepetroleum.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: immersivepetroleum -log.info 'mod \'immersivepetroleum\' detected, running script' +log 'mod \'immersivepetroleum\' detected, running script' // Distillation Tower: // Converts an input fluidstack into any number of output fluidstacks and any number of output itemstacks, with each diff --git a/examples/postInit/generated/immersivetech.groovy b/examples/postInit/generated/immersivetech.groovy index 02c3b2899..8548ddc4c 100644 --- a/examples/postInit/generated/immersivetech.groovy +++ b/examples/postInit/generated/immersivetech.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: immersivetech -log.info 'mod \'immersivetech\' detected, running script' +log 'mod \'immersivetech\' detected, running script' // Boiler: // Converts an input fluidstack into an output fluidstack after a given amount of time in a multiblock structure when the diff --git a/examples/postInit/generated/industrialforegoing.groovy b/examples/postInit/generated/industrialforegoing.groovy index e5d4200eb..9a3c1e00c 100644 --- a/examples/postInit/generated/industrialforegoing.groovy +++ b/examples/postInit/generated/industrialforegoing.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: industrialforegoing -log.info 'mod \'industrialforegoing\' detected, running script' +log 'mod \'industrialforegoing\' detected, running script' // Bioreactor: // Converts an input item into Biofuel, with the amount of Biofuel generated being based on the number of concurrent diff --git a/examples/postInit/generated/inspirations.groovy b/examples/postInit/generated/inspirations.groovy index 3d7641d68..5f5d0bc62 100644 --- a/examples/postInit/generated/inspirations.groovy +++ b/examples/postInit/generated/inspirations.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: inspirations -log.info 'mod \'inspirations\' detected, running script' +log 'mod \'inspirations\' detected, running script' // Anvil Smashing: // Converts a Block or IBlockState into an IBlockState when an anvil falls on top of it (from any height). diff --git a/examples/postInit/generated/integrateddynamics.groovy b/examples/postInit/generated/integrateddynamics.groovy index 77d5233f3..11200958e 100644 --- a/examples/postInit/generated/integrateddynamics.groovy +++ b/examples/postInit/generated/integrateddynamics.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: integrateddynamics -log.info 'mod \'integrateddynamics\' detected, running script' +log 'mod \'integrateddynamics\' detected, running script' // Drying Basin: // Takes either an item or fluid input and gives either an item or fluid output after a duration. diff --git a/examples/postInit/generated/jei.groovy b/examples/postInit/generated/jei.groovy index c17ae6c8b..0f848c421 100644 --- a/examples/postInit/generated/jei.groovy +++ b/examples/postInit/generated/jei.groovy @@ -4,7 +4,7 @@ import mezz.jei.api.ingredients.VanillaTypes -log.info 'mod \'jei\' detected, running script' +log 'mod \'jei\' detected, running script' // Category Catalysts: // Modify the items shown on the left of JEI Categories which indicate where the recipe takes place. diff --git a/examples/postInit/generated/magneticraft.groovy b/examples/postInit/generated/magneticraft.groovy index c1eea6898..415ce9e42 100644 --- a/examples/postInit/generated/magneticraft.groovy +++ b/examples/postInit/generated/magneticraft.groovy @@ -4,7 +4,7 @@ import com.cout970.magneticraft.api.registries.machines.hydraulicpress.HydraulicPressMode -log.info 'mod \'magneticraft\' detected, running script' +log 'mod \'magneticraft\' detected, running script' // Crushing Table: // Converts an input itemstack into an output itemstack when placed on top of the Crushing Table and interacted with by a diff --git a/examples/postInit/generated/mekanism.groovy b/examples/postInit/generated/mekanism.groovy index b015b82d2..bfe8288a3 100644 --- a/examples/postInit/generated/mekanism.groovy +++ b/examples/postInit/generated/mekanism.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: mekanism -log.info 'mod \'mekanism\' detected, running script' +log 'mod \'mekanism\' detected, running script' // Infusion: // Add new infusion types and itemstacks to those types. diff --git a/examples/postInit/generated/minecraft.groovy b/examples/postInit/generated/minecraft.groovy index c929d7505..69372e8e6 100644 --- a/examples/postInit/generated/minecraft.groovy +++ b/examples/postInit/generated/minecraft.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: minecraft -log.info 'mod \'minecraft\' detected, running script' +log 'mod \'minecraft\' detected, running script' // Custom Commands: // Create custom commands, either generally or specifically for the client. diff --git a/examples/postInit/generated/mysticalagriculture.groovy b/examples/postInit/generated/mysticalagriculture.groovy index 2fc7ddb4b..9e9279673 100644 --- a/examples/postInit/generated/mysticalagriculture.groovy +++ b/examples/postInit/generated/mysticalagriculture.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: mysticalagriculture -log.info 'mod \'mysticalagriculture\' detected, running script' +log 'mod \'mysticalagriculture\' detected, running script' // Seed Reprocessor: // Converts an input itemstack into an output itemstack, taking a set amount of time based on the machine and consuming diff --git a/examples/postInit/generated/naturesaura.groovy b/examples/postInit/generated/naturesaura.groovy index 86c6bd87a..5da760ba4 100644 --- a/examples/postInit/generated/naturesaura.groovy +++ b/examples/postInit/generated/naturesaura.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: naturesaura -log.info 'mod \'naturesaura\' detected, running script' +log 'mod \'naturesaura\' detected, running script' // Natural Altar Infusion: // Converts an input itemstack into an itemstack in a multiblock structure, with an optional catalyst block, costing aura diff --git a/examples/postInit/generated/pneumaticcraft.groovy b/examples/postInit/generated/pneumaticcraft.groovy index f5eaac5ec..804d83b7e 100644 --- a/examples/postInit/generated/pneumaticcraft.groovy +++ b/examples/postInit/generated/pneumaticcraft.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: pneumaticcraft -log.info 'mod \'pneumaticcraft\' detected, running script' +log 'mod \'pneumaticcraft\' detected, running script' // Amadron: // Uses an Amadron Tablet and linked inventories in world to trade via drones. diff --git a/examples/postInit/generated/primal_tech.groovy b/examples/postInit/generated/primal_tech.groovy index 00cbd9f47..498c1e48c 100644 --- a/examples/postInit/generated/primal_tech.groovy +++ b/examples/postInit/generated/primal_tech.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: primal_tech -log.info 'mod \'primal_tech\' detected, running script' +log 'mod \'primal_tech\' detected, running script' // Clay Kiln: // Converts an input item into an output itemstack after a given amount of time. Requires the block below to be Minecraft diff --git a/examples/postInit/generated/prodigytech.groovy b/examples/postInit/generated/prodigytech.groovy index 3186174de..facd1aa81 100644 --- a/examples/postInit/generated/prodigytech.groovy +++ b/examples/postInit/generated/prodigytech.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: prodigytech -log.info 'mod \'prodigytech\' detected, running script' +log 'mod \'prodigytech\' detected, running script' // Atomic Reshaper: // Uses Hot Air and Primordium to convert items. Can have a weighted random based output. diff --git a/examples/postInit/generated/projecte.groovy b/examples/postInit/generated/projecte.groovy index 77fd74a1f..ca96480d2 100644 --- a/examples/postInit/generated/projecte.groovy +++ b/examples/postInit/generated/projecte.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: projecte -log.info 'mod \'projecte\' detected, running script' +log 'mod \'projecte\' detected, running script' // Entity Randomizer: // Converts an entity on the list into a random other entity on the list when a projectile fired from the Philosopher's diff --git a/examples/postInit/generated/pyrotech.groovy b/examples/postInit/generated/pyrotech.groovy index bccda9577..36a4e2d1b 100644 --- a/examples/postInit/generated/pyrotech.groovy +++ b/examples/postInit/generated/pyrotech.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: pyrotech -log.info 'mod \'pyrotech\' detected, running script' +log 'mod \'pyrotech\' detected, running script' // Anvil: // When using hammer or pickaxe it can convert items. diff --git a/examples/postInit/generated/quarryplus.groovy b/examples/postInit/generated/quarryplus.groovy index 66c8f1d7c..81569880d 100644 --- a/examples/postInit/generated/quarryplus.groovy +++ b/examples/postInit/generated/quarryplus.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: quarryplus -log.info 'mod \'quarryplus\' detected, running script' +log 'mod \'quarryplus\' detected, running script' // Workbench Plus: // Converts up to 27 itemstacks into an output itemstack at the cost of power. diff --git a/examples/postInit/generated/randomthings.groovy b/examples/postInit/generated/randomthings.groovy index 2702ea6fe..7403c1596 100644 --- a/examples/postInit/generated/randomthings.groovy +++ b/examples/postInit/generated/randomthings.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: randomthings -log.info 'mod \'randomthings\' detected, running script' +log 'mod \'randomthings\' detected, running script' // Anvil Crafting: // Converts two itemstacks into an itemstack in the Vanilla Anvil. diff --git a/examples/postInit/generated/roots.groovy b/examples/postInit/generated/roots.groovy index 5236f3a0a..d87d5ef18 100644 --- a/examples/postInit/generated/roots.groovy +++ b/examples/postInit/generated/roots.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: roots -log.info 'mod \'roots\' detected, running script' +log 'mod \'roots\' detected, running script' // Animal Harvest: // Animal Harvest is a ritual that drops items from nearby mob's based on that mobs loottable without harming the mob. Only diff --git a/examples/postInit/generated/rustic.groovy b/examples/postInit/generated/rustic.groovy index 1e65ddc8c..59599bf9a 100644 --- a/examples/postInit/generated/rustic.groovy +++ b/examples/postInit/generated/rustic.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: rustic -log.info 'mod \'rustic\' detected, running script' +log 'mod \'rustic\' detected, running script' // Alchemy Condenser: // Converts some number of input itemstacks and a fluidstack into a single output stack after a time in a small multiblock diff --git a/examples/postInit/generated/silentgems.groovy b/examples/postInit/generated/silentgems.groovy index c4e680ac5..414fcee34 100644 --- a/examples/postInit/generated/silentgems.groovy +++ b/examples/postInit/generated/silentgems.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: silentgems -log.info 'mod \'silentgems\' detected, running script' +log 'mod \'silentgems\' detected, running script' // Chaos Altar: // Converts an input itemstack into an output itemstack with an optional catalyst, consuming a specified amount of Chaos diff --git a/examples/postInit/generated/tconstruct.groovy b/examples/postInit/generated/tconstruct.groovy index 21c49061a..32ab92093 100644 --- a/examples/postInit/generated/tconstruct.groovy +++ b/examples/postInit/generated/tconstruct.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: tconstruct -log.info 'mod \'tconstruct\' detected, running script' +log 'mod \'tconstruct\' detected, running script' // Alloying: // Modifies what fluids can be mixed together in the Smeltery. diff --git a/examples/postInit/generated/techreborn.groovy b/examples/postInit/generated/techreborn.groovy index 6f0db5513..3a32295de 100644 --- a/examples/postInit/generated/techreborn.groovy +++ b/examples/postInit/generated/techreborn.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: techreborn -log.info 'mod \'techreborn\' detected, running script' +log 'mod \'techreborn\' detected, running script' // Alloy Smelter: // Converts two itemstack inputs into an itemstack output after a given process time, consuming energy per tick. diff --git a/examples/postInit/generated/thaumcraft.groovy b/examples/postInit/generated/thaumcraft.groovy index a5863b13b..14fba3f61 100644 --- a/examples/postInit/generated/thaumcraft.groovy +++ b/examples/postInit/generated/thaumcraft.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: thaumcraft -log.info 'mod \'thaumcraft\' detected, running script' +log 'mod \'thaumcraft\' detected, running script' // Arcane Workbench: // A special crafting table, allowing additional requirements in the form of Vis Crystals, Vis, and having a specific diff --git a/examples/postInit/generated/theaurorian.groovy b/examples/postInit/generated/theaurorian.groovy index cd3c50e97..a04e34b66 100644 --- a/examples/postInit/generated/theaurorian.groovy +++ b/examples/postInit/generated/theaurorian.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: theaurorian -log.info 'mod \'theaurorian\' detected, running script' +log 'mod \'theaurorian\' detected, running script' // Moonlight Forge: // Combines two items to get a third item. Only works at night, and works faster the higher it is placed in the world. diff --git a/examples/postInit/generated/thebetweenlands.groovy b/examples/postInit/generated/thebetweenlands.groovy index c910efbfd..7d125a299 100644 --- a/examples/postInit/generated/thebetweenlands.groovy +++ b/examples/postInit/generated/thebetweenlands.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: thebetweenlands -log.info 'mod \'thebetweenlands\' detected, running script' +log 'mod \'thebetweenlands\' detected, running script' // Animator: // Converts an input item, Life amount from Life Crystals, and Fuel from Sulfur into an output itemstack, summoning an diff --git a/examples/postInit/generated/thermalexpansion.groovy b/examples/postInit/generated/thermalexpansion.groovy index 138401923..3b69444c8 100644 --- a/examples/postInit/generated/thermalexpansion.groovy +++ b/examples/postInit/generated/thermalexpansion.groovy @@ -4,7 +4,7 @@ import cofh.thermalexpansion.util.managers.machine.InsolatorManager -log.info 'mod \'thermalexpansion\' detected, running script' +log 'mod \'thermalexpansion\' detected, running script' // Alchemical Imbuer: // Converts an input fluidstack and input itemstack into an output fluidstack, costing power and taking time based on the diff --git a/examples/postInit/generated/threng.groovy b/examples/postInit/generated/threng.groovy index abe450547..17437c42c 100644 --- a/examples/postInit/generated/threng.groovy +++ b/examples/postInit/generated/threng.groovy @@ -2,7 +2,7 @@ // Auto generated groovyscript example file // MODS_LOADED: threng -log.info 'mod \'threng\' detected, running script' +log 'mod \'threng\' detected, running script' // Fluix Aggregation: // Converts up to 3 input itemstacks into an output itemstack. diff --git a/examples/postInit/generated/woot.groovy b/examples/postInit/generated/woot.groovy index 25723fd2d..ef95539c2 100644 --- a/examples/postInit/generated/woot.groovy +++ b/examples/postInit/generated/woot.groovy @@ -4,7 +4,7 @@ import ipsis.woot.util.WootMobName -log.info 'mod \'woot\' detected, running script' +log 'mod \'woot\' detected, running script' // Drops: // Controls extra drops given by mobs. Chance and Size are both arrays 4 long, containing the values for levels 0/1/2/3 diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index a930b0370..d42a17e58 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -22,7 +22,7 @@ public class Exporter { private static final String INDEX_FILE_NAME = "index.md"; private static final String NAV_FILE_NAME = "!navigation.md"; - private static final String PRINT_MOD_DETECTED = "log.info 'mod \\'%s\\' detected, running script'"; + private static final String PRINT_MOD_DETECTED = "log 'mod \\'%s\\' detected, running script'"; private static final Map> SKIPPED_CLASSES = new Object2ObjectOpenHashMap<>(); From b937611c8e158ec99a179826d84f15dab2ea7f83 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 10 Oct 2025 08:48:54 -0700 Subject: [PATCH 12/92] return boolean for IContainerDocumentation --- .../documentation/IContainerDocumentation.java | 10 ++++++++-- .../compat/mods/MinecraftModContainer.java | 9 ++------- .../documentation/Documentation.java | 17 ++++------------- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/IContainerDocumentation.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/IContainerDocumentation.java index 2e1248dff..4bb8cd5ef 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/IContainerDocumentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/IContainerDocumentation.java @@ -17,15 +17,21 @@ public interface IContainerDocumentation { * * @param suggestedFile the default file that the example code is suggested to be generated in. * @param stage the load stage the examples are being generated for. + * @return if the normal generation method should occur * @see com.cleanroommc.groovyscript.documentation.Exporter#generateExamples(File, LoadStage, GroovyContainer) */ - void generateExamples(File suggestedFile, LoadStage stage); + default boolean generateExamples(File suggestedFile, LoadStage stage) { + return true; + } /** * Generate pages for the wiki in this method. * * @param suggestedFolder the default folder that the wiki is suggested to be generated in. + * @return if the normal generation method should occur * @see com.cleanroommc.groovyscript.documentation.Exporter#generateWiki(File, GroovyContainer) */ - void generateWiki(File suggestedFolder); + default boolean generateWiki(File suggestedFolder) { + return true; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java index 732ce32db..676a09444 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java @@ -5,7 +5,6 @@ import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; import com.cleanroommc.groovyscript.documentation.Documentation; import com.cleanroommc.groovyscript.documentation.Exporter; -import com.cleanroommc.groovyscript.sandbox.LoadStage; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; @@ -68,12 +67,7 @@ public VanillaModule get() { public void onCompatLoaded(GroovyContainer container) {} @Override - public void generateExamples(File suggestedFile, LoadStage stage) { - Exporter.generateExamples(suggestedFile, stage, this); - } - - @Override - public void generateWiki(File suggestedFolder) { + public boolean generateWiki(File suggestedFolder) { var minecraftCompatFolder = new File(new File(Documentation.WIKI, "minecraft"), "helpers"); try { Files.createDirectories(minecraftCompatFolder.toPath()); @@ -82,5 +76,6 @@ public void generateWiki(File suggestedFolder) { } catch (IOException e) { GroovyScript.LOGGER.throwing(e); } + return false; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java index d197441e1..d717961e9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java @@ -1,7 +1,6 @@ package com.cleanroommc.groovyscript.documentation; import com.cleanroommc.groovyscript.GroovyScript; -import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.documentation.IContainerDocumentation; import com.cleanroommc.groovyscript.compat.mods.GroovyContainer; import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; @@ -55,9 +54,7 @@ private static void generateExamples(boolean log) { for (GroovyContainer mod : ModSupport.getAllContainers()) { if (!mod.isLoaded()) continue; File file = new File(generatedFolder, mod.getModId() + ".groovy"); - if (mod instanceof IContainerDocumentation doc) { - doc.generateExamples(file, stage); - } else { + if (!(mod instanceof IContainerDocumentation doc) || doc.generateExamples(file, stage)) { Exporter.generateExamples(file, stage, mod); } } @@ -72,7 +69,6 @@ public static void generateWiki() { generateWiki(true); } - private static void generateWiki(boolean log) { try { Files.createDirectories(WIKI.toPath()); @@ -80,14 +76,9 @@ private static void generateWiki(boolean log) { for (GroovyContainer mod : ModSupport.getAllContainers()) { if (!mod.isLoaded()) continue; File target = new File(MODS, mod.getModId()); - if (mod instanceof IContainerDocumentation doc) { - doc.generateWiki(target); - } else { - if (target.exists() || Files.createDirectories(target.toPath()) != null) { - Exporter.generateWiki(target, mod); - } else { - GroovyLog.get().error("Error creating file at {} to generate wiki files in", target); - } + if (!(mod instanceof IContainerDocumentation doc) || doc.generateWiki(target)) { + Files.createDirectories(target.toPath()); + Exporter.generateWiki(target, mod); } } } catch (IOException e) { From a393f04574c6f751d6e45f323f2a4b1f05937cb6 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 10 Oct 2025 08:57:21 -0700 Subject: [PATCH 13/92] use IGroovyContainer for doc --- .../groovyscript/documentation/Exporter.java | 31 ++++++++++++------- .../groovyscript/documentation/Registry.java | 17 +++++----- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index d42a17e58..b80d46a25 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -2,6 +2,7 @@ import com.cleanroommc.groovyscript.GroovyScript; import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IGroovyContainer; import com.cleanroommc.groovyscript.api.INamed; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.compat.mods.GroovyContainer; @@ -27,13 +28,17 @@ public class Exporter { private static final Map> SKIPPED_CLASSES = new Object2ObjectOpenHashMap<>(); public static void generateWiki(File targetFolder, GroovyContainer mod) { + generateWiki(targetFolder, mod, mod.get().getRegistries()); + } + + public static void generateWiki(File targetFolder, IGroovyContainer container, Collection registryCollection) { List fileLinks = new ArrayList<>(); Set registries = new HashSet<>(); - for (INamed named : mod.get().getRegistries()) { + for (INamed named : registryCollection) { var annotation = named.getClass().getAnnotation(RegistryDescription.class); if (annotation == null) { - SKIPPED_CLASSES.put(mod.getModId() + "." + named.getName(), named.getClass()); + SKIPPED_CLASSES.put(container.getModId() + "." + named.getName(), named.getClass()); } else { registries.add(named); } @@ -44,7 +49,7 @@ public static void generateWiki(File targetFolder, GroovyContainer { - Registry example = new Registry(mod, registry); + Registry example = new Registry(container, registry); String location = String.format("%s.md", registry.getName()); fileLinks.add(String.format("* [%s](./%s)", example.getTitle(), location)); try { @@ -66,7 +71,7 @@ public static void generateWiki(File targetFolder, GroovyContainer { index.append(line).append("\n\n"); @@ -108,6 +113,10 @@ public static void generateWiki(File targetFolder, GroovyContainer mod) { + generateExamples(targetFile, target, mod, mod.get().getRegistries()); + } + + public static void generateExamples(File targetFile, LoadStage target, IGroovyContainer container, Collection registryCollection) { StringBuilder header = new StringBuilder(); StringBuilder body = new StringBuilder(); @@ -118,15 +127,15 @@ public static void generateExamples(File targetFile, LoadStage target, GroovyCon .append("// Auto generated groovyscript example file") .append("\n") .append("// MODS_LOADED: ") - .append(mod.getModId()) + .append(container.getModId()) .append("\n"); // Iterate through every registry of the mod once, in alphabetical order. Set registries = new HashSet<>(); - for (INamed named : mod.get().getRegistries()) { + for (INamed named : registryCollection) { var annotation = named.getClass().getAnnotation(RegistryDescription.class); if (annotation == null) { - SKIPPED_CLASSES.put(mod.getModId() + "." + named.getName(), named.getClass()); + SKIPPED_CLASSES.put(container.getModId() + "." + named.getName(), named.getClass()); continue; } if (annotation.location() == target) { @@ -139,8 +148,8 @@ public static void generateExamples(File targetFile, LoadStage target, GroovyCon registries.stream() .sorted(ComparisonHelper::iNamed) .forEach(registry -> { - GroovyLog.msg("Generating examples for the mod {} and registry '{}'.", mod.toString(), registry.getName()).debug().post(); - Registry example = new Registry(mod, registry); + GroovyLog.msg("Generating examples for the mod {} and registry '{}'.", container.toString(), registry.getName()).debug().post(); + Registry example = new Registry(container, registry); imports.addAll(example.getImports()); body.append(example.exampleBlock()); }); @@ -150,7 +159,7 @@ public static void generateExamples(File targetFile, LoadStage target, GroovyCon // Print that the script was loaded at the end of the header, after any imports have been added. header.append("\n") - .append(String.format(PRINT_MOD_DETECTED, mod.getModId())) + .append(String.format(PRINT_MOD_DETECTED, container.getModId())) .append("\n\n") .append(body); diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 84fde30a2..9e67f6033 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -1,9 +1,8 @@ package com.cleanroommc.groovyscript.documentation; +import com.cleanroommc.groovyscript.api.IGroovyContainer; import com.cleanroommc.groovyscript.api.INamed; import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.GroovyContainer; -import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; import com.cleanroommc.groovyscript.documentation.helper.AdmonitionBuilder; import com.cleanroommc.groovyscript.documentation.helper.CodeBlockBuilder; import com.cleanroommc.groovyscript.documentation.helper.ComparisonHelper; @@ -28,7 +27,7 @@ public class Registry { public static final String BASE_ACCESS_COMPAT = "mods"; private static final Pattern PERIOD_END_PATTERN = Pattern.compile("\\.$"); - private final GroovyContainer mod; + private final IGroovyContainer container; private final INamed registry; private final String baseTranslationKey; private final String reference; @@ -39,10 +38,10 @@ public class Registry { private final EnumMap>> methods; private final List imports = new ArrayList<>(); - public Registry(GroovyContainer mod, INamed registry) { - this.mod = mod; + public Registry(IGroovyContainer container, INamed registry) { + this.container = container; this.registry = registry; - var location = mod.getModId() + "." + registry.getName(); + var location = container.getModId() + "." + registry.getName(); this.baseTranslationKey = BASE_LANG_LOCATION + "." + location; this.reference = BASE_ACCESS_COMPAT + "." + location; this.registryClass = registry.getClass(); @@ -154,7 +153,7 @@ private String documentMethodDescriptionType(MethodDescription.Type type) { private String generateHeader() { StringBuilder out = new StringBuilder(); out.append("---\n").append("title: \"").append(getTitle()).append("\"\n"); - if (Documentation.DEFAULT_FORMAT.hasTitleTemplate()) out.append("titleTemplate: \"").append(mod).append(" | CleanroomMC").append("\"\n"); + if (Documentation.DEFAULT_FORMAT.hasTitleTemplate()) out.append("titleTemplate: \"").append(container).append(" | CleanroomMC").append("\"\n"); out.append("description: \"").append(getDescription()).append("\"\n"); String link = getFileSourceCodeLink(); if (!link.isEmpty()) out.append("source_code_link: \"").append(link).append("\"\n"); @@ -163,7 +162,7 @@ private String generateHeader() { } private String generateTitle() { - return String.format("# %s (%s)\n\n", getTitle(), mod); + return String.format("# %s (%s)\n\n", getTitle(), container); } private String generateDescription() { @@ -199,7 +198,7 @@ private String generateIdentifier() { StringBuilder out = new StringBuilder(); out.append("## ").append(I18n.format("groovyscript.wiki.identifier")).append("\n\n").append(I18n.format("groovyscript.wiki.import_instructions")).append("\n\n"); - List packages = mod.getAliases() + List packages = container.getAliases() .stream() .flatMap(modID -> registry.getAliases().stream().map(alias -> String.format("%s.%s.%s", Registry.BASE_ACCESS_COMPAT, modID, alias))) .collect(Collectors.toList()); From 3d5e0ead6828013f91ca7dac6864217dec3e543b Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 10 Oct 2025 09:01:21 -0700 Subject: [PATCH 14/92] rename parameter to loadStage --- .../cleanroommc/groovyscript/documentation/Exporter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index b80d46a25..a17c9c056 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -112,11 +112,11 @@ public static void generateWiki(File targetFolder, IGroovyContainer container, C } } - public static void generateExamples(File targetFile, LoadStage target, GroovyContainer mod) { - generateExamples(targetFile, target, mod, mod.get().getRegistries()); + public static void generateExamples(File targetFile, LoadStage loadStage, GroovyContainer mod) { + generateExamples(targetFile, loadStage, mod, mod.get().getRegistries()); } - public static void generateExamples(File targetFile, LoadStage target, IGroovyContainer container, Collection registryCollection) { + public static void generateExamples(File targetFile, LoadStage loadStage, IGroovyContainer container, Collection registryCollection) { StringBuilder header = new StringBuilder(); StringBuilder body = new StringBuilder(); @@ -138,7 +138,7 @@ public static void generateExamples(File targetFile, LoadStage target, IGroovyCo SKIPPED_CLASSES.put(container.getModId() + "." + named.getName(), named.getClass()); continue; } - if (annotation.location() == target) { + if (annotation.location() == loadStage) { registries.add(named); } } From c2e9a53baae1c6290c108f00556777f29460d0c0 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 10 Oct 2025 09:04:05 -0700 Subject: [PATCH 15/92] simplify Registry creation --- .../groovyscript/documentation/Registry.java | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 9e67f6033..5322a2f83 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -29,9 +29,6 @@ public class Registry { private final IGroovyContainer container; private final INamed registry; - private final String baseTranslationKey; - private final String reference; - private final Class registryClass; private final RegistryDescription description; private final Map types; private final List recipeBuilders; @@ -41,13 +38,9 @@ public class Registry { public Registry(IGroovyContainer container, INamed registry) { this.container = container; this.registry = registry; - var location = container.getModId() + "." + registry.getName(); - this.baseTranslationKey = BASE_LANG_LOCATION + "." + location; - this.reference = BASE_ACCESS_COMPAT + "." + location; - this.registryClass = registry.getClass(); - this.description = registryClass.getAnnotation(RegistryDescription.class); - this.types = generateTypes(registryClass); - var methodSignatures = generateOfClass(registryClass); + this.description = registry.getClass().getAnnotation(RegistryDescription.class); + this.types = generateTypes(registry.getClass()); + var methodSignatures = generateOfClass(registry.getClass()); List> recipeBuilderMethods = new ArrayList<>(); this.methods = new EnumMap<>(MethodDescription.Type.class); @@ -61,6 +54,7 @@ public Registry(IGroovyContainer container, INamed registry) { methods.get(entry.annotation().type()).add(entry); addImports(entry.annotation().example()); } + var location = container.getModId() + "." + registry.getName(); this.recipeBuilders = recipeBuilderMethods .stream() .sorted(ComparisonHelper::recipeBuilder) @@ -101,6 +95,14 @@ private static DescriptorHelper.OfClass generateOfClass(Class clazz) { return methodSignatures; } + private String getBaseLangKey() { + return BASE_LANG_LOCATION + "." + container.getModId() + "." + registry.getName(); + } + + private String getReference() { + return BASE_ACCESS_COMPAT + "." + container.getModId() + "." + registry.getName(); + } + private void addImports(Example... examples) { for (var example : examples) Collections.addAll(imports, example.imports()); } @@ -110,16 +112,16 @@ public List getImports() { } public String getFileSourceCodeLink() { - return LinkGeneratorHooks.convert(description.linkGenerator(), registryClass); + return LinkGeneratorHooks.convert(description.linkGenerator(), registry.getClass()); } public String getTitle() { - return LangHelper.translate(description.title().isEmpty() ? String.format("%s.title", baseTranslationKey) : description.title()); + return LangHelper.translate(description.title().isEmpty() ? String.format("%s.title", getBaseLangKey()) : description.title()); } public String getDescription() { return LangHelper.ensurePeriod( - LangHelper.translate(description.description().isEmpty() ? String.format("%s.description", baseTranslationKey) : description.description()) + LangHelper.translate(description.description().isEmpty() ? String.format("%s.description", getBaseLangKey()) : description.description()) .replace("\"", "\\\"")); } @@ -203,8 +205,8 @@ private String generateIdentifier() { .flatMap(modID -> registry.getAliases().stream().map(alias -> String.format("%s.%s.%s", Registry.BASE_ACCESS_COMPAT, modID, alias))) .collect(Collectors.toList()); - int target = packages.indexOf(reference); - packages.set(target, reference + "/*()!*/"); + int target = packages.indexOf(getReference()); + packages.set(target, getReference() + "/*()!*/"); out.append( new CodeBlockBuilder() @@ -308,7 +310,7 @@ public String documentMethods(List> methods, public String methodDescription(MethodAnnotation method) { String lang = method.annotation().description(); - String registryDefault = String.format("%s.%s", baseTranslationKey, method.method().getName()); + String registryDefault = String.format("%s.%s", getBaseLangKey(), method.method().getName()); String globalDefault = String.format("%s.%s", Registry.BASE_LANG_LOCATION, method.method().getName()); if (lang.isEmpty()) { // If the `globalDefault` is not defined, we always want to use `registryDefault` for logging the missing key. @@ -327,11 +329,11 @@ public String methodDescription(MethodAnnotation method) { private String methodExample(Method method, String example) { if (method.getParameterTypes().length == 0) return methodExample(method); - return String.format("%s.%s(%s)", reference, method.getName(), example); + return String.format("%s.%s(%s)", getReference(), method.getName(), example); } private String methodExample(Method method) { - return String.format("%s.%s()", reference, method.getName()); + return String.format("%s.%s()", getReference(), method.getName()); } private String examples(MethodAnnotation method) { @@ -341,7 +343,7 @@ private String examples(MethodAnnotation method) { .forEach(example -> { if (example.commented()) out.append("// "); if (!example.def().isEmpty()) out.append("def ").append(example.def()).append(" = "); - out.append(reference).append(".").append(method.method().getName()); + out.append(getReference()).append(".").append(method.method().getName()); if (example.value().isEmpty()) out.append("()"); else out.append("(").append(example.value()).append(")"); out.append("\n"); From 84244817371a7c04ebfbff07b7d097d3da7065d7 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 14 Oct 2025 13:48:07 -0700 Subject: [PATCH 16/92] use list for inworldcrafting --- .../inworldcrafting/InWorldCrafting.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java index ed0623cef..b4b33e2e3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java @@ -3,10 +3,12 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.IScriptReloadable; import com.cleanroommc.groovyscript.registry.NamedRegistry; +import com.google.common.collect.ImmutableList; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import java.util.List; public class InWorldCrafting extends NamedRegistry implements IScriptReloadable { @@ -17,26 +19,18 @@ public class InWorldCrafting extends NamedRegistry implements IScriptReloadable public final Burning burning = new Burning(); public final PistonPush pistonPush = new PistonPush(); + private final List registries = ImmutableList.of(fluidToFluid, fluidToItem, fluidToBlock, explosion, burning, pistonPush); + @GroovyBlacklist @Override public void onReload() { - this.fluidToFluid.onReload(); - this.fluidToItem.onReload(); - this.fluidToBlock.onReload(); - this.explosion.onReload(); - this.burning.onReload(); - this.pistonPush.onReload(); + registries.forEach(IScriptReloadable::onReload); } @GroovyBlacklist @Override public void afterScriptLoad() { - this.fluidToFluid.afterScriptLoad(); - this.fluidToItem.afterScriptLoad(); - this.fluidToBlock.afterScriptLoad(); - this.explosion.afterScriptLoad(); - this.burning.afterScriptLoad(); - this.pistonPush.afterScriptLoad(); + registries.forEach(IScriptReloadable::afterScriptLoad); } public static EntityItem spawnItem(World world, BlockPos pos, ItemStack item) { From 6ca35b6f6f9daf91b4fd5f51fc92693f3ba46ae7 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 14 Oct 2025 13:52:56 -0700 Subject: [PATCH 17/92] allow a single annotation to target multiple methods --- .../documentation/annotations/MethodDescription.java | 8 ++++---- .../annotations/RecipeBuilderDescription.java | 4 ++-- .../annotations/RecipeBuilderMethodDescription.java | 8 ++++---- .../annotations/RecipeBuilderRegistrationMethod.java | 8 ++++---- .../groovyscript/documentation/Builder.java | 4 ++-- .../groovyscript/documentation/Registry.java | 4 ++-- .../helper/descriptor/DescriptorHelper.java | 11 ++++++++++- 7 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/MethodDescription.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/MethodDescription.java index 598d2f136..da89741ad 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/MethodDescription.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/MethodDescription.java @@ -38,17 +38,17 @@ * If this {@link MethodDescription} annotation is attached to a method, this element is set to the name of the method they are attached to. * When annotated on a method directly, this should not be set, as it has no functionality. *
- * If this is not annotated to a method, this should either be the method name + * If this is not annotated to a method, this should either be an array of each method name * (if only a single method has the given name) - * or needs to be the name and full descriptor of the method. + * or each element needs to be the name and full descriptor of the method. *
* Methods that are bridge, non-public, Object, or methods annotated with {@link com.cleanroommc.groovyscript.api.GroovyBlacklist} * cannot be targeted. * - * @return the target method, if not annotated to a method directly. + * @return any number of target methods, if not annotated to a method directly. * @see MethodOverride */ - String method() default ""; + String[] method() default {}; /** * The localization key for a description of the compat. diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderDescription.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderDescription.java index 77eea1917..365d64508 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderDescription.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderDescription.java @@ -86,10 +86,10 @@ * If this {@link RecipeBuilderDescription} annotation is attached to a method, this element is set to the name of the method they are attached to. * When annotated on a method directly, this should not be set, as it has no functionality. * - * @return the target method, if not annotated to a method directly. + * @return any number of target methods, if not annotated to a method directly. * @see MethodOverride */ - String method() default ""; + String[] method() default {}; /** * The builder class. By default, this will use the return class of the target method. diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderMethodDescription.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderMethodDescription.java index 27a2be03a..e4153db82 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderMethodDescription.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderMethodDescription.java @@ -30,17 +30,17 @@ * If this {@link RecipeBuilderMethodDescription} annotation is attached to a method, this element is set to the name of the method they are attached to. * When annotated on a method directly, this should not be set, as it has no functionality. *
- * If this is not annotated to a method, this should either be the method name + * If this is not annotated to a method, this should either be an array of each method name * (if only a single method has the given name) - * or needs to be the name and full descriptor of the method. + * or each element needs to be the name and full descriptor of the method. *
* Methods that are bridge, non-public, Object, or methods annotated with {@link com.cleanroommc.groovyscript.api.GroovyBlacklist} * cannot be targeted. * - * @return the target method, if not annotated to a method directly. + * @return any number of target methods, if not annotated to a method directly. * @see RecipeBuilderOverride */ - String method() default ""; + String[] method() default {}; /** * An array of all fields this method modifies. By default, it checks for a field with the same name as the method. diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderRegistrationMethod.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderRegistrationMethod.java index ca5eb5e58..7c3e0bd00 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderRegistrationMethod.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderRegistrationMethod.java @@ -32,17 +32,17 @@ * If this {@link RecipeBuilderDescription} annotation is attached to a method, this element is set to the name of the method they are attached to. * When annotated on a method directly, this should not be set, as it has no functionality. *
- * If this is not annotated to a method, this should either be the method name + * If this is not annotated to a method, this should either be an array of each method name * (if only a single method has the given name) - * or needs to be the name and full descriptor of the method. + * or each element needs to be the name and full descriptor of the method. *
* Methods that are bridge, non-public, Object, or methods annotated with {@link com.cleanroommc.groovyscript.api.GroovyBlacklist} * cannot be targeted. * - * @return the target method, if not annotated to a method directly. + * @return any number of target methods, if not annotated to a method directly. * @see MethodOverride */ - String method() default ""; + String[] method() default {}; /** * Hierarchy of the property, relative to other properties applying to the same method. diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java index f0ad300f1..daf75a401 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java @@ -60,10 +60,10 @@ private static DescriptorHelper.OfClass generateOfClass(Class clazz, RecipeBu if (annotation != null) { var override = annotation.override(); for (var entry : override.method()) { - methodSignatures.addAnnotation(entry.method(), entry); + methodSignatures.addAnnotation(entry, entry.method()); } for (var entry : override.register()) { - methodSignatures.addAnnotation(entry.method(), entry); + methodSignatures.addAnnotation(entry, entry.method()); } } return methodSignatures; diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 5322a2f83..d379e4d05 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -86,10 +86,10 @@ private static DescriptorHelper.OfClass generateOfClass(Class clazz) { if (description != null) { var override = description.override(); for (var annotation : override.method()) { - methodSignatures.addAnnotation(annotation.method(), annotation); + methodSignatures.addAnnotation(annotation, annotation.method()); } for (var annotation : override.recipeBuilder()) { - methodSignatures.addAnnotation(annotation.method(), annotation); + methodSignatures.addAnnotation(annotation, annotation.method()); } } return methodSignatures; diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/descriptor/DescriptorHelper.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/descriptor/DescriptorHelper.java index 1ddf87389..1febf6c45 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/descriptor/DescriptorHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/descriptor/DescriptorHelper.java @@ -234,10 +234,19 @@ public void addAnnotation(Method method, Annotation annotation) { .add(new MethodAnnotation<>(method, annotation)); } + /** + * @see #addAnnotation(Annotation, String) + */ + public void addAnnotation(Annotation annotation, String[] methods) { + for (String method : methods) { + addAnnotation(annotation, method); + } + } + /** * @see #addAnnotation(Method, Annotation) */ - public void addAnnotation(String method, Annotation annotation) { + public void addAnnotation(Annotation annotation, String method) { addAnnotation(getMethod(method), annotation); } From 0da636b85e46edcbe27e0d750cffef83afc9ce1a Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 14 Oct 2025 13:53:27 -0700 Subject: [PATCH 18/92] refactor recursive annotation fetching --- .../groovyscript/documentation/Builder.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java index daf75a401..06cc7729a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java @@ -69,11 +69,11 @@ private static DescriptorHelper.OfClass generateOfClass(Class clazz, RecipeBu return methodSignatures; } - private static List getPropertyAnnotationsFromClassRecursive(Class clazz) { - List list = new ArrayList<>(); - Collections.addAll(list, clazz.getAnnotationsByType(Property.class)); + private static List getAnnotationsFromClassRecursive(Class annotation, Class clazz) { + List list = new ArrayList<>(); + Collections.addAll(list, clazz.getAnnotationsByType(annotation)); Class superclass = clazz.getSuperclass(); - if (superclass != null) list.addAll(getPropertyAnnotationsFromClassRecursive(superclass)); + if (superclass != null) list.addAll(getAnnotationsFromClassRecursive(annotation, superclass)); return list; } @@ -87,7 +87,7 @@ private static Map gatherFields(Class builderClas // Attached to the builder method's override of the requirements field, an uncommon location for specific overrides Arrays.stream(annotation.override().requirement()).filter(r -> r.property().equals(field.getName())), // Attached to the class or any parent classes, to create/override requirements set in the parent - getPropertyAnnotationsFromClassRecursive(builderClass).stream().filter(r -> r.property().equals(field.getName())), + getAnnotationsFromClassRecursive(Property.class, builderClass).stream().filter(r -> r.property().equals(field.getName())), // Attached to the field, the typical place for property information to be created Arrays.stream(field.getAnnotationsByType(Property.class)).filter(r -> { if (r.property().isEmpty() || r.property().equals(field.getName())) return true; From 4fe71f08bbb38355243b162deaed8c4553617d8a Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 14 Oct 2025 13:53:52 -0700 Subject: [PATCH 19/92] gather recursive annotations for RBMD/RBRM --- .../com/cleanroommc/groovyscript/documentation/Builder.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java index 06cc7729a..75b2f7509 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java @@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; +import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.*; @@ -66,6 +67,8 @@ private static DescriptorHelper.OfClass generateOfClass(Class clazz, RecipeBu methodSignatures.addAnnotation(entry, entry.method()); } } + getAnnotationsFromClassRecursive(RecipeBuilderMethodDescription.class, clazz).forEach(x -> methodSignatures.addAnnotation(x, x.method())); + getAnnotationsFromClassRecursive(RecipeBuilderRegistrationMethod.class, clazz).forEach(x -> methodSignatures.addAnnotation(x, x.method())); return methodSignatures; } From 4213ee558d45da1b6e068ac7b7af848d26ddf6e2 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 14 Oct 2025 13:57:08 -0700 Subject: [PATCH 20/92] extract try-catch IO in Documentation, simplify --- .../documentation/Documentation.java | 60 +++++++++---------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java index d717961e9..76dcb6547 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java @@ -2,8 +2,6 @@ import com.cleanroommc.groovyscript.GroovyScript; import com.cleanroommc.groovyscript.api.documentation.IContainerDocumentation; -import com.cleanroommc.groovyscript.compat.mods.GroovyContainer; -import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.documentation.format.IFormat; import com.cleanroommc.groovyscript.documentation.format.OutputFormat; @@ -25,9 +23,12 @@ public class Documentation { public static final int MAX_LINE_LENGTH = 120; public static final boolean USE_DEFAULT_BRANCH = FMLLaunchHandler.isDeobfuscatedEnvironment(); + public static final String GROOVY_FILE_EXTENSION = ".groovy"; + public static final File EXAMPLES = new File(GroovyScript.getScriptPath()); public static final File WIKI = new File(new File(GroovyScript.getScriptFile().getParentFile(), "build"), "wiki"); - public static final File MODS = new File(WIKI, "mods"); + public static final File WIKI_MODS = new File(WIKI, "mods"); + public static final File WIKI_MINECRAFT = new File(WIKI, "minecraft"); public static final IFormat DEFAULT_FORMAT = OutputFormat.VITEPRESS; @@ -38,29 +39,33 @@ public static void generate() { if (GenerationFlags.GENERATE_AND_CRASH) FMLCommonHandler.instance().exitJava(0, false); } + public static void ensureDirectoryExists(File folder) { + try { + Files.createDirectories(folder.toPath()); + } catch (IOException e) { + GroovyScript.LOGGER.throwing(e); + } + } + + public static File generatedFolder(LoadStage stage) { + return new File(new File(EXAMPLES, stage.getName()), "generated"); + } + public static void generateExamples() { generateExamples(true); } private static void generateExamples(boolean log) { - try { - Files.createDirectories(EXAMPLES.toPath()); - for (LoadStage stage : LoadStage.getLoadStages()) { - File stageFolder = new File(EXAMPLES, stage.getName()); - File generatedFolder = new File(stageFolder, "generated"); - Files.createDirectories(stageFolder.toPath()); - Files.createDirectories(generatedFolder.toPath()); - - for (GroovyContainer mod : ModSupport.getAllContainers()) { - if (!mod.isLoaded()) continue; - File file = new File(generatedFolder, mod.getModId() + ".groovy"); - if (!(mod instanceof IContainerDocumentation doc) || doc.generateExamples(file, stage)) { - Exporter.generateExamples(file, stage, mod); - } + for (LoadStage stage : LoadStage.getLoadStages()) { + File generatedFolder = generatedFolder(stage); + ensureDirectoryExists(generatedFolder); + for (var container : ModSupport.getAllContainers()) { + if (!container.isLoaded()) continue; + File file = new File(generatedFolder, container.getModId() + GROOVY_FILE_EXTENSION); + if (!(container instanceof IContainerDocumentation doc) || doc.generateExamples(file, stage)) { + Exporter.generateExamples(file, stage, container); } } - } catch (IOException e) { - GroovyScript.LOGGER.throwing(e); } if (log) logMissing(); } @@ -70,19 +75,12 @@ public static void generateWiki() { } private static void generateWiki(boolean log) { - try { - Files.createDirectories(WIKI.toPath()); - Files.createDirectories(MODS.toPath()); - for (GroovyContainer mod : ModSupport.getAllContainers()) { - if (!mod.isLoaded()) continue; - File target = new File(MODS, mod.getModId()); - if (!(mod instanceof IContainerDocumentation doc) || doc.generateWiki(target)) { - Files.createDirectories(target.toPath()); - Exporter.generateWiki(target, mod); - } + for (var container : ModSupport.getAllContainers()) { + if (!container.isLoaded()) continue; + File target = new File(WIKI_MODS, container.getModId()); + if (!(container instanceof IContainerDocumentation doc) || doc.generateWiki(target)) { + Exporter.generateWiki(target, container); } - } catch (IOException e) { - GroovyScript.LOGGER.throwing(e); } if (log) logMissing(); } From e6b1688cbe920ff66e69ce3ea4fc0c6396b37931 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 14 Oct 2025 13:59:14 -0700 Subject: [PATCH 21/92] move VALUE method examples to first --- .../com/cleanroommc/groovyscript/documentation/Registry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index d379e4d05..efac0efd6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -129,13 +129,13 @@ public String exampleBlock() { StringBuilder out = new StringBuilder(); out.append("// ").append(getTitle()).append(":").append("\n"); out.append("// ").append(WordUtils.wrap(getDescription(), Documentation.MAX_LINE_LENGTH, "\n// ", false)).append("\n\n"); + out.append(documentMethodDescriptionType(MethodDescription.Type.VALUE)); out.append(documentMethodDescriptionType(MethodDescription.Type.REMOVAL)); if (!recipeBuilders.isEmpty()) { for (var builder : recipeBuilders) out.append(builder.builderExampleFile()).append("\n"); out.append("\n"); } out.append(documentMethodDescriptionType(MethodDescription.Type.ADDITION)); - out.append(documentMethodDescriptionType(MethodDescription.Type.VALUE)); out.append(documentMethodDescriptionType(MethodDescription.Type.QUERY)); return out.toString(); } From c02bd628a7d88ecee086153cacd07457c45d8e44 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 14 Oct 2025 14:17:13 -0700 Subject: [PATCH 22/92] pass lang key into builder --- .../groovyscript/documentation/Builder.java | 14 ++++++++------ .../groovyscript/documentation/Registry.java | 3 +-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java index 75b2f7509..7929ec102 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java @@ -39,19 +39,21 @@ public class Builder { }; private final String location; + private final String langLocation; private final Method builderMethod; private final RecipeBuilderDescription annotation; private final Map fields; private final Map>> methods; private final List> registrationMethods; - public Builder(Method builderMethod, RecipeBuilderDescription annotation, String location) { + public Builder(Method builderMethod, RecipeBuilderDescription annotation, String location, String langLocation) { this.builderMethod = builderMethod; this.location = location; + this.langLocation = langLocation; this.annotation = annotation; Class builderClass = annotation.clazz() == void.class ? builderMethod.getReturnType() : annotation.clazz(); var methodSignatures = generateOfClass(builderClass, annotation); - this.fields = gatherFields(builderClass, annotation, Registry.BASE_LANG_LOCATION + "." + location); + this.fields = gatherFields(builderClass, annotation, langLocation); this.methods = gatherMethods(methodSignatures, fields); this.registrationMethods = gatherRegistrationMethods(methodSignatures); } @@ -355,7 +357,7 @@ public boolean hasComplexMethod() { private String title() { String lang = annotation.title(); - String registryDefault = String.format("%s.%s.%s.title", Registry.BASE_LANG_LOCATION, location, builderMethod.getName()); + String registryDefault = String.format("%s.%s.title", langLocation, builderMethod.getName()); String globalDefault = String.format("%s.recipe_builder.title", Registry.BASE_LANG_LOCATION); if (lang.isEmpty()) { @@ -369,7 +371,7 @@ private String title() { public String creationMethod() { StringBuilder out = new StringBuilder(); String lang = annotation.description(); - String registryDefault = String.format("%s.%s.%s.description", Registry.BASE_LANG_LOCATION, location, builderMethod.getName()); + String registryDefault = String.format("%s.%s.description", langLocation, builderMethod.getName()); String globalDefault = String.format("%s.recipe_builder.description", Registry.BASE_LANG_LOCATION); if (lang.isEmpty()) { @@ -378,7 +380,7 @@ public String creationMethod() { else lang = globalDefault; } - var example = Registry.BASE_ACCESS_COMPAT + "." + location + "." + DescriptorHelper.shortSignature(builderMethod); + var example = location + "." + DescriptorHelper.shortSignature(builderMethod); out.append("- ").append(LangHelper.ensurePeriod(LangHelper.translate(lang))).append("\n\n"); out.append(new CodeBlockBuilder().line(example).indentation(1).toString()); @@ -387,7 +389,7 @@ public String creationMethod() { private String createBuilder(Example example, boolean canBeCommented) { StringBuilder out = new StringBuilder(); - var methodLocation = Registry.BASE_ACCESS_COMPAT + "." + location + "." + builderMethod.getName(); + var methodLocation = location + "." + builderMethod.getName(); var error = GroovyLog.msg("Error creating example for " + methodLocation).error(); var prependComment = canBeCommented && example.commented(); diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index efac0efd6..9e4c1052a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -54,11 +54,10 @@ public Registry(IGroovyContainer container, INamed registry) { methods.get(entry.annotation().type()).add(entry); addImports(entry.annotation().example()); } - var location = container.getModId() + "." + registry.getName(); this.recipeBuilders = recipeBuilderMethods .stream() .sorted(ComparisonHelper::recipeBuilder) - .map(x -> new Builder(x.method(), x.annotation(), location)) + .map(x -> new Builder(x.method(), x.annotation(), getReference(), getBaseLangKey())) .collect(Collectors.toList()); methods.values().forEach(value -> value.sort(ComparisonHelper::method)); } From 41d38b325061d8c1772a91f63bc39b2f91d3682a Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 03:41:39 -0700 Subject: [PATCH 23/92] consolidate logic with IRegistryDocumentation --- .../documentation/IRegistryDocumentation.java | 98 +++++++++ .../compat/mods/MinecraftModContainer.java | 3 +- .../documentation/Documentation.java | 5 +- .../groovyscript/documentation/Exporter.java | 186 +++++++----------- .../groovyscript/documentation/Registry.java | 105 +++++++--- .../helper/ComparisonHelper.java | 49 +++-- .../documentation/helper/ContainerHolder.java | 48 +++++ .../documentation/helper/LinkIndex.java | 86 ++++++++ .../documentation/helper/MarkdownSection.java | 81 ++++++++ .../GroovyScriptDocumentationProvider.java | 3 +- 10 files changed, 497 insertions(+), 167 deletions(-) create mode 100644 src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java create mode 100644 src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java create mode 100644 src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java create mode 100644 src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java new file mode 100644 index 000000000..974ec21a6 --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java @@ -0,0 +1,98 @@ +package com.cleanroommc.groovyscript.api.documentation; + +import com.cleanroommc.groovyscript.api.INamed; +import com.cleanroommc.groovyscript.documentation.helper.MarkdownSection; +import com.cleanroommc.groovyscript.documentation.helper.LinkIndex; +import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; +import com.cleanroommc.groovyscript.sandbox.LoadStage; +import org.jetbrains.annotations.NotNull; + +import java.io.File; +import java.util.List; + +/** + * Implementing this interface on a registry will allow + * customizing the wiki and example generation that occurs. + * This annotation has no effect unless one of its default methods is implemented. + *

+ * The default registry, {@link com.cleanroommc.groovyscript.documentation.Registry Registry}, + * uses this annotation with the goal of consolidating logic. + * + * @see com.cleanroommc.groovyscript.documentation.Registry Registry + */ +public interface IRegistryDocumentation extends INamed { + + /** + * Generate the various files for the wiki - these are almost always + * markdown files inside the {@code suggestedFolder}, + * and the file linked by adding it to {@code linkIndex}. + *

+ * In most situations simply adding it to the default section via {@link LinkIndex#add(String)} + * suffices, but for certain reasons a separate section may be desired. + * If so, the section must be created via {@link LinkIndex#register(String, MarkdownSection)} + * and can then be added to directly {@link LinkIndex#add(String, String)}. + * + * @param container the container the registry is part of + * @param suggestedFolder the suggested folder for the wiki files to be generated within. + * This is only a suggestion, and can be ignored + * @param linkIndex each category will generate a header, description, and some number of entries for the index page + * @see MarkdownSection + * @see LinkIndex + * @see com.cleanroommc.groovyscript.documentation.Exporter#writeNormalWikiFile + */ + default void generateWiki(ContainerHolder container, File suggestedFolder, LinkIndex linkIndex) {} + + /** + * Return a String that will be added to the example groovy file + * depending on the {@code loadStage}. + * + * @param container the container the registry is part of + * @param loadStage the target load stage, which controls which file the output is printed to + * @param imports a list of classes that must be imported. this should only contain the class name, + * and entries should not be removed + * @return the text of the examples, with an empty string indicating no examples were generated. + * If no examples were generated among all the suppliers, the relevant file will not be created. + */ + default @NotNull String generateExamples(ContainerHolder container, LoadStage loadStage, List imports) { + return ""; + } + + /** + * Allows skipping creating the default wiki {@link com.cleanroommc.groovyscript.documentation.Registry Registry}. + * This could be used to either disable documentation of a class, regardless of annotations, + * replace the existing documentation by implementing {@link #generateWiki(ContainerHolder, File, LinkIndex)}, + * or to provide both the default generation and custom generation. + * + * @param container the container the registry is part of + * @return if the normal wiki creation used by {@link com.cleanroommc.groovyscript.documentation.Registry Registry} + * should occur, regardless of if {@link #generateWiki(ContainerHolder, File, LinkIndex)} is implemented + */ + default boolean skipDefaultWiki(ContainerHolder container) { + return false; + } + + /** + * Allows skipping using the default example {@link com.cleanroommc.groovyscript.documentation.Registry Registry}. + * This could be used to either disable example generation of a class, regardless of annotations, + * replace the existing examples by implementing {@link #generateExamples(ContainerHolder, LoadStage, List)}, + * or to provide both the default generation and custom generation. + * + * @param container the container the registry is part of + * @return if the normal example creation used by {@link com.cleanroommc.groovyscript.documentation.Registry Registry} + * should occur, regardless of if {@link #generateExamples(ContainerHolder, LoadStage, List)} is implemented + */ + default boolean skipDefaultExamples(ContainerHolder container) { + return false; + } + + /** + * Priority of the registry, relative to other registries of the same container. + * Priorities sort entries such that lowest is first, then by the natural order of {@link INamed#getName()}. + * + * @return the registry priority, default {@code 100} + * @see com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription#priority() + */ + default int priority() { + return 100; + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java index 676a09444..368fd5a46 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java @@ -5,6 +5,7 @@ import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; import com.cleanroommc.groovyscript.documentation.Documentation; import com.cleanroommc.groovyscript.documentation.Exporter; +import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; @@ -71,7 +72,7 @@ public boolean generateWiki(File suggestedFolder) { var minecraftCompatFolder = new File(new File(Documentation.WIKI, "minecraft"), "helpers"); try { Files.createDirectories(minecraftCompatFolder.toPath()); - Exporter.generateWiki(minecraftCompatFolder, this); + Exporter.generateWiki(minecraftCompatFolder, ContainerHolder.of(this)); Exporter.exportFile(new File(minecraftCompatFolder, "index.md"), "wiki/vanilla/index.md"); } catch (IOException e) { GroovyScript.LOGGER.throwing(e); diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java index 76dcb6547..981f6279b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java @@ -5,6 +5,7 @@ import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.documentation.format.IFormat; import com.cleanroommc.groovyscript.documentation.format.OutputFormat; +import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; import com.cleanroommc.groovyscript.documentation.helper.GenerationFlags; import com.cleanroommc.groovyscript.documentation.helper.LangHelper; import com.cleanroommc.groovyscript.sandbox.LoadStage; @@ -63,7 +64,7 @@ private static void generateExamples(boolean log) { if (!container.isLoaded()) continue; File file = new File(generatedFolder, container.getModId() + GROOVY_FILE_EXTENSION); if (!(container instanceof IContainerDocumentation doc) || doc.generateExamples(file, stage)) { - Exporter.generateExamples(file, stage, container); + Exporter.generateExamples(file, stage, ContainerHolder.of(container)); } } } @@ -79,7 +80,7 @@ private static void generateWiki(boolean log) { if (!container.isLoaded()) continue; File target = new File(WIKI_MODS, container.getModId()); if (!(container instanceof IContainerDocumentation doc) || doc.generateWiki(target)) { - Exporter.generateWiki(target, container); + Exporter.generateWiki(target, ContainerHolder.of(container)); } } if (log) logMissing(); diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index a17c9c056..22bf7f3b7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -2,169 +2,87 @@ import com.cleanroommc.groovyscript.GroovyScript; import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IGroovyContainer; import com.cleanroommc.groovyscript.api.INamed; +import com.cleanroommc.groovyscript.api.documentation.IRegistryDocumentation; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; -import com.cleanroommc.groovyscript.compat.mods.GroovyContainer; -import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; import com.cleanroommc.groovyscript.documentation.helper.ComparisonHelper; +import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; +import com.cleanroommc.groovyscript.documentation.helper.LinkIndex; import com.cleanroommc.groovyscript.sandbox.LoadStage; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import net.minecraft.client.resources.I18n; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.function.Predicate; public class Exporter { private static final String INDEX_FILE_NAME = "index.md"; private static final String NAV_FILE_NAME = "!navigation.md"; - private static final String PRINT_MOD_DETECTED = "log 'mod \\'%s\\' detected, running script'"; + private static final String EXAMPLE_HEADER = "\n// Auto generated groovyscript example file\n// MODS_LOADED: %1$s\n%2$s\nlog 'mod \\'%1$s\\' detected, running script'\n\n"; private static final Map> SKIPPED_CLASSES = new Object2ObjectOpenHashMap<>(); - public static void generateWiki(File targetFolder, GroovyContainer mod) { - generateWiki(targetFolder, mod, mod.get().getRegistries()); - } - - public static void generateWiki(File targetFolder, IGroovyContainer container, Collection registryCollection) { - List fileLinks = new ArrayList<>(); + public static void generateWiki(File targetFolder, ContainerHolder container) { + var linkIndex = new LinkIndex(); - Set registries = new HashSet<>(); - for (INamed named : registryCollection) { - var annotation = named.getClass().getAnnotation(RegistryDescription.class); - if (annotation == null) { - SKIPPED_CLASSES.put(container.getModId() + "." + named.getName(), named.getClass()); - } else { - registries.add(named); - } - } + var registries = getRegistries(container, x -> x.skipDefaultWiki(container)); if (registries.isEmpty()) return; - registries.stream() - .sorted(ComparisonHelper::iNamed) - .forEach(registry -> { - Registry example = new Registry(container, registry); - String location = String.format("%s.md", registry.getName()); - fileLinks.add(String.format("* [%s](./%s)", example.getTitle(), location)); - try { - File file = new File(targetFolder, location); - Files.write(file.toPath(), example.documentationBlock().trim().concat("\n").getBytes()); - } catch (IOException e) { - GroovyScript.LOGGER.throwing(e); - } - }); - - // TODO add bracket handlers - // maybe also add commands? - - StringBuilder index = new StringBuilder() - .append("---") - .append("\n") - .append(Documentation.DEFAULT_FORMAT.removeTableOfContentsText()) - .append("\n") // Removes the table of contents from the sidebar of indexes. - .append("---") - .append("\n\n\n") - .append("# ") - .append(container) - .append("\n\n") - .append("## ") - .append(I18n.format("groovyscript.wiki.categories")) - .append("\n\n") - .append(I18n.format("groovyscript.wiki.subcategories_count", registries.size())) - .append("\n\n"); - - StringBuilder navigation = new StringBuilder() - .append("---") - .append("\n") - .append("search:") - .append("\n") - .append(" exclude: true") - .append("\n") // Removes navigation files from the search index - .append("---") - .append("\n\n\n") - .append(String.format("* [%s](./%s)\n", container, INDEX_FILE_NAME)); - - fileLinks.forEach(line -> { - index.append(line).append("\n\n"); - navigation.append(line).append("\n"); - }); + Documentation.ensureDirectoryExists(targetFolder); - try { - File file = new File(targetFolder, INDEX_FILE_NAME); - Files.write(file.toPath(), index.toString().getBytes()); - } catch (IOException e) { - GroovyScript.LOGGER.throwing(e); + for (var registry : registries) { + GroovyLog.msg("Generating wiki for the container {} and registry '{}'.", container.name(), registry.getName()).debug().post(); + registry.generateWiki(container, targetFolder, linkIndex); } + String indexText = String.format("---\n%s\n---\n\n\n# %s\n\n%s", Documentation.DEFAULT_FORMAT.removeTableOfContentsText(), container.name(), linkIndex.get()); + write(new File(targetFolder, INDEX_FILE_NAME), indexText); + if (Documentation.DEFAULT_FORMAT.requiresNavFile()) { - try { - File file = new File(targetFolder, NAV_FILE_NAME); - Files.write(file.toPath(), navigation.toString().getBytes()); - } catch (IOException e) { - GroovyScript.LOGGER.throwing(e); - } + String navigation = String.format("---\nsearch:\n exclude: true\n---\n\n\n* [%s](./%s)\n%s", container.name(), INDEX_FILE_NAME, linkIndex.getLinks()); + write(new File(targetFolder, NAV_FILE_NAME), navigation); } } - public static void generateExamples(File targetFile, LoadStage loadStage, GroovyContainer mod) { - generateExamples(targetFile, loadStage, mod, mod.get().getRegistries()); + public static void writeNormalWikiFile(File targetFolder, LinkIndex linkIndex, String id, String title, String doc) { + String location = id + ".md"; + linkIndex.add(String.format("* [%s](./%s)", title, location)); + write(new File(targetFolder, location), doc.trim().concat("\n")); } - public static void generateExamples(File targetFile, LoadStage loadStage, IGroovyContainer container, Collection registryCollection) { - StringBuilder header = new StringBuilder(); + public static void generateExamples(File targetFile, LoadStage loadStage, ContainerHolder container) { StringBuilder body = new StringBuilder(); List imports = new ArrayList<>(); - // Preprocessor to only run script if the mod is loaded - header.append("\n") - .append("// Auto generated groovyscript example file") - .append("\n") - .append("// MODS_LOADED: ") - .append(container.getModId()) - .append("\n"); - - // Iterate through every registry of the mod once, in alphabetical order. - Set registries = new HashSet<>(); - for (INamed named : registryCollection) { - var annotation = named.getClass().getAnnotation(RegistryDescription.class); - if (annotation == null) { - SKIPPED_CLASSES.put(container.getModId() + "." + named.getName(), named.getClass()); - continue; - } - if (annotation.location() == loadStage) { - registries.add(named); - } - } + var registries = getRegistries(container, x -> x.skipDefaultExamples(container)); if (registries.isEmpty()) return; - registries.stream() - .sorted(ComparisonHelper::iNamed) - .forEach(registry -> { - GroovyLog.msg("Generating examples for the mod {} and registry '{}'.", container.toString(), registry.getName()).debug().post(); - Registry example = new Registry(container, registry); - imports.addAll(example.getImports()); - body.append(example.exampleBlock()); - }); + for (var registry : registries) { + GroovyLog.msg("Generating examples for the container {} and registry '{}'.", container.name(), registry.getName()).debug().post(); + body.append(registry.generateExamples(container, loadStage, imports)); + } + + if (body.length() == 0) return; - if (!imports.isEmpty()) header.append("\n"); - imports.stream().distinct().sorted().forEach(i -> header.append("import ").append(i).append("\n")); + String header = String.format(EXAMPLE_HEADER, container.id(), getImportBlock(imports)); - // Print that the script was loaded at the end of the header, after any imports have been added. - header.append("\n") - .append(String.format(PRINT_MOD_DETECTED, container.getModId())) - .append("\n\n") - .append(body); + write(targetFile, header + body); + } + public static void write(File file, String text) { try { - Files.write(targetFile.toPath(), header.toString().getBytes()); + Files.write(file.toPath(), text.getBytes()); } catch (IOException e) { GroovyScript.LOGGER.throwing(e); } @@ -180,6 +98,34 @@ public static void exportFile(File file, String resource) throws IOException { } } + private static List getRegistries(ContainerHolder container, Predicate check) { + List registries = new ArrayList<>(); + for (INamed named : container.registries()) { + if (named instanceof IRegistryDocumentation doc) { + registries.add(doc); + if (check.test(doc)) continue; + } + if (named.getClass().isAnnotationPresent(RegistryDescription.class)) { + registries.add(new Registry(container, named)); + continue; + } + SKIPPED_CLASSES.put(container.id() + "." + named.getName(), named.getClass()); + } + registries.sort(ComparisonHelper::iRegistryDocumentation); + return registries; + } + + private static String getImportBlock(List imports) { + if (imports.isEmpty()) return ""; + var list = new ArrayList<>(new ObjectOpenHashSet<>(imports)); + list.sort(ComparisonHelper::splitString); + var sb = new StringBuilder(); + for (var x : list) { + sb.append("\nimport ").append(x); + } + return sb + "\n"; + } + public static void logSkippedClasses() { if (SKIPPED_CLASSES.isEmpty()) return; GroovyLog.Msg log = GroovyLog.msg("Skipped documenting the following potentially valid locations (this may be the correct behavior!)"); diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 9e4c1052a..c2f72dbb1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -1,19 +1,21 @@ package com.cleanroommc.groovyscript.documentation; -import com.cleanroommc.groovyscript.api.IGroovyContainer; +import com.cleanroommc.groovyscript.GroovyScript; +import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.INamed; +import com.cleanroommc.groovyscript.api.documentation.IRegistryDocumentation; import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.documentation.helper.AdmonitionBuilder; -import com.cleanroommc.groovyscript.documentation.helper.CodeBlockBuilder; -import com.cleanroommc.groovyscript.documentation.helper.ComparisonHelper; -import com.cleanroommc.groovyscript.documentation.helper.LangHelper; +import com.cleanroommc.groovyscript.documentation.helper.*; import com.cleanroommc.groovyscript.documentation.helper.descriptor.DescriptorHelper; import com.cleanroommc.groovyscript.documentation.helper.descriptor.MethodAnnotation; import com.cleanroommc.groovyscript.documentation.linkgenerator.LinkGeneratorHooks; +import com.cleanroommc.groovyscript.sandbox.LoadStage; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import net.minecraft.client.resources.I18n; import org.apache.commons.lang3.text.WordUtils; +import org.jetbrains.annotations.NotNull; +import java.io.File; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.util.*; @@ -21,21 +23,21 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -public class Registry { +public class Registry implements IRegistryDocumentation { public static final String BASE_LANG_LOCATION = "groovyscript.wiki"; - public static final String BASE_ACCESS_COMPAT = "mods"; private static final Pattern PERIOD_END_PATTERN = Pattern.compile("\\.$"); - private final IGroovyContainer container; + private final ContainerHolder container; private final INamed registry; private final RegistryDescription description; private final Map types; private final List recipeBuilders; private final EnumMap>> methods; private final List imports = new ArrayList<>(); + private final List aliases; - public Registry(IGroovyContainer container, INamed registry) { + public Registry(ContainerHolder container, INamed registry) { this.container = container; this.registry = registry; this.description = registry.getClass().getAnnotation(RegistryDescription.class); @@ -60,6 +62,7 @@ public Registry(IGroovyContainer container, INamed registry) { .map(x -> new Builder(x.method(), x.annotation(), getReference(), getBaseLangKey())) .collect(Collectors.toList()); methods.values().forEach(value -> value.sort(ComparisonHelper::method)); + aliases = generateAliases(container, registry); } /** @@ -94,12 +97,62 @@ private static DescriptorHelper.OfClass generateOfClass(Class clazz) { return methodSignatures; } + private static List generateAliases(ContainerHolder container, INamed registry) { + List list = new ArrayList<>(); + for (String modID : container.aliases()) { + if (modID.isEmpty()) { + list.addAll(registry.getAliases()); + continue; + } + for (String alias : registry.getAliases()) { + String format = String.format("%s.%s", modID, alias); + list.add(format); + } + } + for (var x : GroovyScript.getSandbox().getBindings().entrySet()) { + if (x.getValue() == registry) { + list.add(x.getKey()); + } + } + list.sort(ComparisonHelper::splitString); + return list; + } + + @Override + public String getName() { + return registry.getName(); + } + + @Override + public List getAliases() { + return aliases; + } + + @Override + public @NotNull String generateExamples(ContainerHolder container, LoadStage loadStage, List imports) { + if (description.location() == loadStage) { + imports.addAll(getImports()); + return exampleBlock(); + } + return ""; + } + + @Override + public void generateWiki(ContainerHolder container, File suggestedFolder, LinkIndex linkIndex) { + Exporter.writeNormalWikiFile(suggestedFolder, linkIndex, getName(), getTitle(), documentationBlock()); + } + + @Override + public int priority() { + return description.priority(); + } + private String getBaseLangKey() { - return BASE_LANG_LOCATION + "." + container.getModId() + "." + registry.getName(); + return BASE_LANG_LOCATION + "." + container.id() + "." + registry.getName(); } private String getReference() { - return BASE_ACCESS_COMPAT + "." + container.getModId() + "." + registry.getName(); + return container.access() + "." + registry.getName(); } private void addImports(Example... examples) { @@ -154,7 +207,7 @@ private String documentMethodDescriptionType(MethodDescription.Type type) { private String generateHeader() { StringBuilder out = new StringBuilder(); out.append("---\n").append("title: \"").append(getTitle()).append("\"\n"); - if (Documentation.DEFAULT_FORMAT.hasTitleTemplate()) out.append("titleTemplate: \"").append(container).append(" | CleanroomMC").append("\"\n"); + if (Documentation.DEFAULT_FORMAT.hasTitleTemplate()) out.append("titleTemplate: \"").append(container.name()).append(" | CleanroomMC").append("\"\n"); out.append("description: \"").append(getDescription()).append("\"\n"); String link = getFileSourceCodeLink(); if (!link.isEmpty()) out.append("source_code_link: \"").append(link).append("\"\n"); @@ -163,7 +216,7 @@ private String generateHeader() { } private String generateTitle() { - return String.format("# %s (%s)\n\n", getTitle(), container); + return String.format("# %s (%s)\n\n", getTitle(), container.name()); } private String generateDescription() { @@ -199,22 +252,20 @@ private String generateIdentifier() { StringBuilder out = new StringBuilder(); out.append("## ").append(I18n.format("groovyscript.wiki.identifier")).append("\n\n").append(I18n.format("groovyscript.wiki.import_instructions")).append("\n\n"); - List packages = container.getAliases() - .stream() - .flatMap(modID -> registry.getAliases().stream().map(alias -> String.format("%s.%s.%s", Registry.BASE_ACCESS_COMPAT, modID, alias))) - .collect(Collectors.toList()); + List packages = getAliases(); int target = packages.indexOf(getReference()); - packages.set(target, getReference() + "/*()!*/"); - - out.append( - new CodeBlockBuilder() - .line(packages) - .annotation(I18n.format("groovyscript.wiki.defaultPackage")) - // Highlighting and focusing are based on the line count, and is 1-indexed - .highlight(String.valueOf(1 + target)) - .focus(1 + target) - .toString()); + if (target == -1) { + GroovyLog.get().warn("Couldn't find identifier %s in packagess %s", getReference(), String.join(", ", packages)); + } else { + packages.set(target, getReference() + "/*()!*/"); + out.append(new CodeBlockBuilder() + .line(packages) + .annotation(I18n.format("groovyscript.wiki.defaultPackage")) + // Highlighting and focusing are based on the line count, and is 1-indexed + .highlight(String.valueOf(1 + target)) + .focus(1 + target)); + } return out.toString(); } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java index 8b7fe7be0..f18ba8ed0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java @@ -1,25 +1,26 @@ package com.cleanroommc.groovyscript.documentation.helper; -import com.cleanroommc.groovyscript.api.INamed; +import com.cleanroommc.groovyscript.api.documentation.IRegistryDocumentation; import com.cleanroommc.groovyscript.api.documentation.annotations.*; import com.cleanroommc.groovyscript.documentation.Builder; import com.cleanroommc.groovyscript.documentation.helper.descriptor.DescriptorHelper; import com.cleanroommc.groovyscript.documentation.helper.descriptor.MethodAnnotation; import com.google.common.collect.ComparisonChain; +import org.apache.commons.lang3.StringUtils; import java.lang.reflect.Method; +import java.util.stream.IntStream; /** * A helper class for comparing various documentation elements against each other. - * */ public final class ComparisonHelper { private ComparisonHelper() {} - public static int iNamed(INamed left, INamed right) { + public static int iRegistryDocumentation(IRegistryDocumentation left, IRegistryDocumentation right) { return ComparisonChain.start() - .compare(left.getClass().getAnnotation(RegistryDescription.class).priority(), right.getClass().getAnnotation(RegistryDescription.class).priority()) + .compare(left.priority(), right.priority()) .compare(left.getName(), right.getName()) .result(); } @@ -33,13 +34,10 @@ public static int recipeBuilder(MethodAnnotation left, } public static int example(Example left, Example right) { - var leftValue = left.value(); - var rightValue = right.value(); return ComparisonChain.start() .compare(left.priority(), right.priority()) .compareFalseFirst(left.commented(), right.commented()) - .compare(leftValue.length(), rightValue.length()) - .compare(leftValue, rightValue) + .compare(left.value(), right.value(), ComparisonHelper::stringCase) .result(); } @@ -50,10 +48,8 @@ public static int recipeBuilderMethod(MethodAnnotation IntStream.range(0, Math.min(a.length, b.length)).map(x -> string(a[x], b[x])).filter(x -> x != 0).findFirst().orElse(0)) + .compare(left, right, ComparisonHelper::string) + .result(); + } + + public static int stringCase(String left, String right) { + return ComparisonChain.start() + .compare(left.length(), right.length()) + .compare(left, right) + .result(); + } + + public static int string(String left, String right) { + return ComparisonChain.start() + .compare(left.length(), right.length()) + .compare(left, right, String::compareToIgnoreCase) + .result(); + } + @SuppressWarnings("deprecation") public static int comp(Comp left, Comp right) { return ComparisonChain.start() diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java new file mode 100644 index 000000000..aca8cd837 --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java @@ -0,0 +1,48 @@ +package com.cleanroommc.groovyscript.documentation.helper; + +import com.cleanroommc.groovyscript.api.IGroovyContainer; +import com.cleanroommc.groovyscript.api.INamed; +import com.cleanroommc.groovyscript.compat.mods.GroovyContainer; +import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; +import com.github.bsideup.jabel.Desugar; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * Holds data for the container being documented. + * Has two helper initialization methods. + * + * @param id the container id + * @param name the name of the container + * @param access the default method to access the container + * @param aliases all aliases the container has + * @param registries all registries the container has + */ +@Desugar +public record ContainerHolder(String id, String name, String access, Collection aliases, Collection registries) { + + public static final String BASE_ACCESS_COMPAT = "mods"; + + public static ContainerHolder of(GroovyContainer mod) { + return of(mod, mod.get().getRegistries()); + } + + public static ContainerHolder of(IGroovyContainer container, Collection registries) { + return new ContainerHolder(container.getModId(), container.getContainerName(), BASE_ACCESS_COMPAT + "." + container.getModId(), ContainerHolder.expandAliases(container.getAliases()), new ObjectOpenHashSet<>(registries)); + } + + /** + * @param aliases a list of base aliases to expand + * @return prepends the basic method to access compat to each element + */ + public static Collection expandAliases(Collection aliases) { + List list = new ArrayList<>(); + for (String alias : aliases) { + list.add(BASE_ACCESS_COMPAT + "." + alias); + } + return list; + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java new file mode 100644 index 000000000..8b6515c65 --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java @@ -0,0 +1,86 @@ +package com.cleanroommc.groovyscript.documentation.helper; + +import net.minecraft.client.resources.I18n; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * This is used to create the index page for the wiki. + *

+ * It has a default {@link MarkdownSection} for the normal + * categories, and in most cases this is the only section needed. + *

+ * Typical use will be multiple calls of {@link #add(String)}. + * + * @see MarkdownSection + */ +public class LinkIndex { + + private static final String PRIMARY_SECTION = "primary"; + + private final Map sections = new HashMap<>(); + + public LinkIndex() { + this(new MarkdownSection(I18n.format("groovyscript.wiki.categories"), count -> I18n.format("groovyscript.wiki.subcategories_count", count))); + } + + public LinkIndex(MarkdownSection primary) { + register(PRIMARY_SECTION, primary); + } + + /** + * Registers a section to the index, with the given id. + * While it is possible to use {@link #add(String, String)}, + * in many cases it is preferable to simply call {@link MarkdownSection#addEntry(String)} + * on the section being registered here. + * + * @param id the id the section has + * @param section the section to register + */ + public void register(String id, MarkdownSection section) { + sections.put(id, section); + } + + /** + * @param entry the string to add to the primary section, typically a markdown bullet point link + * @see MarkdownSection#addEntry(String) + */ + public void add(String entry) { + sections.get(PRIMARY_SECTION).addEntry(entry); + } + + /** + * @param id the id of the section to add to - if invalid, the entry will be added to the primary category + * @param entry the string to add to the section, typically a markdown bullet point link + * @see MarkdownSection#addEntry(String) + */ + public void add(String id, String entry) { + sections.getOrDefault(id, sections.get(PRIMARY_SECTION)).addEntry(entry); + } + + /** + * @return the full text of the sections + */ + public String get() { + return sections.values().stream() + .filter(MarkdownSection::hasEntries) + .sorted() + .map(MarkdownSection::get) + .collect(Collectors.joining()); + } + + /** + * @return the list of links directly, without a header/subtitle + */ + public String getLinks() { + return sections.values().stream() + .filter(MarkdownSection::hasEntries) + .sorted() + .map(MarkdownSection::getEntries) + .flatMap(Collection::stream) + .collect(Collectors.joining("\n")); + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java new file mode 100644 index 000000000..c05186b28 --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java @@ -0,0 +1,81 @@ +package com.cleanroommc.groovyscript.documentation.helper; + +import com.google.common.collect.ComparisonChain; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.IntFunction; + +/** + * This is used to create markdown sections on the wiki index page. + *

+ * Contains a header (which will be formatted as h2), + * a subtitle, and some number of entries. + *

+ * It will only be added to the index file if there is + * at least one entry to display, + * and the order it will be added to the index file is based on its priority. + * + * @see LinkIndex + */ +public class MarkdownSection implements Comparable { + + public static final int DEFAULT_PRIORITY = 1000; + + private final String header; + private final IntFunction subtitle; + private final List entries; + private final int priority; + + /** + * Calls {@link #MarkdownSection(String, IntFunction, int)} with a priority of {@link MarkdownSection#DEFAULT_PRIORITY}. + * + * @param header the header text of the section + * @param subtitle function that creates the subtitle based on the number of entries + * @see #MarkdownSection(String, IntFunction, int) Section + */ + public MarkdownSection(String header, IntFunction subtitle) { + this(header, subtitle, DEFAULT_PRIORITY); + } + + /** + * @param header the header text of the section + * @param subtitle function that creates the subtitle based on the number of entries + * @param priority the priority this Section has on the index page for sorting purposes + */ + public MarkdownSection(String header, IntFunction subtitle, int priority) { + this.header = header; + this.subtitle = subtitle; + this.entries = new ArrayList<>(); + this.priority = priority; + + } + + /** + * @param entry typically a markdown bullet point link + */ + public void addEntry(String entry) { + this.entries.add(entry); + } + + public boolean hasEntries() { + return !entries.isEmpty(); + } + + public List getEntries() { + return entries; + } + + public String get() { + return "## " + header + "\n\n" + subtitle.apply(entries.size()) + "\n\n" + String.join("\n\n", entries); + } + + @Override + public int compareTo(@NotNull MarkdownSection o) { + return ComparisonChain.start() + .compare(priority, o.priority) + .compare(header, o.header) + .result(); + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java index f9897baa5..80ccabd85 100644 --- a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java +++ b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java @@ -5,6 +5,7 @@ import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; import com.cleanroommc.groovyscript.documentation.Registry; import com.cleanroommc.groovyscript.documentation.helper.descriptor.MethodAnnotation; import net.prominic.groovyls.compiler.ast.ASTContext; @@ -35,7 +36,7 @@ public class GroovyScriptDocumentationProvider implements IDocumentationProvider var method = GroovyReflectionUtils.resolveMethodFromMethodNode(methodNode, context); if (method != null && method.isAnnotationPresent(MethodDescription.class)) { - return new Registry(groovyContainer, methodRegistry.get()) + return new Registry(ContainerHolder.of(groovyContainer), methodRegistry.get()) .methodDescription(new MethodAnnotation<>(method, method.getAnnotation(MethodDescription.class))); } } From f71ecce10bf521c32c9704194f46e8ce36210408 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 03:47:47 -0700 Subject: [PATCH 24/92] make default reference use global binding if exists --- .../com/cleanroommc/groovyscript/documentation/Registry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index c2f72dbb1..3d856d6d7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -152,7 +152,7 @@ private String getBaseLangKey() { } private String getReference() { - return container.access() + "." + registry.getName(); + return GroovyScript.getSandbox().getBindings().get(registry.getName()) == registry ? registry.getName() : container.access() + "." + registry.getName(); } private void addImports(Example... examples) { From 814c748da972f1f173431d1544e79070cee93fd7 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 03:48:53 -0700 Subject: [PATCH 25/92] adjust vanilla logic with custom container --- .../compat/mods/MinecraftModContainer.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java index 368fd5a46..a96d45b65 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java @@ -1,19 +1,17 @@ package com.cleanroommc.groovyscript.compat.mods; -import com.cleanroommc.groovyscript.GroovyScript; import com.cleanroommc.groovyscript.api.documentation.IContainerDocumentation; import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; import com.cleanroommc.groovyscript.documentation.Documentation; import com.cleanroommc.groovyscript.documentation.Exporter; import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; +import com.cleanroommc.groovyscript.sandbox.LoadStage; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.NotNull; import java.io.File; -import java.io.IOException; -import java.nio.file.Files; import java.util.Collection; import java.util.Collections; import java.util.Set; @@ -67,16 +65,22 @@ public VanillaModule get() { @Override public void onCompatLoaded(GroovyContainer container) {} + private ContainerHolder getContainer() { + var aliases = ContainerHolder.expandAliases(getAliases()); + aliases.addAll(getAliases()); + return new ContainerHolder(getModId(), getContainerName(), getModId(), aliases, new ObjectOpenHashSet<>(get().getRegistries())); + } + + @Override + public boolean generateExamples(File suggestedFile, LoadStage stage) { + Exporter.generateExamples(suggestedFile, stage, getContainer()); + return false; + } + @Override public boolean generateWiki(File suggestedFolder) { - var minecraftCompatFolder = new File(new File(Documentation.WIKI, "minecraft"), "helpers"); - try { - Files.createDirectories(minecraftCompatFolder.toPath()); - Exporter.generateWiki(minecraftCompatFolder, ContainerHolder.of(this)); - Exporter.exportFile(new File(minecraftCompatFolder, "index.md"), "wiki/vanilla/index.md"); - } catch (IOException e) { - GroovyScript.LOGGER.throwing(e); - } + var minecraftCompatFolder = new File(Documentation.WIKI_MINECRAFT, "helpers"); + Exporter.generateWiki(minecraftCompatFolder, getContainer()); return false; } } From 302dc67999409139e65eb4f8d58b6a9389bc2430 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 03:49:51 -0700 Subject: [PATCH 26/92] make vanilla register globals based on its aliases --- .../groovyscript/compat/vanilla/VanillaModule.java | 4 ++-- .../groovyscript/sandbox/GroovyScriptSandbox.java | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/VanillaModule.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/VanillaModule.java index e7f058ec7..7bfa8a51b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/VanillaModule.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/VanillaModule.java @@ -7,6 +7,7 @@ import com.cleanroommc.groovyscript.compat.loot.Loot; import com.cleanroommc.groovyscript.compat.mods.GroovyContainer; import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.sandbox.expand.ExpansionHelper; import net.minecraft.command.ICommandSender; import net.minecraft.item.ItemStack; @@ -61,8 +62,7 @@ public void addProperty(INamed property, boolean addGlobalBinding) { @Override public void initialize(GroovyContainer owner) { - GroovyScript.getSandbox().registerBinding("Minecraft", this); - GroovyScript.getSandbox().registerBinding("Vanilla", this); + GroovyScript.getSandbox().registerBinding(ModSupport.MINECRAFT.getAliases(), this); for (INamed registry : globalBindings) { GroovyScript.getSandbox().registerBinding(registry); diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox.java index 2a56b6223..577b2993a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox.java @@ -112,8 +112,14 @@ public void registerBinding(String name, Object obj) { public void registerBinding(INamed named) { Objects.requireNonNull(named); - for (String alias : named.getAliases()) { - bindings.put(alias, named); + registerBinding(named.getAliases(), named); + } + + public void registerBinding(Collection names, Object obj) { + Objects.requireNonNull(obj); + for (String name : names) { + Objects.requireNonNull(name); + bindings.put(name, obj); } } From f935266786806676aae12fb7317f240641300d8c Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 03:51:46 -0700 Subject: [PATCH 27/92] extract strings to constants --- .../groovyscript/documentation/Exporter.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index 22bf7f3b7..80c992ba9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -24,9 +24,13 @@ public class Exporter { - private static final String INDEX_FILE_NAME = "index.md"; - private static final String NAV_FILE_NAME = "!navigation.md"; + private static final String MARKDOWN_FILE_EXTENSION = ".md"; + private static final String INDEX_FILE_NAME = "index" + MARKDOWN_FILE_EXTENSION; + private static final String NAV_FILE_NAME = "!navigation" + MARKDOWN_FILE_EXTENSION; private static final String EXAMPLE_HEADER = "\n// Auto generated groovyscript example file\n// MODS_LOADED: %1$s\n%2$s\nlog 'mod \\'%1$s\\' detected, running script'\n\n"; + private static final String INDEX_FILE_TEXT = "---\n%s\n---\n\n\n# %s\n\n%s"; + private static final String BULLET_POINT_LINK = "* [%s](./%s)"; + private static final String NAVIGATION_FILE_TEXT = "---\nsearch:\n exclude: true\n---\n\n\n" + BULLET_POINT_LINK + "\n%s"; private static final Map> SKIPPED_CLASSES = new Object2ObjectOpenHashMap<>(); @@ -44,18 +48,18 @@ public static void generateWiki(File targetFolder, ContainerHolder container) { registry.generateWiki(container, targetFolder, linkIndex); } - String indexText = String.format("---\n%s\n---\n\n\n# %s\n\n%s", Documentation.DEFAULT_FORMAT.removeTableOfContentsText(), container.name(), linkIndex.get()); + String indexText = String.format(INDEX_FILE_TEXT, Documentation.DEFAULT_FORMAT.removeTableOfContentsText(), container.name(), linkIndex.get()); write(new File(targetFolder, INDEX_FILE_NAME), indexText); if (Documentation.DEFAULT_FORMAT.requiresNavFile()) { - String navigation = String.format("---\nsearch:\n exclude: true\n---\n\n\n* [%s](./%s)\n%s", container.name(), INDEX_FILE_NAME, linkIndex.getLinks()); + String navigation = String.format(NAVIGATION_FILE_TEXT, container.name(), INDEX_FILE_NAME, linkIndex.getLinks()); write(new File(targetFolder, NAV_FILE_NAME), navigation); } } public static void writeNormalWikiFile(File targetFolder, LinkIndex linkIndex, String id, String title, String doc) { - String location = id + ".md"; - linkIndex.add(String.format("* [%s](./%s)", title, location)); + String location = id + MARKDOWN_FILE_EXTENSION; + linkIndex.add(String.format(BULLET_POINT_LINK, title, location)); write(new File(targetFolder, location), doc.trim().concat("\n")); } From af72fbdb0544b6af2e175ad1611a0d4710d4e534 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 03:59:36 -0700 Subject: [PATCH 28/92] apply change to vanilla minecraft postInit --- examples/postInit/generated/minecraft.groovy | 134 +++++++++---------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/examples/postInit/generated/minecraft.groovy b/examples/postInit/generated/minecraft.groovy index 69372e8e6..12c4a62b8 100644 --- a/examples/postInit/generated/minecraft.groovy +++ b/examples/postInit/generated/minecraft.groovy @@ -7,18 +7,18 @@ log 'mod \'minecraft\' detected, running script' // Custom Commands: // Create custom commands, either generally or specifically for the client. -mods.minecraft.command.registerCommand('groovy_test', { server, sender, args -> sender.sendMessage('Hello from GroovyScript')}) +minecraft.command.registerCommand('groovy_test', { server, sender, args -> sender.sendMessage('Hello from GroovyScript')}) // Crafting Table: // A normal crafting recipe that takes place in the Vanilla Crafting Table, converting up to 9 items in a shapeless or // specific shaped arrangement into an output itemstack. -mods.minecraft.crafting.remove(resource('minecraft:stonebrick')) -mods.minecraft.crafting.remove('minecraft:mossy_stonebrick') -mods.minecraft.crafting.removeByOutput(item('minecraft:gold_ingot')) -// mods.minecraft.crafting.removeAll() +crafting.remove(resource('minecraft:stonebrick')) +crafting.remove('minecraft:mossy_stonebrick') +crafting.removeByOutput(item('minecraft:gold_ingot')) +// crafting.removeAll() -mods.minecraft.crafting.shapedBuilder() +crafting.shapedBuilder() .output(item('minecraft:nether_star')) .row('TXT') .row('X X') @@ -28,7 +28,7 @@ mods.minecraft.crafting.shapedBuilder() .key('!', item('minecraft:tnt').transform({ _ -> item('minecraft:diamond') })) .register() -mods.minecraft.crafting.shapedBuilder() +crafting.shapedBuilder() .output(item('minecraft:clay_ball') * 3) .shape('S S', ' G ', @@ -36,7 +36,7 @@ mods.minecraft.crafting.shapedBuilder() .key([S: ore('netherStar').reuse(), G: ore('ingotGold'), W: fluid('water') * 1000]) .register() -mods.minecraft.crafting.shapedBuilder() +crafting.shapedBuilder() .name('nether_star_duplication_with_tnt') .output(item('minecraft:nether_star')) .row('!!!') @@ -45,13 +45,13 @@ mods.minecraft.crafting.shapedBuilder() .key([S: ore('netherStar').reuse(), '!': item('minecraft:tnt').transform(item('minecraft:diamond'))]) .register() -mods.minecraft.crafting.shapedBuilder() +crafting.shapedBuilder() .output(item('minecraft:clay')) .row(' B') .key('B', item('minecraft:glass_bottle')) .register() -mods.minecraft.crafting.shapedBuilder() +crafting.shapedBuilder() .output(item('minecraft:clay')) .row(' ') .row(' 0 ') @@ -59,21 +59,21 @@ mods.minecraft.crafting.shapedBuilder() .key('0', item('minecraft:diamond_sword').withNbt([display:[Name:'Sword with Specific NBT data']])) .register() -mods.minecraft.crafting.shapedBuilder() +crafting.shapedBuilder() .output(item('minecraft:gold_block')) .shape([[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], [null, null, null], [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) .register() -mods.minecraft.crafting.shapedBuilder() +crafting.shapedBuilder() .name('gold_v_to_clay') .output(item('minecraft:clay')) .shape([[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')], [null,item('minecraft:stone_pickaxe').transformDamage(2).whenAnyDamage(),null]]) .register() -mods.minecraft.crafting.shapedBuilder() +crafting.shapedBuilder() .name(resource('example:resource_location')) .output(item('minecraft:clay')) .shape([[item('minecraft:cobblestone')], @@ -81,7 +81,7 @@ mods.minecraft.crafting.shapedBuilder() [item('minecraft:cobblestone')]]) .register() -mods.minecraft.crafting.shapedBuilder() +crafting.shapedBuilder() .output(item('minecraft:chest')) .shape([[ore('logWood'),ore('logWood'),ore('logWood')], [ore('logWood'),null,ore('logWood')], @@ -89,7 +89,7 @@ mods.minecraft.crafting.shapedBuilder() .replace() .register() -mods.minecraft.crafting.shapedBuilder() +crafting.shapedBuilder() .name('gold_to_diamonds') .output(item('minecraft:diamond') * 8) .shape([[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], @@ -98,7 +98,7 @@ mods.minecraft.crafting.shapedBuilder() .replaceByName() .register() -mods.minecraft.crafting.shapedBuilder() +crafting.shapedBuilder() .name(resource('minecraft:sea_lantern')) .output(item('minecraft:clay')) .shape([[item('minecraft:glowstone')], @@ -107,37 +107,37 @@ mods.minecraft.crafting.shapedBuilder() .replaceByName() .register() -mods.minecraft.crafting.shapelessBuilder() +crafting.shapelessBuilder() .output(item('minecraft:clay')) .input([item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]) .register() -mods.minecraft.crafting.shapelessBuilder() +crafting.shapelessBuilder() .name('precious_to_clay') .output(item('minecraft:clay')) .input([item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]) .register() -mods.minecraft.crafting.shapelessBuilder() +crafting.shapelessBuilder() .name(resource('example:resource_location2')) .output(item('minecraft:clay')) .input([item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) .register() -mods.minecraft.crafting.shapelessBuilder() +crafting.shapelessBuilder() .output(item('minecraft:ender_eye')) .input([item('minecraft:ender_pearl'),item('minecraft:nether_star')]) .replace() .register() -mods.minecraft.crafting.shapelessBuilder() +crafting.shapelessBuilder() .name('minecraft:pink_dye_from_pink_tulp') .output(item('minecraft:clay')) .input([item('minecraft:nether_star')]) .replaceByName() .register() -mods.minecraft.crafting.shapelessBuilder() +crafting.shapelessBuilder() .name(resource('minecraft:pink_dye_from_peony')) .output(item('minecraft:clay')) .input([item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) @@ -145,81 +145,81 @@ mods.minecraft.crafting.shapelessBuilder() .register() -// mods.minecraft.crafting.addShaped(item('minecraft:gold_block'), [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) -// mods.minecraft.crafting.addShaped(resource('example:resource_location'), item('minecraft:clay'), [[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]) -// mods.minecraft.crafting.addShaped('gold_v_to_clay', item('minecraft:clay'), [[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:gold_ingot'),null]]) -// mods.minecraft.crafting.addShapeless(item('minecraft:clay'), [item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]) -// mods.minecraft.crafting.addShapeless(resource('example:resource_location2'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) -// mods.minecraft.crafting.addShapeless('precious_to_clay', item('minecraft:clay'), [item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]) -// mods.minecraft.crafting.replaceShaped(item('minecraft:chest'), [[ore('logWood'),ore('logWood'),ore('logWood')],[ore('logWood'),null,ore('logWood')],[ore('logWood'),ore('logWood'),ore('logWood')]]) -// mods.minecraft.crafting.replaceShaped(resource('minecraft:sea_lantern'), item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]) -// mods.minecraft.crafting.replaceShaped('gold_to_diamonds', item('minecraft:diamond') * 8, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) -// mods.minecraft.crafting.replaceShapeless(item('minecraft:ender_eye'), [item('minecraft:ender_pearl'),item('minecraft:nether_star')]) -// mods.minecraft.crafting.replaceShapeless(resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) -// mods.minecraft.crafting.replaceShapeless('minecraft:pink_dye_from_pink_tulp', item('minecraft:clay'), [item('minecraft:nether_star')]) +// crafting.addShaped(item('minecraft:gold_block'), [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) +// crafting.addShaped(resource('example:resource_location'), item('minecraft:clay'), [[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]) +// crafting.addShaped('gold_v_to_clay', item('minecraft:clay'), [[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:gold_ingot'),null]]) +// crafting.addShapeless(item('minecraft:clay'), [item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]) +// crafting.addShapeless(resource('example:resource_location2'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) +// crafting.addShapeless('precious_to_clay', item('minecraft:clay'), [item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]) +// crafting.replaceShaped(item('minecraft:chest'), [[ore('logWood'),ore('logWood'),ore('logWood')],[ore('logWood'),null,ore('logWood')],[ore('logWood'),ore('logWood'),ore('logWood')]]) +// crafting.replaceShaped(resource('minecraft:sea_lantern'), item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]) +// crafting.replaceShaped('gold_to_diamonds', item('minecraft:diamond') * 8, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) +// crafting.replaceShapeless(item('minecraft:ender_eye'), [item('minecraft:ender_pearl'),item('minecraft:nether_star')]) +// crafting.replaceShapeless(resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) +// crafting.replaceShapeless('minecraft:pink_dye_from_pink_tulp', item('minecraft:clay'), [item('minecraft:nether_star')]) // Furnace: // Converts an input item into an output itemstack after a configurable amount of time, with the ability to give experience // and using fuel to run. Can also convert the item in the fuel slot. -mods.minecraft.furnace.removeByInput(item('minecraft:clay:*')) -mods.minecraft.furnace.removeByOutput(item('minecraft:brick')) -mods.minecraft.furnace.removeFuelConversionBySmeltedStack(item('minecraft:sponge', 1)) -// mods.minecraft.furnace.removeAll() -// mods.minecraft.furnace.removeAllFuelConversions() +furnace.removeByInput(item('minecraft:clay:*')) +furnace.removeByOutput(item('minecraft:brick')) +furnace.removeFuelConversionBySmeltedStack(item('minecraft:sponge', 1)) +// furnace.removeAll() +// furnace.removeAllFuelConversions() -mods.minecraft.furnace.recipeBuilder() +furnace.recipeBuilder() .input(ore('ingotGold')) .output(item('minecraft:nether_star')) .exp(0.5) .register() -// mods.minecraft.furnace.add(ore('ingotIron'), item('minecraft:diamond')) -mods.minecraft.furnace.add(item('minecraft:nether_star'), item('minecraft:clay') * 64, 13) -mods.minecraft.furnace.add(item('minecraft:diamond'), item('minecraft:clay'), 2, 50) -mods.minecraft.furnace.addFuelConversion(item('minecraft:diamond'), item('minecraft:bucket').transform(item('minecraft:lava_bucket'))) +// furnace.add(ore('ingotIron'), item('minecraft:diamond')) +furnace.add(item('minecraft:nether_star'), item('minecraft:clay') * 64, 13) +furnace.add(item('minecraft:diamond'), item('minecraft:clay'), 2, 50) +furnace.addFuelConversion(item('minecraft:diamond'), item('minecraft:bucket').transform(item('minecraft:lava_bucket'))) // Default GameRules: // Create or assign a default value to GameRules. -mods.minecraft.game_rule.add(['mobGriefing': 'false', 'keepInventory': 'true']) -mods.minecraft.game_rule.add('doDaylightCycle', 'false') +minecraft.game_rule.setWarnNewGameRule(true) -mods.minecraft.game_rule.setWarnNewGameRule(true) +minecraft.game_rule.add(['mobGriefing': 'false', 'keepInventory': 'true']) +minecraft.game_rule.add('doDaylightCycle', 'false') // Ore Dictionary: // Manipulate the Ore Dictionary and what itemstacks are part of what oredicts. -// mods.minecraft.ore_dict.clear('plankWood') -mods.minecraft.ore_dict.remove('netherStar', item('minecraft:nether_star')) -// mods.minecraft.ore_dict.removeAll('ingotIron') -// mods.minecraft.ore_dict.removeAll() +// ore_dict.clear('plankWood') +ore_dict.remove('netherStar', item('minecraft:nether_star')) +// ore_dict.removeAll('ingotIron') +// ore_dict.removeAll() -mods.minecraft.ore_dict.add('ingotGold', item('minecraft:nether_star')) -mods.minecraft.ore_dict.add('netherStar', item('minecraft:gold_ingot')) +ore_dict.add('ingotGold', item('minecraft:nether_star')) +ore_dict.add('netherStar', item('minecraft:gold_ingot')) -mods.minecraft.ore_dict.getOres(~/.*/) -mods.minecraft.ore_dict.getOres(~/.*Gold/) -mods.minecraft.ore_dict.getOres(~/.*or.*/) -mods.minecraft.ore_dict.getOres('ingot*') +ore_dict.getOres(~/.*/) +ore_dict.getOres(~/.*Gold/) +ore_dict.getOres(~/.*or.*/) +ore_dict.getOres('ingot*') // Starting Inventory: // Sets the starting inventory of the player, including armor slots and offhand. -mods.minecraft.player.addStartingItem(item('minecraft:diamond')) -mods.minecraft.player.addStartingItem(item('minecraft:clay_ball')) -mods.minecraft.player.addStartingItem(item('minecraft:gold_ingot')) -mods.minecraft.player.addStartingItem(item('minecraft:nether_star')) -mods.minecraft.player.addStartingItem(item('minecraft:water_bucket')) -mods.minecraft.player.setStartingItems(true, item('minecraft:clay').withNbt([display:[Name:'Hotbar']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Top row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Middle row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Bottom row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:diamond_boots'), item('minecraft:diamond_leggings'), item('minecraft:diamond_chestplate'), item('minecraft:diamond_helmet'), item('minecraft:clay').withNbt([display:[Name:'Offhand']])) +minecraft.player.setReplaceDefaultInventory(true) +// minecraft.player.setTestStartingItems(true) -mods.minecraft.player.setReplaceDefaultInventory(true) -// mods.minecraft.player.setTestStartingItems(true) +minecraft.player.addStartingItem(item('minecraft:diamond')) +minecraft.player.addStartingItem(item('minecraft:clay_ball')) +minecraft.player.addStartingItem(item('minecraft:gold_ingot')) +minecraft.player.addStartingItem(item('minecraft:nether_star')) +minecraft.player.addStartingItem(item('minecraft:water_bucket')) +minecraft.player.setStartingItems(true, item('minecraft:clay').withNbt([display:[Name:'Hotbar']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Top row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Middle row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Bottom row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:diamond_boots'), item('minecraft:diamond_leggings'), item('minecraft:diamond_chestplate'), item('minecraft:diamond_helmet'), item('minecraft:clay').withNbt([display:[Name:'Offhand']])) // Rarity: // Control the rarity of the item, which typically is the name color, to any standard Rarity or any TextFormatting code. -mods.minecraft.rarity.set(textformat('AQUA'), item('minecraft:diamond')) -mods.minecraft.rarity.set(textformat('RESET'), item('minecraft:enchanted_book')) +minecraft.rarity.set(textformat('AQUA'), item('minecraft:diamond')) +minecraft.rarity.set(textformat('RESET'), item('minecraft:enchanted_book')) From 3e5ceca715df240968c0cf3ceecd1f8096428cd3 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 04:01:19 -0700 Subject: [PATCH 29/92] generate mekanism infusion texture --- examples/postInit/generated/mekanism.groovy | 2 +- .../preInit/{ => generated}/mekanism.groovy | 7 ++--- .../compat/mods/mekanism/Infusion.java | 26 ++++++++++++++----- 3 files changed, 24 insertions(+), 11 deletions(-) rename examples/preInit/{ => generated}/mekanism.groovy (71%) diff --git a/examples/postInit/generated/mekanism.groovy b/examples/postInit/generated/mekanism.groovy index bfe8288a3..406361ce1 100644 --- a/examples/postInit/generated/mekanism.groovy +++ b/examples/postInit/generated/mekanism.groovy @@ -12,7 +12,7 @@ mods.mekanism.infusion.removeByType(infusionType('carbon')) // mods.mekanism.infusion.removeByType(infusionType('diamond')) // mods.mekanism.infusion.removeAll() -mods.mekanism.infusion.addType('groovy_example', resource('placeholdername:blocks/mekanism_infusion_texture')) +mods.mekanism.infusion.addType('groovy_example', resource('groovyscriptdev:blocks/mekanism_infusion_texture')) mods.mekanism.infusion.add(infusionType('diamond'), 100, item('minecraft:clay')) mods.mekanism.infusion.add(infusionType('carbon'), 100, item('minecraft:gold_ingot')) mods.mekanism.infusion.add('groovy_example', 10, item('minecraft:ice')) diff --git a/examples/preInit/mekanism.groovy b/examples/preInit/generated/mekanism.groovy similarity index 71% rename from examples/preInit/mekanism.groovy rename to examples/preInit/generated/mekanism.groovy index 15c0792a3..94354dec0 100644 --- a/examples/preInit/mekanism.groovy +++ b/examples/preInit/generated/mekanism.groovy @@ -1,10 +1,11 @@ +// Auto generated groovyscript example file // MODS_LOADED: mekanism + import net.minecraftforge.client.event.TextureStitchEvent -if (!isLoaded('mekanism')) return -println 'mod \'mekanism\' detected, running script' +log 'mod \'mekanism\' detected, running script' eventManager.listen { TextureStitchEvent.Pre event -> event.getMap().registerSprite(resource('groovyscriptdev:blocks/mekanism_infusion_texture')) -} +} \ No newline at end of file diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Infusion.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Infusion.java index 6847d7b2c..5e0707152 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Infusion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Infusion.java @@ -2,13 +2,16 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.IRegistryDocumentation; import com.cleanroommc.groovyscript.api.documentation.annotations.Admonition; import com.cleanroommc.groovyscript.api.documentation.annotations.Example; import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; import com.cleanroommc.groovyscript.registry.AbstractReloadableStorage; import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import com.cleanroommc.groovyscript.sandbox.LoadStage; import mekanism.api.infuse.InfuseObject; import mekanism.api.infuse.InfuseRegistry; import mekanism.api.infuse.InfuseType; @@ -16,11 +19,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; -import java.util.Arrays; -import java.util.Collection; -import java.util.Locale; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; @RegistryDescription( @@ -33,7 +34,7 @@ value = "groovyscript.wiki.mekanism.infusion.note0"), priority = 100 ) -public class Infusion extends VirtualizedRegistry> { +public class Infusion extends VirtualizedRegistry> implements IRegistryDocumentation { private final AbstractReloadableStorage> objectStorage = new AbstractReloadableStorage<>(); @@ -41,7 +42,6 @@ public static InfusionItems infusion(InfuseType type) { return new InfusionItems(type); } - public static InfusionItems infusion(String type, ResourceLocation resource) { return new InfusionItems(type, resource); } @@ -54,6 +54,18 @@ public static InfusionItems infusion(String type) { return new InfusionItems(type); } + @Override + public @NotNull String generateExamples(ContainerHolder container, LoadStage loadStage, List imports) { + if (loadStage == LoadStage.PRE_INIT) { + imports.add("net.minecraftforge.client.event.TextureStitchEvent"); + return """ + eventManager.listen { TextureStitchEvent.Pre event -> + event.getMap().registerSprite(resource('groovyscriptdev:blocks/mekanism_infusion_texture')) + }"""; + } + return ""; + } + @Override public void onReload() { removeScripted().forEach(pair -> InfuseRegistry.getInfuseMap().put(pair.getKey(), pair.getValue())); @@ -63,7 +75,7 @@ public void onReload() { objectStorage.removeScripted().forEach(pair -> InfuseRegistry.getObjectMap().remove(pair.getKey())); } - @MethodDescription(example = @Example("'groovy_example', resource('placeholdername:blocks/mekanism_infusion_texture')"), type = MethodDescription.Type.ADDITION, priority = 500) + @MethodDescription(example = @Example("'groovy_example', resource('groovyscriptdev:blocks/mekanism_infusion_texture')"), type = MethodDescription.Type.ADDITION, priority = 500) public void addType(String name, ResourceLocation resource) { InfuseType infuse = new InfuseType(name.toUpperCase(Locale.ROOT), resource); infuse.unlocalizedName = name.toLowerCase(Locale.ROOT); From 84a8d625923fd0649e91d59df67a9233f6337d08 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 04:11:25 -0700 Subject: [PATCH 30/92] generate preInit ZorraAltar examples --- .../{ => generated}/prodigytech.groovy | 8 ++--- .../compat/mods/prodigytech/ZorraAltar.java | 31 ++++++++++++++++++- 2 files changed, 34 insertions(+), 5 deletions(-) rename examples/preInit/{ => generated}/prodigytech.groovy (79%) diff --git a/examples/preInit/prodigytech.groovy b/examples/preInit/generated/prodigytech.groovy similarity index 79% rename from examples/preInit/prodigytech.groovy rename to examples/preInit/generated/prodigytech.groovy index c0dddae21..0b1b806e3 100644 --- a/examples/preInit/prodigytech.groovy +++ b/examples/preInit/generated/prodigytech.groovy @@ -1,12 +1,13 @@ + +// Auto generated groovyscript example file // MODS_LOADED: prodigytech import lykrast.prodigytech.common.item.IZorrasteelEquipment import lykrast.prodigytech.common.recipe.ZorraAltarManager -if (!isLoaded('prodigytech')) return -println 'mod \'prodigytech\' detected, running script' +log 'mod \'prodigytech\' detected, running script' -// Create an item at the location 'placeholdername:prodigy_stick' enchantable in the Zorra Altar +// Create an item at the location 'groovyscriptdev:prodigy_stick' enchantable in the Zorra Altar // Note: due to the PT's implementation it is difficult to make other mod's items enchantable // This merely registers the item, the post-init script adds the specific enchantments class ProdigyStick extends Item implements IZorrasteelEquipment { @@ -18,4 +19,3 @@ class ProdigyStick extends Item implements IZorrasteelEquipment { } content.registerItem('prodigy_stick', new ProdigyStick()) - diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ZorraAltar.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ZorraAltar.java index 766b40614..4b369abb7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ZorraAltar.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ZorraAltar.java @@ -1,21 +1,27 @@ package com.cleanroommc.groovyscript.compat.mods.prodigytech; import com.cleanroommc.groovyscript.api.GroovyBlacklist; +import com.cleanroommc.groovyscript.api.documentation.IRegistryDocumentation; import com.cleanroommc.groovyscript.api.documentation.annotations.Example; import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; +import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; +import com.cleanroommc.groovyscript.helper.GroovyHelper; import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import com.cleanroommc.groovyscript.sandbox.LoadStage; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import lykrast.prodigytech.common.recipe.ZorraAltarManager; import lykrast.prodigytech.common.util.Config; import net.minecraft.enchantment.Enchantment; +import org.jetbrains.annotations.NotNull; +import java.util.List; import java.util.Map; import java.util.Objects; @RegistryDescription -public class ZorraAltar extends VirtualizedRegistry { +public class ZorraAltar extends VirtualizedRegistry implements IRegistryDocumentation { @GroovyBlacklist private static final Map managers = new Object2ObjectOpenHashMap<>(); @@ -25,6 +31,29 @@ public class ZorraAltar extends VirtualizedRegistry managers.put("bow", ZorraAltarManager.BOW); } + @Override + public @NotNull String generateExamples(ContainerHolder container, LoadStage loadStage, List imports) { + if (loadStage == LoadStage.PRE_INIT) { + imports.add("lykrast.prodigytech.common.item.IZorrasteelEquipment"); + imports.add("lykrast.prodigytech.common.recipe.ZorraAltarManager"); + return String.format(""" + // Create an item at the location '%s:prodigy_stick' enchantable in the Zorra Altar + // Note: due to the PT's implementation it is difficult to make other mod's items enchantable + // This merely registers the item, the post-init script adds the specific enchantments + class ProdigyStick extends Item implements IZorrasteelEquipment { + static registry = mods.prodigytech.zorra_altar.createRegistry('stick') + + ZorraAltarManager getManager() { + return registry + } + } + + content.registerItem('prodigy_stick', new ProdigyStick()) + """, GroovyHelper.getPackId()); + } + return ""; + } + public ZorraAltarManager createRegistry(String key) { ZorraAltarManager manager = new ZorraAltarManager(); managers.put(key, manager); From 7d817ab1fbba3fe3e56a3dfecf16e8b704bfef8e Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 04:22:57 -0700 Subject: [PATCH 31/92] fix piston push validation incorrectly allowing 0 --- .../groovyscript/compat/inworldcrafting/PistonPush.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java index d69d18844..099586bb8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java @@ -121,7 +121,7 @@ public String getErrorMsg() { public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); validateFluids(msg); - if (this.maxConversionsPerPush < 0 || this.maxConversionsPerPush > 64) { + if (this.maxConversionsPerPush <= 0 || this.maxConversionsPerPush > 64) { GroovyLog.get().warn("Piston push recipe chance should be greater than 0 and equal or less than 64."); this.maxConversionsPerPush = MathHelper.clamp(this.maxConversionsPerPush, 1, 64); } From 46ee8852ccd5b25974a34f1f522418ca96534a60 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 07:25:44 -0700 Subject: [PATCH 32/92] allow non-mod ContainerHolder headers --- examples/postInit/generated/minecraft.groovy | 3 +-- .../compat/mods/MinecraftModContainer.java | 2 +- .../groovyscript/documentation/Exporter.java | 4 ++-- .../documentation/helper/ContainerHolder.java | 14 ++++++++++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/examples/postInit/generated/minecraft.groovy b/examples/postInit/generated/minecraft.groovy index 12c4a62b8..b9e98ef0f 100644 --- a/examples/postInit/generated/minecraft.groovy +++ b/examples/postInit/generated/minecraft.groovy @@ -1,8 +1,7 @@ // Auto generated groovyscript example file -// MODS_LOADED: minecraft -log 'mod \'minecraft\' detected, running script' +log 'running Vanilla Minecraft example' // Custom Commands: // Create custom commands, either generally or specifically for the client. diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java index a96d45b65..9ad25c26a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java @@ -68,7 +68,7 @@ public void onCompatLoaded(GroovyContainer container) {} private ContainerHolder getContainer() { var aliases = ContainerHolder.expandAliases(getAliases()); aliases.addAll(getAliases()); - return new ContainerHolder(getModId(), getContainerName(), getModId(), aliases, new ObjectOpenHashSet<>(get().getRegistries())); + return new ContainerHolder(getModId(), getContainerName(), getModId(), importBlock -> importBlock + "\nlog 'running Vanilla Minecraft example'", aliases, new ObjectOpenHashSet<>(get().getRegistries())); } @Override diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index 80c992ba9..05e3ec731 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -27,7 +27,7 @@ public class Exporter { private static final String MARKDOWN_FILE_EXTENSION = ".md"; private static final String INDEX_FILE_NAME = "index" + MARKDOWN_FILE_EXTENSION; private static final String NAV_FILE_NAME = "!navigation" + MARKDOWN_FILE_EXTENSION; - private static final String EXAMPLE_HEADER = "\n// Auto generated groovyscript example file\n// MODS_LOADED: %1$s\n%2$s\nlog 'mod \\'%1$s\\' detected, running script'\n\n"; + private static final String EXAMPLE_GENERATION_NOTE = "// Auto generated groovyscript example file\n"; private static final String INDEX_FILE_TEXT = "---\n%s\n---\n\n\n# %s\n\n%s"; private static final String BULLET_POINT_LINK = "* [%s](./%s)"; private static final String NAVIGATION_FILE_TEXT = "---\nsearch:\n exclude: true\n---\n\n\n" + BULLET_POINT_LINK + "\n%s"; @@ -79,7 +79,7 @@ public static void generateExamples(File targetFile, LoadStage loadStage, Contai if (body.length() == 0) return; - String header = String.format(EXAMPLE_HEADER, container.id(), getImportBlock(imports)); + String header = EXAMPLE_GENERATION_NOTE + container.header().apply(getImportBlock(imports)) + "\n\n"; write(targetFile, header + body); } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java index aca8cd837..e424e60e2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java @@ -10,6 +10,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.function.Function; /** * Holds data for the container being documented. @@ -18,20 +19,29 @@ * @param id the container id * @param name the name of the container * @param access the default method to access the container + * @param header a function that takes the import block to allow adding text before and/or after it * @param aliases all aliases the container has * @param registries all registries the container has */ @Desugar -public record ContainerHolder(String id, String name, String access, Collection aliases, Collection registries) { +public record ContainerHolder(String id, String name, String access, Function header, + Collection aliases, Collection registries) { public static final String BASE_ACCESS_COMPAT = "mods"; + private static final String HEADER = """ + // MODS_LOADED: %1$s + %2$s + log 'mod \\'%1$s\\' detected, running script'"""; + public static ContainerHolder of(GroovyContainer mod) { return of(mod, mod.get().getRegistries()); } public static ContainerHolder of(IGroovyContainer container, Collection registries) { - return new ContainerHolder(container.getModId(), container.getContainerName(), BASE_ACCESS_COMPAT + "." + container.getModId(), ContainerHolder.expandAliases(container.getAliases()), new ObjectOpenHashSet<>(registries)); + return new ContainerHolder(container.getModId(), container.getContainerName(), BASE_ACCESS_COMPAT + "." + container.getModId(), + importBlock -> String.format(HEADER, container.getModId(), importBlock), + ContainerHolder.expandAliases(container.getAliases()), new ObjectOpenHashSet<>(registries)); } /** From 5c4b4fc177c158013a320997dabaad5fecf97031 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 07:26:13 -0700 Subject: [PATCH 33/92] add in-world crafting --- .../generated/in_world_crafting.groovy | 77 +++++++++++++++++++ .../compat/inworldcrafting/Burning.java | 10 +++ .../compat/inworldcrafting/Explosion.java | 10 +++ .../compat/inworldcrafting/FluidRecipe.java | 10 +++ .../compat/inworldcrafting/FluidToBlock.java | 13 ++++ .../compat/inworldcrafting/FluidToFluid.java | 8 ++ .../compat/inworldcrafting/FluidToItem.java | 14 ++++ .../inworldcrafting/InWorldCrafting.java | 51 +++++++++++- .../compat/inworldcrafting/PistonPush.java | 12 +++ .../assets/groovyscript/lang/en_us.lang | 31 ++++++++ 10 files changed, 235 insertions(+), 1 deletion(-) create mode 100644 examples/postInit/generated/in_world_crafting.groovy diff --git a/examples/postInit/generated/in_world_crafting.groovy b/examples/postInit/generated/in_world_crafting.groovy new file mode 100644 index 000000000..182c007f8 --- /dev/null +++ b/examples/postInit/generated/in_world_crafting.groovy @@ -0,0 +1,77 @@ + +// Auto generated groovyscript example file + +log 'running In-World Crafting example' + +// Burning Conversion: +// Converts an input item into an output itemstack after some number of ticks while burning. This also makes the input item +// effectively fireproof. + +// in_world_crafting.burning.removeAll() + +in_world_crafting.burning.recipeBuilder() + .input(item('minecraft:netherrack')) + .output(item('minecraft:nether_star')) + .register() + + +// Explosion Conversion: +// Converts an input itemstack into an output itemstack, with an optional fail rate. + +// in_world_crafting.explosion.removeAll() + +in_world_crafting.explosion.recipeBuilder() + .input(item('minecraft:diamond')) + .output(item('minecraft:nether_star')) + .chance(0.4f) + .register() + + +// Fluid and ItemStack To Block Conversion: +// Converts any number of input itemstacks and a fluid source block into a block in-world, with each input having a chance +// to be consumed. Allows an additional closure check to start the recipe and a closure run after the recipe is finished. + +in_world_crafting.fluid_to_block.recipeBuilder() + .fluidInput(fluid('water')) + .input(item('minecraft:clay_ball')) + .output(block('minecraft:diamond_block')) + .register() + + +// Fluid and ItemStack To Fluid Conversion: +// Converts any number of input itemstacks and a fluid source block into a fluid block in-world, with each input having a +// chance to be consumed. Allows an additional closure check to start the recipe and a closure run after the recipe is +// finished. + +in_world_crafting.fluid_to_fluid.recipeBuilder() + .fluidInput(fluid('water')) + .input(item('minecraft:diamond') * 2) + .fluidOutput(fluid('lava')) + .register() + + +// Fluid and ItemStack To ItemStack Conversion: +// Converts any number of input itemstacks and a fluid source block into an itemstack in-world, with each input having a +// chance to be consumed and a chance to consume the fluid block. Allows an additional closure check to start the recipe +// and a closure run after the recipe is finished. + +in_world_crafting.fluid_to_item.recipeBuilder() + .fluidInput(fluid('water'), 0.22f) + .input(item('minecraft:netherrack')) + .input(item('minecraft:gold_ingot'), 0.1f) + .output(item('minecraft:nether_star')) + .register() + + +// Piston Pushing Conversion: +// Converts an input item into an output item when a piston pushes the item into a block, with an optional minimum harvest +// level requirement for the block. Amount converted in each entity item per push is configurable. + +// in_world_crafting.piston_push.removeAll() + +in_world_crafting.piston_push.recipeBuilder() + .input(item('minecraft:gold_ingot')) + .output(item('minecraft:diamond')) + .minHarvestLevel(2) + .maxConversionsPerPush(3) + .register() diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Burning.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Burning.java index d277f0be1..bcdf7e28b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Burning.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Burning.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; import com.cleanroommc.groovyscript.compat.inworldcrafting.jei.BurningRecipeCategory; import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; @@ -18,6 +19,7 @@ import java.util.*; import java.util.stream.Collectors; +@RegistryDescription public class Burning extends StandardListRegistry { private static final Map runningRecipes = new Object2ObjectOpenHashMap<>(); @@ -41,6 +43,7 @@ public void afterScriptLoad() { this.burningRecipes.sort(Comparator.comparingInt(BurningRecipe::getTicks)); } + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:netherrack')).output(item('minecraft:nether_star'))")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } @@ -76,16 +79,22 @@ public boolean isValidInput(EntityItem entityItem, ItemStack itemStack) { } } + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(eq = 1)) public static class RecipeBuilder extends AbstractRecipeBuilder { + @Property(comp = @Comp(gt = 0), defaultValue = "40") private int ticks = 40; + @Property("groovyscript.wiki.in_world_crafting.startCondition.value") private Closure startCondition; + @RecipeBuilderMethodDescription public RecipeBuilder ticks(int ticks) { this.ticks = ticks; return this; } + @RecipeBuilderMethodDescription public RecipeBuilder startCondition(Closure startCondition) { this.startCondition = startCondition; return this; @@ -107,6 +116,7 @@ public void validate(GroovyLog.Msg msg) { } @Override + @RecipeBuilderRegistrationMethod public @Nullable Burning.BurningRecipe register() { if (!validate()) return null; BurningRecipe burningRecipe = new BurningRecipe(this.input.get(0), this.output.get(0), this.ticks, this.startCondition); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Explosion.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Explosion.java index 91cce300f..0b7628add 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Explosion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Explosion.java @@ -4,6 +4,7 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; import com.cleanroommc.groovyscript.compat.inworldcrafting.jei.ExplosionRecipeCategory; import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; @@ -21,6 +22,7 @@ import java.util.List; import java.util.stream.Collectors; +@RegistryDescription public class Explosion extends StandardListRegistry { private final List explosionRecipes = new ArrayList<>(); @@ -36,6 +38,7 @@ public Collection getRecipes() { return this.explosionRecipes; } + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond')).output(item('minecraft:nether_star')).chance(0.4f)")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } @@ -99,16 +102,22 @@ private boolean tryRecipe(EntityItem entityItem, ItemStack itemStack) { } } + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(eq = 1)) public static class RecipeBuilder extends AbstractRecipeBuilder { + @Property(comp = @Comp(gte = 0, lte = 1), defaultValue = "1.0f") private float chance = 1.0f; + @Property("groovyscript.wiki.in_world_crafting.startCondition.value") private Closure startCondition; + @RecipeBuilderMethodDescription public RecipeBuilder chance(float chance) { this.chance = chance; return this; } + @RecipeBuilderMethodDescription public RecipeBuilder startCondition(Closure startCondition) { this.startCondition = startCondition; return this; @@ -130,6 +139,7 @@ public void validate(GroovyLog.Msg msg) { } @Override + @RecipeBuilderRegistrationMethod public @Nullable Explosion.ExplosionRecipe register() { if (!validate()) return null; ExplosionRecipe explosionRecipe = new ExplosionRecipe(this.input.get(0), this.output.get(0), this.chance, this.startCondition); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java index 5008ea759..63b74226f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java @@ -4,6 +4,9 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.Comp; +import com.cleanroommc.groovyscript.api.documentation.annotations.Property; +import com.cleanroommc.groovyscript.api.documentation.annotations.RecipeBuilderMethodDescription; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.sandbox.ClosureHelper; import groovy.lang.Closure; @@ -273,10 +276,14 @@ private void killItems() { public abstract static class RecipeBuilder extends AbstractRecipeBuilder { + @Property(value = "groovyscript.wiki.in_world_crafting.chances.value", comp = @Comp(unique = "groovyscript.wiki.in_world_crafting.chances.required")) protected final FloatList chances = new FloatArrayList(); + @Property("groovyscript.wiki.in_world_crafting.startCondition.value") protected Closure startCondition; + @Property("groovyscript.wiki.in_world_crafting.afterRecipe.value") protected Closure afterRecipe; + @RecipeBuilderMethodDescription(field = {"input", "chances"}) public RecipeBuilder input(IIngredient ingredient, float consumeChance) { this.input.add(ingredient); this.chances.add(MathHelper.clamp(consumeChance, 0.0f, 1.0f)); @@ -284,15 +291,18 @@ public RecipeBuilder input(IIngredient ingredient, float consumeChance) { } @Override + @RecipeBuilderMethodDescription(field = {"input", "chances"}) public AbstractRecipeBuilder input(IIngredient ingredient) { return input(ingredient, 1.0f); } + @RecipeBuilderMethodDescription public RecipeBuilder startCondition(Closure startCondition) { this.startCondition = startCondition; return this; } + @RecipeBuilderMethodDescription public RecipeBuilder afterRecipe(Closure afterRecipe) { this.afterRecipe = afterRecipe; return this; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToBlock.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToBlock.java index 1e9336d7c..985dc8e37 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToBlock.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToBlock.java @@ -2,6 +2,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; import com.cleanroommc.groovyscript.helper.SimpleObjectStream; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; @@ -18,6 +19,7 @@ import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.Nullable; +@RegistryDescription public class FluidToBlock extends VirtualizedRegistry { @Override @@ -39,6 +41,7 @@ public boolean remove(Recipe recipe) { return false; } + @MethodDescription public boolean removeByInput(FluidStack fluid) { if (IngredientHelper.isEmpty(fluid)) { GroovyLog.msg("Error removing in world fluid to block recipe") @@ -57,6 +60,7 @@ public boolean removeByInput(FluidStack fluid) { return true; } + @MethodDescription public boolean removeByInput(FluidStack fluid, ItemStack... input) { if (GroovyLog.msg("Error removing in world fluid to block recipe") .add(IngredientHelper.isEmpty(fluid), () -> "input fluid must not be empty") @@ -75,14 +79,17 @@ public boolean removeByInput(FluidStack fluid, ItemStack... input) { return true; } + @MethodDescription public boolean removeAll() { return FluidRecipe.removeIf(fluidRecipe -> fluidRecipe.getClass() == Recipe.class, fluidRecipe -> addBackup((Recipe) fluidRecipe)); } + @RecipeBuilderDescription(example = @Example(".fluidInput(fluid('water')).input(item('minecraft:clay_ball')).output(block('minecraft:diamond_block'))")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } + @MethodDescription public SimpleObjectStream streamRecipes() { return new SimpleObjectStream<>(FluidRecipe.findRecipesOfType(Recipe.class)).setRemover(this::remove); } @@ -111,15 +118,20 @@ public void handleRecipeResult(World world, BlockPos pos) { } } + @Property(property = "input", comp = @Comp(gte = 1, lte = Recipe.MAX_ITEM_INPUT)) + @Property(property = "fluidInput", comp = @Comp(eq = 1)) public static class RecipeBuilder extends FluidRecipe.RecipeBuilder { + @Property(comp = @Comp(not = "null")) private IBlockState outputBlock; + @RecipeBuilderMethodDescription(field = "outputBlock") public RecipeBuilder output(IBlockState blockState) { this.outputBlock = blockState; return this; } + @RecipeBuilderMethodDescription(field = "outputBlock") public RecipeBuilder output(Block block) { return output(block.getDefaultState()); } @@ -138,6 +150,7 @@ public void validate(GroovyLog.Msg msg) { } @Override + @RecipeBuilderRegistrationMethod public @Nullable FluidToBlock.Recipe register() { Recipe recipe = new Recipe( this.fluidInput.get(0).getFluid(), diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToFluid.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToFluid.java index e8cb64e02..d46a53f8f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToFluid.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToFluid.java @@ -2,6 +2,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; import com.cleanroommc.groovyscript.helper.SimpleObjectStream; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; @@ -16,6 +17,7 @@ import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.Nullable; +@RegistryDescription public class FluidToFluid extends VirtualizedRegistry { @Override @@ -37,6 +39,7 @@ public boolean remove(Recipe recipe) { return false; } + @MethodDescription public boolean removeByInput(FluidStack fluid) { if (IngredientHelper.isEmpty(fluid)) { GroovyLog.msg("Error removing in world fluid to fluid recipe") @@ -55,6 +58,7 @@ public boolean removeByInput(FluidStack fluid) { return true; } + @MethodDescription public boolean removeByInput(FluidStack fluid, ItemStack... input) { if (GroovyLog.msg("Error removing in world fluid to fluid recipe") .add(IngredientHelper.isEmpty(fluid), () -> "input fluid must not be empty") @@ -73,14 +77,17 @@ public boolean removeByInput(FluidStack fluid, ItemStack... input) { return true; } + @MethodDescription public boolean removeAll() { return FluidRecipe.removeIf(fluidRecipe -> fluidRecipe.getClass() == Recipe.class, fluidRecipe -> addBackup((Recipe) fluidRecipe)); } + @RecipeBuilderDescription(example = @Example(".fluidInput(fluid('water')).input(item('minecraft:diamond') * 2).fluidOutput(fluid('lava'))")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } + @MethodDescription public SimpleObjectStream streamRecipes() { return new SimpleObjectStream<>(FluidRecipe.findRecipesOfType(Recipe.class)).setRemover(this::remove); } @@ -124,6 +131,7 @@ public void validate(GroovyLog.Msg msg) { } @Override + @RecipeBuilderRegistrationMethod public @Nullable Recipe register() { Recipe recipe = new Recipe( this.fluidInput.get(0).getFluid(), diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java index b8259a7e9..d99d35111 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.GroovyScript; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; import com.cleanroommc.groovyscript.helper.SimpleObjectStream; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; @@ -18,6 +19,7 @@ import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.Nullable; +@RegistryDescription public class FluidToItem extends VirtualizedRegistry { @Override @@ -39,6 +41,7 @@ public boolean remove(Recipe recipe) { return false; } + @MethodDescription public boolean removeByInput(FluidStack fluid) { if (IngredientHelper.isEmpty(fluid)) { GroovyLog.msg("Error removing in world fluid to item recipe") @@ -57,6 +60,7 @@ public boolean removeByInput(FluidStack fluid) { return true; } + @MethodDescription public boolean removeByInput(FluidStack fluid, ItemStack... input) { if (GroovyLog.msg("Error removing in world fluid to item recipe") .add(IngredientHelper.isEmpty(fluid), () -> "input fluid must not be empty") @@ -75,14 +79,17 @@ public boolean removeByInput(FluidStack fluid, ItemStack... input) { return true; } + @MethodDescription public boolean removeAll() { return FluidRecipe.removeIf(fluidRecipe -> fluidRecipe.getClass() == Recipe.class, fluidRecipe -> addBackup((Recipe) fluidRecipe)); } + @RecipeBuilderDescription(example = @Example(".fluidInput(fluid('water'), 0.22f).input(item('minecraft:netherrack')).input(item('minecraft:gold_ingot'), 0.1f).output(item('minecraft:nether_star'))")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } + @MethodDescription public SimpleObjectStream streamRecipes() { return new SimpleObjectStream<>(FluidRecipe.findRecipesOfType(Recipe.class)).setRemover(this::remove); } @@ -120,15 +127,21 @@ public void handleRecipeResult(World world, BlockPos pos) { } } + @Property(property = "input", comp = @Comp(gte = 1, lte = Recipe.MAX_ITEM_INPUT)) + @Property(property = "output", comp = @Comp(eq = 1)) + @Property(property = "fluidInput", comp = @Comp(eq = 1)) public static class RecipeBuilder extends FluidRecipe.RecipeBuilder { + @Property(comp = @Comp(gte = 0, lte = 1), defaultValue = "1.0f") private float fluidConsumptionChance = 1.0f; + @RecipeBuilderMethodDescription(field = {"fluidInput", "fluidConsumptionChance"}) public RecipeBuilder fluidInput(FluidStack fluidStack, float fluidConsumptionChance) { fluidInput(fluidStack); return fluidConsumptionChance(fluidConsumptionChance); } + @RecipeBuilderMethodDescription public RecipeBuilder fluidConsumptionChance(float fluidConsumptionChance) { this.fluidConsumptionChance = fluidConsumptionChance; return this; @@ -148,6 +161,7 @@ public void validate(GroovyLog.Msg msg) { } @Override + @RecipeBuilderRegistrationMethod public @Nullable FluidToItem.Recipe register() { Recipe recipe = new Recipe( this.fluidInput.get(0).getFluid(), diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java index b4b33e2e3..240e723ec 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java @@ -2,15 +2,29 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.IScriptReloadable; +import com.cleanroommc.groovyscript.api.documentation.IRegistryDocumentation; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.documentation.Documentation; +import com.cleanroommc.groovyscript.documentation.Exporter; +import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; +import com.cleanroommc.groovyscript.documentation.helper.LinkIndex; import com.cleanroommc.groovyscript.registry.NamedRegistry; +import com.cleanroommc.groovyscript.sandbox.LoadStage; import com.google.common.collect.ImmutableList; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import org.jetbrains.annotations.NotNull; + +import java.io.File; +import java.util.ArrayList; import java.util.List; -public class InWorldCrafting extends NamedRegistry implements IScriptReloadable { +public class InWorldCrafting extends NamedRegistry implements IScriptReloadable, IRegistryDocumentation { + + private static final String NAME = "In-World Crafting"; + private static final String LOCATION = "in_world_crafting"; public final FluidToFluid fluidToFluid = new FluidToFluid(); public final FluidToItem fluidToItem = new FluidToItem(); @@ -38,4 +52,39 @@ public static EntityItem spawnItem(World world, BlockPos pos, ItemStack item) { world.spawnEntity(entityItem); return entityItem; } + + private ContainerHolder getContainerHolder() { + List list = new ArrayList<>(); + for (String alias : getAliases()) { + list.add(alias); + for (String minecraftAlias : ModSupport.MINECRAFT.getAliases()) { + list.add(minecraftAlias + "." + alias); + list.add(ContainerHolder.BASE_ACCESS_COMPAT + "." + minecraftAlias + "." + alias); + } + } + return new ContainerHolder(LOCATION, NAME, LOCATION, importBlock -> importBlock + "\nlog 'running In-World Crafting example'", list, ImmutableList.copyOf(registries)); + } + + @Override + public void generateWiki(ContainerHolder container, File suggestedFolder, LinkIndex linkIndex) { + File inWorld = new File(Documentation.WIKI_MINECRAFT, LOCATION); + Exporter.generateWiki(inWorld, getContainerHolder()); + } + + @Override + public @NotNull String generateExamples(ContainerHolder container, LoadStage loadStage, List imports) { + File inWorldCrafting = new File(Documentation.generatedFolder(loadStage), LOCATION + Documentation.GROOVY_FILE_EXTENSION); + Exporter.generateExamples(inWorldCrafting, loadStage, getContainerHolder()); + return ""; + } + + @Override + public boolean skipDefaultExamples(ContainerHolder container) { + return true; + } + + @Override + public boolean skipDefaultWiki(ContainerHolder container) { + return true; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java index 099586bb8..0227ac156 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; import com.cleanroommc.groovyscript.compat.inworldcrafting.jei.PistonPushRecipeCategory; import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; @@ -22,6 +23,7 @@ import java.util.function.Consumer; import java.util.stream.Collectors; +@RegistryDescription public class PistonPush extends StandardListRegistry { private final List pistonPushRecipes = new ArrayList<>(); @@ -37,6 +39,7 @@ public Collection getRecipes() { return this.pistonPushRecipes; } + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).minHarvestLevel(2).maxConversionsPerPush(3)")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } @@ -91,22 +94,30 @@ private boolean tryRecipe(Consumer entitySpawner, EntityItem entityI } } + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(eq = 1)) public static class RecipeBuilder extends AbstractRecipeBuilder { + @Property(comp = @Comp(gt = 0, lte = 64), defaultValue = "64") private int maxConversionsPerPush = 64; + @Property(defaultValue = "-1") private int minHarvestLevel = -1; + @Property private Closure startCondition; + @RecipeBuilderMethodDescription public RecipeBuilder maxConversionsPerPush(int maxConversionsPerPush) { this.maxConversionsPerPush = maxConversionsPerPush; return this; } + @RecipeBuilderMethodDescription public RecipeBuilder minHarvestLevel(int minHarvestLevel) { this.minHarvestLevel = minHarvestLevel; return this; } + @RecipeBuilderMethodDescription public RecipeBuilder startCondition(Closure beforeRecipe) { this.startCondition = beforeRecipe; return this; @@ -128,6 +139,7 @@ public void validate(GroovyLog.Msg msg) { } @Override + @RecipeBuilderRegistrationMethod public @Nullable PistonPush.PistonPushRecipe register() { if (!validate()) return null; PistonPushRecipe pistonPushRecipe = new PistonPushRecipe(this.input.get(0), this.output.get(0), this.maxConversionsPerPush, this.minHarvestLevel, this.startCondition); diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index a528d1139..d912e008c 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -204,6 +204,37 @@ groovyscript.wiki.minecraft.game_rule.setWarnNewGameRule=Sets if creating new Ga groovyscript.wiki.minecraft.game_rule.add=Adds a new entry in the format `name`, `value`, with `value` being a String that can represent a number (`-1`, `5`) or boolean (`true`, `false`) groovyscript.wiki.minecraft.game_rule.addMap=Adds a map of GameRule name to values +# In-World Crafting +groovyscript.wiki.in_world_crafting.chances.value=Sets the chance each input has to be consumed +groovyscript.wiki.in_world_crafting.chances.required=exactly equal to the number of elements in `input` +groovyscript.wiki.in_world_crafting.startCondition.value=Sets an additional check that must be passed before the recipe runs, with the Closure taking 2 parameters, `World world` and `BlockPos blockPos` +groovyscript.wiki.in_world_crafting.afterRecipe.value=Sets a closure that will run after the recipe completes, with the Closure taking 2 parameters, `World world` and `BlockPos blockPos` + +groovyscript.wiki.in_world_crafting.burning.title=Burning Conversion +groovyscript.wiki.in_world_crafting.burning.description=Converts an input item into an output itemstack after some number of ticks while burning. This also makes the input item effectively fireproof. +groovyscript.wiki.in_world_crafting.burning.ticks.value=Sets the time in ticks the item must be burning before it converts + +groovyscript.wiki.in_world_crafting.explosion.title=Explosion Conversion +groovyscript.wiki.in_world_crafting.explosion.description=Converts an input itemstack into an output itemstack, with an optional fail rate. +groovyscript.wiki.in_world_crafting.explosion.chance.value=Sets the chance the conversion occurs instead of the input being destroyed + +groovyscript.wiki.in_world_crafting.fluid_to_block.title=Fluid and ItemStack To Block Conversion +groovyscript.wiki.in_world_crafting.fluid_to_block.description=Converts any number of input itemstacks and a fluid source block into a block in-world, with each input having a chance to be consumed. Allows an additional closure check to start the recipe and a closure run after the recipe is finished. +groovyscript.wiki.in_world_crafting.fluid_to_block.outputBlock.value=Sets the blockstate being output + +groovyscript.wiki.in_world_crafting.fluid_to_fluid.title=Fluid and ItemStack To Fluid Conversion +groovyscript.wiki.in_world_crafting.fluid_to_fluid.description=Converts any number of input itemstacks and a fluid source block into a fluid block in-world, with each input having a chance to be consumed. Allows an additional closure check to start the recipe and a closure run after the recipe is finished. + +groovyscript.wiki.in_world_crafting.fluid_to_item.title=Fluid and ItemStack To ItemStack Conversion +groovyscript.wiki.in_world_crafting.fluid_to_item.description=Converts any number of input itemstacks and a fluid source block into an itemstack in-world, with each input having a chance to be consumed and a chance to consume the fluid block. Allows an additional closure check to start the recipe and a closure run after the recipe is finished. +groovyscript.wiki.in_world_crafting.fluid_to_item.fluidConsumptionChance.value=Sets the chance the fluid is consumed + +groovyscript.wiki.in_world_crafting.piston_push.title=Piston Pushing Conversion +groovyscript.wiki.in_world_crafting.piston_push.description=Converts an input item into an output item when a piston pushes the item into a block, with an optional minimum harvest level requirement for the block. Amount converted in each entity item per push is configurable. +groovyscript.wiki.in_world_crafting.piston_push.maxConversionsPerPush.value=Sets the maximum number of items converted from an itemstack in one press +groovyscript.wiki.in_world_crafting.piston_push.minHarvestLevel.value=Sets the minimum harvest level required of the block being pushed against +groovyscript.wiki.in_world_crafting.piston_push.startCondition.value=Sets an additional check that must be passed before the recipe runs, with the Closure taking 3 parameters, `EntityItem entityItem`, `ItemStack itemStack`, and `IBlockState pushingAgainst` + # Actually Additions groovyscript.wiki.actuallyadditions.atomic_reconstructor.title=Atomic Reconstructor From da64d3e3a21ae519829b1679b8674db7ecbd9b9f Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 07:31:58 -0700 Subject: [PATCH 34/92] ensure trailing whitespace is the same in all examples --- examples/postInit/generated/actuallyadditions.groovy | 2 -- examples/postInit/generated/advancedmortars.groovy | 1 - examples/postInit/generated/advancedrocketry.groovy | 2 -- examples/postInit/generated/aether_legacy.groovy | 1 - examples/postInit/generated/alchemistry.groovy | 2 -- examples/postInit/generated/appliedenergistics2.groovy | 1 - examples/postInit/generated/arcanearchives.groovy | 2 -- examples/postInit/generated/arcaneworld.groovy | 2 -- examples/postInit/generated/armorplus.groovy | 2 -- examples/postInit/generated/astralsorcery.groovy | 7 +++---- examples/postInit/generated/atum.groovy | 2 -- examples/postInit/generated/avaritia.groovy | 2 -- examples/postInit/generated/betterwithaddons.groovy | 2 -- examples/postInit/generated/betterwithmods.groovy | 6 ++---- examples/postInit/generated/bewitchment.groovy | 2 -- examples/postInit/generated/bloodarsenal.groovy | 1 - examples/postInit/generated/bloodmagic.groovy | 2 -- examples/postInit/generated/botania.groovy | 2 -- examples/postInit/generated/botania_tweaks.groovy | 2 -- examples/postInit/generated/botanicadds.groovy | 2 -- examples/postInit/generated/calculator.groovy | 2 -- examples/postInit/generated/compactmachines3.groovy | 2 -- examples/postInit/generated/cyclicmagic.groovy | 2 -- examples/postInit/generated/draconicevolution.groovy | 2 -- examples/postInit/generated/enderio.groovy | 2 -- examples/postInit/generated/erebus.groovy | 2 -- examples/postInit/generated/essentialcraft.groovy | 2 -- examples/postInit/generated/evilcraft.groovy | 2 -- examples/postInit/generated/extendedcrafting.groovy | 2 -- examples/postInit/generated/extrabotany.groovy | 2 -- examples/postInit/generated/extrautils2.groovy | 4 +--- examples/postInit/generated/factorytech.groovy | 2 -- examples/postInit/generated/futuremc.groovy | 2 -- examples/postInit/generated/horsepower.groovy | 2 -- examples/postInit/generated/iceandfire.groovy | 2 -- examples/postInit/generated/immersiveengineering.groovy | 2 -- examples/postInit/generated/immersivepetroleum.groovy | 2 -- examples/postInit/generated/immersivetech.groovy | 2 -- examples/postInit/generated/industrialforegoing.groovy | 2 -- examples/postInit/generated/inspirations.groovy | 2 -- examples/postInit/generated/integrateddynamics.groovy | 2 -- examples/postInit/generated/jei.groovy | 5 ++--- examples/postInit/generated/magneticraft.groovy | 2 -- examples/postInit/generated/mekanism.groovy | 1 - examples/postInit/generated/minecraft.groovy | 1 - examples/postInit/generated/mysticalagriculture.groovy | 2 -- examples/postInit/generated/naturesaura.groovy | 2 -- examples/postInit/generated/pneumaticcraft.groovy | 2 -- examples/postInit/generated/primal_tech.groovy | 2 -- examples/postInit/generated/prodigytech.groovy | 1 - examples/postInit/generated/projecte.groovy | 2 -- examples/postInit/generated/pyrotech.groovy | 1 - examples/postInit/generated/quarryplus.groovy | 2 -- examples/postInit/generated/randomthings.groovy | 2 -- examples/postInit/generated/roots.groovy | 2 -- examples/postInit/generated/rustic.groovy | 2 -- examples/postInit/generated/silentgems.groovy | 2 -- examples/postInit/generated/tconstruct.groovy | 1 - examples/postInit/generated/techreborn.groovy | 2 -- examples/postInit/generated/thaumcraft.groovy | 1 - examples/postInit/generated/theaurorian.groovy | 2 -- examples/postInit/generated/thebetweenlands.groovy | 1 - examples/postInit/generated/thermalexpansion.groovy | 1 - examples/postInit/generated/threng.groovy | 2 -- examples/postInit/generated/woot.groovy | 2 -- examples/preInit/generated/mekanism.groovy | 2 +- .../cleanroommc/groovyscript/documentation/Exporter.java | 4 ++-- 67 files changed, 11 insertions(+), 127 deletions(-) diff --git a/examples/postInit/generated/actuallyadditions.groovy b/examples/postInit/generated/actuallyadditions.groovy index 7ec0c34f7..4b5bae921 100644 --- a/examples/postInit/generated/actuallyadditions.groovy +++ b/examples/postInit/generated/actuallyadditions.groovy @@ -188,5 +188,3 @@ mods.actuallyadditions.treasure_chest.recipeBuilder() .min(16) .max(32) .register() - - diff --git a/examples/postInit/generated/advancedmortars.groovy b/examples/postInit/generated/advancedmortars.groovy index 1046adcf9..805d58b6c 100644 --- a/examples/postInit/generated/advancedmortars.groovy +++ b/examples/postInit/generated/advancedmortars.groovy @@ -35,4 +35,3 @@ mods.advancedmortars.mortar.recipeBuilder() mods.advancedmortars.mortar.add(['iron', 'wood'], item('minecraft:tnt') * 5, 4, item('minecraft:tnt'), 0.7, [ore('ingotIron'), ore('ingotIron'), ore('ingotIron'), ore('ingotIron'),ore('ingotIron'), ore('ingotIron'), ore('ingotIron'), ore('ingotIron')]) mods.advancedmortars.mortar.add(['stone'], item('minecraft:tnt'), 4, [ore('ingotGold')]) mods.advancedmortars.mortar.add(['stone'], item('minecraft:diamond') * 4, 4, [ore('ingotGold')]) - diff --git a/examples/postInit/generated/advancedrocketry.groovy b/examples/postInit/generated/advancedrocketry.groovy index 265e96be1..fbad73895 100644 --- a/examples/postInit/generated/advancedrocketry.groovy +++ b/examples/postInit/generated/advancedrocketry.groovy @@ -169,5 +169,3 @@ mods.advancedrocketry.small_plate_presser.recipeBuilder() .input(item('minecraft:cobblestone')) .output(item('minecraft:diamond')) .register() - - diff --git a/examples/postInit/generated/aether_legacy.groovy b/examples/postInit/generated/aether_legacy.groovy index 76d1c2b4a..fe23891a3 100644 --- a/examples/postInit/generated/aether_legacy.groovy +++ b/examples/postInit/generated/aether_legacy.groovy @@ -57,4 +57,3 @@ mods.aether_legacy.freezer_fuel.removeByItem(item('aether_legacy:icestone')) // mods.aether_legacy.freezer_fuel.removeAll() mods.aether_legacy.freezer_fuel.add(item('minecraft:packed_ice'), 1000) - diff --git a/examples/postInit/generated/alchemistry.groovy b/examples/postInit/generated/alchemistry.groovy index 1a0b33c76..58fe1240c 100644 --- a/examples/postInit/generated/alchemistry.groovy +++ b/examples/postInit/generated/alchemistry.groovy @@ -125,5 +125,3 @@ mods.alchemistry.liquifier.recipeBuilder() .input(item('minecraft:magma')) .fluidOutput(fluid('lava') * 750) .register() - - diff --git a/examples/postInit/generated/appliedenergistics2.groovy b/examples/postInit/generated/appliedenergistics2.groovy index 7eae0998a..d4ccf8fdb 100644 --- a/examples/postInit/generated/appliedenergistics2.groovy +++ b/examples/postInit/generated/appliedenergistics2.groovy @@ -78,4 +78,3 @@ mods.appliedenergistics2.spatial.remove('net.minecraft.tileentity.TileEntityChes // mods.appliedenergistics2.spatial.removeAll() mods.appliedenergistics2.spatial.add('net.minecraft.tileentity.TileEntityStructure') - diff --git a/examples/postInit/generated/arcanearchives.groovy b/examples/postInit/generated/arcanearchives.groovy index 9cad96163..260ab92aa 100644 --- a/examples/postInit/generated/arcanearchives.groovy +++ b/examples/postInit/generated/arcanearchives.groovy @@ -21,5 +21,3 @@ mods.arcanearchives.gem_cutting_table.recipeBuilder() .input(item('minecraft:stone'),item('minecraft:gold_ingot'),item('minecraft:gold_nugget')) .output(item('minecraft:clay') * 4) .register() - - diff --git a/examples/postInit/generated/arcaneworld.groovy b/examples/postInit/generated/arcaneworld.groovy index 02feef567..a83663dae 100644 --- a/examples/postInit/generated/arcaneworld.groovy +++ b/examples/postInit/generated/arcaneworld.groovy @@ -85,5 +85,3 @@ mods.arcaneworld.ritual.recipeBuilderWeather() .translationKey('groovyscript.demo_weather_thunder') .weatherThunder() .register() - - diff --git a/examples/postInit/generated/armorplus.groovy b/examples/postInit/generated/armorplus.groovy index 5b8054402..d47f15dd4 100644 --- a/examples/postInit/generated/armorplus.groovy +++ b/examples/postInit/generated/armorplus.groovy @@ -114,5 +114,3 @@ mods.armorplus.work_bench.shapelessBuilder() .output(item('minecraft:clay') * 8) .input(item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone')) .register() - - diff --git a/examples/postInit/generated/astralsorcery.groovy b/examples/postInit/generated/astralsorcery.groovy index 8a29c0fe4..320530490 100644 --- a/examples/postInit/generated/astralsorcery.groovy +++ b/examples/postInit/generated/astralsorcery.groovy @@ -2,8 +2,8 @@ // Auto generated groovyscript example file // MODS_LOADED: astralsorcery -import hellfirepvp.astralsorcery.common.constellation.MoonPhase import net.minecraft.util.math.MathHelper +import hellfirepvp.astralsorcery.common.constellation.MoonPhase log 'mod \'astralsorcery\' detected, running script' @@ -129,6 +129,8 @@ mods.astralsorcery.infusion_altar.recipeBuilder() // Converts an input Block or IBlockState into an output IBlockState after being sent a given amount of starlight, with the // ability to require a specific constellation of starlight. +mods.astralsorcery.light_transmutation.setStarmetalReplacementState(blockstate('minecraft:clay')) + mods.astralsorcery.light_transmutation.removeByInput(block('minecraft:netherrack')) mods.astralsorcery.light_transmutation.removeByInput(blockstate('minecraft:sandstone')) mods.astralsorcery.light_transmutation.removeByOutput(block('minecraft:lapis_block')) @@ -151,8 +153,6 @@ mods.astralsorcery.light_transmutation.recipeBuilder() .register() -mods.astralsorcery.light_transmutation.setStarmetalReplacementState(blockstate('minecraft:clay')) - // Lightwell: // Converts an input item into fluid, with a chance at breaking every time fluid is produced. The amount of fluid produced // per interval can be increased via starlight. @@ -298,4 +298,3 @@ mods.astralsorcery.treasure_shrine_registry.remove(ore('oreDiamond')) // mods.astralsorcery.treasure_shrine_registry.removeAll() mods.astralsorcery.treasure_shrine_registry.add(ore('blockDiamond'), 10000) - diff --git a/examples/postInit/generated/atum.groovy b/examples/postInit/generated/atum.groovy index a3285175b..a244e08e2 100644 --- a/examples/postInit/generated/atum.groovy +++ b/examples/postInit/generated/atum.groovy @@ -65,5 +65,3 @@ mods.atum.spinning_wheel.recipeBuilder() .output(item('minecraft:clay') * 4) .rotations(5) .register() - - diff --git a/examples/postInit/generated/avaritia.groovy b/examples/postInit/generated/avaritia.groovy index e3d3a7b91..8a6634715 100644 --- a/examples/postInit/generated/avaritia.groovy +++ b/examples/postInit/generated/avaritia.groovy @@ -53,5 +53,3 @@ mods.avaritia.extreme_crafting.shapelessBuilder() .output(item('minecraft:stone') * 64) .input(item('minecraft:stone'), item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone'), item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone'), item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone'), item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone'), item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone'),item('minecraft:stone')) .register() - - diff --git a/examples/postInit/generated/betterwithaddons.groovy b/examples/postInit/generated/betterwithaddons.groovy index 3dd02d980..07b1d88f1 100644 --- a/examples/postInit/generated/betterwithaddons.groovy +++ b/examples/postInit/generated/betterwithaddons.groovy @@ -281,5 +281,3 @@ mods.betterwithaddons.water_net.recipeBuilder() .input(item('minecraft:gold_ingot')) .output(item('minecraft:clay') * 4, item('minecraft:diamond'), item('minecraft:diamond') * 2) .register() - - diff --git a/examples/postInit/generated/betterwithmods.groovy b/examples/postInit/generated/betterwithmods.groovy index 470a5fd65..a47190731 100644 --- a/examples/postInit/generated/betterwithmods.groovy +++ b/examples/postInit/generated/betterwithmods.groovy @@ -77,11 +77,11 @@ mods.betterwithmods.crucible.recipeBuilder() // Heat: // Creates new levels or adds new blocks to old heat levels. -// mods.betterwithmods.heat.removeAll() - mods.betterwithmods.heat.add(4, item('minecraft:redstone_block'), item('minecraft:redstone_torch')) mods.betterwithmods.heat.add(3, 'torch') +// mods.betterwithmods.heat.removeAll() + // Filtered Hopper: // Recipes for the Filtered Hopper to process. The filter targeted must allow the input item in to function. @@ -192,5 +192,3 @@ mods.betterwithmods.turntable.recipeBuilder() .output(item('minecraft:gold_ingot')) .rotations(2) .register() - - diff --git a/examples/postInit/generated/bewitchment.groovy b/examples/postInit/generated/bewitchment.groovy index 94cbbaa8e..ff0594b90 100644 --- a/examples/postInit/generated/bewitchment.groovy +++ b/examples/postInit/generated/bewitchment.groovy @@ -219,5 +219,3 @@ mods.bewitchment.spinning_wheel.recipeBuilder() .input(item('minecraft:string'), item('minecraft:string'), item('minecraft:string'), item('minecraft:string')) .output(item('minecraft:gold_ingot') * 4, item('minecraft:web')) .register() - - diff --git a/examples/postInit/generated/bloodarsenal.groovy b/examples/postInit/generated/bloodarsenal.groovy index 684a93f7d..d38b9d205 100644 --- a/examples/postInit/generated/bloodarsenal.groovy +++ b/examples/postInit/generated/bloodarsenal.groovy @@ -47,4 +47,3 @@ mods.bloodarsenal.sanguine_infusion.recipeBuilder() // mods.bloodarsenal.sanguine_infusion.addBlacklist(WayofTime.bloodmagic.iface.ISigil.class) - diff --git a/examples/postInit/generated/bloodmagic.groovy b/examples/postInit/generated/bloodmagic.groovy index bbef377af..8bda419b8 100644 --- a/examples/postInit/generated/bloodmagic.groovy +++ b/examples/postInit/generated/bloodmagic.groovy @@ -170,5 +170,3 @@ mods.bloodmagic.tranquility.recipeBuilder() .tranquility('LAVA') .value(500) .register() - - diff --git a/examples/postInit/generated/botania.groovy b/examples/postInit/generated/botania.groovy index 0153a6fef..f94771d5d 100644 --- a/examples/postInit/generated/botania.groovy +++ b/examples/postInit/generated/botania.groovy @@ -185,5 +185,3 @@ mods.botania.entry.entryBuilder() .knowledgeType(newType) .page(mods.botania.lexicon.page.createTextPage('groovy.exampleTextPage')) .register() - - diff --git a/examples/postInit/generated/botania_tweaks.groovy b/examples/postInit/generated/botania_tweaks.groovy index e140848ed..0ba8128bf 100644 --- a/examples/postInit/generated/botania_tweaks.groovy +++ b/examples/postInit/generated/botania_tweaks.groovy @@ -58,5 +58,3 @@ mods.botania_tweaks.agglomeration_plate.recipeBuilder() .edgeReplacement(blockstate('minecraft:lapis_block')) .cornerReplacement(blockstate('botania:livingrock:variant=default')) .register() - - diff --git a/examples/postInit/generated/botanicadds.groovy b/examples/postInit/generated/botanicadds.groovy index fc9efc54c..09ba78a6f 100644 --- a/examples/postInit/generated/botanicadds.groovy +++ b/examples/postInit/generated/botanicadds.groovy @@ -23,5 +23,3 @@ mods.botanicadds.gaia_plate.recipeBuilder() .output(item('minecraft:gold_ingot')) .mana(100) .register() - - diff --git a/examples/postInit/generated/calculator.groovy b/examples/postInit/generated/calculator.groovy index 4474036f9..cbbb8bfab 100644 --- a/examples/postInit/generated/calculator.groovy +++ b/examples/postInit/generated/calculator.groovy @@ -260,5 +260,3 @@ mods.calculator.stone_separator.recipeBuilder() .input(item('minecraft:clay')) .output(item('minecraft:diamond'), item('minecraft:diamond')) .register() - - diff --git a/examples/postInit/generated/compactmachines3.groovy b/examples/postInit/generated/compactmachines3.groovy index b4681a8e5..65d3a2c6b 100644 --- a/examples/postInit/generated/compactmachines3.groovy +++ b/examples/postInit/generated/compactmachines3.groovy @@ -128,5 +128,3 @@ mods.compactmachines3.miniaturization.recipeBuilder() ' ccc ', ' a ') .register() - - diff --git a/examples/postInit/generated/cyclicmagic.groovy b/examples/postInit/generated/cyclicmagic.groovy index 188252686..81380d1a5 100644 --- a/examples/postInit/generated/cyclicmagic.groovy +++ b/examples/postInit/generated/cyclicmagic.groovy @@ -98,5 +98,3 @@ mods.cyclicmagic.solidifier.recipeBuilder() .fluidInput(fluid('lava') * 500) .output(item('minecraft:clay') * 2) .register() - - diff --git a/examples/postInit/generated/draconicevolution.groovy b/examples/postInit/generated/draconicevolution.groovy index 3a0c0660e..fbb448b79 100644 --- a/examples/postInit/generated/draconicevolution.groovy +++ b/examples/postInit/generated/draconicevolution.groovy @@ -33,5 +33,3 @@ mods.draconicevolution.fusion.recipeBuilder() .energy(100000) .tierChaotic() .register() - - diff --git a/examples/postInit/generated/enderio.groovy b/examples/postInit/generated/enderio.groovy index 7174cf237..b39aec550 100644 --- a/examples/postInit/generated/enderio.groovy +++ b/examples/postInit/generated/enderio.groovy @@ -245,5 +245,3 @@ mods.enderio.vat.recipeBuilder() .energy(1000) .tierAny() .register() - - diff --git a/examples/postInit/generated/erebus.groovy b/examples/postInit/generated/erebus.groovy index 4119337a8..793ae0c57 100644 --- a/examples/postInit/generated/erebus.groovy +++ b/examples/postInit/generated/erebus.groovy @@ -71,5 +71,3 @@ mods.erebus.smoothie.recipeBuilder() .fluidInput(fluid('lava') * 500, fluid('formic_acid') * 500, fluid('honey') * 500, fluid('milk') * 500) .output(item('minecraft:clay') * 5) .register() - - diff --git a/examples/postInit/generated/essentialcraft.groovy b/examples/postInit/generated/essentialcraft.groovy index 6604c9b22..607c10e68 100644 --- a/examples/postInit/generated/essentialcraft.groovy +++ b/examples/postInit/generated/essentialcraft.groovy @@ -87,5 +87,3 @@ mods.essentialcraft.wind_rune.recipeBuilder() .output(item('minecraft:diamond_block')) .espe(500) .register() - - diff --git a/examples/postInit/generated/evilcraft.groovy b/examples/postInit/generated/evilcraft.groovy index 0ccc05914..18de3ce56 100644 --- a/examples/postInit/generated/evilcraft.groovy +++ b/examples/postInit/generated/evilcraft.groovy @@ -67,5 +67,3 @@ mods.evilcraft.environmental_accumulator.recipeBuilder() .inputWeather(weather('lightning')) .outputWeather(weather('lightning')) .register() - - diff --git a/examples/postInit/generated/extendedcrafting.groovy b/examples/postInit/generated/extendedcrafting.groovy index 0db3c0803..f0d9ecd42 100644 --- a/examples/postInit/generated/extendedcrafting.groovy +++ b/examples/postInit/generated/extendedcrafting.groovy @@ -151,5 +151,3 @@ mods.extendedcrafting.table_crafting.shapelessBuilder() .output(item('minecraft:stone') * 64) .input(item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone')) .register() - - diff --git a/examples/postInit/generated/extrabotany.groovy b/examples/postInit/generated/extrabotany.groovy index 36214f473..4d2f574ae 100644 --- a/examples/postInit/generated/extrabotany.groovy +++ b/examples/postInit/generated/extrabotany.groovy @@ -21,5 +21,3 @@ mods.extrabotany.pedestal.recipeBuilder() .input(item('minecraft:gold_ingot')) .output(item('minecraft:diamond') * 2) .register() - - diff --git a/examples/postInit/generated/extrautils2.groovy b/examples/postInit/generated/extrautils2.groovy index 089bac062..4cdb2c35a 100644 --- a/examples/postInit/generated/extrautils2.groovy +++ b/examples/postInit/generated/extrautils2.groovy @@ -2,8 +2,8 @@ // Auto generated groovyscript example file // MODS_LOADED: extrautils2 -import com.rwtema.extrautils2.power.IWorldPowerMultiplier import com.rwtema.extrautils2.tile.TilePassiveGenerator +import com.rwtema.extrautils2.power.IWorldPowerMultiplier log 'mod \'extrautils2\' detected, running script' @@ -133,5 +133,3 @@ mods.extrautils2.resonator.recipeBuilder() .ownerTag() .energy(5000) .register() - - diff --git a/examples/postInit/generated/factorytech.groovy b/examples/postInit/generated/factorytech.groovy index 885a48c6b..0b6466343 100644 --- a/examples/postInit/generated/factorytech.groovy +++ b/examples/postInit/generated/factorytech.groovy @@ -384,5 +384,3 @@ mods.factorytech.temperer.recipeBuilder() .output(item('minecraft:clay')) .time(30) .register() - - diff --git a/examples/postInit/generated/futuremc.groovy b/examples/postInit/generated/futuremc.groovy index dca27c043..26b901d80 100644 --- a/examples/postInit/generated/futuremc.groovy +++ b/examples/postInit/generated/futuremc.groovy @@ -112,5 +112,3 @@ mods.futuremc.stonecutter.recipeBuilder() .input(item('minecraft:gold_ingot')) .output(item('minecraft:clay')) .register() - - diff --git a/examples/postInit/generated/horsepower.groovy b/examples/postInit/generated/horsepower.groovy index e3f515a6a..7a828547a 100644 --- a/examples/postInit/generated/horsepower.groovy +++ b/examples/postInit/generated/horsepower.groovy @@ -129,5 +129,3 @@ mods.horsepower.press.recipeBuilder() .input(item('minecraft:diamond')) .fluidOutput(fluid('lava') * 500) .register() - - diff --git a/examples/postInit/generated/iceandfire.groovy b/examples/postInit/generated/iceandfire.groovy index 2f7f088f0..881aa9ebc 100644 --- a/examples/postInit/generated/iceandfire.groovy +++ b/examples/postInit/generated/iceandfire.groovy @@ -62,5 +62,3 @@ mods.iceandfire.ice_forge.recipeBuilder() // .input(item('minecraft:diamond'), item('minecraft:gold_ingot')) // .output(item('minecraft:clay')) // .register() - - diff --git a/examples/postInit/generated/immersiveengineering.groovy b/examples/postInit/generated/immersiveengineering.groovy index 89d32530e..8406aa95a 100644 --- a/examples/postInit/generated/immersiveengineering.groovy +++ b/examples/postInit/generated/immersiveengineering.groovy @@ -248,5 +248,3 @@ mods.immersiveengineering.squeezer.recipeBuilder() .fluidOutput(fluid('water')) .energy(100) .register() - - diff --git a/examples/postInit/generated/immersivepetroleum.groovy b/examples/postInit/generated/immersivepetroleum.groovy index 4b936a7cb..f3339f65c 100644 --- a/examples/postInit/generated/immersivepetroleum.groovy +++ b/examples/postInit/generated/immersivepetroleum.groovy @@ -62,5 +62,3 @@ mods.immersivepetroleum.reservoir.recipeBuilder() .biome('cold') .biomeBlacklist() .register() - - diff --git a/examples/postInit/generated/immersivetech.groovy b/examples/postInit/generated/immersivetech.groovy index 8548ddc4c..1b8d92a37 100644 --- a/examples/postInit/generated/immersivetech.groovy +++ b/examples/postInit/generated/immersivetech.groovy @@ -259,5 +259,3 @@ mods.immersivetech.steam_turbine.recipeBuilder() .fluidOutput(fluid('lava') * 50) .time(50) .register() - - diff --git a/examples/postInit/generated/industrialforegoing.groovy b/examples/postInit/generated/industrialforegoing.groovy index 9a3c1e00c..b0d7c579f 100644 --- a/examples/postInit/generated/industrialforegoing.groovy +++ b/examples/postInit/generated/industrialforegoing.groovy @@ -111,5 +111,3 @@ mods.industrialforegoing.straw.recipeBuilder() .fluidInput(fluid('if.pink_slime')) .effect(new PotionEffect(potion('minecraft:strength'), 1800, 3)) .register() - - diff --git a/examples/postInit/generated/inspirations.groovy b/examples/postInit/generated/inspirations.groovy index 5f5d0bc62..763e894b1 100644 --- a/examples/postInit/generated/inspirations.groovy +++ b/examples/postInit/generated/inspirations.groovy @@ -88,5 +88,3 @@ mods.inspirations.cauldron.recipeBuilderTransform() .fluidOutput(fluid('milk')) .levels(2) .register() - - diff --git a/examples/postInit/generated/integrateddynamics.groovy b/examples/postInit/generated/integrateddynamics.groovy index 11200958e..7ea071bf7 100644 --- a/examples/postInit/generated/integrateddynamics.groovy +++ b/examples/postInit/generated/integrateddynamics.groovy @@ -72,5 +72,3 @@ mods.integrateddynamics.squeezer.recipeBuilder() .input(item('minecraft:diamond')) .fluidOutput(fluid('lava') * 10) .register() - - diff --git a/examples/postInit/generated/jei.groovy b/examples/postInit/generated/jei.groovy index 0f848c421..da52499af 100644 --- a/examples/postInit/generated/jei.groovy +++ b/examples/postInit/generated/jei.groovy @@ -18,6 +18,8 @@ mods.jei.catalyst.add('minecraft.smelting', item('minecraft:clay') * 8, item('mi // Modify the Categories visible in JEI, each of which contain recipes and are associated with specific blocks, typically // machines. Can also set the order of Categories. +mods.jei.category.setOrder('minecraft.crafting', 'jei.information', 'minecraft.smelting', 'groovyscript:burning', 'groovyscript:explosion', 'groovyscript:fluid_recipe', 'groovyscript:piston_push', 'minecraft.anvil') + mods.jei.category.hideCategory('minecraft.fuel') // mods.jei.category.hideAll() @@ -29,8 +31,6 @@ mods.jei.category.hideCategory('minecraft.fuel') // .register() -mods.jei.category.setOrder('minecraft.crafting', 'jei.information', 'minecraft.smelting', 'groovyscript:burning', 'groovyscript:explosion', 'groovyscript:fluid_recipe', 'groovyscript:piston_push', 'minecraft.anvil') - // Description Category: // Modify the description of the input items, where the description is a unique JEI tab containing text. @@ -55,4 +55,3 @@ mods.jei.ingredient.hide(VanillaTypes.ITEM, item('minecraft:bed:*')) mods.jei.ingredient.add(item('minecraft:stone:1').withNbt([display:[Name:'Special Granite']])) mods.jei.ingredient.add(VanillaTypes.ITEM, item('minecraft:bed').withNbt([display:[Name:'Beds come in 16 different colors!']])) - diff --git a/examples/postInit/generated/magneticraft.groovy b/examples/postInit/generated/magneticraft.groovy index 415ce9e42..a6a1fe8ef 100644 --- a/examples/postInit/generated/magneticraft.groovy +++ b/examples/postInit/generated/magneticraft.groovy @@ -211,5 +211,3 @@ mods.magneticraft.thermopile.recipeBuilder() .conductivity(70) .temperature(700) .register() - - diff --git a/examples/postInit/generated/mekanism.groovy b/examples/postInit/generated/mekanism.groovy index 406361ce1..11953521d 100644 --- a/examples/postInit/generated/mekanism.groovy +++ b/examples/postInit/generated/mekanism.groovy @@ -279,4 +279,3 @@ mods.mekanism.washer.recipeBuilder() // mods.mekanism.washer.add(gas('water'), gas('hydrogen')) - diff --git a/examples/postInit/generated/minecraft.groovy b/examples/postInit/generated/minecraft.groovy index b9e98ef0f..77e426b32 100644 --- a/examples/postInit/generated/minecraft.groovy +++ b/examples/postInit/generated/minecraft.groovy @@ -221,4 +221,3 @@ minecraft.player.setStartingItems(true, item('minecraft:clay').withNbt([display: minecraft.rarity.set(textformat('AQUA'), item('minecraft:diamond')) minecraft.rarity.set(textformat('RESET'), item('minecraft:enchanted_book')) - diff --git a/examples/postInit/generated/mysticalagriculture.groovy b/examples/postInit/generated/mysticalagriculture.groovy index 9e9279673..5406f8cdc 100644 --- a/examples/postInit/generated/mysticalagriculture.groovy +++ b/examples/postInit/generated/mysticalagriculture.groovy @@ -21,5 +21,3 @@ mods.mysticalagriculture.reprocessor.recipeBuilder() .input(item('minecraft:diamond')) .output(item('minecraft:gold_ingot')) .register() - - diff --git a/examples/postInit/generated/naturesaura.groovy b/examples/postInit/generated/naturesaura.groovy index 5da760ba4..6ce836066 100644 --- a/examples/postInit/generated/naturesaura.groovy +++ b/examples/postInit/generated/naturesaura.groovy @@ -136,5 +136,3 @@ mods.naturesaura.spawning.recipeBuilder() .aura(10) .time(10) .register() - - diff --git a/examples/postInit/generated/pneumaticcraft.groovy b/examples/postInit/generated/pneumaticcraft.groovy index 804d83b7e..ba624f769 100644 --- a/examples/postInit/generated/pneumaticcraft.groovy +++ b/examples/postInit/generated/pneumaticcraft.groovy @@ -209,5 +209,3 @@ mods.pneumaticcraft.xp_fluid.recipeBuilder() .fluidInput(fluid('lava')) .ratio(5) .register() - - diff --git a/examples/postInit/generated/primal_tech.groovy b/examples/postInit/generated/primal_tech.groovy index 498c1e48c..cfc57d2f1 100644 --- a/examples/postInit/generated/primal_tech.groovy +++ b/examples/postInit/generated/primal_tech.groovy @@ -83,5 +83,3 @@ mods.primal_tech.wooden_basin.recipeBuilder() .fluidInput(fluid('water')) .output(item('minecraft:diamond') * 4) .register() - - diff --git a/examples/postInit/generated/prodigytech.groovy b/examples/postInit/generated/prodigytech.groovy index facd1aa81..4a3eeb6ef 100644 --- a/examples/postInit/generated/prodigytech.groovy +++ b/examples/postInit/generated/prodigytech.groovy @@ -192,4 +192,3 @@ mods.prodigytech.solderer.recipeBuilder() mods.prodigytech.zorra_altar.addEnchantment('sword', enchantment('minecraft:power'), 10) mods.prodigytech.zorra_altar.addEnchantment('stick', enchantment('minecraft:knockback'), 20) mods.prodigytech.zorra_altar.removeEnchantment('sword', enchantment('minecraft:sharpness')) - diff --git a/examples/postInit/generated/projecte.groovy b/examples/postInit/generated/projecte.groovy index ca96480d2..95b92dd86 100644 --- a/examples/postInit/generated/projecte.groovy +++ b/examples/postInit/generated/projecte.groovy @@ -40,5 +40,3 @@ mods.projecte.transmutation.recipeBuilder() .input(blockstate('minecraft:gold_block')) .output(blockstate('minecraft:diamond_block')) .register() - - diff --git a/examples/postInit/generated/pyrotech.groovy b/examples/postInit/generated/pyrotech.groovy index 36a4e2d1b..192d26f13 100644 --- a/examples/postInit/generated/pyrotech.groovy +++ b/examples/postInit/generated/pyrotech.groovy @@ -278,4 +278,3 @@ mods.pyrotech.tanning_rack.recipeBuilder() mods.pyrotech.tanning_rack.add('apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200, item('minecraft:clay_ball')) - diff --git a/examples/postInit/generated/quarryplus.groovy b/examples/postInit/generated/quarryplus.groovy index 81569880d..255410280 100644 --- a/examples/postInit/generated/quarryplus.groovy +++ b/examples/postInit/generated/quarryplus.groovy @@ -15,5 +15,3 @@ mods.quarryplus.workbench_plus.recipeBuilder() .input(item('minecraft:diamond'),item('minecraft:gold_ingot')) .energy(10000) .register() - - diff --git a/examples/postInit/generated/randomthings.groovy b/examples/postInit/generated/randomthings.groovy index 7403c1596..108a9768e 100644 --- a/examples/postInit/generated/randomthings.groovy +++ b/examples/postInit/generated/randomthings.groovy @@ -43,5 +43,3 @@ mods.randomthings.imbuing.recipeBuilder() .input(item('minecraft:clay'), item('minecraft:gold_ingot'), item('minecraft:diamond')) .output(item('minecraft:gold_ingot')) .register() - - diff --git a/examples/postInit/generated/roots.groovy b/examples/postInit/generated/roots.groovy index d87d5ef18..8aa317790 100644 --- a/examples/postInit/generated/roots.groovy +++ b/examples/postInit/generated/roots.groovy @@ -380,5 +380,3 @@ mods.roots.transmutation.recipeBuilder() .start(blockstate('minecraft:diamond_block')) .state(blockstate('minecraft:gold_block')) .register() - - diff --git a/examples/postInit/generated/rustic.groovy b/examples/postInit/generated/rustic.groovy index 59599bf9a..78fd6b411 100644 --- a/examples/postInit/generated/rustic.groovy +++ b/examples/postInit/generated/rustic.groovy @@ -96,5 +96,3 @@ mods.rustic.evaporating_basin.recipeBuilder() .fluidInput(fluid('lava') * 50) .output(item('minecraft:iron_ingot')) .register() - - diff --git a/examples/postInit/generated/silentgems.groovy b/examples/postInit/generated/silentgems.groovy index 414fcee34..961b67599 100644 --- a/examples/postInit/generated/silentgems.groovy +++ b/examples/postInit/generated/silentgems.groovy @@ -26,5 +26,3 @@ mods.silentgems.chaos_altar.recipeBuilder() .catalyst(item('minecraft:diamond')) .cost(5000) .register() - - diff --git a/examples/postInit/generated/tconstruct.groovy b/examples/postInit/generated/tconstruct.groovy index 32ab92093..46f5b0fa2 100644 --- a/examples/postInit/generated/tconstruct.groovy +++ b/examples/postInit/generated/tconstruct.groovy @@ -94,4 +94,3 @@ mods.tconstruct.melting.recipeBuilder() // mods.tconstruct.smeltery_fuel.removeAll() mods.tconstruct.smeltery_fuel.addFuel(fluid('water'), 250) - diff --git a/examples/postInit/generated/techreborn.groovy b/examples/postInit/generated/techreborn.groovy index 3a32295de..3f0f70f47 100644 --- a/examples/postInit/generated/techreborn.groovy +++ b/examples/postInit/generated/techreborn.groovy @@ -583,5 +583,3 @@ mods.techreborn.wire_mill.recipeBuilder() .time(5) .perTick(32) .register() - - diff --git a/examples/postInit/generated/thaumcraft.groovy b/examples/postInit/generated/thaumcraft.groovy index 14fba3f61..b23f36b2b 100644 --- a/examples/postInit/generated/thaumcraft.groovy +++ b/examples/postInit/generated/thaumcraft.groovy @@ -202,4 +202,3 @@ mods.thaumcraft.warp.removeWarp(item('thaumcraft:void_hoe')) // mods.thaumcraft.warp.removeAll() mods.thaumcraft.warp.addWarp(item('minecraft:pumpkin'), 3) - diff --git a/examples/postInit/generated/theaurorian.groovy b/examples/postInit/generated/theaurorian.groovy index a04e34b66..574134484 100644 --- a/examples/postInit/generated/theaurorian.groovy +++ b/examples/postInit/generated/theaurorian.groovy @@ -29,5 +29,3 @@ mods.theaurorian.scrapper.recipeBuilder() .input(item('minecraft:stone_sword')) .output(item('minecraft:cobblestone')) .register() - - diff --git a/examples/postInit/generated/thebetweenlands.groovy b/examples/postInit/generated/thebetweenlands.groovy index 7d125a299..1bc9d064a 100644 --- a/examples/postInit/generated/thebetweenlands.groovy +++ b/examples/postInit/generated/thebetweenlands.groovy @@ -206,4 +206,3 @@ mods.thebetweenlands.steeping_pot.recipeBuilder() mods.thebetweenlands.steeping_pot.addAcceptedItem(item('minecraft:gold_block')) - diff --git a/examples/postInit/generated/thermalexpansion.groovy b/examples/postInit/generated/thermalexpansion.groovy index 3b69444c8..a9b736867 100644 --- a/examples/postInit/generated/thermalexpansion.groovy +++ b/examples/postInit/generated/thermalexpansion.groovy @@ -649,4 +649,3 @@ mods.thermalexpansion.xp_collector.remove(item('minecraft:soul_sand')) // mods.thermalexpansion.xp_collector.removeAll() mods.thermalexpansion.xp_collector.add(item('minecraft:clay'), 100, 30) - diff --git a/examples/postInit/generated/threng.groovy b/examples/postInit/generated/threng.groovy index 17437c42c..26b656d3c 100644 --- a/examples/postInit/generated/threng.groovy +++ b/examples/postInit/generated/threng.groovy @@ -78,5 +78,3 @@ mods.threng.etcher.recipeBuilder() .input(item('minecraft:gold_ingot')) .output(item('minecraft:diamond')) .register() - - diff --git a/examples/postInit/generated/woot.groovy b/examples/postInit/generated/woot.groovy index ef95539c2..c2fa245bc 100644 --- a/examples/postInit/generated/woot.groovy +++ b/examples/postInit/generated/woot.groovy @@ -104,5 +104,3 @@ mods.woot.stygian_iron_anvil.recipeBuilder() .output(item('minecraft:clay')) .preserveBase() .register() - - diff --git a/examples/preInit/generated/mekanism.groovy b/examples/preInit/generated/mekanism.groovy index 94354dec0..66ec0da8e 100644 --- a/examples/preInit/generated/mekanism.groovy +++ b/examples/preInit/generated/mekanism.groovy @@ -8,4 +8,4 @@ log 'mod \'mekanism\' detected, running script' eventManager.listen { TextureStitchEvent.Pre event -> event.getMap().registerSprite(resource('groovyscriptdev:blocks/mekanism_infusion_texture')) -} \ No newline at end of file +} diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index 05e3ec731..03c3d00c5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -60,7 +60,7 @@ public static void generateWiki(File targetFolder, ContainerHolder container) { public static void writeNormalWikiFile(File targetFolder, LinkIndex linkIndex, String id, String title, String doc) { String location = id + MARKDOWN_FILE_EXTENSION; linkIndex.add(String.format(BULLET_POINT_LINK, title, location)); - write(new File(targetFolder, location), doc.trim().concat("\n")); + write(new File(targetFolder, location), doc.trim() + "\n"); } public static void generateExamples(File targetFile, LoadStage loadStage, ContainerHolder container) { @@ -81,7 +81,7 @@ public static void generateExamples(File targetFile, LoadStage loadStage, Contai String header = EXAMPLE_GENERATION_NOTE + container.header().apply(getImportBlock(imports)) + "\n\n"; - write(targetFile, header + body); + write(targetFile, "\n" + header + body.toString().trim() + "\n"); } public static void write(File file, String text) { From 0f3aadd1f9bbfea0bcc14daeff00b047747ee737 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 07:32:26 -0700 Subject: [PATCH 35/92] change carving sound to ADDITION --- examples/postInit/generated/chisel.groovy | 2 -- .../cleanroommc/groovyscript/compat/mods/chisel/Carving.java | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/postInit/generated/chisel.groovy b/examples/postInit/generated/chisel.groovy index 32205168a..8aa949214 100644 --- a/examples/postInit/generated/chisel.groovy +++ b/examples/postInit/generated/chisel.groovy @@ -16,6 +16,4 @@ mods.chisel.carving.addGroup('demo') mods.chisel.carving.addVariation('demo', item('chisel:antiblock:3')) mods.chisel.carving.addVariation('demo', item('minecraft:sea_lantern')) mods.chisel.carving.addVariation('demo', item('minecraft:diamond_block')) - mods.chisel.carving.setSound('demo', sound('minecraft:block.glass.break')) - diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Carving.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Carving.java index 514d76b24..bf4fac0f3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Carving.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Carving.java @@ -108,7 +108,7 @@ public void removeVariation(String groupName, ItemStack item) { } } - @MethodDescription(example = @Example("'demo', sound('minecraft:block.glass.break')"), type = MethodDescription.Type.VALUE) + @MethodDescription(example = @Example("'demo', sound('minecraft:block.glass.break')"), type = MethodDescription.Type.ADDITION) public void setSound(String group, SoundEvent sound) { ICarvingGroup carvingGroup = getRegistry().getGroup(group); if (carvingGroup == null) { @@ -121,7 +121,7 @@ public void setSound(String group, SoundEvent sound) { setSound(carvingGroup, sound); } - @MethodDescription(type = MethodDescription.Type.VALUE) + @MethodDescription(type = MethodDescription.Type.ADDITION) public void setSound(ICarvingGroup group, SoundEvent sound) { getRegistry().setVariationSound(group.getName(), sound); soundStorage.addBackup(Pair.of(group.getName(), group.getSound())); From f6c77f8e39b475043eab865fd183110d12d8a576 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 07:47:19 -0700 Subject: [PATCH 36/92] simplify documenting type method --- .../cleanroommc/groovyscript/documentation/Registry.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 3d856d6d7..ff8ffb74b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -194,14 +194,11 @@ public String exampleBlock() { private String documentMethodDescriptionType(MethodDescription.Type type) { StringBuilder out = new StringBuilder(); - var hasExamples = false; for (var entry : methods.get(type)) { - var examples = examples(entry); - out.append(examples); - if (!hasExamples && !examples.isEmpty()) hasExamples = true; + out.append(examples(entry)); } - if (hasExamples) out.append("\n"); - return out.toString(); + if (out.toString().isEmpty()) return ""; + return out + "\n"; } private String generateHeader() { From af8e7b46f89e539f473ee9074c5c34a5fe317a42 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 07:52:28 -0700 Subject: [PATCH 37/92] streamline compare packages --- .../groovyscript/documentation/Exporter.java | 2 +- .../groovyscript/documentation/Registry.java | 2 +- .../documentation/helper/ComparisonHelper.java | 17 +++++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index 03c3d00c5..b1bbcf45e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -122,7 +122,7 @@ private static List getRegistries(ContainerHolder contai private static String getImportBlock(List imports) { if (imports.isEmpty()) return ""; var list = new ArrayList<>(new ObjectOpenHashSet<>(imports)); - list.sort(ComparisonHelper::splitString); + list.sort(ComparisonHelper::packages); var sb = new StringBuilder(); for (var x : list) { sb.append("\nimport ").append(x); diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index ff8ffb74b..d055c1060 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -114,7 +114,7 @@ private static List generateAliases(ContainerHolder container, INamed re list.add(x.getKey()); } } - list.sort(ComparisonHelper::splitString); + list.sort(ComparisonHelper::packages); return list; } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java index f18ba8ed0..03e6f72e3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java @@ -9,7 +9,6 @@ import org.apache.commons.lang3.StringUtils; import java.lang.reflect.Method; -import java.util.stream.IntStream; /** * A helper class for comparing various documentation elements against each other. @@ -91,13 +90,15 @@ public static int property(Property left, Property right) { .result(); } - public static int splitString(String left, String right) { - return ComparisonChain.start() - .compare(StringUtils.countMatches(left, '.'), StringUtils.countMatches(right, '.')) - .compare(StringUtils.split(left, '.'), StringUtils.split(right, '.'), - (a, b) -> IntStream.range(0, Math.min(a.length, b.length)).map(x -> string(a[x], b[x])).filter(x -> x != 0).findFirst().orElse(0)) - .compare(left, right, ComparisonHelper::string) - .result(); + public static int packages(String left, String right) { + var a = StringUtils.split(left, '.'); + var b = StringUtils.split(right, '.'); + var chain = ComparisonChain.start().compare(a.length, b.length); + int bound = Math.min(a.length, b.length); + for (int x = 0; x < bound; x++) { + chain = chain.compare(a[x], b[x], ComparisonHelper::string); + } + return chain.result(); } public static int stringCase(String left, String right) { From 8ec95d54116fb25104d073fa26cfac8e42fe834f Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 07:54:54 -0700 Subject: [PATCH 38/92] convert example to use case insensitive --- .../documentation/helper/ComparisonHelper.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java index 03e6f72e3..25522760c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java @@ -36,7 +36,7 @@ public static int example(Example left, Example right) { return ComparisonChain.start() .compare(left.priority(), right.priority()) .compareFalseFirst(left.commented(), right.commented()) - .compare(left.value(), right.value(), ComparisonHelper::stringCase) + .compare(left.value(), right.value(), ComparisonHelper::string) .result(); } @@ -101,13 +101,6 @@ public static int packages(String left, String right) { return chain.result(); } - public static int stringCase(String left, String right) { - return ComparisonChain.start() - .compare(left.length(), right.length()) - .compare(left, right) - .result(); - } - public static int string(String left, String right) { return ComparisonChain.start() .compare(left.length(), right.length()) From 5fcc8eaac8c03863f5d9d832ac591209878f59a4 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 07:57:47 -0700 Subject: [PATCH 39/92] sort example entries better --- .../generated/actuallyadditions.groovy | 6 +-- .../postInit/generated/advancedmortars.groovy | 2 +- .../generated/appliedenergistics2.groovy | 8 +-- .../postInit/generated/arcaneworld.groovy | 54 +++++++++---------- .../postInit/generated/astralsorcery.groovy | 26 ++++----- .../postInit/generated/betterwithmods.groovy | 4 +- .../postInit/generated/bewitchment.groovy | 4 +- .../postInit/generated/bloodarsenal.groovy | 4 +- examples/postInit/generated/bloodmagic.groovy | 8 +-- examples/postInit/generated/botania.groovy | 20 +++---- .../postInit/generated/botania_tweaks.groovy | 4 +- examples/postInit/generated/chisel.groovy | 2 +- .../generated/compactmachines3.groovy | 2 +- examples/postInit/generated/enderio.groovy | 2 +- examples/postInit/generated/erebus.groovy | 10 ++-- .../postInit/generated/essentialcraft.groovy | 2 +- .../generated/extendedcrafting.groovy | 2 +- .../postInit/generated/extrautils2.groovy | 4 +- .../generated/immersiveengineering.groovy | 10 ++-- .../generated/industrialforegoing.groovy | 6 +-- .../postInit/generated/inspirations.groovy | 26 ++++----- examples/postInit/generated/jei.groovy | 4 +- .../postInit/generated/magneticraft.groovy | 2 +- examples/postInit/generated/mekanism.groovy | 4 +- examples/postInit/generated/minecraft.groovy | 16 +++--- .../postInit/generated/naturesaura.groovy | 14 ++--- .../postInit/generated/pneumaticcraft.groovy | 4 +- .../postInit/generated/prodigytech.groovy | 2 +- examples/postInit/generated/roots.groovy | 22 ++++---- examples/postInit/generated/silentgems.groovy | 2 +- examples/postInit/generated/tconstruct.groovy | 2 +- examples/postInit/generated/thaumcraft.groovy | 2 +- .../postInit/generated/thebetweenlands.groovy | 4 +- .../generated/thermalexpansion.groovy | 28 +++++----- examples/postInit/generated/woot.groovy | 22 ++++---- .../helper/ComparisonHelper.java | 7 ++- 36 files changed, 170 insertions(+), 171 deletions(-) diff --git a/examples/postInit/generated/actuallyadditions.groovy b/examples/postInit/generated/actuallyadditions.groovy index 4b5bae921..b2aca97a8 100644 --- a/examples/postInit/generated/actuallyadditions.groovy +++ b/examples/postInit/generated/actuallyadditions.groovy @@ -120,8 +120,8 @@ mods.actuallyadditions.empowerer.recipeBuilder() // A weighted oredict for the block obtained via firing a Mining Lens at a block of Netherrack. The oredict must have a // block, or the world will hang. -mods.actuallyadditions.nether_mining_lens.removeByOre(ore('oreQuartz')) mods.actuallyadditions.nether_mining_lens.removeByOre('oreQuartz') +mods.actuallyadditions.nether_mining_lens.removeByOre(ore('oreQuartz')) // mods.actuallyadditions.nether_mining_lens.removeAll() mods.actuallyadditions.nether_mining_lens.recipeBuilder() @@ -139,8 +139,8 @@ mods.actuallyadditions.nether_mining_lens.recipeBuilder() // Turns a fluid into power at a rate. mods.actuallyadditions.oil_gen.removeByInput(fluid('canolaoil').getFluid()) -mods.actuallyadditions.oil_gen.removeByInput(fluid('canolaoil')) mods.actuallyadditions.oil_gen.removeByInput('refinedcanolaoil') +mods.actuallyadditions.oil_gen.removeByInput(fluid('canolaoil')) // mods.actuallyadditions.oil_gen.removeAll() mods.actuallyadditions.oil_gen.recipeBuilder() @@ -160,8 +160,8 @@ mods.actuallyadditions.oil_gen.recipeBuilder() // A weighted oredict for the block obtained via firing a Mining Lens at a block of Stone. The oredict must have a block, // or the world will hang. -mods.actuallyadditions.stone_mining_lens.removeByOre(ore('oreCoal')) mods.actuallyadditions.stone_mining_lens.removeByOre('oreLapis') +mods.actuallyadditions.stone_mining_lens.removeByOre(ore('oreCoal')) // mods.actuallyadditions.stone_mining_lens.removeAll() mods.actuallyadditions.stone_mining_lens.recipeBuilder() diff --git a/examples/postInit/generated/advancedmortars.groovy b/examples/postInit/generated/advancedmortars.groovy index 805d58b6c..f6736da41 100644 --- a/examples/postInit/generated/advancedmortars.groovy +++ b/examples/postInit/generated/advancedmortars.groovy @@ -32,6 +32,6 @@ mods.advancedmortars.mortar.recipeBuilder() .register() -mods.advancedmortars.mortar.add(['iron', 'wood'], item('minecraft:tnt') * 5, 4, item('minecraft:tnt'), 0.7, [ore('ingotIron'), ore('ingotIron'), ore('ingotIron'), ore('ingotIron'),ore('ingotIron'), ore('ingotIron'), ore('ingotIron'), ore('ingotIron')]) mods.advancedmortars.mortar.add(['stone'], item('minecraft:tnt'), 4, [ore('ingotGold')]) mods.advancedmortars.mortar.add(['stone'], item('minecraft:diamond') * 4, 4, [ore('ingotGold')]) +mods.advancedmortars.mortar.add(['iron', 'wood'], item('minecraft:tnt') * 5, 4, item('minecraft:tnt'), 0.7, [ore('ingotIron'), ore('ingotIron'), ore('ingotIron'), ore('ingotIron'),ore('ingotIron'), ore('ingotIron'), ore('ingotIron'), ore('ingotIron')]) diff --git a/examples/postInit/generated/appliedenergistics2.groovy b/examples/postInit/generated/appliedenergistics2.groovy index d4ccf8fdb..92ab4180d 100644 --- a/examples/postInit/generated/appliedenergistics2.groovy +++ b/examples/postInit/generated/appliedenergistics2.groovy @@ -10,15 +10,15 @@ log 'mod \'appliedenergistics2\' detected, running script' // Controls using specific items, any items from a mod, or any items with a Capability to convert a P2P into a specific // tunnel type. -mods.appliedenergistics2.attunement.remove(Capabilities.FORGE_ENERGY, tunnel('fe_power')) -mods.appliedenergistics2.attunement.remove(item('minecraft:lever'), tunnel('redstone')) mods.appliedenergistics2.attunement.remove('thermaldynamics', tunnel('fe_power')) +mods.appliedenergistics2.attunement.remove(item('minecraft:lever'), tunnel('redstone')) +mods.appliedenergistics2.attunement.remove(Capabilities.FORGE_ENERGY, tunnel('fe_power')) mods.appliedenergistics2.attunement.removeByTunnel(tunnel('item')) // mods.appliedenergistics2.attunement.removeAll() -mods.appliedenergistics2.attunement.add(Capabilities.FORGE_ENERGY, tunnel('item')) -mods.appliedenergistics2.attunement.add(item('minecraft:clay'), tunnel('item')) mods.appliedenergistics2.attunement.add('thermaldynamics', tunnel('redstone')) +mods.appliedenergistics2.attunement.add(item('minecraft:clay'), tunnel('item')) +mods.appliedenergistics2.attunement.add(Capabilities.FORGE_ENERGY, tunnel('item')) // Cannon Ammo: // Item and weight, where weight is a factor in how much damage is dealt. diff --git a/examples/postInit/generated/arcaneworld.groovy b/examples/postInit/generated/arcaneworld.groovy index a83663dae..2c2197497 100644 --- a/examples/postInit/generated/arcaneworld.groovy +++ b/examples/postInit/generated/arcaneworld.groovy @@ -21,51 +21,40 @@ mods.arcaneworld.ritual.recipeBuilder() .name('groovyscript:custom_name') .register() +mods.arcaneworld.ritual.recipeBuilderTime() + .input(item('minecraft:diamond'), item('minecraft:clay'), item('minecraft:clay'), item('minecraft:clay')) + .translationKey('groovyscript.demo_time') + .time(5000) + .register() + mods.arcaneworld.ritual.recipeBuilderArena() .input(item('minecraft:stone'), item('minecraft:stone'), item('minecraft:clay')) .translationKey('groovyscript.demo_arena') .entity(entity('minecraft:chicken')) .register() -mods.arcaneworld.ritual.recipeBuilderCommand() - .input(item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:clay')) - .translationKey('groovyscript.demo_command') - .command('say hi', - 'give @p minecraft:coal 5') - .register() - -mods.arcaneworld.ritual.recipeBuilderCreateItem() - .input(item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond')) - .translationKey('groovyscript.demo_create_item') - .output(item('minecraft:diamond')) - .register() - mods.arcaneworld.ritual.recipeBuilderCustom() .input(item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:clay'), item('minecraft:clay')) .translationKey('groovyscript.demo_custom') .onActivate({ World world, BlockPos blockPos, EntityPlayer player, ItemStack... itemStacks -> { log.info blockPos } }) .register() -mods.arcaneworld.ritual.recipeBuilderDragonBreath() - .input(item('minecraft:clay'), item('minecraft:clay'), item('minecraft:clay'), item('minecraft:clay'), item('minecraft:clay')) - .translationKey('groovyscript.demo_dragon_breath') - .register() - -mods.arcaneworld.ritual.recipeBuilderDungeon() - .input(item('minecraft:diamond'), item('minecraft:clay'), item('minecraft:clay')) - .translationKey('groovyscript.demo_dungeon') - .register() - mods.arcaneworld.ritual.recipeBuilderSummon() .input(item('minecraft:stone'), item('minecraft:clay'), item('minecraft:clay')) .translationKey('groovyscript.demo_summon') .entity(entity('minecraft:chicken')) .register() -mods.arcaneworld.ritual.recipeBuilderTime() - .input(item('minecraft:diamond'), item('minecraft:clay'), item('minecraft:clay'), item('minecraft:clay')) - .translationKey('groovyscript.demo_time') - .time(5000) +mods.arcaneworld.ritual.recipeBuilderCommand() + .input(item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:clay')) + .translationKey('groovyscript.demo_command') + .command('say hi', + 'give @p minecraft:coal 5') + .register() + +mods.arcaneworld.ritual.recipeBuilderDungeon() + .input(item('minecraft:diamond'), item('minecraft:clay'), item('minecraft:clay')) + .translationKey('groovyscript.demo_dungeon') .register() mods.arcaneworld.ritual.recipeBuilderWeather() @@ -85,3 +74,14 @@ mods.arcaneworld.ritual.recipeBuilderWeather() .translationKey('groovyscript.demo_weather_thunder') .weatherThunder() .register() + +mods.arcaneworld.ritual.recipeBuilderCreateItem() + .input(item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond')) + .translationKey('groovyscript.demo_create_item') + .output(item('minecraft:diamond')) + .register() + +mods.arcaneworld.ritual.recipeBuilderDragonBreath() + .input(item('minecraft:clay'), item('minecraft:clay'), item('minecraft:clay'), item('minecraft:clay'), item('minecraft:clay')) + .translationKey('groovyscript.demo_dragon_breath') + .register() diff --git a/examples/postInit/generated/astralsorcery.groovy b/examples/postInit/generated/astralsorcery.groovy index 320530490..0b57f31a2 100644 --- a/examples/postInit/generated/astralsorcery.groovy +++ b/examples/postInit/generated/astralsorcery.groovy @@ -26,11 +26,19 @@ mods.astralsorcery.chalice_interaction.recipeBuilder() // Create a custom Constellation. mods.astralsorcery.constellation.remove(constellation('bootes')) -mods.astralsorcery.constellation.removeConstellationMapEffect(constellation('discidia')) mods.astralsorcery.constellation.removeSignatureItems(constellation('discidia')) +mods.astralsorcery.constellation.removeConstellationMapEffect(constellation('discidia')) // mods.astralsorcery.constellation.removeAll() -// mods.astralsorcery.constellation.removeAllConstellationMapEffect() // mods.astralsorcery.constellation.removeAllSignatureItems() +// mods.astralsorcery.constellation.removeAllConstellationMapEffect() + +mods.astralsorcery.constellation.signatureItems() + .constellation(constellation('square')) + .addItem(ore('gemDiamond')) + .addItem(item('minecraft:water_bucket')) + .addItem(item('minecraft:rabbit_foot')) + .addItem(item('minecraft:fish')) + .register() mods.astralsorcery.constellation.constellationBuilder() .major() @@ -57,14 +65,6 @@ mods.astralsorcery.constellation.constellationMapEffectBuilder() .potionEffect(potion('minecraft:luck'), 1, 2) .register() -mods.astralsorcery.constellation.signatureItems() - .constellation(constellation('square')) - .addItem(ore('gemDiamond')) - .addItem(item('minecraft:water_bucket')) - .addItem(item('minecraft:rabbit_foot')) - .addItem(item('minecraft:fish')) - .register() - // Fountain: // Adds virtual aquifers that can be accessed via the Evershifting Fountain's Necromantic Prime. @@ -157,9 +157,9 @@ mods.astralsorcery.light_transmutation.recipeBuilder() // Converts an input item into fluid, with a chance at breaking every time fluid is produced. The amount of fluid produced // per interval can be increased via starlight. -mods.astralsorcery.lightwell.removeByCatalyst(item('minecraft:ice')) mods.astralsorcery.lightwell.removeByInput(item('minecraft:packed_ice')) mods.astralsorcery.lightwell.removeByOutput(fluid('lava')) +mods.astralsorcery.lightwell.removeByCatalyst(item('minecraft:ice')) // mods.astralsorcery.lightwell.removeAll() mods.astralsorcery.lightwell.recipeBuilder() @@ -194,8 +194,8 @@ mods.astralsorcery.perk_tree_config.setXpFunction({ int i, long prev -> prev + 1 // Research Pages: // Add custom Research Pages to the Astral Sorcery Book. -mods.astralsorcery.research.disconnectNodes('MY_TEST_RESEARCH', 'ALTAR1') mods.astralsorcery.research.removeNode('CPAPER') +mods.astralsorcery.research.disconnectNodes('MY_TEST_RESEARCH', 'ALTAR1') mods.astralsorcery.research.researchBuilder() .name('MY_TEST_RESEARCH') @@ -217,8 +217,8 @@ mods.astralsorcery.research.researchBuilder() .register() -mods.astralsorcery.research.connectNodes('MY_TEST_RESEARCH2', 'ENHANCED_COLLECTOR') mods.astralsorcery.research.moveNode('SOOTYMARBLE', 5, 6) +mods.astralsorcery.research.connectNodes('MY_TEST_RESEARCH2', 'ENHANCED_COLLECTOR') // Starlight Altar: // Allows creation of shaped recipes in the Astral Sorcery Crafting Altar chain. diff --git a/examples/postInit/generated/betterwithmods.groovy b/examples/postInit/generated/betterwithmods.groovy index a47190731..9bf45bd96 100644 --- a/examples/postInit/generated/betterwithmods.groovy +++ b/examples/postInit/generated/betterwithmods.groovy @@ -77,8 +77,8 @@ mods.betterwithmods.crucible.recipeBuilder() // Heat: // Creates new levels or adds new blocks to old heat levels. -mods.betterwithmods.heat.add(4, item('minecraft:redstone_block'), item('minecraft:redstone_torch')) mods.betterwithmods.heat.add(3, 'torch') +mods.betterwithmods.heat.add(4, item('minecraft:redstone_block'), item('minecraft:redstone_torch')) // mods.betterwithmods.heat.removeAll() @@ -106,8 +106,8 @@ mods.betterwithmods.hopper.recipeBuilder() // Hopper Filters: // Items placed in the middle slot of the Filtered Hopper to restrict what is capable of passing through. -mods.betterwithmods.hopper_filters.removeByFilter(item('minecraft:trapdoor')) mods.betterwithmods.hopper_filters.removeByName('betterwithmods:ladder') +mods.betterwithmods.hopper_filters.removeByFilter(item('minecraft:trapdoor')) // mods.betterwithmods.hopper_filters.removeAll() mods.betterwithmods.hopper_filters.recipeBuilder() diff --git a/examples/postInit/generated/bewitchment.groovy b/examples/postInit/generated/bewitchment.groovy index ff0594b90..02794a466 100644 --- a/examples/postInit/generated/bewitchment.groovy +++ b/examples/postInit/generated/bewitchment.groovy @@ -9,8 +9,8 @@ log 'mod \'bewitchment\' detected, running script' // logs based on their uniqueness. The upgrades modify the amount gained per second and the maximum Magic Power the Altar // can hold. -mods.bewitchment.altar_upgrade.remove(blockstate('bewitchment:goblet')) mods.bewitchment.altar_upgrade.remove(item('bewitchment:garnet')) +mods.bewitchment.altar_upgrade.remove(blockstate('bewitchment:goblet')) mods.bewitchment.altar_upgrade.removeByType(com.bewitchment.api.registry.AltarUpgrade.Type.WAND) // mods.bewitchment.altar_upgrade.removeAll() @@ -47,8 +47,8 @@ mods.bewitchment.altar_upgrade.recipeBuilder() mods.bewitchment.athame_loot.removeByOutput(item('bewitchment:spectral_dust')) // mods.bewitchment.athame_loot.removeAll() -mods.bewitchment.athame_loot.add(entity('minecraft:pig'), item('minecraft:gold_ingot')) mods.bewitchment.athame_loot.add(entity('minecraft:cow'), item('minecraft:clay') * 5, item('minecraft:iron_sword')) +mods.bewitchment.athame_loot.add(entity('minecraft:pig'), item('minecraft:gold_ingot')) // Witches' Cauldron Brew: // After throwing a `bewitchment:mandrake_root` in the Witches' Cauldron while Magic Power is provided, all items thrown in diff --git a/examples/postInit/generated/bloodarsenal.groovy b/examples/postInit/generated/bloodarsenal.groovy index d38b9d205..5d8f9042f 100644 --- a/examples/postInit/generated/bloodarsenal.groovy +++ b/examples/postInit/generated/bloodarsenal.groovy @@ -10,11 +10,11 @@ log 'mod \'bloodarsenal\' detected, running script' // an infusion item, adds or upgrades a modifier to the given stasis tool, with the ability to increase the quantity of // inputs consumed based on level. -// mods.bloodarsenal.sanguine_infusion.removeBlacklist(WayofTime.bloodmagic.iface.ISigil.class) mods.bloodarsenal.sanguine_infusion.removeByInput(item('minecraft:feather')) mods.bloodarsenal.sanguine_infusion.removeByInput(item('bloodmagic:bound_axe')) -// mods.bloodarsenal.sanguine_infusion.removeByModifierKey('beneficial_potion') mods.bloodarsenal.sanguine_infusion.removeByOutput(item('bloodarsenal:stasis_pickaxe')) +// mods.bloodarsenal.sanguine_infusion.removeBlacklist(WayofTime.bloodmagic.iface.ISigil.class) +// mods.bloodarsenal.sanguine_infusion.removeByModifierKey('beneficial_potion') // mods.bloodarsenal.sanguine_infusion.removeAll() // mods.bloodarsenal.sanguine_infusion.removeAllBlacklist() diff --git a/examples/postInit/generated/bloodmagic.groovy b/examples/postInit/generated/bloodmagic.groovy index 8bda419b8..25c540fe0 100644 --- a/examples/postInit/generated/bloodmagic.groovy +++ b/examples/postInit/generated/bloodmagic.groovy @@ -8,10 +8,10 @@ log 'mod \'bloodmagic\' detected, running script' // Converts two items into an output itemstack by using Arcane Ashes in-world. Has a configurable texture for the // animation. -mods.bloodmagic.alchemy_array.removeByCatalyst(item('bloodmagic:slate:2')) mods.bloodmagic.alchemy_array.removeByInput(item('bloodmagic:component:13')) -mods.bloodmagic.alchemy_array.removeByInputAndCatalyst(item('bloodmagic:component:7'), item('bloodmagic:slate:1')) mods.bloodmagic.alchemy_array.removeByOutput(item('bloodmagic:sigil_void')) +mods.bloodmagic.alchemy_array.removeByCatalyst(item('bloodmagic:slate:2')) +mods.bloodmagic.alchemy_array.removeByInputAndCatalyst(item('bloodmagic:component:7'), item('bloodmagic:slate:1')) // mods.bloodmagic.alchemy_array.removeAll() mods.bloodmagic.alchemy_array.recipeBuilder() @@ -85,8 +85,8 @@ mods.bloodmagic.blood_altar.recipeBuilder() // components, size, explosion strength, and Life Essence cost. mods.bloodmagic.meteor.remove(item('minecraft:diamond_block')) -mods.bloodmagic.meteor.removeByCatalyst(item('minecraft:iron_block')) mods.bloodmagic.meteor.removeByInput(item('minecraft:gold_block')) +mods.bloodmagic.meteor.removeByCatalyst(item('minecraft:iron_block')) // mods.bloodmagic.meteor.removeAll() mods.bloodmagic.meteor.recipeBuilder() @@ -110,9 +110,9 @@ mods.bloodmagic.meteor.recipeBuilder() // Sacrificial: // How much Life Essence is gained when using the Sacrificial Dagger on a mob. +mods.bloodmagic.sacrificial.remove('minecraft:villager') mods.bloodmagic.sacrificial.remove(entity('minecraft:villager')) mods.bloodmagic.sacrificial.remove(resource('minecraft:villager')) -mods.bloodmagic.sacrificial.remove('minecraft:villager') // mods.bloodmagic.sacrificial.removeAll() mods.bloodmagic.sacrificial.recipeBuilder() diff --git a/examples/postInit/generated/botania.groovy b/examples/postInit/generated/botania.groovy index f94771d5d..7303c8f6a 100644 --- a/examples/postInit/generated/botania.groovy +++ b/examples/postInit/generated/botania.groovy @@ -72,9 +72,9 @@ mods.botania.magnet.addToBlacklist(item('minecraft:diamond')) // Mana Infusion: // Toss an item into a mana pool with an optional catalyst blockstate below the pool. -mods.botania.mana_infusion.removeByCatalyst(blockstate('botania:alchemycatalyst')) mods.botania.mana_infusion.removeByInput(item('minecraft:ender_pearl')) mods.botania.mana_infusion.removeByOutput(item('botania:managlass')) +mods.botania.mana_infusion.removeByCatalyst(blockstate('botania:alchemycatalyst')) // mods.botania.mana_infusion.removeAll() mods.botania.mana_infusion.recipeBuilder() @@ -88,9 +88,9 @@ mods.botania.mana_infusion.recipeBuilder() // Orechid: // Converts stone blocks into one of a few ore blocks at the cost of mana. +mods.botania.orechid.removeByOutput('oreCoal') // mods.botania.orechid.removeByOutput(ore('oreQuartz')) // mods.botania.orechid.removeByOutput(ore('oreEmerald')) -mods.botania.orechid.removeByOutput('oreCoal') // mods.botania.orechid.removeAll() mods.botania.orechid.add(ore('blockGold'), 1800) @@ -99,9 +99,9 @@ mods.botania.orechid.add(ore('oreEmerald'), 1350) // Orechid Ignem: // Converts netherrack blocks into one of a few ore blocks at the cost of mana. +mods.botania.orechid_ignem.removeByOutput('oreQuartz') // mods.botania.orechid_ignem.removeByOutput(ore('oreQuartz')) // mods.botania.orechid_ignem.removeByOutput(ore('oreEmerald')) -mods.botania.orechid_ignem.removeByOutput('oreQuartz') // mods.botania.orechid_ignem.removeAll() mods.botania.orechid_ignem.add(ore('blockGold'), 1800) @@ -159,17 +159,17 @@ mods.botania.category.add('first', resource('minecraft:textures/items/clay_ball. mods.botania.page.removeByEntry('botania.entry.runeAltar') // mods.botania.page.removeAll() +// mods.botania.page.createRunePage('groovy.exampleRunePage', mods.botania.runealtar.recipeBuilder().input(ore('gemEmerald'), item('minecraft:apple')).output(item('minecraft:diamond')).mana(500).register()) +mods.botania.page.createTextPage('groovy.exampleTextPage') +mods.botania.page.createImagePage('groovy.exampleImagePage', 'minecraft:textures/items/apple.png') +// mods.botania.page.createPetalPage('groovy.examplePetalPage', mods.botania.apothecary.recipeBuilder().input(ore('blockGold'), ore('ingotIron'), item('minecraft:apple')).output(item('minecraft:golden_apple')).register()) +mods.botania.page.createEntityPage('groovy.exampleEntityPage', 100, 'minecraft:wither_skeleton') +mods.botania.page.createEntityPage('groovy.exampleEntityPage', 5, entity('minecraft:wither_skeleton')) // mods.botania.page.createBrewingPage('groovy.exampleBrewingPage', 'bottomText', 'bottomText', mods.botania.brewrecipe.recipeBuilder().input(item('minecraft:clay'), ore('ingotGold'), ore('gemDiamond')).brew(brew('absorption')).register()) mods.botania.page.createCraftingPage('groovy.exampleCraftingPage', 'minecraft:clay') -// mods.botania.page.createElvenTradePage('groovy.exampleElvenTradePage', mods.botania.elventrade.recipeBuilder().input(ore('ingotGold'), ore('ingotIron')).output(item('botania:manaresource:7')).register()) -mods.botania.page.createEntityPage('groovy.exampleEntityPage', 5, entity('minecraft:wither_skeleton')) -mods.botania.page.createEntityPage('groovy.exampleEntityPage', 100, 'minecraft:wither_skeleton') -mods.botania.page.createImagePage('groovy.exampleImagePage', 'minecraft:textures/items/apple.png') // mods.botania.page.createInfusionPage('groovy.exampleInfusionPage', mods.botania.manainfusion.recipeBuilder().input(ore('ingotGold')).output(item('botania:manaresource', 1)).mana(500).catalyst(blockstate('minecraft:stone')).register()) mods.botania.page.createLoreTextPage('groovy.exampleLoreTextPage') -// mods.botania.page.createPetalPage('groovy.examplePetalPage', mods.botania.apothecary.recipeBuilder().input(ore('blockGold'), ore('ingotIron'), item('minecraft:apple')).output(item('minecraft:golden_apple')).register()) -// mods.botania.page.createRunePage('groovy.exampleRunePage', mods.botania.runealtar.recipeBuilder().input(ore('gemEmerald'), item('minecraft:apple')).output(item('minecraft:diamond')).mana(500).register()) -mods.botania.page.createTextPage('groovy.exampleTextPage') +// mods.botania.page.createElvenTradePage('groovy.exampleElvenTradePage', mods.botania.elventrade.recipeBuilder().input(ore('ingotGold'), ore('ingotIron')).output(item('botania:manaresource:7')).register()) // Lexicon Entry: // Entry creates a new entry in a given category. diff --git a/examples/postInit/generated/botania_tweaks.groovy b/examples/postInit/generated/botania_tweaks.groovy index 0ba8128bf..f98cf2517 100644 --- a/examples/postInit/generated/botania_tweaks.groovy +++ b/examples/postInit/generated/botania_tweaks.groovy @@ -11,10 +11,10 @@ log 'mod \'botania_tweaks\' detected, running script' // is finished. Upon finishing the recipe, the center, sides, and corners can each be converted into a replacement // blockstate, if a replacement blockstate was set. -// mods.botania_tweaks.agglomeration_plate.removeByCenter(blockstate('botania:livingrock')) -// mods.botania_tweaks.agglomeration_plate.removeByCorner(blockstate('botania:livingrock')) // mods.botania_tweaks.agglomeration_plate.removeByEdge(blockstate('minecraft:lapis_block')) // mods.botania_tweaks.agglomeration_plate.removeByInput(item('botania:manaresource:2')) +// mods.botania_tweaks.agglomeration_plate.removeByCenter(blockstate('botania:livingrock')) +// mods.botania_tweaks.agglomeration_plate.removeByCorner(blockstate('botania:livingrock')) mods.botania_tweaks.agglomeration_plate.removeByOutput(item('botania:manaresource:4')) // mods.botania_tweaks.agglomeration_plate.removeAll() diff --git a/examples/postInit/generated/chisel.groovy b/examples/postInit/generated/chisel.groovy index 8aa949214..64c826779 100644 --- a/examples/postInit/generated/chisel.groovy +++ b/examples/postInit/generated/chisel.groovy @@ -13,7 +13,7 @@ mods.chisel.carving.removeVariation('antiblock', item('chisel:antiblock:3')) mods.chisel.carving.removeVariation('antiblock', item('chisel:antiblock:15')) mods.chisel.carving.addGroup('demo') +mods.chisel.carving.setSound('demo', sound('minecraft:block.glass.break')) mods.chisel.carving.addVariation('demo', item('chisel:antiblock:3')) mods.chisel.carving.addVariation('demo', item('minecraft:sea_lantern')) mods.chisel.carving.addVariation('demo', item('minecraft:diamond_block')) -mods.chisel.carving.setSound('demo', sound('minecraft:block.glass.break')) diff --git a/examples/postInit/generated/compactmachines3.groovy b/examples/postInit/generated/compactmachines3.groovy index 65d3a2c6b..73ad34ab9 100644 --- a/examples/postInit/generated/compactmachines3.groovy +++ b/examples/postInit/generated/compactmachines3.groovy @@ -7,9 +7,9 @@ log 'mod \'compactmachines3\' detected, running script' // Miniaturization: // Consumes a 3d structure in-world based on keys when an item is thrown into the field. -mods.compactmachines3.miniaturization.removeByCatalyst(item('minecraft:redstone')) mods.compactmachines3.miniaturization.removeByInput(item('minecraft:ender_pearl')) mods.compactmachines3.miniaturization.removeByOutput(item('compactmachines3:machine:3')) +mods.compactmachines3.miniaturization.removeByCatalyst(item('minecraft:redstone')) // mods.compactmachines3.miniaturization.removeAll() mods.compactmachines3.miniaturization.recipeBuilder() diff --git a/examples/postInit/generated/enderio.groovy b/examples/postInit/generated/enderio.groovy index b39aec550..166e52e17 100644 --- a/examples/postInit/generated/enderio.groovy +++ b/examples/postInit/generated/enderio.groovy @@ -173,8 +173,8 @@ mods.enderio.soul_binder.recipeBuilder() // Converts an input itemstack into an output fluidstack with an optional output itemstack in drain mode, or converts an // input itemstack and fluidstack into an output itemstack in fill mode. -mods.enderio.tank.removeDrain(item('minecraft:experience_bottle'), fluid('xpjuice')) mods.enderio.tank.removeFill(item('minecraft:glass_bottle'), fluid('xpjuice')) +mods.enderio.tank.removeDrain(item('minecraft:experience_bottle'), fluid('xpjuice')) // mods.enderio.tank.removeAll() mods.enderio.tank.recipeBuilder() diff --git a/examples/postInit/generated/erebus.groovy b/examples/postInit/generated/erebus.groovy index 793ae0c57..9f2315486 100644 --- a/examples/postInit/generated/erebus.groovy +++ b/examples/postInit/generated/erebus.groovy @@ -9,17 +9,17 @@ log 'mod \'erebus\' detected, running script' // any Blocks using the valid Materials to be converted, and the Registry contains any valid ItemStacks. The conversion // takes 10 seconds, and is fueled by erebus wall plants. -// mods.erebus.composter.removeFromBlacklist(item('erebus:wall_plants', 1)) mods.erebus.composter.removeFromMaterial(blockmaterial('sponge')) mods.erebus.composter.removeFromRegistry(item('minecraft:stick')) -// mods.erebus.composter.removeAllFromBlacklist() +// mods.erebus.composter.removeFromBlacklist(item('erebus:wall_plants', 1)) // mods.erebus.composter.removeAllFromMaterial() // mods.erebus.composter.removeAllFromRegistry() +// mods.erebus.composter.removeAllFromBlacklist() -mods.erebus.composter.addBlacklist(item('erebus:wall_plants', 7)) -mods.erebus.composter.addBlacklist(item('erebus:wall_plants_cultivated', 7)) mods.erebus.composter.addMaterial(blockmaterial('tnt')) mods.erebus.composter.addRegistry(item('minecraft:gold_ingot')) +mods.erebus.composter.addBlacklist(item('erebus:wall_plants', 7)) +mods.erebus.composter.addBlacklist(item('erebus:wall_plants_cultivated', 7)) // Offering Altar: // Converts up to 3 input itemstacks into an output itemstack. @@ -42,10 +42,10 @@ mods.erebus.offering_altar.recipeBuilder() // Smoothie-matic: // Converts a container item, up to 4 input items, and up to 4 input fluidstacks into an output itemstack. -mods.erebus.smoothie.removeByContainer(item('minecraft:bucket')) mods.erebus.smoothie.removeByInput(fluid('honey')) mods.erebus.smoothie.removeByInput(item('erebus:materials', 18)) mods.erebus.smoothie.removeByOutput(item('erebus:materials', 21)) +mods.erebus.smoothie.removeByContainer(item('minecraft:bucket')) // mods.erebus.smoothie.removeAll() mods.erebus.smoothie.recipeBuilder() diff --git a/examples/postInit/generated/essentialcraft.groovy b/examples/postInit/generated/essentialcraft.groovy index 607c10e68..27797d5b9 100644 --- a/examples/postInit/generated/essentialcraft.groovy +++ b/examples/postInit/generated/essentialcraft.groovy @@ -32,8 +32,8 @@ mods.essentialcraft.magician_table.recipeBuilder() // A machine used to quadruple ores using MRU and lava. Also adds the same recipes for Magmatic Furnace, which is used to // double ores using MRU. -mods.essentialcraft.magmatic_smeltery.removeByInput(ore('oreIron')) mods.essentialcraft.magmatic_smeltery.removeByInput('oreDiamond') +mods.essentialcraft.magmatic_smeltery.removeByInput(ore('oreIron')) // mods.essentialcraft.magmatic_smeltery.removeAll() mods.essentialcraft.magmatic_smeltery.recipeBuilder() diff --git a/examples/postInit/generated/extendedcrafting.groovy b/examples/postInit/generated/extendedcrafting.groovy index f0d9ecd42..eb16c777d 100644 --- a/examples/postInit/generated/extendedcrafting.groovy +++ b/examples/postInit/generated/extendedcrafting.groovy @@ -32,9 +32,9 @@ mods.extendedcrafting.combination_crafting.recipeBuilder() // Converts any number of a single item into an output itemstack, with a configurable rf cost, consumption per tick amount, // catalyst, and if the catalyst is consumed. -mods.extendedcrafting.compression_crafting.removeByCatalyst(item('extendedcrafting:material:11')) mods.extendedcrafting.compression_crafting.removeByInput(item('minecraft:gold_ingot')) mods.extendedcrafting.compression_crafting.removeByOutput(item('extendedcrafting:singularity:6')) +mods.extendedcrafting.compression_crafting.removeByCatalyst(item('extendedcrafting:material:11')) // mods.extendedcrafting.compression_crafting.removeAll() mods.extendedcrafting.compression_crafting.recipeBuilder() diff --git a/examples/postInit/generated/extrautils2.groovy b/examples/postInit/generated/extrautils2.groovy index 4cdb2c35a..422c84271 100644 --- a/examples/postInit/generated/extrautils2.groovy +++ b/examples/postInit/generated/extrautils2.groovy @@ -61,8 +61,8 @@ mods.extrautils2.furnace.recipeBuilder() // Generators: // Converts up to two input itemstacks and an input fluidstack into energy over time. -mods.extrautils2.generator.remove('extrautils2:generator_lava', fluid('lava')) mods.extrautils2.generator.remove('extrautils2:generator_culinary', item('minecraft:apple')) +mods.extrautils2.generator.remove('extrautils2:generator_lava', fluid('lava')) mods.extrautils2.generator.removeByGenerator('extrautils2:generator_death') // mods.extrautils2.generator.removeAll() @@ -100,11 +100,11 @@ mods.extrautils2.generator.recipeBuilder() // Grid Power Generators: // Passively produces Grid Power into the Owner's GP network. +mods.extrautils2.grid_power_passive_generator.setScaling(resource('generators:creative'), 500.0F, 0.5F, 1000.0F, 0.25F, 1500.0F, 0.05F) mods.extrautils2.grid_power_passive_generator.setBasePower(resource('generators:creative'), 5f) mods.extrautils2.grid_power_passive_generator.setBasePower(resource('generators:player_wind_up'), 100f) mods.extrautils2.grid_power_passive_generator.setPowerLevel(resource('generators:solar'), { TilePassiveGenerator generator, World world -> 100f }) mods.extrautils2.grid_power_passive_generator.setPowerMultiplier(resource('generators:wind'), IWorldPowerMultiplier.CONSTANT) -mods.extrautils2.grid_power_passive_generator.setScaling(resource('generators:creative'), 500.0F, 0.5F, 1000.0F, 0.25F, 1500.0F, 0.05F) // Resonator: // Converts and input itemstack into an output itemstack, consuming Grid Power from the Owner's GP network. Can also diff --git a/examples/postInit/generated/immersiveengineering.groovy b/examples/postInit/generated/immersiveengineering.groovy index 8406aa95a..3bc102c88 100644 --- a/examples/postInit/generated/immersiveengineering.groovy +++ b/examples/postInit/generated/immersiveengineering.groovy @@ -67,9 +67,9 @@ mods.immersiveengineering.blast_furnace_fuel.recipeBuilder() // Converts any number of input itemstacks into an output itemstack, using a blueprint with the category nbt tag as a // catalyst. -mods.immersiveengineering.blueprint_crafting.removeByCategory('electrode') mods.immersiveengineering.blueprint_crafting.removeByInput('components', item('immersiveengineering:metal:38'), item('immersiveengineering:metal:38'), item('immersiveengineering:metal')) mods.immersiveengineering.blueprint_crafting.removeByOutput('components', item('immersiveengineering:material:8')) +mods.immersiveengineering.blueprint_crafting.removeByCategory('electrode') // mods.immersiveengineering.blueprint_crafting.removeAll() mods.immersiveengineering.blueprint_crafting.recipeBuilder() @@ -136,8 +136,8 @@ mods.immersiveengineering.crusher.recipeBuilder() // Adds a Mineral Mix with the given name, weight, fail chance, ores, and allowed dimensions. A Mineral Mix can be mined by // an Excavator Multiblock and scanned via a Core Sample Drill. -mods.immersiveengineering.excavator.removeByMineral('silt') mods.immersiveengineering.excavator.removeByOres(ore('oreAluminum')) +mods.immersiveengineering.excavator.removeByMineral('silt') // mods.immersiveengineering.excavator.removeAll() mods.immersiveengineering.excavator.recipeBuilder() @@ -177,9 +177,9 @@ mods.immersiveengineering.fermenter.recipeBuilder() // Metal Press: // Converts an input itemstack into an output itemstack, with a mold catalyst, consuming power. +mods.immersiveengineering.metal_press.removeByMold(item('immersiveengineering:mold:4')) mods.immersiveengineering.metal_press.removeByInput(item('minecraft:iron_ingot')) mods.immersiveengineering.metal_press.removeByInput(item('immersiveengineering:mold'), item('immersiveengineering:metal:8')) -mods.immersiveengineering.metal_press.removeByMold(item('immersiveengineering:mold:4')) mods.immersiveengineering.metal_press.removeByOutput(item('immersiveengineering:material:2')) mods.immersiveengineering.metal_press.removeByOutput(item('immersiveengineering:mold'), item('immersiveengineering:metal:31')) // mods.immersiveengineering.metal_press.removeAll() @@ -195,8 +195,8 @@ mods.immersiveengineering.metal_press.recipeBuilder() // Mixer: // Converts any number of input itemstacks and a fluidstack into an output fluidstack, consuming power. -mods.immersiveengineering.mixer.removeByInput(fluid('water'), item('minecraft:speckled_melon')) mods.immersiveengineering.mixer.removeByInput(item('minecraft:sand'), item('minecraft:sand'), item('minecraft:clay_ball'), item('minecraft:gravel')) +mods.immersiveengineering.mixer.removeByInput(fluid('water'), item('minecraft:speckled_melon')) mods.immersiveengineering.mixer.removeByOutput(fluid('potion').withNbt([Potion:'minecraft:night_vision'])) // mods.immersiveengineering.mixer.removeAll() @@ -226,8 +226,8 @@ mods.immersiveengineering.refinery.recipeBuilder() // Converts an input itemstack into either an output itemstack, fluidstack, or both, using energy. mods.immersiveengineering.squeezer.removeByInput(item('minecraft:wheat_seeds')) -mods.immersiveengineering.squeezer.removeByOutput(fluid('plantoil')) mods.immersiveengineering.squeezer.removeByOutput(item('immersiveengineering:material:18')) +mods.immersiveengineering.squeezer.removeByOutput(fluid('plantoil')) // mods.immersiveengineering.squeezer.removeAll() mods.immersiveengineering.squeezer.recipeBuilder() diff --git a/examples/postInit/generated/industrialforegoing.groovy b/examples/postInit/generated/industrialforegoing.groovy index b0d7c579f..391056839 100644 --- a/examples/postInit/generated/industrialforegoing.groovy +++ b/examples/postInit/generated/industrialforegoing.groovy @@ -39,10 +39,10 @@ mods.industrialforegoing.fluid_dictionary.add(fluid('latex'), fluid('essence'), // Converts power into ores, with a given weight, between a minimum and maximum Y value, in any whitelisted biome or not in // any blacklisted biome, and with a specific color of laser lens impacting the probability. -mods.industrialforegoing.laser_drill.removeByBlacklist(biome('minecraft:sky')) mods.industrialforegoing.laser_drill.removeByLens(5) // mods.industrialforegoing.laser_drill.removeByLens(item('industrialforegoing:laser_lens:5')) mods.industrialforegoing.laser_drill.removeByOutput(item('minecraft:coal_ore')) +mods.industrialforegoing.laser_drill.removeByBlacklist(biome('minecraft:sky')) mods.industrialforegoing.laser_drill.removeByWhitelist(biome('minecraft:hell')) // mods.industrialforegoing.laser_drill.removeAll() @@ -65,9 +65,9 @@ mods.industrialforegoing.ore_fermenter.add(fluid('if.ore_fluid_raw').withNbt(['O // Washing Factory: // Converts an input itemstack and input fluidstack into an output fluidstack. -// mods.industrialforegoing.ore_raw.removeByInput(fluid('meat')) -mods.industrialforegoing.ore_raw.removeByOre(ore('oreRedstone')) // mods.industrialforegoing.ore_raw.removeByOre('oreRedstone') +mods.industrialforegoing.ore_raw.removeByOre(ore('oreRedstone')) +// mods.industrialforegoing.ore_raw.removeByInput(fluid('meat')) // mods.industrialforegoing.ore_raw.removeByOutput(fluid('if.ore_fluid_raw').withNbt(['Ore': 'oreRedstone']),) // mods.industrialforegoing.ore_raw.removeAll() diff --git a/examples/postInit/generated/inspirations.groovy b/examples/postInit/generated/inspirations.groovy index 763e894b1..66bee4704 100644 --- a/examples/postInit/generated/inspirations.groovy +++ b/examples/postInit/generated/inspirations.groovy @@ -26,10 +26,10 @@ mods.inspirations.anvil_smashing.recipeBuilder() // Converts up to 1 itemstack and up to 1 fluid into up to 1 itemstack or up to 1 fluid, with a boiling boolean and // variable amount of fluid consumed or produced. -mods.inspirations.cauldron.removeByFluidInput(fluid('mushroom_stew')) -mods.inspirations.cauldron.removeByFluidOutput(fluid('beetroot_soup')) mods.inspirations.cauldron.removeByInput(item('minecraft:ghast_tear')) mods.inspirations.cauldron.removeByOutput(item('minecraft:piston')) +mods.inspirations.cauldron.removeByFluidInput(fluid('mushroom_stew')) +mods.inspirations.cauldron.removeByFluidOutput(fluid('beetroot_soup')) // mods.inspirations.cauldron.removeAll() mods.inspirations.cauldron.recipeBuilder() @@ -42,12 +42,6 @@ mods.inspirations.cauldron.recipeBuilder() .levels(3) .register() -mods.inspirations.cauldron.recipeBuilderBrewing() - .input(item('minecraft:diamond_block')) - .inputPotion(potionType('minecraft:fire_resistance')) - .outputPotion(potionType('minecraft:strength')) - .register() - mods.inspirations.cauldron.recipeBuilderDye() .input(item('minecraft:gold_block')) .output(item('minecraft:diamond_block')) @@ -55,6 +49,11 @@ mods.inspirations.cauldron.recipeBuilderDye() .levels(2) .register() +mods.inspirations.cauldron.recipeBuilderMix() + .output(item('minecraft:clay')) + .fluidInput(fluid('milk'), fluid('lava')) + .register() + mods.inspirations.cauldron.recipeBuilderFill() .input(item('minecraft:gold_ingot')) .output(item('minecraft:clay')) @@ -62,11 +61,6 @@ mods.inspirations.cauldron.recipeBuilderFill() .sound(sound('minecraft:block.anvil.destroy')) .register() -mods.inspirations.cauldron.recipeBuilderMix() - .output(item('minecraft:clay')) - .fluidInput(fluid('milk'), fluid('lava')) - .register() - mods.inspirations.cauldron.recipeBuilderPotion() .input(item('minecraft:gold_block')) .output(item('minecraft:diamond_block')) @@ -74,6 +68,12 @@ mods.inspirations.cauldron.recipeBuilderPotion() .levels(2) .register() +mods.inspirations.cauldron.recipeBuilderBrewing() + .input(item('minecraft:diamond_block')) + .inputPotion(potionType('minecraft:fire_resistance')) + .outputPotion(potionType('minecraft:strength')) + .register() + mods.inspirations.cauldron.recipeBuilderStandard() .input(item('minecraft:diamond')) .output(item('minecraft:clay')) diff --git a/examples/postInit/generated/jei.groovy b/examples/postInit/generated/jei.groovy index da52499af..5f718785d 100644 --- a/examples/postInit/generated/jei.groovy +++ b/examples/postInit/generated/jei.groovy @@ -36,16 +36,16 @@ mods.jei.category.hideCategory('minecraft.fuel') // mods.jei.description.remove(item('thaumcraft:triple_meat_treat')) -mods.jei.description.add(item('minecraft:clay'), ['wow', 'this', 'is', 'neat']) mods.jei.description.add(item('minecraft:gold_ingot'), 'groovyscript.recipe.fluid_recipe') +mods.jei.description.add(item('minecraft:clay'), ['wow', 'this', 'is', 'neat']) // Ingredient Sidebar: // Modify what ingredients show up in the search menu sidebar. mods.jei.ingredient.hide(fluid('water')) mods.jei.ingredient.hide(item('minecraft:stone:1'), item('minecraft:stone:3')) -mods.jei.ingredient.hide(VanillaTypes.ITEM, item('minecraft:bed:*')) // mods.jei.ingredient.hide(mekanism.client.jei.MekanismJEI.TYPE_GAS, gas('tritium')) +mods.jei.ingredient.hide(VanillaTypes.ITEM, item('minecraft:bed:*')) // mods.jei.ingredient.hideByType(VanillaTypes.ITEM) // mods.jei.ingredient.hideByType(VanillaTypes.FLUID) // mods.jei.ingredient.hideByType(VanillaTypes.ENCHANT) diff --git a/examples/postInit/generated/magneticraft.groovy b/examples/postInit/generated/magneticraft.groovy index a6a1fe8ef..852e1c44e 100644 --- a/examples/postInit/generated/magneticraft.groovy +++ b/examples/postInit/generated/magneticraft.groovy @@ -69,8 +69,8 @@ mods.magneticraft.grinder.recipeBuilder() // Hydraulic Press: // Converts an input itemstack into an output itemstack when set to a given mode in a Hydraulic Press Multiblock. -mods.magneticraft.hydraulic_press.removeByInput(item('minecraft:iron_ingot')) mods.magneticraft.hydraulic_press.removeByMode(HydraulicPressMode.MEDIUM) +mods.magneticraft.hydraulic_press.removeByInput(item('minecraft:iron_ingot')) mods.magneticraft.hydraulic_press.removeByOutput(item('minecraft:cobblestone')) // mods.magneticraft.hydraulic_press.removeAll() diff --git a/examples/postInit/generated/mekanism.groovy b/examples/postInit/generated/mekanism.groovy index 11953521d..fa01c7d99 100644 --- a/examples/postInit/generated/mekanism.groovy +++ b/examples/postInit/generated/mekanism.groovy @@ -13,10 +13,10 @@ mods.mekanism.infusion.removeByType(infusionType('carbon')) // mods.mekanism.infusion.removeAll() mods.mekanism.infusion.addType('groovy_example', resource('groovyscriptdev:blocks/mekanism_infusion_texture')) -mods.mekanism.infusion.add(infusionType('diamond'), 100, item('minecraft:clay')) -mods.mekanism.infusion.add(infusionType('carbon'), 100, item('minecraft:gold_ingot')) mods.mekanism.infusion.add('groovy_example', 10, item('minecraft:ice')) mods.mekanism.infusion.add('groovy_example', 20, item('minecraft:packed_ice')) +mods.mekanism.infusion.add(infusionType('diamond'), 100, item('minecraft:clay')) +mods.mekanism.infusion.add(infusionType('carbon'), 100, item('minecraft:gold_ingot')) // Chemical Infuser: // Combines two input gas stacks into a output gas stack. diff --git a/examples/postInit/generated/minecraft.groovy b/examples/postInit/generated/minecraft.groovy index 77e426b32..d2c731f88 100644 --- a/examples/postInit/generated/minecraft.groovy +++ b/examples/postInit/generated/minecraft.groovy @@ -12,8 +12,8 @@ minecraft.command.registerCommand('groovy_test', { server, sender, args -> sende // A normal crafting recipe that takes place in the Vanilla Crafting Table, converting up to 9 items in a shapeless or // specific shaped arrangement into an output itemstack. -crafting.remove(resource('minecraft:stonebrick')) crafting.remove('minecraft:mossy_stonebrick') +crafting.remove(resource('minecraft:stonebrick')) crafting.removeByOutput(item('minecraft:gold_ingot')) // crafting.removeAll() @@ -145,17 +145,17 @@ crafting.shapelessBuilder() // crafting.addShaped(item('minecraft:gold_block'), [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) -// crafting.addShaped(resource('example:resource_location'), item('minecraft:clay'), [[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]) // crafting.addShaped('gold_v_to_clay', item('minecraft:clay'), [[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:gold_ingot'),null]]) +// crafting.addShaped(resource('example:resource_location'), item('minecraft:clay'), [[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]) // crafting.addShapeless(item('minecraft:clay'), [item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]) -// crafting.addShapeless(resource('example:resource_location2'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) // crafting.addShapeless('precious_to_clay', item('minecraft:clay'), [item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]) +// crafting.addShapeless(resource('example:resource_location2'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) // crafting.replaceShaped(item('minecraft:chest'), [[ore('logWood'),ore('logWood'),ore('logWood')],[ore('logWood'),null,ore('logWood')],[ore('logWood'),ore('logWood'),ore('logWood')]]) -// crafting.replaceShaped(resource('minecraft:sea_lantern'), item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]) // crafting.replaceShaped('gold_to_diamonds', item('minecraft:diamond') * 8, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) +// crafting.replaceShaped(resource('minecraft:sea_lantern'), item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]) // crafting.replaceShapeless(item('minecraft:ender_eye'), [item('minecraft:ender_pearl'),item('minecraft:nether_star')]) -// crafting.replaceShapeless(resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) // crafting.replaceShapeless('minecraft:pink_dye_from_pink_tulp', item('minecraft:clay'), [item('minecraft:nether_star')]) +// crafting.replaceShapeless(resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) // Furnace: // Converts an input item into an output itemstack after a configurable amount of time, with the ability to give experience @@ -184,8 +184,8 @@ furnace.addFuelConversion(item('minecraft:diamond'), item('minecraft:bucket').tr minecraft.game_rule.setWarnNewGameRule(true) -minecraft.game_rule.add(['mobGriefing': 'false', 'keepInventory': 'true']) minecraft.game_rule.add('doDaylightCycle', 'false') +minecraft.game_rule.add(['mobGriefing': 'false', 'keepInventory': 'true']) // Ore Dictionary: // Manipulate the Ore Dictionary and what itemstacks are part of what oredicts. @@ -198,16 +198,16 @@ ore_dict.remove('netherStar', item('minecraft:nether_star')) ore_dict.add('ingotGold', item('minecraft:nether_star')) ore_dict.add('netherStar', item('minecraft:gold_ingot')) +ore_dict.getOres('ingot*') ore_dict.getOres(~/.*/) ore_dict.getOres(~/.*Gold/) ore_dict.getOres(~/.*or.*/) -ore_dict.getOres('ingot*') // Starting Inventory: // Sets the starting inventory of the player, including armor slots and offhand. -minecraft.player.setReplaceDefaultInventory(true) // minecraft.player.setTestStartingItems(true) +minecraft.player.setReplaceDefaultInventory(true) minecraft.player.addStartingItem(item('minecraft:diamond')) minecraft.player.addStartingItem(item('minecraft:clay_ball')) diff --git a/examples/postInit/generated/naturesaura.groovy b/examples/postInit/generated/naturesaura.groovy index 6ce836066..e6e14fcf9 100644 --- a/examples/postInit/generated/naturesaura.groovy +++ b/examples/postInit/generated/naturesaura.groovy @@ -8,10 +8,10 @@ log 'mod \'naturesaura\' detected, running script' // Converts an input itemstack into an itemstack in a multiblock structure, with an optional catalyst block, costing aura // and taking a configurable duration. -mods.naturesaura.altar.removeByCatalyst(item('naturesaura:crushing_catalyst')) -mods.naturesaura.altar.removeByInput(item('minecraft:rotten_flesh')) mods.naturesaura.altar.removeByName(resource('naturesaura:infused_iron')) +mods.naturesaura.altar.removeByInput(item('minecraft:rotten_flesh')) mods.naturesaura.altar.removeByOutput(item('minecraft:soul_sand')) +mods.naturesaura.altar.removeByCatalyst(item('naturesaura:crushing_catalyst')) // mods.naturesaura.altar.removeAll() mods.naturesaura.altar.recipeBuilder() @@ -44,10 +44,10 @@ mods.naturesaura.altar.recipeBuilder() // Converts up to 16 times the input itemstack into output itemstacks by consuming a catalyst item from the ground in a // multiblock structure. -// mods.naturesaura.offering.removeByCatalyst(item('naturesaura:calling_spirit')) -mods.naturesaura.offering.removeByInput(item('minecraft:nether_star')) mods.naturesaura.offering.removeByName(resource('naturesaura:token_euphoria')) +mods.naturesaura.offering.removeByInput(item('minecraft:nether_star')) mods.naturesaura.offering.removeByOutput(item('naturesaura:sky_ingot')) +// mods.naturesaura.offering.removeByCatalyst(item('naturesaura:calling_spirit')) // mods.naturesaura.offering.removeAll() mods.naturesaura.offering.recipeBuilder() @@ -75,8 +75,8 @@ mods.naturesaura.offering.recipeBuilder() // Converts multiple input items into an output itemstack after a duration when a sapling grows in the middle of a // multiblock structure. -mods.naturesaura.ritual.removeByInput(item('naturesaura:infused_stone')) mods.naturesaura.ritual.removeByName(resource('naturesaura:eye_improved')) +mods.naturesaura.ritual.removeByInput(item('naturesaura:infused_stone')) mods.naturesaura.ritual.removeByOutput(item('naturesaura:eye')) mods.naturesaura.ritual.removeBySapling(item('minecraft:sapling:3')) // mods.naturesaura.ritual.removeAll() @@ -108,10 +108,10 @@ mods.naturesaura.ritual.recipeBuilder() // Altar of Birthing: // Converts multiple input itemstacks into a summoned entity, costing aura and taking time. +mods.naturesaura.spawning.removeByName(resource('naturesaura:cow')) +mods.naturesaura.spawning.removeByInput(item('minecraft:bone')) mods.naturesaura.spawning.removeByEntity(entity('minecraft:polar_bear')) mods.naturesaura.spawning.removeByEntity(resource('minecraft:cave_spider')) -mods.naturesaura.spawning.removeByInput(item('minecraft:bone')) -mods.naturesaura.spawning.removeByName(resource('naturesaura:cow')) // mods.naturesaura.spawning.removeAll() mods.naturesaura.spawning.recipeBuilder() diff --git a/examples/postInit/generated/pneumaticcraft.groovy b/examples/postInit/generated/pneumaticcraft.groovy index ba624f769..005e71d84 100644 --- a/examples/postInit/generated/pneumaticcraft.groovy +++ b/examples/postInit/generated/pneumaticcraft.groovy @@ -10,8 +10,8 @@ log 'mod \'pneumaticcraft\' detected, running script' mods.pneumaticcraft.amadron.removeByInput(item('minecraft:rotten_flesh')) mods.pneumaticcraft.amadron.removeByOutput(item('minecraft:emerald')) // mods.pneumaticcraft.amadron.removeAll() -// mods.pneumaticcraft.amadron.removeAllPeriodic() // mods.pneumaticcraft.amadron.removeAllStatic() +// mods.pneumaticcraft.amadron.removeAllPeriodic() mods.pneumaticcraft.amadron.recipeBuilder() .input(item('minecraft:clay') * 3) @@ -113,8 +113,8 @@ mods.pneumaticcraft.liquid_fuel.recipeBuilder() // Converts a fluidstack and an item with a variable damage value into each other, requiring temperature to operate the // process, optionally consuming dye, and allowing either only melting or only solidifying. -// mods.pneumaticcraft.plastic_mixer.removeByFluid(fluid('plastic')) // mods.pneumaticcraft.plastic_mixer.removeByItem(item('pneumaticcraft:plastic')) +// mods.pneumaticcraft.plastic_mixer.removeByFluid(fluid('plastic')) // mods.pneumaticcraft.plastic_mixer.removeAll() mods.pneumaticcraft.plastic_mixer.recipeBuilder() diff --git a/examples/postInit/generated/prodigytech.groovy b/examples/postInit/generated/prodigytech.groovy index 4a3eeb6ef..482a0d2f2 100644 --- a/examples/postInit/generated/prodigytech.groovy +++ b/examples/postInit/generated/prodigytech.groovy @@ -165,9 +165,9 @@ mods.prodigytech.rotary_grinder.recipeBuilder() // Performs recipes using Gold Dust, has a recipe catalyst, and uses up Circuit Boards and an optional extra input for each // recipe. -mods.prodigytech.solderer.removeByAdditive(item('minecraft:iron_ingot')) mods.prodigytech.solderer.removeByOutput(item('prodigytech:circuit_refined')) mods.prodigytech.solderer.removeByPattern(item('prodigytech:pattern_circuit_refined')) +mods.prodigytech.solderer.removeByAdditive(item('minecraft:iron_ingot')) // mods.prodigytech.solderer.removeAll() // mods.prodigytech.solderer.removeWithoutAdditive() diff --git a/examples/postInit/generated/roots.groovy b/examples/postInit/generated/roots.groovy index 8aa317790..7434f08c6 100644 --- a/examples/postInit/generated/roots.groovy +++ b/examples/postInit/generated/roots.groovy @@ -8,8 +8,8 @@ log 'mod \'roots\' detected, running script' // Animal Harvest is a ritual that drops items from nearby mob's based on that mobs loottable without harming the mob. Only // applies to allowed mobs. -mods.roots.animal_harvest.removeByEntity(entity('minecraft:pig')) mods.roots.animal_harvest.removeByName(resource('roots:chicken')) +mods.roots.animal_harvest.removeByEntity(entity('minecraft:pig')) // mods.roots.animal_harvest.removeAll() mods.roots.animal_harvest.recipeBuilder() @@ -47,9 +47,9 @@ mods.roots.animal_harvest_fish.recipeBuilder() // Bark Carving is a special set of alternate drops for blocks when broken with an item containing the tool type 'knife'. // Amount dropped is up to 2 + fortune/looting level higher than the set amount. +mods.roots.bark_carving.removeByName(resource('roots:wildwood')) mods.roots.bark_carving.removeByBlock(item('minecraft:log:1')) mods.roots.bark_carving.removeByInput(item('minecraft:log')) -mods.roots.bark_carving.removeByName(resource('roots:wildwood')) mods.roots.bark_carving.removeByOutput(item('roots:bark_dark_oak')) // mods.roots.bark_carving.removeAll() @@ -73,8 +73,8 @@ mods.roots.bark_carving.recipeBuilder() // Chrysopoeia: // Chrysopoeia is a spell that transmutes items held in the main hand. -mods.roots.chrysopoeia.removeByInput(item('minecraft:rotten_flesh')) mods.roots.chrysopoeia.removeByName(resource('roots:gold_from_silver')) +mods.roots.chrysopoeia.removeByInput(item('minecraft:rotten_flesh')) mods.roots.chrysopoeia.removeByOutput(item('minecraft:iron_nugget')) // mods.roots.chrysopoeia.removeAll() @@ -111,11 +111,11 @@ mods.roots.fey_crafter.recipeBuilder() // block. Additionally, using the spell Growth Infusion's Floral Reproduction modifier will duplicate the flower, // regardless of the soil block. +mods.roots.flower_generation.removeByName(resource('roots:dandelion')) mods.roots.flower_generation.removeByFlower(block('minecraft:red_flower')) +mods.roots.flower_generation.removeByFlower(item('minecraft:red_flower:3')) mods.roots.flower_generation.removeByFlower(block('minecraft:red_flower'), 1) mods.roots.flower_generation.removeByFlower(blockstate('minecraft:red_flower:2')) -mods.roots.flower_generation.removeByFlower(item('minecraft:red_flower:3')) -mods.roots.flower_generation.removeByName(resource('roots:dandelion')) // mods.roots.flower_generation.removeAll() mods.roots.flower_generation.recipeBuilder() @@ -144,9 +144,9 @@ mods.roots.life_essence.add(entity('minecraft:wither_skeleton')) mods.roots.modifiers.disable(spell('spell_geas')) // mods.roots.modifiers.disableAll() +mods.roots.modifiers.enable('extended_geas') mods.roots.modifiers.enable(modifier('roots:weakened_response')) mods.roots.modifiers.enable(resource('roots:animal_savior')) -mods.roots.modifiers.enable('extended_geas') // Mortar And Pestle: // When right clicking a mortar containing the input items with a pestle, it will display a few colored sparkles, consume @@ -197,8 +197,8 @@ mods.roots.moss.add(item('minecraft:stained_glass:3'), item('minecraft:stained_g // Pacifist: // Pacifist is a list of entities which killing will give the player the advancement 'Untrue Pacifist'. -mods.roots.pacifist.removeByEntity(entity('minecraft:cow')) mods.roots.pacifist.removeByName(resource('minecraft:chicken')) +mods.roots.pacifist.removeByEntity(entity('minecraft:cow')) // mods.roots.pacifist.removeAll() mods.roots.pacifist.recipeBuilder() @@ -273,8 +273,8 @@ mods.roots.rituals.recipeBuilder() // Right clicking a Runic Shear on a block to convert it into a replacement block and drop items. mods.roots.runic_shear_block.removeByName(resource('roots:wildewheet')) -mods.roots.runic_shear_block.removeByOutput(item('roots:spirit_herb')) mods.roots.runic_shear_block.removeByState(blockstate('minecraft:beetroots:age=3')) +mods.roots.runic_shear_block.removeByOutput(item('roots:spirit_herb')) // mods.roots.runic_shear_block.removeAll() mods.roots.runic_shear_block.recipeBuilder() @@ -295,8 +295,8 @@ mods.roots.runic_shear_block.recipeBuilder() // Runic Shear Entity: // Right clicking a Runic Shear on an entity. The entity will have a cooldown, preventing spamming. -mods.roots.runic_shear_entity.removeByEntity(entity('minecraft:chicken')) mods.roots.runic_shear_entity.removeByName(resource('roots:slime_strange_ooze')) +mods.roots.runic_shear_entity.removeByEntity(entity('minecraft:chicken')) mods.roots.runic_shear_entity.removeByOutput(item('roots:fey_leather')) // mods.roots.runic_shear_entity.removeAll() @@ -344,8 +344,8 @@ mods.roots.spells.recipeBuilder() // Summon Creature: // When running a Summon Creature Ritual, the input items placed on Catalyst Plate will summon the target entity. -mods.roots.summon_creature.removeByEntity(entity('minecraft:chicken')) mods.roots.summon_creature.removeByName(resource('roots:cow')) +mods.roots.summon_creature.removeByEntity(entity('minecraft:chicken')) // mods.roots.summon_creature.removeAll() mods.roots.summon_creature.recipeBuilder() @@ -359,8 +359,8 @@ mods.roots.summon_creature.recipeBuilder() // When running the Transmutation, convert nearby blocks that match a set of conditions into either a block or items. mods.roots.transmutation.removeByName(resource('roots:redstone_block_to_glowstone')) -mods.roots.transmutation.removeByOutput(blockstate('minecraft:log:variant=jungle')) mods.roots.transmutation.removeByOutput(item('minecraft:dye:3')) +mods.roots.transmutation.removeByOutput(blockstate('minecraft:log:variant=jungle')) // mods.roots.transmutation.removeAll() mods.roots.transmutation.recipeBuilder() diff --git a/examples/postInit/generated/silentgems.groovy b/examples/postInit/generated/silentgems.groovy index 961b67599..106ea9231 100644 --- a/examples/postInit/generated/silentgems.groovy +++ b/examples/postInit/generated/silentgems.groovy @@ -9,9 +9,9 @@ log 'mod \'silentgems\' detected, running script' // from a Chaos Altar. Chaos is consumed at a maximum of 400 per tick, meaning the time taken corresponds to the Chaos // cost. -mods.silentgems.chaos_altar.removeByCatalyst(item('minecraft:slime_ball')) mods.silentgems.chaos_altar.removeByInput(item('silentgems:gem')) mods.silentgems.chaos_altar.removeByOutput(item('silentgems:craftingmaterial')) +mods.silentgems.chaos_altar.removeByCatalyst(item('minecraft:slime_ball')) // mods.silentgems.chaos_altar.removeAll() mods.silentgems.chaos_altar.recipeBuilder() diff --git a/examples/postInit/generated/tconstruct.groovy b/examples/postInit/generated/tconstruct.groovy index 46f5b0fa2..ed1d4be49 100644 --- a/examples/postInit/generated/tconstruct.groovy +++ b/examples/postInit/generated/tconstruct.groovy @@ -8,8 +8,8 @@ log 'mod \'tconstruct\' detected, running script' // Modifies what fluids can be mixed together in the Smeltery. mods.tconstruct.alloying.removeByInputs(fluid('cobalt')*2,fluid('ardite')*2) -mods.tconstruct.alloying.removeByInputsAndOutput(fluid('knightslime')*72,fluid('iron')*72,fluid('stone')*144,fluid('purpleslime')*125) mods.tconstruct.alloying.removeByOutput(fluid('pigiron')) +mods.tconstruct.alloying.removeByInputsAndOutput(fluid('knightslime')*72,fluid('iron')*72,fluid('stone')*144,fluid('purpleslime')*125) // mods.tconstruct.alloying.removeAll() mods.tconstruct.alloying.recipeBuilder() diff --git a/examples/postInit/generated/thaumcraft.groovy b/examples/postInit/generated/thaumcraft.groovy index b23f36b2b..0b05b1cf6 100644 --- a/examples/postInit/generated/thaumcraft.groovy +++ b/examples/postInit/generated/thaumcraft.groovy @@ -174,8 +174,8 @@ mods.thaumcraft.research.researchCategoryBuilder() .register() -// mods.thaumcraft.research.addResearchLocation(resource('thaumcraft:research/new.json')) mods.thaumcraft.research.addScannable('KNOWLEDGETYPEHUMOR', item('minecraft:pumpkin')) +// mods.thaumcraft.research.addResearchLocation(resource('thaumcraft:research/new.json')) // Smelting Bonus: // Additional item output when smelting a given item in the Infernal Furnace Multiblock. diff --git a/examples/postInit/generated/thebetweenlands.groovy b/examples/postInit/generated/thebetweenlands.groovy index 1bc9d064a..15aec6a6f 100644 --- a/examples/postInit/generated/thebetweenlands.groovy +++ b/examples/postInit/generated/thebetweenlands.groovy @@ -8,10 +8,10 @@ log 'mod \'thebetweenlands\' detected, running script' // Converts an input item, Life amount from Life Crystals, and Fuel from Sulfur into an output itemstack, summoning an // entity, a random item from a loottable, or summoning an entity and outputting an itemstack. -mods.thebetweenlands.animator.removeByEntity(entity('thebetweenlands:sporeling')) mods.thebetweenlands.animator.removeByInput(item('thebetweenlands:bone_leggings')) -mods.thebetweenlands.animator.removeByLootTable(resource('thebetweenlands:animator/scroll')) +mods.thebetweenlands.animator.removeByEntity(entity('thebetweenlands:sporeling')) mods.thebetweenlands.animator.removeByOutput(item('thebetweenlands:items_misc:46')) +mods.thebetweenlands.animator.removeByLootTable(resource('thebetweenlands:animator/scroll')) // mods.thebetweenlands.animator.removeAll() mods.thebetweenlands.animator.recipeBuilder() diff --git a/examples/postInit/generated/thermalexpansion.groovy b/examples/postInit/generated/thermalexpansion.groovy index a9b736867..231a24113 100644 --- a/examples/postInit/generated/thermalexpansion.groovy +++ b/examples/postInit/generated/thermalexpansion.groovy @@ -108,12 +108,12 @@ mods.thermalexpansion.charger.recipeBuilder() // Converts an input itemstack into an output itemstack, with different modes each requiring a different augment to be // installed, costing power and taking time based on the power cost. -mods.thermalexpansion.compactor.removeByInput(compactorMode('coin'), item('thermalfoundation:material:130')) -mods.thermalexpansion.compactor.removeByInput(item('minecraft:iron_ingot')) // mods.thermalexpansion.compactor.removeByMode(compactorMode('plate')) -mods.thermalexpansion.compactor.removeByOutput(compactorMode('coin'), item('thermalfoundation:coin:102')) +mods.thermalexpansion.compactor.removeByInput(item('minecraft:iron_ingot')) +mods.thermalexpansion.compactor.removeByInput(compactorMode('coin'), item('thermalfoundation:material:130')) mods.thermalexpansion.compactor.removeByOutput(item('minecraft:blaze_rod')) mods.thermalexpansion.compactor.removeByOutput(item('thermalfoundation:material:24')) +mods.thermalexpansion.compactor.removeByOutput(compactorMode('coin'), item('thermalfoundation:coin:102')) // mods.thermalexpansion.compactor.removeAll() mods.thermalexpansion.compactor.recipeBuilder() @@ -219,11 +219,11 @@ mods.thermalexpansion.enervation.add(item('minecraft:clay'), 100) // Igneous Extruder: // Converts a variable amount of lava and water into a specific output itemstack. -// mods.thermalexpansion.extruder.removeByInput(false, fluid('lava')) +// mods.thermalexpansion.extruder.removeByType(true) // mods.thermalexpansion.extruder.removeByInput(fluid('water')) -mods.thermalexpansion.extruder.removeByOutput(true, item('minecraft:gravel')) +// mods.thermalexpansion.extruder.removeByInput(false, fluid('lava')) mods.thermalexpansion.extruder.removeByOutput(item('minecraft:obsidian')) -// mods.thermalexpansion.extruder.removeByType(true) +mods.thermalexpansion.extruder.removeByOutput(true, item('minecraft:gravel')) // mods.thermalexpansion.extruder.removeAll() mods.thermalexpansion.extruder.recipeBuilder() @@ -247,11 +247,11 @@ mods.thermalexpansion.extruder.add(1000, item('minecraft:gold_block'), 100, 1000 // Converts an input itemstack into an output itemstack, with the ability to undo the the recipe. Mainly used for // compressing ingots into blocks and splitting blocks into ingots. -mods.thermalexpansion.factorizer.removeByInput(false, item('minecraft:diamond')) +// mods.thermalexpansion.factorizer.removeByType(true) mods.thermalexpansion.factorizer.removeByInput(item('minecraft:coal:1')) -// mods.thermalexpansion.factorizer.removeByOutput(false, item('minecraft:coal:1')) +mods.thermalexpansion.factorizer.removeByInput(false, item('minecraft:diamond')) mods.thermalexpansion.factorizer.removeByOutput(item('minecraft:emerald_block')) -// mods.thermalexpansion.factorizer.removeByType(true) +// mods.thermalexpansion.factorizer.removeByOutput(false, item('minecraft:coal:1')) // mods.thermalexpansion.factorizer.removeAll() mods.thermalexpansion.factorizer.recipeBuilder() @@ -287,9 +287,9 @@ mods.thermalexpansion.fisher_bait.add(item('minecraft:clay'), 100) // Redstone Furnace: // Converts an input itemstack into an output itemstack, costing power and taking time based on the power cost. +mods.thermalexpansion.furnace.removeFood(item('minecraft:rabbit:*')) mods.thermalexpansion.furnace.removeByInput(item('minecraft:cactus:*')) mods.thermalexpansion.furnace.removeByOutput(item('minecraft:cooked_porkchop')) -mods.thermalexpansion.furnace.removeFood(item('minecraft:rabbit:*')) // mods.thermalexpansion.furnace.removeAll() // mods.thermalexpansion.furnace.removeAllFood() @@ -567,14 +567,14 @@ mods.thermalexpansion.steam.add(item('minecraft:clay'), 100) // Arboreal Extractor: // Controls what items and blocks can be turned into what fluids. Output can be boosted via Fertilizer items. -mods.thermalexpansion.tapper.removeBlockByInput(item('minecraft:log')) mods.thermalexpansion.tapper.removeItemByInput(item('minecraft:log:1')) +mods.thermalexpansion.tapper.removeBlockByInput(item('minecraft:log')) // mods.thermalexpansion.tapper.removeAll() -// mods.thermalexpansion.tapper.removeAllBlocks() // mods.thermalexpansion.tapper.removeAllItems() +// mods.thermalexpansion.tapper.removeAllBlocks() -mods.thermalexpansion.tapper.addBlock(item('minecraft:clay'), fluid('lava') * 150) mods.thermalexpansion.tapper.addItem(item('minecraft:clay'), fluid('lava') * 300) +mods.thermalexpansion.tapper.addBlock(item('minecraft:clay'), fluid('lava') * 150) // Arboreal Extractor Fertilizer: // Controls what items can be used in the fertilizer slot of the Arboreal Extractor Fertilizer and how effective they are. @@ -588,8 +588,8 @@ mods.thermalexpansion.tapper_fertilizer.add(item('minecraft:clay'), 1000) // Controls what valid log blocks and leaf blocks are to define a tree structure which the Arboreal Extractor can function // on. The \"tree\" must contain some number of leaves adjacent to the log blocks to be valid. -mods.thermalexpansion.tapper_tree.removeByLeaf(blockstate('minecraft:leaves', 'variant=birch')) mods.thermalexpansion.tapper_tree.removeByLog(blockstate('minecraft:log', 'variant=spruce')) +mods.thermalexpansion.tapper_tree.removeByLeaf(blockstate('minecraft:leaves', 'variant=birch')) // mods.thermalexpansion.tapper_tree.removeAll() mods.thermalexpansion.tapper_tree.add(blockstate('minecraft:clay'), blockstate('minecraft:gold_block')) diff --git a/examples/postInit/generated/woot.groovy b/examples/postInit/generated/woot.groovy index c2fa245bc..211f1f35d 100644 --- a/examples/postInit/generated/woot.groovy +++ b/examples/postInit/generated/woot.groovy @@ -10,10 +10,10 @@ log 'mod \'woot\' detected, running script' // Controls extra drops given by mobs. Chance and Size are both arrays 4 long, containing the values for levels 0/1/2/3 // levels of Looting. -mods.woot.drops.removeByEntity(entity('minecraft:ender_dragon')) mods.woot.drops.removeByEntity('minecraft:ender_dragon') -mods.woot.drops.removeByEntity('minecraft:ender_dragon', '') +mods.woot.drops.removeByEntity(entity('minecraft:ender_dragon')) mods.woot.drops.removeByEntity(new WootMobName('minecraft:ender_dragon')) +mods.woot.drops.removeByEntity('minecraft:ender_dragon', '') mods.woot.drops.removeByOutput(item('minecraft:dragon_breath')) // mods.woot.drops.removeAll() @@ -30,8 +30,8 @@ mods.woot.drops.recipeBuilder() // `ipsis.woot.configuration.EnumConfigKey`. A full list can be viewed on // [Github](https://github.com/Ipsis/Woot/blob/55e88f5a15d66cc987e676d665d20f4afbe008b8/src/main/java/ipsis/woot/configuration/EnumConfigKey.java#L14). -mods.woot.mob_config.remove('minecraft:wither_skeleton', 'spawn_units') mods.woot.mob_config.remove('minecraft:wither') +mods.woot.mob_config.remove('minecraft:wither_skeleton', 'spawn_units') // mods.woot.mob_config.removeAll() mods.woot.mob_config.add('spawn_ticks', 100) @@ -41,35 +41,35 @@ mods.woot.mob_config.add('minecraft:zombie', 'spawn_ticks', 1) // Controls what entities can be farmed for what items via an entity blacklist, mod blacklist, item output blacklist, item // output mod blacklist, and a mob whitelist. +// mods.woot.policy.removeFromItemBlacklist(item('minecraft:sugar')) mods.woot.policy.removeFromEntityBlacklist('twilightforest:naga') -mods.woot.policy.removeFromEntityModBlacklist('botania') // mods.woot.policy.removeFromEntityWhitelist('minecraft:wither_skeleton') // mods.woot.policy.removeFromGenerateOnlyList('minecraft:wither_skeleton') -// mods.woot.policy.removeFromItemBlacklist(item('minecraft:sugar')) mods.woot.policy.removeFromItemModBlacklist('minecraft') +mods.woot.policy.removeFromEntityModBlacklist('botania') +// mods.woot.policy.removeAllFromItemBlacklist() // mods.woot.policy.removeAllFromEntityBlacklist() -// mods.woot.policy.removeAllFromEntityModBlacklist() // mods.woot.policy.removeAllFromEntityWhitelist() // mods.woot.policy.removeAllFromGenerateOnlyList() -// mods.woot.policy.removeAllFromItemBlacklist() // mods.woot.policy.removeAllFromItemModBlacklist() +// mods.woot.policy.removeAllFromEntityModBlacklist() // mods.woot.policy.removeAll() +mods.woot.policy.addToItemBlacklist(item('minecraft:gunpowder')) mods.woot.policy.addToEntityBlacklist('minecraft:witch') -// mods.woot.policy.addToEntityModBlacklist('minecraft') // mods.woot.policy.addToEntityWhitelist('minecraft:zombie') mods.woot.policy.addToGenerateOnlyList('minecraft:skeleton') -mods.woot.policy.addToItemBlacklist(item('minecraft:gunpowder')) mods.woot.policy.addToItemModBlacklist('woot') +// mods.woot.policy.addToEntityModBlacklist('minecraft') // Spawning: // Controls item/fluid costs of a given mob or the default cost. mods.woot.spawning.remove(new WootMobName('minecraft:ender_dragon')) -mods.woot.spawning.removeByEntity(entity('minecraft:ender_dragon')) mods.woot.spawning.removeByEntity('minecraft:ender_dragon') -mods.woot.spawning.removeByEntity('minecraft:ender_dragon', '') +mods.woot.spawning.removeByEntity(entity('minecraft:ender_dragon')) mods.woot.spawning.removeByEntity(new WootMobName('minecraft:ender_dragon')) +mods.woot.spawning.removeByEntity('minecraft:ender_dragon', '') // mods.woot.spawning.removeAll() mods.woot.spawning.recipeBuilder() diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java index 25522760c..9bc615f16 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java @@ -101,7 +101,7 @@ public static int packages(String left, String right) { return chain.result(); } - public static int string(String left, String right) { + private static int string(String left, String right) { return ComparisonChain.start() .compare(left.length(), right.length()) .compare(left, right, String::compareToIgnoreCase) @@ -118,9 +118,8 @@ public static int comp(Comp left, Comp right) { private static int comparePriorityAndMethod(int leftPriority, int rightPriority, Method leftMethod, Method rightName) { return ComparisonChain.start() .compare(leftPriority, rightPriority) - .compare(leftMethod.getName(), rightName.getName(), String::compareToIgnoreCase) - .compare(DescriptorHelper.simpleParameters(leftMethod), DescriptorHelper.simpleParameters(rightName), String::compareToIgnoreCase) + .compare(leftMethod.getName(), rightName.getName(), ComparisonHelper::string) + .compare(DescriptorHelper.simpleParameters(leftMethod), DescriptorHelper.simpleParameters(rightName), ComparisonHelper::packages) .result(); - } } From d3f07876dc2fc47cc5f9e1559c373d527cfdb38a Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 08:00:00 -0700 Subject: [PATCH 40/92] the humble spotless apply --- .../documentation/IRegistryDocumentation.java | 4 +-- .../compat/inworldcrafting/FluidRecipe.java | 8 ++++-- .../compat/inworldcrafting/FluidToItem.java | 4 ++- .../compat/mods/prodigytech/ZorraAltar.java | 26 +++++++++---------- .../groovyscript/documentation/Exporter.java | 3 +-- .../groovyscript/documentation/Registry.java | 14 +++++----- .../documentation/helper/ContainerHolder.java | 10 ++++--- .../documentation/helper/LinkIndex.java | 6 +++-- .../GroovyScriptDocumentationProvider.java | 2 +- 9 files changed, 45 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java index 974ec21a6..77edc2548 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java @@ -1,9 +1,9 @@ package com.cleanroommc.groovyscript.api.documentation; import com.cleanroommc.groovyscript.api.INamed; -import com.cleanroommc.groovyscript.documentation.helper.MarkdownSection; -import com.cleanroommc.groovyscript.documentation.helper.LinkIndex; import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; +import com.cleanroommc.groovyscript.documentation.helper.LinkIndex; +import com.cleanroommc.groovyscript.documentation.helper.MarkdownSection; import com.cleanroommc.groovyscript.sandbox.LoadStage; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java index 63b74226f..9563599cb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java @@ -283,7 +283,9 @@ public abstract static class RecipeBuilder extends Abstra @Property("groovyscript.wiki.in_world_crafting.afterRecipe.value") protected Closure afterRecipe; - @RecipeBuilderMethodDescription(field = {"input", "chances"}) + @RecipeBuilderMethodDescription(field = { + "input", "chances" + }) public RecipeBuilder input(IIngredient ingredient, float consumeChance) { this.input.add(ingredient); this.chances.add(MathHelper.clamp(consumeChance, 0.0f, 1.0f)); @@ -291,7 +293,9 @@ public RecipeBuilder input(IIngredient ingredient, float consumeChance) { } @Override - @RecipeBuilderMethodDescription(field = {"input", "chances"}) + @RecipeBuilderMethodDescription(field = { + "input", "chances" + }) public AbstractRecipeBuilder input(IIngredient ingredient) { return input(ingredient, 1.0f); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java index d99d35111..0e10a4c61 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java @@ -135,7 +135,9 @@ public static class RecipeBuilder extends FluidRecipe.RecipeBuilder imports.add("lykrast.prodigytech.common.item.IZorrasteelEquipment"); imports.add("lykrast.prodigytech.common.recipe.ZorraAltarManager"); return String.format(""" - // Create an item at the location '%s:prodigy_stick' enchantable in the Zorra Altar - // Note: due to the PT's implementation it is difficult to make other mod's items enchantable - // This merely registers the item, the post-init script adds the specific enchantments - class ProdigyStick extends Item implements IZorrasteelEquipment { - static registry = mods.prodigytech.zorra_altar.createRegistry('stick') - - ZorraAltarManager getManager() { - return registry - } - } - - content.registerItem('prodigy_stick', new ProdigyStick()) - """, GroovyHelper.getPackId()); + // Create an item at the location '%s:prodigy_stick' enchantable in the Zorra Altar + // Note: due to the PT's implementation it is difficult to make other mod's items enchantable + // This merely registers the item, the post-init script adds the specific enchantments + class ProdigyStick extends Item implements IZorrasteelEquipment { + static registry = mods.prodigytech.zorra_altar.createRegistry('stick') + + ZorraAltarManager getManager() { + return registry + } + } + + content.registerItem('prodigy_stick', new ProdigyStick()) + """, GroovyHelper.getPackId()); } return ""; } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index b1bbcf45e..3636b2c2b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -93,8 +93,7 @@ public static void write(File file, String text) { } public static void exportFile(File file, String resource) throws IOException { - try (InputStream inputStream = Exporter.class.getClassLoader().getResourceAsStream(resource); - FileOutputStream outputStream = new FileOutputStream(file)) { + try (InputStream inputStream = Exporter.class.getClassLoader().getResourceAsStream(resource); FileOutputStream outputStream = new FileOutputStream(file)) { int i; while ((i = inputStream.read()) != -1) { outputStream.write(i); diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index d055c1060..329a9ae8f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -256,12 +256,14 @@ private String generateIdentifier() { GroovyLog.get().warn("Couldn't find identifier %s in packagess %s", getReference(), String.join(", ", packages)); } else { packages.set(target, getReference() + "/*()!*/"); - out.append(new CodeBlockBuilder() - .line(packages) - .annotation(I18n.format("groovyscript.wiki.defaultPackage")) - // Highlighting and focusing are based on the line count, and is 1-indexed - .highlight(String.valueOf(1 + target)) - .focus(1 + target)); + var codeBlock = new CodeBlockBuilder() + .line(packages) + .annotation(I18n.format("groovyscript.wiki.defaultPackage")) + // Highlighting and focusing are based on the line count, and is 1-indexed + .highlight(String.valueOf(1 + target)) + .focus(1 + target) + .toString(); + out.append(codeBlock); } return out.toString(); } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java index e424e60e2..f2cda9570 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java @@ -39,9 +39,13 @@ public static ContainerHolder of(GroovyContainer registries) { - return new ContainerHolder(container.getModId(), container.getContainerName(), BASE_ACCESS_COMPAT + "." + container.getModId(), - importBlock -> String.format(HEADER, container.getModId(), importBlock), - ContainerHolder.expandAliases(container.getAliases()), new ObjectOpenHashSet<>(registries)); + return new ContainerHolder( + container.getModId(), + container.getContainerName(), + BASE_ACCESS_COMPAT + "." + container.getModId(), + importBlock -> String.format(HEADER, container.getModId(), importBlock), + ContainerHolder.expandAliases(container.getAliases()), + new ObjectOpenHashSet<>(registries)); } /** diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java index 8b6515c65..6c0db7137 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java @@ -65,7 +65,8 @@ public void add(String id, String entry) { * @return the full text of the sections */ public String get() { - return sections.values().stream() + return sections.values() + .stream() .filter(MarkdownSection::hasEntries) .sorted() .map(MarkdownSection::get) @@ -76,7 +77,8 @@ public String get() { * @return the list of links directly, without a header/subtitle */ public String getLinks() { - return sections.values().stream() + return sections.values() + .stream() .filter(MarkdownSection::hasEntries) .sorted() .map(MarkdownSection::getEntries) diff --git a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java index 80ccabd85..d3af4943a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java +++ b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java @@ -5,8 +5,8 @@ import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; import com.cleanroommc.groovyscript.documentation.Registry; +import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; import com.cleanroommc.groovyscript.documentation.helper.descriptor.MethodAnnotation; import net.prominic.groovyls.compiler.ast.ASTContext; import net.prominic.groovyls.compiler.documentation.IDocumentationProvider; From 7c01de3dfe051abd99c5b3f4ee96b264abc08e77 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 08:04:56 -0700 Subject: [PATCH 41/92] delete old in_world_crafting examples --- .../postInit/custom/in_world_crafting.groovy | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 examples/postInit/custom/in_world_crafting.groovy diff --git a/examples/postInit/custom/in_world_crafting.groovy b/examples/postInit/custom/in_world_crafting.groovy deleted file mode 100644 index 56b9eebc2..000000000 --- a/examples/postInit/custom/in_world_crafting.groovy +++ /dev/null @@ -1,38 +0,0 @@ - -inWorldCrafting.fluidToFluid.recipeBuilder() - .fluidInput(fluid('water')) - .input(item('minecraft:diamond') * 2) - .fluidOutput(fluid('lava')) - .register() - -inWorldCrafting.fluidToItem.recipeBuilder() - .fluidInput(fluid('water'), 0.22f) - .input(item('minecraft:netherrack')) - .input(item('minecraft:gold_ingot'), 0.1f) - .output(item('minecraft:nether_star')) - .register() - -inWorldCrafting.fluidToBlock.recipeBuilder() - .fluidInput(fluid('water')) - .input(item('minecraft:clay_ball')) - .output(block('minecraft:diamond_block')) - .register() - -inWorldCrafting.explosion.recipeBuilder() - .input(item('minecraft:diamond')) - .output(item('minecraft:nether_star')) - .chance(0.4f) - .register() - -inWorldCrafting.burning.recipeBuilder() - .input(item('minecraft:netherrack')) - .output(item('minecraft:nether_star')) - //.ticks(40f) - .register() - -inWorldCrafting.pistonPush.recipeBuilder() - .input(item('minecraft:gold_ingot')) - .output(item('minecraft:diamond')) - .minHarvestLevel(2) - .maxConversionsPerPush(3) - .register() From 10e7036cf755d6ab521015c433d79be0685c0f07 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 08:47:23 -0700 Subject: [PATCH 42/92] end index file with more line breaks --- .../com/cleanroommc/groovyscript/documentation/Exporter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index 3636b2c2b..9b47ea1a8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -28,7 +28,7 @@ public class Exporter { private static final String INDEX_FILE_NAME = "index" + MARKDOWN_FILE_EXTENSION; private static final String NAV_FILE_NAME = "!navigation" + MARKDOWN_FILE_EXTENSION; private static final String EXAMPLE_GENERATION_NOTE = "// Auto generated groovyscript example file\n"; - private static final String INDEX_FILE_TEXT = "---\n%s\n---\n\n\n# %s\n\n%s"; + private static final String INDEX_FILE_TEXT = "---\n%s\n---\n\n\n# %s\n\n%s\n\n"; private static final String BULLET_POINT_LINK = "* [%s](./%s)"; private static final String NAVIGATION_FILE_TEXT = "---\nsearch:\n exclude: true\n---\n\n\n" + BULLET_POINT_LINK + "\n%s"; From 53f4d6cd2f3e065c898fc53bc2caf84d16abba0f Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 08:50:52 -0700 Subject: [PATCH 43/92] make minecraft use alias and have more of them --- .../groovyscript/compat/mods/MinecraftModContainer.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java index 9ad25c26a..1af46020b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java @@ -5,6 +5,7 @@ import com.cleanroommc.groovyscript.documentation.Documentation; import com.cleanroommc.groovyscript.documentation.Exporter; import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; +import com.cleanroommc.groovyscript.helper.Alias; import com.cleanroommc.groovyscript.sandbox.LoadStage; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; @@ -29,10 +30,7 @@ public final class MinecraftModContainer extends GroovyContainer t.addPropertyFieldsOf(t, false); return t; }); - Set aliasSet = new ObjectOpenHashSet<>(); - aliasSet.add("mc"); - aliasSet.add("vanilla"); - aliasSet.add(modId); + Set aliasSet = new ObjectOpenHashSet<>(Alias.generateOf(containerName).andGenerate("Vanilla").and("mc").and("MC")); this.aliases = Collections.unmodifiableSet(aliasSet); ModSupport.INSTANCE.registerContainer(this); } From bf53f480a74ddd76bdc85d6aef40ea30ac095338 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 09:10:20 -0700 Subject: [PATCH 44/92] rename minecraft wiki page to Vanilla Registries --- .../groovyscript/compat/mods/MinecraftModContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java index 1af46020b..3dde84f9a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java @@ -66,7 +66,7 @@ public void onCompatLoaded(GroovyContainer container) {} private ContainerHolder getContainer() { var aliases = ContainerHolder.expandAliases(getAliases()); aliases.addAll(getAliases()); - return new ContainerHolder(getModId(), getContainerName(), getModId(), importBlock -> importBlock + "\nlog 'running Vanilla Minecraft example'", aliases, new ObjectOpenHashSet<>(get().getRegistries())); + return new ContainerHolder(getModId(), "Vanilla Registries", getModId(), importBlock -> importBlock + "\nlog 'running Vanilla Minecraft example'", aliases, new ObjectOpenHashSet<>(get().getRegistries())); } @Override From de5f9d062f93544ae9762b5aa2e800648003a9c1 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 09:10:37 -0700 Subject: [PATCH 45/92] rework package block to be clearer and less spammy --- .../groovyscript/documentation/Registry.java | 11 +++++++++-- .../resources/assets/groovyscript/lang/en_us.lang | 4 +++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 329a9ae8f..7c67538ad 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -27,6 +27,7 @@ public class Registry implements IRegistryDocumentation { public static final String BASE_LANG_LOCATION = "groovyscript.wiki"; private static final Pattern PERIOD_END_PATTERN = Pattern.compile("\\.$"); + private static final int TOO_MANY_PACKAGES = 12; private final ContainerHolder container; private final INamed registry; @@ -247,7 +248,8 @@ private String generateDescription() { private String generateIdentifier() { StringBuilder out = new StringBuilder(); - out.append("## ").append(I18n.format("groovyscript.wiki.identifier")).append("\n\n").append(I18n.format("groovyscript.wiki.import_instructions")).append("\n\n"); + out.append("## ").append(I18n.format("groovyscript.wiki.identifier")).append("\n\n"); + out.append(I18n.format("groovyscript.wiki.import_default", getReference())).append("\n\n"); List packages = getAliases(); @@ -263,7 +265,12 @@ private String generateIdentifier() { .highlight(String.valueOf(1 + target)) .focus(1 + target) .toString(); - out.append(codeBlock); + if (packages.size() >= TOO_MANY_PACKAGES) { + out.append(new AdmonitionBuilder().hasTitle(true).title(I18n.format("groovyscript.wiki.all_packages_title")).note("\n").note(I18n.format("groovyscript.wiki.import_instructions")).note("\n").note(codeBlock.trim()).note("\n").format(Admonition.Format.COLLAPSED).type(Admonition.Type.ABSTRACT).generate()); + out.append("\n\n"); + } else { + out.append(codeBlock); + } } return out.toString(); } diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index d912e008c..9d38bd4ac 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -64,7 +64,9 @@ groovyscript.wiki.subcategories_count=Has %s subcategories. groovyscript.wiki.description=Description groovyscript.wiki.identifier=Identifier groovyscript.wiki.defaultPackage=Used as page default -groovyscript.wiki.import_instructions=Refer to this via any of the following: +groovyscript.wiki.import_default=The identifier `%s` will be used as the default on this page. +groovyscript.wiki.all_packages_title=All Identifiers +groovyscript.wiki.import_instructions=Any of these can be used to refer to this compat: groovyscript.wiki.editing_values=Editing Values groovyscript.wiki.adding_recipes=Adding Recipes groovyscript.wiki.adding_entries=Adding Entries From c4fab4c4c86b371435926c654766d46e6feb37a2 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 09:20:20 -0700 Subject: [PATCH 46/92] always admonition, but only collapse if too many --- .../groovyscript/documentation/Registry.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 7c67538ad..591fdfbb9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -265,12 +265,17 @@ private String generateIdentifier() { .highlight(String.valueOf(1 + target)) .focus(1 + target) .toString(); - if (packages.size() >= TOO_MANY_PACKAGES) { - out.append(new AdmonitionBuilder().hasTitle(true).title(I18n.format("groovyscript.wiki.all_packages_title")).note("\n").note(I18n.format("groovyscript.wiki.import_instructions")).note("\n").note(codeBlock.trim()).note("\n").format(Admonition.Format.COLLAPSED).type(Admonition.Type.ABSTRACT).generate()); - out.append("\n\n"); - } else { - out.append(codeBlock); - } + var admonition = new AdmonitionBuilder() + .hasTitle(true) + .title(I18n.format("groovyscript.wiki.all_packages_title")) + .note("\n") + .note(I18n.format("groovyscript.wiki.import_instructions")) + .note("\n") + .note(codeBlock.trim()) + .note("\n") + .type(Admonition.Type.ABSTRACT); + if (packages.size() >= TOO_MANY_PACKAGES) admonition.format(Admonition.Format.COLLAPSED); + out.append(admonition.generate()).append("\n\n"); } return out.toString(); } From 0a1f60662fac7282ef632ca51271faea80e23339 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 09:26:38 -0700 Subject: [PATCH 47/92] switch admonition to quote --- .../com/cleanroommc/groovyscript/documentation/Registry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 591fdfbb9..0846c58cf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -273,7 +273,7 @@ private String generateIdentifier() { .note("\n") .note(codeBlock.trim()) .note("\n") - .type(Admonition.Type.ABSTRACT); + .type(Admonition.Type.QUOTE); if (packages.size() >= TOO_MANY_PACKAGES) admonition.format(Admonition.Format.COLLAPSED); out.append(admonition.generate()).append("\n\n"); } From 38a767e8c2553d7c91d684a1a21b2dafe4a96ee7 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 09:29:08 -0700 Subject: [PATCH 48/92] fix vararg method ties --- examples/postInit/generated/bewitchment.groovy | 2 +- .../documentation/helper/ComparisonHelper.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/postInit/generated/bewitchment.groovy b/examples/postInit/generated/bewitchment.groovy index 02794a466..08e7bcbbc 100644 --- a/examples/postInit/generated/bewitchment.groovy +++ b/examples/postInit/generated/bewitchment.groovy @@ -47,8 +47,8 @@ mods.bewitchment.altar_upgrade.recipeBuilder() mods.bewitchment.athame_loot.removeByOutput(item('bewitchment:spectral_dust')) // mods.bewitchment.athame_loot.removeAll() -mods.bewitchment.athame_loot.add(entity('minecraft:cow'), item('minecraft:clay') * 5, item('minecraft:iron_sword')) mods.bewitchment.athame_loot.add(entity('minecraft:pig'), item('minecraft:gold_ingot')) +mods.bewitchment.athame_loot.add(entity('minecraft:cow'), item('minecraft:clay') * 5, item('minecraft:iron_sword')) // Witches' Cauldron Brew: // After throwing a `bewitchment:mandrake_root` in the Witches' Cauldron while Magic Power is provided, all items thrown in diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java index 9bc615f16..dfa042d52 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ComparisonHelper.java @@ -115,11 +115,12 @@ public static int comp(Comp left, Comp right) { .result(); } - private static int comparePriorityAndMethod(int leftPriority, int rightPriority, Method leftMethod, Method rightName) { + private static int comparePriorityAndMethod(int leftPriority, int rightPriority, Method leftMethod, Method rightMethod) { return ComparisonChain.start() .compare(leftPriority, rightPriority) - .compare(leftMethod.getName(), rightName.getName(), ComparisonHelper::string) - .compare(DescriptorHelper.simpleParameters(leftMethod), DescriptorHelper.simpleParameters(rightName), ComparisonHelper::packages) + .compare(leftMethod.getName(), rightMethod.getName(), ComparisonHelper::string) + .compare(DescriptorHelper.simpleParameters(leftMethod), DescriptorHelper.simpleParameters(rightMethod), ComparisonHelper::packages) + .compareFalseFirst(leftMethod.isVarArgs(), rightMethod.isVarArgs()) .result(); } } From 7af1042669a981321d224330b0b5ce82f08a08f7 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Thu, 16 Oct 2025 14:34:27 -0700 Subject: [PATCH 49/92] rename generated files --- ...s.groovy => actuallyadditions_generated.groovy} | 0 ...ars.groovy => advancedmortars_generated.groovy} | 0 ...ry.groovy => advancedrocketry_generated.groovy} | 0 ...egacy.groovy => aether_legacy_generated.groovy} | 0 ...emistry.groovy => alchemistry_generated.groovy} | 0 ...groovy => appliedenergistics2_generated.groovy} | 0 ...ives.groovy => arcanearchives_generated.groovy} | 0 ...neworld.groovy => arcaneworld_generated.groovy} | 0 ...armorplus.groovy => armorplus_generated.groovy} | 0 ...rcery.groovy => astralsorcery_generated.groovy} | 0 .../{atum.groovy => atum_generated.groovy} | 0 .../{avaritia.groovy => avaritia_generated.groovy} | 0 ...ns.groovy => betterwithaddons_generated.groovy} | 0 ...mods.groovy => betterwithmods_generated.groovy} | 0 ...tchment.groovy => bewitchment_generated.groovy} | 0 ...rsenal.groovy => bloodarsenal_generated.groovy} | 0 ...oodmagic.groovy => bloodmagic_generated.groovy} | 0 .../{botania.groovy => botania_generated.groovy} | 0 ...eaks.groovy => botania_tweaks_generated.groovy} | 0 ...nicadds.groovy => botanicadds_generated.groovy} | 0 ...lculator.groovy => calculator_generated.groovy} | 0 .../{chisel.groovy => chisel_generated.groovy} | 0 ...s3.groovy => compactmachines3_generated.groovy} | 0 ...icmagic.groovy => cyclicmagic_generated.groovy} | 0 ...n.groovy => draconicevolution_generated.groovy} | 0 .../{enderio.groovy => enderio_generated.groovy} | 0 .../{erebus.groovy => erebus_generated.groovy} | 0 ...raft.groovy => essentialcraft_generated.groovy} | 0 ...evilcraft.groovy => evilcraft_generated.groovy} | 0 ...ng.groovy => extendedcrafting_generated.groovy} | 0 ...abotany.groovy => extrabotany_generated.groovy} | 0 ...autils2.groovy => extrautils2_generated.groovy} | 0 ...orytech.groovy => factorytech_generated.groovy} | 0 .../{futuremc.groovy => futuremc_generated.groovy} | 0 ...rsepower.groovy => horsepower_generated.groovy} | 0 ...eandfire.groovy => iceandfire_generated.groovy} | 0 ...roovy => immersiveengineering_generated.groovy} | 0 ....groovy => immersivepetroleum_generated.groovy} | 0 ...etech.groovy => immersivetech_generated.groovy} | 0 ...groovy => industrialforegoing_generated.groovy} | 0 ...ations.groovy => inspirations_generated.groovy} | 0 ....groovy => integrateddynamics_generated.groovy} | 0 .../generated/{jei.groovy => jei_generated.groovy} | 0 ...icraft.groovy => magneticraft_generated.groovy} | 0 .../{mekanism.groovy => mekanism_generated.groovy} | 0 ...minecraft.groovy => minecraft_generated.groovy} | 0 ...groovy => mysticalagriculture_generated.groovy} | 0 ...resaura.groovy => naturesaura_generated.groovy} | 0 ...raft.groovy => pneumaticcraft_generated.groovy} | 0 ...al_tech.groovy => primal_tech_generated.groovy} | 0 ...igytech.groovy => prodigytech_generated.groovy} | 0 .../{projecte.groovy => projecte_generated.groovy} | 0 .../{pyrotech.groovy => pyrotech_generated.groovy} | 0 ...arryplus.groovy => quarryplus_generated.groovy} | 0 ...things.groovy => randomthings_generated.groovy} | 0 .../{roots.groovy => roots_generated.groovy} | 0 .../{rustic.groovy => rustic_generated.groovy} | 0 ...lentgems.groovy => silentgems_generated.groovy} | 0 ...onstruct.groovy => tconstruct_generated.groovy} | 0 ...chreborn.groovy => techreborn_generated.groovy} | 0 ...aumcraft.groovy => thaumcraft_generated.groovy} | 0 ...urorian.groovy => theaurorian_generated.groovy} | 0 ...nds.groovy => thebetweenlands_generated.groovy} | 0 ...on.groovy => thermalexpansion_generated.groovy} | 0 .../{threng.groovy => threng_generated.groovy} | 0 .../{woot.groovy => woot_generated.groovy} | 0 .../{mekanism.groovy => mekanism_generated.groovy} | 0 ...igytech.groovy => prodigytech_generated.groovy} | 0 .../groovyscript/documentation/Documentation.java | 14 +++++++++++--- 69 files changed, 11 insertions(+), 3 deletions(-) rename examples/postInit/generated/{actuallyadditions.groovy => actuallyadditions_generated.groovy} (100%) rename examples/postInit/generated/{advancedmortars.groovy => advancedmortars_generated.groovy} (100%) rename examples/postInit/generated/{advancedrocketry.groovy => advancedrocketry_generated.groovy} (100%) rename examples/postInit/generated/{aether_legacy.groovy => aether_legacy_generated.groovy} (100%) rename examples/postInit/generated/{alchemistry.groovy => alchemistry_generated.groovy} (100%) rename examples/postInit/generated/{appliedenergistics2.groovy => appliedenergistics2_generated.groovy} (100%) rename examples/postInit/generated/{arcanearchives.groovy => arcanearchives_generated.groovy} (100%) rename examples/postInit/generated/{arcaneworld.groovy => arcaneworld_generated.groovy} (100%) rename examples/postInit/generated/{armorplus.groovy => armorplus_generated.groovy} (100%) rename examples/postInit/generated/{astralsorcery.groovy => astralsorcery_generated.groovy} (100%) rename examples/postInit/generated/{atum.groovy => atum_generated.groovy} (100%) rename examples/postInit/generated/{avaritia.groovy => avaritia_generated.groovy} (100%) rename examples/postInit/generated/{betterwithaddons.groovy => betterwithaddons_generated.groovy} (100%) rename examples/postInit/generated/{betterwithmods.groovy => betterwithmods_generated.groovy} (100%) rename examples/postInit/generated/{bewitchment.groovy => bewitchment_generated.groovy} (100%) rename examples/postInit/generated/{bloodarsenal.groovy => bloodarsenal_generated.groovy} (100%) rename examples/postInit/generated/{bloodmagic.groovy => bloodmagic_generated.groovy} (100%) rename examples/postInit/generated/{botania.groovy => botania_generated.groovy} (100%) rename examples/postInit/generated/{botania_tweaks.groovy => botania_tweaks_generated.groovy} (100%) rename examples/postInit/generated/{botanicadds.groovy => botanicadds_generated.groovy} (100%) rename examples/postInit/generated/{calculator.groovy => calculator_generated.groovy} (100%) rename examples/postInit/generated/{chisel.groovy => chisel_generated.groovy} (100%) rename examples/postInit/generated/{compactmachines3.groovy => compactmachines3_generated.groovy} (100%) rename examples/postInit/generated/{cyclicmagic.groovy => cyclicmagic_generated.groovy} (100%) rename examples/postInit/generated/{draconicevolution.groovy => draconicevolution_generated.groovy} (100%) rename examples/postInit/generated/{enderio.groovy => enderio_generated.groovy} (100%) rename examples/postInit/generated/{erebus.groovy => erebus_generated.groovy} (100%) rename examples/postInit/generated/{essentialcraft.groovy => essentialcraft_generated.groovy} (100%) rename examples/postInit/generated/{evilcraft.groovy => evilcraft_generated.groovy} (100%) rename examples/postInit/generated/{extendedcrafting.groovy => extendedcrafting_generated.groovy} (100%) rename examples/postInit/generated/{extrabotany.groovy => extrabotany_generated.groovy} (100%) rename examples/postInit/generated/{extrautils2.groovy => extrautils2_generated.groovy} (100%) rename examples/postInit/generated/{factorytech.groovy => factorytech_generated.groovy} (100%) rename examples/postInit/generated/{futuremc.groovy => futuremc_generated.groovy} (100%) rename examples/postInit/generated/{horsepower.groovy => horsepower_generated.groovy} (100%) rename examples/postInit/generated/{iceandfire.groovy => iceandfire_generated.groovy} (100%) rename examples/postInit/generated/{immersiveengineering.groovy => immersiveengineering_generated.groovy} (100%) rename examples/postInit/generated/{immersivepetroleum.groovy => immersivepetroleum_generated.groovy} (100%) rename examples/postInit/generated/{immersivetech.groovy => immersivetech_generated.groovy} (100%) rename examples/postInit/generated/{industrialforegoing.groovy => industrialforegoing_generated.groovy} (100%) rename examples/postInit/generated/{inspirations.groovy => inspirations_generated.groovy} (100%) rename examples/postInit/generated/{integrateddynamics.groovy => integrateddynamics_generated.groovy} (100%) rename examples/postInit/generated/{jei.groovy => jei_generated.groovy} (100%) rename examples/postInit/generated/{magneticraft.groovy => magneticraft_generated.groovy} (100%) rename examples/postInit/generated/{mekanism.groovy => mekanism_generated.groovy} (100%) rename examples/postInit/generated/{minecraft.groovy => minecraft_generated.groovy} (100%) rename examples/postInit/generated/{mysticalagriculture.groovy => mysticalagriculture_generated.groovy} (100%) rename examples/postInit/generated/{naturesaura.groovy => naturesaura_generated.groovy} (100%) rename examples/postInit/generated/{pneumaticcraft.groovy => pneumaticcraft_generated.groovy} (100%) rename examples/postInit/generated/{primal_tech.groovy => primal_tech_generated.groovy} (100%) rename examples/postInit/generated/{prodigytech.groovy => prodigytech_generated.groovy} (100%) rename examples/postInit/generated/{projecte.groovy => projecte_generated.groovy} (100%) rename examples/postInit/generated/{pyrotech.groovy => pyrotech_generated.groovy} (100%) rename examples/postInit/generated/{quarryplus.groovy => quarryplus_generated.groovy} (100%) rename examples/postInit/generated/{randomthings.groovy => randomthings_generated.groovy} (100%) rename examples/postInit/generated/{roots.groovy => roots_generated.groovy} (100%) rename examples/postInit/generated/{rustic.groovy => rustic_generated.groovy} (100%) rename examples/postInit/generated/{silentgems.groovy => silentgems_generated.groovy} (100%) rename examples/postInit/generated/{tconstruct.groovy => tconstruct_generated.groovy} (100%) rename examples/postInit/generated/{techreborn.groovy => techreborn_generated.groovy} (100%) rename examples/postInit/generated/{thaumcraft.groovy => thaumcraft_generated.groovy} (100%) rename examples/postInit/generated/{theaurorian.groovy => theaurorian_generated.groovy} (100%) rename examples/postInit/generated/{thebetweenlands.groovy => thebetweenlands_generated.groovy} (100%) rename examples/postInit/generated/{thermalexpansion.groovy => thermalexpansion_generated.groovy} (100%) rename examples/postInit/generated/{threng.groovy => threng_generated.groovy} (100%) rename examples/postInit/generated/{woot.groovy => woot_generated.groovy} (100%) rename examples/preInit/generated/{mekanism.groovy => mekanism_generated.groovy} (100%) rename examples/preInit/generated/{prodigytech.groovy => prodigytech_generated.groovy} (100%) diff --git a/examples/postInit/generated/actuallyadditions.groovy b/examples/postInit/generated/actuallyadditions_generated.groovy similarity index 100% rename from examples/postInit/generated/actuallyadditions.groovy rename to examples/postInit/generated/actuallyadditions_generated.groovy diff --git a/examples/postInit/generated/advancedmortars.groovy b/examples/postInit/generated/advancedmortars_generated.groovy similarity index 100% rename from examples/postInit/generated/advancedmortars.groovy rename to examples/postInit/generated/advancedmortars_generated.groovy diff --git a/examples/postInit/generated/advancedrocketry.groovy b/examples/postInit/generated/advancedrocketry_generated.groovy similarity index 100% rename from examples/postInit/generated/advancedrocketry.groovy rename to examples/postInit/generated/advancedrocketry_generated.groovy diff --git a/examples/postInit/generated/aether_legacy.groovy b/examples/postInit/generated/aether_legacy_generated.groovy similarity index 100% rename from examples/postInit/generated/aether_legacy.groovy rename to examples/postInit/generated/aether_legacy_generated.groovy diff --git a/examples/postInit/generated/alchemistry.groovy b/examples/postInit/generated/alchemistry_generated.groovy similarity index 100% rename from examples/postInit/generated/alchemistry.groovy rename to examples/postInit/generated/alchemistry_generated.groovy diff --git a/examples/postInit/generated/appliedenergistics2.groovy b/examples/postInit/generated/appliedenergistics2_generated.groovy similarity index 100% rename from examples/postInit/generated/appliedenergistics2.groovy rename to examples/postInit/generated/appliedenergistics2_generated.groovy diff --git a/examples/postInit/generated/arcanearchives.groovy b/examples/postInit/generated/arcanearchives_generated.groovy similarity index 100% rename from examples/postInit/generated/arcanearchives.groovy rename to examples/postInit/generated/arcanearchives_generated.groovy diff --git a/examples/postInit/generated/arcaneworld.groovy b/examples/postInit/generated/arcaneworld_generated.groovy similarity index 100% rename from examples/postInit/generated/arcaneworld.groovy rename to examples/postInit/generated/arcaneworld_generated.groovy diff --git a/examples/postInit/generated/armorplus.groovy b/examples/postInit/generated/armorplus_generated.groovy similarity index 100% rename from examples/postInit/generated/armorplus.groovy rename to examples/postInit/generated/armorplus_generated.groovy diff --git a/examples/postInit/generated/astralsorcery.groovy b/examples/postInit/generated/astralsorcery_generated.groovy similarity index 100% rename from examples/postInit/generated/astralsorcery.groovy rename to examples/postInit/generated/astralsorcery_generated.groovy diff --git a/examples/postInit/generated/atum.groovy b/examples/postInit/generated/atum_generated.groovy similarity index 100% rename from examples/postInit/generated/atum.groovy rename to examples/postInit/generated/atum_generated.groovy diff --git a/examples/postInit/generated/avaritia.groovy b/examples/postInit/generated/avaritia_generated.groovy similarity index 100% rename from examples/postInit/generated/avaritia.groovy rename to examples/postInit/generated/avaritia_generated.groovy diff --git a/examples/postInit/generated/betterwithaddons.groovy b/examples/postInit/generated/betterwithaddons_generated.groovy similarity index 100% rename from examples/postInit/generated/betterwithaddons.groovy rename to examples/postInit/generated/betterwithaddons_generated.groovy diff --git a/examples/postInit/generated/betterwithmods.groovy b/examples/postInit/generated/betterwithmods_generated.groovy similarity index 100% rename from examples/postInit/generated/betterwithmods.groovy rename to examples/postInit/generated/betterwithmods_generated.groovy diff --git a/examples/postInit/generated/bewitchment.groovy b/examples/postInit/generated/bewitchment_generated.groovy similarity index 100% rename from examples/postInit/generated/bewitchment.groovy rename to examples/postInit/generated/bewitchment_generated.groovy diff --git a/examples/postInit/generated/bloodarsenal.groovy b/examples/postInit/generated/bloodarsenal_generated.groovy similarity index 100% rename from examples/postInit/generated/bloodarsenal.groovy rename to examples/postInit/generated/bloodarsenal_generated.groovy diff --git a/examples/postInit/generated/bloodmagic.groovy b/examples/postInit/generated/bloodmagic_generated.groovy similarity index 100% rename from examples/postInit/generated/bloodmagic.groovy rename to examples/postInit/generated/bloodmagic_generated.groovy diff --git a/examples/postInit/generated/botania.groovy b/examples/postInit/generated/botania_generated.groovy similarity index 100% rename from examples/postInit/generated/botania.groovy rename to examples/postInit/generated/botania_generated.groovy diff --git a/examples/postInit/generated/botania_tweaks.groovy b/examples/postInit/generated/botania_tweaks_generated.groovy similarity index 100% rename from examples/postInit/generated/botania_tweaks.groovy rename to examples/postInit/generated/botania_tweaks_generated.groovy diff --git a/examples/postInit/generated/botanicadds.groovy b/examples/postInit/generated/botanicadds_generated.groovy similarity index 100% rename from examples/postInit/generated/botanicadds.groovy rename to examples/postInit/generated/botanicadds_generated.groovy diff --git a/examples/postInit/generated/calculator.groovy b/examples/postInit/generated/calculator_generated.groovy similarity index 100% rename from examples/postInit/generated/calculator.groovy rename to examples/postInit/generated/calculator_generated.groovy diff --git a/examples/postInit/generated/chisel.groovy b/examples/postInit/generated/chisel_generated.groovy similarity index 100% rename from examples/postInit/generated/chisel.groovy rename to examples/postInit/generated/chisel_generated.groovy diff --git a/examples/postInit/generated/compactmachines3.groovy b/examples/postInit/generated/compactmachines3_generated.groovy similarity index 100% rename from examples/postInit/generated/compactmachines3.groovy rename to examples/postInit/generated/compactmachines3_generated.groovy diff --git a/examples/postInit/generated/cyclicmagic.groovy b/examples/postInit/generated/cyclicmagic_generated.groovy similarity index 100% rename from examples/postInit/generated/cyclicmagic.groovy rename to examples/postInit/generated/cyclicmagic_generated.groovy diff --git a/examples/postInit/generated/draconicevolution.groovy b/examples/postInit/generated/draconicevolution_generated.groovy similarity index 100% rename from examples/postInit/generated/draconicevolution.groovy rename to examples/postInit/generated/draconicevolution_generated.groovy diff --git a/examples/postInit/generated/enderio.groovy b/examples/postInit/generated/enderio_generated.groovy similarity index 100% rename from examples/postInit/generated/enderio.groovy rename to examples/postInit/generated/enderio_generated.groovy diff --git a/examples/postInit/generated/erebus.groovy b/examples/postInit/generated/erebus_generated.groovy similarity index 100% rename from examples/postInit/generated/erebus.groovy rename to examples/postInit/generated/erebus_generated.groovy diff --git a/examples/postInit/generated/essentialcraft.groovy b/examples/postInit/generated/essentialcraft_generated.groovy similarity index 100% rename from examples/postInit/generated/essentialcraft.groovy rename to examples/postInit/generated/essentialcraft_generated.groovy diff --git a/examples/postInit/generated/evilcraft.groovy b/examples/postInit/generated/evilcraft_generated.groovy similarity index 100% rename from examples/postInit/generated/evilcraft.groovy rename to examples/postInit/generated/evilcraft_generated.groovy diff --git a/examples/postInit/generated/extendedcrafting.groovy b/examples/postInit/generated/extendedcrafting_generated.groovy similarity index 100% rename from examples/postInit/generated/extendedcrafting.groovy rename to examples/postInit/generated/extendedcrafting_generated.groovy diff --git a/examples/postInit/generated/extrabotany.groovy b/examples/postInit/generated/extrabotany_generated.groovy similarity index 100% rename from examples/postInit/generated/extrabotany.groovy rename to examples/postInit/generated/extrabotany_generated.groovy diff --git a/examples/postInit/generated/extrautils2.groovy b/examples/postInit/generated/extrautils2_generated.groovy similarity index 100% rename from examples/postInit/generated/extrautils2.groovy rename to examples/postInit/generated/extrautils2_generated.groovy diff --git a/examples/postInit/generated/factorytech.groovy b/examples/postInit/generated/factorytech_generated.groovy similarity index 100% rename from examples/postInit/generated/factorytech.groovy rename to examples/postInit/generated/factorytech_generated.groovy diff --git a/examples/postInit/generated/futuremc.groovy b/examples/postInit/generated/futuremc_generated.groovy similarity index 100% rename from examples/postInit/generated/futuremc.groovy rename to examples/postInit/generated/futuremc_generated.groovy diff --git a/examples/postInit/generated/horsepower.groovy b/examples/postInit/generated/horsepower_generated.groovy similarity index 100% rename from examples/postInit/generated/horsepower.groovy rename to examples/postInit/generated/horsepower_generated.groovy diff --git a/examples/postInit/generated/iceandfire.groovy b/examples/postInit/generated/iceandfire_generated.groovy similarity index 100% rename from examples/postInit/generated/iceandfire.groovy rename to examples/postInit/generated/iceandfire_generated.groovy diff --git a/examples/postInit/generated/immersiveengineering.groovy b/examples/postInit/generated/immersiveengineering_generated.groovy similarity index 100% rename from examples/postInit/generated/immersiveengineering.groovy rename to examples/postInit/generated/immersiveengineering_generated.groovy diff --git a/examples/postInit/generated/immersivepetroleum.groovy b/examples/postInit/generated/immersivepetroleum_generated.groovy similarity index 100% rename from examples/postInit/generated/immersivepetroleum.groovy rename to examples/postInit/generated/immersivepetroleum_generated.groovy diff --git a/examples/postInit/generated/immersivetech.groovy b/examples/postInit/generated/immersivetech_generated.groovy similarity index 100% rename from examples/postInit/generated/immersivetech.groovy rename to examples/postInit/generated/immersivetech_generated.groovy diff --git a/examples/postInit/generated/industrialforegoing.groovy b/examples/postInit/generated/industrialforegoing_generated.groovy similarity index 100% rename from examples/postInit/generated/industrialforegoing.groovy rename to examples/postInit/generated/industrialforegoing_generated.groovy diff --git a/examples/postInit/generated/inspirations.groovy b/examples/postInit/generated/inspirations_generated.groovy similarity index 100% rename from examples/postInit/generated/inspirations.groovy rename to examples/postInit/generated/inspirations_generated.groovy diff --git a/examples/postInit/generated/integrateddynamics.groovy b/examples/postInit/generated/integrateddynamics_generated.groovy similarity index 100% rename from examples/postInit/generated/integrateddynamics.groovy rename to examples/postInit/generated/integrateddynamics_generated.groovy diff --git a/examples/postInit/generated/jei.groovy b/examples/postInit/generated/jei_generated.groovy similarity index 100% rename from examples/postInit/generated/jei.groovy rename to examples/postInit/generated/jei_generated.groovy diff --git a/examples/postInit/generated/magneticraft.groovy b/examples/postInit/generated/magneticraft_generated.groovy similarity index 100% rename from examples/postInit/generated/magneticraft.groovy rename to examples/postInit/generated/magneticraft_generated.groovy diff --git a/examples/postInit/generated/mekanism.groovy b/examples/postInit/generated/mekanism_generated.groovy similarity index 100% rename from examples/postInit/generated/mekanism.groovy rename to examples/postInit/generated/mekanism_generated.groovy diff --git a/examples/postInit/generated/minecraft.groovy b/examples/postInit/generated/minecraft_generated.groovy similarity index 100% rename from examples/postInit/generated/minecraft.groovy rename to examples/postInit/generated/minecraft_generated.groovy diff --git a/examples/postInit/generated/mysticalagriculture.groovy b/examples/postInit/generated/mysticalagriculture_generated.groovy similarity index 100% rename from examples/postInit/generated/mysticalagriculture.groovy rename to examples/postInit/generated/mysticalagriculture_generated.groovy diff --git a/examples/postInit/generated/naturesaura.groovy b/examples/postInit/generated/naturesaura_generated.groovy similarity index 100% rename from examples/postInit/generated/naturesaura.groovy rename to examples/postInit/generated/naturesaura_generated.groovy diff --git a/examples/postInit/generated/pneumaticcraft.groovy b/examples/postInit/generated/pneumaticcraft_generated.groovy similarity index 100% rename from examples/postInit/generated/pneumaticcraft.groovy rename to examples/postInit/generated/pneumaticcraft_generated.groovy diff --git a/examples/postInit/generated/primal_tech.groovy b/examples/postInit/generated/primal_tech_generated.groovy similarity index 100% rename from examples/postInit/generated/primal_tech.groovy rename to examples/postInit/generated/primal_tech_generated.groovy diff --git a/examples/postInit/generated/prodigytech.groovy b/examples/postInit/generated/prodigytech_generated.groovy similarity index 100% rename from examples/postInit/generated/prodigytech.groovy rename to examples/postInit/generated/prodigytech_generated.groovy diff --git a/examples/postInit/generated/projecte.groovy b/examples/postInit/generated/projecte_generated.groovy similarity index 100% rename from examples/postInit/generated/projecte.groovy rename to examples/postInit/generated/projecte_generated.groovy diff --git a/examples/postInit/generated/pyrotech.groovy b/examples/postInit/generated/pyrotech_generated.groovy similarity index 100% rename from examples/postInit/generated/pyrotech.groovy rename to examples/postInit/generated/pyrotech_generated.groovy diff --git a/examples/postInit/generated/quarryplus.groovy b/examples/postInit/generated/quarryplus_generated.groovy similarity index 100% rename from examples/postInit/generated/quarryplus.groovy rename to examples/postInit/generated/quarryplus_generated.groovy diff --git a/examples/postInit/generated/randomthings.groovy b/examples/postInit/generated/randomthings_generated.groovy similarity index 100% rename from examples/postInit/generated/randomthings.groovy rename to examples/postInit/generated/randomthings_generated.groovy diff --git a/examples/postInit/generated/roots.groovy b/examples/postInit/generated/roots_generated.groovy similarity index 100% rename from examples/postInit/generated/roots.groovy rename to examples/postInit/generated/roots_generated.groovy diff --git a/examples/postInit/generated/rustic.groovy b/examples/postInit/generated/rustic_generated.groovy similarity index 100% rename from examples/postInit/generated/rustic.groovy rename to examples/postInit/generated/rustic_generated.groovy diff --git a/examples/postInit/generated/silentgems.groovy b/examples/postInit/generated/silentgems_generated.groovy similarity index 100% rename from examples/postInit/generated/silentgems.groovy rename to examples/postInit/generated/silentgems_generated.groovy diff --git a/examples/postInit/generated/tconstruct.groovy b/examples/postInit/generated/tconstruct_generated.groovy similarity index 100% rename from examples/postInit/generated/tconstruct.groovy rename to examples/postInit/generated/tconstruct_generated.groovy diff --git a/examples/postInit/generated/techreborn.groovy b/examples/postInit/generated/techreborn_generated.groovy similarity index 100% rename from examples/postInit/generated/techreborn.groovy rename to examples/postInit/generated/techreborn_generated.groovy diff --git a/examples/postInit/generated/thaumcraft.groovy b/examples/postInit/generated/thaumcraft_generated.groovy similarity index 100% rename from examples/postInit/generated/thaumcraft.groovy rename to examples/postInit/generated/thaumcraft_generated.groovy diff --git a/examples/postInit/generated/theaurorian.groovy b/examples/postInit/generated/theaurorian_generated.groovy similarity index 100% rename from examples/postInit/generated/theaurorian.groovy rename to examples/postInit/generated/theaurorian_generated.groovy diff --git a/examples/postInit/generated/thebetweenlands.groovy b/examples/postInit/generated/thebetweenlands_generated.groovy similarity index 100% rename from examples/postInit/generated/thebetweenlands.groovy rename to examples/postInit/generated/thebetweenlands_generated.groovy diff --git a/examples/postInit/generated/thermalexpansion.groovy b/examples/postInit/generated/thermalexpansion_generated.groovy similarity index 100% rename from examples/postInit/generated/thermalexpansion.groovy rename to examples/postInit/generated/thermalexpansion_generated.groovy diff --git a/examples/postInit/generated/threng.groovy b/examples/postInit/generated/threng_generated.groovy similarity index 100% rename from examples/postInit/generated/threng.groovy rename to examples/postInit/generated/threng_generated.groovy diff --git a/examples/postInit/generated/woot.groovy b/examples/postInit/generated/woot_generated.groovy similarity index 100% rename from examples/postInit/generated/woot.groovy rename to examples/postInit/generated/woot_generated.groovy diff --git a/examples/preInit/generated/mekanism.groovy b/examples/preInit/generated/mekanism_generated.groovy similarity index 100% rename from examples/preInit/generated/mekanism.groovy rename to examples/preInit/generated/mekanism_generated.groovy diff --git a/examples/preInit/generated/prodigytech.groovy b/examples/preInit/generated/prodigytech_generated.groovy similarity index 100% rename from examples/preInit/generated/prodigytech.groovy rename to examples/preInit/generated/prodigytech_generated.groovy diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java index 981f6279b..f9995a2d5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java @@ -48,21 +48,29 @@ public static void ensureDirectoryExists(File folder) { } } - public static File generatedFolder(LoadStage stage) { + public static File generatedExampleFolder(LoadStage stage) { return new File(new File(EXAMPLES, stage.getName()), "generated"); } + public static File generatedExampleFile(File parent, String location) { + return new File(parent, location + "_generated" + GROOVY_FILE_EXTENSION); + } + + public static File generatedExampleFile(LoadStage stage, String location) { + return generatedExampleFile(generatedExampleFolder(stage), location); + } + public static void generateExamples() { generateExamples(true); } private static void generateExamples(boolean log) { for (LoadStage stage : LoadStage.getLoadStages()) { - File generatedFolder = generatedFolder(stage); + File generatedFolder = generatedExampleFolder(stage); ensureDirectoryExists(generatedFolder); for (var container : ModSupport.getAllContainers()) { if (!container.isLoaded()) continue; - File file = new File(generatedFolder, container.getModId() + GROOVY_FILE_EXTENSION); + File file = generatedExampleFile(generatedFolder, container.getModId()); if (!(container instanceof IContainerDocumentation doc) || doc.generateExamples(file, stage)) { Exporter.generateExamples(file, stage, ContainerHolder.of(container)); } From 25a8c25b00cce0e989483ff792f0f5f475bf53e5 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 17 Oct 2025 03:36:07 -0700 Subject: [PATCH 50/92] make inWorldCrafting have properties correctly --- .../inworldcrafting/InWorldCrafting.java | 47 ++++++++++++++----- .../compat/mods/MinecraftModContainer.java | 1 + 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java index 240e723ec..61940e5cd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java @@ -1,16 +1,19 @@ package com.cleanroommc.groovyscript.compat.inworldcrafting; import com.cleanroommc.groovyscript.api.GroovyBlacklist; +import com.cleanroommc.groovyscript.api.INamed; import com.cleanroommc.groovyscript.api.IScriptReloadable; import com.cleanroommc.groovyscript.api.documentation.IRegistryDocumentation; +import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.documentation.Documentation; import com.cleanroommc.groovyscript.documentation.Exporter; import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; import com.cleanroommc.groovyscript.documentation.helper.LinkIndex; -import com.cleanroommc.groovyscript.registry.NamedRegistry; +import com.cleanroommc.groovyscript.helper.Alias; import com.cleanroommc.groovyscript.sandbox.LoadStage; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; @@ -19,9 +22,11 @@ import java.io.File; import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.Locale; -public class InWorldCrafting extends NamedRegistry implements IScriptReloadable, IRegistryDocumentation { +public class InWorldCrafting extends GroovyPropertyContainer implements INamed, IScriptReloadable, IRegistryDocumentation { private static final String NAME = "In-World Crafting"; private static final String LOCATION = "in_world_crafting"; @@ -33,24 +38,42 @@ public class InWorldCrafting extends NamedRegistry implements IScriptReloadable, public final Burning burning = new Burning(); public final PistonPush pistonPush = new PistonPush(); - private final List registries = ImmutableList.of(fluidToFluid, fluidToItem, fluidToBlock, explosion, burning, pistonPush); + private final String name; + private final List aliases; + + private final List reloadable = ImmutableList.of(fluidToFluid, fluidToItem, fluidToBlock, explosion, burning, pistonPush); + + public InWorldCrafting() { + this.aliases = Collections.unmodifiableList(Alias.generateOfClass(this)); + this.name = this.aliases.get(0).toLowerCase(Locale.ENGLISH); + } + + public static EntityItem spawnItem(World world, BlockPos pos, ItemStack item) { + EntityItem entityItem = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, item); + world.spawnEntity(entityItem); + return entityItem; + } + + @Override + public String getName() { + return name; + } + + @Override + public List getAliases() { + return aliases; + } @GroovyBlacklist @Override public void onReload() { - registries.forEach(IScriptReloadable::onReload); + reloadable.forEach(IScriptReloadable::onReload); } @GroovyBlacklist @Override public void afterScriptLoad() { - registries.forEach(IScriptReloadable::afterScriptLoad); - } - - public static EntityItem spawnItem(World world, BlockPos pos, ItemStack item) { - EntityItem entityItem = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, item); - world.spawnEntity(entityItem); - return entityItem; + reloadable.forEach(IScriptReloadable::afterScriptLoad); } private ContainerHolder getContainerHolder() { @@ -73,7 +96,7 @@ public void generateWiki(ContainerHolder container, File suggestedFolder, LinkIn @Override public @NotNull String generateExamples(ContainerHolder container, LoadStage loadStage, List imports) { - File inWorldCrafting = new File(Documentation.generatedFolder(loadStage), LOCATION + Documentation.GROOVY_FILE_EXTENSION); + File inWorldCrafting = Documentation.generatedExampleFile(loadStage, LOCATION); Exporter.generateExamples(inWorldCrafting, loadStage, getContainerHolder()); return ""; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java index 3dde84f9a..c8ec3a233 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java @@ -28,6 +28,7 @@ public final class MinecraftModContainer extends GroovyContainer this.modProperty = Suppliers.memoize(() -> { VanillaModule t = VanillaModule.INSTANCE; t.addPropertyFieldsOf(t, false); + t.inWorldCrafting.addPropertyFieldsOf(t.inWorldCrafting, false); return t; }); Set aliasSet = new ObjectOpenHashSet<>(Alias.generateOf(containerName).andGenerate("Vanilla").and("mc").and("MC")); From 10518b4437b35a40831303cff3f4f3edca5a2fb0 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:07:16 -0700 Subject: [PATCH 51/92] deduplicate sets in a different location --- .../compat/inworldcrafting/InWorldCrafting.java | 2 +- .../groovyscript/compat/mods/MinecraftModContainer.java | 9 +++------ .../cleanroommc/groovyscript/documentation/Exporter.java | 3 ++- .../documentation/helper/ContainerHolder.java | 3 +-- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java index 61940e5cd..74f9f2d8e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java @@ -85,7 +85,7 @@ private ContainerHolder getContainerHolder() { list.add(ContainerHolder.BASE_ACCESS_COMPAT + "." + minecraftAlias + "." + alias); } } - return new ContainerHolder(LOCATION, NAME, LOCATION, importBlock -> importBlock + "\nlog 'running In-World Crafting example'", list, ImmutableList.copyOf(registries)); + return new ContainerHolder(LOCATION, NAME, LOCATION, importBlock -> importBlock + "\nlog 'running In-World Crafting example'", list, getRegistries()); } @Override diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java index c8ec3a233..f2a4782aa 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java @@ -9,13 +9,11 @@ import com.cleanroommc.groovyscript.sandbox.LoadStage; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import com.google.common.collect.ImmutableSet; import org.jetbrains.annotations.NotNull; import java.io.File; import java.util.Collection; -import java.util.Collections; -import java.util.Set; public final class MinecraftModContainer extends GroovyContainer implements IContainerDocumentation { @@ -31,8 +29,7 @@ public final class MinecraftModContainer extends GroovyContainer t.inWorldCrafting.addPropertyFieldsOf(t.inWorldCrafting, false); return t; }); - Set aliasSet = new ObjectOpenHashSet<>(Alias.generateOf(containerName).andGenerate("Vanilla").and("mc").and("MC")); - this.aliases = Collections.unmodifiableSet(aliasSet); + this.aliases = ImmutableSet.copyOf(Alias.generateOf(containerName).andGenerate("Vanilla").and("mc").and("MC")); ModSupport.INSTANCE.registerContainer(this); } @@ -67,7 +64,7 @@ public void onCompatLoaded(GroovyContainer container) {} private ContainerHolder getContainer() { var aliases = ContainerHolder.expandAliases(getAliases()); aliases.addAll(getAliases()); - return new ContainerHolder(getModId(), "Vanilla Registries", getModId(), importBlock -> importBlock + "\nlog 'running Vanilla Minecraft example'", aliases, new ObjectOpenHashSet<>(get().getRegistries())); + return new ContainerHolder(getModId(), "Vanilla Registries", getModId(), importBlock -> importBlock + "\nlog 'running Vanilla Minecraft example'", aliases, get().getRegistries()); } @Override diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index 9b47ea1a8..49632e5a3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -9,6 +9,7 @@ import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; import com.cleanroommc.groovyscript.documentation.helper.LinkIndex; import com.cleanroommc.groovyscript.sandbox.LoadStage; +import com.google.common.collect.ImmutableSet; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; @@ -103,7 +104,7 @@ public static void exportFile(File file, String resource) throws IOException { private static List getRegistries(ContainerHolder container, Predicate check) { List registries = new ArrayList<>(); - for (INamed named : container.registries()) { + for (INamed named : ImmutableSet.copyOf(container.registries())) { if (named instanceof IRegistryDocumentation doc) { registries.add(doc); if (check.test(doc)) continue; diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java index f2cda9570..de8b42667 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java @@ -5,7 +5,6 @@ import com.cleanroommc.groovyscript.compat.mods.GroovyContainer; import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; import com.github.bsideup.jabel.Desugar; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import java.util.ArrayList; import java.util.Collection; @@ -45,7 +44,7 @@ public static ContainerHolder of(IGroovyContainer container, Collection BASE_ACCESS_COMPAT + "." + container.getModId(), importBlock -> String.format(HEADER, container.getModId(), importBlock), ContainerHolder.expandAliases(container.getAliases()), - new ObjectOpenHashSet<>(registries)); + registries); } /** From cb385d89f671f1f3e12319d640894476f5a644f7 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:08:30 -0700 Subject: [PATCH 52/92] add more inworldcrafting examples --- .../generated/in_world_crafting.groovy | 77 -------- .../in_world_crafting_generated.groovy | 165 ++++++++++++++++++ .../compat/inworldcrafting/Burning.java | 6 +- .../compat/inworldcrafting/Explosion.java | 6 +- .../compat/inworldcrafting/FluidRecipe.java | 4 + .../compat/inworldcrafting/FluidToBlock.java | 24 ++- .../compat/inworldcrafting/FluidToFluid.java | 24 ++- .../compat/inworldcrafting/FluidToItem.java | 24 ++- .../compat/inworldcrafting/PistonPush.java | 6 +- 9 files changed, 229 insertions(+), 107 deletions(-) delete mode 100644 examples/postInit/generated/in_world_crafting.groovy create mode 100644 examples/postInit/generated/in_world_crafting_generated.groovy diff --git a/examples/postInit/generated/in_world_crafting.groovy b/examples/postInit/generated/in_world_crafting.groovy deleted file mode 100644 index 182c007f8..000000000 --- a/examples/postInit/generated/in_world_crafting.groovy +++ /dev/null @@ -1,77 +0,0 @@ - -// Auto generated groovyscript example file - -log 'running In-World Crafting example' - -// Burning Conversion: -// Converts an input item into an output itemstack after some number of ticks while burning. This also makes the input item -// effectively fireproof. - -// in_world_crafting.burning.removeAll() - -in_world_crafting.burning.recipeBuilder() - .input(item('minecraft:netherrack')) - .output(item('minecraft:nether_star')) - .register() - - -// Explosion Conversion: -// Converts an input itemstack into an output itemstack, with an optional fail rate. - -// in_world_crafting.explosion.removeAll() - -in_world_crafting.explosion.recipeBuilder() - .input(item('minecraft:diamond')) - .output(item('minecraft:nether_star')) - .chance(0.4f) - .register() - - -// Fluid and ItemStack To Block Conversion: -// Converts any number of input itemstacks and a fluid source block into a block in-world, with each input having a chance -// to be consumed. Allows an additional closure check to start the recipe and a closure run after the recipe is finished. - -in_world_crafting.fluid_to_block.recipeBuilder() - .fluidInput(fluid('water')) - .input(item('minecraft:clay_ball')) - .output(block('minecraft:diamond_block')) - .register() - - -// Fluid and ItemStack To Fluid Conversion: -// Converts any number of input itemstacks and a fluid source block into a fluid block in-world, with each input having a -// chance to be consumed. Allows an additional closure check to start the recipe and a closure run after the recipe is -// finished. - -in_world_crafting.fluid_to_fluid.recipeBuilder() - .fluidInput(fluid('water')) - .input(item('minecraft:diamond') * 2) - .fluidOutput(fluid('lava')) - .register() - - -// Fluid and ItemStack To ItemStack Conversion: -// Converts any number of input itemstacks and a fluid source block into an itemstack in-world, with each input having a -// chance to be consumed and a chance to consume the fluid block. Allows an additional closure check to start the recipe -// and a closure run after the recipe is finished. - -in_world_crafting.fluid_to_item.recipeBuilder() - .fluidInput(fluid('water'), 0.22f) - .input(item('minecraft:netherrack')) - .input(item('minecraft:gold_ingot'), 0.1f) - .output(item('minecraft:nether_star')) - .register() - - -// Piston Pushing Conversion: -// Converts an input item into an output item when a piston pushes the item into a block, with an optional minimum harvest -// level requirement for the block. Amount converted in each entity item per push is configurable. - -// in_world_crafting.piston_push.removeAll() - -in_world_crafting.piston_push.recipeBuilder() - .input(item('minecraft:gold_ingot')) - .output(item('minecraft:diamond')) - .minHarvestLevel(2) - .maxConversionsPerPush(3) - .register() diff --git a/examples/postInit/generated/in_world_crafting_generated.groovy b/examples/postInit/generated/in_world_crafting_generated.groovy new file mode 100644 index 000000000..6c1303cd2 --- /dev/null +++ b/examples/postInit/generated/in_world_crafting_generated.groovy @@ -0,0 +1,165 @@ + +// Auto generated groovyscript example file + +log 'running In-World Crafting example' + +// Burning Conversion: +// Converts an input item into an output itemstack after some number of ticks while burning. This also makes the input item +// effectively fireproof. + +// in_world_crafting.burning.removeAll() + +in_world_crafting.burning.recipeBuilder() + .input(item('minecraft:netherrack')) + .output(item('minecraft:nether_star')) + .register() + +in_world_crafting.burning.recipeBuilder() + .input(item('minecraft:gold_ingot')) + .output(item('minecraft:diamond')) + .ticks(100) + .register() + +in_world_crafting.burning.recipeBuilder() + .input(item('minecraft:diamond')) + .output(item('minecraft:clay')) + .ticks(10) + .startCondition({ stack -> stack.getItem().getCount() > 5 }) + .register() + + +// Explosion Conversion: +// Converts an input itemstack into an output itemstack, with an optional fail rate. + +// in_world_crafting.explosion.removeAll() + +in_world_crafting.explosion.recipeBuilder() + .input(item('minecraft:diamond')) + .output(item('minecraft:nether_star')) + .chance(0.4f) + .register() + +in_world_crafting.explosion.recipeBuilder() + .input(item('minecraft:gold_ingot')) + .output(item('minecraft:clay')) + .startCondition({ entityItem, itemStack -> entityItem.posY <= 60 }) + .register() + +in_world_crafting.explosion.recipeBuilder() + .input(item('minecraft:clay')) + .output(item('minecraft:diamond')) + .register() + + +// Fluid and ItemStack To Block Conversion: +// Converts any number of input itemstacks and a fluid source block into a block in-world, with each input having a chance +// to be consumed. Allows an additional closure check to start the recipe and a closure run after the recipe is finished. + +// in_world_crafting.fluid_to_block.removeByInput(fluid('water')) +// in_world_crafting.fluid_to_block.removeByInput(fluid('water'), item('minecraft:clay')) +// in_world_crafting.fluid_to_block.removeAll() + +in_world_crafting.fluid_to_block.recipeBuilder() + .fluidInput(fluid('water')) + .input(item('minecraft:clay_ball')) + .output(block('minecraft:diamond_block')) + .register() + +in_world_crafting.fluid_to_block.recipeBuilder() + .fluidInput(fluid('water')) + .input(item('minecraft:clay'), 0.5f) + .output(block('minecraft:gold_block')) + .register() + +in_world_crafting.fluid_to_block.recipeBuilder() + .fluidInput(fluid('water')) + .input(item('minecraft:diamond'), item('minecraft:iron_ingot')) + .output(block('minecraft:clay')) + .startCondition({ world, pos -> pos.getY() > 50 }) + .register() + + +// Fluid and ItemStack To Fluid Conversion: +// Converts any number of input itemstacks and a fluid source block into a fluid block in-world, with each input having a +// chance to be consumed. Allows an additional closure check to start the recipe and a closure run after the recipe is +// finished. + +// in_world_crafting.fluid_to_fluid.removeByInput(fluid('water')) +// in_world_crafting.fluid_to_fluid.removeByInput(fluid('water'), item('minecraft:clay')) +// in_world_crafting.fluid_to_fluid.removeAll() + +in_world_crafting.fluid_to_fluid.recipeBuilder() + .fluidInput(fluid('water')) + .input(item('minecraft:diamond'), item('minecraft:dirt')) + .fluidOutput(fluid('lava')) + .register() + +in_world_crafting.fluid_to_fluid.recipeBuilder() + .fluidInput(fluid('water')) + .input(item('minecraft:diamond'), item('minecraft:gold_nugget')) + .fluidOutput(fluid('lava')) + .register() + +in_world_crafting.fluid_to_fluid.recipeBuilder() + .fluidInput(fluid('water')) + .input(item('minecraft:diamond'), item('minecraft:diamond_block')) + .fluidOutput(fluid('lava')) + .startCondition({ world, pos -> pos.getY() < 50 }) + .register() + + +// Fluid and ItemStack To ItemStack Conversion: +// Converts any number of input itemstacks and a fluid source block into an itemstack in-world, with each input having a +// chance to be consumed and a chance to consume the fluid block. Allows an additional closure check to start the recipe +// and a closure run after the recipe is finished. + +// in_world_crafting.fluid_to_item.removeByInput(fluid('water')) +// in_world_crafting.fluid_to_item.removeByInput(fluid('water'), item('minecraft:clay')) +// in_world_crafting.fluid_to_item.removeAll() + +in_world_crafting.fluid_to_item.recipeBuilder() + .fluidInput(fluid('water'), 0.22f) + .input(item('minecraft:netherrack')) + .input(item('minecraft:gold_ingot'), 0.1f) + .output(item('minecraft:nether_star')) + .register() + +in_world_crafting.fluid_to_item.recipeBuilder() + .fluidInput(fluid('water')) + .fluidConsumptionChance(0.9f) + .input(item('minecraft:diamond'), item('minecraft:gold_block')) + .output(item('minecraft:diamond') * 10) + .startCondition({ world, pos -> pos.getY() > 50 }) + .register() + +in_world_crafting.fluid_to_item.recipeBuilder() + .fluidInput(fluid('water')) + .input(item('minecraft:diamond'), item('minecraft:iron_block') * 3) + .output(item('minecraft:gold_ingot')) + .afterRecipe({ world, pos -> world.setBlockState(pos, block('minecraft:dirt')) }) + .register() + + +// Piston Pushing Conversion: +// Converts an input item into an output item when a piston pushes the item into a block, with an optional minimum harvest +// level requirement for the block. Amount converted in each entity item per push is configurable. + +// in_world_crafting.piston_push.removeAll() + +in_world_crafting.piston_push.recipeBuilder() + .input(item('minecraft:gold_ingot')) + .output(item('minecraft:diamond')) + .minHarvestLevel(2) + .maxConversionsPerPush(3) + .register() + +in_world_crafting.piston_push.recipeBuilder() + .input(item('minecraft:clay')) + .output(item('minecraft:gold_ingot')) + .register() + +in_world_crafting.piston_push.recipeBuilder() + .input(item('minecraft:diamond')) + .output(item('minecraft:gold_ingot')) + .startCondition({entityItem, itemStack, pushingAgainst -> pushingAgainst.getBlock() == block('minecraft:clay') }) + .register() diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Burning.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Burning.java index bcdf7e28b..6a1805e34 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Burning.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Burning.java @@ -43,7 +43,11 @@ public void afterScriptLoad() { this.burningRecipes.sort(Comparator.comparingInt(BurningRecipe::getTicks)); } - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:netherrack')).output(item('minecraft:nether_star'))")) + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:netherrack')).output(item('minecraft:nether_star'))"), + @Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).ticks(100)"), + @Example(".input(item('minecraft:diamond')).output(item('minecraft:clay')).ticks(10).startCondition({ stack -> stack.getItem().getCount() > 5 })") + }) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Explosion.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Explosion.java index 0b7628add..8f5ac080c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Explosion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Explosion.java @@ -38,7 +38,11 @@ public Collection getRecipes() { return this.explosionRecipes; } - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond')).output(item('minecraft:nether_star')).chance(0.4f)")) + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:diamond')).output(item('minecraft:nether_star')).chance(0.4f)"), + @Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:clay')).startCondition({ entityItem, itemStack -> entityItem.posY <= 60 })"), + @Example(".input(item('minecraft:clay')).output(item('minecraft:diamond'))") + }) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java index 9563599cb..8181aaf56 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java @@ -1,5 +1,6 @@ package com.cleanroommc.groovyscript.compat.inworldcrafting; +import akka.actor.Kill; import com.cleanroommc.groovyscript.GroovyScript; import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; @@ -9,11 +10,14 @@ import com.cleanroommc.groovyscript.api.documentation.annotations.RecipeBuilderMethodDescription; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.sandbox.ClosureHelper; +import com.zeitheron.hammercore.utils.match.item.ItemContainer; import groovy.lang.Closure; import it.unimi.dsi.fastutil.floats.FloatArrayList; import it.unimi.dsi.fastutil.floats.FloatList; +import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import mezz.jei.api.ingredients.IIngredients; import net.minecraft.block.Block; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToBlock.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToBlock.java index 985dc8e37..b1fe599c8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToBlock.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToBlock.java @@ -28,11 +28,22 @@ public void onReload() { getBackupRecipes().forEach(FluidRecipe::add); } + @RecipeBuilderDescription(example = { + @Example(".fluidInput(fluid('water')).input(item('minecraft:clay_ball')).output(block('minecraft:diamond_block'))"), + @Example(".fluidInput(fluid('water')).input(item('minecraft:clay'), 0.5f).output(block('minecraft:gold_block'))"), + @Example(".fluidInput(fluid('water')).input(item('minecraft:diamond'), item('minecraft:iron_ingot')).output(block('minecraft:clay')).startCondition({ world, pos -> pos.getY() > 50 })"), + }) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.add_to_list", priority = 500) public void add(Recipe recipe) { addScripted(recipe); FluidRecipe.add(recipe); } + @MethodDescription(description = "groovyscript.wiki.remove_from_list", priority = 500) public boolean remove(Recipe recipe) { if (FluidRecipe.remove(recipe)) { addBackup(recipe); @@ -41,7 +52,7 @@ public boolean remove(Recipe recipe) { return false; } - @MethodDescription + @MethodDescription(example = @Example(value = "fluid('water')", commented = true)) public boolean removeByInput(FluidStack fluid) { if (IngredientHelper.isEmpty(fluid)) { GroovyLog.msg("Error removing in world fluid to block recipe") @@ -60,7 +71,7 @@ public boolean removeByInput(FluidStack fluid) { return true; } - @MethodDescription + @MethodDescription(example = @Example(value = "fluid('water'), item('minecraft:clay')", commented = true)) public boolean removeByInput(FluidStack fluid, ItemStack... input) { if (GroovyLog.msg("Error removing in world fluid to block recipe") .add(IngredientHelper.isEmpty(fluid), () -> "input fluid must not be empty") @@ -79,17 +90,12 @@ public boolean removeByInput(FluidStack fluid, ItemStack... input) { return true; } - @MethodDescription + @MethodDescription(priority = 2000, example = @Example(commented = true)) public boolean removeAll() { return FluidRecipe.removeIf(fluidRecipe -> fluidRecipe.getClass() == Recipe.class, fluidRecipe -> addBackup((Recipe) fluidRecipe)); } - @RecipeBuilderDescription(example = @Example(".fluidInput(fluid('water')).input(item('minecraft:clay_ball')).output(block('minecraft:diamond_block'))")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @MethodDescription + @MethodDescription(type = MethodDescription.Type.QUERY) public SimpleObjectStream streamRecipes() { return new SimpleObjectStream<>(FluidRecipe.findRecipesOfType(Recipe.class)).setRemover(this::remove); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToFluid.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToFluid.java index d46a53f8f..7b0c3acde 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToFluid.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToFluid.java @@ -26,11 +26,22 @@ public void onReload() { getBackupRecipes().forEach(FluidRecipe::add); } + @RecipeBuilderDescription(example = { + @Example(".fluidInput(fluid('water')).input(item('minecraft:diamond'), item('minecraft:dirt')).fluidOutput(fluid('lava'))"), + @Example(".fluidInput(fluid('water')).input(item('minecraft:diamond'), item('minecraft:gold_nugget')).fluidOutput(fluid('lava'))"), + @Example(".fluidInput(fluid('water')).input(item('minecraft:diamond'), item('minecraft:diamond_block')).fluidOutput(fluid('lava')).startCondition({ world, pos -> pos.getY() < 50 })"), + }) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.add_to_list", priority = 500) public void add(Recipe recipe) { addScripted(recipe); FluidRecipe.add(recipe); } + @MethodDescription(description = "groovyscript.wiki.remove_from_list", priority = 500) public boolean remove(Recipe recipe) { if (FluidRecipe.remove(recipe)) { addBackup(recipe); @@ -39,7 +50,7 @@ public boolean remove(Recipe recipe) { return false; } - @MethodDescription + @MethodDescription(example = @Example(value = "fluid('water')", commented = true)) public boolean removeByInput(FluidStack fluid) { if (IngredientHelper.isEmpty(fluid)) { GroovyLog.msg("Error removing in world fluid to fluid recipe") @@ -58,7 +69,7 @@ public boolean removeByInput(FluidStack fluid) { return true; } - @MethodDescription + @MethodDescription(example = @Example(value = "fluid('water'), item('minecraft:clay')", commented = true)) public boolean removeByInput(FluidStack fluid, ItemStack... input) { if (GroovyLog.msg("Error removing in world fluid to fluid recipe") .add(IngredientHelper.isEmpty(fluid), () -> "input fluid must not be empty") @@ -77,17 +88,12 @@ public boolean removeByInput(FluidStack fluid, ItemStack... input) { return true; } - @MethodDescription + @MethodDescription(priority = 2000, example = @Example(commented = true)) public boolean removeAll() { return FluidRecipe.removeIf(fluidRecipe -> fluidRecipe.getClass() == Recipe.class, fluidRecipe -> addBackup((Recipe) fluidRecipe)); } - @RecipeBuilderDescription(example = @Example(".fluidInput(fluid('water')).input(item('minecraft:diamond') * 2).fluidOutput(fluid('lava'))")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @MethodDescription + @MethodDescription(type = MethodDescription.Type.QUERY) public SimpleObjectStream streamRecipes() { return new SimpleObjectStream<>(FluidRecipe.findRecipesOfType(Recipe.class)).setRemover(this::remove); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java index 0e10a4c61..3917d4ee3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java @@ -28,11 +28,22 @@ public void onReload() { getBackupRecipes().forEach(FluidRecipe::add); } + @RecipeBuilderDescription(example = { + @Example(".fluidInput(fluid('water'), 0.22f).input(item('minecraft:netherrack')).input(item('minecraft:gold_ingot'), 0.1f).output(item('minecraft:nether_star'))"), + @Example(".fluidInput(fluid('water')).fluidConsumptionChance(0.9f).input(item('minecraft:diamond'), item('minecraft:gold_block')).output(item('minecraft:diamond') * 10).startCondition({ world, pos -> pos.getY() > 50 })"), + @Example(".fluidInput(fluid('water')).input(item('minecraft:diamond'), item('minecraft:iron_block') * 3).output(item('minecraft:gold_ingot')).afterRecipe({ world, pos -> world.setBlockState(pos, block('minecraft:dirt')) })"), + }) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.add_to_list", priority = 500) public void add(Recipe recipe) { addScripted(recipe); FluidRecipe.add(recipe); } + @MethodDescription(description = "groovyscript.wiki.remove_from_list", priority = 500) public boolean remove(Recipe recipe) { if (FluidRecipe.remove(recipe)) { addBackup(recipe); @@ -41,7 +52,7 @@ public boolean remove(Recipe recipe) { return false; } - @MethodDescription + @MethodDescription(example = @Example(value = "fluid('water')", commented = true)) public boolean removeByInput(FluidStack fluid) { if (IngredientHelper.isEmpty(fluid)) { GroovyLog.msg("Error removing in world fluid to item recipe") @@ -60,7 +71,7 @@ public boolean removeByInput(FluidStack fluid) { return true; } - @MethodDescription + @MethodDescription(example = @Example(value = "fluid('water'), item('minecraft:clay')", commented = true)) public boolean removeByInput(FluidStack fluid, ItemStack... input) { if (GroovyLog.msg("Error removing in world fluid to item recipe") .add(IngredientHelper.isEmpty(fluid), () -> "input fluid must not be empty") @@ -79,17 +90,12 @@ public boolean removeByInput(FluidStack fluid, ItemStack... input) { return true; } - @MethodDescription + @MethodDescription(priority = 2000, example = @Example(commented = true)) public boolean removeAll() { return FluidRecipe.removeIf(fluidRecipe -> fluidRecipe.getClass() == Recipe.class, fluidRecipe -> addBackup((Recipe) fluidRecipe)); } - @RecipeBuilderDescription(example = @Example(".fluidInput(fluid('water'), 0.22f).input(item('minecraft:netherrack')).input(item('minecraft:gold_ingot'), 0.1f).output(item('minecraft:nether_star'))")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @MethodDescription + @MethodDescription(type = MethodDescription.Type.QUERY) public SimpleObjectStream streamRecipes() { return new SimpleObjectStream<>(FluidRecipe.findRecipesOfType(Recipe.class)).setRemover(this::remove); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java index 0227ac156..a85ec98cd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java @@ -39,7 +39,11 @@ public Collection getRecipes() { return this.pistonPushRecipes; } - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).minHarvestLevel(2).maxConversionsPerPush(3)")) + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).minHarvestLevel(2).maxConversionsPerPush(3)"), + @Example(".input(item('minecraft:clay')).output(item('minecraft:gold_ingot'))"), + @Example(".input(item('minecraft:diamond')).output(item('minecraft:gold_ingot')).startCondition({entityItem, itemStack, pushingAgainst -> pushingAgainst.getBlock() == block('minecraft:clay') })"), + }) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } From 65271d2a402425db08014b19cd0c07fb232acb60 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 17 Oct 2025 15:45:18 -0700 Subject: [PATCH 53/92] add header control to markdown sections --- .../documentation/helper/MarkdownSection.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java index c05186b28..ba91c1480 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java @@ -1,6 +1,7 @@ package com.cleanroommc.groovyscript.documentation.helper; import com.google.common.collect.ComparisonChain; +import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -68,7 +69,17 @@ public List getEntries() { } public String get() { - return "## " + header + "\n\n" + subtitle.apply(entries.size()) + "\n\n" + String.join("\n\n", entries); + return get(2); + } + + public String get(int headerLevel) { + var sb = new StringBuilder(); + sb.append(StringUtils.repeat('#', headerLevel)); + sb.append(" ").append(header).append("\n\n"); + var sub = subtitle.apply(entries.size()); + if (!sub.isEmpty()) sb.append(sub).append("\n\n"); + entries.forEach(entry -> sb.append(entry).append("\n\n")); + return sb.toString(); } @Override From 6e8bf5986e59b69a652b1ebb7a2bc6c7fc2487ae Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 17 Oct 2025 15:48:08 -0700 Subject: [PATCH 54/92] rename subtitle to comment --- .../documentation/helper/MarkdownSection.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java index ba91c1480..298e08b55 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java @@ -12,7 +12,8 @@ * This is used to create markdown sections on the wiki index page. *

* Contains a header (which will be formatted as h2), - * a subtitle, and some number of entries. + * an optional normal text comment below it, and some number of entries. + * The comment is a function that can be formatted based on the number of entries. *

* It will only be added to the index file if there is * at least one entry to display, @@ -25,29 +26,29 @@ public class MarkdownSection implements Comparable { public static final int DEFAULT_PRIORITY = 1000; private final String header; - private final IntFunction subtitle; + private final IntFunction comment; private final List entries; private final int priority; /** * Calls {@link #MarkdownSection(String, IntFunction, int)} with a priority of {@link MarkdownSection#DEFAULT_PRIORITY}. * - * @param header the header text of the section - * @param subtitle function that creates the subtitle based on the number of entries + * @param header the header text of the section + * @param comment function that creates the comment based on the number of entries * @see #MarkdownSection(String, IntFunction, int) Section */ - public MarkdownSection(String header, IntFunction subtitle) { - this(header, subtitle, DEFAULT_PRIORITY); + public MarkdownSection(String header, IntFunction comment) { + this(header, comment, DEFAULT_PRIORITY); } /** * @param header the header text of the section - * @param subtitle function that creates the subtitle based on the number of entries + * @param comment function that creates the comment based on the number of entries * @param priority the priority this Section has on the index page for sorting purposes */ - public MarkdownSection(String header, IntFunction subtitle, int priority) { + public MarkdownSection(String header, IntFunction comment, int priority) { this.header = header; - this.subtitle = subtitle; + this.comment = comment; this.entries = new ArrayList<>(); this.priority = priority; @@ -76,7 +77,7 @@ public String get(int headerLevel) { var sb = new StringBuilder(); sb.append(StringUtils.repeat('#', headerLevel)); sb.append(" ").append(header).append("\n\n"); - var sub = subtitle.apply(entries.size()); + var sub = comment.apply(entries.size()); if (!sub.isEmpty()) sb.append(sub).append("\n\n"); entries.forEach(entry -> sb.append(entry).append("\n\n")); return sb.toString(); From 674bf7f6d4c4ac7f24285a364935947f03beb843 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 17 Oct 2025 15:49:34 -0700 Subject: [PATCH 55/92] note header level --- .../groovyscript/documentation/helper/MarkdownSection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java index 298e08b55..db71b7235 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java @@ -11,7 +11,7 @@ /** * This is used to create markdown sections on the wiki index page. *

- * Contains a header (which will be formatted as h2), + * Contains a header (which will be formatted as h2 via {@link #get()}, but can be configured {@link #get(int)}), * an optional normal text comment below it, and some number of entries. * The comment is a function that can be formatted based on the number of entries. *

From 3b53cca9fbf586430ab76da07e7bed85f002877f Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 17 Oct 2025 15:50:07 -0700 Subject: [PATCH 56/92] remove random unused imports --- .../groovyscript/compat/inworldcrafting/FluidRecipe.java | 3 --- .../groovyscript/compat/inworldcrafting/InWorldCrafting.java | 1 - 2 files changed, 4 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java index 8181aaf56..9d5e29bb3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java @@ -1,6 +1,5 @@ package com.cleanroommc.groovyscript.compat.inworldcrafting; -import akka.actor.Kill; import com.cleanroommc.groovyscript.GroovyScript; import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; @@ -14,10 +13,8 @@ import groovy.lang.Closure; import it.unimi.dsi.fastutil.floats.FloatArrayList; import it.unimi.dsi.fastutil.floats.FloatList; -import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import mezz.jei.api.ingredients.IIngredients; import net.minecraft.block.Block; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java index 74f9f2d8e..384cbfc32 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java @@ -13,7 +13,6 @@ import com.cleanroommc.groovyscript.helper.Alias; import com.cleanroommc.groovyscript.sandbox.LoadStage; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; From 1e9e8591e256c19449b2b5d60cf2211739acb093 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 23 Nov 2025 14:31:00 -0800 Subject: [PATCH 57/92] reduce some code complexity --- .../compat/inworldcrafting/InWorldCrafting.java | 2 +- .../groovyscript/compat/mods/MinecraftModContainer.java | 2 +- .../documentation/helper/ContainerHolder.java | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java index 384cbfc32..401ead796 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/InWorldCrafting.java @@ -84,7 +84,7 @@ private ContainerHolder getContainerHolder() { list.add(ContainerHolder.BASE_ACCESS_COMPAT + "." + minecraftAlias + "." + alias); } } - return new ContainerHolder(LOCATION, NAME, LOCATION, importBlock -> importBlock + "\nlog 'running In-World Crafting example'", list, getRegistries()); + return ContainerHolder.of(LOCATION, NAME, LOCATION, "running In-World Crafting example", list, getRegistries()); } @Override diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java index f2a4782aa..a5ac27914 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java @@ -64,7 +64,7 @@ public void onCompatLoaded(GroovyContainer container) {} private ContainerHolder getContainer() { var aliases = ContainerHolder.expandAliases(getAliases()); aliases.addAll(getAliases()); - return new ContainerHolder(getModId(), "Vanilla Registries", getModId(), importBlock -> importBlock + "\nlog 'running Vanilla Minecraft example'", aliases, get().getRegistries()); + return ContainerHolder.of(getModId(), getContainerName(), getModId(), "running Vanilla Minecraft example", aliases, get().getRegistries()); } @Override diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java index de8b42667..304ec21c5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java @@ -33,6 +33,15 @@ public record ContainerHolder(String id, String name, String access, Function aliases, + Collection registries) { + return new ContainerHolder(id, name, access, importBlock -> importBlock + "%nlog '" + log + "'", aliases, registries); + } + public static ContainerHolder of(GroovyContainer mod) { return of(mod, mod.get().getRegistries()); } From fa5c2baa4a921175bccf1e4c6017549d8a0631ab Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 23 Nov 2025 15:36:38 -0800 Subject: [PATCH 58/92] document containerholder better --- .../documentation/helper/ContainerHolder.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java index 304ec21c5..76a9fa286 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java @@ -13,11 +13,11 @@ /** * Holds data for the container being documented. - * Has two helper initialization methods. + * Has three helper initialization methods. * * @param id the container id * @param name the name of the container - * @param access the default method to access the container + * @param access the default method to access the container, often {@code mod.{id}} * @param header a function that takes the import block to allow adding text before and/or after it * @param aliases all aliases the container has * @param registries all registries the container has @@ -33,6 +33,14 @@ public record ContainerHolder(String id, String name, String access, Function importBlock + "%nlog '" + log + "'", aliases, registries); } + /** + * @param mod the groovy container, which represents a mod. + */ public static ContainerHolder of(GroovyContainer mod) { return of(mod, mod.get().getRegistries()); } + /** + * @param container the container information + * @param registries all registries for that container + */ public static ContainerHolder of(IGroovyContainer container, Collection registries) { return new ContainerHolder( container.getModId(), From fbf869ae67c339a95a670b9ddc34906c9dfd9633 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 23 Nov 2025 15:37:23 -0800 Subject: [PATCH 59/92] add LangHelper.fallback --- .../groovyscript/documentation/Builder.java | 14 ++++++------- .../groovyscript/documentation/Registry.java | 9 ++++---- .../documentation/helper/LangHelper.java | 21 +++++++++++++++++++ 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java index 7929ec102..709b6f00d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java @@ -357,12 +357,11 @@ public boolean hasComplexMethod() { private String title() { String lang = annotation.title(); - String registryDefault = String.format("%s.%s.title", langLocation, builderMethod.getName()); - String globalDefault = String.format("%s.recipe_builder.title", Registry.BASE_LANG_LOCATION); if (lang.isEmpty()) { - if (I18n.hasKey(registryDefault)) lang = registryDefault; - else lang = globalDefault; + lang = LangHelper.fallback( + String.format("%s.%s.title", langLocation, builderMethod.getName()), + String.format("%s.recipe_builder.title", Registry.BASE_LANG_LOCATION)); } return LangHelper.translate(lang); @@ -371,13 +370,12 @@ private String title() { public String creationMethod() { StringBuilder out = new StringBuilder(); String lang = annotation.description(); - String registryDefault = String.format("%s.%s.description", langLocation, builderMethod.getName()); - String globalDefault = String.format("%s.recipe_builder.description", Registry.BASE_LANG_LOCATION); if (lang.isEmpty()) { // If the method is complex, we want to require defining the key via the annotation or as the registryDefault. - if (I18n.hasKey(registryDefault) || hasComplexMethod()) lang = registryDefault; - else lang = globalDefault; + String registryDefault = String.format("%s.%s.description", langLocation, builderMethod.getName()); + if (hasComplexMethod()) lang = registryDefault; + else lang = LangHelper.fallback(registryDefault, String.format("%s.recipe_builder.description", Registry.BASE_LANG_LOCATION)); } var example = location + "." + DescriptorHelper.shortSignature(builderMethod); diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 0846c58cf..42b623bd1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -371,12 +371,11 @@ public String documentMethods(List> methods, public String methodDescription(MethodAnnotation method) { String lang = method.annotation().description(); - String registryDefault = String.format("%s.%s", getBaseLangKey(), method.method().getName()); - String globalDefault = String.format("%s.%s", Registry.BASE_LANG_LOCATION, method.method().getName()); if (lang.isEmpty()) { - // If the `globalDefault` is not defined, we always want to use `registryDefault` for logging the missing key. - if (I18n.hasKey(registryDefault) || !I18n.hasKey(globalDefault)) lang = registryDefault; - else lang = globalDefault; + lang = LangHelper.fallback( + 0, + String.format("%s.%s", getBaseLangKey(), method.method().getName()), + String.format("%s.%s", Registry.BASE_LANG_LOCATION, method.method().getName())); } return String.format( diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LangHelper.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LangHelper.java index 28027a110..4f848e997 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LangHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LangHelper.java @@ -31,6 +31,27 @@ public static void logAnyMissingKeys() { MISSING_LANG_KEYS.clear(); } + /** + * @param keys a list of strings to check if they are lang keys + * @return the first key that is a lang key, or if none match the last key passed in + * @see #fallback(int, String...) + */ + public static String fallback(String... keys) { + return fallback(keys.length - 1, keys); + } + + /** + * @param fallbackIndex the fallback position if no key matches + * @param keys a list of strings to check if they are lang keys + * @return the first key that is a lang key, or if none match the key in the {@code fallbackIndex} position + */ + public static String fallback(int fallbackIndex, String... keys) { + for (var key : keys) { + if (I18n.hasKey(key)) return key; + } + return keys[fallbackIndex]; + } + public static String translate(String translateKey, Object... parameters) { if (GenerationFlags.LOG_MISSING_LANG_KEYS && !I18n.hasKey(translateKey)) { MISSING_LANG_KEYS.add(translateKey); From 442e10f6fb468007fd164b22168966fd13076792 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 23 Nov 2025 15:39:04 -0800 Subject: [PATCH 60/92] replace all headers with MarkdownSection --- .../groovyscript/documentation/Exporter.java | 7 ++- .../groovyscript/documentation/Registry.java | 63 +++++++++---------- .../documentation/helper/LinkIndex.java | 5 -- .../documentation/helper/MarkdownSection.java | 48 +++++++++++--- .../assets/groovyscript/lang/en_us.lang | 3 + 5 files changed, 77 insertions(+), 49 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index 49632e5a3..38ff54c1d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -8,6 +8,7 @@ import com.cleanroommc.groovyscript.documentation.helper.ComparisonHelper; import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; import com.cleanroommc.groovyscript.documentation.helper.LinkIndex; +import com.cleanroommc.groovyscript.documentation.helper.MarkdownSection; import com.cleanroommc.groovyscript.sandbox.LoadStage; import com.google.common.collect.ImmutableSet; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; @@ -29,14 +30,14 @@ public class Exporter { private static final String INDEX_FILE_NAME = "index" + MARKDOWN_FILE_EXTENSION; private static final String NAV_FILE_NAME = "!navigation" + MARKDOWN_FILE_EXTENSION; private static final String EXAMPLE_GENERATION_NOTE = "// Auto generated groovyscript example file\n"; - private static final String INDEX_FILE_TEXT = "---\n%s\n---\n\n\n# %s\n\n%s\n\n"; + private static final String INDEX_FILE_TEXT = "---\n%s\n---\n\n\n%s%s\n\n"; private static final String BULLET_POINT_LINK = "* [%s](./%s)"; private static final String NAVIGATION_FILE_TEXT = "---\nsearch:\n exclude: true\n---\n\n\n" + BULLET_POINT_LINK + "\n%s"; private static final Map> SKIPPED_CLASSES = new Object2ObjectOpenHashMap<>(); public static void generateWiki(File targetFolder, ContainerHolder container) { - var linkIndex = new LinkIndex(); + var linkIndex = new LinkIndex(MarkdownSection.fromContainer(container)); var registries = getRegistries(container, x -> x.skipDefaultWiki(container)); @@ -49,7 +50,7 @@ public static void generateWiki(File targetFolder, ContainerHolder container) { registry.generateWiki(container, targetFolder, linkIndex); } - String indexText = String.format(INDEX_FILE_TEXT, Documentation.DEFAULT_FORMAT.removeTableOfContentsText(), container.name(), linkIndex.get()); + String indexText = String.format(INDEX_FILE_TEXT, Documentation.DEFAULT_FORMAT.removeTableOfContentsText(), MarkdownSection.containerIndex(container).get(1), linkIndex.get()); write(new File(targetFolder, INDEX_FILE_NAME), indexText); if (Documentation.DEFAULT_FORMAT.requiresNavFile()) { diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 42b623bd1..5b9d5eba6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -214,26 +214,23 @@ private String generateHeader() { } private String generateTitle() { - return String.format("# %s (%s)\n\n", getTitle(), container.name()); + return new MarkdownSection(getTitle() + " " + container.name()).get(1); } private String generateDescription() { - StringBuilder out = new StringBuilder(); - out.append("## ").append(I18n.format("groovyscript.wiki.description")).append("\n\n"); - out.append(getDescription()).append("\n\n"); + var md = new MarkdownSection(I18n.format("groovyscript.wiki.description"), getDescription()); if (!description.isFullyDocumented()) { - out.append( + md.addEntry( new AdmonitionBuilder() .type(Admonition.Type.WARNING) .note(I18n.format("groovyscript.wiki.not_fully_documented")) .generate()); - out.append("\n\n"); } Admonition[] admonition = description.admonition(); for (Admonition note : admonition) { - out.append( + md.addEntry( new AdmonitionBuilder() .type(note.type()) .title(note.title()) @@ -241,15 +238,12 @@ private String generateDescription() { .format(note.format()) .note(LangHelper.ensurePeriod(LangHelper.translate(note.value()))) .generate()); - out.append("\n\n"); } - return out.toString(); + return md.get(); } private String generateIdentifier() { - StringBuilder out = new StringBuilder(); - out.append("## ").append(I18n.format("groovyscript.wiki.identifier")).append("\n\n"); - out.append(I18n.format("groovyscript.wiki.import_default", getReference())).append("\n\n"); + var md = new MarkdownSection(I18n.format("groovyscript.wiki.identifier"), I18n.format("groovyscript.wiki.import_default", getReference())); List packages = getAliases(); @@ -275,28 +269,21 @@ private String generateIdentifier() { .note("\n") .type(Admonition.Type.QUOTE); if (packages.size() >= TOO_MANY_PACKAGES) admonition.format(Admonition.Format.COLLAPSED); - out.append(admonition.generate()).append("\n\n"); + md.addEntry(admonition.generate()); } - return out.toString(); + return md.get(); } private String recipeBuilder() { - StringBuilder out = new StringBuilder(); + var md = new MarkdownSection(I18n.format("groovyscript.wiki.recipe_builder")); + + md.addEntry(I18n.format("groovyscript.wiki.uses_recipe_builder", getTitle())); + md.addEntry(I18n.format("groovyscript.wiki.recipe_builder_note", Documentation.DEFAULT_FORMAT.linkToBuilder())); - out.append("### ") - .append(I18n.format("groovyscript.wiki.recipe_builder")) - .append("\n\n") - .append(I18n.format("groovyscript.wiki.uses_recipe_builder", getTitle())) - .append("\n\n") - .append(I18n.format("groovyscript.wiki.recipe_builder_note", Documentation.DEFAULT_FORMAT.linkToBuilder())) - .append("\n\n"); - - int size = recipeBuilders.size(); - for (int i = 0; i < size; i++) { - out.append(recipeBuilders.get(i).generateAdmonition()); - if (i < size - 1) out.append("\n\n"); + for (Builder recipeBuilder : recipeBuilders) { + md.addEntry(recipeBuilder.generateAdmonition()); } - return out.toString(); + return md.get(3); } public String documentationBlock() { @@ -308,10 +295,10 @@ public String documentationBlock() { out.append(generateIdentifier()); if (!methods.get(MethodDescription.Type.VALUE).isEmpty()) { - out.append("## ").append(I18n.format("groovyscript.wiki.editing_values")).append("\n\n").append(documentMethods(methods.get(MethodDescription.Type.VALUE))).append("\n"); + out.append(documentMethods(I18n.format("groovyscript.wiki.editing_values"), MethodDescription.Type.VALUE)); } if (!methods.get(MethodDescription.Type.ADDITION).isEmpty() || !recipeBuilders.isEmpty()) { - out.append("## ").append(LangHelper.translate(description.category().adding())).append("\n\n"); + out.append(new MarkdownSection(LangHelper.translate(description.category().adding())).get()); if (!methods.get(MethodDescription.Type.ADDITION).isEmpty()) { out.append(documentMethods(methods.get(MethodDescription.Type.ADDITION))).append("\n"); } @@ -320,16 +307,28 @@ public String documentationBlock() { } } if (!methods.get(MethodDescription.Type.REMOVAL).isEmpty()) { - out.append("## ").append(LangHelper.translate(description.category().removing())).append("\n\n").append(documentMethods(methods.get(MethodDescription.Type.REMOVAL))).append("\n"); + out.append(documentMethods(LangHelper.translate(description.category().removing()), MethodDescription.Type.REMOVAL)); } if (!methods.get(MethodDescription.Type.QUERY).isEmpty()) { - out.append("## ").append(LangHelper.translate(description.category().query())).append("\n\n").append(documentMethods(methods.get(MethodDescription.Type.QUERY), true)).append("\n"); + out.append(documentMethods(LangHelper.translate(description.category().query()), MethodDescription.Type.QUERY)); } out.append("\n"); return out.toString(); } + public String documentMethods(String header, MethodDescription.Type type) { + Set describedMethods = new ObjectOpenHashSet<>(); + var md = new MarkdownSection(header); + for (var method : methods.get(type)) { + // only add the method description if it is the first for the targeted method + if (describedMethods.add(method.method())) { + md.addEntry(methodDescription(method)); + } + } + return md.get(); + } + public String documentMethods(List> methods) { return documentMethods(methods, false); } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java index 6c0db7137..222eab3fa 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java @@ -1,6 +1,5 @@ package com.cleanroommc.groovyscript.documentation.helper; -import net.minecraft.client.resources.I18n; import java.util.Collection; import java.util.HashMap; @@ -23,10 +22,6 @@ public class LinkIndex { private final Map sections = new HashMap<>(); - public LinkIndex() { - this(new MarkdownSection(I18n.format("groovyscript.wiki.categories"), count -> I18n.format("groovyscript.wiki.subcategories_count", count))); - } - public LinkIndex(MarkdownSection primary) { register(PRIMARY_SECTION, primary); } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java index db71b7235..718dbab8c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java @@ -1,12 +1,13 @@ package com.cleanroommc.groovyscript.documentation.helper; import com.google.common.collect.ComparisonChain; +import net.minecraft.client.resources.I18n; import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; -import java.util.function.IntFunction; +import java.util.function.Function; /** * This is used to create markdown sections on the wiki index page. @@ -26,18 +27,30 @@ public class MarkdownSection implements Comparable { public static final int DEFAULT_PRIORITY = 1000; private final String header; - private final IntFunction comment; + private final Function comment; private final List entries; private final int priority; /** - * Calls {@link #MarkdownSection(String, IntFunction, int)} with a priority of {@link MarkdownSection#DEFAULT_PRIORITY}. + * @param header the header text of the section + * @see #MarkdownSection(String, Function, int) Section + */ + public MarkdownSection(String header) { + this(header, null, DEFAULT_PRIORITY); + } + + public MarkdownSection(String header, String comment) { + this(header, x -> comment, DEFAULT_PRIORITY); + } + + /** + * Calls {@link #MarkdownSection(String, Function, int)} with a priority of {@link MarkdownSection#DEFAULT_PRIORITY}. * * @param header the header text of the section * @param comment function that creates the comment based on the number of entries - * @see #MarkdownSection(String, IntFunction, int) Section + * @see #MarkdownSection(String, Function, int) Section */ - public MarkdownSection(String header, IntFunction comment) { + public MarkdownSection(String header, Function comment) { this(header, comment, DEFAULT_PRIORITY); } @@ -46,12 +59,27 @@ public MarkdownSection(String header, IntFunction comment) { * @param comment function that creates the comment based on the number of entries * @param priority the priority this Section has on the index page for sorting purposes */ - public MarkdownSection(String header, IntFunction comment, int priority) { + public MarkdownSection(String header, Function comment, int priority) { this.header = header; this.comment = comment; this.entries = new ArrayList<>(); this.priority = priority; + } + + public static MarkdownSection containerIndex(ContainerHolder container) { + var header = LangHelper.fallback(String.format("groovyscript.wiki.%s.index.title", container.id()), container.name()); + var comment = LangHelper.fallback(String.format("groovyscript.wiki.%s.index.description", container.id()), null); + return new MarkdownSection(I18n.format(header), comment == null ? null : md -> I18n.format(comment, md.entries.size())); + } + + public static MarkdownSection fromContainer(ContainerHolder container) { + var header = LangHelper.fallback(String.format("groovyscript.wiki.%s.index.subtitle", container.id()), "groovyscript.wiki.categories"); + var comment = LangHelper.fallback(String.format("groovyscript.wiki.%s.index.subtitle.comment", container.id()), "groovyscript.wiki.subcategories_count"); + return fromI18n(header, comment); + } + public static MarkdownSection fromI18n(String header, String comment) { + return new MarkdownSection(I18n.format(header), md -> I18n.format(comment, md.entries.size())); } /** @@ -76,9 +104,11 @@ public String get() { public String get(int headerLevel) { var sb = new StringBuilder(); sb.append(StringUtils.repeat('#', headerLevel)); - sb.append(" ").append(header).append("\n\n"); - var sub = comment.apply(entries.size()); - if (!sub.isEmpty()) sb.append(sub).append("\n\n"); + sb.append(' ').append(header).append("\n\n"); + if (comment != null) { + var sub = comment.apply(this); + if (!sub.isEmpty()) sb.append(sub).append("\n\n"); + } entries.forEach(entry -> sb.append(entry).append("\n\n")); return sb.toString(); } diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index 9d38bd4ac..bdb6f2989 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -134,6 +134,9 @@ groovyscript.wiki.and=and # Vanilla Minecraft +groovyscript.wiki.minecraft.index.title=Vanilla Minecraft Registries +groovyscript.wiki.minecraft.index.description=This is where GroovyScript handles compatibility with Vanilla Minecraft.%n%nSome documentation is not complete - particularly loot compat. To learn more, view the [example page](https://github.com/CleanroomMC/GroovyScript/blob/master/examples/postInit/custom/loottables.groovy). + groovyscript.wiki.minecraft.crafting.title=Crafting Table groovyscript.wiki.minecraft.crafting.description=A normal crafting recipe that takes place in the Vanilla Crafting Table, converting up to 9 items in a shapeless or specific shaped arrangement into an output itemstack. groovyscript.wiki.minecraft.crafting.note0=While shorthand methods to create recipes have been supplied, it is far easier to use the recipe builder. From 8528b8f9f1b80f0a7f1fca5a612d719508b1113b Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 23 Nov 2025 15:43:31 -0800 Subject: [PATCH 61/92] rename to Heading --- .../documentation/IRegistryDocumentation.java | 6 +- .../groovyscript/documentation/Exporter.java | 6 +- .../groovyscript/documentation/Registry.java | 12 ++-- .../{MarkdownSection.java => Heading.java} | 58 +++++++++---------- .../documentation/helper/LinkIndex.java | 24 ++++---- 5 files changed, 53 insertions(+), 53 deletions(-) rename src/main/java/com/cleanroommc/groovyscript/documentation/helper/{MarkdownSection.java => Heading.java} (59%) diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java index 77edc2548..221cf95fb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java @@ -2,8 +2,8 @@ import com.cleanroommc.groovyscript.api.INamed; import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; +import com.cleanroommc.groovyscript.documentation.helper.Heading; import com.cleanroommc.groovyscript.documentation.helper.LinkIndex; -import com.cleanroommc.groovyscript.documentation.helper.MarkdownSection; import com.cleanroommc.groovyscript.sandbox.LoadStage; import org.jetbrains.annotations.NotNull; @@ -29,14 +29,14 @@ public interface IRegistryDocumentation extends INamed { *

* In most situations simply adding it to the default section via {@link LinkIndex#add(String)} * suffices, but for certain reasons a separate section may be desired. - * If so, the section must be created via {@link LinkIndex#register(String, MarkdownSection)} + * If so, the section must be created via {@link LinkIndex#register(String, Heading)} * and can then be added to directly {@link LinkIndex#add(String, String)}. * * @param container the container the registry is part of * @param suggestedFolder the suggested folder for the wiki files to be generated within. * This is only a suggestion, and can be ignored * @param linkIndex each category will generate a header, description, and some number of entries for the index page - * @see MarkdownSection + * @see Heading * @see LinkIndex * @see com.cleanroommc.groovyscript.documentation.Exporter#writeNormalWikiFile */ diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index 38ff54c1d..1bcd741ee 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -7,8 +7,8 @@ import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.documentation.helper.ComparisonHelper; import com.cleanroommc.groovyscript.documentation.helper.ContainerHolder; +import com.cleanroommc.groovyscript.documentation.helper.Heading; import com.cleanroommc.groovyscript.documentation.helper.LinkIndex; -import com.cleanroommc.groovyscript.documentation.helper.MarkdownSection; import com.cleanroommc.groovyscript.sandbox.LoadStage; import com.google.common.collect.ImmutableSet; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; @@ -37,7 +37,7 @@ public class Exporter { private static final Map> SKIPPED_CLASSES = new Object2ObjectOpenHashMap<>(); public static void generateWiki(File targetFolder, ContainerHolder container) { - var linkIndex = new LinkIndex(MarkdownSection.fromContainer(container)); + var linkIndex = new LinkIndex(Heading.fromContainer(container)); var registries = getRegistries(container, x -> x.skipDefaultWiki(container)); @@ -50,7 +50,7 @@ public static void generateWiki(File targetFolder, ContainerHolder container) { registry.generateWiki(container, targetFolder, linkIndex); } - String indexText = String.format(INDEX_FILE_TEXT, Documentation.DEFAULT_FORMAT.removeTableOfContentsText(), MarkdownSection.containerIndex(container).get(1), linkIndex.get()); + String indexText = String.format(INDEX_FILE_TEXT, Documentation.DEFAULT_FORMAT.removeTableOfContentsText(), Heading.containerIndex(container).get(1), linkIndex.get()); write(new File(targetFolder, INDEX_FILE_NAME), indexText); if (Documentation.DEFAULT_FORMAT.requiresNavFile()) { diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 5b9d5eba6..381f6aad6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -214,11 +214,11 @@ private String generateHeader() { } private String generateTitle() { - return new MarkdownSection(getTitle() + " " + container.name()).get(1); + return new Heading(getTitle() + " " + container.name()).get(1); } private String generateDescription() { - var md = new MarkdownSection(I18n.format("groovyscript.wiki.description"), getDescription()); + var md = new Heading(I18n.format("groovyscript.wiki.description"), getDescription()); if (!description.isFullyDocumented()) { md.addEntry( @@ -243,7 +243,7 @@ private String generateDescription() { } private String generateIdentifier() { - var md = new MarkdownSection(I18n.format("groovyscript.wiki.identifier"), I18n.format("groovyscript.wiki.import_default", getReference())); + var md = new Heading(I18n.format("groovyscript.wiki.identifier"), I18n.format("groovyscript.wiki.import_default", getReference())); List packages = getAliases(); @@ -275,7 +275,7 @@ private String generateIdentifier() { } private String recipeBuilder() { - var md = new MarkdownSection(I18n.format("groovyscript.wiki.recipe_builder")); + var md = new Heading(I18n.format("groovyscript.wiki.recipe_builder")); md.addEntry(I18n.format("groovyscript.wiki.uses_recipe_builder", getTitle())); md.addEntry(I18n.format("groovyscript.wiki.recipe_builder_note", Documentation.DEFAULT_FORMAT.linkToBuilder())); @@ -298,7 +298,7 @@ public String documentationBlock() { out.append(documentMethods(I18n.format("groovyscript.wiki.editing_values"), MethodDescription.Type.VALUE)); } if (!methods.get(MethodDescription.Type.ADDITION).isEmpty() || !recipeBuilders.isEmpty()) { - out.append(new MarkdownSection(LangHelper.translate(description.category().adding())).get()); + out.append(new Heading(LangHelper.translate(description.category().adding())).get()); if (!methods.get(MethodDescription.Type.ADDITION).isEmpty()) { out.append(documentMethods(methods.get(MethodDescription.Type.ADDITION))).append("\n"); } @@ -319,7 +319,7 @@ public String documentationBlock() { public String documentMethods(String header, MethodDescription.Type type) { Set describedMethods = new ObjectOpenHashSet<>(); - var md = new MarkdownSection(header); + var md = new Heading(header); for (var method : methods.get(type)) { // only add the method description if it is the first for the targeted method if (describedMethods.add(method.method())) { diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java similarity index 59% rename from src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java rename to src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java index 718dbab8c..4cb65681d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/MarkdownSection.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java @@ -10,9 +10,9 @@ import java.util.function.Function; /** - * This is used to create markdown sections on the wiki index page. + * This is used to create headings on the wiki index page. *

- * Contains a header (which will be formatted as h2 via {@link #get()}, but can be configured {@link #get(int)}), + * Contains header text (which will be formatted as h2 via {@link #get()}, but can be configured {@link #get(int)}), * an optional normal text comment below it, and some number of entries. * The comment is a function that can be formatted based on the number of entries. *

@@ -22,64 +22,64 @@ * * @see LinkIndex */ -public class MarkdownSection implements Comparable { +public class Heading implements Comparable { public static final int DEFAULT_PRIORITY = 1000; - private final String header; - private final Function comment; + private final String text; + private final Function comment; private final List entries; private final int priority; /** - * @param header the header text of the section - * @see #MarkdownSection(String, Function, int) Section + * @param text the header text of the section + * @see #Heading(String, Function, int) Section */ - public MarkdownSection(String header) { - this(header, null, DEFAULT_PRIORITY); + public Heading(String text) { + this(text, null, DEFAULT_PRIORITY); } - public MarkdownSection(String header, String comment) { - this(header, x -> comment, DEFAULT_PRIORITY); + public Heading(String text, String comment) { + this(text, x -> comment, DEFAULT_PRIORITY); } /** - * Calls {@link #MarkdownSection(String, Function, int)} with a priority of {@link MarkdownSection#DEFAULT_PRIORITY}. + * Calls {@link #Heading(String, Function, int)} with a priority of {@link Heading#DEFAULT_PRIORITY}. * - * @param header the header text of the section + * @param text the header text of the section * @param comment function that creates the comment based on the number of entries - * @see #MarkdownSection(String, Function, int) Section + * @see #Heading(String, Function, int) Section */ - public MarkdownSection(String header, Function comment) { - this(header, comment, DEFAULT_PRIORITY); + public Heading(String text, Function comment) { + this(text, comment, DEFAULT_PRIORITY); } /** - * @param header the header text of the section + * @param text the header text of the section * @param comment function that creates the comment based on the number of entries * @param priority the priority this Section has on the index page for sorting purposes */ - public MarkdownSection(String header, Function comment, int priority) { - this.header = header; + public Heading(String text, Function comment, int priority) { + this.text = text; this.comment = comment; this.entries = new ArrayList<>(); this.priority = priority; } - public static MarkdownSection containerIndex(ContainerHolder container) { + public static Heading containerIndex(ContainerHolder container) { var header = LangHelper.fallback(String.format("groovyscript.wiki.%s.index.title", container.id()), container.name()); var comment = LangHelper.fallback(String.format("groovyscript.wiki.%s.index.description", container.id()), null); - return new MarkdownSection(I18n.format(header), comment == null ? null : md -> I18n.format(comment, md.entries.size())); + return new Heading(I18n.format(header), comment == null ? null : md -> I18n.format(comment, md.entries.size())); } - public static MarkdownSection fromContainer(ContainerHolder container) { + public static Heading fromContainer(ContainerHolder container) { var header = LangHelper.fallback(String.format("groovyscript.wiki.%s.index.subtitle", container.id()), "groovyscript.wiki.categories"); var comment = LangHelper.fallback(String.format("groovyscript.wiki.%s.index.subtitle.comment", container.id()), "groovyscript.wiki.subcategories_count"); return fromI18n(header, comment); } - public static MarkdownSection fromI18n(String header, String comment) { - return new MarkdownSection(I18n.format(header), md -> I18n.format(comment, md.entries.size())); + public static Heading fromI18n(String header, String comment) { + return new Heading(I18n.format(header), md -> I18n.format(comment, md.entries.size())); } /** @@ -101,10 +101,10 @@ public String get() { return get(2); } - public String get(int headerLevel) { + public String get(int headingLevel) { var sb = new StringBuilder(); - sb.append(StringUtils.repeat('#', headerLevel)); - sb.append(' ').append(header).append("\n\n"); + sb.append(StringUtils.repeat('#', headingLevel)); + sb.append(' ').append(text).append("\n\n"); if (comment != null) { var sub = comment.apply(this); if (!sub.isEmpty()) sb.append(sub).append("\n\n"); @@ -114,10 +114,10 @@ public String get(int headerLevel) { } @Override - public int compareTo(@NotNull MarkdownSection o) { + public int compareTo(@NotNull Heading o) { return ComparisonChain.start() .compare(priority, o.priority) - .compare(header, o.header) + .compare(text, o.text) .result(); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java index 222eab3fa..3b0b70454 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LinkIndex.java @@ -9,39 +9,39 @@ /** * This is used to create the index page for the wiki. *

- * It has a default {@link MarkdownSection} for the normal + * It has a default {@link Heading} for the normal * categories, and in most cases this is the only section needed. *

* Typical use will be multiple calls of {@link #add(String)}. * - * @see MarkdownSection + * @see Heading */ public class LinkIndex { private static final String PRIMARY_SECTION = "primary"; - private final Map sections = new HashMap<>(); + private final Map sections = new HashMap<>(); - public LinkIndex(MarkdownSection primary) { + public LinkIndex(Heading primary) { register(PRIMARY_SECTION, primary); } /** * Registers a section to the index, with the given id. * While it is possible to use {@link #add(String, String)}, - * in many cases it is preferable to simply call {@link MarkdownSection#addEntry(String)} + * in many cases it is preferable to simply call {@link Heading#addEntry(String)} * on the section being registered here. * * @param id the id the section has * @param section the section to register */ - public void register(String id, MarkdownSection section) { + public void register(String id, Heading section) { sections.put(id, section); } /** * @param entry the string to add to the primary section, typically a markdown bullet point link - * @see MarkdownSection#addEntry(String) + * @see Heading#addEntry(String) */ public void add(String entry) { sections.get(PRIMARY_SECTION).addEntry(entry); @@ -50,7 +50,7 @@ public void add(String entry) { /** * @param id the id of the section to add to - if invalid, the entry will be added to the primary category * @param entry the string to add to the section, typically a markdown bullet point link - * @see MarkdownSection#addEntry(String) + * @see Heading#addEntry(String) */ public void add(String id, String entry) { sections.getOrDefault(id, sections.get(PRIMARY_SECTION)).addEntry(entry); @@ -62,9 +62,9 @@ public void add(String id, String entry) { public String get() { return sections.values() .stream() - .filter(MarkdownSection::hasEntries) + .filter(Heading::hasEntries) .sorted() - .map(MarkdownSection::get) + .map(Heading::get) .collect(Collectors.joining()); } @@ -74,9 +74,9 @@ public String get() { public String getLinks() { return sections.values() .stream() - .filter(MarkdownSection::hasEntries) + .filter(Heading::hasEntries) .sorted() - .map(MarkdownSection::getEntries) + .map(Heading::getEntries) .flatMap(Collection::stream) .collect(Collectors.joining("\n")); } From 4da45eb78dc1ea3a282000bacc7621d453138851 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:46:32 -0800 Subject: [PATCH 62/92] make header IFormat --- .../groovyscript/documentation/format/IFormat.java | 7 +++++++ .../groovyscript/documentation/format/MKDocsMaterial.java | 5 +++++ .../groovyscript/documentation/format/VitePress.java | 5 +++++ .../groovyscript/documentation/helper/Heading.java | 4 ++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/format/IFormat.java b/src/main/java/com/cleanroommc/groovyscript/documentation/format/IFormat.java index 4aa768fca..7613fb6c9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/format/IFormat.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/format/IFormat.java @@ -39,6 +39,13 @@ public interface IFormat { */ String codeBlockHighlights(List highlight); + /** + * @param level the level of header + * @param text the text of the header itself + * @return a header of the given size for the given text + */ + String header(int level, String text); + /** * @return the String to hide the Table of Contents (sidebar showing Headers on focused file) from the page */ diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/format/MKDocsMaterial.java b/src/main/java/com/cleanroommc/groovyscript/documentation/format/MKDocsMaterial.java index 6dd4e8716..e2aed6cb1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/format/MKDocsMaterial.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/format/MKDocsMaterial.java @@ -34,6 +34,11 @@ public String codeBlockHighlights(List highlight) { return " hl_lines=\"" + String.join(" ", highlight) + "\""; } + @Override + public String header(int level, String text) { + return StringUtils.repeat('#', level) + " " + text; + } + @Override public String removeTableOfContentsText() { return "hide: toc"; diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/format/VitePress.java b/src/main/java/com/cleanroommc/groovyscript/documentation/format/VitePress.java index 357256f13..aa46be2ac 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/format/VitePress.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/format/VitePress.java @@ -40,6 +40,11 @@ public String codeBlockHighlights(List highlight) { return ":no-line-numbers {" + String.join(",", highlight) + "}"; } + @Override + public String header(int level, String text) { + return StringUtils.repeat('#', level) + " " + text; + } + @Override public String removeTableOfContentsText() { return "aside: false"; diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java index 4cb65681d..0461de16a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java @@ -1,5 +1,6 @@ package com.cleanroommc.groovyscript.documentation.helper; +import com.cleanroommc.groovyscript.documentation.Documentation; import com.google.common.collect.ComparisonChain; import net.minecraft.client.resources.I18n; import org.apache.commons.lang3.StringUtils; @@ -103,8 +104,7 @@ public String get() { public String get(int headingLevel) { var sb = new StringBuilder(); - sb.append(StringUtils.repeat('#', headingLevel)); - sb.append(' ').append(text).append("\n\n"); + sb.append(Documentation.DEFAULT_FORMAT.header(headingLevel, text)).append("\n\n"); if (comment != null) { var sub = comment.apply(this); if (!sub.isEmpty()) sb.append(sub).append("\n\n"); From 635fb6badae048a0a0ab0ac87a57d4a4fd7b1b52 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:49:34 -0800 Subject: [PATCH 63/92] thats now how you make new lines --- .../groovyscript/documentation/helper/ContainerHolder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java index 76a9fa286..aaf6b01a3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/ContainerHolder.java @@ -47,7 +47,7 @@ public static ContainerHolder of(String id, String log, Collection aliases, Collection registries) { - return new ContainerHolder(id, name, access, importBlock -> importBlock + "%nlog '" + log + "'", aliases, registries); + return new ContainerHolder(id, name, access, importBlock -> importBlock + "\nlog '" + log + "'", aliases, registries); } /** From d356266ee4adaf6784efb27913fb2ce018e383d3 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 23 Nov 2025 21:37:12 -0800 Subject: [PATCH 64/92] add category header overrides --- .../api/documentation/annotations/RegistryDescription.java | 7 +++++++ .../cleanroommc/groovyscript/documentation/Registry.java | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java index c8a26e2fc..23f168dd8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java @@ -121,6 +121,13 @@ /** * Controls the localization keys used refer to adding, removing, or querying the registry. * Primarily used to control if the registry contains specifically "recipes" or more generic "entries". + *

+ * Can be overridden by the presence of lang keys for the registry, checking these places for overrides: + * + *
groovyscript.wiki.{@link com.cleanroommc.groovyscript.compat.mods.GroovyContainer#getModId() {modId}}.{@link com.cleanroommc.groovyscript.registry.VirtualizedRegistry#getName() {name}}.operation.adding + *
groovyscript.wiki.{@link com.cleanroommc.groovyscript.compat.mods.GroovyContainer#getModId() {modId}}.{@link com.cleanroommc.groovyscript.registry.VirtualizedRegistry#getName() {name}}.operation.removing + *
groovyscript.wiki.{@link com.cleanroommc.groovyscript.compat.mods.GroovyContainer#getModId() {modId}}.{@link com.cleanroommc.groovyscript.registry.VirtualizedRegistry#getName() {name}}.operation.query + *
* * @return the name of the objects within the registry. Defaults to {@code Category.RECIPES} * @see Category diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 381f6aad6..e31387a0c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -298,7 +298,7 @@ public String documentationBlock() { out.append(documentMethods(I18n.format("groovyscript.wiki.editing_values"), MethodDescription.Type.VALUE)); } if (!methods.get(MethodDescription.Type.ADDITION).isEmpty() || !recipeBuilders.isEmpty()) { - out.append(new Heading(LangHelper.translate(description.category().adding())).get()); + out.append(new Heading(LangHelper.translate(LangHelper.fallback(getBaseLangKey() + ".operation.adding", description.category().adding()))).get()); if (!methods.get(MethodDescription.Type.ADDITION).isEmpty()) { out.append(documentMethods(methods.get(MethodDescription.Type.ADDITION))).append("\n"); } @@ -307,10 +307,10 @@ public String documentationBlock() { } } if (!methods.get(MethodDescription.Type.REMOVAL).isEmpty()) { - out.append(documentMethods(LangHelper.translate(description.category().removing()), MethodDescription.Type.REMOVAL)); + out.append(documentMethods(LangHelper.translate(LangHelper.fallback(getBaseLangKey() + ".operation.removing", description.category().removing())), MethodDescription.Type.REMOVAL)); } if (!methods.get(MethodDescription.Type.QUERY).isEmpty()) { - out.append(documentMethods(LangHelper.translate(description.category().query()), MethodDescription.Type.QUERY)); + out.append(documentMethods(LangHelper.translate(LangHelper.fallback(getBaseLangKey() + ".operation.query", description.category().query())), MethodDescription.Type.QUERY)); } out.append("\n"); From b6198e745c5fc9806ebc8d1201c3eacb1c9b6713 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 23 Nov 2025 21:52:57 -0800 Subject: [PATCH 65/92] make non-varargs translate method --- .../documentation/helper/LangHelper.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LangHelper.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LangHelper.java index 4f848e997..b76661e0a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LangHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/LangHelper.java @@ -52,10 +52,19 @@ public static String fallback(int fallbackIndex, String... keys) { return keys[fallbackIndex]; } - public static String translate(String translateKey, Object... parameters) { - if (GenerationFlags.LOG_MISSING_LANG_KEYS && !I18n.hasKey(translateKey)) { - MISSING_LANG_KEYS.add(translateKey); + private static void validateKey(String key) { + if (GenerationFlags.LOG_MISSING_LANG_KEYS && !I18n.hasKey(key)) { + MISSING_LANG_KEYS.add(key); } + } + + public static String translate(String translateKey) { + validateKey(translateKey); + return I18n.format(translateKey); + } + + public static String translate(String translateKey, Object... parameters) { + validateKey(translateKey); return I18n.format(translateKey, parameters); } From 443ff17e3942f2551816e90fc9f723f1c95e4e92 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 23 Nov 2025 21:55:03 -0800 Subject: [PATCH 66/92] rework lang key usage for category --- .../annotations/RegistryDescription.java | 43 ++++++++++--------- .../groovyscript/documentation/Registry.java | 8 ++-- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java index 23f168dd8..133219721 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java @@ -122,11 +122,12 @@ * Controls the localization keys used refer to adding, removing, or querying the registry. * Primarily used to control if the registry contains specifically "recipes" or more generic "entries". *

- * Can be overridden by the presence of lang keys for the registry, checking these places for overrides: + * Using {@link Category#CUSTOM} it will instead try to read specific lang keys, checking these places for overrides: * - *
groovyscript.wiki.{@link com.cleanroommc.groovyscript.compat.mods.GroovyContainer#getModId() {modId}}.{@link com.cleanroommc.groovyscript.registry.VirtualizedRegistry#getName() {name}}.operation.adding - *
groovyscript.wiki.{@link com.cleanroommc.groovyscript.compat.mods.GroovyContainer#getModId() {modId}}.{@link com.cleanroommc.groovyscript.registry.VirtualizedRegistry#getName() {name}}.operation.removing *
groovyscript.wiki.{@link com.cleanroommc.groovyscript.compat.mods.GroovyContainer#getModId() {modId}}.{@link com.cleanroommc.groovyscript.registry.VirtualizedRegistry#getName() {name}}.operation.query + *
groovyscript.wiki.{@link com.cleanroommc.groovyscript.compat.mods.GroovyContainer#getModId() {modId}}.{@link com.cleanroommc.groovyscript.registry.VirtualizedRegistry#getName() {name}}.operation.removing + *
groovyscript.wiki.{@link com.cleanroommc.groovyscript.compat.mods.GroovyContainer#getModId() {modId}}.{@link com.cleanroommc.groovyscript.registry.VirtualizedRegistry#getName() {name}}.operation.values + *
groovyscript.wiki.{@link com.cleanroommc.groovyscript.compat.mods.GroovyContainer#getModId() {modId}}.{@link com.cleanroommc.groovyscript.registry.VirtualizedRegistry#getName() {name}}.operation.adding *
* * @return the name of the objects within the registry. Defaults to {@code Category.RECIPES} @@ -174,29 +175,31 @@ public boolean hasFlaws() { /** * Controls the name of what the registry contains. - * Currently, either specifically "recipes" or generically "entries" + * Currently, either specifically "recipes", generically "entries", or entirely custom. */ enum Category { RECIPES("recipes"), - ENTRIES("entries"); - - private final String category; - - Category(String category) { - this.category = category; - } - - public String adding() { - return "groovyscript.wiki.adding_" + category; + ENTRIES("entries"), + CUSTOM; + + public final String query; + public final String adding; + public final String removing; + public final String values; + + Category() { + this.query = null; + this.adding = null; + this.removing = null; + this.values = null; } - public String removing() { - return "groovyscript.wiki.removing_" + category; - } - - public String query() { - return "groovyscript.wiki.query_" + category; + Category(String category) { + this.query = "groovyscript.wiki.query_" + category; + this.adding = "groovyscript.wiki.adding_" + category; + this.removing = "groovyscript.wiki.removing_" + category; + this.values = "groovyscript.wiki.editing_values"; } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index e31387a0c..36e3e822b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -295,10 +295,10 @@ public String documentationBlock() { out.append(generateIdentifier()); if (!methods.get(MethodDescription.Type.VALUE).isEmpty()) { - out.append(documentMethods(I18n.format("groovyscript.wiki.editing_values"), MethodDescription.Type.VALUE)); + out.append(documentMethods(LangHelper.translate(LangHelper.fallback(description.category().values, getBaseLangKey() + ".operation.values")), MethodDescription.Type.VALUE)); } if (!methods.get(MethodDescription.Type.ADDITION).isEmpty() || !recipeBuilders.isEmpty()) { - out.append(new Heading(LangHelper.translate(LangHelper.fallback(getBaseLangKey() + ".operation.adding", description.category().adding()))).get()); + out.append(new Heading(LangHelper.translate(LangHelper.fallback(description.category().adding, getBaseLangKey() + ".operation.adding"))).get()); if (!methods.get(MethodDescription.Type.ADDITION).isEmpty()) { out.append(documentMethods(methods.get(MethodDescription.Type.ADDITION))).append("\n"); } @@ -307,10 +307,10 @@ public String documentationBlock() { } } if (!methods.get(MethodDescription.Type.REMOVAL).isEmpty()) { - out.append(documentMethods(LangHelper.translate(LangHelper.fallback(getBaseLangKey() + ".operation.removing", description.category().removing())), MethodDescription.Type.REMOVAL)); + out.append(documentMethods(LangHelper.translate(LangHelper.fallback(description.category().removing, getBaseLangKey() + ".operation.removing")), MethodDescription.Type.REMOVAL)); } if (!methods.get(MethodDescription.Type.QUERY).isEmpty()) { - out.append(documentMethods(LangHelper.translate(LangHelper.fallback(getBaseLangKey() + ".operation.query", description.category().query())), MethodDescription.Type.QUERY)); + out.append(documentMethods(LangHelper.translate(LangHelper.fallback(description.category().query, getBaseLangKey() + ".operation.query")), MethodDescription.Type.QUERY)); } out.append("\n"); From 66137c4c4e3712d1f6bb2ead7473150a43751f00 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 23 Nov 2025 23:04:45 -0800 Subject: [PATCH 67/92] adjust documenting methods --- .../groovyscript/documentation/Registry.java | 55 ++++++++----------- 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 36e3e822b..761f61d9a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -296,21 +296,24 @@ public String documentationBlock() { if (!methods.get(MethodDescription.Type.VALUE).isEmpty()) { out.append(documentMethods(LangHelper.translate(LangHelper.fallback(description.category().values, getBaseLangKey() + ".operation.values")), MethodDescription.Type.VALUE)); + out.append(methodExamples(MethodDescription.Type.VALUE)); } if (!methods.get(MethodDescription.Type.ADDITION).isEmpty() || !recipeBuilders.isEmpty()) { - out.append(new Heading(LangHelper.translate(LangHelper.fallback(description.category().adding, getBaseLangKey() + ".operation.adding"))).get()); + out.append(documentMethods(LangHelper.translate(LangHelper.fallback(description.category().adding, getBaseLangKey() + ".operation.adding")), MethodDescription.Type.ADDITION)); if (!methods.get(MethodDescription.Type.ADDITION).isEmpty()) { - out.append(documentMethods(methods.get(MethodDescription.Type.ADDITION))).append("\n"); + out.append(methodExamples(MethodDescription.Type.ADDITION)); } if (!recipeBuilders.isEmpty()) { - out.append(recipeBuilder()).append("\n\n"); + out.append(recipeBuilder()); } } if (!methods.get(MethodDescription.Type.REMOVAL).isEmpty()) { out.append(documentMethods(LangHelper.translate(LangHelper.fallback(description.category().removing, getBaseLangKey() + ".operation.removing")), MethodDescription.Type.REMOVAL)); + out.append(methodExamples(MethodDescription.Type.REMOVAL)); } if (!methods.get(MethodDescription.Type.QUERY).isEmpty()) { out.append(documentMethods(LangHelper.translate(LangHelper.fallback(description.category().query, getBaseLangKey() + ".operation.query")), MethodDescription.Type.QUERY)); +// out.append(methodExamples(MethodDescription.Type.QUERY)); } out.append("\n"); @@ -323,49 +326,35 @@ public String documentMethods(String header, MethodDescription.Type type) { for (var method : methods.get(type)) { // only add the method description if it is the first for the targeted method if (describedMethods.add(method.method())) { - md.addEntry(methodDescription(method)); + md.addEntry(methodDescription(method).trim()); } } return md.get(); } - public String documentMethods(List> methods) { - return documentMethods(methods, false); - } - - public String documentMethods(List> methods, boolean preventExamples) { - StringBuilder out = new StringBuilder(); + public String methodExamples(MethodDescription.Type type) { List exampleLines = new ArrayList<>(); List annotations = new ArrayList<>(); - Set describedMethods = new ObjectOpenHashSet<>(); - for (MethodAnnotation method : methods) { - // only add the method description if it is the first for the targeted method - if (describedMethods.add(method.method())) { - out.append(methodDescription(method)); - } - if (method.annotation().example().length > 0 && Arrays.stream(method.annotation().example()).anyMatch(x -> !x.value().isEmpty())) { - exampleLines.addAll(Arrays.stream(method.annotation().example()).flatMap(example -> Stream.of(methodExample(method.method(), example.value()))).collect(Collectors.toList())); + for (var method : methods.get(type)) { + var example = method.annotation().example(); + if (example.length > 0 && Arrays.stream(example).anyMatch(x -> !x.value().isEmpty())) { + for (var x : example) { + exampleLines.add(methodExample(method.method(), x.value())); + } } else if (method.method().getParameterTypes().length == 0) { exampleLines.add(methodExample(method.method())); } - Arrays.stream(method.annotation().example()).map(Example::annotations).flatMap(Arrays::stream).forEach(annotations::add); - } - - if (!exampleLines.isEmpty() && !preventExamples) { - out.append( - new AdmonitionBuilder() - .type(Admonition.Type.EXAMPLE) - .note( - new CodeBlockBuilder() - .line(exampleLines) - .annotation(annotations) - .generate()) - .generate()); - out.append("\n"); + for (var x : example) { + Collections.addAll(annotations, x.annotations()); + } } - return out.toString(); + if (exampleLines.isEmpty()) return ""; + return new AdmonitionBuilder() + .type(Admonition.Type.EXAMPLE) + .note(new CodeBlockBuilder().line(exampleLines).annotation(annotations).generate()) + .generate() + "\n\n"; } public String methodDescription(MethodAnnotation method) { From 808f6a1792e58f789d811a73d096007bb21510b8 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 23 Nov 2025 23:05:45 -0800 Subject: [PATCH 68/92] surround mod in parentheses for title --- .../com/cleanroommc/groovyscript/documentation/Registry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 761f61d9a..b3c541722 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -214,7 +214,7 @@ private String generateHeader() { } private String generateTitle() { - return new Heading(getTitle() + " " + container.name()).get(1); + return new Heading(getTitle() + " (" + container.name() + ")").get(1); } private String generateDescription() { From 19d0c0db02950163741e5c519a2f40653b20ed93 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 23 Nov 2025 23:08:28 -0800 Subject: [PATCH 69/92] extract tab indent whitespace --- .../documentation/helper/AdmonitionBuilder.java | 6 ++++-- .../groovyscript/documentation/helper/CodeBlockBuilder.java | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/AdmonitionBuilder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/AdmonitionBuilder.java index 9bf5b90e0..c55c3a335 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/AdmonitionBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/AdmonitionBuilder.java @@ -11,6 +11,8 @@ public class AdmonitionBuilder { + private static final String TAB = " "; + private final List note = new ArrayList<>(); private Admonition.Type admonitionType = Admonition.Type.NOTE; private String title = ""; @@ -64,7 +66,7 @@ public String generate() { public String generate(IFormat format) { StringBuilder out = new StringBuilder(); - String indent = StringUtils.repeat(" ", indentation); + String indent = StringUtils.repeat(TAB, indentation); out.append(format.admonitionStart(admonitionFormat, admonitionType, indentation, hasTitle ? title : "")); out.append("\n"); @@ -72,7 +74,7 @@ public String generate(IFormat format) { for (int i = 0; i < note.size(); i++) { String line = note.get(i); if (!line.trim().isEmpty()) { - if (format.allowsIndentation()) out.append(indent).append(" "); + if (format.allowsIndentation()) out.append(indent).append(TAB); out.append(line); } if (i < note.size() - 1) out.append("\n"); diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/CodeBlockBuilder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/CodeBlockBuilder.java index 61e0699b9..bb065dad8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/CodeBlockBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/CodeBlockBuilder.java @@ -11,6 +11,8 @@ public class CodeBlockBuilder { + private static final String TAB = " "; + private final List lines = new ArrayList<>(); private final List annotations = new ArrayList<>(); private final List highlight = new ArrayList<>(); @@ -75,7 +77,7 @@ public List generate() { @SuppressWarnings("StringBufferMayBeStringBuilder") public List generate(IFormat format) { List out = new ArrayList<>(); - String indent = StringUtils.repeat(" ", indentation); + String indent = StringUtils.repeat(TAB, indentation); out.add(indent + "```" + lang + format.codeBlockHighlights(highlight)); for (String line : lines) out.add(indent + line); From 66c68ca4e9cbc2147dac84e742199e42f4f6ca64 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 23 Nov 2025 23:09:06 -0800 Subject: [PATCH 70/92] document content creation --- .../generated/minecraft_generated.groovy | 49 ++++++++++++++++ .../groovyscript/compat/content/Content.java | 56 +++++++++++++++++++ .../assets/groovyscript/lang/en_us.lang | 14 +++++ 3 files changed, 119 insertions(+) create mode 100644 examples/preInit/generated/minecraft_generated.groovy diff --git a/examples/preInit/generated/minecraft_generated.groovy b/examples/preInit/generated/minecraft_generated.groovy new file mode 100644 index 000000000..89dc5faa4 --- /dev/null +++ b/examples/preInit/generated/minecraft_generated.groovy @@ -0,0 +1,49 @@ + +// Auto generated groovyscript example file + +import net.minecraft.item.ItemFood +import net.minecraft.world.IBlockAccess +import net.minecraft.potion.PotionEffect +import net.minecraft.util.math.AxisAlignedBB +import net.minecraft.block.state.BlockFaceShape +import net.minecraft.entity.player.EntityPlayer + +log 'running Vanilla Minecraft example' + +// Vanilla Content Creation: +// Creates custom items, blocks, and fluids for later use. + +content.setDefaultCreativeTab(content.createCreativeTab('groovyscript.example_creative_tab', _ -> item('groovyscriptdev:heartofauniverse'))) + +content.registerItem('snack', (new ItemFood(20, 10, false) { + protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) { + if (!worldIn.isRemote) { + player.addPotionEffect(new PotionEffect(potion('minecraft:regeneration'), 240000, 3, false, false)) + player.addPotionEffect(new PotionEffect(potion('minecraft:resistance'), 240000, 3, false, false)) + } + } +}).setAlwaysEdible()) +content.registerBlock('dragon_egg_lamp', (new Block(blockMaterial('redstone_light')) { + protected static final AxisAlignedBB DRAGON_EGG_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 1.0D, 0.9375D) + + AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + return DRAGON_EGG_AABB + } + + boolean isOpaqueCube(IBlockState state) { + return false + } + + boolean isFullCube(IBlockState state) { + return false + } + + boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { + return true + } + + BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + return BlockFaceShape.UNDEFINED + } +}).setLightLevel(1.0F)) +content.createCreativeTab('groovyscript.other_tab_clay', _ -> item('minecraft:clay')) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java b/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java index ed7074cfa..04c232093 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java @@ -2,7 +2,12 @@ import com.cleanroommc.groovyscript.GroovyScript; import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.documentation.annotations.Example; +import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; +import com.cleanroommc.groovyscript.api.documentation.annotations.RecipeBuilderDescription; +import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.registry.NamedRegistry; +import com.cleanroommc.groovyscript.sandbox.LoadStage; import groovy.lang.Closure; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -17,10 +22,24 @@ import java.util.function.Supplier; +@RegistryDescription(location = LoadStage.PRE_INIT, category = RegistryDescription.Category.CUSTOM) public class Content extends NamedRegistry { public CreativeTabs defaultTab; + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example(value = """ + 'snack', (new ItemFood(20, 10, false) { + protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) { + if (!worldIn.isRemote) { + player.addPotionEffect(new PotionEffect(potion('minecraft:regeneration'), 240000, 3, false, false)) + player.addPotionEffect(new PotionEffect(potion('minecraft:resistance'), 240000, 3, false, false)) + } + } + }).setAlwaysEdible()""", imports = { + "net.minecraft.item.ItemFood", + "net.minecraft.potion.PotionEffect", + "net.minecraft.entity.player.EntityPlayer" + })) public void registerItem(@Nullable String name, Item item) { if (name != null) { item.setRegistryName(GroovyScript.getRunConfig().getPackId(), name); @@ -31,16 +50,46 @@ public void registerItem(@Nullable String name, Item item) { GroovyItem.registerItem(item); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public void registerBlock(String name, Block block, ItemBlock item) { block.setRegistryName(GroovyScript.getRunConfig().getPackId(), name); item.setRegistryName(GroovyScript.getRunConfig().getPackId(), name); GroovyBlock.register(block, item); } + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example(value = """ + 'dragon_egg_lamp', (new Block(blockMaterial('redstone_light')) { + protected static final AxisAlignedBB DRAGON_EGG_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 1.0D, 0.9375D) + + AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + return DRAGON_EGG_AABB + } + + boolean isOpaqueCube(IBlockState state) { + return false + } + + boolean isFullCube(IBlockState state) { + return false + } + + boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { + return true + } + + BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + return BlockFaceShape.UNDEFINED + } + }).setLightLevel(1.0F)""", imports = { + "net.minecraft.block.state.BlockFaceShape", + "net.minecraft.util.math.AxisAlignedBB", + "net.minecraft.world.IBlockAccess" + })) public void registerBlock(String name, Block block) { registerBlock(name, block, new ItemBlock(block)); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public void registerFluid(Fluid fluid) { FluidRegistry.registerFluid(fluid); } @@ -61,6 +110,7 @@ public GroovyFluid.Builder createFluid(String name) { return new GroovyFluid.Builder(name); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public CreativeTabs createCreativeTab(String name, ItemStack icon) { return new CreativeTabs(name) { @@ -71,6 +121,7 @@ public CreativeTabs createCreativeTab(String name, ItemStack icon) { }; } + @MethodDescription(type = MethodDescription.Type.ADDITION) public CreativeTabs createCreativeTab(String name, Supplier icon) { return new CreativeTabs(name) { @@ -81,6 +132,7 @@ public CreativeTabs createCreativeTab(String name, Supplier icon) { }; } + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'groovyscript.other_tab_clay', _ -> item('minecraft:clay')")) public CreativeTabs createCreativeTab(String name, Closure icon) { return new CreativeTabs(name) { @@ -91,14 +143,18 @@ public CreativeTabs createCreativeTab(String name, Closure icon) { }; } + @MethodDescription(type = MethodDescription.Type.ADDITION) public CreativeTabs createCreativeTab(String name, Item icon) { return createCreativeTab(name, new ItemStack(icon)); } + @MethodDescription(type = MethodDescription.Type.QUERY) public CreativeTabs getDefaultTab() { return defaultTab; } + // Set as VALUE so it is the first in the file + @MethodDescription(type = MethodDescription.Type.VALUE, example = @Example("content.createCreativeTab('groovyscript.example_creative_tab', _ -> item('groovyscriptdev:heartofauniverse'))")) public void setDefaultCreativeTab(CreativeTabs tab) { this.defaultTab = tab; } diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index bdb6f2989..1a3956abf 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -209,6 +209,20 @@ groovyscript.wiki.minecraft.game_rule.setWarnNewGameRule=Sets if creating new Ga groovyscript.wiki.minecraft.game_rule.add=Adds a new entry in the format `name`, `value`, with `value` being a String that can represent a number (`-1`, `5`) or boolean (`true`, `false`) groovyscript.wiki.minecraft.game_rule.addMap=Adds a map of GameRule name to values +## Content +groovyscript.wiki.minecraft.content.title=Vanilla Content Creation +groovyscript.wiki.minecraft.content.operation.query=Helper methods +groovyscript.wiki.minecraft.content.operation.adding=Create Custom Content +#groovyscript.wiki.minecraft.content.operation.removing=unused +groovyscript.wiki.minecraft.content.operation.values=Creative Tab Manipulation +groovyscript.wiki.minecraft.content.description=Creates custom items, blocks, and fluids for later use. +groovyscript.wiki.minecraft.content.registerBlock=Register an already created block. Useful for when provided methods do not suffice to create the desired block +groovyscript.wiki.minecraft.content.registerFluid=Register an already created fluid. Useful for when provided methods do not suffice to create the desired fluid +groovyscript.wiki.minecraft.content.registerItem=Register an already created item. Useful for when provided methods do not suffice to create the desired item +groovyscript.wiki.minecraft.content.createCreativeTab=Create a creative tab with the given icon +groovyscript.wiki.minecraft.content.setDefaultCreativeTab=Sets the default Creative Tab used when registering items through GroovyScript +groovyscript.wiki.minecraft.content.getDefaultTab=Get the default Creative Tab for GroovyScript, which is set by `setDefaultCreativeTab` + # In-World Crafting groovyscript.wiki.in_world_crafting.chances.value=Sets the chance each input has to be consumed groovyscript.wiki.in_world_crafting.chances.required=exactly equal to the number of elements in `input` From 69eb99ab72684cce8d345ec2615843fcec2accc5 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Mon, 24 Nov 2025 15:11:11 -0800 Subject: [PATCH 71/92] gather overrides from class --- .../annotations/MethodOverride.java | 3 ++- .../documentation/annotations/Property.java | 2 +- .../annotations/RecipeBuilderOverride.java | 3 ++- .../groovyscript/documentation/Builder.java | 19 ++++++++++------ .../groovyscript/documentation/Registry.java | 22 ++++++++++--------- .../documentation/helper/Heading.java | 1 - 6 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/MethodOverride.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/MethodOverride.java index 3b9b101ae..eec27e189 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/MethodOverride.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/MethodOverride.java @@ -1,5 +1,6 @@ package com.cleanroommc.groovyscript.api.documentation.annotations; +import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -16,7 +17,7 @@ * and not overridden in the focused class. */ @Retention(RetentionPolicy.RUNTIME) -@Target({}) // No targets allowed +@Target(ElementType.TYPE) public @interface MethodOverride { /** diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Property.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Property.java index 3248f561c..d8b5720f6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Property.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Property.java @@ -12,7 +12,7 @@ * *

  • * {@link ElementType#TYPE}: Marks the field targeted by {@link #property()} within the attached class and any subclasses with this {@link Property}. - * Multiple will be wrapped in {@link Properties}. + * Multiple will be wrapped in {@link Properties} or contained inside {@link RecipeBuilderOverride#requirement()}. *
  • *
  • * {@link ElementType#METHOD}: Marks the field targeted by {@link #property()} within the class the attached method returns with this {@link Property}. diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderOverride.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderOverride.java index 848944676..d3f4d813b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderOverride.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderOverride.java @@ -1,5 +1,6 @@ package com.cleanroommc.groovyscript.api.documentation.annotations; +import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -16,7 +17,7 @@ * and not overridden in the focused class. */ @Retention(RetentionPolicy.RUNTIME) -@Target({}) // No targets allowed +@Target(ElementType.TYPE) public @interface RecipeBuilderOverride { /** diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java index 709b6f00d..28ba5abf4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java @@ -60,17 +60,16 @@ public Builder(Method builderMethod, RecipeBuilderDescription annotation, String private static DescriptorHelper.OfClass generateOfClass(Class clazz, RecipeBuilderDescription annotation) { var methodSignatures = DescriptorHelper.generateOfClass(clazz); - if (annotation != null) { - var override = annotation.override(); + Consumer consumer = override -> { for (var entry : override.method()) { methodSignatures.addAnnotation(entry, entry.method()); } for (var entry : override.register()) { methodSignatures.addAnnotation(entry, entry.method()); } - } - getAnnotationsFromClassRecursive(RecipeBuilderMethodDescription.class, clazz).forEach(x -> methodSignatures.addAnnotation(x, x.method())); - getAnnotationsFromClassRecursive(RecipeBuilderRegistrationMethod.class, clazz).forEach(x -> methodSignatures.addAnnotation(x, x.method())); + }; + if (annotation != null) consumer.accept(annotation.override()); + getAnnotationsFromClassRecursive(RecipeBuilderOverride.class, clazz).forEach(consumer); return methodSignatures; } @@ -85,14 +84,20 @@ private static List getAnnotationsFromClassRecursive(C private static Map gatherFields(Class builderClass, RecipeBuilderDescription annotation, String langLocation) { Map fields = new HashMap<>(); List allFields = getAllFields(builderClass); + // Attached to the class or any parent classes, to create/override requirements set in the parent + List classProperties = new ArrayList<>(getAnnotationsFromClassRecursive(Property.class, builderClass)); + // Part of an override attached to the class or any parent classes, to create/override requirements set in the parent + for (var rbo : getAnnotationsFromClassRecursive(RecipeBuilderOverride.class, builderClass)) { + Collections.addAll(classProperties, rbo.requirement()); + } for (Field field : allFields) { List annotations = Stream.of( // (deprecated) Attached to the builder method's requirements field, an uncommon location for specific overrides Arrays.stream(annotation.requirement()).filter(r -> r.property().equals(field.getName())), // Attached to the builder method's override of the requirements field, an uncommon location for specific overrides Arrays.stream(annotation.override().requirement()).filter(r -> r.property().equals(field.getName())), - // Attached to the class or any parent classes, to create/override requirements set in the parent - getAnnotationsFromClassRecursive(Property.class, builderClass).stream().filter(r -> r.property().equals(field.getName())), + // Attached to the class or any parent classes either directly or via RecipeBuilderOverride, to create/override requirements set in the parent + classProperties.stream().filter(r -> r.property().equals(field.getName())), // Attached to the field, the typical place for property information to be created Arrays.stream(field.getAnnotationsByType(Property.class)).filter(r -> { if (r.property().isEmpty() || r.property().equals(field.getName())) return true; diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index b3c541722..624a3a731 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -19,9 +19,9 @@ import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.util.*; +import java.util.function.Consumer; import java.util.regex.Pattern; import java.util.stream.Collectors; -import java.util.stream.Stream; public class Registry implements IRegistryDocumentation { @@ -85,16 +85,18 @@ private static Map generateTypes(Class registryClass) { private static DescriptorHelper.OfClass generateOfClass(Class clazz) { var methodSignatures = DescriptorHelper.generateOfClass(clazz); - var description = clazz.getAnnotation(RegistryDescription.class); - if (description != null) { - var override = description.override(); - for (var annotation : override.method()) { - methodSignatures.addAnnotation(annotation, annotation.method()); + Consumer consumer = override -> { + for (var entry : override.method()) { + methodSignatures.addAnnotation(entry, entry.method()); } for (var annotation : override.recipeBuilder()) { methodSignatures.addAnnotation(annotation, annotation.method()); } - } + }; + var description = clazz.getAnnotation(RegistryDescription.class); + if (description != null) consumer.accept(description.override()); + var mo = clazz.getAnnotation(MethodOverride.class); + if (mo != null) consumer.accept(mo); return methodSignatures; } @@ -352,9 +354,9 @@ public String methodExamples(MethodDescription.Type type) { if (exampleLines.isEmpty()) return ""; return new AdmonitionBuilder() - .type(Admonition.Type.EXAMPLE) - .note(new CodeBlockBuilder().line(exampleLines).annotation(annotations).generate()) - .generate() + "\n\n"; + .type(Admonition.Type.EXAMPLE) + .note(new CodeBlockBuilder().line(exampleLines).annotation(annotations).generate()) + .generate() + "\n\n"; } public String methodDescription(MethodAnnotation method) { diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java index 0461de16a..5661394a7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java @@ -3,7 +3,6 @@ import com.cleanroommc.groovyscript.documentation.Documentation; import com.google.common.collect.ComparisonChain; import net.minecraft.client.resources.I18n; -import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; From 808db78d49e319490c28981b6b05171eb564afa0 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Mon, 24 Nov 2025 19:00:26 -0800 Subject: [PATCH 72/92] tulip typo --- examples/postInit/generated/minecraft_generated.groovy | 4 ++-- .../com/cleanroommc/groovyscript/compat/vanilla/Crafting.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/postInit/generated/minecraft_generated.groovy b/examples/postInit/generated/minecraft_generated.groovy index d2c731f88..47b4ba2c8 100644 --- a/examples/postInit/generated/minecraft_generated.groovy +++ b/examples/postInit/generated/minecraft_generated.groovy @@ -130,7 +130,7 @@ crafting.shapelessBuilder() .register() crafting.shapelessBuilder() - .name('minecraft:pink_dye_from_pink_tulp') + .name('minecraft:pink_dye_from_pink_tulip') .output(item('minecraft:clay')) .input([item('minecraft:nether_star')]) .replaceByName() @@ -154,7 +154,7 @@ crafting.shapelessBuilder() // crafting.replaceShaped('gold_to_diamonds', item('minecraft:diamond') * 8, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) // crafting.replaceShaped(resource('minecraft:sea_lantern'), item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]) // crafting.replaceShapeless(item('minecraft:ender_eye'), [item('minecraft:ender_pearl'),item('minecraft:nether_star')]) -// crafting.replaceShapeless('minecraft:pink_dye_from_pink_tulp', item('minecraft:clay'), [item('minecraft:nether_star')]) +// crafting.replaceShapeless('minecraft:pink_dye_from_pink_tulip', item('minecraft:clay'), [item('minecraft:nether_star')]) // crafting.replaceShapeless(resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) // Furnace: diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Crafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Crafting.java index 3ec077aa8..f08a0059d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Crafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Crafting.java @@ -112,7 +112,7 @@ public void replaceShapeless(ItemStack output, List input) { .register(); } - @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShapeless1", example = @Example(value = "'minecraft:pink_dye_from_pink_tulp', item('minecraft:clay'), [item('minecraft:nether_star')]", commented = true)) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShapeless1", example = @Example(value = "'minecraft:pink_dye_from_pink_tulip', item('minecraft:clay'), [item('minecraft:nether_star')]", commented = true)) public void replaceShapeless(String name, ItemStack output, List input) { shapelessBuilder() .input(input) @@ -253,7 +253,7 @@ public CraftingRecipeBuilder.Shaped shapedBuilder() { @Example(".name('precious_to_clay').output(item('minecraft:clay')).input([item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')])"), @Example(".name(resource('example:resource_location2')).output(item('minecraft:clay')).input([item('minecraft:cobblestone'), item('minecraft:gold_ingot')])"), @Example(".output(item('minecraft:ender_eye')).input([item('minecraft:ender_pearl'),item('minecraft:nether_star')]).replace()"), - @Example(".name('minecraft:pink_dye_from_pink_tulp').output(item('minecraft:clay')).input([item('minecraft:nether_star')]).replaceByName()"), + @Example(".name('minecraft:pink_dye_from_pink_tulip').output(item('minecraft:clay')).input([item('minecraft:nether_star')]).replaceByName()"), @Example(".name(resource('minecraft:pink_dye_from_peony')).output(item('minecraft:clay')).input([item('minecraft:cobblestone'), item('minecraft:gold_ingot')]).replaceByName()"), }) public CraftingRecipeBuilder.Shapeless shapelessBuilder() { From 1c7e535a50168745d841f7c0a77e3016662e6d52 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Mon, 24 Nov 2025 19:53:12 -0800 Subject: [PATCH 73/92] fix error not logging desired info --- .../com/cleanroommc/groovyscript/documentation/Builder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java index 28ba5abf4..02bccbc84 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java @@ -325,7 +325,7 @@ public StringBuilder documentFields() { var recipeBuilderMethods = methods.get(fieldDocumentation.getField().getName()); if (recipeBuilderMethods == null || recipeBuilderMethods.isEmpty()) { - GroovyLog.get().warn("Couldn't find any methods targeting field '{}' in recipe builder '{}'", fieldDocumentation.getField().getName(), location); + GroovyLog.get().warn("Couldn't find any methods targeting field '{}' in recipe builder '{}'", fieldDocumentation.getField().getName(), location + "." + builderMethod.getName()); } else { var lines = recipeBuilderMethods.stream() .sorted(ComparisonHelper::recipeBuilderMethod) From 9d8c0947357a9ada9721bee6afd95ddc332181ea Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Mon, 24 Nov 2025 20:54:31 -0800 Subject: [PATCH 74/92] add description to recipe builder methods --- .../RecipeBuilderMethodDescription.java | 9 ++ .../RecipeBuilderRegistrationMethod.java | 12 +++ .../groovyscript/documentation/Builder.java | 93 ++++++++++--------- 3 files changed, 71 insertions(+), 43 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderMethodDescription.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderMethodDescription.java index e4153db82..804c67afa 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderMethodDescription.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderMethodDescription.java @@ -42,6 +42,15 @@ */ String[] method() default {}; + /** + * The localization key for the description of the method. + * If present, will generate a comment in-line on the wiki when it appears. + * If it is an empty string, will not generate anything. + * + * @return localization key for the recipe builder method description + */ + String description() default ""; + /** * An array of all fields this method modifies. By default, it checks for a field with the same name as the method. * diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderRegistrationMethod.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderRegistrationMethod.java index 7c3e0bd00..12aef26f6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderRegistrationMethod.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderRegistrationMethod.java @@ -44,6 +44,18 @@ */ String[] method() default {}; + /** + * The localization key for the description of the return method, will default to generating + * + *
    groovyscript.wiki.recipe_builder.register + *
    groovyscript.wiki.recipe_builder.register_return + *
    + *
    depending on if the recipe builder returns a non-void value. + * + * @return localization key for the recipe builder return method + */ + String description() default ""; + /** * Hierarchy of the property, relative to other properties applying to the same method. * Annotations on methods that return {@link Object} are of lower priority by default. diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java index 02bccbc84..4933cf2b5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java @@ -279,63 +279,70 @@ public String documentMethods() { } public String documentRegistration() { - StringBuilder out = new StringBuilder(); if (registrationMethods.isEmpty()) { GroovyLog.get().warn("Couldn't find any registration methods for recipe builder '{}'", location); - } else { - for (var registerMethod : registrationMethods) { - out.append("- "); + return ""; + } + StringBuilder out = new StringBuilder(); + for (var registerMethod : registrationMethods) { + out.append("- "); + var desc = registerMethod.annotation().description(); + if (desc.isEmpty()) { String returnType = registerMethod.method().getAnnotatedReturnType().getType().getTypeName(); - if ("void".equals(returnType) || "null".equals(returnType)) out.append(I18n.format("groovyscript.wiki.recipe_builder.register")); - else out.append(I18n.format("groovyscript.wiki.recipe_builder.register_return", returnType)); - out.append("\n\n"); - out.append(new CodeBlockBuilder().line(String.format("%s()", registerMethod.method().getName())).indentation(1).toString()); - } + boolean hasNoReturnValue = "void".equals(returnType) || "null".equals(returnType); + out.append( + hasNoReturnValue + ? I18n.format("groovyscript.wiki.recipe_builder.register") + : I18n.format("groovyscript.wiki.recipe_builder.register_return", returnType)); + } else out.append(LangHelper.translate(desc)); + out.append("\n\n"); + out.append(new CodeBlockBuilder().line(String.format("%s()", registerMethod.method().getName())).indentation(1).toString()); } return out.toString(); } public StringBuilder documentFields() { StringBuilder out = new StringBuilder(); - fields.values() - .stream() - .sorted(ComparisonHelper::field) - .filter(FieldDocumentation::isUsed) - .forEach(fieldDocumentation -> { - - out.append(fieldDocumentation.getDescription()); - - if (fieldDocumentation.hasComparison()) { - var value = fieldDocumentation.getComparison(); - if (!value.isEmpty()) out.append(" ").append(I18n.format("groovyscript.wiki.requires", value)); - } + var list = new ArrayList<>(fields.values()); + list.sort(ComparisonHelper::field); + for (FieldDocumentation fieldDocumentation : list) { + if (!fieldDocumentation.isUsed()) continue; - if (fieldDocumentation.hasRequirement()) { - var value = fieldDocumentation.getRequirement(); - if (!value.isEmpty()) out.append(" ").append(I18n.format("groovyscript.wiki.requires", value)); - } + out.append(fieldDocumentation.getDescription()); - if (fieldDocumentation.hasDefaultValue()) { - var value = fieldDocumentation.getDefaultValue(); - if (!value.isEmpty()) out.append(" ").append(I18n.format("groovyscript.wiki.default", value)); - } + if (fieldDocumentation.hasComparison()) { + var value = fieldDocumentation.getComparison(); + if (!value.isEmpty()) out.append(" ").append(I18n.format("groovyscript.wiki.requires", value)); + } + if (fieldDocumentation.hasRequirement()) { + var value = fieldDocumentation.getRequirement(); + if (!value.isEmpty()) out.append(" ").append(I18n.format("groovyscript.wiki.requires", value)); + } + if (fieldDocumentation.hasDefaultValue()) { + var value = fieldDocumentation.getDefaultValue(); + if (!value.isEmpty()) out.append(" ").append(I18n.format("groovyscript.wiki.default", value)); + } - out.append("\n\n"); + out.append("\n\n"); - var recipeBuilderMethods = methods.get(fieldDocumentation.getField().getName()); + var recipeBuilderMethods = methods.get(fieldDocumentation.getField().getName()); - if (recipeBuilderMethods == null || recipeBuilderMethods.isEmpty()) { - GroovyLog.get().warn("Couldn't find any methods targeting field '{}' in recipe builder '{}'", fieldDocumentation.getField().getName(), location + "." + builderMethod.getName()); - } else { - var lines = recipeBuilderMethods.stream() - .sorted(ComparisonHelper::recipeBuilderMethod) - .map(MethodAnnotation::method) - .map(DescriptorHelper::shortSignature) - .distinct() - .collect(Collectors.toList()); - out.append(new CodeBlockBuilder().line(lines).indentation(1).toString()); - } - }); + if (recipeBuilderMethods == null || recipeBuilderMethods.isEmpty()) { + GroovyLog.get().warn("Couldn't find any methods targeting field '{}' in recipe builder '{}'", fieldDocumentation.getField().getName(), location + "." + builderMethod.getName()); + continue; + } + var lines = recipeBuilderMethods.stream() + .sorted(ComparisonHelper::recipeBuilderMethod) + .map(x -> { + var desc = x.annotation().description(); + var method = DescriptorHelper.shortSignature(x.method()); + if (desc.isEmpty()) return method; + return method + " // " + LangHelper.translate(desc); + }) + .distinct() + .collect(Collectors.toList()); + out.append(new CodeBlockBuilder().line(lines).indentation(1).toString()); + } return out; } From fb9269d85662002b915cbdf2271f49e70b79e60f Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Mon, 24 Nov 2025 20:56:31 -0800 Subject: [PATCH 75/92] reduce complexity of some field doc code --- .../groovyscript/documentation/Builder.java | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java index 4933cf2b5..827cbc0ca 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java @@ -19,10 +19,7 @@ import java.lang.reflect.Method; import java.util.*; import java.util.concurrent.ConcurrentHashMap; -import java.util.function.BiPredicate; -import java.util.function.Consumer; -import java.util.function.Function; -import java.util.function.Predicate; +import java.util.function.*; import java.util.regex.Matcher; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -310,18 +307,9 @@ public StringBuilder documentFields() { out.append(fieldDocumentation.getDescription()); - if (fieldDocumentation.hasComparison()) { - var value = fieldDocumentation.getComparison(); - if (!value.isEmpty()) out.append(" ").append(I18n.format("groovyscript.wiki.requires", value)); - } - if (fieldDocumentation.hasRequirement()) { - var value = fieldDocumentation.getRequirement(); - if (!value.isEmpty()) out.append(" ").append(I18n.format("groovyscript.wiki.requires", value)); - } - if (fieldDocumentation.hasDefaultValue()) { - var value = fieldDocumentation.getDefaultValue(); - if (!value.isEmpty()) out.append(" ").append(I18n.format("groovyscript.wiki.default", value)); - } + out.append(FieldDocumentation.documentValue(fieldDocumentation::hasComparison, fieldDocumentation::getComparison, "groovyscript.wiki.requires")); + out.append(FieldDocumentation.documentValue(fieldDocumentation::hasRequirement, fieldDocumentation::getRequirement, "groovyscript.wiki.requires")); + out.append(FieldDocumentation.documentValue(fieldDocumentation::hasDefaultValue, fieldDocumentation::getDefaultValue, "groovyscript.wiki.default")); out.append("\n\n"); @@ -462,6 +450,14 @@ public FieldDocumentation(Field field, List annotations, String langLo this.firstAnnotation = annotations.get(0); } + private static String documentValue(BooleanSupplier check, Supplier string, String langKey) { + if (check.getAsBoolean()) { + var value = string.get(); + if (!value.isEmpty()) return " " + I18n.format(langKey, value); + } + return ""; + } + private static String parseComparisonRequirements(Comp comp, EnumSet usedTypes) { return usedTypes.stream().sorted().map(type -> LangHelper.translate(type.getKey(), switch (type) { case GT -> comp.gt(); From 61565b2ab5b0423da1f90dce3f46d191e0506d3b Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 25 Nov 2025 14:27:22 -0800 Subject: [PATCH 76/92] ensure period in custom register description --- .../com/cleanroommc/groovyscript/documentation/Builder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java index 827cbc0ca..86879c34f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java @@ -291,7 +291,7 @@ public String documentRegistration() { hasNoReturnValue ? I18n.format("groovyscript.wiki.recipe_builder.register") : I18n.format("groovyscript.wiki.recipe_builder.register_return", returnType)); - } else out.append(LangHelper.translate(desc)); + } else out.append(LangHelper.ensurePeriod(LangHelper.translate(desc))); out.append("\n\n"); out.append(new CodeBlockBuilder().line(String.format("%s()", registerMethod.method().getName())).indentation(1).toString()); } From 59e042cd46f197d798478543d21849ca313f413a Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 25 Nov 2025 14:38:53 -0800 Subject: [PATCH 77/92] document content builders --- .../generated/minecraft_generated.groovy | 27 ++++++- .../groovyscript/compat/content/Content.java | 28 ++++--- .../compat/content/GroovyBlock.java | 36 +++++++++ .../compat/content/GroovyFluid.java | 73 ++++++++++++++++++- .../compat/content/GroovyItem.java | 26 +++++++ .../assets/groovyscript/lang/en_us.lang | 62 ++++++++++++++++ 6 files changed, 237 insertions(+), 15 deletions(-) diff --git a/examples/preInit/generated/minecraft_generated.groovy b/examples/preInit/generated/minecraft_generated.groovy index 89dc5faa4..1ced83d5f 100644 --- a/examples/preInit/generated/minecraft_generated.groovy +++ b/examples/preInit/generated/minecraft_generated.groovy @@ -15,6 +15,32 @@ log 'running Vanilla Minecraft example' content.setDefaultCreativeTab(content.createCreativeTab('groovyscript.example_creative_tab', _ -> item('groovyscriptdev:heartofauniverse'))) +content.createItem('heartofauniverse') + .setRarity(EnumRarity.EPIC) + .setMaxStackSize(1) + .register() + +content.createItem('clay_2') + .setMaxStackSize(5) + .setRarity(EnumRarity.RARE) + .register() + +content.createItem('clay_3') + .setCreativeTab(creativeTab('misc')) + .setEnchantedEffect() + .register() + +content.createBlock('generic_block') + .register() + + +content.createFluid('amongium') + .setMetalTexture() + .setColor(0x00FF00) + .register() + + +content.createCreativeTab('groovyscript.other_tab_clay', _ -> item('minecraft:clay')) content.registerItem('snack', (new ItemFood(20, 10, false) { protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) { if (!worldIn.isRemote) { @@ -46,4 +72,3 @@ content.registerBlock('dragon_egg_lamp', (new Block(blockMaterial('redstone_ligh return BlockFaceShape.UNDEFINED } }).setLightLevel(1.0F)) -content.createCreativeTab('groovyscript.other_tab_clay', _ -> item('minecraft:clay')) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java b/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java index 04c232093..a5eb56af1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java @@ -22,7 +22,7 @@ import java.util.function.Supplier; -@RegistryDescription(location = LoadStage.PRE_INIT, category = RegistryDescription.Category.CUSTOM) +@RegistryDescription(location = LoadStage.PRE_INIT, category = RegistryDescription.Category.CUSTOM, priority = 500) public class Content extends NamedRegistry { public CreativeTabs defaultTab; @@ -60,23 +60,23 @@ public void registerBlock(String name, Block block, ItemBlock item) { @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example(value = """ 'dragon_egg_lamp', (new Block(blockMaterial('redstone_light')) { protected static final AxisAlignedBB DRAGON_EGG_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 1.0D, 0.9375D) - + AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return DRAGON_EGG_AABB } - + boolean isOpaqueCube(IBlockState state) { return false } - + boolean isFullCube(IBlockState state) { return false } - + boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { return true } - + BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { return BlockFaceShape.UNDEFINED } @@ -94,23 +94,31 @@ public void registerFluid(Fluid fluid) { FluidRegistry.registerFluid(fluid); } + @RecipeBuilderDescription(example = { + @Example("('heartofauniverse').setRarity(EnumRarity.EPIC).setMaxStackSize(1)"), + @Example("('clay_2').setMaxStackSize(5).setRarity(EnumRarity.RARE)"), + @Example("('clay_3').setCreativeTab(creativeTab('misc')).setEnchantedEffect()") + }) public GroovyItem createItem(String name) { return new GroovyItem(name); } + @RecipeBuilderDescription(description = "groovyscript.wiki.minecraft.content.createBlock.description0") public GroovyBlock createBlock(String name, Material material) { return new GroovyBlock(name, material); } + @RecipeBuilderDescription(description = "groovyscript.wiki.minecraft.content.createBlock.description1", example = @Example("('generic_block')")) public GroovyBlock createBlock(String name) { return new GroovyBlock(name, Material.ROCK); } + @RecipeBuilderDescription(example = @Example("('amongium').setMetalTexture().setColor(0x00FF00)")) public GroovyFluid.Builder createFluid(String name) { return new GroovyFluid.Builder(name); } - @MethodDescription(type = MethodDescription.Type.ADDITION) + @MethodDescription(type = MethodDescription.Type.ADDITION, priority = 500) public CreativeTabs createCreativeTab(String name, ItemStack icon) { return new CreativeTabs(name) { @@ -121,7 +129,7 @@ public CreativeTabs createCreativeTab(String name, ItemStack icon) { }; } - @MethodDescription(type = MethodDescription.Type.ADDITION) + @MethodDescription(type = MethodDescription.Type.ADDITION, priority = 500) public CreativeTabs createCreativeTab(String name, Supplier icon) { return new CreativeTabs(name) { @@ -132,7 +140,7 @@ public CreativeTabs createCreativeTab(String name, Supplier icon) { }; } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'groovyscript.other_tab_clay', _ -> item('minecraft:clay')")) + @MethodDescription(type = MethodDescription.Type.ADDITION, priority = 500, example = @Example("'groovyscript.other_tab_clay', _ -> item('minecraft:clay')")) public CreativeTabs createCreativeTab(String name, Closure icon) { return new CreativeTabs(name) { @@ -143,7 +151,7 @@ public CreativeTabs createCreativeTab(String name, Closure icon) { }; } - @MethodDescription(type = MethodDescription.Type.ADDITION) + @MethodDescription(type = MethodDescription.Type.ADDITION, priority = 500) public CreativeTabs createCreativeTab(String name, Item icon) { return createCreativeTab(name, new ItemStack(icon)); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyBlock.java b/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyBlock.java index d7f9ebbfa..4c17c5b27 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyBlock.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyBlock.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.GroovyScript; import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; import com.cleanroommc.groovyscript.helper.JsonHelper; import com.cleanroommc.groovyscript.sandbox.FileUtil; @@ -26,6 +27,40 @@ import java.io.File; import java.util.Map; +@Property(property = "displayOnCreativeTab") +//@Property(property = "fullBlock")//fieldOnly +@Property(property = "lightOpacity") +//@Property(property = "translucent")//fieldOnly +@Property(property = "lightValue") +//@Property(property = "useNeighborBrightness")//protected fieldOnly +@Property(property = "blockHardness", defaultValue = "2.0f") +@Property(property = "blockResistance", defaultValue = "10.0f") +//@Property(property = "enableStats")//protected +@Property(property = "needsRandomTick") +//@Property(property = "hasTileEntity")//protected fieldOnly +@Property(property = "blockSoundType", defaultValue = "SoundType.STONE") +//@Property(property = "blockParticleGravity")//fieldOnly +//@Property(property = "slipperiness")//not a builder method +//@Property(property = "defaultBlockState")//protected and not a builder method +@Property(property = "translationKey", defaultValue = "registryName", value = "groovyscript.wiki.minecraft.content.item.translationKey.value") +@RecipeBuilderOverride(method = { + @RecipeBuilderMethodDescription(method = "setSoundType", field = "blockSoundType"), + @RecipeBuilderMethodDescription(method = "setLightOpacity", field = "lightOpacity"), + @RecipeBuilderMethodDescription(method = "setLightLevel", field = "lightValue"),//15x float + @RecipeBuilderMethodDescription(method = "setResistance", field = "blockResistance"),//3x float + @RecipeBuilderMethodDescription(method = "setHardness", field = { + "blockHardness", "blockResistance" + }, description = "groovyscript.wiki.minecraft.content.block.setHardness.description"),//block resistance is increased to hardness*5 + @RecipeBuilderMethodDescription(method = "setBlockUnbreakable", field = { + "blockHardness", "blockResistance" + }, description = "groovyscript.wiki.minecraft.content.block.setBlockUnbreakable.description"), + @RecipeBuilderMethodDescription(method = "setTickRandomly", field = "needsRandomTick"), + @RecipeBuilderMethodDescription(method = "setTranslationKey", field = "translationKey"), +// @RecipeBuilderMethodDescription(method = "setDefaultState", field = "defaultBlockState"),//protected and not a builder method +// @RecipeBuilderMethodDescription(method = "disableStats", field = "enableStats"),//protected +// @RecipeBuilderMethodDescription(method = "setDefaultSlipperiness", field = "slipperiness"),//not a builder method + @RecipeBuilderMethodDescription(method = "setCreativeTab", field = "displayOnCreativeTab"), +}) public class GroovyBlock extends Block { private static boolean initialised; @@ -103,6 +138,7 @@ public GroovyBlock(String name, Material blockMaterialIn) { } } + @RecipeBuilderRegistrationMethod(description = "groovyscript.wiki.minecraft.content.block.register.description") public GroovyBlock register() { register(this, this.itemBlock); return this; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyFluid.java b/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyFluid.java index eb8807b2b..964a6c478 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyFluid.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyFluid.java @@ -2,6 +2,9 @@ import com.cleanroommc.groovyscript.GroovyScript; import com.cleanroommc.groovyscript.api.GroovyBlacklist; +import com.cleanroommc.groovyscript.api.documentation.annotations.Property; +import com.cleanroommc.groovyscript.api.documentation.annotations.RecipeBuilderMethodDescription; +import com.cleanroommc.groovyscript.api.documentation.annotations.RecipeBuilderRegistrationMethod; import com.cleanroommc.groovyscript.helper.JsonHelper; import com.cleanroommc.groovyscript.sandbox.FileUtil; import com.google.gson.JsonObject; @@ -34,6 +37,10 @@ public class GroovyFluid extends Fluid { private static final List fluidBlocks = new ArrayList<>(); private static final List fluids = new ArrayList<>(); + public GroovyFluid(String fluidName, ResourceLocation still, ResourceLocation flowing, @Nullable ResourceLocation overlay, int color) { + super(fluidName, still, flowing, overlay, color); + } + @GroovyBlacklist @ApiStatus.Internal public static void initBlocks(IForgeRegistry registry) { @@ -65,10 +72,6 @@ public static void registerModels() { } } - public GroovyFluid(String fluidName, ResourceLocation still, ResourceLocation flowing, @Nullable ResourceLocation overlay, int color) { - super(fluidName, still, flowing, overlay, color); - } - private static void checkBlockState(ResourceLocation loc) { File file = FileUtil.makeFile(GroovyScript.getResourcesFile().getPath(), loc.getNamespace(), "blockstates", loc.getPath() + ".json"); if (!file.exists()) { @@ -93,116 +96,178 @@ private static void checkBlockState(ResourceLocation loc) { public static class Builder { private final String name; + @Property(defaultValue = "DEFAULT_STILL") private ResourceLocation still = DEFAULT_STILL; + @Property(defaultValue = "DEFAULT_FLOWING") private ResourceLocation flowing = DEFAULT_FLOWING; + @Property private ResourceLocation overlay; + @Property(defaultValue = "0xFFFFFF") private int color = 0xFFFFFF; + @Property private SoundEvent fillSound; + @Property private SoundEvent emptySound; + @Property private int luminosity; + @Property(defaultValue = "1000") private int density = 1000; + @Property(defaultValue = "300") private int temperature = 300; + @Property(defaultValue = "1000") private int viscosity = 1000; + @Property private boolean isGaseous; + @Property(defaultValue = "EnumRarity.COMMON") private EnumRarity rarity = EnumRarity.COMMON; + @Property(defaultValue = "blockMaterial('water')") private Material material = Material.WATER; + @Property(defaultValue = "true") private boolean createBlock = true; + @Property private boolean finiteFluidBlock; public Builder(String name) { this.name = name; } + @RecipeBuilderMethodDescription(field = "still") public Builder setStill(ResourceLocation still) { this.still = still; return this; } + @RecipeBuilderMethodDescription(field = "flowing") public Builder setFlowing(ResourceLocation flowing) { this.flowing = flowing; return this; } + @RecipeBuilderMethodDescription(field = "overlay") public Builder setOverlay(ResourceLocation overlay) { this.overlay = overlay; return this; } + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.minecraft.content.fluid.setTexture0.description", field = { + "still", "flowing" + }) public Builder setTexture(ResourceLocation still, ResourceLocation flowing) { return setStill(still).setFlowing(flowing); } + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.minecraft.content.fluid.setTexture1.description", field = { + "still", "flowing", "overlay" + }) public Builder setTexture(ResourceLocation still, ResourceLocation flowing, @Nullable ResourceLocation overlay) { return setStill(still).setFlowing(flowing).setOverlay(overlay); } + @RecipeBuilderMethodDescription(priority = 100, field = { + "still", "flowing" + }) public Builder setDefaultTexture() { return setTexture(DEFAULT_STILL, DEFAULT_FLOWING); } + @RecipeBuilderMethodDescription(priority = 500, field = { + "still", "flowing" + }) public Builder setMetalTexture() { return setTexture(METAL_STILL, METAL_FLOWING); } + @RecipeBuilderMethodDescription(field = "color") public Builder setColor(int color) { this.color = color; return this; } + @RecipeBuilderMethodDescription(priority = 500, field = "fillSound") + public Builder setFillSound(SoundEvent fillSound) { + this.fillSound = fillSound; + return this; + } + + @RecipeBuilderMethodDescription(priority = 500, field = "emptySound") + public Builder setEmptySound(SoundEvent emptySound) { + this.emptySound = emptySound; + return this; + } + + @RecipeBuilderMethodDescription(field = { + "fillSound", "emptySound" + }) public Builder setSound(SoundEvent fillSound, SoundEvent emptySound) { this.fillSound = fillSound; this.emptySound = emptySound; return this; } + @RecipeBuilderMethodDescription(field = "luminosity") public Builder setLuminosity(int luminosity) { this.luminosity = luminosity; return this; } + @RecipeBuilderMethodDescription(field = "density") public Builder setDensity(int density) { this.density = density; return this; } + @RecipeBuilderMethodDescription(field = "temperature") public Builder setTemperature(int temperature) { this.temperature = temperature; return this; } + @RecipeBuilderMethodDescription(field = "viscosity") public Builder setViscosity(int viscosity) { this.viscosity = viscosity; return this; } + @RecipeBuilderMethodDescription(field = "isGaseous") public Builder setGaseous(boolean gaseous) { isGaseous = gaseous; return this; } + @RecipeBuilderMethodDescription(field = "rarity") public Builder setRarity(EnumRarity rarity) { this.rarity = rarity; return this; } + @RecipeBuilderMethodDescription(field = "material") public Builder setWaterMaterial() { this.material = Material.WATER; return this; } + @RecipeBuilderMethodDescription(field = "material") public Builder setLavaMaterial() { this.material = Material.LAVA; return this; } + @RecipeBuilderMethodDescription(field = "createBlock") public Builder noBlock() { this.createBlock = false; return this; } + @RecipeBuilderMethodDescription(field = "finiteFluidBlock") + public Builder isFinite() { + this.finiteFluidBlock = true; + return this; + } + + @RecipeBuilderRegistrationMethod(description = "groovyscript.wiki.minecraft.content.fluid.register.description") public Fluid register() { this.color |= 0xFF << 24; String mod = GroovyScript.getRunConfig().getPackId(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyItem.java b/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyItem.java index d08330bcd..d82552d40 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyItem.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyItem.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.GroovyScript; import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; import com.cleanroommc.groovyscript.helper.JsonHelper; import com.cleanroommc.groovyscript.sandbox.FileUtil; @@ -22,6 +23,24 @@ import java.io.File; import java.util.Map; +@Property(property = "maxStackSize", defaultValue = "64") +@Property(property = "hasSubtypes") +@Property(property = "maxDamage") +@Property(property = "bFull3D") +@Property(property = "translationKey", defaultValue = "registryName", value = "groovyscript.wiki.minecraft.content.block.translationKey.value") +@Property(property = "containerItem")//getContainerItem(ItemStack) // should we add overrides for the ItemStack version? +@Property(property = "tabToDisplayOn", defaultValue = "content.getDefaultTab()") +@Property(property = "canRepair", defaultValue = "true") +@RecipeBuilderOverride(method = { + @RecipeBuilderMethodDescription(method = "setMaxStackSize", field = "maxStackSize"), + @RecipeBuilderMethodDescription(method = "setHasSubtypes", field = "hasSubtypes"), + @RecipeBuilderMethodDescription(method = "setMaxDamage", field = "maxDamage"), + @RecipeBuilderMethodDescription(method = "setFull3D", field = "bFull3D"), + @RecipeBuilderMethodDescription(method = "setTranslationKey", field = "translationKey"), + @RecipeBuilderMethodDescription(method = "setContainerItem", field = "containerItem"), + @RecipeBuilderMethodDescription(method = "setCreativeTab", field = "tabToDisplayOn"), + @RecipeBuilderMethodDescription(method = "setNoRepair", field = "canRepair"), +}) public class GroovyItem extends Item { private static boolean initialised; @@ -71,8 +90,11 @@ public static void initItems(IForgeRegistry registry) { initialised = true; } + @Property private boolean effect; + @Property private int enchantability; + @Property private IRarity rarity; public GroovyItem(String loc) { @@ -82,21 +104,25 @@ public GroovyItem(String loc) { } } + @RecipeBuilderMethodDescription(field = "effect") public GroovyItem setEnchantedEffect() { this.effect = true; return this; } + @RecipeBuilderMethodDescription(field = "enchantability") public GroovyItem setEnchantability(int enchantability) { this.enchantability = enchantability; return this; } + @RecipeBuilderMethodDescription(field = "rarity") public GroovyItem setRarity(IRarity rarity) { this.rarity = rarity; return this; } + @RecipeBuilderRegistrationMethod(description = "groovyscript.wiki.minecraft.content.item.register.description") public GroovyItem register() { registerItem(this); return this; diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index 1a3956abf..cf1c5e21b 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -223,6 +223,68 @@ groovyscript.wiki.minecraft.content.createCreativeTab=Create a creative tab with groovyscript.wiki.minecraft.content.setDefaultCreativeTab=Sets the default Creative Tab used when registering items through GroovyScript groovyscript.wiki.minecraft.content.getDefaultTab=Get the default Creative Tab for GroovyScript, which is set by `setDefaultCreativeTab` +groovyscript.wiki.minecraft.content.createBlock.title=Create Custom Block +groovyscript.wiki.minecraft.content.createBlock.description0=Create a GroovyBlock with the given name and material +groovyscript.wiki.minecraft.content.createBlock.description1=Create a GroovyBlock with the given name with the material `Material.ROCK` +groovyscript.wiki.minecraft.content.createFluid.title=Create Custom Fluid +groovyscript.wiki.minecraft.content.createFluid.description=Create a GroovyFluid with the given name +groovyscript.wiki.minecraft.content.createItem.title=Create Custom Item +groovyscript.wiki.minecraft.content.createItem.description=Create a GroovyItem with the given name + +groovyscript.wiki.minecraft.content.rarity.value=Sets the rarity this will be is displayed as, primarily impacts the color of its name + +# Item +groovyscript.wiki.minecraft.content.tabToDisplayOn.value=Sets the Creative Tab the item should display on +groovyscript.wiki.minecraft.content.maxStackSize.value=Sets the max stack size of the item +groovyscript.wiki.minecraft.content.maxDamage.value=Sets the max damage of the item, used as durability for tools +groovyscript.wiki.minecraft.content.bFull3D.value=Sets if the items render the object in full 3D, like tools +groovyscript.wiki.minecraft.content.hasSubtypes.value=Sets if the item has subtypes, like dyes or terracotta +groovyscript.wiki.minecraft.content.containerItem.value=Sets the Container Item, which will replace this item when it breaks +groovyscript.wiki.minecraft.content.canRepair.value=Sets if the item can be repaired, typically by combining two of the same item in the crafting grid +groovyscript.wiki.minecraft.content.effect.value=Sets if the item has the shimmer effect, typically associated with potions or enchantments +groovyscript.wiki.minecraft.content.enchantability.value=Sets the enchantability level +groovyscript.wiki.minecraft.content.item.translationKey.value=Sets the base String used for translation. Prefixed by `item.` and checks the suffix `.name` for the item display name +groovyscript.wiki.minecraft.content.item.register.description=Registers the Item and returns itself (returns `GroovyItem`) + +# Block +groovyscript.wiki.minecraft.content.displayOnCreativeTab.value=Sets the Creative Tab the item representing the block should be displayed on +groovyscript.wiki.minecraft.content.fullBlock.value=Sets if the block is a full block +groovyscript.wiki.minecraft.content.lightOpacity.value=Sets how much light is subtracted for going through this block +groovyscript.wiki.minecraft.content.translucent.value=Sets if the block is translucent +groovyscript.wiki.minecraft.content.lightValue.value=Sets how much light the block emits, multiplied by 15 +#groovyscript.wiki.minecraft.content.useNeighborBrightness.value=fieldOnly +groovyscript.wiki.minecraft.content.blockHardness.value=Sets the difficulty of the block to break, primarily affecting the speed to break. A hardness of `0` will cause no durability loss, and a hardness of `-1` will be unbreakable +groovyscript.wiki.minecraft.content.blockResistance.value=Sets the explosion resistance of the block +#groovyscript.wiki.minecraft.content.enableStats.value=fieldOnly #Sets if the block is counted for the stats page +groovyscript.wiki.minecraft.content.needsRandomTick.value=Sets if the block has random ticks +groovyscript.wiki.minecraft.content.blockSoundType.value=Sets the sound played when stepping on the block +#groovyscript.wiki.minecraft.content.blockParticleGravity.value=fieldOnly +groovyscript.wiki.minecraft.content.defaultBlockState.value=Sets the default `IBlockState` for the block +groovyscript.wiki.minecraft.content.block.translationKey.value=Sets the base String used for translation. Prefixed by `tile.` and checks the suffix `.name` for the block display name +groovyscript.wiki.minecraft.content.block.setHardness.description=Also increases block resistance to itself * 5 +groovyscript.wiki.minecraft.content.block.setBlockUnbreakable.description=Makes the block unbreakable by setting hardness to -1.0f +groovyscript.wiki.minecraft.content.block.register.description=Registers the Block and a corresponding ItemBlock and returns itself (returns `GroovyBlock`) + +# Fluid +groovyscript.wiki.minecraft.content.still.value=Sets the texture used for when the fluid is still +groovyscript.wiki.minecraft.content.flowing.value=Sets the texture used for when the fluid is flowing +groovyscript.wiki.minecraft.content.overlay.value=Sets the texture used as an overlay for the fluid +groovyscript.wiki.minecraft.content.color.value=Sets the color of the fluid +groovyscript.wiki.minecraft.content.fillSound.value=Sets the sound played when the fluid is picked up +groovyscript.wiki.minecraft.content.emptySound.value=Sets the sound played when the fluid is emptied out +groovyscript.wiki.minecraft.content.luminosity.value=Sets how much light the fluid produces +groovyscript.wiki.minecraft.content.density.value=Sets the density of the fluid, which controls what other fluids it can displace +groovyscript.wiki.minecraft.content.temperature.value=Sets the temperature of the fluid +groovyscript.wiki.minecraft.content.viscosity.value=Sets the viscosity of the fluid, which impacts how fast the fluid spreads +groovyscript.wiki.minecraft.content.isGaseous.value=Sets if the fluid is gaseous, typically indicating a negative density +groovyscript.wiki.minecraft.content.material.value=Sets the material the block has, if a block is created +groovyscript.wiki.minecraft.content.createBlock.value=Sets if the fluid creates a block +groovyscript.wiki.minecraft.content.finiteFluidBlock.value=Sets if the fluid is a finite block, if a block is created +groovyscript.wiki.minecraft.content.fluid.setTexture0.description=still, flowing +groovyscript.wiki.minecraft.content.fluid.setTexture1.description=still, flowing, overlay +groovyscript.wiki.minecraft.content.fluid.register.description=Registers the Fluid and returns the registered Fluid (returns `Fluid`) + + # In-World Crafting groovyscript.wiki.in_world_crafting.chances.value=Sets the chance each input has to be consumed groovyscript.wiki.in_world_crafting.chances.required=exactly equal to the number of elements in `input` From cc455f5d5be817e97a72290d4ed2ec053358fb04 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 25 Nov 2025 16:30:27 -0800 Subject: [PATCH 78/92] remove trailing newlines on index files --- .../com/cleanroommc/groovyscript/documentation/Exporter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index 1bcd741ee..bc2ba0059 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -30,7 +30,7 @@ public class Exporter { private static final String INDEX_FILE_NAME = "index" + MARKDOWN_FILE_EXTENSION; private static final String NAV_FILE_NAME = "!navigation" + MARKDOWN_FILE_EXTENSION; private static final String EXAMPLE_GENERATION_NOTE = "// Auto generated groovyscript example file\n"; - private static final String INDEX_FILE_TEXT = "---\n%s\n---\n\n\n%s%s\n\n"; + private static final String INDEX_FILE_TEXT = "---\n%s\n---\n\n\n%s%s"; private static final String BULLET_POINT_LINK = "* [%s](./%s)"; private static final String NAVIGATION_FILE_TEXT = "---\nsearch:\n exclude: true\n---\n\n\n" + BULLET_POINT_LINK + "\n%s"; From dc56f19a2b7105b0047d752dc0bc32605478aa52 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 25 Nov 2025 16:31:42 -0800 Subject: [PATCH 79/92] sort classes that skipped documentation --- .../com/cleanroommc/groovyscript/documentation/Exporter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index bc2ba0059..107cbc155 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -20,6 +20,7 @@ import java.io.InputStream; import java.nio.file.Files; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.function.Predicate; @@ -134,7 +135,9 @@ private static String getImportBlock(List imports) { public static void logSkippedClasses() { if (SKIPPED_CLASSES.isEmpty()) return; GroovyLog.Msg log = GroovyLog.msg("Skipped documenting the following potentially valid locations (this may be the correct behavior!)"); - SKIPPED_CLASSES.forEach((key, value) -> log.add(key + ": " + value.getName())); + SKIPPED_CLASSES.entrySet().stream() + .sorted(Map.Entry.comparingByKey(ComparisonHelper::packages)) + .forEach(x -> log.add(x.getKey() + ": " + x.getValue().getName())); log.debug().post(); SKIPPED_CLASSES.clear(); } From 0605e86cfa5bc374573eeb2e182016b63df4c2ac Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 25 Nov 2025 18:19:51 -0800 Subject: [PATCH 80/92] add method descriptions to more places --- .../mods/actuallyadditions/Empowerer.java | 35 +++++++------------ .../compat/mods/alchemistry/Dissolver.java | 10 +++--- .../astralsorcery/ChaliceInteraction.java | 8 ++--- .../botaniatweaks/AgglomerationPlate.java | 2 +- .../extendedcrafting/EnderRecipeBuilder.java | 10 +++--- .../compat/mods/projecte/Transmutation.java | 2 +- .../compat/mods/roots/Mortar.java | 4 +-- .../AbstractCraftingRecipeBuilder.java | 4 +-- .../assets/groovyscript/lang/en_us.lang | 14 ++++++-- 9 files changed, 45 insertions(+), 44 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java index ef95133fb..fb346cc76 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java @@ -13,7 +13,6 @@ import net.minecraft.item.crafting.Ingredient; import org.jetbrains.annotations.Nullable; -import java.awt.*; import java.util.Collection; @RegistryDescription @@ -97,48 +96,40 @@ public RecipeBuilder energy(int energy) { return this; } - @RecipeBuilderMethodDescription public RecipeBuilder time(int time) { this.time = time; return this; } - @RecipeBuilderMethodDescription(field = { + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.actuallyadditions.empowerer.color_var.description", field = { "red", "green", "blue" }) - public RecipeBuilder particleColor(float... color) { - if (color.length != 3) { - GroovyLog.get().warn("Error setting color in Actually Additions Empowerer recipe. color must contain 3 floats, yet it contained {}", color.length); - return this; - } - this.red = color[0]; - this.green = color[1]; - this.blue = color[2]; + public RecipeBuilder particleColor(float red, float green, float blue) { + this.red = red; + this.green = green; + this.blue = blue; return this; } - @RecipeBuilderMethodDescription(field = { + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.actuallyadditions.empowerer.color_var.description", field = { "red", "green", "blue" }) - public RecipeBuilder color(float... color) { - return this.particleColor(color); + public RecipeBuilder color(float red, float green, float blue) { + return this.particleColor(red, green, blue); } - - @RecipeBuilderMethodDescription(field = { + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.actuallyadditions.empowerer.color_hex.description", field = { "red", "green", "blue" }) public RecipeBuilder particleColor(int hex) { - Color color = new Color(hex); - this.red = color.getRed() / 255.0f; - this.green = color.getGreen() / 255.0f; - this.blue = color.getBlue() / 255.0f; + this.red = ((hex >> 16) & 0xFF) / 255.0f; + this.green = ((hex >> 8) & 0xFF) / 255.0f; + this.blue = ((hex >> 0) & 0xFF) / 255.0f; return this; } - - @RecipeBuilderMethodDescription(field = { + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.actuallyadditions.empowerer.color_hex.description", field = { "red", "green", "blue" }) public RecipeBuilder color(int hex) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Dissolver.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Dissolver.java index ca30bcf03..3b862f4af 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Dissolver.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Dissolver.java @@ -68,7 +68,7 @@ public RecipeBuilder probabilityOutput(double probability, ItemStack... probabil return this; } - @RecipeBuilderMethodDescription(field = "probabilityGroup") + @RecipeBuilderMethodDescription(field = "probabilityGroup", description = "groovyscript.wiki.probability_default.description") public RecipeBuilder probabilityOutput(ItemStack... probabilityOutputs) { return this.probabilityOutput(100, probabilityOutputs); } @@ -79,25 +79,25 @@ public RecipeBuilder probabilityOutput(double probability, Collection return this; } - @RecipeBuilderMethodDescription(field = "probabilityGroup") + @RecipeBuilderMethodDescription(field = "probabilityGroup", description = "groovyscript.wiki.probability_default.description") public RecipeBuilder probabilityOutput(Collection probabilityOutputs) { return this.probabilityOutput(100, probabilityOutputs); } @Override - @RecipeBuilderMethodDescription(field = "probabilityGroup") + @RecipeBuilderMethodDescription(field = "probabilityGroup", description = "groovyscript.wiki.probability_default.description") public RecipeBuilder output(ItemStack probabilityOutputs) { return this.probabilityOutput(100, probabilityOutputs); } @Override - @RecipeBuilderMethodDescription(field = "probabilityGroup") + @RecipeBuilderMethodDescription(field = "probabilityGroup", description = "groovyscript.wiki.probability_default.description") public RecipeBuilder output(ItemStack... probabilityOutputs) { return this.probabilityOutput(100, probabilityOutputs); } @Override - @RecipeBuilderMethodDescription(field = "probabilityGroup") + @RecipeBuilderMethodDescription(field = "probabilityGroup", description = "groovyscript.wiki.probability_default.description") public RecipeBuilder output(Collection probabilityOutputs) { return this.probabilityOutput(100, probabilityOutputs); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/ChaliceInteraction.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/ChaliceInteraction.java index 20e14d75c..4d4da8970 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/ChaliceInteraction.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/ChaliceInteraction.java @@ -101,7 +101,7 @@ public RecipeBuilder result(ItemStack item, int weight) { return this; } - @RecipeBuilderMethodDescription(field = { + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.probability_default.description", field = { "output", "probabilities" }) public RecipeBuilder result(ItemStack item) { @@ -116,14 +116,14 @@ public RecipeBuilder output(ItemStack item, int weight) { } @Override - @RecipeBuilderMethodDescription(field = { + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.probability_default.description", field = { "output", "probabilities" }) public RecipeBuilder output(ItemStack item) { return this.result(item, 1); } - @RecipeBuilderMethodDescription(field = { + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.probability_default.description", field = { "fluidInput", "chances" }) public RecipeBuilder component(FluidStack fluid, float chance) { @@ -147,7 +147,7 @@ public RecipeBuilder fluidInput(FluidStack fluid, float chance) { } @Override - @RecipeBuilderMethodDescription(field = { + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.probability_default.description", field = { "fluidInput", "chances" }) public RecipeBuilder fluidInput(FluidStack fluid) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/AgglomerationPlate.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/AgglomerationPlate.java index 948b6e888..241777f91 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/AgglomerationPlate.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/AgglomerationPlate.java @@ -125,7 +125,7 @@ public RecipeBuilder color(int colorStart, int colorEnd) { return this; } - @RecipeBuilderMethodDescription(field = { + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.botania_tweaks.agglomeration_plate.recipeBuilder.baseStructure.description",field = { "center", "edge", "corner" }) public RecipeBuilder baseStructure() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/EnderRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/EnderRecipeBuilder.java index b9db9866d..674863753 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/EnderRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/EnderRecipeBuilder.java @@ -14,15 +14,15 @@ public interface EnderRecipeBuilder { - @RecipeBuilderMethodDescription + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.time_seconds.description") EnderRecipeBuilder time(int time); - @RecipeBuilderMethodDescription(field = "time") + @RecipeBuilderMethodDescription(field = "time", description = "groovyscript.wiki.time_seconds.description") default EnderRecipeBuilder seconds(int seconds) { return this.time(seconds); } - @RecipeBuilderMethodDescription(field = "time") + @RecipeBuilderMethodDescription(field = "time", description = "groovyscript.wiki.time_ticks.description") default EnderRecipeBuilder ticks(int ticks) { return this.time(ticks * 20); } @@ -42,7 +42,7 @@ public String getRecipeNamePrefix() { } @Override - @RecipeBuilderMethodDescription + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.time_seconds.description") public Shaped time(int time) { this.time = time; return this; @@ -96,7 +96,7 @@ public String getRecipeNamePrefix() { } @Override - @RecipeBuilderMethodDescription + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.time_seconds.description") public Shapeless time(int time) { this.time = time; return this; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/projecte/Transmutation.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/projecte/Transmutation.java index 3a0f5f006..2f27acfcb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/projecte/Transmutation.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/projecte/Transmutation.java @@ -79,7 +79,7 @@ public RecipeBuilder altOutput(IBlockState altOutput) { return this; } - @RecipeBuilderMethodDescription(field = { + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.projecte.transmutation.altOutput.description", field = { "output", "altOutput" }) public RecipeBuilder output(IBlockState output, IBlockState altOutput) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Mortar.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Mortar.java index 7d9b443e8..acc573f70 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Mortar.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Mortar.java @@ -210,7 +210,7 @@ public RecipeBuilder blue(float blue) { return this; } - @RecipeBuilderMethodDescription(field = { + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.roots.mortar.recipeBuilder.color_long.description", field = { "red1", "green1", "blue1", "red2", "green2", "blue2" }) public RecipeBuilder color(float red1, float green1, float blue1, float red2, float green2, float blue2) { @@ -223,7 +223,7 @@ public RecipeBuilder color(float red1, float green1, float blue1, float red2, fl return this; } - @RecipeBuilderMethodDescription(field = { + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.roots.mortar.recipeBuilder.color.description", field = { "red1", "green1", "blue1", "red2", "green2", "blue2" }) public RecipeBuilder color(float red, float green, float blue) { diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java index 7a4d7db56..d9e0a901b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java @@ -101,13 +101,13 @@ public AbstractCraftingRecipeBuilder recipeAction(Closure recipeAction) return this; } - @RecipeBuilderMethodDescription + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.craftingrecipe.replace.replace.description") public AbstractCraftingRecipeBuilder replace() { this.replace = 1; return this; } - @RecipeBuilderMethodDescription(field = "replace") + @RecipeBuilderMethodDescription(field = "replace", description = "groovyscript.wiki.craftingrecipe.replace.replaceByName.description") public AbstractCraftingRecipeBuilder replaceByName() { this.replace = 2; return this; diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index cf1c5e21b..9ca8b2f93 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -113,6 +113,8 @@ groovyscript.wiki.craftingrecipe.keyBasedMatrix.value=Sets the items required in groovyscript.wiki.craftingrecipe.keyMap.value=Sets the item the given char corresponds to groovyscript.wiki.craftingrecipe.ingredientMatrix.value=Sets the items required in each slot in the grid as IIngredients groovyscript.wiki.craftingrecipe.ingredients.value=Sets the items required for the recipe +groovyscript.wiki.craftingrecipe.replace.replace.description=Makes the recipe remove by the ItemStack output +groovyscript.wiki.craftingrecipe.replace.replaceByName.description=Makes the recipe remove by the Resource Location name groovyscript.wiki.removeByInput=Removes all recipes that match the given input groovyscript.wiki.removeByOutput=Removes all recipes that match the given output @@ -123,6 +125,10 @@ groovyscript.wiki.removeByInputAndCatalyst=This removes all recipes that match t groovyscript.wiki.streamRecipes=Iterates through every entry in the registry, with the ability to call remove on any element to remove it groovyscript.wiki.removeAll=Removes all registered recipes +groovyscript.wiki.probability_default.description=100% chance +groovyscript.wiki.time_ticks.description=Sets the time in ticks +groovyscript.wiki.time_seconds.description=Sets the time in seconds + groovyscript.wiki.less_than=less than %s groovyscript.wiki.less_than_or_equal_to=less than or equal to %s groovyscript.wiki.equal_to=exactly %s @@ -344,6 +350,8 @@ groovyscript.wiki.actuallyadditions.empowerer.time.value=Sets the amount of time groovyscript.wiki.actuallyadditions.empowerer.red.value=Sets the red color groovyscript.wiki.actuallyadditions.empowerer.blue.value=Sets the blue color groovyscript.wiki.actuallyadditions.empowerer.green.value=Sets the green color +groovyscript.wiki.actuallyadditions.empowerer.color_hex.description=Sets the color via standardized hex code +groovyscript.wiki.actuallyadditions.empowerer.color_var.description=red, green, blue groovyscript.wiki.actuallyadditions.empowerer.mainInput.required=either defined in mainInput or in input groovyscript.wiki.actuallyadditions.nether_mining_lens.title=Nether Mining Lens @@ -1223,7 +1231,7 @@ groovyscript.wiki.botania_tweaks.agglomeration_plate.cornerReplacement.value=Set groovyscript.wiki.botania_tweaks.agglomeration_plate.removeByCenter=Removes all recipes with the given center IBlockState groovyscript.wiki.botania_tweaks.agglomeration_plate.removeByCorner=Removes all recipes with the given corner IBlockState groovyscript.wiki.botania_tweaks.agglomeration_plate.removeByEdge=Removes all recipes with the given edge IBlockState - +groovyscript.wiki.botania_tweaks.agglomeration_plate.recipeBuilder.baseStructure.description=Makes the structure the default, with livingrock and lapis blocks # Botanic Additions groovyscript.wiki.botanicadds.gaia_plate.title=Gaia Plate @@ -2525,7 +2533,7 @@ groovyscript.wiki.projecte.transmutation.description=Converts an input blockstat groovyscript.wiki.projecte.transmutation.input.value=Sets the input blockstate groovyscript.wiki.projecte.transmutation.output.value=Sets the normal output blockstate groovyscript.wiki.projecte.transmutation.altOutput.value=Sets the shift output blockstate - +groovyscript.wiki.projecte.transmutation.altOutput.description=output, altOutput # Random Things groovyscript.wiki.randomthings.anvil.title=Anvil Crafting @@ -2614,6 +2622,8 @@ groovyscript.wiki.roots.mortar.generate.value=Sets if, when input has a single I groovyscript.wiki.roots.mortar.blue2.value=Sets the blue color value of the second version of the particle spawned groovyscript.wiki.roots.mortar.removeByName=Removes the Mortar recipe with the given name groovyscript.wiki.roots.mortar.removeByOutput=Removes the Mortar recipe with the given output itemstack +groovyscript.wiki.roots.mortar.recipeBuilder.color_long.description=red1, green1, blue1, red2, green2, blue2 +groovyscript.wiki.roots.mortar.recipeBuilder.color.description=red, green, blue groovyscript.wiki.roots.moss.title=Moss groovyscript.wiki.roots.moss.description=Moss indicates a pair of items that can right click the input with a knife to turn it into the output and give a Terra Moss and right click the output with moss spores to turn it into the input. From 45865f77c0b24035ac0938862c4cabafd20b831d Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 25 Nov 2025 18:20:22 -0800 Subject: [PATCH 81/92] fix melting recipe builder --- .../recipe/MeltingRecipeBuilder.java | 23 +++++++++++-------- .../assets/groovyscript/lang/en_us.lang | 4 +++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/recipe/MeltingRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/recipe/MeltingRecipeBuilder.java index c1859affb..04c1c6dd4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/recipe/MeltingRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/recipe/MeltingRecipeBuilder.java @@ -17,8 +17,11 @@ @Property(property = "input", comp = @Comp(eq = 1)) public class MeltingRecipeBuilder extends AbstractRecipeBuilder { - @Property(defaultValue = "300", comp = @Comp(gte = 1)) - private int temp = 300; + @Property(defaultValue = "300", comp = @Comp(gte = 1, unique = "groovyscript.wiki.tconstruct.melting.time_temperature.unique")) + private int temperature = 300; + @Property(comp = @Comp(unique = "groovyscript.wiki.tconstruct.melting.time_temperature.unique")) + private int time; + private final StandardListRegistry registry; private final String recipeName; @@ -37,16 +40,15 @@ public MeltingRecipeBuilder(StandardListRegistry registry, String this.recipeName = recipeName; } - @RecipeBuilderMethodDescription(field = "temp") + @RecipeBuilderMethodDescription public MeltingRecipeBuilder temperature(int temp) { - this.temp = temp + 300; + this.temperature = temp + 300; return this; } - @RecipeBuilderMethodDescription(field = "temp") + @RecipeBuilderMethodDescription public MeltingRecipeBuilder time(int time) { - int t = fluidOutput.get(0) != null ? fluidOutput.get(0).getFluid().getTemperature() : 300; - this.temp = MeltingRecipeAccessor.invokeCalcTemperature(t, time); + this.time = time; return this; } @@ -63,9 +65,12 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { + if (time != 0 && fluidOutput.get(0) != null) { + this.temperature = MeltingRecipeAccessor.invokeCalcTemperature(fluidOutput.get(0).getFluid().getTemperature(), time); + } validateItems(msg, 1, 1, 0, 0); validateFluids(msg, 0, 0, 1, 1); - msg.add(temp < 1, "Recipe temperature must be at least 1, got " + temp); + msg.add(temperature < 1, "Recipe temperature must be at least 1, got " + temperature); } @Override @@ -75,7 +80,7 @@ public void validate(GroovyLog.Msg msg) { int amount = fluidOutput.get(0).amount; IIngredient input = this.input.get(0); RecipeMatch match = recipeMatchFromIngredient(input, amount); - MeltingRecipe recipe = new MeltingRecipe(match, fluidOutput.get(0), temp); + MeltingRecipe recipe = new MeltingRecipe(match, fluidOutput.get(0), temperature); registry.add(recipe); return recipe; } diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index 9ca8b2f93..544b92b5b 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -2908,7 +2908,9 @@ groovyscript.wiki.tconstruct.casting_basin.consumesCast.value=Whether the cast i groovyscript.wiki.tconstruct.melting.title=Melting groovyscript.wiki.tconstruct.melting.description=Modifies what items can be melted down in the Smeltery. groovyscript.wiki.tconstruct.melting.add=Adds a new recipe in the format `input`, `output`, `time` -groovyscript.wiki.tconstruct.melting.temp.value=Required temperature for melting. Also determines the speed of the melt +groovyscript.wiki.tconstruct.melting.temperature.value=Required temperature for melting. Also determines the speed of the melt +groovyscript.wiki.tconstruct.melting.time.value=Sets the time required for melting, which is based on temperature +groovyscript.wiki.tconstruct.melting.time_temperature.unique=If time is set, temperature will be ignored groovyscript.wiki.tconstruct.entity_melting.title=Entity Melting groovyscript.wiki.tconstruct.entity_melting.description=Allows mobs to create a bit of fluid when hurt by the Smeltery. From 0076686f080a286aa00bb4484ec865f7e3dae696 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 25 Nov 2025 18:22:18 -0800 Subject: [PATCH 82/92] spotless apply --- .../compat/mods/botaniatweaks/AgglomerationPlate.java | 2 +- .../com/cleanroommc/groovyscript/documentation/Exporter.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/AgglomerationPlate.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/AgglomerationPlate.java index 241777f91..83e064212 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/AgglomerationPlate.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/AgglomerationPlate.java @@ -125,7 +125,7 @@ public RecipeBuilder color(int colorStart, int colorEnd) { return this; } - @RecipeBuilderMethodDescription(description = "groovyscript.wiki.botania_tweaks.agglomeration_plate.recipeBuilder.baseStructure.description",field = { + @RecipeBuilderMethodDescription(description = "groovyscript.wiki.botania_tweaks.agglomeration_plate.recipeBuilder.baseStructure.description", field = { "center", "edge", "corner" }) public RecipeBuilder baseStructure() { diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index 107cbc155..2fcd3f635 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -20,7 +20,6 @@ import java.io.InputStream; import java.nio.file.Files; import java.util.ArrayList; -import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.function.Predicate; @@ -135,7 +134,8 @@ private static String getImportBlock(List imports) { public static void logSkippedClasses() { if (SKIPPED_CLASSES.isEmpty()) return; GroovyLog.Msg log = GroovyLog.msg("Skipped documenting the following potentially valid locations (this may be the correct behavior!)"); - SKIPPED_CLASSES.entrySet().stream() + SKIPPED_CLASSES.entrySet() + .stream() .sorted(Map.Entry.comparingByKey(ComparisonHelper::packages)) .forEach(x -> log.add(x.getKey() + ": " + x.getValue().getName())); log.debug().post(); From 2ccd756afa6945595bf985f24794cf48a3600c73 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Tue, 25 Nov 2025 18:24:26 -0800 Subject: [PATCH 83/92] needs two percent symbols --- src/main/resources/assets/groovyscript/lang/en_us.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index 544b92b5b..03b77e5fb 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -125,7 +125,7 @@ groovyscript.wiki.removeByInputAndCatalyst=This removes all recipes that match t groovyscript.wiki.streamRecipes=Iterates through every entry in the registry, with the ability to call remove on any element to remove it groovyscript.wiki.removeAll=Removes all registered recipes -groovyscript.wiki.probability_default.description=100% chance +groovyscript.wiki.probability_default.description=100%% chance groovyscript.wiki.time_ticks.description=Sets the time in ticks groovyscript.wiki.time_seconds.description=Sets the time in seconds From 48acd0e932627af90f3a419d686b81fdcc528023 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Wed, 26 Nov 2025 00:21:06 -0800 Subject: [PATCH 84/92] move heading to constructor, split link logic --- .../compat/mods/MinecraftModContainer.java | 3 +- .../documentation/Documentation.java | 1 + .../groovyscript/documentation/Exporter.java | 13 +++-- .../groovyscript/documentation/Registry.java | 9 ++-- .../documentation/helper/Heading.java | 51 ++++++++++++------- 5 files changed, 47 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java index a5ac27914..1d2aebd8d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java @@ -76,7 +76,8 @@ public boolean generateExamples(File suggestedFile, LoadStage stage) { @Override public boolean generateWiki(File suggestedFolder) { var minecraftCompatFolder = new File(Documentation.WIKI_MINECRAFT, "helpers"); - Exporter.generateWiki(minecraftCompatFolder, getContainer()); + var container = getContainer(); + Exporter.generateWiki(minecraftCompatFolder, container); return false; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java index f9995a2d5..5771d3ad3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java @@ -25,6 +25,7 @@ public class Documentation { public static final boolean USE_DEFAULT_BRANCH = FMLLaunchHandler.isDeobfuscatedEnvironment(); public static final String GROOVY_FILE_EXTENSION = ".groovy"; + public static final String MARKDOWN_FILE_EXTENSION = ".md"; public static final File EXAMPLES = new File(GroovyScript.getScriptPath()); public static final File WIKI = new File(new File(GroovyScript.getScriptFile().getParentFile(), "build"), "wiki"); diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index 2fcd3f635..1bc856d78 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -26,9 +26,8 @@ public class Exporter { - private static final String MARKDOWN_FILE_EXTENSION = ".md"; - private static final String INDEX_FILE_NAME = "index" + MARKDOWN_FILE_EXTENSION; - private static final String NAV_FILE_NAME = "!navigation" + MARKDOWN_FILE_EXTENSION; + private static final String INDEX_FILE_NAME = "index" + Documentation.MARKDOWN_FILE_EXTENSION; + private static final String NAV_FILE_NAME = "!navigation" + Documentation.MARKDOWN_FILE_EXTENSION; private static final String EXAMPLE_GENERATION_NOTE = "// Auto generated groovyscript example file\n"; private static final String INDEX_FILE_TEXT = "---\n%s\n---\n\n\n%s%s"; private static final String BULLET_POINT_LINK = "* [%s](./%s)"; @@ -50,7 +49,7 @@ public static void generateWiki(File targetFolder, ContainerHolder container) { registry.generateWiki(container, targetFolder, linkIndex); } - String indexText = String.format(INDEX_FILE_TEXT, Documentation.DEFAULT_FORMAT.removeTableOfContentsText(), Heading.containerIndex(container).get(1), linkIndex.get()); + String indexText = String.format(INDEX_FILE_TEXT, Documentation.DEFAULT_FORMAT.removeTableOfContentsText(), Heading.containerIndex(container).get(), linkIndex.get()); write(new File(targetFolder, INDEX_FILE_NAME), indexText); if (Documentation.DEFAULT_FORMAT.requiresNavFile()) { @@ -59,10 +58,10 @@ public static void generateWiki(File targetFolder, ContainerHolder container) { } } - public static void writeNormalWikiFile(File targetFolder, LinkIndex linkIndex, String id, String title, String doc) { - String location = id + MARKDOWN_FILE_EXTENSION; - linkIndex.add(String.format(BULLET_POINT_LINK, title, location)); + public static String writeNormalWikiFile(File targetFolder, String id, String title, String doc) { + String location = id + Documentation.MARKDOWN_FILE_EXTENSION; write(new File(targetFolder, location), doc.trim() + "\n"); + return String.format(BULLET_POINT_LINK, title, location); } public static void generateExamples(File targetFile, LoadStage loadStage, ContainerHolder container) { diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 624a3a731..6df0bf367 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -142,7 +142,8 @@ public List getAliases() { @Override public void generateWiki(ContainerHolder container, File suggestedFolder, LinkIndex linkIndex) { - Exporter.writeNormalWikiFile(suggestedFolder, linkIndex, getName(), getTitle(), documentationBlock()); + var location = Exporter.writeNormalWikiFile(suggestedFolder, getName(), getTitle(), documentationBlock()); + linkIndex.add(location); } @Override @@ -216,7 +217,7 @@ private String generateHeader() { } private String generateTitle() { - return new Heading(getTitle() + " (" + container.name() + ")").get(1); + return new Heading(getTitle() + " (" + container.name() + ")", 1).get(); } private String generateDescription() { @@ -277,7 +278,7 @@ private String generateIdentifier() { } private String recipeBuilder() { - var md = new Heading(I18n.format("groovyscript.wiki.recipe_builder")); + var md = new Heading(I18n.format("groovyscript.wiki.recipe_builder"), 3); md.addEntry(I18n.format("groovyscript.wiki.uses_recipe_builder", getTitle())); md.addEntry(I18n.format("groovyscript.wiki.recipe_builder_note", Documentation.DEFAULT_FORMAT.linkToBuilder())); @@ -285,7 +286,7 @@ private String recipeBuilder() { for (Builder recipeBuilder : recipeBuilders) { md.addEntry(recipeBuilder.generateAdmonition()); } - return md.get(3); + return md.get(); } public String documentationBlock() { diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java index 5661394a7..b5ef775e9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/helper/Heading.java @@ -12,7 +12,7 @@ /** * This is used to create headings on the wiki index page. *

    - * Contains header text (which will be formatted as h2 via {@link #get()}, but can be configured {@link #get(int)}), + * Contains header text to be formatted at the provided headingLevel, * an optional normal text comment below it, and some number of entries. * The comment is a function that can be formatted based on the number of entries. *

    @@ -25,51 +25,70 @@ public class Heading implements Comparable { public static final int DEFAULT_PRIORITY = 1000; + public static final int DEFAULT_HEADING_LEVEL = 2; private final String text; private final Function comment; private final List entries; + private final int headingLevel; private final int priority; /** * @param text the header text of the section - * @see #Heading(String, Function, int) Section + * @see #Heading(String, Function, int, int) Heading */ public Heading(String text) { - this(text, null, DEFAULT_PRIORITY); + this(text, null, DEFAULT_HEADING_LEVEL, DEFAULT_PRIORITY); } + /** + * @param text the header text of the section + * @param headingLevel the heading level, {@code 0 < level <= 6} + * @see #Heading(String, Function, int, int) Heading + */ + public Heading(String text, int headingLevel) { + this(text, null, headingLevel, DEFAULT_PRIORITY); + } + + + /** + * @param text the header text of the section + * @param comment comment for the given header + * @see #Heading(String, Function, int, int) Heading + */ public Heading(String text, String comment) { - this(text, x -> comment, DEFAULT_PRIORITY); + this(text, x -> comment, DEFAULT_HEADING_LEVEL, DEFAULT_PRIORITY); } /** - * Calls {@link #Heading(String, Function, int)} with a priority of {@link Heading#DEFAULT_PRIORITY}. + * Calls {@link #Heading(String, Function, int, int)} with a heading level of {@link Heading#DEFAULT_HEADING_LEVEL} and priority of {@link Heading#DEFAULT_PRIORITY}. * - * @param text the header text of the section + * @param text the header text of the section * @param comment function that creates the comment based on the number of entries - * @see #Heading(String, Function, int) Section + * @see #Heading(String, Function, int, int) Heading */ public Heading(String text, Function comment) { - this(text, comment, DEFAULT_PRIORITY); + this(text, comment, DEFAULT_HEADING_LEVEL, DEFAULT_PRIORITY); } /** - * @param text the header text of the section - * @param comment function that creates the comment based on the number of entries - * @param priority the priority this Section has on the index page for sorting purposes + * @param text the header text of the section + * @param comment function that creates the comment based on the number of entries + * @param headingLevel the heading level, {@code 0 < level <= 6} + * @param priority the priority this Section has on the index page for sorting purposes */ - public Heading(String text, Function comment, int priority) { + public Heading(String text, Function comment, int headingLevel, int priority) { this.text = text; this.comment = comment; this.entries = new ArrayList<>(); + this.headingLevel = headingLevel <= 0 || headingLevel > 6 ? DEFAULT_HEADING_LEVEL : headingLevel; this.priority = priority; } public static Heading containerIndex(ContainerHolder container) { var header = LangHelper.fallback(String.format("groovyscript.wiki.%s.index.title", container.id()), container.name()); var comment = LangHelper.fallback(String.format("groovyscript.wiki.%s.index.description", container.id()), null); - return new Heading(I18n.format(header), comment == null ? null : md -> I18n.format(comment, md.entries.size())); + return new Heading(I18n.format(header), comment == null ? null : md -> I18n.format(comment, md.entries.size()), 1, DEFAULT_PRIORITY); } public static Heading fromContainer(ContainerHolder container) { @@ -79,7 +98,7 @@ public static Heading fromContainer(ContainerHolder container) { } public static Heading fromI18n(String header, String comment) { - return new Heading(I18n.format(header), md -> I18n.format(comment, md.entries.size())); + return new Heading(LangHelper.translate(header), md -> LangHelper.translate(comment, md.entries.size())); } /** @@ -98,10 +117,6 @@ public List getEntries() { } public String get() { - return get(2); - } - - public String get(int headingLevel) { var sb = new StringBuilder(); sb.append(Documentation.DEFAULT_FORMAT.header(headingLevel, text)).append("\n\n"); if (comment != null) { From 57f6ee1b4eeeb1fe85f61eb6b9565395b4e19f53 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Wed, 26 Nov 2025 14:13:31 -0800 Subject: [PATCH 85/92] add custom iwc description --- src/main/resources/assets/groovyscript/lang/en_us.lang | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index 03b77e5fb..6003ab041 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -292,6 +292,9 @@ groovyscript.wiki.minecraft.content.fluid.register.description=Registers the Flu # In-World Crafting +groovyscript.wiki.in_world_crafting.index.title=In-World Crafting +groovyscript.wiki.in_world_crafting.index.description=GroovyScript adds the ability to craft things in-world via specific processes. By default, no recipes are created and everything must be added by you through GroovyScript. + groovyscript.wiki.in_world_crafting.chances.value=Sets the chance each input has to be consumed groovyscript.wiki.in_world_crafting.chances.required=exactly equal to the number of elements in `input` groovyscript.wiki.in_world_crafting.startCondition.value=Sets an additional check that must be passed before the recipe runs, with the Closure taking 2 parameters, `World world` and `BlockPos blockPos` From cc2637bd1d68c038aed208621b1faa59bf45fb37 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Wed, 26 Nov 2025 14:18:54 -0800 Subject: [PATCH 86/92] remove now-unused test file --- src/main/resources/wiki/vanilla/index.md | 25 ------------------------ 1 file changed, 25 deletions(-) delete mode 100644 src/main/resources/wiki/vanilla/index.md diff --git a/src/main/resources/wiki/vanilla/index.md b/src/main/resources/wiki/vanilla/index.md deleted file mode 100644 index a66c207dd..000000000 --- a/src/main/resources/wiki/vanilla/index.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -aside: false -order: 700 ---- - - -# Registries - -## Categories - -Has 7 subcategories. - -* [Custom Commands](./command.md) - -* [Crafting Table](./crafting.md) - -* [Furnace](./furnace.md) - -* [Default GameRules](./game_rule.md) - -* [Ore Dictionary](./ore_dict.md) - -* [Starting Inventory](./player.md) - -* [Rarity](./rarity.md) \ No newline at end of file From 4de909821f4705756196c190a614406b3e15af9a Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Wed, 26 Nov 2025 19:32:35 -0800 Subject: [PATCH 87/92] add a single space to indent better --- .../generated/armorplus_generated.groovy | 4 ++-- .../generated/avaritia_generated.groovy | 12 +++++----- .../betterwithaddons_generated.groovy | 4 ++-- .../generated/betterwithmods_generated.groovy | 6 ++--- .../extendedcrafting_generated.groovy | 20 ++++++++--------- .../generated/minecraft_generated.groovy | 22 +++++++++---------- .../generated/techreborn_generated.groovy | 4 ++-- .../groovyscript/documentation/Builder.java | 22 ++++++++++++------- 8 files changed, 50 insertions(+), 44 deletions(-) diff --git a/examples/postInit/generated/armorplus_generated.groovy b/examples/postInit/generated/armorplus_generated.groovy index d47f15dd4..fba484855 100644 --- a/examples/postInit/generated/armorplus_generated.groovy +++ b/examples/postInit/generated/armorplus_generated.groovy @@ -41,8 +41,8 @@ mods.armorplus.high_tech_bench.removeByOutput(item('armorplus:emerald_helmet')) mods.armorplus.high_tech_bench.shapedBuilder() .output(item('minecraft:diamond') * 32) .matrix([[item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')]]) + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')]]) .register() diff --git a/examples/postInit/generated/avaritia_generated.groovy b/examples/postInit/generated/avaritia_generated.groovy index 8a6634715..1f3b495fd 100644 --- a/examples/postInit/generated/avaritia_generated.groovy +++ b/examples/postInit/generated/avaritia_generated.groovy @@ -27,12 +27,12 @@ mods.avaritia.extreme_crafting.removeByOutput(item('avaritia:resource', 6)) mods.avaritia.extreme_crafting.shapedBuilder() .matrix([[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) + [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) .output(item('minecraft:gold_block')) .register() diff --git a/examples/postInit/generated/betterwithaddons_generated.groovy b/examples/postInit/generated/betterwithaddons_generated.groovy index 07b1d88f1..1003b770a 100644 --- a/examples/postInit/generated/betterwithaddons_generated.groovy +++ b/examples/postInit/generated/betterwithaddons_generated.groovy @@ -66,8 +66,8 @@ mods.betterwithaddons.infuser.shapedBuilder() mods.betterwithaddons.infuser.shapedBuilder() .output(item('minecraft:diamond') * 32) .matrix([[item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')]]) + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')]]) .spirits(6) .register() diff --git a/examples/postInit/generated/betterwithmods_generated.groovy b/examples/postInit/generated/betterwithmods_generated.groovy index 9bf45bd96..84157b4d9 100644 --- a/examples/postInit/generated/betterwithmods_generated.groovy +++ b/examples/postInit/generated/betterwithmods_generated.groovy @@ -14,9 +14,9 @@ mods.betterwithmods.anvil_crafting.removeByOutput(item('betterwithmods:steel_blo mods.betterwithmods.anvil_crafting.shapedBuilder() .output(item('minecraft:diamond') * 32) .matrix([[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),null], - [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),null], - [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),null], - [null,null,null,item('minecraft:gold_ingot').transform({ _ -> item('minecraft:diamond') })]]) + [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),null], + [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),null], + [null,null,null,item('minecraft:gold_ingot').transform({ _ -> item('minecraft:diamond') })]]) .register() mods.betterwithmods.anvil_crafting.shapedBuilder() diff --git a/examples/postInit/generated/extendedcrafting_generated.groovy b/examples/postInit/generated/extendedcrafting_generated.groovy index eb16c777d..025399304 100644 --- a/examples/postInit/generated/extendedcrafting_generated.groovy +++ b/examples/postInit/generated/extendedcrafting_generated.groovy @@ -73,8 +73,8 @@ mods.extendedcrafting.ender_crafting.shapedBuilder() mods.extendedcrafting.ender_crafting.shapedBuilder() .output(item('minecraft:diamond') * 32) .matrix([[item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')]]) + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')]]) .time(1) .register() @@ -130,20 +130,20 @@ mods.extendedcrafting.table_crafting.shapedBuilder() mods.extendedcrafting.table_crafting.shapedBuilder() .matrix([[item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')]]) + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')]]) .output(item('minecraft:gold_ingot') * 64) .tier(4) .register() mods.extendedcrafting.table_crafting.shapedBuilder() .matrix([[item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')]]) + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')]]) .output(item('minecraft:gold_ingot') * 64) .register() diff --git a/examples/postInit/generated/minecraft_generated.groovy b/examples/postInit/generated/minecraft_generated.groovy index 47b4ba2c8..e2cdc1918 100644 --- a/examples/postInit/generated/minecraft_generated.groovy +++ b/examples/postInit/generated/minecraft_generated.groovy @@ -61,30 +61,30 @@ crafting.shapedBuilder() crafting.shapedBuilder() .output(item('minecraft:gold_block')) .shape([[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], - [null, null, null], - [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) + [null, null, null], + [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) .register() crafting.shapedBuilder() .name('gold_v_to_clay') .output(item('minecraft:clay')) .shape([[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')], - [null,item('minecraft:stone_pickaxe').transformDamage(2).whenAnyDamage(),null]]) + [null,item('minecraft:stone_pickaxe').transformDamage(2).whenAnyDamage(),null]]) .register() crafting.shapedBuilder() .name(resource('example:resource_location')) .output(item('minecraft:clay')) .shape([[item('minecraft:cobblestone')], - [item('minecraft:nether_star')], - [item('minecraft:cobblestone')]]) + [item('minecraft:nether_star')], + [item('minecraft:cobblestone')]]) .register() crafting.shapedBuilder() .output(item('minecraft:chest')) .shape([[ore('logWood'),ore('logWood'),ore('logWood')], - [ore('logWood'),null,ore('logWood')], - [ore('logWood'),ore('logWood'),ore('logWood')]]) + [ore('logWood'),null,ore('logWood')], + [ore('logWood'),ore('logWood'),ore('logWood')]]) .replace() .register() @@ -92,8 +92,8 @@ crafting.shapedBuilder() .name('gold_to_diamonds') .output(item('minecraft:diamond') * 8) .shape([[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) + [item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) .replaceByName() .register() @@ -101,8 +101,8 @@ crafting.shapedBuilder() .name(resource('minecraft:sea_lantern')) .output(item('minecraft:clay')) .shape([[item('minecraft:glowstone')], - [item('minecraft:glowstone')], - [item('minecraft:glowstone')]]) + [item('minecraft:glowstone')], + [item('minecraft:glowstone')]]) .replaceByName() .register() diff --git a/examples/postInit/generated/techreborn_generated.groovy b/examples/postInit/generated/techreborn_generated.groovy index 3f0f70f47..f0084e520 100644 --- a/examples/postInit/generated/techreborn_generated.groovy +++ b/examples/postInit/generated/techreborn_generated.groovy @@ -448,8 +448,8 @@ mods.techreborn.rolling_machine.shapedBuilder() mods.techreborn.rolling_machine.shapedBuilder() .output(item('minecraft:diamond') * 32) .matrix([[item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], - [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')]]) + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')]]) .register() mods.techreborn.rolling_machine.shapelessBuilder() diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java index 86879c34f..77acde0cb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java @@ -216,18 +216,24 @@ else if (!req.isEmpty() && current == req.get(req.size() - 1)) { List output = new ArrayList<>(); for (int i = 0; i < parts.size(); i++) { String part = parts.get(i); - if (!part.isEmpty()) { - int indent = 4; - if (!output.isEmpty()) { - int lastIndex = output.get(i - 1).indexOf(part.charAt(0)); - if (lastIndex != -1) indent = lastIndex; - } - output.add(StringUtils.repeat(" ", indent) + part.trim() + "\n"); - } + if (part.isEmpty()) continue; + int indent = output.isEmpty() ? -1 : getIndent(output.get(i - 1), part.charAt(0)); + output.add(StringUtils.repeat(' ', indent == -1 ? 4 : indent) + part.trim() + "\n"); } return output; } + private static int getIndent(String priorLine, char target) { + // if we are trying to match [, in many cases it is in the format [[...]\n[...]... + // and we want the second line to have its starting brace matched with the *second* brace instead of the first + if (target == '[') { + int open = StringUtils.countMatches(priorLine, '['); + int close = StringUtils.countMatches(priorLine, ']'); + return StringUtils.ordinalIndexOf(priorLine, "[", 1 + open - close); + } + return priorLine.indexOf(target); + } + public String builderExampleAdmonition() { if (annotation.example().length == 0) return ""; return new AdmonitionBuilder() From 5165b1a84249b8aea91e3cea5cdcf3bc999e03ac Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Wed, 26 Nov 2025 20:20:32 -0800 Subject: [PATCH 88/92] use priority for wiki --- .../api/documentation/IRegistryDocumentation.java | 4 ++-- .../com/cleanroommc/groovyscript/documentation/Registry.java | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java index 221cf95fb..18d0c28bf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/IRegistryDocumentation.java @@ -89,10 +89,10 @@ default boolean skipDefaultExamples(ContainerHolder container) { * Priority of the registry, relative to other registries of the same container. * Priorities sort entries such that lowest is first, then by the natural order of {@link INamed#getName()}. * - * @return the registry priority, default {@code 100} + * @return the registry priority, default {@code 1000} * @see com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription#priority() */ default int priority() { - return 100; + return 1000; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 6df0bf367..624d2b6a7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -212,6 +212,7 @@ private String generateHeader() { out.append("description: \"").append(getDescription()).append("\"\n"); String link = getFileSourceCodeLink(); if (!link.isEmpty()) out.append("source_code_link: \"").append(link).append("\"\n"); + if (priority() != 1000) out.append("order: ").append(priority()).append("\n"); out.append("---\n\n"); return out.toString(); } From 84792940eccba91468b6fd191362489e3a557f46 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Wed, 26 Nov 2025 20:20:56 -0800 Subject: [PATCH 89/92] minor whitespace change --- .../groovyscript/documentation/Registry.java | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index 624d2b6a7..a2e597257 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -253,28 +253,28 @@ private String generateIdentifier() { int target = packages.indexOf(getReference()); if (target == -1) { - GroovyLog.get().warn("Couldn't find identifier %s in packagess %s", getReference(), String.join(", ", packages)); - } else { - packages.set(target, getReference() + "/*()!*/"); - var codeBlock = new CodeBlockBuilder() - .line(packages) - .annotation(I18n.format("groovyscript.wiki.defaultPackage")) - // Highlighting and focusing are based on the line count, and is 1-indexed - .highlight(String.valueOf(1 + target)) - .focus(1 + target) - .toString(); - var admonition = new AdmonitionBuilder() - .hasTitle(true) - .title(I18n.format("groovyscript.wiki.all_packages_title")) - .note("\n") - .note(I18n.format("groovyscript.wiki.import_instructions")) - .note("\n") - .note(codeBlock.trim()) - .note("\n") - .type(Admonition.Type.QUOTE); - if (packages.size() >= TOO_MANY_PACKAGES) admonition.format(Admonition.Format.COLLAPSED); - md.addEntry(admonition.generate()); + GroovyLog.get().warn("Couldn't find identifier %s in packages %s", getReference(), String.join(", ", packages)); + return ""; } + packages.set(target, getReference() + "/*()!*/"); + var codeBlock = new CodeBlockBuilder() + .line(packages) + .annotation(I18n.format("groovyscript.wiki.defaultPackage")) + // Highlighting and focusing are based on the line count, and is 1-indexed + .highlight(String.valueOf(1 + target)) + .focus(1 + target) + .toString(); + var admonition = new AdmonitionBuilder() + .hasTitle(true) + .title(I18n.format("groovyscript.wiki.all_packages_title")) + .note("\n") + .note(I18n.format("groovyscript.wiki.import_instructions")) + .note("\n") + .note(codeBlock.trim()) + .note("\n") + .type(Admonition.Type.QUOTE); + if (packages.size() >= TOO_MANY_PACKAGES) admonition.format(Admonition.Format.COLLAPSED); + md.addEntry(admonition.generate()); return md.get(); } From 522001bd320062c55bf1f3131cc4a9fab0bf7fce Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Wed, 26 Nov 2025 20:22:45 -0800 Subject: [PATCH 90/92] remove useless distinct call --- .../java/com/cleanroommc/groovyscript/documentation/Builder.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java index 77acde0cb..e87fdb7b4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java @@ -333,7 +333,6 @@ public StringBuilder documentFields() { if (desc.isEmpty()) return method; return method + " // " + LangHelper.translate(desc); }) - .distinct() .collect(Collectors.toList()); out.append(new CodeBlockBuilder().line(lines).indentation(1).toString()); } From 9c8e4bca8e0c32004d0422b78a7cf4d0f63f4bbd Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Wed, 26 Nov 2025 20:53:45 -0800 Subject: [PATCH 91/92] add more content documentation --- .../generated/minecraft_generated.groovy | 3 +- examples/preInit/vanilla.groovy | 96 ------------------- .../groovyscript/compat/content/Content.java | 10 +- .../assets/groovyscript/lang/en_us.lang | 16 ++-- 4 files changed, 16 insertions(+), 109 deletions(-) delete mode 100644 examples/preInit/vanilla.groovy diff --git a/examples/preInit/generated/minecraft_generated.groovy b/examples/preInit/generated/minecraft_generated.groovy index 1ced83d5f..19f1b9fc3 100644 --- a/examples/preInit/generated/minecraft_generated.groovy +++ b/examples/preInit/generated/minecraft_generated.groovy @@ -11,7 +11,8 @@ import net.minecraft.entity.player.EntityPlayer log 'running Vanilla Minecraft example' // Vanilla Content Creation: -// Creates custom items, blocks, and fluids for later use. +// Creates custom items, blocks, and fluids for later use. Textures and other assets such as translations will be loaded +// from the `groovy/assets/` folder. content.setDefaultCreativeTab(content.createCreativeTab('groovyscript.example_creative_tab', _ -> item('groovyscriptdev:heartofauniverse'))) diff --git a/examples/preInit/vanilla.groovy b/examples/preInit/vanilla.groovy deleted file mode 100644 index f5382826e..000000000 --- a/examples/preInit/vanilla.groovy +++ /dev/null @@ -1,96 +0,0 @@ - -import net.minecraft.item.ItemFood -import net.minecraft.potion.PotionEffect -import net.minecraft.entity.player.EntityPlayer -import net.minecraft.block.material.Material -import net.minecraft.block.state.BlockFaceShape -import net.minecraft.block.state.IBlockState -import net.minecraft.util.math.AxisAlignedBB -import net.minecraft.world.IBlockAccess - - -// Localization is done in 'assets/groovyscriptdev/lang/[language].lang' - -// Textures for items are created at 'assets/groovyscriptdev/textures/items/'. -// Add a file called '[itemname].png' to create a static item texture, and a file called -// '[itemname].png.mcmeta' to create an animated file. -// A file will be created in 'assets/groovyscriptdev/models/item/' called '[itemname].json' and point to this location in textures. - -// Create the creative tab, using the not-yet-registered item -def tab = content.createCreativeTab('groovyscript.example_creative_tab', _ -> item('groovyscriptdev:heartofauniverse')) - -// When registering items, this will add them to the given creative tab without having to manually do so. -content.setDefaultCreativeTab(tab) - -// create the creative tab -content.createItem('heartofauniverse') // Set item name at 'item.[itemname].name=[desired name]' - .setRarity(EnumRarity.EPIC) // Optional IRarity, sets the default text formatting (default none) - .setMaxStackSize(1) // Optional int, sets the max stack size (default 64) - .register() - - -// Create an item at the location 'groovyscriptdev:clay_2' -content.createItem('clay_2') - .setMaxStackSize(5) // Optional int, sets the max stack size (default 64) - .setRarity(EnumRarity.RARE) // Optional IRarity, sets the default text formatting (default none) - .register() - -// Create an item at the location 'groovyscriptdev:clay_3'. -content.createItem('clay_3') - .setCreativeTab(creativeTab('misc')) // Optional CreativeTab, sets the creative tab (default set via setDefaultCreativeTab) - .setEnchantedEffect() // Optional boolean, controls if the enchanted effect plays on the item - .register() - -content.createFluid('amongium') - .setMetalTexture() - .setColor(0x00FF00) - .register() - -// You can register any item created, even items created via custom means. -content.registerItem('snack', (new ItemFood(20, 10, false) { - protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) { - if (!worldIn.isRemote) { - player.addPotionEffect(new PotionEffect(potion('minecraft:regeneration'), 240000, 3, false, false)) - player.addPotionEffect(new PotionEffect(potion('minecraft:resistance'), 240000, 3, false, false)) - } - } -}).setAlwaysEdible()) - - - -// block - -// Textures for blocks are created at 'assets/groovyscriptdev/textures/blocks/'. -// Add a file called '[blockname].png' to create a static item texture, and a file called -// '[blockname].png.mcmeta' to create an animated file. -// A file will be created in 'assets/groovyscriptdev/models/block/' called '[blockname].json' and point to this location in textures. - -// Create a block at the location 'groovyscriptdev:generic_block' -content.createBlock('generic_block')// Set block name at 'tile.[blockname].name=[desired name]' - .register() - -// Create a custom block at the location 'groovyscriptdev:dragon_egg_lamp' -// Also changes the 'parent' setting in 'assets/groovyscriptdev/models/block/[blockname].json' from 'block/cube_all' to 'block/dragon_egg' -content.registerBlock('dragon_egg_lamp', (new Block(Material.REDSTONE_LIGHT) { - protected static final AxisAlignedBB DRAGON_EGG_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 1.0D, 0.9375D) - - AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { - return DRAGON_EGG_AABB - } - - boolean isOpaqueCube(IBlockState state) { - return false - } - - boolean isFullCube(IBlockState state) { - return false - } - - boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { - return true - } - - BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { - return BlockFaceShape.UNDEFINED - } -}).setLightLevel(1.0F)) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java b/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java index a5eb56af1..887c2bcc4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java @@ -2,10 +2,7 @@ import com.cleanroommc.groovyscript.GroovyScript; import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.documentation.annotations.Example; -import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; -import com.cleanroommc.groovyscript.api.documentation.annotations.RecipeBuilderDescription; -import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; import com.cleanroommc.groovyscript.registry.NamedRegistry; import com.cleanroommc.groovyscript.sandbox.LoadStage; import groovy.lang.Closure; @@ -22,7 +19,10 @@ import java.util.function.Supplier; -@RegistryDescription(location = LoadStage.PRE_INIT, category = RegistryDescription.Category.CUSTOM, priority = 500) +@RegistryDescription(location = LoadStage.PRE_INIT, category = RegistryDescription.Category.CUSTOM, priority = 500, admonition = { + @Admonition(value = "groovyscript.wiki.minecraft.content.note0", type = Admonition.Type.WARNING), + @Admonition(value = "groovyscript.wiki.minecraft.content.note1", type = Admonition.Type.DANGER), +}) public class Content extends NamedRegistry { public CreativeTabs defaultTab; diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index 6003ab041..c35328e21 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -221,7 +221,9 @@ groovyscript.wiki.minecraft.content.operation.query=Helper methods groovyscript.wiki.minecraft.content.operation.adding=Create Custom Content #groovyscript.wiki.minecraft.content.operation.removing=unused groovyscript.wiki.minecraft.content.operation.values=Creative Tab Manipulation -groovyscript.wiki.minecraft.content.description=Creates custom items, blocks, and fluids for later use. +groovyscript.wiki.minecraft.content.description=Creates custom items, blocks, and fluids for later use. Textures and other assets such as translations will be loaded from the `groovy/assets/` folder. +groovyscript.wiki.minecraft.content.note0=Item and blocks will automatically generate a model file inside if one is not present. Textures will be `missingno` until assigned, and names will be the raw lang key until a localization file sets the relevant lang key to a value. The localization file must be all lowercase, such as `en_us.lang`! +groovyscript.wiki.minecraft.content.note1=The [packid](../../getting_started/run_config.md#packid) must be valid for any content to be created! groovyscript.wiki.minecraft.content.registerBlock=Register an already created block. Useful for when provided methods do not suffice to create the desired block groovyscript.wiki.minecraft.content.registerFluid=Register an already created fluid. Useful for when provided methods do not suffice to create the desired fluid groovyscript.wiki.minecraft.content.registerItem=Register an already created item. Useful for when provided methods do not suffice to create the desired item @@ -229,13 +231,13 @@ groovyscript.wiki.minecraft.content.createCreativeTab=Create a creative tab with groovyscript.wiki.minecraft.content.setDefaultCreativeTab=Sets the default Creative Tab used when registering items through GroovyScript groovyscript.wiki.minecraft.content.getDefaultTab=Get the default Creative Tab for GroovyScript, which is set by `setDefaultCreativeTab` -groovyscript.wiki.minecraft.content.createBlock.title=Create Custom Block -groovyscript.wiki.minecraft.content.createBlock.description0=Create a GroovyBlock with the given name and material -groovyscript.wiki.minecraft.content.createBlock.description1=Create a GroovyBlock with the given name with the material `Material.ROCK` -groovyscript.wiki.minecraft.content.createFluid.title=Create Custom Fluid +groovyscript.wiki.minecraft.content.createBlock.title=Create Custom Blocks +groovyscript.wiki.minecraft.content.createBlock.description0=Create a GroovyBlock with the given name and material. The name is the registry name used and must consist of exclusively lower case letters, numbers, and underscores `_`. +groovyscript.wiki.minecraft.content.createBlock.description1=Create a GroovyBlock with the given name with the material `Material.ROCK`. The name is the registry name used and must consist of exclusively lower case letters, numbers, and underscores `_`. +groovyscript.wiki.minecraft.content.createFluid.title=Create Custom Fluids groovyscript.wiki.minecraft.content.createFluid.description=Create a GroovyFluid with the given name -groovyscript.wiki.minecraft.content.createItem.title=Create Custom Item -groovyscript.wiki.minecraft.content.createItem.description=Create a GroovyItem with the given name +groovyscript.wiki.minecraft.content.createItem.title=Create Custom Items +groovyscript.wiki.minecraft.content.createItem.description=Create a GroovyItem with the given name. The name is the registry name used and must consist of exclusively lower case letters, numbers, and underscores `_`. groovyscript.wiki.minecraft.content.rarity.value=Sets the rarity this will be is displayed as, primarily impacts the color of its name From 7eb1c7679729fbdcac1715207f5b4e2f52f28417 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Wed, 26 Nov 2025 21:55:53 -0800 Subject: [PATCH 92/92] minor capitalization typo --- src/main/resources/assets/groovyscript/lang/en_us.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index fbef32222..74d837c60 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -2915,7 +2915,7 @@ groovyscript.wiki.tconstruct.melting.description=Modifies what items can be melt groovyscript.wiki.tconstruct.melting.add=Adds a new recipe in the format `input`, `output`, `time` groovyscript.wiki.tconstruct.melting.temperature.value=Required temperature for melting. Also determines the speed of the melt groovyscript.wiki.tconstruct.melting.time.value=Sets the time required for melting, which is based on temperature -groovyscript.wiki.tconstruct.melting.time_temperature.unique=If time is set, temperature will be ignored +groovyscript.wiki.tconstruct.melting.time_temperature.unique=if time is set, temperature will be ignored groovyscript.wiki.tconstruct.entity_melting.title=Entity Melting groovyscript.wiki.tconstruct.entity_melting.description=Allows mobs to create a bit of fluid when hurt by the Smeltery.