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
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ dependencies {
runtimeOnly rfg.deobf('curse.maven:blood-magic-224791:2822288')
}

compileOnly rfg.deobf('curse.maven:actually-additions-228404:3117927')
if (project.debug_actually_additions.toBoolean()) {
runtimeOnly rfg.deobf('curse.maven:actually-additions-228404:3117927')
}

compileOnly rfg.deobf('curse.maven:cucumber-272335:2645867')
compileOnly rfg.deobf('curse.maven:extended-crafting-nomifactory-edition-398267:3613140')
if (project.debug_extended_crafting.toBoolean()) {
Expand Down
164 changes: 164 additions & 0 deletions examples/actuallyadditions.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@

// Atomic Reconstructor
// The Atomic Reconstructor is a block which uses energy to convert a block or item in front of it into other items.
mods.actuallyadditions.atomicreconstructor.recipeBuilder()
.input(item('minecraft:clay'))
.output(item('minecraft:diamond'))
.energyUse(1000) // Optional, int
.register()

mods.actuallyadditions.atomicreconstructor.recipeBuilder()
.input(item('minecraft:gold_ingot'))
.output(item('minecraft:clay') * 2)
.register()

mods.actuallyadditions.atomicreconstructor.removeByInput(item('minecraft:diamond'))
mods.actuallyadditions.atomicreconstructor.removeByOutput(item('actuallyadditions:block_crystal'))
//mods.actuallyadditions.atomicreconstructor.removeAll()

// Ball of Fur
// A weighted itemstack output for using a Ball of Fur, dropped by a cat.
mods.actuallyadditions.balloffur.recipeBuilder()
.output(item('minecraft:clay') * 32)
.weight(15)
.register()

mods.actuallyadditions.balloffur.removeByOutput(item('minecraft:feather'))
//mods.actuallyadditions.balloffur.removeAll()

// Compost
// Converts an input item into an output item after 150 seconds. Requires an input and output display blockstate.
mods.actuallyadditions.compost.recipeBuilder()
.input(item('minecraft:clay'))
.output(item('minecraft:diamond'))
.inputDisplay(blockstate('minecraft:clay'))
.outputDisplay(blockstate('minecraft:diamond_block'))
.register()

mods.actuallyadditions.compost.removeByInput(item('actuallyadditions:item_canola_seed'))
mods.actuallyadditions.compost.removeByOutput(item('actuallyadditions:item_fertilizer'))
//mods.actuallyadditions.compost.removeAll()

// Crusher
// Converts an input itemstack into an output itemstack with a chance of a second itemstack
mods.actuallyadditions.crusher.recipeBuilder()
.input(item('minecraft:clay'))
.output(item('minecraft:diamond'), item('minecraft:diamond')) // Second output is optional, and modified by chance
.chance(100) // Optional, int
.register()

mods.actuallyadditions.crusher.recipeBuilder()
.input(item('minecraft:diamond_block'))
.output(item('minecraft:diamond') * 12)
.register()

mods.actuallyadditions.crusher.removeByInput(item('minecraft:bone'))
mods.actuallyadditions.crusher.removeByOutput(item('minecraft:sugar'))
//mods.actuallyadditions.crusher.removeAll()

// Empowerer
// Turns 5 input items into an output item at the cost of power and time. Has a configurable color
mods.actuallyadditions.empowerer.recipeBuilder()
.mainInput(item('minecraft:clay')) // Optional, itemstack. if undefined and input has 5 items, mainInput uses the first itemstack input. Otherwise, errors.
.input(item('minecraft:clay'),item('minecraft:clay'),item('minecraft:clay'),item('minecraft:clay'))
.output(item('minecraft:diamond'))
.time(50)
.energy(1000) // Optional, int
.red(0.5) // Optional, float (default 0)
.green(0.3) // Optional, float (default 0)
.blue(0.2) // Optional, float (default 0)
.register()

mods.actuallyadditions.empowerer.recipeBuilder()
.mainInput(item('minecraft:clay'))
.input(item('minecraft:diamond'),item('minecraft:clay'),item('minecraft:clay'),item('minecraft:clay'))
.output(item('minecraft:diamond') * 2)
.time(50)
.color(0.5, 0.3, 0.2) // Optional, float... shorthand for (red, green, blue). Must contain exactly 3 entries. "particleColor" and "color" are aliases
.register()

mods.actuallyadditions.empowerer.recipeBuilder()
.mainInput(item('minecraft:diamond'))
.input(item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:diamond'),item('minecraft:gold_ingot'))
.output(item('minecraft:dirt') * 8)
.time(50)
.particleColor(0x00FF88) // Optional, int. Hexadecimal color. "particleColor" and "color" are aliases
.register()

mods.actuallyadditions.empowerer.recipeBuilder()
.input(item('minecraft:gold_ingot'),item('minecraft:clay'),item('minecraft:clay'),item('minecraft:clay'),item('minecraft:clay'))
.output(item('minecraft:diamond'))
.time(50)
.register()

mods.actuallyadditions.empowerer.removeByInput(item('actuallyadditions:item_crystal'))
mods.actuallyadditions.empowerer.removeByOutput(item('actuallyadditions:item_misc:24'))
//mods.actuallyadditions.empowerer.removeAll()

// Nether Mining Lens
// 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.nethermininglens.recipeBuilder()
.ore(ore('blockDiamond'))
.weight(100)
.register()

mods.actuallyadditions.nethermininglens.recipeBuilder()
.ore('blockGold')
.weight(100)
.register()

mods.actuallyadditions.nethermininglens.removeByOre(ore('oreQuartz'))
mods.actuallyadditions.nethermininglens.removeByOre('oreQuartz')
//mods.actuallyadditions.nethermininglens.removeAll()

// Oil Gen
// Turns a fluid into power at a rate
mods.actuallyadditions.oilgen.recipeBuilder()
.fluidInput(fluid('water'))
.amount(1000) // Optional, uses the FluidStack amount if not defined.
.time(50)
.register()

mods.actuallyadditions.oilgen.recipeBuilder()
.fluidInput(fluid('lava') * 50)
.time(100)
.register()

mods.actuallyadditions.oilgen.removeByInput(fluid('canolaoil').getFluid())
mods.actuallyadditions.oilgen.removeByInput('refinedcanolaoil')
//mods.actuallyadditions.oilgen.removeAll()


// Stone Mining Lens
// 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.stonemininglens.recipeBuilder()
.ore(ore('blockDiamond'))
.weight(100)
.register()

mods.actuallyadditions.stonemininglens.recipeBuilder()
.ore('blockGold')
.weight(100)
.register()

mods.actuallyadditions.stonemininglens.removeByOre(ore('oreCoal'))
mods.actuallyadditions.stonemininglens.removeByOre('oreLapis')
//mods.actuallyadditions.stonemininglens.removeAll()

// Treasure Chest
// A weighted item, with a weight to obtain and a minimum and maximum amount. Obtained via right clicking a Treasure Chest spawning randomly on the sea floor.
mods.actuallyadditions.treasurechest.recipeBuilder()
.output(item('minecraft:clay'))
.weight(50)
.min(16)
.max(32)
.register()

mods.actuallyadditions.treasurechest.removeByOutput(item('minecraft:iron_ingot'))
//mods.actuallyadditions.treasurechest.removeAll()






1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ debug_load_all_mods = true
coremod_plugin_class_name = com.cleanroommc.groovyscript.core.GroovyScriptCore

# Debug mod compat
debug_actually_additions = false
debug_chisel = false
debug_mekanism = false
debug_thermal = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.cleanroommc.groovyscript.api.GroovyBlacklist;
import com.cleanroommc.groovyscript.api.IDynamicGroovyProperty;
import com.cleanroommc.groovyscript.compat.mods.actuallyadditions.ActuallyAdditions;
import com.cleanroommc.groovyscript.compat.mods.astralsorcery.AstralSorcery;
import com.cleanroommc.groovyscript.compat.mods.bloodmagic.BloodMagic;
import com.cleanroommc.groovyscript.compat.mods.botania.Botania;
Expand Down Expand Up @@ -38,8 +39,9 @@ public class ModSupport implements IDynamicGroovyProperty {

public static final ModSupport INSTANCE = new ModSupport(); // Just for Binding purposes

public static final Container<Chisel> CHISEL = new Container<>("chisel", "Chisel", Chisel::new);
public static final Container<ActuallyAdditions> ACTUALLY_ADDITIONS = new Container<>("actuallyadditions", "Actually Additions", ActuallyAdditions::new, "aa");
public static final Container<AstralSorcery> ASTRAL_SORCERY = new Container<>("astralsorcery", "Astral Sorcery", AstralSorcery::new, "astral", "astral_sorcery", "as");
public static final Container<Chisel> CHISEL = new Container<>("chisel", "Chisel", Chisel::new);
public static final Container<EnderIO> ENDER_IO = new Container<>("enderio", "Ender IO", EnderIO::new, "eio");
public static final Container<JustEnoughItems> JEI = new Container<>("jei", "Just Enough Items", JustEnoughItems::new, "hei");
public static final Container<Thaumcraft> THAUMCRAFT = new Container<>("thaumcraft", "Thaumcraft", Thaumcraft::new, "tc", "thaum");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.cleanroommc.groovyscript.compat.mods.actuallyadditions;

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

public class ActuallyAdditions extends ModPropertyContainer {

public final Crusher crusher = new Crusher();
public final OilGen oilGen = new OilGen();
public final Compost compost = new Compost();
public final BallOfFur ballOfFur = new BallOfFur();
public final TreasureChest treasureChest = new TreasureChest();
public final Empowerer empowerer = new Empowerer();
public final AtomicReconstructor atomicReconstructor = new AtomicReconstructor();
public final NetherMiningLens netherMiningLens = new NetherMiningLens();
public final StoneMiningLens stoneMiningLens = new StoneMiningLens();

public ActuallyAdditions() {
addRegistry(crusher);
addRegistry(oilGen);
addRegistry(compost);
addRegistry(ballOfFur);
addRegistry(treasureChest);
addRegistry(empowerer);
addRegistry(atomicReconstructor);
addRegistry(netherMiningLens);
addRegistry(stoneMiningLens);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
package com.cleanroommc.groovyscript.compat.mods.actuallyadditions;

import com.cleanroommc.groovyscript.api.GroovyBlacklist;
import com.cleanroommc.groovyscript.api.GroovyLog;
import com.cleanroommc.groovyscript.api.IIngredient;
import com.cleanroommc.groovyscript.compat.mods.ModSupport;
import com.cleanroommc.groovyscript.helper.SimpleObjectStream;
import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper;
import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder;
import com.cleanroommc.groovyscript.registry.VirtualizedRegistry;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import org.jetbrains.annotations.Nullable;

public class AtomicReconstructor extends VirtualizedRegistry<LensConversionRecipe> {

public AtomicReconstructor() {
super();
}

public RecipeBuilder recipeBuilder() {
return new RecipeBuilder();
}

@Override
@GroovyBlacklist
public void onReload() {
removeScripted().forEach(ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES::remove);
ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES.addAll(restoreFromBackup());
}

public LensConversionRecipe add(Ingredient input, ItemStack output, int energy, Lens type) {
LensConversionRecipe recipe = new LensConversionRecipe(input, output, energy, type);
add(recipe);
return recipe;
}

public void add(LensConversionRecipe recipe) {
if (recipe == null) return;
addScripted(recipe);
ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(recipe);
}

public boolean remove(LensConversionRecipe recipe) {
if (recipe == null) return false;
addBackup(recipe);
ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES.remove(recipe);
return true;
}

public boolean removeByInput(IIngredient input) {
return ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES.removeIf(recipe -> {
boolean found = recipe.getInput().test(IngredientHelper.toItemStack(input));
if (found) {
addBackup(recipe);
}
return found;
});
}

public boolean removeByOutput(ItemStack output) {
return ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES.removeIf(recipe -> {
boolean matches = ItemStack.areItemStacksEqual(recipe.getOutput(), output);
if (matches) {
addBackup(recipe);
}
return matches;
});
}

public void removeAll() {
ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES.forEach(this::addBackup);
ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES.clear();
}

public SimpleObjectStream<LensConversionRecipe> streamRecipes() {
return new SimpleObjectStream<>(ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES)
.setRemover(this::remove);
}

public static class RecipeBuilder extends AbstractRecipeBuilder<LensConversionRecipe> {

private int energyUse = 1;

public RecipeBuilder energyUse(int energyUse) {
this.energyUse = energyUse;
return this;
}

public RecipeBuilder energy(int energy) {
this.energyUse = energy;
return this;
}

@Override
public String getErrorMsg() {
return "Error adding Actually Additions Atomic Reconstructor recipe";
}

@Override
public void validate(GroovyLog.Msg msg) {
validateItems(msg, 1, 1, 1, 1);
validateFluids(msg);
msg.add(energyUse <= 0, "energyUse must be an integer greater than 0, yet it was {}", energyUse);
}

@Override
public @Nullable LensConversionRecipe register() {
if (!validate()) return null;
LensConversionRecipe recipe = new LensConversionRecipe(input.get(0).toMcIngredient(), output.get(0), energyUse, ActuallyAdditionsAPI.lensDefaultConversion);
ModSupport.ACTUALLY_ADDITIONS.get().atomicReconstructor.add(recipe);
return recipe;
}
}
}
Loading