Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ final def mod_dependencies = [
'brandons_core-231382:3408276' : [project.debug_draconic_evolution],
'draconic_evolution-223565:3431261' : [project.debug_draconic_evolution],
'redstone_flux-270789:2920436' : [project.debug_draconic_evolution, project.debug_thermal],
'the-erebus-220698:3211974' : [project.debug_erebus],
'essentialcraft-4-unofficial-254817:5416404' : [project.debug_essentialcraft_4],
'dummycore-unofficial-266491:2611426' : [project.debug_essentialcraft_4],
'cyclops-core-232758:3159497' : [project.debug_evilcraft, project.debug_integrated_dynamics],
Expand Down Expand Up @@ -131,7 +132,9 @@ final Map<String, List<String>> runtime_dependencies = [
'curse.maven:aainfo-573154:3627065' : [project.debug_actually_advanced_info],
'curse.maven:dropt-284973:3758733' : [project.debug_pyrotech],
'curse.maven:jei-bees-248370:2490058' : [project.debug_forestry],
'curse.maven:just-enough-magiculture-940521:5796192': [project.debug_erebus],
'curse.maven:just-enough-petroleum-291727:2549332' : [project.debug_immersive_petroleum],
'curse.maven:just-enough-resources-240630:4440935' : [project.debug_erebus],
'curse.maven:mouse-tweaks-unofficial-461660:5876158': [project.debug_mouse_tweaks_unofficial],
'curse.maven:reid-629017:5502915' : [project.debug_roughly_enough_ids],
'curse.maven:thaumic_jei-285492:2705304' : [project.debug_thaum],
Expand Down
75 changes: 75 additions & 0 deletions examples/postInit/erebus.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

// Auto generated groovyscript example file
// MODS_LOADED: erebus

log.info '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
// 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(material('sponge'))
mods.erebus.composter.removeFromRegistry(item('minecraft:stick'))
// mods.erebus.composter.removeAllFromBlacklist()
// mods.erebus.composter.removeAllFromMaterial()
// mods.erebus.composter.removeAllFromRegistry()

mods.erebus.composter.addBlacklist(item('erebus:wall_plants', 7))
mods.erebus.composter.addBlacklist(item('erebus:wall_plants_cultivated', 7))
mods.erebus.composter.addMaterial(material('tnt'))
mods.erebus.composter.addRegistry(item('minecraft:gold_ingot'))

// Offering Altar:
// Converts up to 3 input itemstacks into an output itemstack.

// mods.erebus.offering_altar.removeByInput(item('minecraft:emerald'))
mods.erebus.offering_altar.removeByOutput(item('erebus:materials', 38))
// mods.erebus.offering_altar.removeAll()

mods.erebus.offering_altar.recipeBuilder()
.input(item('minecraft:gold_ingot'))
.output(item('minecraft:clay'))
.register()

mods.erebus.offering_altar.recipeBuilder()
.input(item('minecraft:stone'), ore('gemDiamond'), item('minecraft:clay'))
.output(item('minecraft:gold_ingot'))
.register()


// 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.removeAll()

mods.erebus.smoothie.recipeBuilder()
.container(item('minecraft:diamond'))
.output(item('minecraft:gold_ingot'))
.register()

mods.erebus.smoothie.recipeBuilder()
.container(item('minecraft:clay'))
.input(item('minecraft:clay'))
.output(item('minecraft:gold_ingot'))
.register()

mods.erebus.smoothie.recipeBuilder()
.container(item('minecraft:gold_block'))
.fluidInput(fluid('water') * 5000)
.output(item('minecraft:gold_ingot'))
.register()

mods.erebus.smoothie.recipeBuilder()
.container(item('minecraft:stone'))
.input(item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot'))
.fluidInput(fluid('lava') * 500, fluid('formic_acid') * 500, fluid('honey') * 500, fluid('milk') * 500)
.output(item('minecraft:clay') * 5)
.register()


1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ debug_cyclic = false
debug_draconic_evolution = false

debug_enderio = false
debug_erebus = false
debug_essentialcraft_4 = false
debug_evilcraft = false
debug_extended_crafting = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.cleanroommc.groovyscript.compat.mods.cyclic.Cyclic;
import com.cleanroommc.groovyscript.compat.mods.draconicevolution.DraconicEvolution;
import com.cleanroommc.groovyscript.compat.mods.enderio.EnderIO;
import com.cleanroommc.groovyscript.compat.mods.erebus.Erebus;
import com.cleanroommc.groovyscript.compat.mods.essentialcraft.EssentialCraft;
import com.cleanroommc.groovyscript.compat.mods.evilcraft.EvilCraft;
import com.cleanroommc.groovyscript.compat.mods.extendedcrafting.ExtendedCrafting;
Expand Down Expand Up @@ -118,6 +119,7 @@ public class ModSupport {
public static final GroovyContainer<Cyclic> CYCLIC = new InternalModContainer<>("cyclicmagic", "Cyclic", Cyclic::new, "cyclic");
public static final GroovyContainer<DraconicEvolution> DRACONIC_EVOLUTION = new InternalModContainer<>("draconicevolution", "Draconic Evolution", DraconicEvolution::new, "de");
public static final GroovyContainer<EnderIO> ENDER_IO = new InternalModContainer<>("enderio", "Ender IO", EnderIO::new, "eio");
public static final GroovyContainer<Erebus> EREBUS = new InternalModContainer<>("erebus", "The Erebus", Erebus::new);
public static final GroovyContainer<EssentialCraft> ESSENTIALCRAFT = new InternalModContainer<>("essentialcraft", "EssentialCraft 4", EssentialCraft::new, "ec4");
public static final GroovyContainer<EvilCraft> EVILCRAFT = new InternalModContainer<>("evilcraft", "EvilCraft", EvilCraft::new);
public static final GroovyContainer<ExtendedCrafting> EXTENDED_CRAFTING = new InternalModContainer<>("extendedcrafting", "Extended Crafting", ExtendedCrafting::new);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package com.cleanroommc.groovyscript.compat.mods.erebus;

import com.cleanroommc.groovyscript.api.IIngredient;
import com.cleanroommc.groovyscript.api.IScriptReloadable;
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.core.mixin.erebus.ComposterRegistryAccessor;
import com.cleanroommc.groovyscript.registry.AbstractReloadableStorage;
import com.cleanroommc.groovyscript.registry.NamedRegistry;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;

import java.util.List;

@RegistryDescription(category = RegistryDescription.Category.ENTRIES, admonition = {
@Admonition(value = "groovyscript.wiki.erebus.composter.note0", type = Admonition.Type.BUG), @Admonition("groovyscript.wiki.erebus.composter.note1")
})
public class Composter extends NamedRegistry implements IScriptReloadable {

private final AbstractReloadableStorage<Material> materialStorage = new AbstractReloadableStorage<>();
private final AbstractReloadableStorage<ItemStack> registryStorage = new AbstractReloadableStorage<>();
private final AbstractReloadableStorage<ItemStack> blacklistStorage = new AbstractReloadableStorage<>();

private static List<Material> getMaterial() {
return ComposterRegistryAccessor.getMaterial();
}

private static List<ItemStack> getRegistry() {
return ComposterRegistryAccessor.getRegistry();
}

private static List<ItemStack> getBlacklist() {
return ComposterRegistryAccessor.getBlacklist();
}

@Override
public void onReload() {
var material = getMaterial();
var registry = getRegistry();
var blacklist = getBlacklist();
material.removeAll(materialStorage.removeScripted());
material.addAll(materialStorage.restoreFromBackup());
registry.removeAll(registryStorage.removeScripted());
registry.addAll(registryStorage.restoreFromBackup());
blacklist.removeAll(blacklistStorage.removeScripted());
blacklist.addAll(blacklistStorage.restoreFromBackup());
}

@Override
public void afterScriptLoad() {}

@MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("material('tnt')"))
public boolean addMaterial(Material material) {
return getMaterial().add(material) && materialStorage.addScripted(material);
}

@MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("item('minecraft:gold_ingot')"))
public boolean addRegistry(ItemStack stack) {
return getRegistry().add(stack) && registryStorage.addScripted(stack);
}

@MethodDescription(type = MethodDescription.Type.ADDITION, example = {
@Example("item('erebus:wall_plants', 7)"),
@Example("item('erebus:wall_plants_cultivated', 7)")
})
public boolean addBlacklist(ItemStack stack) {
return getBlacklist().add(stack) && blacklistStorage.addScripted(stack);
}

@MethodDescription(example = @Example("material('sponge')"))
public boolean removeFromMaterial(Material material) {
return getMaterial().removeIf(r -> material == r && materialStorage.addBackup(r));
}

@MethodDescription(example = @Example("item('minecraft:stick')"))
public boolean removeFromRegistry(IIngredient ingredient) {
return getRegistry().removeIf(r -> ingredient.test(r) && registryStorage.addBackup(r));
}

@MethodDescription(example = @Example(value = "item('erebus:wall_plants', 1)", commented = true))
public boolean removeFromBlacklist(IIngredient ingredient) {
return getBlacklist().removeIf(r -> ingredient.test(r) && blacklistStorage.addBackup(r));
}

@MethodDescription(priority = 2000, example = @Example(commented = true))
public void removeAllFromMaterial() {
var entries = getMaterial();
entries.forEach(materialStorage::addBackup);
entries.clear();
}

@MethodDescription(priority = 2000, example = @Example(commented = true))
public void removeAllFromRegistry() {
var entries = getRegistry();
entries.forEach(registryStorage::addBackup);
entries.clear();
}

@MethodDescription(priority = 2000, example = @Example(commented = true))
public void removeAllFromBlacklist() {
var entries = getBlacklist();
entries.forEach(blacklistStorage::addBackup);
entries.clear();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.cleanroommc.groovyscript.compat.mods.erebus;

import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer;

public class Erebus extends GroovyPropertyContainer {

public final Composter composter = new Composter();
public final Smoothie smoothie = new Smoothie();
public final OfferingAltar offeringAltar = new OfferingAltar();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package com.cleanroommc.groovyscript.compat.mods.erebus;

import com.cleanroommc.groovyscript.api.GroovyLog;
import com.cleanroommc.groovyscript.api.IIngredient;
import com.cleanroommc.groovyscript.api.IOreDicts;
import com.cleanroommc.groovyscript.api.documentation.annotations.*;
import com.cleanroommc.groovyscript.compat.mods.ModSupport;
import com.cleanroommc.groovyscript.core.mixin.erebus.OfferingAltarRecipeAccessor;
import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper;
import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder;
import com.cleanroommc.groovyscript.registry.StandardListRegistry;
import erebus.recipes.OfferingAltarRecipe;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import org.jetbrains.annotations.Nullable;

import java.util.Collection;
import java.util.List;

@RegistryDescription
public class OfferingAltar extends StandardListRegistry<OfferingAltarRecipe> {

@RecipeBuilderDescription(example = {
@Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:clay'))"),
@Example(".input(item('minecraft:stone'), ore('gemDiamond'), item('minecraft:clay')).output(item('minecraft:gold_ingot'))")
})
public OfferingAltar.RecipeBuilder recipeBuilder() {
return new OfferingAltar.RecipeBuilder();
}

@Override
public Collection<OfferingAltarRecipe> getRecipes() {
return OfferingAltarRecipeAccessor.getRecipes();
}

@MethodDescription(example = @Example(value = "item('minecraft:emerald')", commented = true))
public boolean removeByInput(IIngredient input) {
return getRecipes().removeIf(r -> {
for (Object object : r.getInputs()) {
if (object instanceof ItemStack stack && input.test(stack)) return doAddBackup(r);
else if (object instanceof String s) {
if (input instanceof IOreDicts d && d.getOreDicts().contains(s)) {
return true;
} else if (OreDictionary.getOres(s, false).stream().anyMatch(input)) {
return true;
}
}
}
return false;
});
}

@MethodDescription(example = @Example("item('erebus:materials', 38)"))
public boolean removeByOutput(IIngredient output) {
return getRecipes().removeIf(r -> output.test(r.getOutput()) && doAddBackup(r));
}

@Property(property = "input", comp = @Comp(gte = 1, lte = 3))
@Property(property = "output", comp = @Comp(eq = 1))
public static class RecipeBuilder extends AbstractRecipeBuilder<OfferingAltarRecipe> {

@Override
protected int getMaxItemInput() {
return 1;
}

@Override
public String getErrorMsg() {
return "Error adding Erebus Offering Altar Recipe";
}

@Override
public void validate(GroovyLog.Msg msg) {
validateItems(msg, 1, 3, 1, 1);
validateFluids(msg);
}

@Override
@RecipeBuilderRegistrationMethod
public @Nullable OfferingAltarRecipe register() {
if (!validate()) return null;
OfferingAltarRecipe recipe = null;
var inputs = IngredientHelper.cartesianProductOres(input);
for (List<Object> objects : inputs) {
recipe = OfferingAltarRecipeAccessor.createOfferingAltarRecipe(output.get(0), objects.toArray());
ModSupport.EREBUS.get().offeringAltar.add(recipe);
}
return recipe;
}
}
}
Loading