This commit is contained in:
kuba6000 committed 2023-04-30 23:07:11 +02:00
1 parent 68ac0d8b05
commit 25ae719ab9
36 files changed
+944 -43

No files matched your search

@@ -12,6 +12,7 @@ import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import stanhebben.zenscript.annotations.ZenClass;
@@ -44,6 +45,21 @@ public class Apothecary {
recipes.add(recipe);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (RecipePetals recipe : successful) {
Thaumcraft.info(
"BotaniaAPI.registerPetalRecipe(" + Thaumcraft.convertStack(recipe.getOutput())
+ ", "
+ Thaumcraft.convertArrayInLine(recipe.getInputs().toArray(new Object[0]))
+ ");");
}
}
}
@Override
public String getRecipeInfo(RecipePetals recipe) {
return LogHelper.getStackDescription(recipe.getOutput());
@@ -83,6 +99,18 @@ public class Apothecary {
super(Apothecary.name, BotaniaAPI.petalRecipes, recipes);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (RecipePetals recipe : successful) {
Thaumcraft.info(
"BotaniaHelper.removePetalRecipe(" + Thaumcraft.convertStack(recipe.getOutput()) + ");");
}
}
}
@Override
public String getRecipeInfo(RecipePetals recipe) {
return LogHelper.getStackDescription(recipe.getOutput());
@@ -4,6 +4,10 @@ import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.chisel.ChiselHelper;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@@ -26,7 +30,7 @@ public class Groups {
MineTweakerAPI.getLogger().logError("Can't create variation from " + stack);
return;
}
MineTweakerAPI.apply(new AddVariation(group, variation, stack.toString()));
MineTweakerAPI.apply(new AddVariation(group, variation, stack.toString(), stack));
}
static class AddVariation implements IUndoableAction {
@@ -34,16 +38,23 @@ public class Groups {
ICarvingGroup group;
ICarvingVariation variation;
String variationName;
IItemStack stack;
public AddVariation(ICarvingGroup group, ICarvingVariation variation, String variationName) {
public AddVariation(ICarvingGroup group, ICarvingVariation variation, String variationName, IItemStack stack) {
this.group = group;
this.variation = variation;
this.variationName = variationName;
this.stack = stack;
}
@Override
public void apply() {
CarvingUtils.getChiselRegistry().addVariation(group.getName(), variation);
Thaumcraft.info(
"ChiselHelper.addVariationFromStack(\"" + group.getName()
+ "\", "
+ Thaumcraft.convertStack((ItemStack) stack.getInternal())
+ ");");
}
@Override
@@ -79,7 +90,7 @@ public class Groups {
MineTweakerAPI.getLogger().logError("Can't find variation from " + stack);
return;
}
MineTweakerAPI.apply(new RemoveVariation(variation, stack.toString()));
MineTweakerAPI.apply(new RemoveVariation(variation, stack.toString(), stack));
}
static class RemoveVariation implements IUndoableAction {
@@ -87,16 +98,21 @@ public class Groups {
ICarvingVariation variation;
String variationName;
ICarvingGroup group;
IItemStack stack;
public RemoveVariation(ICarvingVariation variation, String variationName) {
public RemoveVariation(ICarvingVariation variation, String variationName, IItemStack stack) {
this.variation = variation;
this.variationName = variationName;
this.stack = stack;
}
@Override
public void apply() {
group = CarvingUtils.getChiselRegistry().getGroup(variation.getBlock(), variation.getBlockMeta());
CarvingUtils.getChiselRegistry().removeVariation(variation.getBlock(), variation.getBlockMeta());
Thaumcraft.info(
"ChiselHelper.removeVariationStack(" + Thaumcraft.convertStack((ItemStack) stack.getInternal())
+ ");");
}
@Override
@@ -147,6 +163,7 @@ public class Groups {
@Override
public void apply() {
CarvingUtils.getChiselRegistry().addGroup(group);
Thaumcraft.info("ChiselHelper.addGroup(\"" + group.getName() + "\");");
}
@Override
@@ -196,6 +213,7 @@ public class Groups {
@Override
public void apply() {
CarvingUtils.getChiselRegistry().removeGroup(group.getName());
Thaumcraft.info("CarvingUtils.getChiselRegistry().removeGroup(\"" + group.getName() + "\");");
}
@Override
@@ -10,6 +10,7 @@ import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.InputHelper;
import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
@@ -28,15 +29,32 @@ public class QED {
@ZenMethod
public static void addShapedRecipe(IItemStack output, IIngredient[][] recipe) {
MineTweakerAPI
.apply(new Add(new ShapedOreRecipe(InputHelper.toStack(output), InputHelper.toShapedObjects(recipe))));
MineTweakerAPI.apply(
new Add(
new ShapedOreRecipe(InputHelper.toStack(output), InputHelper.toShapedObjects(recipe)),
InputHelper.toShapedObjects(recipe)));
}
private static class Add extends BaseListAddition<IRecipe> {
public Add(IRecipe recipe) {
Object[] rawRecipe;
public Add(IRecipe recipe, Object[] rawRecipe) {
super("QED", EnderConstructorRecipesHandler.recipes);
recipes.add(recipe);
this.rawRecipe = rawRecipe;
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (IRecipe recipe : successful) {
Thaumcraft.info(
"EnderConstructorRecipesHandler.addRecipe(" + Thaumcraft.convertStack(
recipe.getRecipeOutput()) + ", " + Thaumcraft.convertArrayInLine(rawRecipe) + ");");
}
}
}
@Override
@@ -73,6 +91,19 @@ public class QED {
super("QED", EnderConstructorRecipesHandler.recipes, stacks);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (IRecipe recipe : successful) {
Thaumcraft.info(
"ExtraUtilitiesHelper.removeQEDRecipe(" + Thaumcraft.convertStack(recipe.getRecipeOutput())
+ ");");
}
}
}
@Override
protected String getRecipeInfo(IRecipe recipe) {
return recipe.toString();
@@ -27,7 +27,7 @@ public abstract class ForestryListAddition<T extends IForestryRecipe, C extends
protected abstract String getRecipeInfo(T recipe);
@Override
public final void apply() {
public void apply() {
for (T recipe : recipes) {
if (recipe != null) {
if (craftingProvider.addRecipe(recipe)) {
@@ -22,7 +22,7 @@ public abstract class ForestryListRemoval<T extends IForestryRecipe, C extends I
protected abstract String getRecipeInfo(T recipe);
@Override
public final void apply() {
public void apply() {
for (T recipe : recipes) {
if (recipe != null) {
if (craftingProvider.removeRecipe(recipe)) {
@@ -19,6 +19,7 @@ import modtweaker2.mods.forestry.ForestryListAddition;
import modtweaker2.mods.forestry.ForestryListRemoval;
import modtweaker2.mods.forestry.recipes.CarpenterRecipe;
import modtweaker2.mods.forestry.recipes.DescriptiveRecipe;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import net.minecraft.item.ItemStack;
@@ -54,7 +55,10 @@ public class Carpenter {
toShapedObjects(ingredients),
toStack(output),
false);
MineTweakerAPI.apply(new Add(new CarpenterRecipe(packagingTime, null, toStack(box), craftRecipe)));
MineTweakerAPI.apply(
new Add(
new CarpenterRecipe(packagingTime, null, toStack(box), craftRecipe),
toShapedObjects(ingredients)));
}
/**
@@ -75,8 +79,10 @@ public class Carpenter {
toShapedObjects(ingredients),
toStack(output),
false);
MineTweakerAPI
.apply(new Add(new CarpenterRecipe(packagingTime, toFluid(fluidInput), toStack(box), craftRecipe)));
MineTweakerAPI.apply(
new Add(
new CarpenterRecipe(packagingTime, toFluid(fluidInput), toStack(box), craftRecipe),
toShapedObjects(ingredients)));
}
@Deprecated
@@ -89,8 +95,10 @@ public class Carpenter {
toShapedObjects(transform(ingredients, 3)),
toStack(output),
false);
MineTweakerAPI
.apply(new Add(new CarpenterRecipe(packagingTime, toFluid(fluidInput), toStack(box), craftRecipe)));
MineTweakerAPI.apply(
new Add(
new CarpenterRecipe(packagingTime, toFluid(fluidInput), toStack(box), craftRecipe),
toShapedObjects(transform(ingredients, 3))));
}
private static IItemStack[][] transform(IItemStack[] arr, int N) {
@@ -107,9 +115,33 @@ public class Carpenter {
private static class Add extends ForestryListAddition<ICarpenterRecipe, ICarpenterManager> {
public Add(ICarpenterRecipe recipe) {
Object[] rawRecipe;
public Add(ICarpenterRecipe recipe, Object[] rawRecipe) {
super(Carpenter.name, RecipeManagers.carpenterManager);
recipes.add(recipe);
this.rawRecipe = rawRecipe;
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (ICarpenterRecipe recipe : successful) {
Thaumcraft.info(
"RecipeManagers.carpenterManager.addRecipe(" + recipe.getPackagingTime()
+ ", "
+ Thaumcraft.convertFluidStack(recipe.getFluidResource())
+ ", "
+ Thaumcraft.convertStack(recipe.getBox())
+ ", "
+ Thaumcraft.convertStack(recipe.getCraftingGridRecipe().getRecipeOutput())
+ ", "
+ Thaumcraft.convertArrayInLine(rawRecipe)
+ ");");
}
}
}
@Override
@@ -157,6 +189,20 @@ public class Carpenter {
super(Carpenter.name, RecipeManagers.carpenterManager, recipes);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (ICarpenterRecipe recipe : successful) {
Thaumcraft.info(
"ForestryHelper.removeCarpenterRecipe("
+ Thaumcraft.convertStack(recipe.getCraftingGridRecipe().getRecipeOutput())
+ ");");
}
}
}
@Override
protected String getRecipeInfo(ICarpenterRecipe recipe) {
return LogHelper.getStackDescription(recipe.getCraftingGridRecipe().getRecipeOutput());
@@ -17,6 +17,7 @@ import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.forestry.ForestryListAddition;
import modtweaker2.mods.forestry.ForestryListRemoval;
import modtweaker2.mods.forestry.recipes.CentrifugeRecipe;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import net.minecraft.item.ItemStack;
@@ -105,6 +106,18 @@ public class Centrifuge {
super(Centrifuge.name, RecipeManagers.centrifugeManager, recipes);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (ICentrifugeRecipe recipe : successful) {
Thaumcraft.info(
"ForestryHelper.removeCentrifugeRecipe(" + Thaumcraft.convertStack(recipe.getInput())
+ ");");
}
}
}
@Override
protected String getRecipeInfo(ICentrifugeRecipe recipe) {
return LogHelper.getStackDescription(recipe.getInput());
@@ -21,6 +21,7 @@ import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.forestry.ForestryListAddition;
import modtweaker2.mods.forestry.ForestryListRemoval;
import modtweaker2.mods.forestry.recipes.FermenterRecipe;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.utils.BaseMapAddition;
import modtweaker2.utils.BaseMapRemoval;
@@ -86,6 +87,27 @@ public class Fermenter {
recipes.add(recipe);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (IFermenterRecipe recipe : successful) {
Thaumcraft.info(
"RecipeManagers.fermenterManager.addRecipe(" + Thaumcraft.convertStack(recipe.getResource())
+ ", "
+ recipe.getFermentationValue()
+ ", "
+ recipe.getModifier()
+ ", "
+ Thaumcraft.convertFluidStack(recipe.getOutput())
+ ", "
+ Thaumcraft.convertFluidStack(recipe.getFluidResource())
+ ");");
}
}
}
@Override
public String getRecipeInfo(IFermenterRecipe recipe) {
return LogHelper.getStackDescription(recipe.getOutput());
@@ -19,6 +19,7 @@ import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.forestry.ForestryListAddition;
import modtweaker2.mods.forestry.ForestryListRemoval;
import modtweaker2.mods.forestry.recipes.SqueezerRecipe;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import stanhebben.zenscript.annotations.Optional;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@@ -88,6 +89,26 @@ public class Squeezer {
recipes.add(recipe);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (ISqueezerRecipe recipe : successful) {
Thaumcraft.info(
"RecipeManagers.squeezerManager.addRecipe(" + recipe.getProcessingTime()
+ ", "
+ Thaumcraft.convertStacks(recipe.getResources())
+ ", "
+ Thaumcraft.convertFluidStack(recipe.getFluidOutput())
+ ", "
+ Thaumcraft.convertStack(recipe.getRemnants())
+ ", "
+ recipe.getRemnantsChance()
+ ");");
}
}
}
@Override
public String getRecipeInfo(ISqueezerRecipe recipe) {
return LogHelper.getStackDescription(recipe.getFluidOutput());
@@ -144,6 +165,20 @@ public class Squeezer {
super(Squeezer.name, RecipeManagers.squeezerManager, recipes);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (ISqueezerRecipe recipe : successful) {
Thaumcraft.info(
"ForestryHelper.removeSqueezerRecipe("
+ Thaumcraft.convertFluidStack(recipe.getFluidOutput())
+ ");");
}
}
}
@Override
public String getRecipeInfo(ISqueezerRecipe recipe) {
return LogHelper.getStackDescription(recipe.getFluidOutput());
@@ -16,6 +16,7 @@ import modtweaker2.mods.forestry.ForestryListRemoval;
import modtweaker2.mods.forestry.recipes.DescriptiveRecipe;
import modtweaker2.mods.forestry.recipes.FabricatorRecipe;
import modtweaker2.mods.forestry.recipes.FabricatorSmeltingRecipe;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import net.minecraftforge.fluids.FluidRegistry;
@@ -85,7 +86,8 @@ public class ThermionicFabricator {
IDescriptiveRecipe recipe = new DescriptiveRecipe(3, 3, toShapedObjects(ingredients), toStack(output), false);
MineTweakerAPI.apply(
new AddCast(
new FabricatorRecipe(toStack(plan), FluidRegistry.getFluidStack("glass", fluidInput), recipe)));
new FabricatorRecipe(toStack(plan), FluidRegistry.getFluidStack("glass", fluidInput), recipe),
toShapedObjects(ingredients)));
}
@Deprecated
@@ -93,7 +95,10 @@ public class ThermionicFabricator {
public static void addCast(ILiquidStack fluidInput, IIngredient[][] ingredients, IItemStack plan,
IItemStack output) {
IDescriptiveRecipe recipe = new DescriptiveRecipe(3, 3, toShapedObjects(ingredients), toStack(output), false);
MineTweakerAPI.apply(new AddCast(new FabricatorRecipe(toStack(plan), toFluid(fluidInput), recipe)));
MineTweakerAPI.apply(
new AddCast(
new FabricatorRecipe(toStack(plan), toFluid(fluidInput), recipe),
toShapedObjects(ingredients)));
}
/*
@@ -115,9 +120,31 @@ public class ThermionicFabricator {
private static class AddCast extends ForestryListAddition<IFabricatorRecipe, IFabricatorManager> {
public AddCast(IFabricatorRecipe recipe) {
Object[] rawRecipe;
public AddCast(IFabricatorRecipe recipe, Object[] rawRecipe) {
super(ThermionicFabricator.nameCasting, RecipeManagers.fabricatorManager);
recipes.add(recipe);
this.rawRecipe = rawRecipe;
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (IFabricatorRecipe recipe : successful) {
Thaumcraft.info(
"RecipeManagers.fabricatorManager.addRecipe(" + Thaumcraft.convertStack(recipe.getPlan())
+ ", "
+ Thaumcraft.convertFluidStack(recipe.getLiquid())
+ ", "
+ Thaumcraft.convertStack(recipe.getRecipeOutput())
+ ", "
+ Thaumcraft.convertArrayInLine(rawRecipe)
+ ");");
}
}
}
@Override
@@ -211,6 +238,19 @@ public class ThermionicFabricator {
super(ThermionicFabricator.nameCasting, RecipeManagers.fabricatorManager, recipes);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (IFabricatorRecipe recipe : successful) {
Thaumcraft.info(
"ForestryHelper.removeFabricatorRecipe(" + Thaumcraft.convertStack(recipe.getRecipeOutput())
+ ");");
}
}
}
@Override
public String getRecipeInfo(IFabricatorRecipe recipe) {
return LogHelper.getStackDescription(recipe.getRecipeOutput());
@@ -11,6 +11,7 @@ import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.railcraft.RailcraftHelper;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.utils.BaseCraftingAddition;
import modtweaker2.utils.BaseCraftingRemoval;
@@ -30,19 +31,39 @@ public class RollingMachine {
@ZenMethod
public static void addShaped(IItemStack output, IIngredient[][] ingredients) {
MineTweakerAPI.apply(new Add(new ShapedOreRecipe(toStack(output), toShapedObjects(ingredients))));
MineTweakerAPI.apply(
new Add(
new ShapedOreRecipe(toStack(output), toShapedObjects(ingredients)),
toShapedObjects(ingredients)));
}
@ZenMethod
public static void addShapeless(IItemStack output, IIngredient[] ingredients) {
MineTweakerAPI.apply(new Add(new ShapelessOreRecipe(toStack(output), toObjects(ingredients))));
MineTweakerAPI.apply(
new Add(new ShapelessOreRecipe(toStack(output), toObjects(ingredients)), toObjects(ingredients)));
}
private static class Add extends BaseCraftingAddition {
public Add(IRecipe recipe) {
Object[] rawRecipe;
public Add(IRecipe recipe, Object[] rawRecipe) {
super(RollingMachine.name, RailcraftHelper.rolling);
recipes.add(recipe);
this.rawRecipe = rawRecipe;
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (IRecipe recipe : successful) {
Thaumcraft.info(
"RailcraftCraftingManager.rollingMachine.addRecipe(" + Thaumcraft.convertStack(
recipe.getRecipeOutput()) + ", " + Thaumcraft.convertArrayInLine(rawRecipe) + ");");
}
}
}
}
@@ -68,5 +89,18 @@ public class RollingMachine {
public Remove(List<IRecipe> recipes) {
super(RollingMachine.name, RailcraftHelper.rolling, recipes);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (IRecipe recipe : successful) {
Thaumcraft.info(
"RailcraftHelper.removeRollingRecipe(" + Thaumcraft.convertStack(recipe.getRecipeOutput())
+ ");");
}
}
}
}
}
@@ -17,6 +17,7 @@ import minetweaker.api.item.IngredientAny;
import minetweaker.api.liquid.ILiquidStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.tconstruct.TConstructHelper;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import stanhebben.zenscript.annotations.Optional;
@@ -68,6 +69,44 @@ public class Casting {
this.recipes.add(recipe);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (CastingRecipe recipe : successful) {
if (list == TConstructHelper.basinCasting) {
Thaumcraft.info(
"TConstructRegistry.getBasinCasting().addCastingRecipe("
+ Thaumcraft.convertStack(recipe.output)
+ ", "
+ Thaumcraft.convertFluidStack(recipe.castingMetal)
+ ", "
+ Thaumcraft.convertStack(recipe.cast)
+ ", "
+ (recipe.consumeCast ? "true" : "false")
+ ", "
+ recipe.coolTime
+ ");");
} else if (list == TConstructHelper.tableCasting) {
Thaumcraft.info(
"TConstructRegistry.getTableCasting().addCastingRecipe("
+ Thaumcraft.convertStack(recipe.output)
+ ", "
+ Thaumcraft.convertFluidStack(recipe.castingMetal)
+ ", "
+ Thaumcraft.convertStack(recipe.cast)
+ ", "
+ (recipe.consumeCast ? "true" : "false")
+ ", "
+ recipe.coolTime
+ ");");
}
}
}
}
@Override
protected String getRecipeInfo(CastingRecipe recipe) {
return LogHelper.getStackDescription(recipe.output);
@@ -144,6 +183,23 @@ public class Casting {
super(Casting.name, list, recipes);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (CastingRecipe recipe : successful) {
if (list == TConstructHelper.basinCasting) {
Thaumcraft.info(
"TConstructHelper.removeBasinRecipe(" + Thaumcraft.convertStack(recipe.output) + ");");
} else if (list == TConstructHelper.tableCasting) {
Thaumcraft.info(
"TConstructHelper.removeTableRecipe(" + Thaumcraft.convertStack(recipe.output) + ");");
}
}
}
}
@Override
protected String getRecipeInfo(CastingRecipe recipe) {
return LogHelper.getStackDescription(recipe.output);
@@ -11,6 +11,7 @@ import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.tconstruct.TConstructHelper;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import stanhebben.zenscript.annotations.ZenClass;
@@ -43,6 +44,23 @@ public class Drying {
this.recipes.add(recipe);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (DryingRecipe recipe : successful) {
Thaumcraft.info(
"DryingRackRecipes.addDryingRecipe(" + Thaumcraft.convertStack(recipe.input)
+ ", "
+ recipe.time
+ ", "
+ Thaumcraft.convertStack(recipe.result)
+ ");");
}
}
}
@Override
protected String getRecipeInfo(DryingRecipe recipe) {
return LogHelper.getStackDescription(recipe.result);
@@ -23,6 +23,7 @@ import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.tconstruct.TConstructHelper;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import modtweaker2.utils.BaseMapAddition;
@@ -69,6 +70,21 @@ public class Smeltery {
this.recipes.add(recipe);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (AlloyMix recipe : successful) {
Thaumcraft.info(
"Smeltery.addAlloyMixing(" + Thaumcraft.convertFluidStack(recipe.result)
+ ", "
+ Thaumcraft.convertArrayInLine(recipe.mixers.toArray(new FluidStack[0]))
+ ");");
}
}
}
@Override
protected String getRecipeInfo(AlloyMix recipe) {
return LogHelper.getStackDescription(recipe.result);
@@ -105,6 +121,19 @@ public class Smeltery {
super(nameAlloy, TConstructHelper.alloys, recipes);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (AlloyMix recipe : successful) {
Thaumcraft.info(
"TConstructHelper.removeSmelterAlloyMix(" + Thaumcraft.convertFluidStack(recipe.result)
+ ");");
}
}
}
@Override
protected String getRecipeInfo(AlloyMix recipe) {
return LogHelper.getStackDescription(recipe.result);
@@ -167,6 +196,19 @@ public class Smeltery {
recipe.temperature,
recipe.fluid);
successful.add(recipe);
Thaumcraft.info(
"Smeltery.addMelting(" + Thaumcraft.convertStack(recipe.input)
+ ", "
+ Thaumcraft.convertBlock(recipe.getRendererBlock())
+ ", "
+ recipe.getRendererMeta()
+ ", "
+ recipe.temperature
+ ", "
+ Thaumcraft.convertFluidStack(recipe.fluid)
+ ");");
}
}
@@ -226,6 +268,8 @@ public class Smeltery {
TConstructHelper.renderIndex.remove(recipe.meta);
successful.add(recipe);
Thaumcraft.info("TConstructHelper.removeMeltingRecipe(" + Thaumcraft.convertStack(recipe.input) + ");");
}
}
@@ -303,6 +347,17 @@ public class Smeltery {
super(Smeltery.nameFuel, TConstructHelper.fuelList, recipes);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (Entry<Fluid, Integer[]> recipe : successful.entrySet()) {
Thaumcraft.info("TConstructHelper.removeFuel(" + Thaumcraft.convertFluid(recipe.getKey()) + ");");
}
}
}
@Override
public String getRecipeInfo(Entry<Fluid, Integer[]> recipe) {
return LogHelper.getStackDescription(new FluidStack(recipe.getKey(), 1));
@@ -331,6 +386,23 @@ public class Smeltery {
super(Smeltery.nameFuel, TConstructHelper.fuelList, recipes);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (Entry<Fluid, Integer[]> recipe : successful.entrySet()) {
Thaumcraft.info(
"Smeltery.addSmelteryFuel(" + Thaumcraft.convertFluid(recipe.getKey())
+ ", "
+ recipe.getValue()[0]
+ ", "
+ recipe.getValue()[1]
+ ");");
}
}
}
@Override
public String getRecipeInfo(Entry<Fluid, Integer[]> recipe) {
return LogHelper.getStackDescription(new FluidStack(recipe.getKey(), 1));
@@ -1,5 +1,8 @@
package modtweaker2.mods.thaumcraft;
import java.util.Iterator;
import java.util.Map;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.thaumcraft.aspect.AspectBracketHandler;
import modtweaker2.mods.thaumcraft.handlers.Arcane;
@@ -10,16 +13,263 @@ import modtweaker2.mods.thaumcraft.handlers.Loot;
import modtweaker2.mods.thaumcraft.handlers.Research;
import modtweaker2.mods.thaumcraft.handlers.Warp;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import cpw.mods.fml.common.registry.GameRegistry;
public class Thaumcraft {
private static final Logger TCLOG = LogManager.getLogger("[SCRIPTS TO CODE TRANSLATOR]");
public static String addingResearch = null;
public static int setting = 0;
public static int wasSettingBefore = 0;
public static void info(String s) {
if (addingResearch != null) {
if (setting != 0) TCLOG.info(")");
TCLOG.info(".registerResearchItem();");
addingResearch = null;
}
TCLOG.info(s);
addingResearch = null;
setting = 0;
wasSettingBefore = 0;
}
public static void researchInfo(String r, String s) {
if (addingResearch == null || !addingResearch.equals(r)) {
info("ResearchCategories.getResearch(\"" + r + "\")" + s + ";");
return;
}
if (setting != 0) {
wasSettingBefore |= setting;
setting = 0;
TCLOG.info(")");
}
TCLOG.info(s);
}
public static void addPageInfo(String r, String s) {
final int setID = 0b1;
if (addingResearch == null || !addingResearch.equals(r)) {
info("TCHelper.addResearchPage(\"" + r + "\", " + s + ");");
return;
}
if ((setting & setID) == 0) {
if ((wasSettingBefore & setID) != 0) {
info("TCHelper.addResearchPage(\"" + r + "\", " + s + ");");
return;
}
if (setting != 0) {
wasSettingBefore |= setting;
setting = 0;
TCLOG.info(")");
}
setting = setID;
TCLOG.info(".setPages(" + s);
} else TCLOG.info(", " + s);
}
public static void addPrereq(String r, String s, boolean hidden) {
if (hidden) addPrereqHidden(r, s);
else addPrereqNormal(r, s);
}
public static void addPrereqNormal(String r, String s) {
final int setID = 0b10;
if (addingResearch == null || !addingResearch.equals(r)) {
info("TCHelper.addResearchPrereq(\"" + r + "\", " + s + ", false);");
return;
}
if ((setting & setID) == 0) {
if ((wasSettingBefore & setID) != 0) {
info("TCHelper.addResearchPrereq(\"" + addingResearch + "\", " + s + ", false);");
return;
}
if (setting != 0) {
wasSettingBefore |= setting;
setting = 0;
TCLOG.info(")");
}
setting = setID;
TCLOG.info(".setParents(" + s);
} else TCLOG.info(", " + s);
}
public static void addPrereqHidden(String r, String s) {
final int setID = 0b100;
if (addingResearch == null || !addingResearch.equals(r)) {
info("TCHelper.addResearchPrereq(\"" + r + "\", " + s + ", true);");
return;
}
if ((setting & setID) == 0) {
if ((wasSettingBefore & setID) != 0) {
info("TCHelper.addResearchPrereq(\"" + addingResearch + "\", " + s + ", true);");
return;
}
if (setting != 0) {
wasSettingBefore |= setting;
setting = 0;
TCLOG.info(")");
}
setting = setID;
TCLOG.info(".setParentsHidden(" + s);
} else TCLOG.info(", " + s);
}
public static void addSibling(String r, String s) {
final int setID = 0b1000;
if (addingResearch == null || !addingResearch.equals(r)) {
info("TCHelper.addResearchSibling(\"" + r + "\", " + s + ");");
return;
}
if ((setting & setID) == 0) {
if ((wasSettingBefore & setID) != 0) {
info("TCHelper.addResearchSibling(\"" + addingResearch + "\", " + s + ");");
return;
}
if (setting != 0) {
wasSettingBefore |= setting;
setting = 0;
TCLOG.info(")");
}
setting = setID;
TCLOG.info(".setSiblings(" + s);
} else TCLOG.info(", " + s);
}
public static String convertBlock(Block block) {
if (block == null) return "null";
GameRegistry.UniqueIdentifier itemIdentifier = GameRegistry.findUniqueIdentifierFor(block);
return "GameRegistry.findBlock(\"" + itemIdentifier.modId + "\", \"" + itemIdentifier.name + "\")";
}
public static String convertStack(ItemStack stack) {
if (stack == null) return "null";
GameRegistry.UniqueIdentifier itemIdentifier = GameRegistry.findUniqueIdentifierFor(stack.getItem());
int meta = stack.getItemDamage();
int size = stack.stackSize;
NBTTagCompound tagCompound = stack.stackTagCompound;
if (tagCompound == null || tagCompound.hasNoTags()) {
return "getModItem(\"" + itemIdentifier.modId
+ "\", \""
+ itemIdentifier.name
+ "\", "
+ size
+ ", "
+ meta
+ ", missing)";
} else {
return "createItemStack(\"" + itemIdentifier.modId
+ "\", \""
+ itemIdentifier.name
+ "\", "
+ size
+ ", "
+ meta
+ ", "
+ "\""
+ tagCompound.toString().replace("\"", "\\\"")
+ "\""
+ ", missing)";
}
}
public static String convertStacks(ItemStack[] list) {
StringBuilder stacks = new StringBuilder("new ItemStack[]{");
for (ItemStack stack : list) {
stacks.append(convertStack(stack)).append(", ");
}
stacks.append("}");
return stacks.toString();
}
public static String convertAspects(AspectList list) {
StringBuilder aspects = new StringBuilder("new AspectList()");
for (Map.Entry<Aspect, Integer> aspect : list.aspects.entrySet()) {
aspects.append(".add(Aspect.getAspect(\"").append(aspect.getKey().getTag()).append("\"), ")
.append(aspect.getValue()).append(")");
}
return aspects.toString();
}
public static String convertAspectsInLine(AspectList list) {
StringBuilder aspects = new StringBuilder();
for (Iterator<Map.Entry<Aspect, Integer>> iterator = list.aspects.entrySet().iterator(); iterator.hasNext();) {
Map.Entry<Aspect, Integer> aspect = iterator.next();
aspects.append("Aspect.getAspect(\"").append(aspect.getKey().getTag()).append("\")");
if (iterator.hasNext()) aspects.append(", ");
}
return aspects.toString();
}
public static String convertArray(Object[] arr) {
StringBuilder arrayString = new StringBuilder("new Object[] {");
for (Object o : arr) {
if (o instanceof String) arrayString.append((String) o);
else if (o instanceof ItemStack) arrayString.append(convertStack((ItemStack) o));
else arrayString.append(o);
arrayString.append(", ");
}
arrayString.append("}");
return arrayString.toString();
}
public static String convertArray(String[] arr) {
StringBuilder arrayString = new StringBuilder("new String[] {");
for (String o : arr) {
arrayString.append("\"").append(o).append("\"").append(", ");
}
arrayString.append("}");
return arrayString.toString();
}
public static String convertArrayInLine(Object[] arr) {
StringBuilder arrayString = new StringBuilder();
for (int i = 0, arrLength = arr.length; i < arrLength; i++) {
Object o = arr[i];
if (o instanceof String) arrayString.append("\"").append((String) o).append("\"");
else if (o instanceof Character) arrayString.append("'").append((char) o).append("'");
else if (o instanceof ItemStack) arrayString.append(convertStack((ItemStack) o));
else if (o instanceof FluidStack) arrayString.append(convertFluidStack((FluidStack) o));
else arrayString.append(o);
if (i + 1 < arrLength) arrayString.append(", ");
}
return arrayString.toString();
}
public static String convertFluidStack(FluidStack stack) {
if (stack == null) return "null";
return "FluidRegistry.getFluidStack(\"" + stack.getFluid().getName() + "\", " + stack.amount + ")";
}
public static String convertFluidStack(Fluid stack) {
if (stack == null) return "null";
return "FluidRegistry.getFluidStack(\"" + stack.getName() + "\", 1000)";
}
public static String convertFluid(Fluid fluid) {
if (fluid == null) return "null";
return "FluidRegistry.getFluid(\"" + fluid.getName() + "\")";
}
public Thaumcraft() {
MineTweakerAPI.registerBracketHandler(new AspectBracketHandler());
MineTweakerAPI.registerClass(Arcane.class);
MineTweakerAPI.registerClass(Aspects.class);
MineTweakerAPI.registerClass(Crucible.class);
MineTweakerAPI.registerClass(Infusion.class);
MineTweakerAPI.registerClass(Research.class);
MineTweakerAPI.registerClass(Warp.class);
MineTweakerAPI.registerClass(Loot.class);
MineTweakerAPI.registerClass(Arcane.class); // DONE
MineTweakerAPI.registerClass(Aspects.class); // DONE
MineTweakerAPI.registerClass(Crucible.class); // DONE
MineTweakerAPI.registerClass(Infusion.class); // DONE
MineTweakerAPI.registerClass(Research.class); // DONE
MineTweakerAPI.registerClass(Warp.class); // DONE
MineTweakerAPI.registerClass(Loot.class); // DONE
}
}
@@ -13,6 +13,7 @@ import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
@@ -41,7 +42,8 @@ public class Arcane {
key,
toStack(output),
ThaumcraftHelper.parseAspects(aspects),
toShapedObjects(ingredients))));
toShapedObjects(ingredients)),
toShapedObjects(ingredients)));
}
@ZenMethod
@@ -52,14 +54,45 @@ public class Arcane {
key,
toStack(output),
ThaumcraftHelper.parseAspects(aspects),
toObjects(ingredients))));
toObjects(ingredients)),
toObjects(ingredients)));
}
private static class Add extends BaseListAddition<IArcaneRecipe> {
public Add(IArcaneRecipe recipe) {
Object[] rawRecipe;
public Add(IArcaneRecipe recipe, Object[] rawRecipe) {
super(Arcane.name, ThaumcraftApi.getCraftingRecipes());
recipes.add(recipe);
this.rawRecipe = rawRecipe;
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (IArcaneRecipe a : successful) {
if (a instanceof ShapedArcaneRecipe) Thaumcraft.info(
"ThaumcraftApi.addArcaneCraftingRecipe(\"" + a.getResearch()
+ "\", "
+ Thaumcraft.convertStack(a.getRecipeOutput())
+ ", "
+ Thaumcraft.convertAspects(((ShapedArcaneRecipe) a).aspects)
+ ", "
+ Thaumcraft.convertArrayInLine(rawRecipe)
+ ");");
else Thaumcraft.info(
"ThaumcraftApi.addShapelessArcaneCraftingRecipe(\"" + a.getResearch()
+ "\", "
+ Thaumcraft.convertStack(a.getRecipeOutput())
+ ", "
+ Thaumcraft.convertAspects(((ShapelessArcaneRecipe) a).aspects)
+ ", "
+ Thaumcraft.convertArrayInLine(rawRecipe)
+ ");");
}
}
}
@Override
@@ -101,6 +134,17 @@ public class Arcane {
super(Arcane.name, ThaumcraftApi.getCraftingRecipes(), recipes);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (IArcaneRecipe a : successful) {
Thaumcraft
.info("TCHelper.removeArcaneRecipe(" + Thaumcraft.convertStack(a.getRecipeOutput()) + ");");
}
}
}
@Override
protected String getRecipeInfo(IArcaneRecipe recipe) {
ItemStack stack = recipe.getRecipeOutput();
@@ -6,6 +6,7 @@ import java.util.Arrays;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import modtweaker2.utils.BaseUndoable;
@@ -61,6 +62,12 @@ public class Aspects {
ThaumcraftApi.objectTags.put(Arrays.asList(stack.getItem(), stack.getItemDamage()), newList);
Thaumcraft.info(
"ThaumcraftApi.registerObjectTag(" + Thaumcraft.convertStack(stack)
+ ", "
+ Thaumcraft.convertAspects(newList)
+ ");");
success = true;
}
@@ -12,9 +12,13 @@ import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import thaumcraft.api.ThaumcraftApi;
@@ -33,14 +37,35 @@ public class Crucible {
key,
toStack(result),
toObject(catalyst),
ThaumcraftHelper.parseAspects(aspects))));
ThaumcraftHelper.parseAspects(aspects)),
toObject(catalyst)));
}
private static class Add extends BaseListAddition<CrucibleRecipe> {
public Add(CrucibleRecipe recipe) {
Object catalystRaw;
public Add(CrucibleRecipe recipe, Object catalystRaw) {
super(Crucible.name, ThaumcraftApi.getCraftingRecipes());
recipes.add(recipe);
this.catalystRaw = catalystRaw;
}
@Override
public void apply() {
super.apply();
for (CrucibleRecipe a : successful) {
Thaumcraft.info(
"ThaumcraftApi.addCrucibleRecipe(\"" + a.key
+ "\", "
+ Thaumcraft.convertStack(a.getRecipeOutput())
+ ", "
+ (catalystRaw instanceof String ? catalystRaw
: Thaumcraft.convertStack((ItemStack) catalystRaw))
+ ", "
+ Thaumcraft.convertAspects(a.aspects)
+ ");");
}
}
@Override
@@ -78,6 +103,17 @@ public class Crucible {
super(Crucible.name, ThaumcraftApi.getCraftingRecipes(), recipes);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (CrucibleRecipe a : successful) {
Thaumcraft.info(
"TCHelper.removeCrucibleRecipe(" + Thaumcraft.convertStack(a.getRecipeOutput()) + ");");
}
}
}
@Override
protected String getRecipeInfo(CrucibleRecipe recipe) {
return LogHelper.getStackDescription(recipe.getRecipeOutput());
@@ -12,6 +12,7 @@ import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import modtweaker2.mods.thaumcraft.recipe.MTInfusionRecipe;
import modtweaker2.utils.BaseListAddition;
@@ -84,6 +85,26 @@ public class Infusion {
recipes.add(recipe);
}
@Override
public void apply() {
super.apply();
for (InfusionRecipe a : successful) {
Thaumcraft.info(
"ThaumcraftApi.addInfusionCraftingRecipe(\"" + a.getResearch()
+ "\", "
+ Thaumcraft.convertStack((ItemStack) a.getRecipeOutput())
+ ", "
+ a.getInstability()
+ ", "
+ Thaumcraft.convertAspects(a.getAspects())
+ ", "
+ Thaumcraft.convertStack(a.getRecipeInput())
+ ", "
+ Thaumcraft.convertStacks(a.getComponents())
+ ");");
}
}
@Override
protected String getRecipeInfo(InfusionRecipe recipe) {
Object out = ((InfusionRecipe) recipe).getRecipeOutput();
@@ -100,6 +121,26 @@ public class Infusion {
recipes.add(inp);
}
@Override
public void apply() {
super.apply();
for (InfusionEnchantmentRecipe a : successful) {
Thaumcraft.info(
"ThaumcraftApi.addInfusionCraftingRecipe(\"" + a.research
+ "\", "
+ "Enchantment.enchantmentsList["
+ a.enchantment.effectId
+ "]"
+ ", "
+ a.instability
+ ", "
+ Thaumcraft.convertAspects(a.getAspects())
+ ", "
+ Thaumcraft.convertStacks(a.components)
+ ");");
}
}
@Override
protected String getRecipeInfo(InfusionEnchantmentRecipe recipe) {
return recipe.getEnchantment().getName();
@@ -161,6 +202,18 @@ public class Infusion {
super(Infusion.name, ThaumcraftApi.getCraftingRecipes(), recipes);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (InfusionRecipe a : successful) {
Thaumcraft.info(
"TCHelper.removeInfusionRecipe(" + Thaumcraft.convertStack((ItemStack) a.getRecipeOutput())
+ ");");
}
}
}
@Override
protected String getRecipeInfo(InfusionRecipe recipe) {
@@ -180,6 +233,16 @@ public class Infusion {
super(Infusion.enchName, ThaumcraftApi.getCraftingRecipes(), recipes);
}
@Override
public void apply() {
super.apply();
if (!successful.isEmpty()) {
for (InfusionEnchantmentRecipe a : successful) {
Thaumcraft.info("TCHelper.removeInfusionEnchantmentRecipe(" + a.getEnchantment().effectId + ");");
}
}
}
@Override
protected String getRecipeInfo(InfusionEnchantmentRecipe recipe) {
return recipe.getEnchantment().getName();
@@ -9,6 +9,7 @@ import java.util.List;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import net.minecraft.item.ItemStack;
@@ -41,8 +42,17 @@ public class Warp {
}
public void apply() {
if (target instanceof String) ThaumcraftApi.addWarpToResearch((String) target, warp);
else if (target instanceof ItemStack) ThaumcraftApi.addWarpToItem((ItemStack) target, warp);
if (target instanceof String) {
ThaumcraftApi.addWarpToResearch((String) target, warp);
Thaumcraft.info("ThaumcraftApi.addWarpToResearch(\"" + (String) target + "\", " + warp + ");");
} else if (target instanceof ItemStack) {
ThaumcraftApi.addWarpToItem((ItemStack) target, warp);
Thaumcraft.info(
"ThaumcraftApi.addWarpToItem(" + Thaumcraft.convertStack((ItemStack) target)
+ ", "
+ warp
+ ");");
}
}
public boolean canUndo() {
@@ -4,6 +4,7 @@ import static modtweaker2.helpers.StackHelper.areEqual;
import static modtweaker2.mods.thaumcraft.ThaumcraftHelper.getResearchSafe;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import net.minecraft.enchantment.Enchantment;
@@ -42,12 +43,15 @@ public class AddPage implements IUndoableAction {
@Override
public void apply() {
String pageTX = null;
if (type == PageType.NORMAL_CRAFTING) {
for (Object craft : CraftingManager.getInstance().getRecipeList()) {
if (craft instanceof IRecipe) {
IRecipe theCraft = (IRecipe) craft;
if (theCraft.getRecipeOutput() != null && areEqual(theCraft.getRecipeOutput(), target)) {
page = new ResearchPage(theCraft);
pageTX = "new ResearchPage(TCHelper.findCraftingRecipe(" + Thaumcraft.convertStack(target)
+ "))";
break;
}
}
@@ -58,6 +62,7 @@ public class AddPage implements IUndoableAction {
IArcaneRecipe theCraft = (IArcaneRecipe) craft;
if (theCraft.getRecipeOutput() != null && areEqual(theCraft.getRecipeOutput(), target)) {
page = new ResearchPage(theCraft);
pageTX = "new ResearchPage(TCHelper.findArcaneRecipe(" + Thaumcraft.convertStack(target) + "))";
break;
}
}
@@ -68,6 +73,8 @@ public class AddPage implements IUndoableAction {
CrucibleRecipe theCraft = (CrucibleRecipe) craft;
if (theCraft.getRecipeOutput() != null && areEqual(theCraft.getRecipeOutput(), target)) {
page = new ResearchPage(theCraft);
pageTX = "new ResearchPage(TCHelper.findCrucibleRecipe(" + Thaumcraft.convertStack(target)
+ "))";
break;
}
}
@@ -79,6 +86,8 @@ public class AddPage implements IUndoableAction {
if (theCraft.getRecipeOutput() != null && theCraft.getRecipeOutput() instanceof ItemStack
&& areEqual(((ItemStack) (theCraft.getRecipeOutput())), target)) {
page = new ResearchPage(theCraft);
pageTX = "new ResearchPage(TCHelper.findInfusionRecipe(" + Thaumcraft.convertStack(target)
+ "))";
break;
}
}
@@ -89,12 +98,14 @@ public class AddPage implements IUndoableAction {
InfusionEnchantmentRecipe theCraft = (InfusionEnchantmentRecipe) craft;
if (theCraft.getEnchantment() != null && theCraft.getEnchantment() == enchant) {
page = new ResearchPage(theCraft);
pageTX = "new ResearchPage(TCHelper.findInfusionEnchantRecipe(" + enchant.effectId + "))";
break;
}
}
}
}
if (page == null) return;
if (pageTX == null) pageTX = "new ResearchPage(\"" + page.text + "\")";
oldPages = ResearchCategories.researchCategories.get(tab).research.get(key).getPages();
if (oldPages == null) oldPages = new ResearchPage[0];
ResearchPage[] newPages = new ResearchPage[oldPages.length + 1];
@@ -103,6 +114,7 @@ public class AddPage implements IUndoableAction {
}
newPages[oldPages.length] = page;
ResearchCategories.researchCategories.get(tab).research.get(key).setPages(newPages);
Thaumcraft.addPageInfo(key, pageTX);
}
@Override
@@ -3,6 +3,7 @@ package modtweaker2.mods.thaumcraft.research;
import static modtweaker2.mods.thaumcraft.ThaumcraftHelper.getResearchSafe;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ResearchItem;
@@ -43,6 +44,7 @@ public class AddPrereq implements IUndoableAction {
newPrereqs[oldPrereqs.length] = prereq;
ResearchCategories.researchCategories.get(tab).research.get(key).setParentsHidden(newPrereqs);
}
Thaumcraft.addPrereq(key, "\"" + prereq + "\"", hidden);
}
@Override
@@ -1,6 +1,7 @@
package modtweaker2.mods.thaumcraft.research;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import net.minecraft.item.ItemStack;
@@ -30,16 +31,36 @@ public class AddResearch implements IUndoableAction {
@Override
public void apply() {
oldResearch = ResearchCategories.getResearch(research.key);
String a = "new ResearchItem(\"" + research.key
+ "\", \""
+ research.category
+ "\", "
+ Thaumcraft.convertAspects(research.tags)
+ ", "
+ research.displayColumn
+ ", "
+ research.displayRow
+ ", "
+ research.getComplexity()
+ ", "
+ Thaumcraft.convertStack(research.icon_item)
+ ")";
if (itemTriggers != null) {
research = research.setItemTriggers(itemTriggers);
a += ".setItemTriggers(" + Thaumcraft.convertStacks(itemTriggers) + ")";
}
if (entityTriggers != null) {
research = research.setEntityTriggers(entityTriggers);
a += ".setEntityTriggers(" + Thaumcraft.convertArray(entityTriggers) + ")";
}
if (aspectTriggers != null) {
research = research.setAspectTriggers(aspectTriggers.getAspects());
a += ".setAspectTriggers(" + Thaumcraft.convertAspectsInLine(aspectTriggers) + ")";
}
research.registerResearchItem();
Thaumcraft.info(a);
Thaumcraft.addingResearch = research.key;
}
@Override
@@ -3,6 +3,7 @@ package modtweaker2.mods.thaumcraft.research;
import static modtweaker2.mods.thaumcraft.ThaumcraftHelper.getResearchSafe;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ResearchItem;
@@ -30,6 +31,7 @@ public class AddSibling implements IUndoableAction {
}
newSiblings[oldSiblings.length] = sibling;
ResearchCategories.researchCategories.get(tab).research.get(key).setSiblings(sibling);
Thaumcraft.addSibling(key, "\"" + sibling + "\"");
}
@Override
@@ -1,6 +1,7 @@
package modtweaker2.mods.thaumcraft.research;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import net.minecraft.util.ResourceLocation;
@@ -21,6 +22,8 @@ public class AddTab implements IUndoableAction {
@Override
public void apply() {
ResearchCategories.registerCategory(tab, icon, background);
Thaumcraft.info(
"ResearchCategories.registerCategory(\"" + tab + "\", \"" + icon + "\", \"" + background + "\");");
}
@Override
@@ -3,6 +3,7 @@ package modtweaker2.mods.thaumcraft.research;
import static modtweaker2.mods.thaumcraft.ThaumcraftHelper.getResearchSafe;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ResearchItem;
@@ -23,6 +24,7 @@ public class ClearPages implements IUndoableAction {
public void apply() {
oldPages = ResearchCategories.researchCategories.get(tab).research.get(key).getPages();
ResearchCategories.researchCategories.get(tab).research.get(key).setPages(new ResearchPage[0]);
Thaumcraft.info("TCHelper.clearPages(\"" + key + "\");");
}
@Override
@@ -3,6 +3,7 @@ package modtweaker2.mods.thaumcraft.research;
import static modtweaker2.mods.thaumcraft.ThaumcraftHelper.getResearchSafe;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ResearchItem;
@@ -25,6 +26,7 @@ public class ClearPrereqs implements IUndoableAction {
secretPrereqs = ResearchCategories.researchCategories.get(tab).research.get(key).parentsHidden;
ResearchCategories.researchCategories.get(tab).research.get(key).setParents(new String[0]);
ResearchCategories.researchCategories.get(tab).research.get(key).setParentsHidden(new String[0]);
Thaumcraft.info("TCHelper.clearPrereq(\"" + key + "\");");
}
@Override
@@ -3,6 +3,7 @@ package modtweaker2.mods.thaumcraft.research;
import static modtweaker2.mods.thaumcraft.ThaumcraftHelper.getResearchSafe;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ResearchItem;
@@ -22,6 +23,7 @@ public class ClearSiblings implements IUndoableAction {
public void apply() {
siblings = ResearchCategories.researchCategories.get(tab).research.get(key).siblings;
ResearchCategories.researchCategories.get(tab).research.get(key).setSiblings(new String[0]);
Thaumcraft.info("TCHelper.clearSiblings(\"" + key + "\");");
}
@Override
@@ -5,6 +5,7 @@ import static modtweaker2.mods.thaumcraft.ThaumcraftHelper.getResearchSafe;
import java.lang.reflect.Field;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ResearchItem;
@@ -47,6 +48,7 @@ public class Difficulty implements IUndoableAction {
} catch (Exception e) {
e.printStackTrace();
}
Thaumcraft.info("TCHelper.setResearchComplexity(\"" + key + "\", " + difficulty + ");");
}
@Override
@@ -3,6 +3,7 @@ package modtweaker2.mods.thaumcraft.research;
import java.lang.reflect.Field;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ResearchItem;
@@ -38,6 +39,7 @@ public class MoveResearch implements IUndoableAction {
} catch (Exception e) {
e.printStackTrace();
}
Thaumcraft.info("TCHelper.moveResearch(\"" + key + "\", \"" + newTab + "\", " + x + ", " + y + ");");
}
}
@@ -9,6 +9,7 @@ import java.util.function.Function;
import minetweaker.IUndoableAction;
import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import org.apache.commons.lang3.ArrayUtils;
@@ -58,6 +59,7 @@ public class OrphanResearch implements IUndoableAction {
remove(research, researchItem.siblings, siblings, researchItem::setSiblings);
}
}
Thaumcraft.info("TCHelper.orphanResearch(\"" + key + "\");");
}
@Override
@@ -3,6 +3,7 @@ package modtweaker2.mods.thaumcraft.research;
import static modtweaker2.helpers.StackHelper.areEqual;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import net.minecraft.item.ItemStack;
@@ -90,6 +91,7 @@ public class RefreshResearch implements IUndoableAction {
}
}
}
Thaumcraft.info("TCHelper.refreshResearchPages(\"" + research + "\");");
}
}
@@ -1,6 +1,7 @@
package modtweaker2.mods.thaumcraft.research;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ResearchItem;
@@ -21,6 +22,7 @@ public class RemoveResearch implements IUndoableAction {
if (tab != null) {
removed = ResearchCategories.researchCategories.get(tab).research.get(key);
ResearchCategories.researchCategories.get(tab).research.remove(key);
Thaumcraft.info("TCHelper.removeResearch(\"" + key + "\");");
}
}
@@ -1,6 +1,7 @@
package modtweaker2.mods.thaumcraft.research;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ResearchCategoryList;
@@ -17,6 +18,7 @@ public class RemoveTab implements IUndoableAction {
public void apply() {
list = ResearchCategories.getResearchList(tab);
ResearchCategories.researchCategories.remove(tab);
Thaumcraft.info("ResearchCategories.researchCategories.remove(\"" + tab + "\");");
}
@Override
@@ -5,6 +5,7 @@ import static modtweaker2.mods.thaumcraft.ThaumcraftHelper.getResearchSafe;
import java.lang.reflect.Field;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchCategories;
@@ -48,6 +49,7 @@ public class SetAspects implements IUndoableAction {
} catch (Exception e) {
e.printStackTrace();
}
Thaumcraft.info("TCHelper.setResearchAspects(\"" + key + "\", " + Thaumcraft.convertAspects(list) + ");");
}
@Override
@@ -5,6 +5,7 @@ import static modtweaker2.mods.thaumcraft.ThaumcraftHelper.getResearchSafe;
import java.lang.reflect.Field;
import minetweaker.IUndoableAction;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
import modtweaker2.mods.thaumcraft.handlers.Research.SetType;
import thaumcraft.api.research.ResearchCategories;
@@ -29,14 +30,31 @@ public class SetResearch implements IUndoableAction {
public void apply() {
ResearchItem research = ResearchCategories.researchCategories.get(tab).research.get(key);
if (flag) {
if (type == SetType.AUTO) research.setAutoUnlock();
else if (type == SetType.ROUND) research.setRound();
else if (type == SetType.SPIKE) research.setSpecial();
else if (type == SetType.SECONDARY) research.setSecondary();
else if (type == SetType.STUB) research.setStub();
else if (type == SetType.VIRTUAL) research.setVirtual();
else if (type == SetType.CONCEAL) research.setConcealed();
else if (type == SetType.HIDDEN) research.setHidden();
if (type == SetType.AUTO) {
research.setAutoUnlock();
Thaumcraft.researchInfo(key, ".setAutoUnlock()");
} else if (type == SetType.ROUND) {
research.setRound();
Thaumcraft.researchInfo(key, ".setRound()");
} else if (type == SetType.SPIKE) {
research.setSpecial();
Thaumcraft.researchInfo(key, ".setSpecial()");
} else if (type == SetType.SECONDARY) {
research.setSecondary();
Thaumcraft.researchInfo(key, ".setSecondary()");
} else if (type == SetType.STUB) {
research.setStub();
Thaumcraft.researchInfo(key, ".setStub()");
} else if (type == SetType.VIRTUAL) {
research.setVirtual();
Thaumcraft.researchInfo(key, ".setVirtual()");
} else if (type == SetType.CONCEAL) {
research.setConcealed();
Thaumcraft.researchInfo(key, ".setConcealed()");
} else if (type == SetType.HIDDEN) {
research.setHidden();
Thaumcraft.researchInfo(key, ".setHidden()");
}
applied = true;
} else {
try {