feat: Mekanism Theoretical Elementizer compat

This commit is contained in:
Timo Ley 2022-11-22 22:44:33 +01:00
parent 44bb751d54
commit 6de4ad874b
9 changed files with 245 additions and 12 deletions

View File

@ -11,13 +11,18 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
classpath ('com.anatawa12.forge:ForgeGradle:1.2-1.0.+') {
changing = true
}
}
}
apply plugin: 'forge'
apply plugin: 'java'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
// define the properties file
ext.configFile = file "build.properties"
configFile.withReader {
@ -40,12 +45,15 @@ minecraft {
repositories {
maven {
name = "forestry"
url = "http://maven.ic2.player.to/"
url = "https://maven.ic2.player.to/"
metadataSources {
artifact()
}
}
}
dependencies {
compile "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}:api"
implementation "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}:api"
}
processResources

View File

@ -1,5 +1,5 @@
minecraft.version=1.7.10
forge.version=10.13.4.1448-1.7.10
forge.version=10.13.4.1614-1.7.10
mod.version=0.9.6

12
changelog.md Normal file
View File

@ -0,0 +1,12 @@
### Current version: 4.0.20
- [lets see how it likes gradle 2.14](https://github.com/jaredlll08/ModTweaker/commit/8ba1b84d2b977718f626d785dc4cf5883f646b40) - Colin Wong - Mon Jun 20 03:46:33 2022
- [Enable debug flag](https://github.com/jaredlll08/ModTweaker/commit/966235271a6a130e7786811bf9ea8b86fd5a954f) - Colin Wong - Mon Jun 20 03:33:27 2022
- [Update deps](https://github.com/jaredlll08/ModTweaker/commit/40b3bc146447ede73efc9decd006e3098f7e9981) - Colin Wong - Mon Jun 20 01:40:26 2022
- [Print stacktrace](https://github.com/jaredlll08/ModTweaker/commit/6129abadfe8c354d19cccabc16e32e18a37e3d63) - Jared - Mon Jun 20 01:36:08 2022
- [Return new mill builder with every .builder()](https://github.com/jaredlll08/ModTweaker/commit/af7808c35728b154f55c7e24f9a56ef37489f934) - Colin Wong - Mon Jun 20 01:18:49 2022
- [Add TICMaterial methods for checking if stat exists (fixes #782)](https://github.com/jaredlll08/ModTweaker/commit/3fec35f97692dfe38a35998b4a3772082a0bd3b3) - Colin Wong - Tue Oct 12 05:16:15 2021
- [don't try push to maven](https://github.com/jaredlll08/ModTweaker/commit/78021c0715d0b72aab862933ef7c62f55653aba2) - Jared - Tue Jun 29 13:18:50 2021
- [fix build](https://github.com/jaredlll08/ModTweaker/commit/504119a3e807990193b7cb55da95620886c37e0f) - Jared - Tue Jun 29 13:12:35 2021
- [auto curse push code](https://github.com/jaredlll08/ModTweaker/commit/77a1633529b9e2c9e9ffbc52fa83f785df419b2a) - Jared - Tue Jun 29 13:08:55 2021
- [old version push](https://github.com/jaredlll08/ModTweaker/commit/521462c17027d124081bc5f923aff106d4c54f4f) - Jared - Tue Jun 29 12:49:16 2021
- [Add support for pulley blocks (#781)](https://github.com/jaredlll08/ModTweaker/commit/0b5404c71101db84670e49d546c148e7d733994a) - Colin Wong - Wed Jun 23 18:34:06 2021

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip

View File

@ -22,6 +22,7 @@ import modtweaker2.mods.mekanism.handlers.Sawmill;
import modtweaker2.mods.mekanism.handlers.Separator;
import modtweaker2.mods.mekanism.handlers.SolarEvaporation;
import modtweaker2.mods.mekanism.handlers.SolarNeutronActivator;
import modtweaker2.mods.mekanism.handlers.TheoreticalElementizer;
import modtweaker2.utils.TweakerPlugin;
public class Mekanism extends TweakerPlugin {
@ -47,5 +48,6 @@ public class Mekanism extends TweakerPlugin {
MineTweakerAPI.registerClass(Separator.class);
MineTweakerAPI.registerClass(SolarEvaporation.class);
MineTweakerAPI.registerClass(SolarNeutronActivator.class);
MineTweakerAPI.registerClass(TheoreticalElementizer.class);
}
}

View File

@ -21,7 +21,7 @@ import mekanism.common.recipe.machines.PurificationRecipe;
import mekanism.common.recipe.machines.SawmillRecipe;
import mekanism.common.recipe.machines.SeparatorRecipe;
import mekanism.common.recipe.machines.SmeltingRecipe;
import mekanism.common.recipe.machines.SolarEvaporationRecipe;
import mekanism.common.recipe.machines.ThermalEvaporationRecipe;
import mekanism.common.recipe.machines.SolarNeutronRecipe;
import mekanism.common.recipe.machines.WasherRecipe;
import minetweaker.MineTweakerAPI;
@ -215,7 +215,7 @@ public class MekanismLogger implements ICommandFunction {
}
if(args.isEmpty() || args.contains("SolarEvaporation")) {
for(SolarEvaporationRecipe recipe : (Collection<SolarEvaporationRecipe>)Recipe.SOLAR_EVAPORATION_PLANT.get().values()) {
for(ThermalEvaporationRecipe recipe : (Collection<ThermalEvaporationRecipe>)Recipe.THERMAL_EVAPORATION_PLANT.get().values()) {
MineTweakerAPI.logCommand(String.format("mods.mekanism.SolarEvaporation.addRecipe(%s, %s);",
LogHelper.getStackDescription(recipe.recipeInput.ingredient),
LogHelper.getStackDescription(recipe.recipeOutput.output)));

View File

@ -10,7 +10,7 @@ import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.inputs.FluidInput;
import mekanism.common.recipe.inputs.MachineInput;
import mekanism.common.recipe.machines.MachineRecipe;
import mekanism.common.recipe.machines.SolarEvaporationRecipe;
import mekanism.common.recipe.machines.ThermalEvaporationRecipe;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IngredientAny;
@ -39,9 +39,9 @@ public class SolarEvaporation {
return;
}
SolarEvaporationRecipe recipe = new SolarEvaporationRecipe(toFluid(liquidInput), toFluid(liquidOutput));
ThermalEvaporationRecipe recipe = new ThermalEvaporationRecipe(toFluid(liquidInput), toFluid(liquidOutput));
MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.SOLAR_EVAPORATION_PLANT.get(), recipe));
MineTweakerAPI.apply(new AddMekanismRecipe(name, Recipe.THERMAL_EVAPORATION_PLANT.get(), recipe));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -58,7 +58,7 @@ public class SolarEvaporation {
Map<MachineInput, MachineRecipe> recipes = new HashMap<MachineInput, MachineRecipe>();
for(Entry<FluidInput, SolarEvaporationRecipe> entry : ((Map<FluidInput, SolarEvaporationRecipe>)Recipe.SOLAR_EVAPORATION_PLANT.get()).entrySet() ) {
for(Entry<FluidInput, ThermalEvaporationRecipe> entry : ((Map<FluidInput, ThermalEvaporationRecipe>)Recipe.THERMAL_EVAPORATION_PLANT.get()).entrySet() ) {
ILiquidStack inputLiquid = InputHelper.toILiquidStack(entry.getKey().ingredient);
ILiquidStack outputLiquid = InputHelper.toILiquidStack(entry.getValue().recipeOutput.output);
@ -69,7 +69,7 @@ public class SolarEvaporation {
}
if(!recipes.isEmpty()) {
MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.SOLAR_EVAPORATION_PLANT.get(), recipes));
MineTweakerAPI.apply(new RemoveMekanismRecipe(name, Recipe.THERMAL_EVAPORATION_PLANT.get(), recipes));
} else {
LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", name, liquidInput.toString(), liquidOutput.toString()));
}

View File

@ -0,0 +1,211 @@
package modtweaker2.mods.mekanism.handlers;
import java.util.LinkedList;
import java.util.List;
import mekanism.common.recipe.ElementizerRecipeHandler;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import static modtweaker2.helpers.InputHelper.toIItemStack;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.matches;
import modtweaker2.helpers.LogHelper;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.mekanism.chemical.Elementizer")
public class TheoreticalElementizer {
public static final String name = "Theoretical Elementizer";
@ZenMethod
public static void addOutput(IItemStack itemOutput) {
if(itemOutput == null) {
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
return;
}
MineTweakerAPI.apply(new AddOutput(toStack(itemOutput)));
}
private static class AddOutput extends BaseListAddition<ItemStack> {
public AddOutput(ItemStack recipe) {
super(TheoreticalElementizer.name, null);
recipes.add(recipe);
}
public void apply() {
for(ItemStack recipe : recipes) {
boolean applied = ElementizerRecipeHandler.outputItems.add(recipe);
if(applied) {
successful.add(recipe);
}
}
}
public void undo() {
for(ItemStack recipe : successful) {
ElementizerRecipeHandler.outputItems.remove(recipe);
}
}
@Override
protected boolean equals(ItemStack recipe, ItemStack otherRecipe) {
return recipe != null && recipe.isItemEqual(otherRecipe);
}
@Override
protected String getRecipeInfo(ItemStack recipe) {
return LogHelper.getStackDescription(recipe);
}
}
@ZenMethod
public static void removeOutput(IIngredient input) {
List<ItemStack> recipes = new LinkedList<ItemStack>();
for(ItemStack recipe : ElementizerRecipeHandler.outputItems) {
if(recipe != null && matches(input, toIItemStack(recipe))) {
recipes.add(recipe);
}
}
if(!recipes.isEmpty()) {
MineTweakerAPI.apply(new RemoveOutput(recipes));
} else {
LogHelper.logWarning(String.format("No %s Recipe found for %s.", name, input.toString()));
}
}
private static class RemoveOutput extends BaseListRemoval<ItemStack> {
public RemoveOutput(List<ItemStack> recipes) {
super(TheoreticalElementizer.name, null, recipes);
}
public void apply() {
for(ItemStack recipe : recipes) {
boolean removed = ElementizerRecipeHandler.outputItems.remove(recipe);
if(removed) {
successful.add(recipe);
}
}
}
public void undo() {
for(ItemStack recipe : successful) {
ElementizerRecipeHandler.outputItems.add(recipe);
}
}
@Override
protected boolean equals(ItemStack recipe, ItemStack otherRecipe) {
return recipe != null && recipe.isItemEqual(otherRecipe);
}
@Override
protected String getRecipeInfo(ItemStack recipe) {
return LogHelper.getStackDescription(recipe);
}
}
@ZenMethod
public static void addFuel(IItemStack itemFuel) {
if(itemFuel == null) {
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
return;
}
MineTweakerAPI.apply(new AddFuel(toStack(itemFuel)));
}
private static class AddFuel extends BaseListAddition<ItemStack> {
public AddFuel(ItemStack recipe) {
super(TheoreticalElementizer.name, null);
recipes.add(recipe);
}
public void apply() {
for(ItemStack recipe : recipes) {
boolean applied = ElementizerRecipeHandler.fuelItems.add(recipe);
if(applied) {
successful.add(recipe);
}
}
}
public void undo() {
for(ItemStack recipe : successful) {
ElementizerRecipeHandler.fuelItems.remove(recipe);
}
}
@Override
protected boolean equals(ItemStack recipe, ItemStack otherRecipe) {
return recipe != null && recipe.isItemEqual(otherRecipe);
}
@Override
protected String getRecipeInfo(ItemStack recipe) {
return LogHelper.getStackDescription(recipe);
}
}
@ZenMethod
public static void RemoveFuel(IIngredient input) {
List<ItemStack> recipes = new LinkedList<ItemStack>();
for(ItemStack recipe : ElementizerRecipeHandler.fuelItems) {
if(recipe != null && matches(input, toIItemStack(recipe))) {
recipes.add(recipe);
}
}
if(!recipes.isEmpty()) {
MineTweakerAPI.apply(new RemoveFuel(recipes));
} else {
LogHelper.logWarning(String.format("No %s Recipe found for %s.", name, input.toString()));
}
}
private static class RemoveFuel extends BaseListRemoval<ItemStack> {
public RemoveFuel(List<ItemStack> recipes) {
super(TheoreticalElementizer.name, null, recipes);
}
public void apply() {
for(ItemStack recipe : recipes) {
boolean removed = ElementizerRecipeHandler.fuelItems.remove(recipe);
if(removed) {
successful.add(recipe);
}
}
}
public void undo() {
for(ItemStack recipe : successful) {
ElementizerRecipeHandler.fuelItems.add(recipe);
}
}
@Override
protected boolean equals(ItemStack recipe, ItemStack otherRecipe) {
return recipe != null && recipe.isItemEqual(otherRecipe);
}
@Override
protected String getRecipeInfo(ItemStack recipe) {
return LogHelper.getStackDescription(recipe);
}
}
}