Skip to content

Commit bb8b1d9

Browse files
authored
add Ice And Fire compat (#258)
* add ice and fire compat * extract complex compat dependencies from map * replace example block comments with line comments * update how isRotN is checked based on review
1 parent aef4323 commit bb8b1d9

File tree

11 files changed

+355
-14
lines changed

11 files changed

+355
-14
lines changed

dependencies.gradle

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,10 @@ final def mod_dependencies = [
7272
'forestry-59751:2918418' : [project.debug_forestry],
7373
'future-mc-310059:5626387' : [project.debug_future_mc],
7474
'horse-power-270466:2705433' : [project.debug_horse_power],
75+
'llibrary-243298:2504999' : [project.debug_ice_and_fire_old, project.debug_ice_and_fire_rotn],
7576
'immersive_engineering-231951:2974106' : [project.debug_immersive_engineering, project.debug_immersive_petroleum, project.debug_immersive_technology],
7677
'immersive-petroleum-268250:3382321' : [project.debug_immersive_petroleum],
7778
'mct-immersive-technology-359407:5108047' : [project.debug_immersive_technology],
78-
// WARNING: experimental must be placed before classic, otherwise you will crash when debugging either. Check FluidGenerator compat to confirm
79-
'industrialcraft_experimental-242638:3838713' : [project.debug_industrial_craft_2_experimental],
80-
'industrialcraft_classic-242942:3093607' : [project.debug_industrial_craft_2_classic],
8179
'tesla-core-lib-254602:3438487' : [project.debug_industrial_foregoing],
8280
'industrialforegoing-266515:2745321' : [project.debug_industrial_foregoing],
8381
'inspirations-284007:2843007' : [project.debug_inspirations],
@@ -155,6 +153,25 @@ dependencies {
155153
runtimeOnly 'crazypants:enderio:5.3.72'
156154
}
157155

156+
// WARNING: rotn must be placed before normal, otherwise you will not be able to properly detect sources for the LightningForge
157+
compileOnly rfg.deobf('curse.maven:ice-and-fire-rotn-edition-457668:5738729')
158+
compileOnly rfg.deobf('curse.maven:iceandfire-264231:2939529')
159+
if (project.debug_ice_and_fire_rotn.toBoolean()) {
160+
runtimeOnly rfg.deobf('curse.maven:ice-and-fire-rotn-edition-457668:5738729')
161+
} else if (project.debug_ice_and_fire_old.toBoolean()) {
162+
runtimeOnly rfg.deobf('curse.maven:iceandfire-264231:2939529')
163+
}
164+
165+
// WARNING: experimental must be placed before classic, otherwise you will crash when debugging either. Check FluidGenerator compat to confirm
166+
compileOnly rfg.deobf('curse.maven:industrialcraft_experimental-242638:3838713')
167+
compileOnly rfg.deobf('curse.maven:industrialcraft_classic-242942:3093607')
168+
if (project.debug_industrial_craft_2_experimental.toBoolean()) {
169+
runtimeOnly rfg.deobf('curse.maven:industrialcraft_experimental-242638:3838713')
170+
} else if (project.debug_industrial_craft_2_classic.toBoolean()) {
171+
runtimeOnly rfg.deobf('curse.maven:industrialcraft_classic-242942:3093607')
172+
}
173+
174+
158175
if (project.debug_forestry.toBoolean()) {
159176
runtimeOnly rfg.deobf('curse.maven:jei-bees-248370:2490058')
160177
}

examples/postInit/iceandfire.groovy

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
2+
// Auto generated groovyscript example file
3+
// MODS_LOADED: iceandfire
4+
5+
log.info 'mod \'iceandfire\' detected, running script'
6+
7+
// Fire Dragonforge:
8+
// Converts two input itemstacks into an output itemstack in a multiblock Dragonforge Fire Multiblock while there is a
9+
// stage 3+ Fire Dragon nearby.
10+
11+
mods.iceandfire.fire_forge.removeByInput(item('minecraft:iron_ingot'))
12+
// mods.iceandfire.fire_forge.removeByInput(item('iceandfire:fire_dragon_blood'))
13+
// mods.iceandfire.fire_forge.removeByOutput(item('iceandfire:dragonsteel_fire_ingot'))
14+
// mods.iceandfire.fire_forge.removeAll()
15+
16+
mods.iceandfire.fire_forge.recipeBuilder()
17+
.input(item('minecraft:gold_ingot'), item('minecraft:gold_ingot'))
18+
.output(item('minecraft:clay'))
19+
.register()
20+
21+
mods.iceandfire.fire_forge.recipeBuilder()
22+
.input(item('minecraft:diamond'), item('minecraft:clay'))
23+
.output(item('minecraft:gold_ingot'))
24+
.register()
25+
26+
27+
// Ice Dragonforge:
28+
// Converts two input itemstacks into an output itemstack in a multiblock Dragonforge Ice Multiblock while there is a stage
29+
// 3+ Ice Dragon nearby.
30+
31+
mods.iceandfire.ice_forge.removeByInput(item('minecraft:iron_ingot'))
32+
// mods.iceandfire.ice_forge.removeByInput(item('iceandfire:ice_dragon_blood'))
33+
// mods.iceandfire.ice_forge.removeByOutput(item('iceandfire:dragonsteel_ice_ingot'))
34+
// mods.iceandfire.ice_forge.removeAll()
35+
36+
mods.iceandfire.ice_forge.recipeBuilder()
37+
.input(item('minecraft:gold_ingot'), item('minecraft:gold_ingot'))
38+
.output(item('minecraft:clay'))
39+
.register()
40+
41+
mods.iceandfire.ice_forge.recipeBuilder()
42+
.input(item('minecraft:diamond'), item('minecraft:gold_ingot'))
43+
.output(item('minecraft:clay'))
44+
.register()
45+
46+
47+
// Lightning Dragonforge:
48+
// Converts two input itemstacks into an output itemstack in a multiblock Dragonforge Lightning Multiblock while there is a
49+
// stage 3+ Lightning Dragon nearby.
50+
51+
// mods.iceandfire.lightning_forge.removeByInput(item('minecraft:iron_ingot'))
52+
// mods.iceandfire.lightning_forge.removeByInput(item('iceandfire:lightning_dragon_blood'))
53+
// mods.iceandfire.lightning_forge.removeByOutput(item('iceandfire:dragonsteel_lightning_ingot'))
54+
// mods.iceandfire.lightning_forge.removeAll()
55+
56+
//mods.iceandfire.lightning_forge.recipeBuilder()
57+
// .input(item('minecraft:gold_ingot'), item('minecraft:gold_ingot'))
58+
// .output(item('minecraft:clay'))
59+
// .register()
60+
61+
//mods.iceandfire.lightning_forge.recipeBuilder()
62+
// .input(item('minecraft:diamond'), item('minecraft:gold_ingot'))
63+
// .output(item('minecraft:clay'))
64+
// .register()
65+
66+

examples/postInit/jei.groovy

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ mods.jei.catalyst.add('minecraft.smelting', item('minecraft:clay') * 8, item('mi
2121
mods.jei.category.hideCategory('minecraft.fuel')
2222
// mods.jei.category.hideAll()
2323

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

3131

3232
mods.jei.category.setOrder('minecraft.crafting', 'jei.information', 'minecraft.smelting', 'groovyscript:burning', 'groovyscript:explosion', 'groovyscript:fluid_recipe', 'groovyscript:piston_push', 'minecraft.anvil')

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ debug_future_mc = false
4949

5050
debug_horse_power = false
5151

52+
debug_ice_and_fire_old = false
53+
debug_ice_and_fire_rotn = false
5254
debug_immersive_engineering = false
5355
debug_immersive_petroleum = false
5456
debug_immersive_technology = false

src/main/java/com/cleanroommc/groovyscript/compat/mods/ModSupport.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import com.cleanroommc.groovyscript.compat.mods.futuremc.FutureMC;
3434
import com.cleanroommc.groovyscript.compat.mods.horsepower.HorsePower;
3535
import com.cleanroommc.groovyscript.compat.mods.ic2.IC2;
36+
import com.cleanroommc.groovyscript.compat.mods.iceandfire.IceAndFire;
3637
import com.cleanroommc.groovyscript.compat.mods.immersiveengineering.ImmersiveEngineering;
3738
import com.cleanroommc.groovyscript.compat.mods.immersivepetroleum.ImmersivePetroleum;
3839
import com.cleanroommc.groovyscript.compat.mods.immersivetechnology.ImmersiveTechnology;
@@ -109,6 +110,7 @@ public class ModSupport {
109110
public static final GroovyContainer<Forestry> FORESTRY = new InternalModContainer<>("forestry", "Forestry", Forestry::new);
110111
public static final GroovyContainer<FutureMC> FUTURE_MC = new InternalModContainer<>("futuremc", "Future MC", FutureMC::new);
111112
public static final GroovyContainer<HorsePower> HORSE_POWER = new InternalModContainer<>("horsepower", "Horse Power", HorsePower::new);
113+
public static final GroovyContainer<IceAndFire> ICE_AND_FIRE = new InternalModContainer<>("iceandfire", "Ice And Fire", IceAndFire::new);
112114
public static final GroovyContainer<ImmersiveEngineering> IMMERSIVE_ENGINEERING = new InternalModContainer<>("immersiveengineering", "Immersive Engineering", ImmersiveEngineering::new, "ie");
113115
public static final GroovyContainer<ImmersivePetroleum> IMMERSIVE_PETROLEUM = new InternalModContainer<>("immersivepetroleum", "Immersive Petroleum", ImmersivePetroleum::new);
114116
public static final GroovyContainer<ImmersiveTechnology> IMMERSIVE_TECHNOLOGY = new InternalModContainer<>("immersivetech", "Immersive Technology", ImmersiveTechnology::new);
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package com.cleanroommc.groovyscript.compat.mods.iceandfire;
2+
3+
import com.cleanroommc.groovyscript.api.GroovyLog;
4+
import com.cleanroommc.groovyscript.api.IIngredient;
5+
import com.cleanroommc.groovyscript.api.documentation.annotations.*;
6+
import com.cleanroommc.groovyscript.compat.mods.ModSupport;
7+
import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder;
8+
import com.cleanroommc.groovyscript.registry.StandardListRegistry;
9+
import com.github.alexthe666.iceandfire.recipe.DragonForgeRecipe;
10+
import com.github.alexthe666.iceandfire.recipe.IafRecipeRegistry;
11+
import org.jetbrains.annotations.Nullable;
12+
13+
import java.util.Collection;
14+
15+
@RegistryDescription
16+
public class FireForge extends StandardListRegistry<DragonForgeRecipe> {
17+
18+
@Override
19+
public Collection<DragonForgeRecipe> getRecipes() {
20+
return IafRecipeRegistry.FIRE_FORGE_RECIPES;
21+
}
22+
23+
@RecipeBuilderDescription(example = {
24+
@Example(".input(item('minecraft:gold_ingot'), item('minecraft:gold_ingot')).output(item('minecraft:clay'))"),
25+
@Example(".input(item('minecraft:diamond'), item('minecraft:clay')).output(item('minecraft:gold_ingot'))")
26+
})
27+
public RecipeBuilder recipeBuilder() {
28+
return new RecipeBuilder();
29+
}
30+
31+
@MethodDescription(example = {
32+
@Example("item('minecraft:iron_ingot')"), @Example(value = "item('iceandfire:fire_dragon_blood')", commented = true)
33+
})
34+
public boolean removeByInput(IIngredient input) {
35+
return getRecipes().removeIf(r -> (input.test(r.getInput()) || input.test(r.getBlood())) && doAddBackup(r));
36+
}
37+
38+
@MethodDescription(example = @Example(value = "item('iceandfire:dragonsteel_fire_ingot')", commented = true))
39+
public boolean removeByOutput(IIngredient output) {
40+
return getRecipes().removeIf(r -> output.test(r.getOutput()) && doAddBackup(r));
41+
}
42+
43+
@Property(property = "input", comp = @Comp(eq = 2))
44+
@Property(property = "output", comp = @Comp(eq = 1))
45+
public static class RecipeBuilder extends AbstractRecipeBuilder<DragonForgeRecipe> {
46+
47+
@Override
48+
public String getErrorMsg() {
49+
return "Error adding Ice And Fire Fire Forge recipe";
50+
}
51+
52+
@Override
53+
public void validate(GroovyLog.Msg msg) {
54+
validateItems(msg, 2, 2, 1, 1);
55+
validateFluids(msg);
56+
}
57+
58+
@Nullable
59+
@Override
60+
@RecipeBuilderRegistrationMethod
61+
public DragonForgeRecipe register() {
62+
if (!validate()) return null;
63+
DragonForgeRecipe recipe = null;
64+
for (var inputStack : input.get(0).getMatchingStacks()) {
65+
for (var blood : input.get(1).getMatchingStacks()) {
66+
recipe = new DragonForgeRecipe(inputStack, blood, output.get(0));
67+
ModSupport.ICE_AND_FIRE.get().fireForge.add(recipe);
68+
}
69+
}
70+
return recipe;
71+
}
72+
}
73+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.cleanroommc.groovyscript.compat.mods.iceandfire;
2+
3+
import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer;
4+
import net.minecraftforge.fml.common.Loader;
5+
6+
public class IceAndFire extends GroovyPropertyContainer {
7+
8+
public final FireForge fireForge = new FireForge();
9+
public final IceForge iceForge = new IceForge();
10+
public final LightningForge lightningForge;
11+
12+
public IceAndFire() {
13+
lightningForge = isRotN() ? new LightningForge() : null;
14+
}
15+
16+
public static boolean isRotN() {
17+
var entry = Loader.instance().getIndexedModList().get("iceandfire");
18+
if (entry == null) return false;
19+
// Name should be "Ice And Fire: RotN Edition"
20+
return entry.getName().contains("RotN");
21+
}
22+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package com.cleanroommc.groovyscript.compat.mods.iceandfire;
2+
3+
import com.cleanroommc.groovyscript.api.GroovyLog;
4+
import com.cleanroommc.groovyscript.api.IIngredient;
5+
import com.cleanroommc.groovyscript.api.documentation.annotations.*;
6+
import com.cleanroommc.groovyscript.compat.mods.ModSupport;
7+
import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder;
8+
import com.cleanroommc.groovyscript.registry.StandardListRegistry;
9+
import com.github.alexthe666.iceandfire.recipe.DragonForgeRecipe;
10+
import com.github.alexthe666.iceandfire.recipe.IafRecipeRegistry;
11+
import org.jetbrains.annotations.Nullable;
12+
13+
import java.util.Collection;
14+
15+
@RegistryDescription
16+
public class IceForge extends StandardListRegistry<DragonForgeRecipe> {
17+
18+
@Override
19+
public Collection<DragonForgeRecipe> getRecipes() {
20+
return IafRecipeRegistry.ICE_FORGE_RECIPES;
21+
}
22+
23+
@RecipeBuilderDescription(example = {
24+
@Example(".input(item('minecraft:gold_ingot'), item('minecraft:gold_ingot')).output(item('minecraft:clay'))"),
25+
@Example(".input(item('minecraft:diamond'), item('minecraft:gold_ingot')).output(item('minecraft:clay'))")
26+
})
27+
public RecipeBuilder recipeBuilder() {
28+
return new RecipeBuilder();
29+
}
30+
31+
@MethodDescription(example = {
32+
@Example("item('minecraft:iron_ingot')"), @Example(value = "item('iceandfire:ice_dragon_blood')", commented = true)
33+
})
34+
public boolean removeByInput(IIngredient input) {
35+
return getRecipes().removeIf(r -> (input.test(r.getInput()) || input.test(r.getBlood())) && doAddBackup(r));
36+
}
37+
38+
@MethodDescription(example = @Example(value = "item('iceandfire:dragonsteel_ice_ingot')", commented = true))
39+
public boolean removeByOutput(IIngredient output) {
40+
return getRecipes().removeIf(r -> output.test(r.getOutput()) && doAddBackup(r));
41+
}
42+
43+
@Property(property = "input", comp = @Comp(eq = 2))
44+
@Property(property = "output", comp = @Comp(eq = 1))
45+
public static class RecipeBuilder extends AbstractRecipeBuilder<DragonForgeRecipe> {
46+
47+
@Override
48+
public String getErrorMsg() {
49+
return "Error adding Ice And Fire Ice Forge recipe";
50+
}
51+
52+
@Override
53+
public void validate(GroovyLog.Msg msg) {
54+
validateItems(msg, 2, 2, 1, 1);
55+
validateFluids(msg);
56+
}
57+
58+
@Nullable
59+
@Override
60+
@RecipeBuilderRegistrationMethod
61+
public DragonForgeRecipe register() {
62+
if (!validate()) return null;
63+
DragonForgeRecipe recipe = null;
64+
for (var inputStack : input.get(0).getMatchingStacks()) {
65+
for (var blood : input.get(1).getMatchingStacks()) {
66+
recipe = new DragonForgeRecipe(inputStack, blood, output.get(0));
67+
ModSupport.ICE_AND_FIRE.get().iceForge.add(recipe);
68+
}
69+
}
70+
return recipe;
71+
}
72+
}
73+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package com.cleanroommc.groovyscript.compat.mods.iceandfire;
2+
3+
import com.cleanroommc.groovyscript.api.GroovyLog;
4+
import com.cleanroommc.groovyscript.api.IIngredient;
5+
import com.cleanroommc.groovyscript.api.documentation.annotations.*;
6+
import com.cleanroommc.groovyscript.compat.mods.ModSupport;
7+
import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder;
8+
import com.cleanroommc.groovyscript.registry.StandardListRegistry;
9+
import com.github.alexthe666.iceandfire.recipe.DragonForgeRecipe;
10+
import com.github.alexthe666.iceandfire.recipe.IafRecipeRegistry;
11+
import org.jetbrains.annotations.Nullable;
12+
13+
import java.util.Collection;
14+
15+
// want all the examples to be commented
16+
@RegistryDescription(admonition = @Admonition("groovyscript.wiki.iceandfire.lightning_forge.note"))
17+
public class LightningForge extends StandardListRegistry<DragonForgeRecipe> {
18+
19+
@Override
20+
public Collection<DragonForgeRecipe> getRecipes() {
21+
return IafRecipeRegistry.LIGHTNING_FORGE_RECIPES;
22+
}
23+
24+
@RecipeBuilderDescription(example = {
25+
@Example(value = ".input(item('minecraft:gold_ingot'), item('minecraft:gold_ingot')).output(item('minecraft:clay'))", commented = true),
26+
@Example(value = ".input(item('minecraft:diamond'), item('minecraft:gold_ingot')).output(item('minecraft:clay'))", commented = true)
27+
})
28+
public RecipeBuilder recipeBuilder() {
29+
return new RecipeBuilder();
30+
}
31+
32+
@MethodDescription(example = {
33+
@Example(value = "item('minecraft:iron_ingot')", commented = true), @Example(value = "item('iceandfire:lightning_dragon_blood')", commented = true)
34+
})
35+
public boolean removeByInput(IIngredient input) {
36+
return getRecipes().removeIf(r -> (input.test(r.getInput()) || input.test(r.getBlood())) && doAddBackup(r));
37+
}
38+
39+
@MethodDescription(example = @Example(value = "item('iceandfire:dragonsteel_lightning_ingot')", commented = true))
40+
public boolean removeByOutput(IIngredient output) {
41+
return getRecipes().removeIf(r -> output.test(r.getOutput()) && doAddBackup(r));
42+
}
43+
44+
@Property(property = "input", comp = @Comp(eq = 2))
45+
@Property(property = "output", comp = @Comp(eq = 1))
46+
public static class RecipeBuilder extends AbstractRecipeBuilder<DragonForgeRecipe> {
47+
48+
@Override
49+
public String getErrorMsg() {
50+
return "Error adding Ice And Fire Lightning Forge recipe";
51+
}
52+
53+
@Override
54+
public void validate(GroovyLog.Msg msg) {
55+
validateItems(msg, 2, 2, 1, 1);
56+
validateFluids(msg);
57+
}
58+
59+
@Nullable
60+
@Override
61+
@RecipeBuilderRegistrationMethod
62+
public DragonForgeRecipe register() {
63+
if (!validate()) return null;
64+
DragonForgeRecipe recipe = null;
65+
for (var inputStack : input.get(0).getMatchingStacks()) {
66+
for (var blood : input.get(1).getMatchingStacks()) {
67+
recipe = new DragonForgeRecipe(inputStack, blood, output.get(0));
68+
ModSupport.ICE_AND_FIRE.get().lightningForge.add(recipe);
69+
}
70+
}
71+
return recipe;
72+
}
73+
}
74+
}

0 commit comments

Comments
 (0)