Fix #327 : FSP support now Minetweaker itself
This commit is contained in:
parent
64fdb57b81
commit
e74070a030
|
@ -16,7 +16,6 @@ import modtweaker2.mods.extendedworkbench.ExtendedWorkbench;
|
|||
import modtweaker2.mods.extraUtils.ExtraUtils;
|
||||
import modtweaker2.mods.factorization.Factorization;
|
||||
import modtweaker2.mods.forestry.Forestry;
|
||||
import modtweaker2.mods.fsp.Steamcraft;
|
||||
import modtweaker2.mods.ic2c.IC2C;
|
||||
import modtweaker2.mods.mariculture.Mariculture;
|
||||
import modtweaker2.mods.mekanism.Mekanism;
|
||||
|
@ -75,7 +74,6 @@ public class ModTweaker2 {
|
|||
TweakerPlugin.register("Metallurgy", Metallurgy.class);
|
||||
TweakerPlugin.register("PneumaticCraft", PneumaticCraft.class);
|
||||
TweakerPlugin.register("Railcraft", Railcraft.class);
|
||||
TweakerPlugin.register("Steamcraft", Steamcraft.class);
|
||||
TweakerPlugin.register("TConstruct", TConstruct.class);
|
||||
TweakerPlugin.register("Thaumcraft", Thaumcraft.class);
|
||||
TweakerPlugin.register("ThermalExpansion", ThermalExpansion.class);
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
package modtweaker2.mods.fsp;
|
||||
|
||||
import flaxbeard.steamcraft.api.CrucibleLiquid;
|
||||
import flaxbeard.steamcraft.api.SteamcraftRegistry;
|
||||
|
||||
public class FSPHelper {
|
||||
public static CrucibleLiquid getLiquid(String name) {
|
||||
for (CrucibleLiquid l : SteamcraftRegistry.liquids) {
|
||||
if (l.name.equals(name)) {
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package modtweaker2.mods.fsp;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker2.mods.fsp.handlers.Crucible;
|
||||
import modtweaker2.mods.fsp.handlers.Furnace;
|
||||
|
||||
public class Steamcraft {
|
||||
public Steamcraft() {
|
||||
MineTweakerAPI.registerClass(Crucible.class);
|
||||
MineTweakerAPI.registerClass(Furnace.class);
|
||||
}
|
||||
}
|
|
@ -1,160 +0,0 @@
|
|||
package modtweaker2.mods.fsp.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
import static modtweaker2.mods.fsp.FSPHelper.getLiquid;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseMapAddition;
|
||||
import modtweaker2.utils.BaseMapRemoval;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import flaxbeard.steamcraft.api.CrucibleFormula;
|
||||
import flaxbeard.steamcraft.api.CrucibleLiquid;
|
||||
import flaxbeard.steamcraft.api.SteamcraftRegistry;
|
||||
import flaxbeard.steamcraft.api.Tuple3;
|
||||
|
||||
@ZenClass("mods.fsp.Crucible")
|
||||
public class Crucible {
|
||||
|
||||
public static final String nameLiquid = "FSP Crucible (Liquid)";
|
||||
public static final String nameMelting = "FSP Crucible (Liquid)";
|
||||
public static final String nameDunking = "FSP Crucible (Dunking)";
|
||||
|
||||
@ZenMethod
|
||||
public static void addLiquid(String name, IItemStack ingot, IItemStack plate, IItemStack nugget, int r, int g, int b) {
|
||||
MineTweakerAPI.apply(new AddLiquid(new CrucibleLiquid(name, toStack(ingot), toStack(plate), toStack(nugget), null, r, g, b)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addLiquid(String name, IItemStack ingot, IItemStack plate, IItemStack nugget, int r, int g, int b, String l1, int n1, String l2, int n2, int n3) {
|
||||
MineTweakerAPI.apply(new AddLiquid(new CrucibleLiquid(name, toStack(ingot), toStack(plate), toStack(nugget), new CrucibleFormula(getLiquid(l1), n1, getLiquid(l2), n2, n3), r, g, b)));
|
||||
}
|
||||
|
||||
private static class AddLiquid extends BaseListAddition<CrucibleLiquid> {
|
||||
public AddLiquid(CrucibleLiquid recipe) {
|
||||
super(nameLiquid, SteamcraftRegistry.liquids);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(CrucibleLiquid recipe) {
|
||||
return recipe.name;
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addMelting(IItemStack input, String liquid, int volume) {
|
||||
ItemStack stack = toStack(input);
|
||||
CrucibleLiquid fluid = getLiquid(liquid);
|
||||
if (fluid != null) {
|
||||
MineTweakerAPI.apply(new AddMelting(stack, MutablePair.of(stack.getItem(), stack.getItemDamage()), MutablePair.of(fluid, volume)));
|
||||
}
|
||||
}
|
||||
|
||||
private static class AddMelting extends BaseMapAddition<MutablePair<Item, Integer>, MutablePair<CrucibleLiquid, Integer>> {
|
||||
public AddMelting(ItemStack stack, MutablePair<Item, Integer> key, MutablePair<CrucibleLiquid, Integer> recipe) {
|
||||
super(nameMelting, SteamcraftRegistry.smeltThings);
|
||||
map.put(key, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<MutablePair<Item, Integer>, MutablePair<CrucibleLiquid, Integer>> recipe) {
|
||||
return LogHelper.getStackDescription(new ItemStack(recipe.getKey().left, 1, recipe.getKey().right));
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeMelting(IIngredient input) {
|
||||
Map<MutablePair<Item, Integer>, MutablePair<CrucibleLiquid, Integer>> recipes = new HashMap<MutablePair<Item, Integer>, MutablePair<CrucibleLiquid, Integer>>();
|
||||
|
||||
for(Entry<MutablePair<Item, Integer>, MutablePair<CrucibleLiquid, Integer>> entry : SteamcraftRegistry.smeltThings.entrySet()) {
|
||||
if(matches(input, toIItemStack(new ItemStack(entry.getKey().left, 1, entry.getKey().right)))) {
|
||||
recipes.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveMelting(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipes found for %s", Crucible.nameMelting, input));
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveMelting extends BaseMapRemoval<MutablePair<Item, Integer>, MutablePair<CrucibleLiquid, Integer>> {
|
||||
public RemoveMelting(Map<MutablePair<Item, Integer>, MutablePair<CrucibleLiquid, Integer>> recipes) {
|
||||
super(nameMelting, SteamcraftRegistry.smeltThings, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<MutablePair<Item, Integer>, MutablePair<CrucibleLiquid, Integer>> recipe) {
|
||||
return LogHelper.getStackDescription(new ItemStack(recipe.getKey().left, 1, recipe.getKey().right));
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addDunking(IItemStack input, String liquid, int volume, IItemStack output) {
|
||||
ItemStack stack = toStack(input);
|
||||
CrucibleLiquid fluid = getLiquid(liquid);
|
||||
if (fluid != null) {
|
||||
MineTweakerAPI.apply(new AddDunking(new Tuple3(stack.getItem(), stack.getItemDamage(), fluid), MutablePair.of(volume, toStack(output))));
|
||||
}
|
||||
}
|
||||
|
||||
private static class AddDunking extends BaseMapAddition<Tuple3, MutablePair<Integer, ItemStack>> {
|
||||
public AddDunking(Tuple3 key, MutablePair<Integer, ItemStack> recipe) {
|
||||
super(Crucible.nameDunking, SteamcraftRegistry.dunkThings);
|
||||
recipes.put(key, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<Tuple3, MutablePair<Integer, ItemStack>> recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getValue().right);
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeDunking(IIngredient input, String liquid) {
|
||||
Map<Tuple3, MutablePair<Integer, ItemStack>> recipes = new HashMap<Tuple3, MutablePair<Integer, ItemStack>>();
|
||||
|
||||
for(Entry<Tuple3, MutablePair<Integer, ItemStack>> recipe : SteamcraftRegistry.dunkThings.entrySet()) {
|
||||
if(recipe.getValue() != null && recipe.getValue().right != null && matches(input, toIItemStack(recipe.getValue().right))) {
|
||||
if(((CrucibleLiquid)recipe.getKey().third).equals(getLiquid(liquid))) {
|
||||
recipes.put(recipe.getKey(), recipe.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveDunking(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s and %s. Command ignored!", Crucible.nameDunking, input.toString(), liquid));
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveDunking extends BaseMapRemoval<Tuple3, MutablePair<Integer, ItemStack>> {
|
||||
public RemoveDunking(Map<Tuple3, MutablePair<Integer, ItemStack>> recipes) {
|
||||
super(Crucible.nameDunking, SteamcraftRegistry.dunkThings, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<Tuple3, MutablePair<Integer, ItemStack>> recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getValue().right);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
package modtweaker2.mods.fsp.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.utils.BaseMapAddition;
|
||||
import modtweaker2.utils.BaseMapRemoval;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import flaxbeard.steamcraft.api.SteamcraftRegistry;
|
||||
|
||||
@ZenClass("mods.fsp.Furnace")
|
||||
public class Furnace {
|
||||
|
||||
public static final String name = "FSP Furnace (Steamed Foods)";
|
||||
|
||||
@ZenMethod
|
||||
public static void addSteamFood(IItemStack input, IItemStack output) {
|
||||
MineTweakerAPI.apply(new AddSteamFood(toStack(input), MutablePair.of(toStack(input).getItem(), toStack(input).getItemDamage()), MutablePair.of(toStack(output).getItem(), toStack(output).getItemDamage())));
|
||||
}
|
||||
|
||||
private static class AddSteamFood extends BaseMapAddition<MutablePair<Item, Integer>, MutablePair<Item, Integer>> {
|
||||
public AddSteamFood(ItemStack stack, MutablePair<Item, Integer> key, MutablePair<Item, Integer> recipe) {
|
||||
super(Furnace.name, SteamcraftRegistry.steamedFoods);
|
||||
recipes.put(key, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<MutablePair<Item, Integer>, MutablePair<Item, Integer>> recipe) {
|
||||
return LogHelper.getStackDescription(new ItemStack(recipe.getKey().left, 1, recipe.getKey().right));
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeSteamFood(IIngredient input) {
|
||||
Map<MutablePair<Item, Integer>, MutablePair<Item, Integer>> recipes = new HashMap<MutablePair<Item, Integer>, MutablePair<Item, Integer>>();
|
||||
|
||||
for(Entry<MutablePair<Item, Integer>, MutablePair<Item, Integer>> recipe : SteamcraftRegistry.steamedFoods.entrySet()) {
|
||||
if(matches(input, toIItemStack(new ItemStack(recipe.getKey().left, 1, recipe.getKey().right)))) {
|
||||
recipes.put(recipe.getKey(), recipe.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveSteamFood(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Furnace.name, input.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveSteamFood extends BaseMapRemoval<MutablePair<Item, Integer>, MutablePair<Item, Integer>> {
|
||||
public RemoveSteamFood(Map<MutablePair<Item, Integer>, MutablePair<Item, Integer>> recipes) {
|
||||
super(Furnace.name, SteamcraftRegistry.steamedFoods, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<MutablePair<Item, Integer>, MutablePair<Item, Integer>> recipe) {
|
||||
return LogHelper.getStackDescription(new ItemStack(recipe.getKey().left, 1, recipe.getKey().right));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue