generated from CleanroomMC/TemplateDevEnv
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
- Loading branch information
1 parent
aef4323
commit bb8b1d9
Showing
11 changed files
with
355 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/main/java/com/cleanroommc/groovyscript/compat/mods/iceandfire/FireForge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/cleanroommc/groovyscript/compat/mods/iceandfire/IceAndFire.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
src/main/java/com/cleanroommc/groovyscript/compat/mods/iceandfire/IceForge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
src/main/java/com/cleanroommc/groovyscript/compat/mods/iceandfire/LightningForge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
Oops, something went wrong.