Compare commits
13 commits
1.8.9
...
master-MC1
Author | SHA1 | Date | |
---|---|---|---|
Timo Ley | c09e3dfe09 | ||
Timo Ley | bfb5c7d474 | ||
Timo Ley | ca09d6e5a9 | ||
Timo Ley | 49c9bdfe2c | ||
Timo Ley | 6de4ad874b | ||
44bb751d54 | |||
e74070a030 | |||
64fdb57b81 | |||
23eb3a6461 | |||
ddd78e9dbd | |||
5c520e853c | |||
be46a8343d | |||
2aa238a9eb |
25
CHANGELOG.md
25
CHANGELOG.md
|
@ -1,24 +1,39 @@
|
|||
# Change Log
|
||||
|
||||
## [0.9.6](https://github.com/jaredlll08/ModTweaker2/tree/0.9.6) (2016-07-06)
|
||||
[Full Changelog](https://github.com/jaredlll08/ModTweaker2/compare/0.9.5...0.9.6)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- \[Request\] Botanical Addons \(Botania\) support [\#301](https://github.com/jaredlll08/ModTweaker2/issues/301)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Remove FSP integration [\#327](https://github.com/jaredlll08/ModTweaker2/issues/327)
|
||||
- \[1.7.10\] \[BUG\] Cannot specify low byproduct chance for Forestry squeezer [\#320](https://github.com/jaredlll08/ModTweaker2/issues/320)
|
||||
- Importing some ModTweaker classes in ZenScript fails [\#308](https://github.com/jaredlll08/ModTweaker2/issues/308)
|
||||
- Missing 'name' parameter in line 182 of modtweaker2.mods.exnihilo.mods.handler.Hammer results in script failure when no recipe found. [\#297](https://github.com/jaredlll08/ModTweaker2/issues/297)
|
||||
|
||||
## [0.9.5](https://github.com/jaredlll08/ModTweaker2/tree/0.9.5) (2015-12-07)
|
||||
[Full Changelog](https://github.com/jaredlll08/ModTweaker2/compare/0.9.4...0.9.5)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Added WeightedItemStack Handlers [\#275](https://github.com/jaredlll08/ModTweaker2/issues/275)
|
||||
- \[Request Feature\] TinkerConstruct support: a way to disable a modifier [\#238](https://github.com/jaredlll08/ModTweaker2/issues/238)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Crash with Forestry 4.0 [\#252](https://github.com/jaredlll08/ModTweaker2/issues/252)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- \[Request Feature\] TinkerConstruct support: a way to disable a modifier [\#238](https://github.com/jaredlll08/ModTweaker2/issues/238)
|
||||
|
||||
## [0.9.4](https://github.com/jaredlll08/ModTweaker2/tree/0.9.4) (2015-10-12)
|
||||
**Implemented enhancements:**
|
||||
|
||||
- QED Table remove funktion missing [\#245](https://github.com/jaredlll08/ModTweaker2/issues/245)
|
||||
- \[Suggestion\] Oredicted Recipes QED Table [\#242](https://github.com/jaredlll08/ModTweaker2/issues/242)
|
||||
- \[Request\] Allow oredict usage in Forestry Carpenter [\#192](https://github.com/jaredlll08/ModTweaker2/issues/192)
|
||||
- Updated ToolStats based on new TConstruct API [\#232](https://github.com/jaredlll08/ModTweaker2/pull/232) ([blade1981m](https://github.com/blade1981m))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
|
@ -29,6 +44,10 @@
|
|||
- mekanism chemicalInfuser MineTweakerAPI.apply call; incorrect param [\#213](https://github.com/jaredlll08/ModTweaker2/issues/213)
|
||||
- \[AE2 Inscriber\] Error msg [\#200](https://github.com/jaredlll08/ModTweaker2/issues/200)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- \[Request\] Allow oredict usage in Forestry Carpenter [\#192](https://github.com/jaredlll08/ModTweaker2/issues/192)
|
||||
|
||||
|
||||
|
||||
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
|
@ -1 +0,0 @@
|
|||
<?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>
|
|
@ -1 +0,0 @@
|
|||
<?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>
|
|
@ -22,6 +22,7 @@ Supported Mods
|
|||
- Applied Energistics 2
|
||||
- Auracascade
|
||||
- Botania
|
||||
- Botanical Addons
|
||||
- Chisel
|
||||
- ExNihilo
|
||||
- ExtendedWorkbench
|
||||
|
|
71
build.gradle
71
build.gradle
|
@ -1,20 +1,33 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
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:2.1-SNAPSHOT'
|
||||
classpath ('com.anatawa12.forge:ForgeGradle:1.2-1.0.+') {
|
||||
changing = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
apply plugin: 'forge'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'java'
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
// 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
|
||||
|
@ -28,28 +41,41 @@ minecraft {
|
|||
version = "${config.minecraft.version}-${config.forge.version}"
|
||||
runDir = "eclipse"
|
||||
replace "@modVersion@", config.mod.version
|
||||
mappings = "stable_20"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "forestry"
|
||||
url = "http://maven.ic2.player.to/"
|
||||
url = "https://maven.ic2.player.to/"
|
||||
metadataSources {
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url = "https://maven.tilera.xyz"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "dev.tilera:auracore:1.8.0:deobf"
|
||||
implementation "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'
|
||||
}
|
||||
|
@ -61,3 +87,36 @@ task deobfJar(type: Jar) {
|
|||
}
|
||||
|
||||
tasks.build.dependsOn deobfJar
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from sourceSets.main.allSource
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
publishing {
|
||||
tasks.publish.dependsOn 'build'
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifactId = project.archivesBaseName
|
||||
|
||||
artifact deobfJar
|
||||
artifact sourcesJar
|
||||
artifact jar
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
if (project.hasProperty('mvnURL')) {
|
||||
maven {
|
||||
credentials {
|
||||
username findProperty("mvnUsername")
|
||||
password findProperty("mvnPassword")
|
||||
}
|
||||
url = findProperty("mvnURL")
|
||||
}
|
||||
}
|
||||
else {
|
||||
mavenLocal()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
minecraft.version=1.8.9
|
||||
forge.version=11.15.0.1701
|
||||
minecraft.version=1.7.10
|
||||
forge.version=10.13.4.1614-1.7.10
|
||||
|
||||
mod.version=1.0.0
|
||||
mod.version=0.11.0
|
||||
|
||||
forestry.version=4.1.0.43
|
||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
|
||||
|
|
BIN
libs/AuraCascade-552-dev.jar
Normal file
BIN
libs/AuraCascade-552-dev.jar
Normal file
Binary file not shown.
BIN
libs/Baubles-deobf-1.7.10-1.0.1.10.jar
Normal file
BIN
libs/Baubles-deobf-1.7.10-1.0.1.10.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
libs/BloodMagic-1.7.10-1.3.0b-3-deobf.jar
Normal file
BIN
libs/BloodMagic-1.7.10-1.3.0b-3-deobf.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
libs/BotanicalAddons-r0.1.20-0-deobf.jar
Normal file
BIN
libs/BotanicalAddons-r0.1.20-0-deobf.jar
Normal file
Binary file not shown.
BIN
libs/CTMLib-1.2.0-11.jar
Normal file
BIN
libs/CTMLib-1.2.0-11.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
libs/Chisel2_DEV-2.5.0.163-deobf.jar
Normal file
BIN
libs/Chisel2_DEV-2.5.0.163-deobf.jar
Normal file
Binary file not shown.
BIN
libs/CoFHCore-[1.7.10]3.0.4B1-308-dev.jar
Normal file
BIN
libs/CoFHCore-[1.7.10]3.0.4B1-308-dev.jar
Normal file
Binary file not shown.
BIN
libs/CoFHLib-[1.7.10]1.0.4B1-176-dev.jar
Normal file
BIN
libs/CoFHLib-[1.7.10]1.0.4B1-176-dev.jar
Normal file
Binary file not shown.
BIN
libs/CodeChickenCore-1.7.10-1.0.4.29-dev (2).jar
Normal file
BIN
libs/CodeChickenCore-1.7.10-1.0.4.29-dev (2).jar
Normal file
Binary file not shown.
BIN
libs/CodeChickenLib-1.7.10-1.1.1.110-dev.jar
Normal file
BIN
libs/CodeChickenLib-1.7.10-1.1.1.110-dev.jar
Normal file
Binary file not shown.
BIN
libs/Enchiridion 2-1.7.10-2.0.2a-73-dev.jar
Normal file
BIN
libs/Enchiridion 2-1.7.10-2.0.2a-73-dev.jar
Normal file
Binary file not shown.
BIN
libs/Ex-Nihilo-1.38-46-deobf.jar
Normal file
BIN
libs/Ex-Nihilo-1.38-46-deobf.jar
Normal file
Binary file not shown.
BIN
libs/ForgeMultipart-1.7.10-1.2.0.345-dev.jar
Normal file
BIN
libs/ForgeMultipart-1.7.10-1.2.0.345-dev.jar
Normal file
Binary file not shown.
BIN
libs/IC2.Classic.Version.1.1.0.19.Dev.jar
Normal file
BIN
libs/IC2.Classic.Version.1.1.0.19.Dev.jar
Normal file
Binary file not shown.
BIN
libs/Mantle-1.7.10-0.3.2.jenkins190-deobf.jar
Normal file
BIN
libs/Mantle-1.7.10-0.3.2.jenkins190-deobf.jar
Normal file
Binary file not shown.
BIN
libs/Mariculture-Deluxe-1.7.10-1.2.4.2-51-dev.jar
Normal file
BIN
libs/Mariculture-Deluxe-1.7.10-1.2.4.2-51-dev.jar
Normal file
Binary file not shown.
BIN
libs/Mekanism-1.7.10-Community-Edition-1.7.10-9.10.16-deobf.jar
Normal file
BIN
libs/Mekanism-1.7.10-Community-Edition-1.7.10-9.10.16-deobf.jar
Normal file
Binary file not shown.
BIN
libs/Metallurgy-1.7.10-4.0.8.128-deobf.jar
Normal file
BIN
libs/Metallurgy-1.7.10-4.0.8.128-deobf.jar
Normal file
Binary file not shown.
BIN
libs/MetallurgyCore-1.7.10-4.0.4.24-deobf.jar
Normal file
BIN
libs/MetallurgyCore-1.7.10-4.0.4.24-deobf.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
libs/NotEnoughItems-1.7.10-1.0.4.83-dev.jar
Normal file
BIN
libs/NotEnoughItems-1.7.10-1.0.4.83-dev.jar
Normal file
Binary file not shown.
BIN
libs/Railcraft_1.7.10-9.7.0.0-dev.jar
Normal file
BIN
libs/Railcraft_1.7.10-9.7.0.0-dev.jar
Normal file
Binary file not shown.
BIN
libs/Steamcraft-0.27.3-dev.jar
Normal file
BIN
libs/Steamcraft-0.27.3-dev.jar
Normal file
Binary file not shown.
BIN
libs/TConstruct-1.7.10-1.8.7.build982-deobf.jar
Normal file
BIN
libs/TConstruct-1.7.10-1.8.7.build982-deobf.jar
Normal file
Binary file not shown.
BIN
libs/ThermalExpansion-[1.7.10]4.0.3B1-218-dev.jar
Normal file
BIN
libs/ThermalExpansion-[1.7.10]4.0.3B1-218-dev.jar
Normal file
Binary file not shown.
BIN
libs/ThermalFoundation-[1.7.10]1.2.0-102-dev.jar
Normal file
BIN
libs/ThermalFoundation-[1.7.10]1.2.0-102-dev.jar
Normal file
Binary file not shown.
BIN
libs/appliedenergistics2-rv2-stable-10-dev.jar
Normal file
BIN
libs/appliedenergistics2-rv2-stable-10-dev.jar
Normal file
Binary file not shown.
BIN
libs/extrautilities-1.2.11-deobf.jar
Normal file
BIN
libs/extrautilities-1.2.11-deobf.jar
Normal file
Binary file not shown.
|
@ -0,0 +1,141 @@
|
|||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package naruto1310.extendedWorkbench.crafting;
|
||||
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
public interface IExtendedRecipe extends IRecipe
|
||||
{
|
||||
|
||||
}
|
49
src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java
Normal file
49
src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java
Normal file
|
@ -0,0 +1,49 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
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);
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
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
src/api/java/thaumcraft
Submodule
1
src/api/java/thaumcraft
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit ced30ed35097d53cdb2a843d705477e52896e54b
|
|
@ -1,14 +1,13 @@
|
|||
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 net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class ClientEvents {
|
||||
public static int cooldown;
|
||||
|
|
|
@ -4,8 +4,28 @@ 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.botanicaladdons.commands.BotanicalAddonsDendricLogger;
|
||||
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 {
|
||||
|
@ -22,12 +42,63 @@ 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("shadowfox_botany")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("treeCrafting", new String[] { "/minetweaker treeCrafting", " Outputs a list of all Botanical Addons Tree Crafting recipes." }, new BotanicalAddonsDendricLogger());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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:crafttweaker;", dependencies = DEPENDENCIES;
|
||||
public static final String DEPENDENCIES = "required-after:MineTweaker3;after:Forestry@[4.1.0,);", dependencies = DEPENDENCIES;
|
||||
}
|
||||
|
|
|
@ -2,79 +2,119 @@ 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.auracore.AuraCore;
|
||||
import modtweaker2.mods.botania.Botania;
|
||||
import modtweaker2.mods.botanicaladdons.BotanicalAddons;
|
||||
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.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 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;
|
||||
|
||||
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;
|
||||
|
||||
@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);
|
||||
|
||||
@SidedProxy(clientSide = "modtweaker2.proxy.ClientProxy", serverSide = "modtweaker2.proxy.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
public static File baseIMCFolder;
|
||||
@Instance(ModProps.modid)
|
||||
public ModTweaker2 instance;
|
||||
|
||||
@Instance(ModProps.modid)
|
||||
public ModTweaker2 instance;
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
logger.info("Starting PreInitialization for " + ModProps.modid);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
logger.info("Starting PreInitialization for " + ModProps.modid);
|
||||
}
|
||||
@SidedProxy(clientSide = "modtweaker2.proxy.ClientProxy", serverSide = "modtweaker2.proxy.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
logger.info("Starting Initialization for " + ModProps.modid);
|
||||
TweakerPlugin.register("Thaumcraft", Thaumcraft.class);
|
||||
@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("shadowfox_botany", BotanicalAddons.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("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);
|
||||
TweakerPlugin.register("auracore", AuraCore.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();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<String> keys = EntityList.stringToClassMapping.keySet();
|
||||
@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);
|
||||
|
||||
System.out.println("Mob Keys: " + keys.size());
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.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,6 +47,7 @@ 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.mc18.item.MCItemStack;
|
||||
import minetweaker.mc18.liquid.MCLiquidStack;
|
||||
import minetweaker.mc1710.item.MCItemStack;
|
||||
import minetweaker.mc1710.liquid.MCLiquidStack;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
|
|
@ -4,12 +4,14 @@ 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.mc18.item.MCItemStack;
|
||||
import minetweaker.mc1710.item.MCItemStack;
|
||||
import modtweaker2.mods.mekanism.gas.MCGasStack;
|
||||
import modtweaker2.mods.thaumcraft.aspect.AspectStack;
|
||||
import modtweaker2.mods.thaumcraft.aspect.MCAspectStack;
|
||||
import modtweaker2.utils.TweakerPlugin;
|
||||
|
@ -62,7 +64,6 @@ 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);
|
||||
|
@ -72,7 +73,9 @@ 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("Thaumcraft") && object instanceof AspectStack) {
|
||||
} else if (TweakerPlugin.isLoaded("Mekanism") && object instanceof GasStack) {
|
||||
return new MCGasStack((GasStack)object).toString();
|
||||
} 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>();
|
||||
|
|
|
@ -155,6 +155,6 @@ public class ReflectionHelper {
|
|||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static void setPrivateValue( Class cls, Object o, String field, Object var) {
|
||||
net.minecraftforge.fml.relauncher.ReflectionHelper.setPrivateValue(cls, o, var, field);
|
||||
cpw.mods.fml.relauncher.ReflectionHelper.setPrivateValue(cls, o, var, field);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
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;
|
||||
|
@ -17,7 +19,9 @@ public class StackHelper {
|
|||
public static boolean areEqual(ItemStack stack1, ItemStack stack2) {
|
||||
if (stack1 == null || stack2 == null) {
|
||||
return false;
|
||||
} else {
|
||||
} else if (TweakerPlugin.isLoaded("Botania") && Botania.isSubtile(stack1) && Botania.isSubtile(stack2)) {
|
||||
return Botania.subtileMatches(stack1, stack2);
|
||||
} else {
|
||||
return stack1.isItemEqual(stack2);
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +69,18 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,5 +109,20 @@ 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
192
src/main/java/modtweaker2/mods/appeng/handlers/Grind.java
Normal file
192
src/main/java/modtweaker2/mods/appeng/handlers/Grind.java
Normal file
|
@ -0,0 +1,192 @@
|
|||
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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
196
src/main/java/modtweaker2/mods/appeng/handlers/Inscriber.java
Normal file
196
src/main/java/modtweaker2/mods/appeng/handlers/Inscriber.java
Normal file
|
@ -0,0 +1,196 @@
|
|||
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());
|
||||
}
|
||||
}
|
||||
}
|
13
src/main/java/modtweaker2/mods/auracascade/AuraCascade.java
Normal file
13
src/main/java/modtweaker2/mods/auracascade/AuraCascade.java
Normal file
|
@ -0,0 +1,13 @@
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
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;
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
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));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
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();
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
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();
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
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()));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
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"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
68
src/main/java/modtweaker2/mods/auracore/AddCruciblePage.java
Normal file
68
src/main/java/modtweaker2/mods/auracore/AddCruciblePage.java
Normal file
|
@ -0,0 +1,68 @@
|
|||
package modtweaker2.mods.auracore;
|
||||
|
||||
import dev.tilera.auracore.api.AuracoreRecipes;
|
||||
import dev.tilera.auracore.api.crafting.CrucibleRecipe;
|
||||
import dev.tilera.auracore.api.research.ResearchPageCrucible;
|
||||
import minetweaker.IUndoableAction;
|
||||
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
|
||||
import thaumcraft.api.research.ResearchCategories;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
|
||||
public class AddCruciblePage implements IUndoableAction {
|
||||
String key;
|
||||
String tab;
|
||||
ResearchPage page;
|
||||
ResearchPage[] oldPages;
|
||||
String recipeKey;
|
||||
|
||||
public AddCruciblePage(String research, String key) {
|
||||
this.key = research;
|
||||
this.tab = ThaumcraftHelper.getResearchTab(this.key);
|
||||
this.recipeKey = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (CrucibleRecipe rec : AuracoreRecipes.getCrucibleRecipes()) {
|
||||
if (rec.key.equals(recipeKey)) {
|
||||
page = new ResearchPageCrucible(rec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (page == null) return;
|
||||
oldPages = ResearchCategories.researchCategories.get(tab).research.get(key).getPages();
|
||||
if (oldPages == null) oldPages = new ResearchPage[0];
|
||||
ResearchPage[] newPages = new ResearchPage[oldPages.length + 1];
|
||||
for (int x = 0; x < oldPages.length; x++) {
|
||||
newPages[x] = oldPages[x];
|
||||
}
|
||||
newPages[oldPages.length] = page;
|
||||
ResearchCategories.researchCategories.get(tab).research.get(key).setPages(newPages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Research Page to " + key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return oldPages != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
ResearchCategories.researchCategories.get(tab).research.get(key).setPages(oldPages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Page from " + key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
68
src/main/java/modtweaker2/mods/auracore/AddInfusionPage.java
Normal file
68
src/main/java/modtweaker2/mods/auracore/AddInfusionPage.java
Normal file
|
@ -0,0 +1,68 @@
|
|||
package modtweaker2.mods.auracore;
|
||||
|
||||
import dev.tilera.auracore.api.AuracoreRecipes;
|
||||
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
|
||||
import dev.tilera.auracore.api.research.ResearchPageInfusion;
|
||||
import minetweaker.IUndoableAction;
|
||||
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
|
||||
import thaumcraft.api.research.ResearchCategories;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
|
||||
public class AddInfusionPage implements IUndoableAction {
|
||||
String key;
|
||||
String tab;
|
||||
ResearchPage page;
|
||||
ResearchPage[] oldPages;
|
||||
String recipeKey;
|
||||
|
||||
public AddInfusionPage(String research, String key) {
|
||||
this.key = research;
|
||||
this.tab = ThaumcraftHelper.getResearchTab(this.key);
|
||||
this.recipeKey = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (IInfusionRecipe rec : AuracoreRecipes.getInfusionRecipes()) {
|
||||
if (rec.getKey().equals(recipeKey)) {
|
||||
page = new ResearchPageInfusion(rec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (page == null) return;
|
||||
oldPages = ResearchCategories.researchCategories.get(tab).research.get(key).getPages();
|
||||
if (oldPages == null) oldPages = new ResearchPage[0];
|
||||
ResearchPage[] newPages = new ResearchPage[oldPages.length + 1];
|
||||
for (int x = 0; x < oldPages.length; x++) {
|
||||
newPages[x] = oldPages[x];
|
||||
}
|
||||
newPages[oldPages.length] = page;
|
||||
ResearchCategories.researchCategories.get(tab).research.get(key).setPages(newPages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Research Page to " + key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return oldPages != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
ResearchCategories.researchCategories.get(tab).research.get(key).setPages(oldPages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Page from " + key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
17
src/main/java/modtweaker2/mods/auracore/AuraCore.java
Normal file
17
src/main/java/modtweaker2/mods/auracore/AuraCore.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package modtweaker2.mods.auracore;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker2.mods.auracore.handlers.Crucible;
|
||||
import modtweaker2.mods.auracore.handlers.Infusion;
|
||||
import modtweaker2.mods.auracore.handlers.Research;
|
||||
import modtweaker2.utils.TweakerPlugin;
|
||||
|
||||
public class AuraCore extends TweakerPlugin {
|
||||
|
||||
public AuraCore() {
|
||||
MineTweakerAPI.registerClass(Crucible.class);
|
||||
MineTweakerAPI.registerClass(Infusion.class);
|
||||
MineTweakerAPI.registerClass(Research.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package modtweaker2.mods.auracore.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import dev.tilera.auracore.api.AuracoreRecipes;
|
||||
import dev.tilera.auracore.api.crafting.CrucibleRecipe;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.auracore.Crucible")
|
||||
public class Crucible {
|
||||
public static final String name = "Auracore Crucible";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(String key, IItemStack result, int cost, String aspects) {
|
||||
MineTweakerAPI.apply(new Add(new CrucibleRecipe(key, toStack(result), ThaumcraftHelper.parseAspects(aspects), cost)));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<CrucibleRecipe> {
|
||||
public Add(CrucibleRecipe recipe) {
|
||||
super(Crucible.name, AuracoreRecipes.getCrucibleRecipes());
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(CrucibleRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.recipeOutput);
|
||||
}
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
List<CrucibleRecipe> recipes = new LinkedList<CrucibleRecipe>();
|
||||
|
||||
for (Object o : AuracoreRecipes.getCrucibleRecipes()) {
|
||||
if (o instanceof CrucibleRecipe) {
|
||||
CrucibleRecipe r = (CrucibleRecipe) o;
|
||||
if (r.recipeOutput != null && matches(output, toIItemStack(r.recipeOutput))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Crucible.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<CrucibleRecipe> {
|
||||
public Remove(List<CrucibleRecipe> recipes) {
|
||||
super(Crucible.name, AuracoreRecipes.getCrucibleRecipes(), recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(CrucibleRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.recipeOutput);
|
||||
}
|
||||
}
|
||||
}
|
102
src/main/java/modtweaker2/mods/auracore/handlers/Infusion.java
Normal file
102
src/main/java/modtweaker2/mods/auracore/handlers/Infusion.java
Normal file
|
@ -0,0 +1,102 @@
|
|||
package modtweaker2.mods.auracore.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toStacks;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import dev.tilera.auracore.api.AuracoreRecipes;
|
||||
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
|
||||
import dev.tilera.auracore.api.crafting.ShapedInfusionCraftingRecipe;
|
||||
import dev.tilera.auracore.api.crafting.ShapelessInfusionCraftingRecipe;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.auracore.Infusion")
|
||||
public class Infusion {
|
||||
|
||||
public static final String name = "Auracore Infusion Altar";
|
||||
|
||||
@ZenMethod
|
||||
public static void addShaped(String key, String research, int cost, IItemStack output, String aspects, IItemStack[][] ingredients) {
|
||||
List<ItemStack> stacks = new ArrayList<>();
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
for(IItemStack[] row : ingredients) {
|
||||
height++;
|
||||
width = Math.max(width, row.length);
|
||||
for (IItemStack i : row) {
|
||||
stacks.add(toStack(i));
|
||||
}
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(new ShapedInfusionCraftingRecipe(key, research, width, height, stacks.toArray(new ItemStack[stacks.size()]), toStack(output), cost, ThaumcraftHelper.parseAspects(aspects))));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addShapeless(String key, String research, int cost, IItemStack output, String aspects, IItemStack[] ingredients) {
|
||||
MineTweakerAPI.apply(new Add(new ShapelessInfusionCraftingRecipe(key, research, toStack(output), Arrays.asList(toStacks(ingredients)), cost, ThaumcraftHelper.parseAspects(aspects))));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<IInfusionRecipe> {
|
||||
public Add(IInfusionRecipe recipe) {
|
||||
super(Infusion.name, AuracoreRecipes.getInfusionRecipes());
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(IInfusionRecipe recipe) {
|
||||
ItemStack stack = recipe.getRecipeOutput();
|
||||
|
||||
if(stack instanceof ItemStack)
|
||||
return LogHelper.getStackDescription(stack);
|
||||
else
|
||||
return "Unknown output";
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
List<IInfusionRecipe> recipes = new LinkedList<IInfusionRecipe>();
|
||||
|
||||
for(IInfusionRecipe recipe : AuracoreRecipes.getInfusionRecipes()) {
|
||||
if(recipe.getRecipeOutput() != null && matches(output, toIItemStack(recipe.getRecipeOutput()))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command Ignored", Infusion.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<IInfusionRecipe> {
|
||||
public Remove(List<IInfusionRecipe> recipes) {
|
||||
super(Infusion.name, AuracoreRecipes.getInfusionRecipes(), recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(IInfusionRecipe recipe) {
|
||||
ItemStack stack = recipe.getRecipeOutput();
|
||||
|
||||
if(stack instanceof ItemStack)
|
||||
return LogHelper.getStackDescription(stack);
|
||||
else
|
||||
return "Unknown output";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package modtweaker2.mods.auracore.handlers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker2.mods.auracore.AddCruciblePage;
|
||||
import modtweaker2.mods.auracore.AddInfusionPage;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.auracore.Research")
|
||||
public class Research {
|
||||
|
||||
@ZenMethod
|
||||
public static void addInfusionPage(String research, String recipe) {
|
||||
MineTweakerAPI.apply(new AddInfusionPage(research, recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addCruciblePage(String research, String recipe) {
|
||||
MineTweakerAPI.apply(new AddCruciblePage(research, recipe));
|
||||
}
|
||||
|
||||
}
|
34
src/main/java/modtweaker2/mods/botania/Botania.java
Normal file
34
src/main/java/modtweaker2/mods/botania/Botania.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
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)));
|
||||
}
|
||||
}
|
39
src/main/java/modtweaker2/mods/botania/BotaniaHelper.java
Normal file
39
src/main/java/modtweaker2/mods/botania/BotaniaHelper.java
Normal file
|
@ -0,0 +1,39 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
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"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
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"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
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());
|
||||
}
|
||||
}
|
||||
}
|
88
src/main/java/modtweaker2/mods/botania/handlers/Brew.java
Normal file
88
src/main/java/modtweaker2/mods/botania/handlers/Brew.java
Normal file
|
@ -0,0 +1,88 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
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());
|
||||
}
|
||||
}
|
||||
}
|
472
src/main/java/modtweaker2/mods/botania/handlers/Lexicon.java
Normal file
472
src/main/java/modtweaker2/mods/botania/handlers/Lexicon.java
Normal file
|
@ -0,0 +1,472 @@
|
|||
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)));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
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());
|
||||
}
|
||||
}
|
||||
}
|
113
src/main/java/modtweaker2/mods/botania/handlers/Orechid.java
Normal file
113
src/main/java/modtweaker2/mods/botania/handlers/Orechid.java
Normal file
|
@ -0,0 +1,113 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
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()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
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;
|
||||
}
|
||||
}
|
45
src/main/java/modtweaker2/mods/botania/lexicon/AddEntry.java
Normal file
45
src/main/java/modtweaker2/mods/botania/lexicon/AddEntry.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
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;
|
||||
}
|
||||
}
|
50
src/main/java/modtweaker2/mods/botania/lexicon/AddPage.java
Normal file
50
src/main/java/modtweaker2/mods/botania/lexicon/AddPage.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
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;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue