Skip to content

Commit

Permalink
fix up docgen for new compat (#148)
Browse files Browse the repository at this point in the history
* add and fix some RecipeBuilderMethodDescription

* rename "The Aether" to "Aether Legacy"

* escape double quotes in description

* add missing aether legacy lang keys

* fix unescaped % causing a formatting error

* update example files
  • Loading branch information
WaitingIdly authored Mar 28, 2024
1 parent f77ebee commit 6f7c627
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 27 deletions.
29 changes: 17 additions & 12 deletions examples/postInit/alchemistry.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

println 'mod \'alchemistry\' detected, running script'

// groovyscript.wiki.alchemistry.atomizer.title:
// groovyscript.wiki.alchemistry.atomizer.description
// Atomizer:
// Converts a non-element into its component elements.

mods.alchemistry.atomizer.removeByInput(fluid('water'))
// mods.alchemistry.atomizer.removeByOutput(item('alchemistry:compound:7'))
Expand All @@ -23,8 +23,9 @@ mods.alchemistry.atomizer.recipeBuilder()
.register()


// groovyscript.wiki.alchemistry.combiner.title:
// groovyscript.wiki.alchemistry.combiner.description

// Chemical Combiner:
// Converts up to 9 input itemstacks into an output itemstack.

mods.alchemistry.combiner.removeByInput(element('carbon'))
mods.alchemistry.combiner.removeByOutput(item('minecraft:glowstone'))
Expand All @@ -41,8 +42,9 @@ mods.alchemistry.combiner.recipeBuilder()
.register()


// groovyscript.wiki.alchemistry.dissolver.title:
// groovyscript.wiki.alchemistry.dissolver.description
// Chemical Dissolver:
// Converts an input itemstack into any number of output itemstacks, divided in any manner between different chances, with
// the ability to run multiple rolls to produce additional outputs.

mods.alchemistry.dissolver.removeByInput(item('alchemistry:compound:1'))
// mods.alchemistry.dissolver.removeAll()
Expand All @@ -63,8 +65,9 @@ mods.alchemistry.dissolver.recipeBuilder()
.register()


// groovyscript.wiki.alchemistry.electrolyzer.title:
// groovyscript.wiki.alchemistry.electrolyzer.description
// Electrolyzer:
// Converts an input fluidstack into up to 4 output itemstacks, with the 3rd and 4th output itemstacks being able to have
// chances applied to them. May require a catalyst input itemstack, which may also have a chance to be consumed.

// mods.alchemistry.electrolyzer.removeByInput(fluid('water'))
mods.alchemistry.electrolyzer.removeByInput(element('calcium_carbonate'))
Expand All @@ -89,8 +92,8 @@ mods.alchemistry.electrolyzer.recipeBuilder()
.register()


// groovyscript.wiki.alchemistry.evaporator.title:
// groovyscript.wiki.alchemistry.evaporator.description
// Evaporator:
// Converts an input fluidstack into an output fluidstack, taking a set amount of time.

mods.alchemistry.evaporator.removeByInput(fluid('lava'))
mods.alchemistry.evaporator.removeByOutput(item('alchemistry:mineral_salt'))
Expand All @@ -107,8 +110,9 @@ mods.alchemistry.evaporator.recipeBuilder()
.register()


// groovyscript.wiki.alchemistry.liquifier.title:
// groovyscript.wiki.alchemistry.liquifier.description

// Liquifier:
// Converts an input itemstack into an output fluidstack, consuming a set amount of power.

mods.alchemistry.liquifier.removeByInput(element('water'))
// mods.alchemistry.liquifier.removeByOutput(fluid('water'))
Expand All @@ -125,3 +129,4 @@ mods.alchemistry.liquifier.recipeBuilder()
.register()



2 changes: 1 addition & 1 deletion examples/postInit/calculator.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ mods.calculator.glowstone_extractor.recipeBuilder()


// Health Processor:
// Converts an input itemstack into "Health Points", which charge a Health or Nutrition module and are converted into
// Converts an input itemstack into \"Health Points\", which charge a Health or Nutrition module and are converted into
// rapidly regenerating health.

mods.calculator.health_processor.removeByInput(item('minecraft:blaze_rod'))
Expand Down
2 changes: 1 addition & 1 deletion examples/postInit/draconicevolution.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
println 'mod \'draconicevolution\' detected, running script'

// Energy Core:
// A multiblock which stores energy
// A multiblock with 8 tiers for storing large amounts of energy.

mods.draconicevolution.energy_core.setInnerBlock(7, blockstate('minecraft:stone', 1))
mods.draconicevolution.energy_core.setOuterBlock(2, blockstate('minecraft:diamond_block'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class ModSupport implements IDynamicGroovyProperty {

public static final GroovyContainer<ActuallyAdditions> ACTUALLY_ADDITIONS = new InternalModContainer<>("actuallyadditions", "Actually Additions", ActuallyAdditions::new, "aa");
public static final GroovyContainer<AdvancedMortars> ADVANCED_MORTARS = new InternalModContainer<>("advancedmortars", "Advanced Mortars", AdvancedMortars::new);
public static final GroovyContainer<Aether> AETHER = new InternalModContainer<>("aether_legacy", "The Aether", Aether::new, "aether");
public static final GroovyContainer<Aether> AETHER = new InternalModContainer<>("aether_legacy", "Aether Legacy", Aether::new, "aether");
public static final GroovyContainer<Alchemistry> ALCHEMISTRY = new InternalModContainer<>("alchemistry", "Alchemistry", Alchemistry::new);
public static final GroovyContainer<AppliedEnergistics2> APPLIED_ENERGISTICS_2 = new InternalModContainer<>("appliedenergistics2", "Applied Energistics 2", AppliedEnergistics2::new, "ae2");
public static final GroovyContainer<AstralSorcery> ASTRAL_SORCERY = new InternalModContainer<>("astralsorcery", "Astral Sorcery", AstralSorcery::new, "astral");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,34 +92,34 @@ public static class RecipeBuilder extends AbstractRecipeBuilder<DissolverRecipe>
@Property(defaultValue = "1", valid = @Comp(value = "1", type = Comp.Type.GTE))
private int rolls = 1;

@RecipeBuilderMethodDescription
@RecipeBuilderMethodDescription(field = "probabilityGroup")
public RecipeBuilder probabilityOutput(double probability, ItemStack... probabilityOutputs) {
probabilityGroup.add(new ProbabilityGroup(Arrays.asList(probabilityOutputs), probability));
return this;
}

@RecipeBuilderMethodDescription
@RecipeBuilderMethodDescription(field = "probabilityGroup")
public RecipeBuilder probabilityOutput(ItemStack... probabilityOutputs) {
return this.probabilityOutput(100, probabilityOutputs);
}

@RecipeBuilderMethodDescription
@RecipeBuilderMethodDescription(field = "probabilityGroup")
public RecipeBuilder probabilityOutput(double probability, Collection<ItemStack> probabilityOutputs) {
probabilityGroup.add(new ProbabilityGroup((List<ItemStack>) probabilityOutputs, probability));
return this;
}

@RecipeBuilderMethodDescription
@RecipeBuilderMethodDescription(field = "probabilityGroup")
public RecipeBuilder probabilityOutput(Collection<ItemStack> probabilityOutputs) {
return this.probabilityOutput(100, probabilityOutputs);
}

@RecipeBuilderMethodDescription
@RecipeBuilderMethodDescription(field = "probabilityGroup")
public RecipeBuilder output(ItemStack... probabilityOutputs) {
return this.probabilityOutput(100, probabilityOutputs);
}

@RecipeBuilderMethodDescription
@RecipeBuilderMethodDescription(field = "probabilityGroup")
public RecipeBuilder output(Collection<ItemStack> probabilityOutputs) {
return this.probabilityOutput(100, probabilityOutputs);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class Cauldron extends VirtualizedRegistry<CookingPotRecipe> {
@Example(".input(item('minecraft:clay')).output(item('minecraft:diamond')).heat(2)"),
@Example(".input(item('minecraft:diamond')).output(item('minecraft:gold_ingot') * 16).ignoreHeat()")
})
@RecipeBuilderMethodDescription
public RecipeBuilder recipeBuilder() {
return new RecipeBuilder();
}
Expand Down Expand Up @@ -98,21 +99,25 @@ public static class RecipeBuilder extends AbstractRecipeBuilder<CookingPotRecipe
@Property(defaultValue = "1")
private int priority = 1;

@RecipeBuilderMethodDescription
public RecipeBuilder heat(int heat) {
this.heat = heat;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder ignoreHeat(boolean ignoreHeat) {
this.ignoreHeat = ignoreHeat;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder ignoreHeat() {
this.ignoreHeat = !ignoreHeat;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder priority(int priority) {
this.priority = priority;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class Crucible extends VirtualizedRegistry<CookingPotRecipe> {
@Example(".input(item('minecraft:clay')).output(item('minecraft:diamond')).heat(2)"),
@Example(".input(item('minecraft:diamond')).output(item('minecraft:gold_ingot') * 16).ignoreHeat()")
})
@RecipeBuilderMethodDescription
public RecipeBuilder recipeBuilder() {
return new RecipeBuilder();
}
Expand Down Expand Up @@ -103,21 +104,25 @@ public static class RecipeBuilder extends AbstractRecipeBuilder<CookingPotRecipe
@Property(defaultValue = "1")
private int priority = 1;

@RecipeBuilderMethodDescription
public RecipeBuilder heat(int heat) {
this.heat = heat;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder ignoreHeat(boolean ignoreHeat) {
this.ignoreHeat = ignoreHeat;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder ignoreHeat() {
this.ignoreHeat = !ignoreHeat;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder priority(int priority) {
this.priority = priority;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,41 +95,49 @@ public static class RecipeBuilder extends AbstractRecipeBuilder<KilnRecipe> {
@Property
private boolean ignoreHeat;

@RecipeBuilderMethodDescription
public RecipeBuilder input(BlockIngredient input) {
this.input = input;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder input(String input) {
this.input = new BlockIngredient(input);
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder input(List<ItemStack> input) {
this.input = new BlockIngredient(input);
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder input(ItemStack... input) {
this.input = new BlockIngredient(input);
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder input(IIngredient input) {
this.input = new BlockIngredient(input.toMcIngredient());
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder heat(int heat) {
this.heat = heat;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder ignoreHeat(boolean ignoreHeat) {
this.ignoreHeat = ignoreHeat;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder ignoreHeat() {
this.ignoreHeat = !ignoreHeat;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,25 @@ public static class RecipeBuilder extends AbstractRecipeBuilder<MillRecipe> {
@Property(defaultValue = "1")
private int priority = 1;

@RecipeBuilderMethodDescription
public RecipeBuilder ticks(int ticks) {
this.ticks = ticks;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder time(int ticks) {
this.ticks = ticks;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder soundEvent(SoundEvent soundEvent) {
this.soundEvent = soundEvent;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder priority(int priority) {
this.priority = priority;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
public class Saw extends VirtualizedRegistry<SawRecipe> {

@RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond_block')).output(item('minecraft:gold_ingot') * 16)"))
@RecipeBuilderMethodDescription
public RecipeBuilder recipeBuilder() {
return new RecipeBuilder();
}
Expand Down Expand Up @@ -88,26 +89,31 @@ public static class RecipeBuilder extends AbstractRecipeBuilder<SawRecipe> {
@Property
private BlockIngredient input;

@RecipeBuilderMethodDescription
public RecipeBuilder input(BlockIngredient input) {
this.input = input;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder input(String input) {
this.input = new BlockIngredient(input);
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder input(List<ItemStack> input) {
this.input = new BlockIngredient(input);
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder input(ItemStack... input) {
this.input = new BlockIngredient(input);
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder input(IIngredient input) {
this.input = new BlockIngredient(input.toMcIngredient());
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class Turntable extends VirtualizedRegistry<TurntableRecipe> {
@Example(".input(item('minecraft:gold_block')).outputBlock(blockstate('minecraft:clay')).output(item('minecraft:gold_ingot') * 5).rotations(5)"),
@Example(".input(item('minecraft:clay')).output(item('minecraft:gold_ingot')).rotations(2)")
})
@RecipeBuilderMethodDescription
public RecipeBuilder recipeBuilder() {
return new RecipeBuilder();
}
Expand Down Expand Up @@ -97,36 +98,43 @@ public static class RecipeBuilder extends AbstractRecipeBuilder<TurntableRecipe>
@Property(defaultValue = "1")
private int rotations = 1;

@RecipeBuilderMethodDescription
public RecipeBuilder input(BlockIngredient input) {
this.input = input;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder input(String input) {
this.input = new BlockIngredient(input);
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder input(List<ItemStack> input) {
this.input = new BlockIngredient(input);
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder input(ItemStack... input) {
this.input = new BlockIngredient(input);
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder input(IIngredient input) {
this.input = new BlockIngredient(input.toMcIngredient());
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder outputBlock(IBlockState outputBlock) {
this.outputBlock = outputBlock;
return this;
}

@RecipeBuilderMethodDescription
public RecipeBuilder rotations(int rotations) {
this.rotations = rotations;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ public String getTitle() {
}

public String getDescription() {
return Documentation.translate(description.description().isEmpty() ? String.format("%s.description", baseTranslationKey) : description.description());
return Documentation.translate(description.description().isEmpty() ? String.format("%s.description", baseTranslationKey) : description.description())
.replace("\"", "\\\"");
}

public String exampleBlock() {
Expand Down
Loading

0 comments on commit 6f7c627

Please sign in to comment.