Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Better With Addons compat #271

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ final def mod_dependencies = [
'the-aurorian-352137:4981736' : [project.debug_aurorian],
'avaritia_1_10-261348:3143349' : [project.debug_avaritia],
'atum-2-59621:3116599' : [project.debug_atum],
'bwm-core-294335:2624990' : [project.debug_better_with_mods],
'bwm-suite-246760:3289033' : [project.debug_better_with_mods],
'better-with-addons-268326:2899407' : [project.debug_better_with_addons],
'bwm-core-294335:2624990' : [project.debug_better_with_addons, project.debug_better_with_mods],
'bwm-suite-246760:3289033' : [project.debug_better_with_addons, project.debug_better_with_mods],
'blood-magic-224791:2822288' : [project.debug_blood_magic],
'guide-api-228832:2645992' : [project.debug_blood_magic, project.debug_woot],
'botania-225643:3330934' : [project.debug_botania, project.debug_botania_tweaks, project.debug_botanic_additions, project.debug_extra_botany],
Expand Down Expand Up @@ -143,6 +144,11 @@ dependencies {
}
}

compileOnly rfg.deobf('curse.maven:better-with-everything-896908:5202745')
if (!(project.debug_better_with_addons.toBoolean() || project.debug_better_with_mods.toBoolean()) && project.debug_better_with_everything.toBoolean()) {
runtimeOnly rfg.deobf('curse.maven:better-with-everything-896908:5202745')
}

if (project.debug_thaum.toBoolean()) {
runtimeOnly 'curse.maven:thaumic_jei-285492:2705304'
}
Expand Down
260 changes: 260 additions & 0 deletions examples/postInit/betterwithaddons.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@

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

log.info '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
// directly below the Drying Box, 8 Sand around the Drying Box, and a Dead Bush placed on the Sand. Only functions in a
// non-snowy biome with sky access during the day, and functions twice as fast when in a hot biome.

mods.betterwithaddons.drying_box.removeByInput(item('betterwithaddons:japanmat:2'))
mods.betterwithaddons.drying_box.removeByOutput(item('minecraft:sponge'))
// mods.betterwithaddons.drying_box.removeAll()

mods.betterwithaddons.drying_box.recipeBuilder()
.input(item('minecraft:diamond'))
.output(item('minecraft:clay'))
.register()

mods.betterwithaddons.drying_box.recipeBuilder()
.input(item('minecraft:gold_ingot'))
.output(item('minecraft:clay') * 4)
.register()


// Fire Net:
// Converts an input item into any number of output itemstacks if placed within the appropriate multiblock. The multiblock
// is Lava or Fire directly below the Netted Screen, 8 Stone Brick around the Lava or Fire, and 8 Slat Blocks placed around
// the Netted Screen.

mods.betterwithaddons.fire_net.removeByInput(item('betterwithaddons:iron_sand'))
mods.betterwithaddons.fire_net.removeByOutput(item('betterwithaddons:japanmat:12'))
// mods.betterwithaddons.fire_net.removeAll()

mods.betterwithaddons.fire_net.recipeBuilder()
.input(item('minecraft:diamond'))
.output(item('minecraft:clay'))
.register()

mods.betterwithaddons.fire_net.recipeBuilder()
.input(item('minecraft:gold_ingot'))
.output(item('minecraft:clay') * 4, item('minecraft:diamond'), item('minecraft:diamond') * 2)
.register()


// Ancestral Infusion Crafting:
// Converts a custom crafting recipe an output itemstack, consuming Spirits from the Infused Soul Sand placed below the
// Ancestral Infuser if placed within the appropriate multiblock. The multiblock is either Soul Sand or Infused Soul Sand
// placed below the Ancestral Infuser and exclusively air blocks adjacent to the Infuser and Soul Sand blocks.

mods.betterwithaddons.infuser.removeByInput(item('betterwithaddons:japanmat:16'))
mods.betterwithaddons.infuser.removeByOutput(item('betterwithaddons:ya'))
// mods.betterwithaddons.infuser.removeAll()

mods.betterwithaddons.infuser.shapedBuilder()
.output(item('minecraft:stone'))
.matrix('BXX',
'X B')
.key('B', item('minecraft:stone'))
.key('X', item('minecraft:gold_ingot'))
.spirits(1)
.mirrored()
.register()

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')]])
.spirits(6)
.register()

mods.betterwithaddons.infuser.shapelessBuilder()
.output(item('minecraft:clay') * 8)
.input(item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'))
.register()

mods.betterwithaddons.infuser.shapelessBuilder()
.output(item('minecraft:clay') * 32)
.input(item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'))
.spirits(8)
.register()


// Alicio Tree Foods:
// Converts an input item into an amount of food for the tree to gradually consume, eventually summoning a random creature
// nearby.

mods.betterwithaddons.lure_tree.removeByInput(item('minecraft:rotten_flesh'))
// mods.betterwithaddons.lure_tree.removeAll()

mods.betterwithaddons.lure_tree.recipeBuilder()
.input(item('minecraft:diamond'))
.food(1000)
.register()

mods.betterwithaddons.lure_tree.recipeBuilder()
.input(item('minecraft:gold_ingot'))
.food(4)
.register()


mods.betterwithaddons.lure_tree.addBlacklist(entity('minecraft:chicken'))

// Rotting Food:
// Converts an input item into an output itemstack after the given time has passed. Has the ability to customize the
// terminology used to indicate the age.

mods.betterwithaddons.rotting.removeByInput(item('betterwithaddons:food_cooked_rice'))
mods.betterwithaddons.rotting.removeByOutput(item('minecraft:rotten_flesh'))
// mods.betterwithaddons.rotting.removeAll()

mods.betterwithaddons.rotting.recipeBuilder()
.input(item('minecraft:gold_ingot'))
.register()

mods.betterwithaddons.rotting.recipeBuilder()
.input(item('placeholdername:snack'))
.time(100)
.key('groovy_example')
.rotted(item('minecraft:clay') * 4)
.register()


// Sand Net:
// Converts an input item into any number of output itemstacks if placed within the appropriate multiblock. The multiblock
// is a Slat Block directly below the Netted Screen, 8 Water Blocks around the Water, and 8 Slat Blocks placed around the
// Netted Screen.

mods.betterwithaddons.sand_net.removeByInput(item('minecraft:iron_ingot'))
mods.betterwithaddons.sand_net.removeByOutput(item('minecraft:sand'))
mods.betterwithaddons.sand_net.removeByOutput(item('betterwithaddons:iron_sand'))
// mods.betterwithaddons.sand_net.removeAll()

mods.betterwithaddons.sand_net.recipeBuilder()
.input(item('minecraft:diamond'))
.output(item('minecraft:clay'))
.register()

mods.betterwithaddons.sand_net.recipeBuilder()
.input(item('minecraft:diamond'))
.output(item('minecraft:gold_ingot'))
.sand(2)
.register()

mods.betterwithaddons.sand_net.recipeBuilder()
.input(item('minecraft:gold_ingot'))
.output(item('minecraft:clay') * 4, item('minecraft:diamond'), item('minecraft:diamond') * 2)
.sand(5)
.register()


// Soaking Unit:
// Converts an input item into an output itemstack if placed within the appropriate multiblock. The multiblock is Ice
// directly above the Soaking Box, 8 Water around the Soaking Box, and Water directly below the Soaking Box.

mods.betterwithaddons.soaking_box.removeByInput(item('betterwithaddons:bamboo'))
mods.betterwithaddons.soaking_box.removeByOutput(item('betterwithaddons:japanmat:8'))
// mods.betterwithaddons.soaking_box.removeAll()

mods.betterwithaddons.soaking_box.recipeBuilder()
.input(item('minecraft:diamond'))
.output(item('minecraft:clay'))
.register()

mods.betterwithaddons.soaking_box.recipeBuilder()
.input(item('minecraft:gold_ingot'))
.output(item('minecraft:clay') * 4)
.register()


// Spindle:
// Converts an input itemstack into an output itemstack, with the ability to consume the Spindle, when placed against a
// Spinning Wheel powered by Mechanical Power.

mods.betterwithaddons.spindle.removeByInput(item('minecraft:vine'))
mods.betterwithaddons.spindle.removeByOutput(item('betterwithaddons:bolt'))
// mods.betterwithaddons.spindle.removeAll()

mods.betterwithaddons.spindle.recipeBuilder()
.input(item('minecraft:diamond'))
.output(item('minecraft:clay'))
.register()

mods.betterwithaddons.spindle.recipeBuilder()
.input(item('minecraft:clay') * 3)
.output(item('minecraft:diamond'))
.popoff()
.register()

mods.betterwithaddons.spindle.recipeBuilder()
.input(item('minecraft:gold_ingot'))
.output(item('minecraft:clay') * 4)
.register()


// Tatara:
// Converts an input item into an output itemstack if placed within the appropriate multiblock while fueled by Rice Ashes.
// The multiblock is Lava or Fire directly below the Tatara, 8 Clay around the Lava or Fire, 9 Nether Brick above the
// Tatara, 4 Stone Brick diagonal to the Tatara and two Iron Blocks across from each other adjacent to the Tatara.

mods.betterwithaddons.tatara.removeByInput(item('betterwithaddons:japanmat:20'))
mods.betterwithaddons.tatara.removeByOutput(item('betterwithaddons:kera'))
// mods.betterwithaddons.tatara.removeAll()

mods.betterwithaddons.tatara.recipeBuilder()
.input(item('minecraft:diamond'))
.output(item('minecraft:clay'))
.register()

mods.betterwithaddons.tatara.recipeBuilder()
.input(item('minecraft:gold_ingot'))
.output(item('minecraft:clay') * 4)
.register()


// Ancestral Infusion Transmutation:
// Converts an input item into an output itemstack, consuming Spirits from the Infused Soul Sand placed below the Ancestral
// Infuser if placed within the appropriate multiblock. The multiblock is either Soul Sand or Infused Soul Sand placed
// below the Ancestral Infuser and exclusively air blocks adjacent to the Infuser and Soul Sand blocks.

mods.betterwithaddons.transmutation.removeByInput(item('minecraft:reeds'))
mods.betterwithaddons.transmutation.removeByOutput(item('betterwithaddons:crop_rice'))
// mods.betterwithaddons.transmutation.removeAll()

mods.betterwithaddons.transmutation.recipeBuilder()
.input(item('minecraft:diamond'))
.output(item('minecraft:clay'))
.spirits(0)
.register()

mods.betterwithaddons.transmutation.recipeBuilder()
.input(item('minecraft:gold_ingot'))
.output(item('minecraft:clay') * 4)
.spirits(5)
.register()


// Water Net:
// Converts an input item into any number of output itemstacks if placed within the appropriate multiblock. The multiblock
// is a Water Block directly below the Netted Screen, 8 Sakura Planks around the Water Block, and 8 Slat Blocks placed
// around the Netted Screen.

mods.betterwithaddons.water_net.removeByInput(item('betterwithaddons:iron_sand'))
mods.betterwithaddons.water_net.removeByOutput(item('betterwithaddons:food_sashimi'))
mods.betterwithaddons.water_net.removeByOutput(item('betterwithaddons:food_fugu_sac'))
// mods.betterwithaddons.water_net.removeAll()

mods.betterwithaddons.water_net.recipeBuilder()
.input(item('minecraft:diamond'))
.output(item('minecraft:clay'))
.register()

mods.betterwithaddons.water_net.recipeBuilder()
.input(item('minecraft:gold_ingot'))
.output(item('minecraft:clay') * 4, item('minecraft:diamond'), item('minecraft:diamond') * 2)
.register()


2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ debug_atum = false
debug_aurorian = false
debug_avaritia = false

debug_better_with_addons = false
debug_better_with_everything = false
debug_better_with_mods = false
debug_blood_magic = false
debug_botania = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.cleanroommc.groovyscript.compat.mods.astralsorcery.AstralSorcery;
import com.cleanroommc.groovyscript.compat.mods.atum.Atum;
import com.cleanroommc.groovyscript.compat.mods.avaritia.Avaritia;
import com.cleanroommc.groovyscript.compat.mods.betterwithaddons.BetterWithAddons;
import com.cleanroommc.groovyscript.compat.mods.betterwithmods.BetterWithMods;
import com.cleanroommc.groovyscript.compat.mods.bloodmagic.BloodMagic;
import com.cleanroommc.groovyscript.compat.mods.botania.Botania;
Expand Down Expand Up @@ -91,6 +92,7 @@ public class ModSupport {
public static final GroovyContainer<AstralSorcery> ASTRAL_SORCERY = new InternalModContainer<>("astralsorcery", "Astral Sorcery", AstralSorcery::new, "astral");
public static final GroovyContainer<Atum> ATUM = new InternalModContainer<>("atum", "Atum 2", Atum::new);
public static final GroovyContainer<Avaritia> AVARITIA = new InternalModContainer<>("avaritia", "Avaritia", Avaritia::new);
public static final GroovyContainer<BetterWithAddons> BETTER_WITH_ADDONS = new InternalModContainer<>("betterwithaddons", "Better With Addons", BetterWithAddons::new);
public static final GroovyContainer<BetterWithMods> BETTER_WITH_MODS = new InternalModContainer<>("betterwithmods", "Better With Mods", BetterWithMods::new);
public static final GroovyContainer<BloodMagic> BLOOD_MAGIC = new InternalModContainer<>("bloodmagic", "Blood Magic: Alchemical Wizardry", BloodMagic::new, "bm");
public static final GroovyContainer<Botania> BOTANIA = new InternalModContainer<>("botania", "Botania", Botania::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public void validate(GroovyLog.Msg msg) {
validateItems(msg, 4, 4, 1, 1);
validateFluids(msg);
msg.add(mainInput == null, "mainInput must be defined");
msg.add(IngredientHelper.overMaxSize(mainInput, 1), "mainInput must have a stack size of 1");
validateStackSize(msg, 1, "mainInput", mainInput);
msg.add(energyPerStand < 0, "energyPerStand must be a non negative integer, yet it was {}", energyPerStand);
msg.add(time <= 0, "time must be an integer greater than 0, yet it was {}", time);
msg.add(red < 0 || red > 1, "red must be a float between 0 and 1, yet it was {}", red);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.cleanroommc.groovyscript.compat.mods.betterwithaddons;

import betterwithaddons.util.IngredientSized;
import com.cleanroommc.groovyscript.api.IIngredient;
import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer;
import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.fml.common.Loader;

public class BetterWithAddons extends GroovyPropertyContainer {

public final DryingBox dryingBox = new DryingBox();
public final FireNet fireNet = new FireNet();
public final Infuser infuser = new Infuser();
public final LureTree lureTree = new LureTree();
public final Packing packing;
public final Rotting rotting = new Rotting();
public final SandNet sandNet = new SandNet();
public final SoakingBox soakingBox = new SoakingBox();
public final Spindle spindle = new Spindle();
public final Tatara tatara = new Tatara();
public final Transmutation transmutation = new Transmutation();
public final WaterNet waterNet = new WaterNet();

public BetterWithAddons() {
// the format of "PackingRecipe" has changed, and we cannot build against both.
packing = isBetterWithEverything() ? null : new Packing();
}

/**
* Because Better With Addons checks if the ingredient is an instanceof {@link betterwithaddons.util.IHasSize IHasSize}
* to determine if the Ingredient has an amount, we have to use their custom Ingredient.
* <p>
* If this isn't used, then the recipe may appear correctly in JEI but will actually only consume 1 when done in-game.
*/
public static Ingredient fromIIngredient(IIngredient ingredient) {
return new IngredientSized(ingredient.toMcIngredient(), ingredient.getAmount());
}

public static boolean isBetterWithEverything() {
var entry = Loader.instance().getIndexedModList().get("betterwithaddons");
if (entry == null) return false;
return entry.getMetadata().authorList.contains("ACGaming"); // TODO identify a better way to do this, if one exists
}
}
Loading