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 Ice And Fire compat #258

Merged
merged 5 commits into from
Nov 8, 2024
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
23 changes: 20 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ final def mod_dependencies = [
'forestry-59751:2918418' : [project.debug_forestry],
'future-mc-310059:5626387' : [project.debug_future_mc],
'horse-power-270466:2705433' : [project.debug_horse_power],
'llibrary-243298:2504999' : [project.debug_ice_and_fire_old, project.debug_ice_and_fire_rotn],
'immersive_engineering-231951:2974106' : [project.debug_immersive_engineering, project.debug_immersive_petroleum, project.debug_immersive_technology],
'immersive-petroleum-268250:3382321' : [project.debug_immersive_petroleum],
'mct-immersive-technology-359407:5108047' : [project.debug_immersive_technology],
// WARNING: experimental must be placed before classic, otherwise you will crash when debugging either. Check FluidGenerator compat to confirm
'industrialcraft_experimental-242638:3838713' : [project.debug_industrial_craft_2_experimental],
'industrialcraft_classic-242942:3093607' : [project.debug_industrial_craft_2_classic],
'tesla-core-lib-254602:3438487' : [project.debug_industrial_foregoing],
'industrialforegoing-266515:2745321' : [project.debug_industrial_foregoing],
'inspirations-284007:2843007' : [project.debug_inspirations],
Expand Down Expand Up @@ -155,6 +153,25 @@ dependencies {
runtimeOnly 'crazypants:enderio:5.3.72'
}

// WARNING: rotn must be placed before normal, otherwise you will not be able to properly detect sources for the LightningForge
compileOnly rfg.deobf('curse.maven:ice-and-fire-rotn-edition-457668:5738729')
compileOnly rfg.deobf('curse.maven:iceandfire-264231:2939529')
if (project.debug_ice_and_fire_rotn.toBoolean()) {
runtimeOnly rfg.deobf('curse.maven:ice-and-fire-rotn-edition-457668:5738729')
} else if (project.debug_ice_and_fire_old.toBoolean()) {
runtimeOnly rfg.deobf('curse.maven:iceandfire-264231:2939529')
}

// WARNING: experimental must be placed before classic, otherwise you will crash when debugging either. Check FluidGenerator compat to confirm
compileOnly rfg.deobf('curse.maven:industrialcraft_experimental-242638:3838713')
compileOnly rfg.deobf('curse.maven:industrialcraft_classic-242942:3093607')
if (project.debug_industrial_craft_2_experimental.toBoolean()) {
runtimeOnly rfg.deobf('curse.maven:industrialcraft_experimental-242638:3838713')
} else if (project.debug_industrial_craft_2_classic.toBoolean()) {
runtimeOnly rfg.deobf('curse.maven:industrialcraft_classic-242942:3093607')
}


if (project.debug_forestry.toBoolean()) {
runtimeOnly rfg.deobf('curse.maven:jei-bees-248370:2490058')
}
Expand Down
66 changes: 66 additions & 0 deletions examples/postInit/iceandfire.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

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

log.info 'mod \'iceandfire\' detected, running script'

// Fire Dragonforge:
// Converts two input itemstacks into an output itemstack in a multiblock Dragonforge Fire Multiblock while there is a
// stage 3+ Fire Dragon nearby.

mods.iceandfire.fire_forge.removeByInput(item('minecraft:iron_ingot'))
// mods.iceandfire.fire_forge.removeByInput(item('iceandfire:fire_dragon_blood'))
// mods.iceandfire.fire_forge.removeByOutput(item('iceandfire:dragonsteel_fire_ingot'))
// mods.iceandfire.fire_forge.removeAll()

mods.iceandfire.fire_forge.recipeBuilder()
.input(item('minecraft:gold_ingot'), item('minecraft:gold_ingot'))
.output(item('minecraft:clay'))
.register()

mods.iceandfire.fire_forge.recipeBuilder()
.input(item('minecraft:diamond'), item('minecraft:clay'))
.output(item('minecraft:gold_ingot'))
.register()


// Ice Dragonforge:
// Converts two input itemstacks into an output itemstack in a multiblock Dragonforge Ice Multiblock while there is a stage
// 3+ Ice Dragon nearby.

mods.iceandfire.ice_forge.removeByInput(item('minecraft:iron_ingot'))
// mods.iceandfire.ice_forge.removeByInput(item('iceandfire:ice_dragon_blood'))
// mods.iceandfire.ice_forge.removeByOutput(item('iceandfire:dragonsteel_ice_ingot'))
// mods.iceandfire.ice_forge.removeAll()

mods.iceandfire.ice_forge.recipeBuilder()
.input(item('minecraft:gold_ingot'), item('minecraft:gold_ingot'))
.output(item('minecraft:clay'))
.register()

mods.iceandfire.ice_forge.recipeBuilder()
.input(item('minecraft:diamond'), item('minecraft:gold_ingot'))
.output(item('minecraft:clay'))
.register()


// Lightning Dragonforge:
// Converts two input itemstacks into an output itemstack in a multiblock Dragonforge Lightning Multiblock while there is a
// stage 3+ Lightning Dragon nearby.

// mods.iceandfire.lightning_forge.removeByInput(item('minecraft:iron_ingot'))
// mods.iceandfire.lightning_forge.removeByInput(item('iceandfire:lightning_dragon_blood'))
// mods.iceandfire.lightning_forge.removeByOutput(item('iceandfire:dragonsteel_lightning_ingot'))
// mods.iceandfire.lightning_forge.removeAll()

//mods.iceandfire.lightning_forge.recipeBuilder()
// .input(item('minecraft:gold_ingot'), item('minecraft:gold_ingot'))
// .output(item('minecraft:clay'))
// .register()

//mods.iceandfire.lightning_forge.recipeBuilder()
// .input(item('minecraft:diamond'), item('minecraft:gold_ingot'))
// .output(item('minecraft:clay'))
// .register()


12 changes: 6 additions & 6 deletions examples/postInit/jei.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ mods.jei.catalyst.add('minecraft.smelting', item('minecraft:clay') * 8, item('mi
mods.jei.category.hideCategory('minecraft.fuel')
// mods.jei.category.hideAll()

/*mods.jei.category.categoryBuilder()
.id(classes.GenericRecipeCategory.UID) // Note that `classes.GenericRecipeCategory` must be defined elsewhere, and this example presumes certain fields and methods exist.
.category(guiHelper -> new classes.GenericRecipeCategory(guiHelper))
.catalyst(item('minecraft:clay'))
.wrapper(classes.GenericRecipeCategory.getRecipeWrappers())
.register()*/
//mods.jei.category.categoryBuilder()
// .id(classes.GenericRecipeCategory.UID) // Note that `classes.GenericRecipeCategory` must be defined elsewhere, and this example presumes certain fields and methods exist.
// .category(guiHelper -> new classes.GenericRecipeCategory(guiHelper))
// .catalyst(item('minecraft:clay'))
// .wrapper(classes.GenericRecipeCategory.getRecipeWrappers())
// .register()


// Description Category:
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ debug_future_mc = false

debug_horse_power = false

debug_ice_and_fire_old = false
debug_ice_and_fire_rotn = false
debug_immersive_engineering = false
debug_immersive_petroleum = false
debug_immersive_technology = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.cleanroommc.groovyscript.compat.mods.futuremc.FutureMC;
import com.cleanroommc.groovyscript.compat.mods.horsepower.HorsePower;
import com.cleanroommc.groovyscript.compat.mods.ic2.IC2;
import com.cleanroommc.groovyscript.compat.mods.iceandfire.IceAndFire;
import com.cleanroommc.groovyscript.compat.mods.immersiveengineering.ImmersiveEngineering;
import com.cleanroommc.groovyscript.compat.mods.immersivepetroleum.ImmersivePetroleum;
import com.cleanroommc.groovyscript.compat.mods.immersivetechnology.ImmersiveTechnology;
Expand Down Expand Up @@ -109,6 +110,7 @@ public class ModSupport {
public static final GroovyContainer<Forestry> FORESTRY = new InternalModContainer<>("forestry", "Forestry", Forestry::new);
public static final GroovyContainer<FutureMC> FUTURE_MC = new InternalModContainer<>("futuremc", "Future MC", FutureMC::new);
public static final GroovyContainer<HorsePower> HORSE_POWER = new InternalModContainer<>("horsepower", "Horse Power", HorsePower::new);
public static final GroovyContainer<IceAndFire> ICE_AND_FIRE = new InternalModContainer<>("iceandfire", "Ice And Fire", IceAndFire::new);
public static final GroovyContainer<ImmersiveEngineering> IMMERSIVE_ENGINEERING = new InternalModContainer<>("immersiveengineering", "Immersive Engineering", ImmersiveEngineering::new, "ie");
public static final GroovyContainer<ImmersivePetroleum> IMMERSIVE_PETROLEUM = new InternalModContainer<>("immersivepetroleum", "Immersive Petroleum", ImmersivePetroleum::new);
public static final GroovyContainer<ImmersiveTechnology> IMMERSIVE_TECHNOLOGY = new InternalModContainer<>("immersivetech", "Immersive Technology", ImmersiveTechnology::new);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.cleanroommc.groovyscript.compat.mods.iceandfire;

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.StandardListRegistry;
import com.github.alexthe666.iceandfire.recipe.DragonForgeRecipe;
import com.github.alexthe666.iceandfire.recipe.IafRecipeRegistry;
import org.jetbrains.annotations.Nullable;

import java.util.Collection;

@RegistryDescription
public class FireForge extends StandardListRegistry<DragonForgeRecipe> {

@Override
public Collection<DragonForgeRecipe> getRecipes() {
return IafRecipeRegistry.FIRE_FORGE_RECIPES;
}

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

@MethodDescription(example = {
@Example("item('minecraft:iron_ingot')"), @Example(value = "item('iceandfire:fire_dragon_blood')", commented = true)
})
public boolean removeByInput(IIngredient input) {
return getRecipes().removeIf(r -> (input.test(r.getInput()) || input.test(r.getBlood())) && doAddBackup(r));
}

@MethodDescription(example = @Example(value = "item('iceandfire:dragonsteel_fire_ingot')", commented = true))
public boolean removeByOutput(IIngredient output) {
return getRecipes().removeIf(r -> output.test(r.getOutput()) && doAddBackup(r));
}

@Property(property = "input", comp = @Comp(eq = 2))
@Property(property = "output", comp = @Comp(eq = 1))
public static class RecipeBuilder extends AbstractRecipeBuilder<DragonForgeRecipe> {

@Override
public String getErrorMsg() {
return "Error adding Ice And Fire Fire Forge recipe";
}

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

@Nullable
@Override
@RecipeBuilderRegistrationMethod
public DragonForgeRecipe register() {
if (!validate()) return null;
DragonForgeRecipe recipe = null;
for (var inputStack : input.get(0).getMatchingStacks()) {
for (var blood : input.get(1).getMatchingStacks()) {
recipe = new DragonForgeRecipe(inputStack, blood, output.get(0));
ModSupport.ICE_AND_FIRE.get().fireForge.add(recipe);
}
}
return recipe;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.cleanroommc.groovyscript.compat.mods.iceandfire;

import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer;
import net.minecraftforge.fml.common.Loader;

public class IceAndFire extends GroovyPropertyContainer {

public final FireForge fireForge = new FireForge();
public final IceForge iceForge = new IceForge();
public final LightningForge lightningForge;

public IceAndFire() {
lightningForge = isRotN() ? new LightningForge() : null;
}

public static boolean isRotN() {
var entry = Loader.instance().getIndexedModList().get("iceandfire");
if (entry == null) return false;
// Name should be "Ice And Fire: RotN Edition"
return entry.getName().contains("RotN");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.cleanroommc.groovyscript.compat.mods.iceandfire;

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.StandardListRegistry;
import com.github.alexthe666.iceandfire.recipe.DragonForgeRecipe;
import com.github.alexthe666.iceandfire.recipe.IafRecipeRegistry;
import org.jetbrains.annotations.Nullable;

import java.util.Collection;

@RegistryDescription
public class IceForge extends StandardListRegistry<DragonForgeRecipe> {

@Override
public Collection<DragonForgeRecipe> getRecipes() {
return IafRecipeRegistry.ICE_FORGE_RECIPES;
}

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

@MethodDescription(example = {
@Example("item('minecraft:iron_ingot')"), @Example(value = "item('iceandfire:ice_dragon_blood')", commented = true)
})
public boolean removeByInput(IIngredient input) {
return getRecipes().removeIf(r -> (input.test(r.getInput()) || input.test(r.getBlood())) && doAddBackup(r));
}

@MethodDescription(example = @Example(value = "item('iceandfire:dragonsteel_ice_ingot')", commented = true))
public boolean removeByOutput(IIngredient output) {
return getRecipes().removeIf(r -> output.test(r.getOutput()) && doAddBackup(r));
}

@Property(property = "input", comp = @Comp(eq = 2))
@Property(property = "output", comp = @Comp(eq = 1))
public static class RecipeBuilder extends AbstractRecipeBuilder<DragonForgeRecipe> {

@Override
public String getErrorMsg() {
return "Error adding Ice And Fire Ice Forge recipe";
}

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

@Nullable
@Override
@RecipeBuilderRegistrationMethod
public DragonForgeRecipe register() {
if (!validate()) return null;
DragonForgeRecipe recipe = null;
for (var inputStack : input.get(0).getMatchingStacks()) {
for (var blood : input.get(1).getMatchingStacks()) {
recipe = new DragonForgeRecipe(inputStack, blood, output.get(0));
ModSupport.ICE_AND_FIRE.get().iceForge.add(recipe);
}
}
return recipe;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package com.cleanroommc.groovyscript.compat.mods.iceandfire;

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.StandardListRegistry;
import com.github.alexthe666.iceandfire.recipe.DragonForgeRecipe;
import com.github.alexthe666.iceandfire.recipe.IafRecipeRegistry;
import org.jetbrains.annotations.Nullable;

import java.util.Collection;

// want all the examples to be commented
@RegistryDescription(admonition = @Admonition("groovyscript.wiki.iceandfire.lightning_forge.note"))
public class LightningForge extends StandardListRegistry<DragonForgeRecipe> {

@Override
public Collection<DragonForgeRecipe> getRecipes() {
return IafRecipeRegistry.LIGHTNING_FORGE_RECIPES;
}

@RecipeBuilderDescription(example = {
@Example(value = ".input(item('minecraft:gold_ingot'), item('minecraft:gold_ingot')).output(item('minecraft:clay'))", commented = true),
@Example(value = ".input(item('minecraft:diamond'), item('minecraft:gold_ingot')).output(item('minecraft:clay'))", commented = true)
})
public RecipeBuilder recipeBuilder() {
return new RecipeBuilder();
}

@MethodDescription(example = {
@Example(value = "item('minecraft:iron_ingot')", commented = true), @Example(value = "item('iceandfire:lightning_dragon_blood')", commented = true)
})
public boolean removeByInput(IIngredient input) {
return getRecipes().removeIf(r -> (input.test(r.getInput()) || input.test(r.getBlood())) && doAddBackup(r));
}

@MethodDescription(example = @Example(value = "item('iceandfire:dragonsteel_lightning_ingot')", commented = true))
public boolean removeByOutput(IIngredient output) {
return getRecipes().removeIf(r -> output.test(r.getOutput()) && doAddBackup(r));
}

@Property(property = "input", comp = @Comp(eq = 2))
@Property(property = "output", comp = @Comp(eq = 1))
public static class RecipeBuilder extends AbstractRecipeBuilder<DragonForgeRecipe> {

@Override
public String getErrorMsg() {
return "Error adding Ice And Fire Lightning Forge recipe";
}

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

@Nullable
@Override
@RecipeBuilderRegistrationMethod
public DragonForgeRecipe register() {
if (!validate()) return null;
DragonForgeRecipe recipe = null;
for (var inputStack : input.get(0).getMatchingStacks()) {
for (var blood : input.get(1).getMatchingStacks()) {
recipe = new DragonForgeRecipe(inputStack, blood, output.get(0));
ModSupport.ICE_AND_FIRE.get().lightningForge.add(recipe);
}
}
return recipe;
}
}
}
Loading