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 Industrial Foregoing compat (#159)
- Loading branch information
1 parent
21915c9
commit f88c6dc
Showing
19 changed files
with
1,302 additions
and
1 deletion.
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,118 @@ | ||
|
||
// Auto generated groovyscript example file | ||
// MODS_LOADED: industrialforegoing | ||
|
||
import net.minecraft.potion.PotionEffect | ||
|
||
println 'mod \'industrialforegoing\' detected, running script' | ||
|
||
// Bioreactor: | ||
// Converts an input item into Biofuel, with the amount of Biofuel generated being based on the number of concurrent | ||
// conversion processes inside the Bioreactor. | ||
|
||
mods.industrialforegoing.bio_reactor.removeByInput(item('minecraft:wheat_seeds')) | ||
// mods.industrialforegoing.bio_reactor.removeAll() | ||
|
||
mods.industrialforegoing.bio_reactor.add(item('minecraft:clay')) | ||
|
||
// Latex Extractor: | ||
// Converts an input block in-world into a fluidstack over time, eventually breaking the block. | ||
|
||
mods.industrialforegoing.extractor.removeByInput(item('minecraft:log2:1')) | ||
// mods.industrialforegoing.extractor.removeByOutput(fluid('latex')) | ||
// mods.industrialforegoing.extractor.removeAll() | ||
|
||
mods.industrialforegoing.extractor.add(item('minecraft:clay'), fluid('lava') * 50) | ||
mods.industrialforegoing.extractor.add(item('minecraft:stone'), fluid('water') * 100, 1) | ||
|
||
// Fluid Dictionary Converter: | ||
// Converts one fluid into another fluid at a given ratio. | ||
|
||
// mods.industrialforegoing.fluid_dictionary.removeByInput(fluid('essence')) | ||
// mods.industrialforegoing.fluid_dictionary.removeByOutput(fluid(essence')) | ||
// mods.industrialforegoing.fluid_dictionary.removeAll() | ||
|
||
mods.industrialforegoing.fluid_dictionary.add(fluid('biofuel'), fluid('latex'),) | ||
mods.industrialforegoing.fluid_dictionary.add(fluid('latex'), fluid('biofuel'),) | ||
mods.industrialforegoing.fluid_dictionary.add(fluid('essence'), fluid('latex'), 2) | ||
mods.industrialforegoing.fluid_dictionary.add(fluid('latex'), fluid('essence'), 0.5) | ||
|
||
// Laser Drill: | ||
// Converts power into ores, with a given weight, between a minimum and maximum Y value, in any whitelisted biome or not in | ||
// any blacklisted biome, and with a specific color of laser lens impacting the probability. | ||
|
||
mods.industrialforegoing.laser_drill.removeByBlacklist(biome('minecraft:sky')) | ||
mods.industrialforegoing.laser_drill.removeByLens(5) | ||
// mods.industrialforegoing.laser_drill.removeByLens(item('industrialforegoing:laser_lens:5')) | ||
mods.industrialforegoing.laser_drill.removeByOutput(item('minecraft:coal_ore')) | ||
mods.industrialforegoing.laser_drill.removeByWhitelist(biome('minecraft:hell')) | ||
// mods.industrialforegoing.laser_drill.removeAll() | ||
|
||
mods.industrialforegoing.laser_drill.recipeBuilder() | ||
.output(item('minecraft:clay')) | ||
.lensMeta(5) | ||
.weight(100) | ||
.register() | ||
|
||
|
||
// Fermentation Station: | ||
// Converts an input fluidstack into an output fluidstack. | ||
|
||
mods.industrialforegoing.ore_fermenter.removeByInput(fluid('if.ore_fluid_raw').withNbt([Ore: 'oreRedstone'])) | ||
// mods.industrialforegoing.ore_fermenter.removeByOutput(fluid('if.ore_fluid_fermented').withNbt([Ore: 'oreRedstone'])) | ||
// mods.industrialforegoing.ore_fermenter.removeAll() | ||
|
||
mods.industrialforegoing.ore_fermenter.add(fluid('if.ore_fluid_raw').withNbt(['Ore': 'oreGold']), fluid('if.ore_fluid_fermented').withNbt(['Ore': 'oreGold']) * 2) | ||
|
||
// Washing Factory: | ||
// Converts an input itemstack and input fluidstack into an output fluidstack. | ||
|
||
// mods.industrialforegoing.ore_raw.removeByInput(fluid('meat')) | ||
mods.industrialforegoing.ore_raw.removeByOre(ore('oreRedstone')) | ||
// mods.industrialforegoing.ore_raw.removeByOre('oreRedstone') | ||
// mods.industrialforegoing.ore_raw.removeByOutput(fluid('if.ore_fluid_raw').withNbt(['Ore': 'oreRedstone']),) | ||
// mods.industrialforegoing.ore_raw.removeAll() | ||
|
||
mods.industrialforegoing.ore_raw.add(ore('stone'), fluid('water') * 1000, fluid('lava') * 50) | ||
mods.industrialforegoing.ore_raw.add(ore('oreGold'), fluid('meat') * 200, fluid('if.ore_fluid_raw').withNbt(['Ore': 'oreGold']) * 300) | ||
|
||
// Fluid Sieving Machine: | ||
// Converts an input itemstack and input fluidstack into an output itemstack. | ||
|
||
mods.industrialforegoing.ore_sieve.removeByInput(fluid('if.pink_slime')) | ||
mods.industrialforegoing.ore_sieve.removeByInput(item('minecraft:sand')) | ||
// mods.industrialforegoing.ore_sieve.removeByOutput(item('industrialforegoing:pink_slime_ingot) | ||
// mods.industrialforegoing.ore_sieve.removeAll() | ||
|
||
mods.industrialforegoing.ore_sieve.add(fluid('lava') * 5, item('minecraft:gold_ingot'), item('minecraft:clay')) | ||
mods.industrialforegoing.ore_sieve.add(fluid('if.ore_fluid_fermented').withNbt(['Ore': 'oreGold']) * 100, item('minecraft:nether_star') * 2, item('minecraft:clay')) | ||
|
||
// Protein Reactor: | ||
// Converts an input item into Protein, with the amount of Protein generated being based on the number of concurrent | ||
// conversion processes inside the Protein Reactor. | ||
|
||
mods.industrialforegoing.protein_reactor.removeByInput(item('minecraft:porkchop')) | ||
// mods.industrialforegoing.protein_reactor.removeAll() | ||
|
||
mods.industrialforegoing.protein_reactor.add(item('minecraft:clay')) | ||
|
||
// Sludge Refiner: | ||
// Converts 1000mb of Sludge into a random itemstack based on the weight of the given itemstack. | ||
|
||
mods.industrialforegoing.sludge_refiner.removeByOutput(item('minecraft:clay_ball')) | ||
// mods.industrialforegoing.sludge_refiner.removeAll() | ||
|
||
mods.industrialforegoing.sludge_refiner.add(item('minecraft:gold_ingot'), 5) | ||
|
||
// Straw: | ||
// Converts an fluid block in-world into various effects for the player when consumed via a straw. | ||
|
||
// mods.industrialforegoing.straw.removeAll() | ||
|
||
mods.industrialforegoing.straw.recipeBuilder() | ||
.fluidInput(fluid('if.pink_slime')) | ||
.effect(new PotionEffect(potion('minecraft:strength'), 1800, 3)) | ||
.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
75 changes: 75 additions & 0 deletions
75
src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/BioReactor.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,75 @@ | ||
package com.cleanroommc.groovyscript.compat.mods.industrialforegoing; | ||
|
||
import com.buuz135.industrial.api.recipe.BioReactorEntry; | ||
import com.buuz135.industrial.api.recipe.IReactorEntry; | ||
import com.cleanroommc.groovyscript.api.GroovyBlacklist; | ||
import com.cleanroommc.groovyscript.api.IIngredient; | ||
import com.cleanroommc.groovyscript.api.documentation.annotations.Example; | ||
import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; | ||
import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; | ||
import com.cleanroommc.groovyscript.helper.SimpleObjectStream; | ||
import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; | ||
import com.google.common.base.Predicate; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
@RegistryDescription | ||
public class BioReactor extends VirtualizedRegistry<IReactorEntry> { | ||
|
||
@Override | ||
@GroovyBlacklist | ||
public void onReload() { | ||
BioReactorEntry.BIO_REACTOR_ENTRIES.removeAll(removeScripted()); | ||
BioReactorEntry.BIO_REACTOR_ENTRIES.addAll(restoreFromBackup()); | ||
} | ||
|
||
@MethodDescription(description = "groovyscript.wiki.industrialforegoing.bio_reactor.add0", type = MethodDescription.Type.ADDITION, example = @Example("item('minecraft:clay')")) | ||
public IReactorEntry add(ItemStack input) { | ||
return add(input, null); | ||
} | ||
|
||
@MethodDescription(description = "groovyscript.wiki.industrialforegoing.bio_reactor.add1", type = MethodDescription.Type.ADDITION) | ||
public IReactorEntry add(ItemStack input, @Nullable Predicate<NBTTagCompound> nbtCheck) { | ||
IReactorEntry recipe = new BioReactorEntry(input, nbtCheck); | ||
add(recipe); | ||
return recipe; | ||
} | ||
|
||
public void add(IReactorEntry recipe) { | ||
if (recipe == null) return; | ||
addScripted(recipe); | ||
BioReactorEntry.BIO_REACTOR_ENTRIES.add(recipe); | ||
} | ||
|
||
public boolean remove(IReactorEntry recipe) { | ||
if (recipe == null) return false; | ||
addBackup(recipe); | ||
BioReactorEntry.BIO_REACTOR_ENTRIES.remove(recipe); | ||
return true; | ||
} | ||
|
||
@MethodDescription(example = @Example("item('minecraft:wheat_seeds')")) | ||
public boolean removeByInput(IIngredient input) { | ||
return BioReactorEntry.BIO_REACTOR_ENTRIES.removeIf(recipe -> { | ||
if (input.test(recipe.getStack())) { | ||
addBackup(recipe); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
} | ||
|
||
@MethodDescription(priority = 2000, example = @Example(commented = true)) | ||
public void removeAll() { | ||
BioReactorEntry.BIO_REACTOR_ENTRIES.forEach(this::addBackup); | ||
BioReactorEntry.BIO_REACTOR_ENTRIES.clear(); | ||
} | ||
|
||
@MethodDescription(type = MethodDescription.Type.QUERY) | ||
public SimpleObjectStream<IReactorEntry> streamRecipes() { | ||
return new SimpleObjectStream<>(BioReactorEntry.BIO_REACTOR_ENTRIES) | ||
.setRemover(this::remove); | ||
} | ||
|
||
} |
88 changes: 88 additions & 0 deletions
88
src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Extractor.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,88 @@ | ||
package com.cleanroommc.groovyscript.compat.mods.industrialforegoing; | ||
|
||
import com.buuz135.industrial.api.extractor.ExtractorEntry; | ||
import com.cleanroommc.groovyscript.api.GroovyBlacklist; | ||
import com.cleanroommc.groovyscript.api.IIngredient; | ||
import com.cleanroommc.groovyscript.api.documentation.annotations.Example; | ||
import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; | ||
import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; | ||
import com.cleanroommc.groovyscript.helper.Alias; | ||
import com.cleanroommc.groovyscript.helper.SimpleObjectStream; | ||
import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.fluids.FluidStack; | ||
|
||
@RegistryDescription | ||
public class Extractor extends VirtualizedRegistry<ExtractorEntry> { | ||
|
||
public Extractor() { | ||
super(Alias.generateOfClass(Extractor.class).andGenerate("TreeFluidExtractor")); | ||
} | ||
|
||
@Override | ||
@GroovyBlacklist | ||
public void onReload() { | ||
ExtractorEntry.EXTRACTOR_ENTRIES.removeAll(removeScripted()); | ||
ExtractorEntry.EXTRACTOR_ENTRIES.addAll(restoreFromBackup()); | ||
} | ||
|
||
@MethodDescription(description = "groovyscript.wiki.industrialforegoing.extractor.add0", type = MethodDescription.Type.ADDITION, example = @Example("item('minecraft:clay'), fluid('lava') * 50")) | ||
public ExtractorEntry add(ItemStack input, FluidStack output) { | ||
return add(input, output, 0.005F); | ||
} | ||
|
||
@MethodDescription(description = "groovyscript.wiki.industrialforegoing.extractor.add1", type = MethodDescription.Type.ADDITION, example = @Example("item('minecraft:stone'), fluid('water') * 100, 1")) | ||
public ExtractorEntry add(ItemStack input, FluidStack output, float breakChance) { | ||
ExtractorEntry recipe = new ExtractorEntry(input, output, breakChance); | ||
add(recipe); | ||
return recipe; | ||
} | ||
|
||
public void add(ExtractorEntry recipe) { | ||
if (recipe == null) return; | ||
addScripted(recipe); | ||
ExtractorEntry.EXTRACTOR_ENTRIES.add(recipe); | ||
} | ||
|
||
public boolean remove(ExtractorEntry recipe) { | ||
if (recipe == null) return false; | ||
addBackup(recipe); | ||
ExtractorEntry.EXTRACTOR_ENTRIES.remove(recipe); | ||
return true; | ||
} | ||
|
||
@MethodDescription(example = @Example("item('minecraft:log2:1')")) | ||
public boolean removeByInput(IIngredient input) { | ||
return ExtractorEntry.EXTRACTOR_ENTRIES.removeIf(recipe -> { | ||
if (input.test(recipe.getItemStack())) { | ||
addBackup(recipe); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
} | ||
|
||
@MethodDescription(example = @Example(value = "fluid('latex')", commented = true)) | ||
public boolean removeByOutput(IIngredient output) { | ||
return ExtractorEntry.EXTRACTOR_ENTRIES.removeIf(recipe -> { | ||
if (output.test(recipe.getFluidStack())) { | ||
addBackup(recipe); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
} | ||
|
||
@MethodDescription(priority = 2000, example = @Example(commented = true)) | ||
public void removeAll() { | ||
ExtractorEntry.EXTRACTOR_ENTRIES.forEach(this::addBackup); | ||
ExtractorEntry.EXTRACTOR_ENTRIES.clear(); | ||
} | ||
|
||
@MethodDescription(type = MethodDescription.Type.QUERY) | ||
public SimpleObjectStream<ExtractorEntry> streamRecipes() { | ||
return new SimpleObjectStream<>(ExtractorEntry.EXTRACTOR_ENTRIES) | ||
.setRemover(this::remove); | ||
} | ||
|
||
} |
Oops, something went wrong.