generated from CleanroomMC/TemplateDevEnv
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add LazyAE2 compat * alias * fix lang keys
- Loading branch information
1 parent
cac58d4
commit 1329264
Showing
10 changed files
with
565 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
|
||
// Auto generated groovyscript example file | ||
// MODS_LOADED: threng | ||
|
||
println 'mod \'threng\' detected, running script' | ||
|
||
// Fluix Aggregation: | ||
// Converts up to 3 input itemstacks into an output itemstack. | ||
|
||
mods.threng.aggregator.removeByInput(item('appliedenergistics2:material:45')) | ||
mods.threng.aggregator.removeByOutput(item('appliedenergistics2:material:7')) | ||
// mods.threng.aggregator.removeAll() | ||
|
||
mods.threng.aggregator.recipeBuilder() | ||
.input(ore('blockGlass'), item('minecraft:diamond')) | ||
.output(item('minecraft:diamond') * 4) | ||
.register() | ||
|
||
mods.threng.aggregator.recipeBuilder() | ||
.input(item('minecraft:gold_ingot')) | ||
.output(item('minecraft:diamond')) | ||
.register() | ||
|
||
|
||
// Pulse Centrifuge: | ||
// Converts 1 input itemstack into an output itemstack. | ||
|
||
mods.threng.centrifuge.removeByInput(item('appliedenergistics2:material')) | ||
mods.threng.centrifuge.removeByOutput(item('appliedenergistics2:material:4')) | ||
// mods.threng.centrifuge.removeAll() | ||
|
||
mods.threng.centrifuge.recipeBuilder() | ||
.input(ore('blockGlass')) | ||
.output(item('minecraft:diamond')) | ||
.register() | ||
|
||
mods.threng.centrifuge.recipeBuilder() | ||
.input(item('minecraft:gold_ingot')) | ||
.output(item('minecraft:diamond')) | ||
.register() | ||
|
||
|
||
// Crystal Energization: | ||
// Converts 1 input itemstack into an output itemstack, consuming a set amount of energy. | ||
|
||
// mods.threng.energizer.removeByInput(item('appliedenergistics2:material')) | ||
mods.threng.energizer.removeByOutput(item('appliedenergistics2:material:1')) | ||
// mods.threng.energizer.removeAll() | ||
|
||
mods.threng.energizer.recipeBuilder() | ||
.input(ore('blockGlass')) | ||
.energy(50) | ||
.output(item('minecraft:diamond')) | ||
.register() | ||
|
||
mods.threng.energizer.recipeBuilder() | ||
.input(item('minecraft:gold_ingot')) | ||
.energy(10000) | ||
.output(item('minecraft:diamond')) | ||
.register() | ||
|
||
|
||
// ME Circuit Etching: | ||
// Converts up to 3 input itemstacks from specific slots into an output itemstack. | ||
|
||
mods.threng.etcher.removeByInput(item('minecraft:diamond')) | ||
mods.threng.etcher.removeByOutput(item('appliedenergistics2:material:22')) | ||
// mods.threng.etcher.removeAll() | ||
|
||
mods.threng.etcher.recipeBuilder() | ||
.input(ore('blockGlass')) | ||
.top(item('minecraft:diamond')) | ||
.bottom(item('minecraft:clay')) | ||
.output(item('minecraft:diamond') * 5) | ||
.register() | ||
|
||
mods.threng.etcher.recipeBuilder() | ||
.input(item('minecraft:gold_ingot')) | ||
.output(item('minecraft:diamond')) | ||
.register() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Aggregator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package com.cleanroommc.groovyscript.compat.mods.lazyae2; | ||
|
||
import com.cleanroommc.groovyscript.api.GroovyLog; | ||
import com.cleanroommc.groovyscript.api.IIngredient; | ||
import com.cleanroommc.groovyscript.api.documentation.annotations.*; | ||
import com.cleanroommc.groovyscript.compat.mods.ModSupport; | ||
import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; | ||
import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; | ||
import io.github.phantamanta44.libnine.LibNine; | ||
import io.github.phantamanta44.threng.recipe.AggRecipe; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import java.util.stream.Collectors; | ||
|
||
@RegistryDescription | ||
public class Aggregator extends VirtualizedRegistry<AggRecipe> { | ||
|
||
@RecipeBuilderDescription(example = { | ||
@Example(".input(ore('blockGlass'), item('minecraft:diamond')).output(item('minecraft:diamond') * 4)"), | ||
@Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond'))") | ||
}) | ||
public static RecipeBuilder recipeBuilder() { | ||
return new RecipeBuilder(); | ||
} | ||
|
||
private static Collection<AggRecipe> recipes() { | ||
return LibNine.PROXY.getRecipeManager().getRecipeList(AggRecipe.class).recipes(); | ||
} | ||
|
||
@Override | ||
public void onReload() { | ||
removeScripted().forEach(recipes()::remove); | ||
restoreFromBackup().forEach(recipes()::add); | ||
} | ||
|
||
public void add(AggRecipe recipe) { | ||
recipes().add(recipe); | ||
addScripted(recipe); | ||
} | ||
|
||
public void remove(AggRecipe recipe) { | ||
recipes().remove(recipe); | ||
addBackup(recipe); | ||
} | ||
|
||
@MethodDescription(example = @Example("item('appliedenergistics2:material:45')")) | ||
public void removeByInput(IIngredient input) { | ||
recipes().removeIf(recipe -> { | ||
if (recipe.input().getInputs().stream().anyMatch(x -> Arrays.stream(input.getMatchingStacks()).anyMatch(x))) { | ||
addBackup(recipe); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
} | ||
|
||
@MethodDescription(example = @Example("item('appliedenergistics2:material:7')")) | ||
public void removeByOutput(IIngredient output) { | ||
recipes().removeIf(recipe -> { | ||
if (output.test(recipe.getOutput().getOutput())) { | ||
addBackup(recipe); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
} | ||
|
||
@MethodDescription(priority = 2000, example = @Example(commented = true)) | ||
public void removeAll() { | ||
recipes().forEach(this::addBackup); | ||
recipes().clear(); | ||
} | ||
|
||
@Property(property = "input", valid = {@Comp(type = Comp.Type.GTE, value = "1"), @Comp(type = Comp.Type.LTE, value = "3")}) | ||
@Property(property = "output", valid = @Comp("1")) | ||
public static class RecipeBuilder extends AbstractRecipeBuilder<AggRecipe> { | ||
|
||
@Override | ||
public String getErrorMsg() { | ||
return "Error adding Lazy AE2 Aggregator recipe"; | ||
} | ||
|
||
@Override | ||
public void validate(GroovyLog.Msg msg) { | ||
validateItems(msg, 1, 3, 1, 1); | ||
validateFluids(msg); | ||
} | ||
|
||
@Override | ||
@RecipeBuilderRegistrationMethod | ||
public @Nullable AggRecipe register() { | ||
if (!validate()) return null; | ||
|
||
AggRecipe recipe = new AggRecipe(input.stream().map(LazyAE2::matchesIIngredient).collect(Collectors.toList()), output.get(0)); | ||
ModSupport.LAZYAE2.get().aggregator.add(recipe); | ||
return recipe; | ||
} | ||
} | ||
|
||
} |
101 changes: 101 additions & 0 deletions
101
src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Centrifuge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package com.cleanroommc.groovyscript.compat.mods.lazyae2; | ||
|
||
import com.cleanroommc.groovyscript.api.GroovyLog; | ||
import com.cleanroommc.groovyscript.api.IIngredient; | ||
import com.cleanroommc.groovyscript.api.documentation.annotations.*; | ||
import com.cleanroommc.groovyscript.compat.mods.ModSupport; | ||
import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; | ||
import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; | ||
import io.github.phantamanta44.libnine.LibNine; | ||
import io.github.phantamanta44.threng.recipe.PurifyRecipe; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collection; | ||
|
||
@RegistryDescription | ||
public class Centrifuge extends VirtualizedRegistry<PurifyRecipe> { | ||
|
||
@RecipeBuilderDescription(example = { | ||
@Example(".input(ore('blockGlass')).output(item('minecraft:diamond'))"), | ||
@Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond'))") | ||
}) | ||
public static RecipeBuilder recipeBuilder() { | ||
return new RecipeBuilder(); | ||
} | ||
|
||
private static Collection<PurifyRecipe> recipes() { | ||
return LibNine.PROXY.getRecipeManager().getRecipeList(PurifyRecipe.class).recipes(); | ||
} | ||
|
||
@Override | ||
public void onReload() { | ||
removeScripted().forEach(recipes()::remove); | ||
restoreFromBackup().forEach(recipes()::add); | ||
} | ||
|
||
public void add(PurifyRecipe recipe) { | ||
recipes().add(recipe); | ||
addScripted(recipe); | ||
} | ||
|
||
public void remove(PurifyRecipe recipe) { | ||
recipes().remove(recipe); | ||
addBackup(recipe); | ||
} | ||
|
||
@MethodDescription(example = @Example("item('appliedenergistics2:material')")) | ||
public void removeByInput(IIngredient input) { | ||
recipes().removeIf(recipe -> { | ||
if (Arrays.stream(input.getMatchingStacks()).anyMatch(recipe.input().getMatcher())) { | ||
addBackup(recipe); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
} | ||
|
||
@MethodDescription(example = @Example("item('appliedenergistics2:material:4')")) | ||
public void removeByOutput(IIngredient output) { | ||
recipes().removeIf(recipe -> { | ||
if (output.test(recipe.getOutput().getOutput())) { | ||
addBackup(recipe); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
} | ||
|
||
@MethodDescription(priority = 2000, example = @Example(commented = true)) | ||
public void removeAll() { | ||
recipes().forEach(this::addBackup); | ||
recipes().clear(); | ||
} | ||
|
||
@Property(property = "input", valid = @Comp("1")) | ||
@Property(property = "output", valid = @Comp("1")) | ||
public static class RecipeBuilder extends AbstractRecipeBuilder<PurifyRecipe> { | ||
|
||
@Override | ||
public String getErrorMsg() { | ||
return "Error adding Lazy AE2 Centrifuge recipe"; | ||
} | ||
|
||
@Override | ||
public void validate(GroovyLog.Msg msg) { | ||
validateItems(msg, 1, 3, 1, 1); | ||
validateFluids(msg); | ||
} | ||
|
||
@Override | ||
@RecipeBuilderRegistrationMethod | ||
public @Nullable PurifyRecipe register() { | ||
if (!validate()) return null; | ||
|
||
PurifyRecipe recipe = new PurifyRecipe(LazyAE2.matchesIIngredient(input.get(0)), output.get(0)); | ||
ModSupport.LAZYAE2.get().centrifuge.add(recipe); | ||
return recipe; | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.