Compare commits

...

1 commit

Author SHA1 Message Date
Jared 6ee996fb5c UPDATED TO 1.8.9 2016-02-27 14:21:27 +02:00
241 changed files with 230 additions and 15754 deletions

View file

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication"><stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="GradleStart"/><stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ModTweaker2"/><stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="C:\Users\Jared\Documents\Github\ModTweaker2\eclipse"/><stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value=" -DFORGE_FORCE_FRAME_RECALC=true"/></launchConfiguration>

View file

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication"><stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="GradleStartServer"/><stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ModTweaker2"/><stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="C:\Users\Jared\Documents\Github\ModTweaker2\eclipse"/><stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value=" -DFORGE_FORCE_FRAME_RECALC=true"/></launchConfiguration>

View file

@ -1,27 +1,20 @@
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
}
}
apply plugin: 'forge'
apply plugin: 'java'
apply plugin: 'net.minecraftforge.gradle.forge'
// define the properties file
ext.configFile = file "build.properties"
configFile.withReader {
// read config. it shall from now on be referenced as simply config or as project.config
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
@ -35,6 +28,7 @@ minecraft {
version = "${config.minecraft.version}-${config.forge.version}"
runDir = "eclipse"
replace "@modVersion@", config.mod.version
mappings = "stable_20"
}
repositories {
@ -44,25 +38,18 @@ repositories {
}
}
dependencies {
compile "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}:api"
}
processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", config.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':config.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}

View file

@ -1,6 +1,4 @@
minecraft.version=1.7.10
forge.version=10.13.4.1448-1.7.10
minecraft.version=1.8.9
forge.version=11.15.0.1701
mod.version=0.9.5
forestry.version=4.1.0.43
mod.version=1.0.0

Binary file not shown.

BIN
libs/Baubles-deobf.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,141 +0,0 @@
package naruto1310.extendedWorkbench.crafting;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
public class ExtendedCraftingManager
{
/** The static instance of this class */
private static final ExtendedCraftingManager instance = new ExtendedCraftingManager();
/** A list of all the recipes added */
private List<IRecipe> recipes = new ArrayList<IRecipe>();
/**
* Returns the static instance of this class
*/
public static final ExtendedCraftingManager getInstance()
{
return instance;
}
private void addExtendedRecipe(ItemStack par1ItemStack, Object ... par2ArrayOfObj)
{
String var3 = "";
int var4 = 0;
int var5 = 0;
int var6 = 0;
if(par2ArrayOfObj[var4] instanceof String[])
{
String[] var7 =((String[])par2ArrayOfObj[var4++]);
for(int var8 = 0; var8 < var7.length; ++var8)
{
String var9 = var7[var8];
++var6;
var5 = var9.length();
var3 = var3 + var9;
}
}
else
{
while(par2ArrayOfObj[var4] instanceof String)
{
String var11 =(String)par2ArrayOfObj[var4++];
++var6;
var5 = var11.length();
var3 = var3 + var11;
}
}
HashMap<Character, ItemStack> var12;
for(var12 = new HashMap<Character, ItemStack>(); var4 < par2ArrayOfObj.length; var4 += 2)
{
Character var13 =(Character)par2ArrayOfObj[var4];
ItemStack var14 = null;
if(par2ArrayOfObj[var4 + 1] instanceof Item)
var14 = new ItemStack((Item)par2ArrayOfObj[var4 + 1], 1, 32767);
if(par2ArrayOfObj[var4 + 1] instanceof Block)
var14 = new ItemStack((Block)par2ArrayOfObj[var4 + 1], 1, 32767);
if(par2ArrayOfObj[var4 + 1] instanceof ItemStack)
var14 =(ItemStack)par2ArrayOfObj[var4 + 1];
var12.put(var13, var14);
}
ItemStack[] var15 = new ItemStack[var5 * var6];
for(int var16 = 0; var16 < var5 * var6; ++var16)
{
char var10 = var3.charAt(var16);
if(var12.containsKey(Character.valueOf(var10)))
var15[var16] = var12.get(Character.valueOf(var10)).copy();
else
var15[var16] = null;
}
this.recipes.add(new ExtendedShapedRecipes(var5, var6, var15, par1ItemStack));
}
private void addExtendedShapelessRecipe(ItemStack par1ItemStack, Object ... par2ArrayOfObj)
{
ArrayList<ItemStack> var3 = new ArrayList<ItemStack>();
Object[] var4 = par2ArrayOfObj;
int var5 = par2ArrayOfObj.length;
for(int var6 = 0; var6 < var5; var6++)
{
Object var7 = var4[var6];
if(var7 instanceof Item)
var3.add(new ItemStack((Item)var7, 1, 32767));
else if(var7 instanceof Block)
var3.add(new ItemStack((Block)var7, 1, 32767));
else if(var7 instanceof ItemStack)
var3.add(((ItemStack)var7).copy());
else throw new RuntimeException("Invalid shapeless recipy!");
}
this.recipes.add(new ExtendedShapelessRecipes(par1ItemStack, var3));
}
public ItemStack findMatchingRecipe(InventoryCrafting inv, World world)
{
for(int i = 0; i < this.recipes.size(); i++)
{
IRecipe recipe = this.recipes.get(i);
if(recipe.matches(inv, world))
return recipe.getCraftingResult(inv);
}
return null;
}
public List<IRecipe> getRecipeList()
{
return this.recipes;
}
public static void addRecipe(ItemStack output, Object ... input)
{
ExtendedCraftingManager.getInstance().addExtendedRecipe(output, input);
}
public static void addShapelessRecipe(ItemStack output, Object ... input)
{
ExtendedCraftingManager.getInstance().addExtendedShapelessRecipe(output, input);
}
}

View file

@ -1,103 +0,0 @@
package naruto1310.extendedWorkbench.crafting;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ExtendedShapedRecipes implements IExtendedRecipe
{
private int maxRecipeSize = 6;
/** How many horizontal slots this recipe is wide. */
private int recipeWidth;
/** How many vertical slots this recipe uses. */
private int recipeHeight;
/** Is a array of ItemStack that composes the recipe. */
private ItemStack[] recipeItems;
/** Is the ItemStack that you get when craft the recipe. */
private ItemStack recipeOutput;
public ExtendedShapedRecipes(int par1, int par2, ItemStack[] par3ArrayOfItemStack, ItemStack par4ItemStack)
{
this.recipeWidth = par1;
this.recipeHeight = par2;
this.recipeItems = par3ArrayOfItemStack;
this.recipeOutput = par4ItemStack;
}
@Override
public ItemStack getRecipeOutput()
{
return this.recipeOutput;
}
/**
* Used to check if a recipe matches current crafting inventory
*/
@Override
public boolean matches(InventoryCrafting par1InventoryCrafting, World world)
{
for(int x = 0; x <= this.maxRecipeSize - this.recipeWidth; ++x)
for(int y = 0; y <= this.maxRecipeSize - this.recipeHeight; ++y)
if(this.checkMatch(par1InventoryCrafting, x, y, true) || this.checkMatch(par1InventoryCrafting, x, y, false))
return true;
return false;
}
/**
* Checks if the region of a crafting inventory is match for the recipe.
*/
private boolean checkMatch(InventoryCrafting par1InventoryCrafting, int x, int y, boolean mirrored)
{
for(int i = 0; i < this.maxRecipeSize; ++i)
{
for(int j = 0; j < this.maxRecipeSize; ++j)
{
int var7 = i - x;
int var8 = j - y;
ItemStack stackFound = null;
if(var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight)
if(mirrored)
stackFound = this.recipeItems[this.recipeWidth - var7 - 1 + var8 * this.recipeWidth];
else
stackFound = this.recipeItems[var7 + var8 * this.recipeWidth];
ItemStack stackExcpected = par1InventoryCrafting.getStackInRowAndColumn(i, j);
if(stackFound == null && stackExcpected == null)
continue;
if((stackExcpected == null && stackFound != null) || (stackExcpected != null && stackFound == null))
return false;
if(stackFound.getItem() != stackExcpected.getItem())
return false;
if(stackFound.getItemDamage() != 32767 && stackFound.getItemDamage() != stackExcpected.getItemDamage())
return false;
}
}
return true;
}
/**
* Returns an Item that is the result of this recipe
*/
@Override
public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting)
{
return this.getRecipeOutput().copy();
}
/**
* Returns the size of the recipe area
*/
@Override
public int getRecipeSize()
{
return this.recipeWidth * this.recipeHeight;
}
}

View file

@ -1,92 +0,0 @@
package naruto1310.extendedWorkbench.crafting;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ExtendedShapelessRecipes implements IExtendedRecipe
{
private int maxRecipeSize = 6;
/** Is the ItemStack that you get when craft the recipe. */
private final ItemStack recipeOutput;
/** Is a List of ItemStack that composes the recipe. */
private final List<ItemStack> recipeItems;
public ExtendedShapelessRecipes(ItemStack par1ItemStack, List<ItemStack> par2List)
{
this.recipeOutput = par1ItemStack;
this.recipeItems = par2List;
}
@Override
public ItemStack getRecipeOutput()
{
return this.recipeOutput;
}
/**
* Used to check if a recipe matches current crafting inventory
*/
@Override
public boolean matches(InventoryCrafting par1InventoryCrafting, World world)
{
ArrayList<ItemStack> var2 = new ArrayList<ItemStack>(this.recipeItems);
for (int var3 = 0; var3 < this.maxRecipeSize; ++var3)
{
for (int var4 = 0; var4 < this.maxRecipeSize; ++var4)
{
ItemStack var5 = par1InventoryCrafting.getStackInRowAndColumn(var4, var3);
if (var5 != null)
{
boolean var6 = false;
Iterator<ItemStack> var7 = var2.iterator();
while (var7.hasNext())
{
ItemStack var8 = var7.next();
if (var5 == var8 && (var8.getItemDamage() == 32767 || var5.getItemDamage() == var8.getItemDamage()))
{
var6 = true;
var2.remove(var8);
break;
}
}
if (!var6)
{
return false;
}
}
}
}
return var2.isEmpty();
}
/**
* Returns an Item that is the result of this recipe
*/
@Override
public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting)
{
return this.recipeOutput.copy();
}
/**
* Returns the size of the recipe area
*/
@Override
public int getRecipeSize()
{
return this.recipeItems.size();
}
}

View file

@ -1,8 +0,0 @@
package naruto1310.extendedWorkbench.crafting;
import net.minecraft.item.crafting.IRecipe;
public interface IExtendedRecipe extends IRecipe
{
}

View file

@ -1,49 +0,0 @@
package pneumaticCraft.api.recipe;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class AssemblyRecipe{
public static List<AssemblyRecipe> drillRecipes = new ArrayList<AssemblyRecipe>();
public static List<AssemblyRecipe> laserRecipes = new ArrayList<AssemblyRecipe>();
public static List<AssemblyRecipe> drillLaserRecipes = new ArrayList<AssemblyRecipe>();
private final ItemStack input;
private final ItemStack output;
public AssemblyRecipe(ItemStack input, ItemStack output){
this.input = input;
this.output = output;
}
public ItemStack getInput(){
return input;
}
public ItemStack getOutput(){
return output;
}
public static void addDrillRecipe(Object input, Object output){
drillRecipes.add(new AssemblyRecipe(getStackFromObject(input), getStackFromObject(output)));
}
public static void addLaserRecipe(Object input, Object output){
laserRecipes.add(new AssemblyRecipe(getStackFromObject(input), getStackFromObject(output)));
}
private static ItemStack getStackFromObject(Object object){
if(object instanceof Block) {
return new ItemStack((Block)object);
} else if(object instanceof Item) {
return new ItemStack((Item)object);
} else {
return (ItemStack)object;
}
}
}

View file

@ -1,34 +0,0 @@
package pneumaticCraft.api.recipe;
import net.minecraft.item.ItemStack;
public interface IPressureChamberRecipe{
/**
* Returns the threshold which is minimal to craft the recipe. Negative pressures also work.
* @return threshold pressure
*/
public float getCraftingPressure();
/**
* This method should return the used items in the recipe when the right items are provided to craft this recipe.
* @param inputStacks
* @return usedStacks, return null when the inputStacks aren't valid for this recipe.
*/
public ItemStack[] isValidRecipe(ItemStack[] inputStacks);
/**
* When returned true, only the exact same references of the stacks returned by isValidRecipe() will be removed. This is useful
* to remove stacks with a certain NBT value (like Enchanted Books). Return false for normal behaviour.
* @return true if exact stacks should be removed only.
*/
public boolean shouldRemoveExactStacks();
/**
* This method will be called when the recipe should output its items. the stacks the recipe output, may be dependent on the input stacks.
* @param removedStacks same reference to the stacks returned by isValidRecipe.
* @param inputStacks. These stacks can be modified (like adding/removing NBT data eg.)
* @return outputStacks. Stacks that will pop 'out of the chamber'
*/
public ItemStack[] craftRecipe(ItemStack[] inputStacks, ItemStack[] removedStacks);
}

View file

@ -1,24 +0,0 @@
package pneumaticCraft.api.recipe;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
public class PressureChamberRecipe{
public static List<PressureChamberRecipe> chamberRecipes = new ArrayList<PressureChamberRecipe>();
public static List<IPressureChamberRecipe> specialRecipes = new ArrayList<IPressureChamberRecipe>();
public final ItemStack[] input;
public final ItemStack[] output;
public final float pressure;
public final boolean outputAsBlock;
public PressureChamberRecipe(ItemStack[] input, float pressureRequired, ItemStack[] output, boolean outputAsBlock){
this.input = input;
this.output = output;
pressure = pressureRequired;
this.outputAsBlock = outputAsBlock;
}
}

@ -1 +0,0 @@
Subproject commit ced30ed35097d53cdb2a843d705477e52896e54b

View file

@ -1,13 +1,14 @@
package modtweaker2;
import static modtweaker2.helpers.LogHelper.print;
import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.player.IPlayer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class ClientEvents {
public static int cooldown;

View file

@ -4,27 +4,8 @@ import minetweaker.MineTweakerAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import modtweaker2.commands.EntityMappingLogger;
import modtweaker2.mods.appeng.commands.AppliedEnergisticsLogger;
import modtweaker2.mods.auracascade.commands.AuraLogger;
import modtweaker2.mods.botania.commands.BotaniaBrewLogger;
import modtweaker2.mods.botania.commands.BotaniaLogger;
import modtweaker2.mods.botania.commands.BotaniaOrechidLogger;
import modtweaker2.mods.botania.lexicon.commands.LexiconCategoryLogger;
import modtweaker2.mods.botania.lexicon.commands.LexiconKnowledgeTypesLogger;
import modtweaker2.mods.botania.lexicon.commands.LexiconPageLogger;
import modtweaker2.mods.chisel.commands.ChiselGroupLogger;
import modtweaker2.mods.chisel.commands.ChiselVariationLogger;
import modtweaker2.mods.exnihilo.commands.ExNihiloLogger;
import modtweaker2.mods.factorization.commands.FactorizationLogger;
import modtweaker2.mods.mekanism.commands.GasLogger;
import modtweaker2.mods.mekanism.commands.MekanismLogger;
import modtweaker2.mods.railcraft.commands.RailcraftLogger;
import modtweaker2.mods.tconstruct.commands.MaterialLogger;
import modtweaker2.mods.tconstruct.commands.ModifierLogger;
import modtweaker2.mods.tconstruct.commands.TConstructLogger;
import modtweaker2.mods.thaumcraft.commands.AspectLogger;
import modtweaker2.mods.thaumcraft.research.commands.ResearchLogger;
import modtweaker2.mods.thermalexpansion.commands.ThermalExpansionLogger;
import modtweaker2.utils.TweakerPlugin;
public class Commands {
@ -41,59 +22,12 @@ public class Commands {
MineTweakerAPI.server.addMineTweakerCommand("entities", new String[] { "/minetweaker entities", " Outputs a list of entities class mapping keys and the entity IDs" }, new EntityMappingLogger());
if (TweakerPlugin.isLoaded("appliedenergistics2-core")) {
MineTweakerAPI.server.addMineTweakerCommand("appeng", new String[] {"/minetweaker appeng [HANDLER]", " Outputs a list of all Applied Energistics 2 recipes."}, new AppliedEnergisticsLogger());
}
if (TweakerPlugin.isLoaded("aura")) {
MineTweakerAPI.server.addMineTweakerCommand("auras", new String[] { "/minetweaker auras", "Outputs a list of Aura Types" }, new AuraLogger());
}
if (TweakerPlugin.isLoaded("Botania")) {
MineTweakerAPI.server.addMineTweakerCommand("lexiconCategories", new String[] { "/minetweaker lexiconCategories", " Outputs a list of lexicon categories" }, new LexiconCategoryLogger());
MineTweakerAPI.server.addMineTweakerCommand("lexiconPages", new String[] { "/minetweaker lexiconPages", "/minetweaker lexiconPages [ENTRY]", " Outputs a list of lexicon pages for the entry" }, new LexiconPageLogger());
MineTweakerAPI.server.addMineTweakerCommand("botaniaBrews", new String[] { "/minetweaker botaniaBrews", " Outputs a list of keys for botania brews" }, new BotaniaBrewLogger());
MineTweakerAPI.server.addMineTweakerCommand("lexiconKnowledgeTypes", new String[] { "/minetweaker lexiconKnowledgeTypes", " Outputs a list of keys for lexicon knowledge types" }, new LexiconKnowledgeTypesLogger());
MineTweakerAPI.server.addMineTweakerCommand("botaniaOrechid", new String[] { "/minetweaker botaniaOrechid", " Outputs a list of keys for botania orechid weights" }, new BotaniaOrechidLogger());
MineTweakerAPI.server.addMineTweakerCommand("botania", new String[] { "/minetweaker botania [HANDLER]", " Outputs a list of all Botania recipes." }, new BotaniaLogger());
}
if (TweakerPlugin.isLoaded("chisel")) {
MineTweakerAPI.server.addMineTweakerCommand("chiselGroups", new String[] { "/minetweaker chiselGroups", " Outputs a list of chisel groups" }, new ChiselGroupLogger());
MineTweakerAPI.server.addMineTweakerCommand("chiselVariations", new String[] { "/minetweaker chiselVariations", "/minetweaker chiselVariations [GROUP]", " Outputs a list of chisel variations" }, new ChiselVariationLogger());
}
if (TweakerPlugin.isLoaded("exnihilo")) {
MineTweakerAPI.server.addMineTweakerCommand("exnihilo", new String[] {"/minetweaker exnihilo [HANDLER]", " Outputs a list of all ExNihilo recipes."}, new ExNihiloLogger());
}
if (TweakerPlugin.isLoaded("factorization")) {
MineTweakerAPI.server.addMineTweakerCommand("factorization", new String[] {"/minetweaker factorization [HANDLER]", " Outputs a list of all Factorization recipes."}, new FactorizationLogger());
}
if (TweakerPlugin.isLoaded("Mekanism")) {
MineTweakerAPI.server.addMineTweakerCommand("gases", new String[] { "/minetweaker gases", " Outputs a list of all gas names in the game to the minetweaker log" }, new GasLogger());
MineTweakerAPI.server.addMineTweakerCommand("mekanism", new String[] { "/minetweaker mekanism [HANDLER]", " Outputs a list of all Mekanism recipes." }, new MekanismLogger());
}
if (TweakerPlugin.isLoaded("Railcraft")) {
MineTweakerAPI.server.addMineTweakerCommand("railcraft", new String[] {"/minetweaker railcraft [HANDLER]", " Outputs a list of all Railcraft recipes."}, new RailcraftLogger());
}
if (TweakerPlugin.isLoaded("TConstruct")) {
MineTweakerAPI.server.addMineTweakerCommand("materials", new String[] { "/minetweaker materials", " Outputs a list of all Tinker's Construct material names in the game to the minetweaker log" }, new MaterialLogger());
MineTweakerAPI.server.addMineTweakerCommand("modifiers", new String[] { "/minetweaker modifiers", " Outputs a list of all Tinker's Construct modifier names in the game to the minetweaker log" }, new ModifierLogger());
MineTweakerAPI.server.addMineTweakerCommand("tconstruct", new String[]{ "/minetweaker tconstruct [HANDLER]", " Outputs a list of all Tinkers Construct recipes."}, new TConstructLogger());
}
if (TweakerPlugin.isLoaded("Thaumcraft")) {
MineTweakerAPI.server.addMineTweakerCommand("research", new String[] { "/minetweaker research", "/minetweaker research [CATEGORY]", " Outputs a list of all category names in the game to the minetweaker log," + " or outputs a list of all research keys in a category to the log." }, new ResearchLogger());
MineTweakerAPI.server.addMineTweakerCommand("aspectList", new String[] { "/minetweaker aspectList", " Outputs a list of all aspects registered to entities and items" }, new AspectLogger());
}
if (TweakerPlugin.isLoaded("ThermalExpansion")) {
MineTweakerAPI.server.addMineTweakerCommand("thermalexpansion", new String[] {"/minetweaker thermalexpansion [HANDLER]", " Outputs a list of all Thermal Expansion recipes."}, new ThermalExpansionLogger());
}
}
}

View file

@ -5,5 +5,5 @@ public class ModProps {
public static final String NAME = "Mod Tweaker 2", name = NAME;
public static final String MODID = "modtweaker2", modid = MODID;
public static final String VERSION = "@modVersion@", version = VERSION;
public static final String DEPENDENCIES = "required-after:MineTweaker3;after:Forestry@[4.1.0,);", dependencies = DEPENDENCIES;
public static final String DEPENDENCIES = "required-after:crafttweaker;", dependencies = DEPENDENCIES;
}

View file

@ -2,117 +2,79 @@ package modtweaker2;
import java.io.File;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.MineTweakerImplementationAPI.ReloadEvent;
import minetweaker.runtime.providers.ScriptProviderDirectory;
import minetweaker.util.IEventHandler;
import modtweaker2.mods.appeng.AppliedEnergistics;
import modtweaker2.mods.auracascade.AuraCascade;
import modtweaker2.mods.botania.Botania;
import modtweaker2.mods.chisel.Chisel;
import modtweaker2.mods.exnihilo.ExNihilo;
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;
import modtweaker2.mods.metallurgy.Metallurgy;
import modtweaker2.mods.pneumaticcraft.PneumaticCraft;
import modtweaker2.mods.railcraft.Railcraft;
import modtweaker2.mods.tconstruct.TConstruct;
import modtweaker2.mods.thaumcraft.Thaumcraft;
import modtweaker2.mods.thermalexpansion.ThermalExpansion;
import modtweaker2.proxy.CommonProxy;
import modtweaker2.utils.TweakerPlugin;
import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.relauncher.Side;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.relauncher.Side;
@Mod(modid = ModProps.modid, version = ModProps.version, dependencies = ModProps.dependencies)
public class ModTweaker2 {
public static Logger logger = LogManager.getLogger(ModProps.modid);
public static Logger logger = LogManager.getLogger(ModProps.modid);
public static File baseIMCFolder;
@Instance(ModProps.modid)
public ModTweaker2 instance;
@SidedProxy(clientSide = "modtweaker2.proxy.ClientProxy", serverSide = "modtweaker2.proxy.CommonProxy")
public static CommonProxy proxy;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
logger.info("Starting PreInitialization for " + ModProps.modid);
}
@Instance(ModProps.modid)
public ModTweaker2 instance;
@SidedProxy(clientSide = "modtweaker2.proxy.ClientProxy", serverSide = "modtweaker2.proxy.CommonProxy")
public static CommonProxy proxy;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
logger.info("Starting PreInitialization for " + ModProps.modid);
}
@EventHandler
public void init(FMLInitializationEvent event) {
logger.info("Starting Initialization for " + ModProps.modid);
TweakerPlugin.register("appliedenergistics2-core", AppliedEnergistics.class);
TweakerPlugin.register("Botania", Botania.class);
TweakerPlugin.register("exnihilo", ExNihilo.class);
TweakerPlugin.register("extendedWorkbench", ExtendedWorkbench.class);
TweakerPlugin.register("factorization", Factorization.class);
TweakerPlugin.register("Mariculture", Mariculture.class);
TweakerPlugin.register("Mekanism", Mekanism.class);
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);
TweakerPlugin.register("Forestry", Forestry.class);
TweakerPlugin.register("chisel", Chisel.class);
TweakerPlugin.register("aura", AuraCascade.class);
TweakerPlugin.register("ExtraUtilities", ExtraUtils.class);
TweakerPlugin.register("IC2", IC2C.class);
@EventHandler
public void init(FMLInitializationEvent event) {
logger.info("Starting Initialization for " + ModProps.modid);
TweakerPlugin.register("Thaumcraft", Thaumcraft.class);
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
MinecraftForge.EVENT_BUS.register(new ClientEvents());
}
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
MinecraftForge.EVENT_BUS.register(new ClientEvents());
}
MineTweakerImplementationAPI.onReloadEvent(new IEventHandler<MineTweakerImplementationAPI.ReloadEvent>() {
MineTweakerImplementationAPI.onReloadEvent(new IEventHandler<MineTweakerImplementationAPI.ReloadEvent>() {
@Override
public void handle(ReloadEvent event) {
proxy.registerCommands();
@Override
public void handle(ReloadEvent event) {
proxy.registerCommands();
}
});
}
});
File scripts = new File("scripts");
if (!scripts.exists()) {
scripts.mkdir();
}
MineTweakerImplementationAPI.setScriptProvider(new ScriptProviderDirectory(scripts));
}
File scripts = new File("scripts");
if (!scripts.exists()) {
scripts.mkdir();
}
MineTweakerImplementationAPI.setScriptProvider(new ScriptProviderDirectory(scripts));
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
logger.info("Starting PostInitialization for " + ModProps.modid);
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
logger.info("Starting PostInitialization for " + ModProps.modid);
}
@EventHandler
public void serverStart(FMLServerStartingEvent event) {
logger.info("Starting ServerStart for " + ModProps.modid);
proxy.registerCommands();
@EventHandler
public void serverStart(FMLServerStartingEvent event) {
logger.info("Starting ServerStart for " + ModProps.modid);
proxy.registerCommands();
}
}
}

View file

@ -11,22 +11,22 @@ import net.minecraft.entity.EntityList;
public class EntityMappingLogger implements ICommandFunction {
@Override
public void execute(String[] arguments, IPlayer player) {
@Override
public void execute(String[] arguments, IPlayer player) {
@SuppressWarnings("unchecked")
Set<Integer> keys = EntityList.stringToIDMapping.keySet();
System.out.println("Mob Keys: " + keys.size());
for (Integer key : keys) {
ModTweaker2.logger.info("Mob Key " + EntityList.getStringFromID(key) + " : " + key);
MineTweakerAPI.logCommand("Mob Key " + EntityList.getStringFromID(key) + " : " + key);
@SuppressWarnings("unchecked")
Set<String> keys = EntityList.stringToClassMapping.keySet();
}
System.out.println("Mob Keys: " + keys.size());
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
for (String key : keys) {
ModTweaker2.logger.info("Mob Key " + key);
MineTweakerAPI.logCommand("Mob Key " + key);
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}

View file

@ -13,9 +13,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.ForgeHooks;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.Side;
public class ForgeHelper {
@SuppressWarnings("rawtypes")
@ -29,15 +29,15 @@ public class ForgeHelper {
seeds = getStaticObject(ForgeHooks.class, "seedList");
loot = getStaticObject(ChestGenHooks.class, "chestInfo");
translate = getFinalObject(getStaticObject(StatCollector.class, "localizedName", "field_74839_a"), "languageList", "field_74816_c");
} catch (Exception e) { }
} catch (Exception e) {
}
}
private ForgeHelper() {
}
public static Object getSeedEntry(ItemStack stack, int weight) {
Object seedEntry = getInstance(getConstructor("net.minecraftforge.common.ForgeHooks$SeedEntry",
ItemStack.class, int.class), stack, weight);
Object seedEntry = getInstance(getConstructor("net.minecraftforge.common.ForgeHooks$SeedEntry", ItemStack.class, int.class), stack, weight);
if (seedEntry == null) {
throw new NullPointerException("Failed to instantiate SeedEntry");
@ -47,7 +47,6 @@ public class ForgeHelper {
}
public static boolean isLangActive(String lang) {
return FMLCommonHandler.instance().getSide() == Side.SERVER ? null
: FMLClientHandler.instance().getCurrentLanguage().equals(lang);
return FMLCommonHandler.instance().getSide() == Side.SERVER ? null : FMLClientHandler.instance().getCurrentLanguage().equals(lang);
}
}

View file

@ -8,8 +8,8 @@ import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack;
import minetweaker.api.oredict.IOreDictEntry;
import minetweaker.mc1710.item.MCItemStack;
import minetweaker.mc1710.liquid.MCLiquidStack;
import minetweaker.mc18.item.MCItemStack;
import minetweaker.mc18.liquid.MCLiquidStack;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;

View file

@ -4,14 +4,12 @@ import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import mekanism.api.gas.GasStack;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.oredict.IOreDictEntry;
import minetweaker.api.player.IPlayer;
import minetweaker.mc1710.item.MCItemStack;
import modtweaker2.mods.mekanism.gas.MCGasStack;
import minetweaker.mc18.item.MCItemStack;
import modtweaker2.mods.thaumcraft.aspect.AspectStack;
import modtweaker2.mods.thaumcraft.aspect.MCAspectStack;
import modtweaker2.utils.TweakerPlugin;
@ -64,6 +62,7 @@ public class LogHelper {
/**
* Returns a string representation of the item which can also be used in scripts
*/
@SuppressWarnings("rawtypes")
public static String getStackDescription(Object object) {
if(object instanceof IIngredient) {
return getStackDescription((IIngredient)object);
@ -73,9 +72,7 @@ public class LogHelper {
return getStackDescription((FluidStack) object);
} else if (object instanceof Block) {
return new MCItemStack(new ItemStack((Block)object, 1, 0)).toString();
} else if (TweakerPlugin.isLoaded("Mekanism") && object instanceof GasStack) {
return new MCGasStack((GasStack)object).toString();
} else if (TweakerPlugin.isLoaded("Thaumcraft") && object instanceof AspectStack) {
} else if (TweakerPlugin.isLoaded("Thaumcraft") && object instanceof AspectStack) {
return new MCAspectStack((AspectStack)object).toString();
} else if(TweakerPlugin.isLoaded("Thaumcraft") && object instanceof AspectList) {
List<AspectStack> stacks = new LinkedList<AspectStack>();

View file

@ -155,6 +155,6 @@ public class ReflectionHelper {
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void setPrivateValue( Class cls, Object o, String field, Object var) {
cpw.mods.fml.relauncher.ReflectionHelper.setPrivateValue(cls, o, var, field);
net.minecraftforge.fml.relauncher.ReflectionHelper.setPrivateValue(cls, o, var, field);
}
}

View file

@ -1,13 +1,11 @@
package modtweaker2.helpers;
import static modtweaker2.helpers.InputHelper.toStack;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import minetweaker.api.item.IngredientAny;
import minetweaker.api.liquid.ILiquidStack;
import modtweaker2.mods.botania.Botania;
import modtweaker2.mods.mekanism.MekanismHelper;
import modtweaker2.mods.mekanism.gas.IGasStack;
import modtweaker2.utils.TweakerPlugin;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@ -19,9 +17,7 @@ public class StackHelper {
public static boolean areEqual(ItemStack stack1, ItemStack stack2) {
if (stack1 == null || stack2 == null) {
return false;
} else if (TweakerPlugin.isLoaded("Botania") && Botania.isSubtile(stack1) && Botania.isSubtile(stack2)) {
return Botania.subtileMatches(stack1, stack2);
} else {
} else {
return stack1.isItemEqual(stack2);
}
}
@ -69,18 +65,7 @@ public class StackHelper {
return false;
}
// Check for Botania special flowers
if(ingredient.getItems() != null && TweakerPlugin.isLoaded("Botania") && Botania.isSubtile(toStack(itemStack))) {
for(IItemStack item : ingredient.getItems()) {
if(areEqual(toStack(item), toStack(itemStack))) {
return true;
}
}
} else {
return true;
}
return false;
}
/**
@ -109,20 +94,5 @@ public class StackHelper {
return false;
}
public static boolean matches(IIngredient ingredient, IGasStack gasStack) {
if(ingredient == null) {
return false;
}
if(ingredient == IngredientAny.INSTANCE) {
return true;
}
if(ingredient instanceof IGasStack) {
return MekanismHelper.toGas((IGasStack)ingredient).isGasEqual(MekanismHelper.toGas(gasStack));
}
return false;
}
}

View file

@ -1,13 +0,0 @@
package modtweaker2.mods.appeng;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.appeng.handlers.Grind;
import modtweaker2.mods.appeng.handlers.Inscriber;
public class AppliedEnergistics {
public AppliedEnergistics() {
MineTweakerAPI.registerClass(Inscriber.class);
MineTweakerAPI.registerClass(Grind.class);
}
}

View file

@ -1,77 +0,0 @@
package modtweaker2.mods.appeng;
import static modtweaker2.helpers.StackHelper.areEqualOrNull;
import net.minecraft.item.ItemStack;
import appeng.api.features.IGrinderEntry;
import appeng.api.features.IInscriberRecipe;
public class AppliedEnergisticsHelper {
/**
* Compares two IInscriberRecipe objects, if they are the same or have the same inputs
*/
public static boolean equals(IInscriberRecipe r1, IInscriberRecipe r2) {
if(r1 == r2) {
return true;
}
if (r1 == null || r2 == null) {
return false;
}
if(!areEqualOrNull(r1.getTopOptional().orNull(), r2.getTopOptional().orNull())) {
return false;
}
if(!areEqualOrNull(r1.getBottomOptional().orNull(), r2.getBottomOptional().orNull())) {
return false;
}
if(r1.getInputs() == null && r2.getInputs() != null || r1.getInputs() != null && r2.getInputs() == null) {
return false;
}
if(r1.getInputs() != null && r2.getInputs() != null) {
if(r1.getInputs().size() != r2.getInputs().size()) {
return false;
}
// Check if every item in recipe 1 is in recipe 2
for(ItemStack i1 : r1.getInputs()) {
boolean found = false;
for(ItemStack i2 : r2.getInputs()) {
if(areEqualOrNull(i1, i2)) {
found = true;
}
}
if(!found) {
return false;
}
}
}
return true;
}
/**
* Compares two IGrinderEntry objects, if they are the same or have the same inputs
*/
public static boolean equals(IGrinderEntry r1, IGrinderEntry r2) {
if(r1 == r2) {
return true;
}
if (r1 == null || r2 == null) {
return false;
}
if(!areEqualOrNull(r1.getInput(), r2.getInput())) {
return false;
}
return true;
}
}

View file

@ -1,64 +0,0 @@
package modtweaker2.mods.appeng.commands;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import modtweaker2.helpers.LogHelper;
import modtweaker2.helpers.StringHelper;
import appeng.api.AEApi;
import appeng.api.features.IGrinderEntry;
import appeng.api.features.IInscriberRecipe;
public class AppliedEnergisticsLogger implements ICommandFunction {
private static final List<String> validArguments = new LinkedList<String>();
static {
validArguments.add("Grinder");
validArguments.add("Inscriber");
}
@Override
public void execute(String[] arguments, IPlayer player) {
List<String> args = StringHelper.toLowerCase(Arrays.asList(arguments));
if(!validArguments.containsAll(args)) {
if(player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("Invalid arguments for command. Valid arguments: " + StringHelper.join(validArguments, ", ")));
}
} else {
if(args.isEmpty() || args.contains("Grinder")) {
for(IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes()) {
MineTweakerAPI.logCommand(String.format("mods.appeng.Grinder.addRecipe(%s, %s, %d, %s, %s, %s, %s);",
LogHelper.getStackDescription(recipe.getInput()),
LogHelper.getStackDescription(recipe.getOutput()),
recipe.getEnergyCost(),
LogHelper.getStackDescription(recipe.getOptionalOutput()),
recipe.getOptionalChance(),
LogHelper.getStackDescription(recipe.getSecondOptionalOutput()),
recipe.getSecondOptionalChance()));
}
}
if(args.isEmpty() || args.contains("Inscriber")) {
for(IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes()) {
MineTweakerAPI.logCommand(String.format("mods.appeng.Inscriber.addRecipe(%s, %s, %s, %s, \"%s\");",
LogHelper.getListDescription(recipe.getInputs()),
LogHelper.getStackDescription(recipe.getTopOptional().orNull()),
LogHelper.getStackDescription(recipe.getBottomOptional().orNull()),
LogHelper.getStackDescription(recipe.getOutput()),
recipe.getProcessType().toString()));
}
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}
}

View file

@ -1,192 +0,0 @@
package modtweaker2.mods.appeng.handlers;
import appeng.api.AEApi;
import appeng.api.features.IGrinderEntry;
import appeng.core.features.registries.entries.AppEngGrinderRecipe;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import minetweaker.api.item.WeightedItemStack;
import modtweaker2.helpers.InputHelper;
import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.appeng.AppliedEnergisticsHelper;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import stanhebben.zenscript.annotations.Optional;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import java.util.LinkedList;
import static modtweaker2.helpers.InputHelper.toIItemStack;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.matches;
@ZenClass("mods.appeng.Grinder")
public class Grind {
protected static final String name = "Applied Energistics 2 Grindstone";
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Adds a shaped recipe for the Grindstone
* @param outputs
* @param inputStack
* @param turns
*/
@ZenMethod
public static void addRecipe(WeightedItemStack[] outputs, IItemStack inputStack, int turns) {
IGrinderEntry recipe;
if (outputs.length == 1)
recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputs[0].getStack()), turns);
else if (outputs.length == 2)
recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputs[0].getStack()), InputHelper.toStack(outputs[1].getStack()), outputs[1].getChance(), turns);
else if (outputs.length == 3)
recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputs[0].getStack()), InputHelper.toStack(outputs[1].getStack()), InputHelper.toStack(outputs[2].getStack()), outputs[1].getChance(), outputs[2].getChance(), turns);
else {
LogHelper.logWarning(String.format("No more then 3 output stacks are allowed in %s. Command ignored!", name, LogHelper.getStackDescription(toStack(inputStack))));
return;
}
// Check if the recipe is already present, we don't want to add duplicates
for (IGrinderEntry r : AEApi.instance().registries().grinder().getRecipes()) {
if (r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", name, LogHelper.getStackDescription(toStack(inputStack))));
return;
}
}
MineTweakerAPI.apply(new Add(recipe));
}
/**
* Adds a shaped recipe for the Grindstone
*
* @param outputStack - Product of the Recipe
* @param inputStack - Ingredient of the Recipe
* @param inputEnergy - Energy requirement of the Recipe
* @optionalParam outputStack2 - Second product of the Recipe
* @optionalParam outputStack2Chance - Chance for the acquirement of the second product
* @optionalParam outputStack3 - Third product of the Recipe
* @optionalParam outputStack3Chance - Chance for the acquirement of the third product
**/
@Deprecated
@ZenMethod
public static void addRecipe(IItemStack outputStack, IItemStack inputStack, @Optional IItemStack outputStack2, @Optional float outputStack2Chance, @Optional IItemStack outputStack3, @Optional float outputStack3Chance, int inputEnergy) {
if (inputStack == null || outputStack == null) {
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
return;
}
// Create recipe
IGrinderEntry recipe;
if (outputStack2 != null && outputStack3 != null)
recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputStack), InputHelper.toStack(outputStack2), InputHelper.toStack(outputStack3), outputStack2Chance, outputStack3Chance, inputEnergy);
else if (outputStack2 != null)
recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputStack), InputHelper.toStack(outputStack2), outputStack2Chance, inputEnergy);
else
recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputStack), inputEnergy);
// Check if the recipe is already present, we don't want to add duplicates
for (IGrinderEntry r : AEApi.instance().registries().grinder().getRecipes()) {
if (r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", name, LogHelper.getStackDescription(toStack(inputStack))));
return;
}
}
MineTweakerAPI.apply(new Add(recipe));
}
@Deprecated
@ZenMethod
public static void addRecipe(IItemStack input, IItemStack output, int energy, @Optional IItemStack output2, @Optional float chance2, @Optional IItemStack output3, @Optional float chance3) {
if (input == null || output == null) {
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
return;
}
// Create recipe
IGrinderEntry recipe;
if (output2 != null && output3 != null)
recipe = new AppEngGrinderRecipe(InputHelper.toStack(input), InputHelper.toStack(output), InputHelper.toStack(output2), InputHelper.toStack(output3), chance2, chance3, energy);
else if (output2 != null)
recipe = new AppEngGrinderRecipe(InputHelper.toStack(input), InputHelper.toStack(output), InputHelper.toStack(output2), chance2, energy);
else
recipe = new AppEngGrinderRecipe(InputHelper.toStack(input), InputHelper.toStack(output), energy);
// Check if the recipe is already present, we don't want to add duplicates
for (IGrinderEntry r : AEApi.instance().registries().grinder().getRecipes()) {
if (r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", name, LogHelper.getStackDescription(toStack(input))));
return;
}
}
MineTweakerAPI.apply(new Add(recipe));
}
private static class Add extends BaseListAddition<IGrinderEntry> {
public Add(IGrinderEntry recipe) {
super(Grind.name, AEApi.instance().registries().grinder().getRecipes());
recipes.add(recipe);
}
@Override
public String getRecipeInfo(IGrinderEntry recipe) {
return LogHelper.getStackDescription(recipe.getInput());
}
@Override
protected boolean equals(IGrinderEntry recipe, IGrinderEntry otherRecipe) {
return AppliedEnergisticsHelper.equals(recipe, otherRecipe);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Removes a recipe for the Grindstone
*
* @param input - Product of the Recipe
**/
@ZenMethod
public static void removeRecipe(IIngredient input) {
if (input == null) {
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
return;
}
// Get list of existing recipes, matching with parameter
LinkedList<IGrinderEntry> result = new LinkedList<IGrinderEntry>();
for (IGrinderEntry entry : AEApi.instance().registries().grinder().getRecipes()) {
if (entry != null && entry.getOutput() != null && matches(input, toIItemStack(entry.getOutput()))) {
result.add(entry);
}
}
// Check if we found the recipes and apply the action
if (!result.isEmpty()) {
MineTweakerAPI.apply(new Remove(result));
} else {
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", name, input.toString()));
}
}
private static class Remove extends BaseListRemoval<IGrinderEntry> {
public Remove(LinkedList<IGrinderEntry> recipes) {
super(Grind.name, AEApi.instance().registries().grinder().getRecipes(), recipes);
}
@Override
public String getRecipeInfo(IGrinderEntry recipe) {
return LogHelper.getStackDescription(recipe.getInput());
}
}
}

View file

@ -1,196 +0,0 @@
package modtweaker2.mods.appeng.handlers;
import static modtweaker2.helpers.InputHelper.toIItemStack;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.InputHelper.toStacks;
import static modtweaker2.helpers.StackHelper.matches;
import java.util.LinkedList;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.appeng.AppliedEnergisticsHelper;
import modtweaker2.utils.ArrayUtils;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import appeng.api.AEApi;
import appeng.api.features.IInscriberRecipe;
import appeng.api.features.InscriberProcessType;
import appeng.core.features.registries.entries.InscriberRecipe;
@ZenClass("mods.appeng.Inscriber")
public class Inscriber {
protected static final String name = "Applied Energistics 2 Inscriber";
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Adds a shaped recipe for the Carpenter
*
* @param outputStack - Product of the Recipe
* @param inputArray - Ingredients of the Recipe
* @param inputStackPlateA - Ingredient of the Recipe for Plate Slot A
* @param inputStackPlateB - Ingredient of the Recipe for Plate Slot B
* @param typeString - Type that decides whether to consume the ItemStack in Plate Slot A/B
**/
@ZenMethod
public static void addRecipe(IItemStack outputStack, IItemStack[] inputArray, IItemStack inputStackPlateA, IItemStack inputStackPlateB, String typeString) {
if(inputArray == null || outputStack == null || (!typeString.equals("Press") && !typeString.equals("Inscribe"))) {
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", Inscriber.name));
return;
}
// Create recipe
IInscriberRecipe recipe = new InscriberRecipe(ArrayUtils.toArrayList(toStacks(inputArray)), toStack(outputStack), toStack(inputStackPlateA), toStack(inputStackPlateB), InscriberProcessType.valueOf(typeString));
// Check if the recipe is already present, we don't want to add duplicates
for(IInscriberRecipe r : AEApi.instance().registries().inscriber().getRecipes()) {
if(r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", Inscriber.name, LogHelper.getStackDescription(toStack(outputStack))));
return;
}
}
MineTweakerAPI.apply(new Add(recipe));
}
@Deprecated
@ZenMethod
public static void addRecipe(IItemStack[] imprintable, IItemStack plateA, IItemStack plateB, IItemStack out, String type) {
if(imprintable == null || out == null || (!type.equals("Press") && !type.equals("Inscribe"))) {
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", Inscriber.name));
return;
}
// Create recipe
IInscriberRecipe recipe = new InscriberRecipe(ArrayUtils.toArrayList(toStacks(imprintable)), toStack(out), toStack(plateA), toStack(plateB), InscriberProcessType.valueOf(type));
// Check if the recipe is already present, we don't want to add duplicates
for(IInscriberRecipe r : AEApi.instance().registries().inscriber().getRecipes()) {
if(r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", Inscriber.name, LogHelper.getStackDescription(toStack(out))));
return;
}
}
MineTweakerAPI.apply(new Add(recipe));
}
public static class Add extends BaseListAddition<IInscriberRecipe> {
public Add(IInscriberRecipe recipe) {
super(Inscriber.name, AEApi.instance().registries().inscriber().getRecipes());
recipes.add(recipe);
}
@Override
public void apply() {
if(recipes.isEmpty()) {
return;
}
for(IInscriberRecipe recipe : recipes) {
try {
AEApi.instance().registries().inscriber().addRecipe(recipe);
successful.add(recipe);
} catch (Exception ex) { LogHelper.logError("Error adding inscriber recipe.", ex); }
}
}
@Override
public void undo() {
if(successful.isEmpty()) {
return;
}
for(IInscriberRecipe recipe : successful) {
try {
AEApi.instance().registries().inscriber().removeRecipe(recipe);
} catch (Exception ex) { LogHelper.logError("Error removing inscriber recipe.", ex); }
}
}
@Override
public String getRecipeInfo(IInscriberRecipe recipe) {
return LogHelper.getStackDescription(recipe.getOutput());
}
@Override
protected boolean equals(IInscriberRecipe recipe, IInscriberRecipe otherRecipe) {
return AppliedEnergisticsHelper.equals(recipe, otherRecipe);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Adds a shaped recipe for the Carpenter
*
* @param outputStack - Product of the Recipe
**/
@ZenMethod
public static void removeRecipe(IIngredient outputStack) {
if(outputStack == null) {
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", Inscriber.name));
return;
}
// Get list of existing recipes, matching with parameter
LinkedList<IInscriberRecipe> result = new LinkedList<IInscriberRecipe>();
for(IInscriberRecipe entry : AEApi.instance().registries().inscriber().getRecipes()) {
if(entry != null && entry.getOutput() != null && matches(outputStack, toIItemStack(entry.getOutput()))) {
result.add(entry);
}
}
// Check if we found the recipes and apply the action
if(!result.isEmpty()) {
MineTweakerAPI.apply(new Remove(result));
} else {
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Inscriber.name, outputStack.toString()));
}
}
public static class Remove extends BaseListRemoval<IInscriberRecipe> {
public Remove(LinkedList<IInscriberRecipe> recipes) {
super(Inscriber.name, AEApi.instance().registries().inscriber().getRecipes(), recipes);
}
@Override
public void apply() {
if(this.recipes.isEmpty()) {
return;
}
for(IInscriberRecipe recipe : recipes) {
try {
AEApi.instance().registries().inscriber().removeRecipe(recipe);
successful.add(recipe);
} catch (Exception ex) { LogHelper.logError("Error removing inscriber recipe.", ex); }
}
}
@Override
public void undo() {
if(successful.isEmpty()) {
return;
}
for(IInscriberRecipe recipe : successful) {
try {
AEApi.instance().registries().inscriber().addRecipe(recipe);
} catch (Exception ex) { LogHelper.logError("Error restoring inscriber recipe.", ex); }
}
}
@Override
public String getRecipeInfo(IInscriberRecipe recipe) {
return LogHelper.getStackDescription(recipe.getOutput());
}
}
}

View file

@ -1,13 +0,0 @@
package modtweaker2.mods.auracascade;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.auracascade.aura.AuraBracketHandler;
import modtweaker2.mods.auracascade.handlers.Pylon;
public class AuraCascade {
public AuraCascade(){
MineTweakerAPI.registerBracketHandler(new AuraBracketHandler());
MineTweakerAPI.registerClass(Pylon.class);
}
}

View file

@ -1,24 +0,0 @@
package modtweaker2.mods.auracascade;
import modtweaker2.mods.auracascade.aura.IAuraStack;
import pixlepix.auracascade.data.AuraQuantity;
import pixlepix.auracascade.data.EnumAura;
public class AuraCascadeHelper {
public static AuraQuantity toAura(IAuraStack iStack) {
if (iStack == null) {
return null;
} else return new AuraQuantity(EnumAura.valueOf(iStack.getName()), iStack.getAmount());
}
// public static GasStack[] toGases(IIngredient[] input) {
// return toGases((IGasStack[]) input);
// }
//
// public static GasStack[] toGases(IGasStack[] iStack) {
// GasStack[] stack = new GasStack[iStack.length];
// for (int i = 0; i < stack.length; i++)
// stack[i] = toGas(iStack[i]);
// return stack;
// }
}

View file

@ -1,85 +0,0 @@
package modtweaker2.mods.auracascade.aura;
import java.util.List;
import minetweaker.IBracketHandler;
import minetweaker.MineTweakerAPI;
import minetweaker.annotations.BracketHandler;
import minetweaker.api.item.IngredientAny;
import pixlepix.auracascade.data.AuraQuantity;
import pixlepix.auracascade.data.EnumAura;
import stanhebben.zenscript.compiler.IEnvironmentGlobal;
import stanhebben.zenscript.expression.ExpressionCallStatic;
import stanhebben.zenscript.expression.ExpressionString;
import stanhebben.zenscript.expression.partial.IPartialExpression;
import stanhebben.zenscript.parser.Token;
import stanhebben.zenscript.symbols.IZenSymbol;
import stanhebben.zenscript.type.natives.IJavaMethod;
import stanhebben.zenscript.util.ZenPosition;
@BracketHandler(priority = 100)
public class AuraBracketHandler implements IBracketHandler {
public static IAuraStack getAura(String name) {
EnumAura aura = EnumAura.valueOf(name);
if (aura != null) {
return new MCAuraStack(new AuraQuantity(aura, 1));
} else {
return null;
}
}
private final IZenSymbol symbolAny;
private final IJavaMethod method;
public AuraBracketHandler() {
symbolAny = MineTweakerAPI.getJavaStaticFieldSymbol(IngredientAny.class, "INSTANCE");
method = MineTweakerAPI.getJavaMethod(AuraBracketHandler.class, "getAura", String.class);
}
@Override
public IZenSymbol resolve(IEnvironmentGlobal environment, List<Token> tokens) {
// any symbol
if (tokens.size() == 1 && tokens.get(0).getValue().equals("*")) {
return symbolAny;
}
if (tokens.size() > 2) {
if (tokens.get(0).getValue().equals("aura") && tokens.get(1).getValue().equals(":")) {
return find(environment, tokens, 2, tokens.size());
}
}
return null;
}
private IZenSymbol find(IEnvironmentGlobal environment, List<Token> tokens, int startIndex, int endIndex) {
//StringBuilder valueBuilder = new StringBuilder();
for (EnumAura a : EnumAura.values()) {
for (int i = startIndex; i < endIndex; i++) {
Token token = tokens.get(i);
if (a.name().equals(token.getValue())) {
return new AuraReferenceSymbol(environment, token.getValue());
}
}
}
return null;
}
private class AuraReferenceSymbol implements IZenSymbol {
private final IEnvironmentGlobal environment;
private final String name;
public AuraReferenceSymbol(IEnvironmentGlobal environment, String name) {
this.environment = environment;
this.name = name;
}
@Override
public IPartialExpression instance(ZenPosition position) {
return new ExpressionCallStatic(position, environment, method, new ExpressionString(position, name));
}
}
}

View file

@ -1,19 +0,0 @@
package modtweaker2.mods.auracascade.aura;
import stanhebben.zenscript.annotations.OperatorType;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter;
import stanhebben.zenscript.annotations.ZenOperator;
@ZenClass("modtweaker.auraCascade.IAuraDefinition")
public interface IAuraDefinition {
@ZenOperator(OperatorType.MUL)
public IAuraStack asAura(int amount);
@ZenGetter("name")
public String getName();
@ZenGetter("displayName")
public String getDisplayName();
}

View file

@ -1,28 +0,0 @@
package modtweaker2.mods.auracascade.aura;
import stanhebben.zenscript.annotations.OperatorType;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter;
import stanhebben.zenscript.annotations.ZenMethod;
import stanhebben.zenscript.annotations.ZenOperator;
@ZenClass("modtweaker.auraCascade.IAuraStack")
public interface IAuraStack {
@ZenGetter("definition")
public IAuraDefinition getDefinition();
@ZenGetter("name")
public String getName();
@ZenGetter("displayName")
public String getDisplayName();
@ZenGetter("amount")
public int getAmount();
@ZenOperator(OperatorType.MUL)
@ZenMethod
public IAuraStack withAmount(int amount);
public Object getInternal();
}

View file

@ -1,27 +0,0 @@
package modtweaker2.mods.auracascade.aura;
import pixlepix.auracascade.data.AuraQuantity;
public class MCAuraDefinition implements IAuraDefinition {
private final AuraQuantity aura;
public MCAuraDefinition(AuraQuantity aura) {
this.aura = aura;
}
@Override
public String getName() {
return aura.getType().name;
}
@Override
public String getDisplayName() {
return aura.getType().name;
}
@Override
public IAuraStack asAura(int amount) {
return new MCAuraStack(new AuraQuantity(aura.getType(), aura.getNum()));
}
}

View file

@ -1,43 +0,0 @@
package modtweaker2.mods.auracascade.aura;
import pixlepix.auracascade.data.AuraQuantity;
public class MCAuraStack implements IAuraStack {
private final AuraQuantity aura;
public MCAuraStack(AuraQuantity aura) {
this.aura = aura;
}
@Override
public IAuraDefinition getDefinition() {
return new MCAuraDefinition(aura);
}
@Override
public String getName() {
return aura.getType().name();
}
@Override
public String getDisplayName() {
return aura.getType().name();
}
@Override
public int getAmount() {
return aura.getNum();
}
@Override
public IAuraStack withAmount(int amount) {
AuraQuantity result = new AuraQuantity(aura.getType(), amount);
return new MCAuraStack(result);
}
@Override
public Object getInternal() {
return aura;
}
}

View file

@ -1,28 +0,0 @@
package modtweaker2.mods.auracascade.commands;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import modtweaker2.ModTweaker2;
import pixlepix.auracascade.data.EnumAura;
public class AuraLogger implements ICommandFunction {
@Override
public void execute(String[] arguments, IPlayer player) {
System.out.println("Aura Types: " + EnumAura.values().length);
MineTweakerAPI.logCommand("Aura Types: " + EnumAura.values().length);
for (EnumAura aura : EnumAura.values()) {
ModTweaker2.logger.info("Aura Type: " + aura.name() + ".");
MineTweakerAPI.logCommand("Aura Type: " + aura.name() + ".");
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}

View file

@ -1,86 +0,0 @@
package modtweaker2.mods.auracascade.handlers;
import static modtweaker2.helpers.InputHelper.toIItemStack;
import static modtweaker2.helpers.InputHelper.toStack;
import java.util.LinkedList;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.mods.auracascade.AuraCascadeHelper;
import modtweaker2.mods.auracascade.aura.IAuraStack;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import pixlepix.auracascade.data.recipe.PylonRecipe;
import pixlepix.auracascade.data.recipe.PylonRecipeComponent;
import pixlepix.auracascade.data.recipe.PylonRecipeRegistry;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.auraCascade.Pylon")
public class Pylon {
protected static final String name = "Aura Cascade Pylon";
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void addRecipe(IItemStack ouput, IAuraStack stack, IItemStack input) {
addRecipe(ouput, stack, input, stack, input, stack, input, stack, input);
}
@ZenMethod
public static void addRecipe(IItemStack ouput, IAuraStack aura1, IItemStack input1, IAuraStack aura2, IItemStack input2, IAuraStack aura3, IItemStack input3, IAuraStack aura4, IItemStack input4) {
List<PylonRecipe> recipes = new LinkedList<PylonRecipe>();
recipes.add(new PylonRecipe(toStack(ouput), new PylonRecipeComponent(AuraCascadeHelper.toAura(aura1), toStack(input1)), new PylonRecipeComponent(AuraCascadeHelper.toAura(aura2), toStack(input2)), new PylonRecipeComponent(AuraCascadeHelper.toAura(aura3), toStack(input3)), new PylonRecipeComponent(AuraCascadeHelper.toAura(aura1), toStack(input4))));
MineTweakerAPI.apply(new Add(recipes));
}
private static class Add extends BaseListAddition<PylonRecipe> {
public Add(List<PylonRecipe> recipes) {
super(Pylon.name, PylonRecipeRegistry.recipes, recipes);
}
@Override
protected String getRecipeInfo(PylonRecipe recipe) {
return LogHelper.getStackDescription(recipe.result);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IIngredient output) {
List<PylonRecipe> recipes = new LinkedList<PylonRecipe>();
for (PylonRecipe r : PylonRecipeRegistry.recipes) {
if (output.matches(toIItemStack(r.result))) {
recipes.add(r);
}
}
// Check if we found the recipes and apply the action
if(!recipes.isEmpty()) {
MineTweakerAPI.apply(new Remove(recipes));
} else {
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Pylon.name, output.toString()));
}
}
private static class Remove extends BaseListRemoval<PylonRecipe> {
public Remove(List<PylonRecipe> recipes) {
super(Pylon.name, PylonRecipeRegistry.recipes, recipes);
}
@Override
protected String getRecipeInfo(PylonRecipe recipe) {
return LogHelper.getStackDescription(recipe.result);
}
}
}

View file

@ -1,34 +0,0 @@
package modtweaker2.mods.botania;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.botania.handlers.Apothecary;
import modtweaker2.mods.botania.handlers.Brew;
import modtweaker2.mods.botania.handlers.ElvenTrade;
import modtweaker2.mods.botania.handlers.Lexicon;
import modtweaker2.mods.botania.handlers.ManaInfusion;
import modtweaker2.mods.botania.handlers.Orechid;
import modtweaker2.mods.botania.handlers.PureDaisy;
import modtweaker2.mods.botania.handlers.RuneAltar;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
public class Botania {
public Botania() {
MineTweakerAPI.registerClass(Apothecary.class);
MineTweakerAPI.registerClass(Brew.class);
MineTweakerAPI.registerClass(ElvenTrade.class);
MineTweakerAPI.registerClass(ManaInfusion.class);
MineTweakerAPI.registerClass(Orechid.class);
MineTweakerAPI.registerClass(PureDaisy.class);
MineTweakerAPI.registerClass(RuneAltar.class);
MineTweakerAPI.registerClass(Lexicon.class);
}
public static boolean isSubtile(ItemStack stack) {
return stack.getItem() instanceof ItemBlockSpecialFlower;
}
public static boolean subtileMatches(ItemStack stack, ItemStack stack2) {
return (ItemBlockSpecialFlower.getType(stack2).equals(ItemBlockSpecialFlower.getType(stack)));
}
}

View file

@ -1,39 +0,0 @@
package modtweaker2.mods.botania;
import java.util.List;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.KnowledgeType;
import vazkii.botania.api.lexicon.LexiconCategory;
import vazkii.botania.api.lexicon.LexiconEntry;
public class BotaniaHelper {
public static LexiconCategory findCatagory(String name)
{
List<LexiconCategory> catagories=BotaniaAPI.getAllCategories();
for(int i=0;i<catagories.size();i++)
{
if(catagories.get(i).getUnlocalizedName().equalsIgnoreCase(name))
return catagories.get(i);
}
return null;
}
public static LexiconEntry findEntry(String name)
{
List<LexiconEntry> entries=BotaniaAPI.getAllEntries();
for(int i=0;i<entries.size();i++)
{
if(entries.get(i).getUnlocalizedName().equalsIgnoreCase(name))
return entries.get(i);
}
return null;
}
public static KnowledgeType findKnowledgeType(String name)
{
if(BotaniaAPI.knowledgeTypes.containsKey(name))
return BotaniaAPI.knowledgeTypes.get(name);
return null;
}
}

View file

@ -1,26 +0,0 @@
package modtweaker2.mods.botania.commands;
import java.util.Set;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import vazkii.botania.api.BotaniaAPI;
public class BotaniaBrewLogger implements ICommandFunction{
@Override
public void execute(String[] arguments, IPlayer player) {
Set<String> brew_keys=BotaniaAPI.brewMap.keySet();
System.out.println("Brews: " + brew_keys.size());
for (String key : brew_keys) {
System.out.println("Brew " + key);
MineTweakerAPI.logCommand(key);
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}

View file

@ -1,104 +0,0 @@
package modtweaker2.mods.botania.commands;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import modtweaker2.helpers.LogHelper;
import modtweaker2.helpers.StringHelper;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.api.recipe.RecipeElvenTrade;
import vazkii.botania.api.recipe.RecipeManaInfusion;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.api.recipe.RecipePureDaisy;
import vazkii.botania.api.recipe.RecipeRuneAltar;
public class BotaniaLogger implements ICommandFunction {
private static final List<String> validArguments = new LinkedList<String>();
static {
validArguments.add("Apothecary");
validArguments.add("Brew");
validArguments.add("ElvenTrade");
validArguments.add("ManaInfusion");
validArguments.add("PureDaisy");
validArguments.add("RuneAltar");
}
@Override
public void execute(String[] arguments, IPlayer player) {
List<String> args = StringHelper.toLowerCase(Arrays.asList(arguments));
if(!validArguments.containsAll(args)) {
if(player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("Invalid arguments for command. Valid arguments: " + StringHelper.join(validArguments, ", ")));
}
} else {
if(args.isEmpty() || args.contains("Apothecary")) {
for(RecipePetals recipe : BotaniaAPI.petalRecipes) {
MineTweakerAPI.logCommand(String.format("mods.botania.Apothecary.addRecipe(%s, %s);",
LogHelper.getStackDescription(recipe.getOutput()),
LogHelper.getListDescription(recipe.getInputs()) // Need to resolve "petalXXX" to an item
));
}
}
if(args.isEmpty() || args.contains("Brew")) {
for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
MineTweakerAPI.logCommand(String.format("mods.botania.Brew.addRecipe(%s, \"%s\");",
LogHelper.getListDescription(recipe.getInputs()),
recipe.getBrew().getKey()));
}
}
if(args.isEmpty() || args.contains("ElvenTrade")) {
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
MineTweakerAPI.logCommand(String.format("mods.botania.ElvenTrade.addRecipe(%s, %s);",
LogHelper.getStackDescription(recipe.getOutput()),
LogHelper.getListDescription(recipe.getInputs()
)));
}
}
if(args.isEmpty() || args.contains("ManaInfusion")) {
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
MineTweakerAPI.logCommand(String.format("mods.botania.ManaInfusion.add%s(%s, %s, %d);",
recipe.isAlchemy() ? "Alchemy" : recipe.isConjuration() ? "Conjuration" : "Infusion",
LogHelper.getStackDescription(recipe.getOutput()),
LogHelper.getStackDescription(recipe.getInput()),
recipe.getManaToConsume()
));
}
}
if(args.isEmpty() || args.contains("PureDaisy")) {
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
MineTweakerAPI.logCommand(String.format("mods.botania.PureDaisy.addRecipe(%s, %s);",
LogHelper.getStackDescription(recipe.getInput()),
LogHelper.getStackDescription(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta()))));
}
}
if(args.isEmpty() || args.contains("RuneAltar")) {
for(RecipeRuneAltar recipe : BotaniaAPI.runeAltarRecipes) {
MineTweakerAPI.logCommand(String.format("mods.botania.RuneAltar.addRecipe(%s, %s, %d);",
LogHelper.getStackDescription(recipe.getOutput()),
LogHelper.getListDescription(recipe.getInputs()),
recipe.getManaUsage()
));
}
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}
}

View file

@ -1,27 +0,0 @@
package modtweaker2.mods.botania.commands;
import java.util.Set;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import vazkii.botania.api.BotaniaAPI;
public class BotaniaOrechidLogger implements ICommandFunction {
@Override
public void execute(String[] arguments, IPlayer player) {
Set<String> keys = BotaniaAPI.oreWeights.keySet();
System.out.println("Orechid Keys: " + keys.size());
for (String str : BotaniaAPI.oreWeights.keySet()) {
System.out.println("Orechid Key: " + str);
MineTweakerAPI.logCommand(str + ": " + BotaniaAPI.oreWeights.get(str) + "\n");
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}

View file

@ -1,88 +0,0 @@
package modtweaker2.mods.botania.handlers;
import static modtweaker2.helpers.InputHelper.toIItemStack;
import static modtweaker2.helpers.InputHelper.toObjects;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.matches;
import java.util.LinkedList;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
@ZenClass("mods.botania.Apothecary")
public class Apothecary {
protected static final String name = "Botania Petal";
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void addRecipe(IItemStack output, IIngredient[] input) {
MineTweakerAPI.apply(new Add(new RecipePetals(toStack(output), toObjects(input))));
}
@ZenMethod
public static void addRecipe(String output, IIngredient[] input) {
addRecipe(toIItemStack(ItemBlockSpecialFlower.ofType(output)), input);
}
private static class Add extends BaseListAddition<RecipePetals> {
public Add(RecipePetals recipe) {
super("Botania Petal", BotaniaAPI.petalRecipes);
recipes.add(recipe);
}
@Override
public String getRecipeInfo(RecipePetals recipe) {
return LogHelper.getStackDescription(recipe.getOutput());
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IIngredient output) {
// Get list of existing recipes, matching with parameter
LinkedList<RecipePetals> result = new LinkedList<RecipePetals>();
for(RecipePetals entry : BotaniaAPI.petalRecipes) {
if(entry != null && entry.getOutput() != null && matches(output, toIItemStack(entry.getOutput()))) {
result.add(entry);
}
}
// Check if we found the recipes and apply the action
if(!result.isEmpty()) {
MineTweakerAPI.apply(new Remove(result));
} else {
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Apothecary.name, output.toString()));
}
}
@ZenMethod
public static void removeRecipe(String output) {
removeRecipe(toIItemStack(ItemBlockSpecialFlower.ofType(output)));
}
private static class Remove extends BaseListRemoval<RecipePetals> {
public Remove(List<RecipePetals> recipes) {
super(Apothecary.name, BotaniaAPI.petalRecipes, recipes);
}
@Override
public String getRecipeInfo(RecipePetals recipe) {
return LogHelper.getStackDescription(recipe.getOutput());
}
}
}

View file

@ -1,88 +0,0 @@
package modtweaker2.mods.botania.handlers;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import modtweaker2.helpers.InputHelper;
import modtweaker2.helpers.LogHelper;
import modtweaker2.helpers.StringHelper;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipeBrew;
@ZenClass("mods.botania.Brew")
public class Brew {
public static final String name = "Botania Brew";
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void addRecipe(IIngredient[] inputItems, String brewName) {
if(inputItems == null || inputItems.length == 0 || brewName == null || brewName.length() == 0) {
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
return;
}
if(!BotaniaAPI.brewMap.containsKey(brewName)) {
LogHelper.logError(String.format("Unknown brew name \"%s\" for %s recipe.", brewName, name));
}
RecipeBrew recipe = new RecipeBrew(BotaniaAPI.brewMap.get(brewName), InputHelper.toObjects(inputItems));
MineTweakerAPI.apply(new Add(recipe));
}
private static class Add extends BaseListAddition<RecipeBrew> {
protected Add(RecipeBrew recipe) {
super(Brew.name, BotaniaAPI.brewRecipes);
recipes.add(recipe);
}
@Override
protected String getRecipeInfo(RecipeBrew recipe) {
return recipe.getBrew().getKey();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(String brewName) {
List<RecipeBrew> recipes = new LinkedList<RecipeBrew>();
Matcher matcher = Pattern.compile(StringHelper.wildcardToRegex(brewName)).matcher("");
for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
matcher.reset(recipe.getBrew().getKey());
if(matcher.matches()) {
recipes.add(recipe);
}
}
if(!recipes.isEmpty()) {
MineTweakerAPI.apply(new Remove(recipes));
} else {
LogHelper.logWarning(String.format("No %s recipe found for %s. Command ignored!", name, brewName));
}
}
public static class Remove extends BaseListRemoval<RecipeBrew> {
protected Remove(List<RecipeBrew> recipes) {
super(Brew.name, BotaniaAPI.brewRecipes, recipes);
}
@Override
protected String getRecipeInfo(RecipeBrew recipe) {
return recipe.getBrew().getKey();
}
}
}

View file

@ -1,77 +0,0 @@
package modtweaker2.mods.botania.handlers;
import static modtweaker2.helpers.InputHelper.toIItemStack;
import static modtweaker2.helpers.InputHelper.toObjects;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.matches;
import java.util.LinkedList;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipeElvenTrade;
@ZenClass("mods.botania.ElvenTrade")
public class ElvenTrade {
protected static final String name = "Botania Eleven Trade";
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void addRecipe(IItemStack output, IIngredient[] input) {
MineTweakerAPI.apply(new Add(new RecipeElvenTrade(toStack(output), toObjects(input))));
}
private static class Add extends BaseListAddition<RecipeElvenTrade> {
public Add(RecipeElvenTrade recipe) {
super(ElvenTrade.name, BotaniaAPI.elvenTradeRecipes);
recipes.add(recipe);
}
@Override
public String getRecipeInfo(RecipeElvenTrade recipe) {
return LogHelper.getStackDescription(recipe.getOutput());
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IIngredient output) {
// Get list of existing recipes, matching with parameter
LinkedList<RecipeElvenTrade> recipes = new LinkedList<RecipeElvenTrade>();
for(RecipeElvenTrade entry : BotaniaAPI.elvenTradeRecipes) {
if(entry != null && entry.getOutput() != null && matches(output, toIItemStack(entry.getOutput()))) {
recipes.add(entry);
}
}
// Check if we found the recipes and apply the action
if(!recipes.isEmpty()) {
MineTweakerAPI.apply(new Remove(recipes));
} else {
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ElvenTrade.name, output.toString()));
}
}
private static class Remove extends BaseListRemoval<RecipeElvenTrade> {
public Remove(List<RecipeElvenTrade> recipes) {
super(ElvenTrade.name, BotaniaAPI.elvenTradeRecipes, recipes);
}
@Override
public String getRecipeInfo(RecipeElvenTrade recipe) {
return LogHelper.getStackDescription(recipe.getOutput());
}
}
}

View file

@ -1,472 +0,0 @@
package modtweaker2.mods.botania.handlers;
import static modtweaker2.helpers.InputHelper.toObject;
import static modtweaker2.helpers.InputHelper.toObjects;
import static modtweaker2.helpers.InputHelper.toStack;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.init.Blocks;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import minetweaker.api.recipes.ShapedRecipe;
import minetweaker.mc1710.recipes.RecipeConverter;
import modtweaker2.mods.botania.BotaniaHelper;
import modtweaker2.mods.botania.lexicon.AddCategory;
import modtweaker2.mods.botania.lexicon.AddEntry;
import modtweaker2.mods.botania.lexicon.AddPage;
import modtweaker2.mods.botania.lexicon.AddRecipeMapping;
import modtweaker2.mods.botania.lexicon.RemoveCategory;
import modtweaker2.mods.botania.lexicon.RemoveEntry;
import modtweaker2.mods.botania.lexicon.RemovePage;
import modtweaker2.mods.botania.lexicon.RemoveRecipeMapping;
import modtweaker2.mods.botania.lexicon.SetCategoryIcon;
import modtweaker2.mods.botania.lexicon.SetCategoryPriority;
import modtweaker2.mods.botania.lexicon.SetEntryKnowledgeType;
import net.minecraft.entity.EntityList;
import net.minecraft.item.crafting.IRecipe;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.KnowledgeType;
import vazkii.botania.api.lexicon.LexiconCategory;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconPage;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.api.recipe.RecipeElvenTrade;
import vazkii.botania.api.recipe.RecipeManaInfusion;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.api.recipe.RecipeRuneAltar;
import vazkii.botania.common.lexicon.page.PageBrew;
import vazkii.botania.common.lexicon.page.PageCraftingRecipe;
import vazkii.botania.common.lexicon.page.PageElvenRecipe;
import vazkii.botania.common.lexicon.page.PageEntity;
import vazkii.botania.common.lexicon.page.PageImage;
import vazkii.botania.common.lexicon.page.PageLoreText;
import vazkii.botania.common.lexicon.page.PageManaInfusionRecipe;
import vazkii.botania.common.lexicon.page.PagePetalRecipe;
import vazkii.botania.common.lexicon.page.PageRuneRecipe;
import vazkii.botania.common.lexicon.page.PageText;
@ZenClass("mods.botania.Lexicon")
public class Lexicon {
@ZenMethod
public static void addBrewPage(String name, String entry, int page_number, String brew, IIngredient[] recipe, String bottomText) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(BotaniaAPI.getBrewFromKey(brew)==null)
{
MineTweakerAPI.getLogger().logError("Cannot find brew "+brew);
return;
}
RecipeBrew page_recipe=new RecipeBrew(BotaniaAPI.getBrewFromKey(brew),toObjects(recipe));
LexiconPage page=new PageBrew(page_recipe,name,bottomText);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addCraftingPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[][][] inputs) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(outputs.length!=inputs.length)
{
MineTweakerAPI.getLogger().logError("Length of input and output must match");
return;
}
List<IRecipe> recipes=new ArrayList<IRecipe>();
for(int i=0;i<outputs.length;i++)
{
recipes.add(RecipeConverter.convert(new ShapedRecipe(outputs[i],inputs[i],null,false)));
}
LexiconPage page=new PageCraftingRecipe(name, recipes);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addElvenPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[][] inputs) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(outputs.length!=inputs.length)
{
MineTweakerAPI.getLogger().logError("Length of input and output must match");
return;
}
List<RecipeElvenTrade> recipes=new ArrayList<RecipeElvenTrade>();
for(int i=0;i<outputs.length;i++)
{
recipes.add(new RecipeElvenTrade(toStack(outputs[i]),toObjects(inputs[i])));
}
LexiconPage page=new PageElvenRecipe(name,recipes);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addEntityPage(String name, String entry, int page_number, String entity, int size) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(!EntityList.stringToClassMapping.containsKey(entity))
{
MineTweakerAPI.getLogger().logError("No such entity "+entity);
return;
}
LexiconPage page=new PageEntity(entity, entity, size);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addImagePage(String name, String entry, int page_number, String resource) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
LexiconPage page=new PageImage(name, resource);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addLorePage(String name, String entry, int page_number) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
LexiconPage page=new PageLoreText(name);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addInfusionPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[] inputs, int[] mana) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(outputs.length!=inputs.length || outputs.length!=mana.length)
{
MineTweakerAPI.getLogger().logError("Length of input and output must match");
return;
}
List<RecipeManaInfusion> recipes=new ArrayList<RecipeManaInfusion>();
for(int i=0;i<outputs.length;i++)
{
recipes.add(new RecipeManaInfusion(toStack(outputs[i]),toObject(inputs[i]),mana[i]));
}
LexiconPage page=new PageManaInfusionRecipe(name,recipes);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addAlchemyPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[] inputs, int[] mana) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(outputs.length!=inputs.length || outputs.length!=mana.length)
{
MineTweakerAPI.getLogger().logError("Length of input and output must match");
return;
}
List<RecipeManaInfusion> recipes=new ArrayList<RecipeManaInfusion>();
for(int i=0;i<outputs.length;i++)
{
RecipeManaInfusion current_recipe=new RecipeManaInfusion(toStack(outputs[i]),toObject(inputs[i]),mana[i]);
current_recipe.setAlchemy(true);
recipes.add(current_recipe);
}
LexiconPage page=new PageManaInfusionRecipe(name,recipes);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addConjurationPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[] inputs, int[] mana) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(outputs.length!=inputs.length || outputs.length!=mana.length)
{
MineTweakerAPI.getLogger().logError("Length of input and output must match");
return;
}
List<RecipeManaInfusion> recipes=new ArrayList<RecipeManaInfusion>();
for(int i=0;i<outputs.length;i++)
{
RecipeManaInfusion current_recipe=new RecipeManaInfusion(toStack(outputs[i]),toObject(inputs[i]),mana[i]);
current_recipe.setConjuration(true);
recipes.add(current_recipe);
}
LexiconPage page=new PageManaInfusionRecipe(name,recipes);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addPetalPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[][] inputs) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(outputs.length!=inputs.length)
{
MineTweakerAPI.getLogger().logError("Length of input and output must match");
return;
}
List<RecipePetals> recipes=new ArrayList<RecipePetals>();
for(int i=0;i<outputs.length;i++)
{
recipes.add(new RecipePetals(toStack(outputs[i]),toObjects(inputs[i])));
}
LexiconPage page=new PagePetalRecipe(name,recipes);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addRunePage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[][] inputs, int[] mana) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
if(outputs.length!=inputs.length || outputs.length!=mana.length)
{
MineTweakerAPI.getLogger().logError("Length of input and output must match");
return;
}
List<RecipeRuneAltar> recipes=new ArrayList<RecipeRuneAltar>();
for(int i=0;i<outputs.length;i++)
{
recipes.add(new RecipeRuneAltar(toStack(outputs[i]),mana[i],toObjects(inputs[i])));
}
LexiconPage page=new PageRuneRecipe(name,recipes);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void addTextPage(String name, String entry, int page_number) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
LexiconPage page=new PageText(name);
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
}
@ZenMethod
public static void removePage(String entry, int page_number) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(page_number>=lexiconEntry.pages.size())
{
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
return;
}
MineTweakerAPI.apply(new RemovePage(lexiconEntry,page_number));
}
@ZenMethod
public static void addEntry(String entry, String catagory, IItemStack stack) {
LexiconCategory lexiconCategory=BotaniaHelper.findCatagory(catagory);
if(lexiconCategory==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon category "+catagory);
return;
}
LexiconEntry lexiconEntry=new LexiconEntry(entry,lexiconCategory);
lexiconEntry.setIcon(toStack(stack));
MineTweakerAPI.apply(new AddEntry(lexiconEntry));
}
@ZenMethod
public static void removeEntry(String entry) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
MineTweakerAPI.apply(new RemoveEntry(lexiconEntry));
}
@ZenMethod
public static void setEntryKnowledgeType(String entry, String knowledgeType) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
KnowledgeType type=BotaniaHelper.findKnowledgeType(knowledgeType);
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
return;
}
if(type==null)
{
MineTweakerAPI.getLogger().logError("Cannot find knowledge type "+knowledgeType);
return;
}
MineTweakerAPI.apply(new SetEntryKnowledgeType(lexiconEntry,type));
}
@ZenMethod
public static void addCategory(String name) {
LexiconCategory lexiconCategory=new LexiconCategory(name);
MineTweakerAPI.apply(new AddCategory(lexiconCategory));
}
@ZenMethod
public static void removeCategory(String name) {
LexiconCategory lexiconCategory=BotaniaHelper.findCatagory(name);
if(lexiconCategory==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon category "+name);
return;
}
MineTweakerAPI.apply(new RemoveCategory(lexiconCategory));
}
@ZenMethod
public static void setCategoryPriority(String name, int priority) {
LexiconCategory lexiconCategory=BotaniaHelper.findCatagory(name);
if(lexiconCategory==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon category "+name);
return;
}
MineTweakerAPI.apply(new SetCategoryPriority(lexiconCategory,priority));
}
@ZenMethod
public static void setCategoryIcon(String name, String icon) {
LexiconCategory lexiconCategory=BotaniaHelper.findCatagory(name);
if(lexiconCategory==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon category "+name);
return;
}
MineTweakerAPI.apply(new SetCategoryIcon(lexiconCategory,icon));
}
@ZenMethod
public static void addRecipeMapping(IItemStack stack, String Entry, int page) {
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(Entry);
if(LexiconRecipeMappings.getDataForStack(toStack(stack))!=null)
{
MineTweakerAPI.getLogger().logError("There is already a recipe mapping for "+stack);
return;
}
if(lexiconEntry==null)
{
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+Entry);
return;
}
if(lexiconEntry.pages.size()<page)
{
MineTweakerAPI.getLogger().logError("Not enough pages in "+Entry);
return;
}
MineTweakerAPI.apply(new AddRecipeMapping(toStack(stack),lexiconEntry,page));
}
@ZenMethod
public static void removeRecipeMapping(IItemStack stack) {
if(LexiconRecipeMappings.getDataForStack(toStack(stack))==null)
{
MineTweakerAPI.getLogger().logError("There isn't a recipe mapping for "+stack);
return;
}
MineTweakerAPI.apply(new RemoveRecipeMapping(toStack(stack)));
}
}

View file

@ -1,90 +0,0 @@
package modtweaker2.mods.botania.handlers;
import static modtweaker2.helpers.InputHelper.toIItemStack;
import static modtweaker2.helpers.InputHelper.toObject;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.matches;
import java.util.LinkedList;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipeManaInfusion;
@ZenClass("mods.botania.ManaInfusion")
public class ManaInfusion {
protected static final String name = "Botania Mana Infusion";
@ZenMethod
public static void addInfusion(IItemStack output, IIngredient input, int mana) {
MineTweakerAPI.apply(new Add(new RecipeManaInfusion(toStack(output), toObject(input), mana)));
}
@ZenMethod
public static void addAlchemy(IItemStack output, IIngredient input, int mana) {
RecipeManaInfusion recipe = new RecipeManaInfusion(toStack(output), toObject(input), mana);
recipe.setAlchemy(true);
MineTweakerAPI.apply(new Add(recipe));
}
@ZenMethod
public static void addConjuration(IItemStack output, IIngredient input, int mana) {
RecipeManaInfusion recipe = new RecipeManaInfusion(toStack(output), toObject(input), mana);
recipe.setConjuration(true);
MineTweakerAPI.apply(new Add(recipe));
}
private static class Add extends BaseListAddition<RecipeManaInfusion> {
public Add(RecipeManaInfusion recipe) {
super(ManaInfusion.name, BotaniaAPI.manaInfusionRecipes);
recipes.add(recipe);
}
@Override
public String getRecipeInfo(RecipeManaInfusion recipe) {
return LogHelper.getStackDescription(recipe.getOutput());
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IIngredient output) {
// Get list of existing recipes, matching with parameter
List<RecipeManaInfusion> recipes = new LinkedList<RecipeManaInfusion>();
for (RecipeManaInfusion r : BotaniaAPI.manaInfusionRecipes) {
if (r.getOutput() != null && matches(output, toIItemStack(r.getOutput()))) {
recipes.add(r);
}
}
// Check if we found the recipes and apply the action
if(!recipes.isEmpty()) {
MineTweakerAPI.apply(new Remove(recipes));
} else {
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ManaInfusion.name, output.toString()));
}
}
private static class Remove extends BaseListRemoval<RecipeManaInfusion> {
public Remove(List<RecipeManaInfusion> recipes) {
super(ManaInfusion.name, BotaniaAPI.manaInfusionRecipes, recipes);
}
@Override
public String getRecipeInfo(RecipeManaInfusion recipe) {
return LogHelper.getStackDescription(recipe.getOutput());
}
}
}

View file

@ -1,113 +0,0 @@
package modtweaker2.mods.botania.handlers;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.oredict.IOreDictEntry;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
@ZenClass("mods.botania.Orechid")
public class Orechid {
@ZenMethod
public static void addOre(IOreDictEntry oreDict, int weight) {
MineTweakerAPI.apply(new Add(oreDict.getName(), weight));
}
@ZenMethod
public static void addOre(String oreDict, int weight) {
MineTweakerAPI.apply(new Add(oreDict, weight));
}
private static class Add implements IUndoableAction {
String oreDict;
int weight;
public Add(String ore, int prop) {
oreDict = ore;
weight = prop;
}
@Override
public void apply() {
BotaniaAPI.addOreWeight(oreDict, weight);
}
@Override
public String describe() {
return "Adding Orechid Ore Weight: " + oreDict + ":" + weight;
}
@Override
public boolean canUndo() {
return oreDict != null;
}
@Override
public void undo() {
BotaniaAPI.oreWeights.remove(oreDict);
}
@Override
public String describeUndo() {
return "Removing Orechid Ore: " + oreDict;
}
@Override
public String getOverrideKey() {
return null;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeOre(IOreDictEntry oreDict) {
MineTweakerAPI.apply(new Remove(oreDict.getName()));
}
@ZenMethod
public static void removeOre(String oreDict) {
MineTweakerAPI.apply(new Remove(oreDict));
}
private static class Remove implements IUndoableAction {
String oreDict;
int weight;
public Remove(String ore) {
oreDict = ore;
}
@Override
public void apply() {
weight = BotaniaAPI.getOreWeight(oreDict);
BotaniaAPI.oreWeights.remove(oreDict);
}
@Override
public String describe() {
return "Removing Orechid Ore: " + oreDict;
}
@Override
public boolean canUndo() {
return weight > 0;
}
@Override
public void undo() {
BotaniaAPI.addOreWeight(oreDict, weight);
}
@Override
public String describeUndo() {
return "Restoring Orechid Ore Weight: " + oreDict + ":" + weight;
}
@Override
public String getOverrideKey() {
return null;
}
}
}

View file

@ -1,93 +0,0 @@
package modtweaker2.mods.botania.handlers;
import java.util.LinkedList;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.InputHelper;
import modtweaker2.helpers.LogHelper;
import modtweaker2.helpers.StackHelper;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipePureDaisy;
@ZenClass("mods.botania.PureDaisy")
public class PureDaisy {
public static final String name = "Botania PureDaisy";
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void addRecipe(IIngredient blockInput, IItemStack blockOutput) {
if(blockInput == null || blockOutput == null) {
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
return;
}
Object input = InputHelper.toObject(blockInput);
if(input == null || (input instanceof ItemStack && !InputHelper.isABlock((ItemStack)input))) {
LogHelper.logError(String.format("Input must be a block or an oredict entry."));
return;
}
if(input instanceof ItemStack) input = Block.getBlockFromItem(((ItemStack)input).getItem());
ItemStack output = InputHelper.toStack(blockOutput);
RecipePureDaisy recipe = new RecipePureDaisy(input, Block.getBlockFromItem(output.getItem()), output.getItemDamage());
MineTweakerAPI.apply(new Add(recipe));
}
private static class Add extends BaseListAddition<RecipePureDaisy> {
public Add(RecipePureDaisy recipe) {
super(PureDaisy.name, BotaniaAPI.pureDaisyRecipes);
recipes.add(recipe);
}
@Override
protected String getRecipeInfo(RecipePureDaisy recipe) {
return LogHelper.getStackDescription(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta()));
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IIngredient output) {
List<RecipePureDaisy> recipes = new LinkedList<RecipePureDaisy>();
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
IItemStack out = InputHelper.toIItemStack(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta()));
if(StackHelper.matches(output, out)) {
recipes.add(recipe);
}
}
if(!recipes.isEmpty()) {
MineTweakerAPI.apply(new Remove(recipes));
} else {
}
}
private static class Remove extends BaseListRemoval<RecipePureDaisy> {
public Remove(List<RecipePureDaisy> recipes) {
super(PureDaisy.name, BotaniaAPI.pureDaisyRecipes, recipes);
}
@Override
protected String getRecipeInfo(RecipePureDaisy recipe) {
return LogHelper.getStackDescription(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta()));
}
}
}

View file

@ -1,78 +0,0 @@
package modtweaker2.mods.botania.handlers;
import static modtweaker2.helpers.InputHelper.toIItemStack;
import static modtweaker2.helpers.InputHelper.toObjects;
import static modtweaker2.helpers.InputHelper.toStack;
import static modtweaker2.helpers.StackHelper.matches;
import java.util.LinkedList;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.utils.BaseListAddition;
import modtweaker2.utils.BaseListRemoval;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipeRuneAltar;
@ZenClass("mods.botania.RuneAltar")
public class RuneAltar {
protected static final String name = "Botania Rune Altar";
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void addRecipe(IItemStack output, IIngredient[] input, int mana) {
MineTweakerAPI.apply(new Add(new RecipeRuneAltar(toStack(output), mana, toObjects(input))));
}
private static class Add extends BaseListAddition<RecipeRuneAltar> {
public Add(RecipeRuneAltar recipe) {
super(RuneAltar.name, BotaniaAPI.runeAltarRecipes);
recipes.add(recipe);
}
@Override
public String getRecipeInfo(RecipeRuneAltar recipe) {
return LogHelper.getStackDescription(recipe.getOutput());
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IIngredient output) {
// Get list of existing recipes, matching with parameter
List<RecipeRuneAltar> recipes = new LinkedList<RecipeRuneAltar>();
for (RecipeRuneAltar r : BotaniaAPI.runeAltarRecipes) {
if (r != null && r.getOutput() != null && matches(output, toIItemStack(r.getOutput()))) {
recipes.add(r);
}
}
// Check if we found the recipes and apply the action
if(!recipes.isEmpty()) {
MineTweakerAPI.apply(new Remove(recipes));
} else {
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ElvenTrade.name, output.toString()));
}
}
private static class Remove extends BaseListRemoval<RecipeRuneAltar> {
public Remove(List<RecipeRuneAltar> recipes) {
super(RuneAltar.name, BotaniaAPI.runeAltarRecipes, recipes);
}
@Override
public String getRecipeInfo(RecipeRuneAltar recipe) {
return LogHelper.getStackDescription(recipe.getOutput());
}
}
}

View file

@ -1,44 +0,0 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconCategory;
public class AddCategory implements IUndoableAction {
LexiconCategory category;
public AddCategory(LexiconCategory category) {
this.category=category;
}
@Override
public void apply() {
BotaniaAPI.addCategory(category);
}
@Override
public boolean canUndo() {
return category != null;
}
@Override
public String describe() {
return "Adding Lexicon Category: " + category.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Removing Lexicon Category: " + category.getUnlocalizedName();
}
@Override
public void undo() {
BotaniaAPI.getAllCategories().remove(category);
}
@Override
public Object getOverrideKey() {
return null;
}
}

View file

@ -1,45 +0,0 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconEntry;
public class AddEntry implements IUndoableAction {
LexiconEntry Entry;
public AddEntry(LexiconEntry Entry) {
this.Entry=Entry;
}
@Override
public void apply() {
BotaniaAPI.addEntry(Entry, Entry.category);
}
@Override
public boolean canUndo() {
return Entry != null;
}
@Override
public String describe() {
return "Adding Lexicon Entry: " + Entry.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Removing Lexicon Entry: " + Entry.getUnlocalizedName();
}
@Override
public void undo() {
Entry.category.entries.remove(Entry);
BotaniaAPI.getAllEntries().remove(Entry);
}
@Override
public Object getOverrideKey() {
return null;
}
}

View file

@ -1,50 +0,0 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconPage;
public class AddPage implements IUndoableAction {
String Name;
int page_number;
LexiconEntry Entry;
LexiconPage page;
public AddPage(String Name, LexiconEntry Entry, LexiconPage page, int page_number) {
this.Name=Name;
this.Entry=Entry;
this.page=page;
this.page_number=page_number;
}
@Override
public void apply() {
Entry.pages.add(page_number, page);
}
@Override
public boolean canUndo() {
return Name != null && Entry != null && page != null;
}
@Override
public String describe() {
return "Adding Lexicon Page: " + Name;
}
@Override
public String describeUndo() {
return "Removing Lexicon Page: " + Name;
}
@Override
public void undo() {
Entry.pages.remove(page_number);
}
@Override
public Object getOverrideKey() {
return null;
}
}

View file

@ -1,49 +0,0 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
public class AddRecipeMapping implements IUndoableAction {
ItemStack stack;
LexiconEntry entry;
int page;
public AddRecipeMapping(ItemStack stack, LexiconEntry entry, int page) {
this.stack =stack;
this.entry=entry;
this.page=page;
}
@Override
public void apply() {
LexiconRecipeMappings.map(stack, entry, page);
}
@Override
public boolean canUndo() {
return true;
}
@Override
public String describe() {
return "Adding Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Removing Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
}
@Override
public void undo() {
LexiconRecipeMappings.remove(stack);
}
@Override
public Object getOverrideKey() {
return null;
}
}

View file

@ -1,44 +0,0 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconCategory;
public class RemoveCategory implements IUndoableAction {
LexiconCategory category;
public RemoveCategory(LexiconCategory category) {
this.category=category;
}
@Override
public void apply() {
BotaniaAPI.getAllCategories().remove(category);
}
@Override
public boolean canUndo() {
return category != null;
}
@Override
public String describe() {
return "Removing Lexicon Category: " + category.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Adding Lexicon Category: " + category.getUnlocalizedName();
}
@Override
public void undo() {
BotaniaAPI.addCategory(category);
}
@Override
public Object getOverrideKey() {
return null;
}
}

View file

@ -1,45 +0,0 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconEntry;
public class RemoveEntry implements IUndoableAction {
LexiconEntry Entry;
public RemoveEntry(LexiconEntry Entry) {
this.Entry=Entry;
}
@Override
public void apply() {
Entry.category.entries.remove(Entry);
BotaniaAPI.getAllEntries().remove(Entry);
}
@Override
public boolean canUndo() {
return Entry != null;
}
@Override
public String describe() {
return "Removing Lexicon Entry: " + Entry.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Adding Lexicon Entry: " + Entry.getUnlocalizedName();
}
@Override
public void undo() {
BotaniaAPI.addEntry(Entry, Entry.category);
}
@Override
public Object getOverrideKey() {
return null;
}
}

View file

@ -1,48 +0,0 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconPage;
public class RemovePage implements IUndoableAction {
int page_number;
LexiconEntry Entry;
LexiconPage page;
public RemovePage(LexiconEntry Entry, int page_number) {
this.Entry=Entry;
this.page_number=page_number;
}
@Override
public void apply() {
this.page=Entry.pages.get(page_number);
Entry.pages.remove(page);
}
@Override
public boolean canUndo() {
return Entry != null && page != null;
}
@Override
public String describe() {
return "Removing Lexicon Page: " + Entry.pages.get(page_number).getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Adding Lexicon Page: " + page.getUnlocalizedName();
}
@Override
public void undo() {
Entry.pages.add(page_number,page);
}
@Override
public Object getOverrideKey() {
return null;
}
}

View file

@ -1,51 +0,0 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
import vazkii.botania.api.lexicon.LexiconRecipeMappings.EntryData;
public class RemoveRecipeMapping implements IUndoableAction {
ItemStack stack;
LexiconEntry entry;
int page;
public RemoveRecipeMapping(ItemStack stack) {
this.stack =stack;
}
@Override
public void apply() {
EntryData data=LexiconRecipeMappings.getDataForStack(stack);
this.entry=data.entry;
this.page=data.page;
LexiconRecipeMappings.remove(stack);
}
@Override
public boolean canUndo() {
return true;
}
@Override
public String describe() {
return "Removing Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Adding Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
}
@Override
public void undo() {
LexiconRecipeMappings.map(stack,entry,page);
}
@Override
public Object getOverrideKey() {
return null;
}
}

View file

@ -1,48 +0,0 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.api.lexicon.LexiconCategory;
public class SetCategoryIcon implements IUndoableAction {
LexiconCategory category;
ResourceLocation oldIcon;
ResourceLocation newIcon;
public SetCategoryIcon(LexiconCategory category, String icon) {
this.category=category;
this.newIcon=new ResourceLocation(icon);
}
@Override
public void apply() {
oldIcon=category.getIcon();
category.setIcon(newIcon);
}
@Override
public boolean canUndo() {
return category != null;
}
@Override
public String describe() {
return "Setting Lexicon Category priority: " + category.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Unsetting Lexicon Category priority: " + category.getUnlocalizedName();
}
@Override
public void undo() {
category.setIcon(oldIcon);
}
@Override
public Object getOverrideKey() {
return null;
}
}

View file

@ -1,47 +0,0 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.lexicon.LexiconCategory;
public class SetCategoryPriority implements IUndoableAction {
LexiconCategory category;
int oldPriority;
int newPriority;
public SetCategoryPriority(LexiconCategory category, int priority) {
this.category=category;
this.newPriority=priority;
}
@Override
public void apply() {
oldPriority=category.getSortingPriority();
category.setPriority(newPriority);
}
@Override
public boolean canUndo() {
return category != null;
}
@Override
public String describe() {
return "Setting Lexicon Category priority: " + category.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Unsetting Lexicon Category priority: " + category.getUnlocalizedName();
}
@Override
public void undo() {
category.setPriority(oldPriority);
}
@Override
public Object getOverrideKey() {
return null;
}
}

View file

@ -1,48 +0,0 @@
package modtweaker2.mods.botania.lexicon;
import minetweaker.IUndoableAction;
import vazkii.botania.api.lexicon.KnowledgeType;
import vazkii.botania.api.lexicon.LexiconEntry;
public class SetEntryKnowledgeType implements IUndoableAction {
LexiconEntry Entry;
KnowledgeType newType;
KnowledgeType oldType;
public SetEntryKnowledgeType(LexiconEntry Entry, KnowledgeType type) {
this.Entry=Entry;
this.newType=type;
}
@Override
public void apply() {
oldType=Entry.getKnowledgeType();
Entry.setKnowledgeType(newType);
}
@Override
public boolean canUndo() {
return Entry != null && oldType != null;
}
@Override
public String describe() {
return "Setting Knowledge type for: " + Entry.getUnlocalizedName();
}
@Override
public String describeUndo() {
return "Unsetting Knowledge type for: " + Entry.getUnlocalizedName();
}
@Override
public void undo() {
Entry.setKnowledgeType(oldType);
}
@Override
public Object getOverrideKey() {
return null;
}
}

View file

@ -1,27 +0,0 @@
package modtweaker2.mods.botania.lexicon.commands;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconCategory;
public class LexiconCategoryLogger implements ICommandFunction{
@Override
public void execute(String[] arguments, IPlayer player) {
List<LexiconCategory> categories=BotaniaAPI.getAllCategories();
System.out.println("Categories: " + categories.size());
for (LexiconCategory category : categories) {
System.out.println("Category " + category.getUnlocalizedName());
MineTweakerAPI.logCommand(category.getUnlocalizedName());
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}

View file

@ -1,42 +0,0 @@
package modtweaker2.mods.botania.lexicon.commands;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import modtweaker2.mods.botania.BotaniaHelper;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconCategory;
import vazkii.botania.api.lexicon.LexiconEntry;
public class LexiconEntryLogger implements ICommandFunction{
@Override
public void execute(String[] arguments, IPlayer player) {
LexiconCategory category=null;
if(arguments.length>0)
{
category=BotaniaHelper.findCatagory(arguments[0]);
if(category==null)
{
MineTweakerAPI.getLogger().logError("Category not found (" + arguments[0]+")");
return;
}
}
List<LexiconEntry> entries=BotaniaAPI.getAllEntries();
System.out.println("Entries: " + entries.size());
for (LexiconEntry entry : entries) {
if(category==null || entry.category==category)
{
System.out.println("Entry " + entry.getUnlocalizedName());
MineTweakerAPI.logCommand(entry.getUnlocalizedName());
}
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}

View file

@ -1,26 +0,0 @@
package modtweaker2.mods.botania.lexicon.commands;
import java.util.Set;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import vazkii.botania.api.BotaniaAPI;
public class LexiconKnowledgeTypesLogger implements ICommandFunction{
@Override
public void execute(String[] arguments, IPlayer player) {
Set<String> types=BotaniaAPI.knowledgeTypes.keySet();
System.out.println("Knowledge Types: " + types.size());
for (String key : types) {
System.out.println("Knowledge Type " + key);
MineTweakerAPI.logCommand(key);
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}

View file

@ -1,47 +0,0 @@
package modtweaker2.mods.botania.lexicon.commands;
import java.util.ArrayList;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import modtweaker2.mods.botania.BotaniaHelper;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconPage;
public class LexiconPageLogger implements ICommandFunction{
@Override
public void execute(String[] arguments, IPlayer player) {
LexiconEntry entry=null;
if(arguments.length>0)
{
entry=BotaniaHelper.findEntry(arguments[0]);
if(entry==null)
{
MineTweakerAPI.getLogger().logError("Entry not found (" + arguments[0]+")");
return;
}
}
List<LexiconEntry> entries;
List<LexiconPage> pages=new ArrayList();
if(entry!=null)
pages.addAll(entry.pages);
else
for (LexiconEntry current_Entry : BotaniaAPI.getAllEntries())
pages.addAll(current_Entry.pages);
System.out.println("Pages: " + pages.size());
for (LexiconPage page : pages) {
System.out.println("Page " + page.getUnlocalizedName() + " (" + page.getClass() + ")");
MineTweakerAPI.logCommand(page.getUnlocalizedName() + " (" + page.getClass() + ")");
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}

View file

@ -1,11 +0,0 @@
package modtweaker2.mods.chisel;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.chisel.handlers.Groups;
public class Chisel {
public Chisel() {
MineTweakerAPI.registerClass(Groups.class);
}
}

View file

@ -1,158 +0,0 @@
package modtweaker2.mods.chisel;
import static modtweaker2.helpers.InputHelper.toStack;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import minetweaker.api.item.IItemStack;
import net.minecraft.block.Block;
import com.cricketcraft.chisel.api.carving.CarvingUtils;
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
import com.google.common.collect.Lists;
public class ChiselHelper {
public static ICarvingGroup getGroup(String name)
{
return CarvingUtils.getChiselRegistry().getGroup(name);
}
public static ICarvingGroup getGroup(IItemStack stack)
{
return CarvingUtils.getChiselRegistry().getGroup(Block.getBlockFromItem(toStack(stack).getItem()), stack.getDamage());
}
public static ICarvingVariation getVariation(IItemStack stack)
{
ICarvingGroup g = getGroup(stack);
if (g != null) {
for (ICarvingVariation v : g.getVariations()) {
if (v.getBlock() == Block.getBlockFromItem(toStack(stack).getItem()) && v.getBlockMeta() == stack.getDamage()) {
return v;
}
}
}
return null;
}
public static ICarvingVariation makeVariation(IItemStack stack)
{
return new CarvingVariation(Block.getBlockFromItem(toStack(stack).getItem()), stack.getDamage());
}
public static ICarvingGroup makeGroup(String name)
{
return new CarvingGroup(name);
}
public static boolean groupContainsVariation(ICarvingGroup group, ICarvingVariation variation)
{
for(ICarvingVariation otherVariation : group.getVariations())
{
if(otherVariation.getBlock()==variation.getBlock() && otherVariation.getBlockMeta()==variation.getBlockMeta())
return true;
}
return false;
}
static class CarvingVariation implements ICarvingVariation
{
Block block;
int meta;
public CarvingVariation(Block block, int meta)
{
this.block=block;
this.meta=meta;
}
@Override
public Block getBlock() {
return block;
}
@Override
public int getBlockMeta() {
return meta;
}
@Override
public int getItemMeta() {
return meta;
}
@Override
public int getOrder() {
return 99;
}
}
static class CarvingGroup implements ICarvingGroup
{
private String name;
private String sound;
private String oreName;
private List<ICarvingVariation> variations = Lists.newArrayList();
public CarvingGroup(String name) {
this.name = name;
}
public List<ICarvingVariation> getVariations() {
return Lists.newArrayList(variations);
}
@Override
public void addVariation(ICarvingVariation variation) {
variations.add(variation);
Collections.sort(variations, new Comparator<ICarvingVariation>() {
@Override
public int compare(ICarvingVariation o1, ICarvingVariation o2) {
return CarvingUtils.compare(o1, o2);
}
});
}
@Override
public boolean removeVariation(ICarvingVariation variation) {
ICarvingVariation toRemove = null;
for (ICarvingVariation v : variations) {
if (v.getBlock() == variation.getBlock() && v.getBlockMeta() == variation.getBlockMeta()) {
toRemove = v;
}
}
return toRemove == null ? false : variations.remove(toRemove);
}
@Override
public String getName() {
return name;
}
@Override
public String getSound() {
return sound;
}
@Override
public void setSound(String sound) {
this.sound = sound;
}
@Override
public String getOreName() {
return oreName;
}
@Override
public void setOreName(String oreName) {
this.oreName = oreName;
}
}
}

View file

@ -1,27 +0,0 @@
package modtweaker2.mods.chisel.commands;
import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import com.cricketcraft.chisel.api.carving.CarvingUtils;
public class ChiselGroupLogger implements ICommandFunction{
@Override
public void execute(String[] arguments, IPlayer player) {
List<String> keys=CarvingUtils.getChiselRegistry().getSortedGroupNames();
System.out.println("Chisel Groups: " + keys.size());
for (String key : keys) {
System.out.println("Chisel Group " + key);
MineTweakerAPI.logCommand(key);
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}

View file

@ -1,57 +0,0 @@
package modtweaker2.mods.chisel.commands;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.player.IPlayer;
import minetweaker.api.server.ICommandFunction;
import modtweaker2.mods.chisel.ChiselHelper;
import net.minecraft.item.Item;
import com.cricketcraft.chisel.api.carving.CarvingUtils;
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
public class ChiselVariationLogger implements ICommandFunction{
@Override
public void execute(String[] arguments, IPlayer player) {
Map<ICarvingVariation, ICarvingGroup> variations=new HashMap<ICarvingVariation, ICarvingGroup>();
List<String> keys=CarvingUtils.getChiselRegistry().getSortedGroupNames();
if(arguments.length>0)
{
ICarvingGroup group=ChiselHelper.getGroup(arguments[0]);
if(group==null)
{
MineTweakerAPI.getLogger().logError("Group not found (" + arguments[0]+")");
return;
}
else
{
keys.clear();
keys.add(arguments[0]);
}
}
for (String key : keys) {
ICarvingGroup group=CarvingUtils.getChiselRegistry().getGroup(key);
for(ICarvingVariation variation : group.getVariations())
variations.put(variation, group);
}
System.out.println("Chisel Variations: " + variations.size());
for (Entry<ICarvingVariation, ICarvingGroup> entry: variations.entrySet()) {
String stringedVariation="<"+Item.itemRegistry.getNameForObject(Item.getItemFromBlock(entry.getKey().getBlock()))+":"+entry.getKey().getBlockMeta()+">";
if(arguments.length==0)
stringedVariation+=" "+entry.getValue().getName();
System.out.println("Chisel Variation " + stringedVariation);
MineTweakerAPI.logCommand(stringedVariation);
}
if (player != null) {
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
}
}
}

View file

@ -1,233 +0,0 @@
package modtweaker2.mods.chisel.handlers;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import modtweaker2.mods.chisel.ChiselHelper;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import com.cricketcraft.chisel.api.carving.CarvingUtils;
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
@ZenClass("mods.chisel.Groups")
public class Groups {
@ZenMethod
public static void addVariation(String groupName, IItemStack stack) {
ICarvingGroup group=ChiselHelper.getGroup(groupName);
ICarvingVariation variation=ChiselHelper.makeVariation(stack);
if(group==null)
{
MineTweakerAPI.getLogger().logError("Cannot find group " + groupName);
return;
}
if(variation==null)
{
MineTweakerAPI.getLogger().logError("Can't create variation from " + stack);
return;
}
MineTweakerAPI.apply(new AddVariation(group,variation, stack.toString()));
}
static class AddVariation implements IUndoableAction {
ICarvingGroup group;
ICarvingVariation variation;
String variationName;
public AddVariation(ICarvingGroup group,ICarvingVariation variation, String variationName) {
this.group=group;
this.variation=variation;
this.variationName=variationName;
}
@Override
public void apply() {
CarvingUtils.getChiselRegistry().addVariation(group.getName(),variation);
}
@Override
public boolean canUndo() {
return group != null && variation != null;
}
@Override
public String describe() {
return "Adding Variation: " + variationName;
}
@Override
public String describeUndo() {
return "Removing Variation: " + variationName;
}
@Override
public void undo() {
CarvingUtils.getChiselRegistry().removeVariation(variation.getBlock(),variation.getBlockMeta());
}
@Override
public Object getOverrideKey() {
return null;
}
}
@ZenMethod
public static void removeVariation(IItemStack stack) {
ICarvingVariation variation=ChiselHelper.getVariation(stack);
if(variation==null)
{
MineTweakerAPI.getLogger().logError("Can't find variation from " + stack);
return;
}
MineTweakerAPI.apply(new RemoveVariation(variation, stack.toString()));
}
static class RemoveVariation implements IUndoableAction {
ICarvingVariation variation;
String variationName;
ICarvingGroup group;
public RemoveVariation(ICarvingVariation variation, String variationName) {
this.variation=variation;
this.variationName=variationName;
}
@Override
public void apply() {
group=CarvingUtils.getChiselRegistry().getGroup(variation.getBlock(),variation.getBlockMeta());
CarvingUtils.getChiselRegistry().removeVariation(variation.getBlock(),variation.getBlockMeta());
}
@Override
public boolean canUndo() {
return group!= null && variation != null;
}
@Override
public String describe() {
return "Removing Variation: " + variationName;
}
@Override
public String describeUndo() {
return "Adding Variation: " + variationName;
}
@Override
public void undo() {
CarvingUtils.getChiselRegistry().addVariation(group.getName(),variation);
}
@Override
public Object getOverrideKey() {
return null;
}
}
@ZenMethod
public static void addGroup(String groupName) {
ICarvingGroup group=ChiselHelper.getGroup(groupName);
if(group!=null)
{
MineTweakerAPI.getLogger().logError("Group already exists " + groupName);
return;
}
group=ChiselHelper.makeGroup(groupName);
MineTweakerAPI.apply(new AddGroup(group));
}
static class AddGroup implements IUndoableAction {
ICarvingGroup group;
public AddGroup(ICarvingGroup group) {
this.group=group;
}
@Override
public void apply() {
CarvingUtils.getChiselRegistry().addGroup(group);
}
@Override
public boolean canUndo() {
return group != null;
}
@Override
public String describe() {
return "Adding Group: " + group.getName();
}
@Override
public String describeUndo() {
return "Removing Group: " + group.getName();
}
@Override
public void undo() {
CarvingUtils.getChiselRegistry().removeGroup(group.getName());
}
@Override
public Object getOverrideKey() {
return null;
}
}
@ZenMethod
public static void removeGroup(String groupName) {
ICarvingGroup group=ChiselHelper.getGroup(groupName);
if(group==null)
{
MineTweakerAPI.getLogger().logError("Could not find group " + groupName);
return;
}
MineTweakerAPI.apply(new RemoveGroup(group));
}
static class RemoveGroup implements IUndoableAction {
ICarvingGroup group;
public RemoveGroup(ICarvingGroup group) {
this.group=group;
}
@Override
public void apply() {
CarvingUtils.getChiselRegistry().removeGroup(group.getName());
}
@Override
public boolean canUndo() {
return group != null;
}
@Override
public String describe() {
return "Removing Group: " + group.getName();
}
@Override
public String describeUndo() {
return "Adding Group: " + group.getName();
}
@Override
public void undo() {
CarvingUtils.getChiselRegistry().addGroup(group);
}
@Override
public Object getOverrideKey() {
return null;
}
}
}

View file

@ -1,16 +0,0 @@
package modtweaker2.mods.exnihilo;
import minetweaker.MineTweakerAPI;
import modtweaker2.mods.exnihilo.handlers.Compost;
import modtweaker2.mods.exnihilo.handlers.Crucible;
import modtweaker2.mods.exnihilo.handlers.Hammer;
import modtweaker2.mods.exnihilo.handlers.Sieve;
public class ExNihilo {
public ExNihilo() {
MineTweakerAPI.registerClass(Compost.class);
MineTweakerAPI.registerClass(Crucible.class);
MineTweakerAPI.registerClass(Hammer.class);
MineTweakerAPI.registerClass(Sieve.class);
}
}

Some files were not shown because too many files have changed in this diff Show more