Starting anew
This commit is contained in:
parent
8b49478813
commit
594805ee96
34
CHANGELOG.md
34
CHANGELOG.md
|
@ -1,34 +0,0 @@
|
|||
# Change Log
|
||||
|
||||
## [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)
|
||||
|
||||
## [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:**
|
||||
|
||||
- Don`t work BlastFurnace - remove Fuel [\#248](https://github.com/jaredlll08/ModTweaker2/issues/248)
|
||||
- \[Bug\] Metallurgy Crusher Handler does not work [\#244](https://github.com/jaredlll08/ModTweaker2/issues/244)
|
||||
- \[ExNihilo\] Can't override/remove heat sources [\#225](https://github.com/jaredlll08/ModTweaker2/issues/225)
|
||||
- ArrayIndexOutOfBoundsException: Mekanism Sawmill removeRecipe [\#215](https://github.com/jaredlll08/ModTweaker2/issues/215)
|
||||
- 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)
|
||||
|
||||
|
||||
|
||||
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
51
CoFH_at.cfg
51
CoFH_at.cfg
|
@ -1,51 +0,0 @@
|
|||
# NetherOres
|
||||
public net.minecraft.entity.monster.EntityPigZombie func_70835_c(Lnet/minecraft/entity/Entity;)V # becomeAngryAt
|
||||
public net.minecraft.entity.monster.EntitySilverfish field_70843_d # allySummonCooldown
|
||||
public-f net.minecraft.init.Blocks field_150449_bY # oreNetherQuartz
|
||||
|
||||
# MineFactory Reloaded
|
||||
protected net.minecraft.util.WeightedRandomFishable * # need it all
|
||||
public net.minecraft.entity.EntityList field_75624_e # classToIDMapping
|
||||
public net.minecraft.entity.EntityList field_75622_f # stringToIDMapping
|
||||
public net.minecraft.entity.monster.EntitySlime func_70799_a(I)V # setSlimeSize
|
||||
public net.minecraft.entity.monster.EntityZombie func_82228_a(I)V # startConversion
|
||||
public net.minecraft.entity.EntityLivingBase field_70718_bc # recentlyHit
|
||||
public-f net.minecraft.init.Blocks field_150432_aD # ice
|
||||
public-f net.minecraft.init.Blocks field_150410_aZ # glass_pane
|
||||
public-f net.minecraft.init.Items field_151117_aB # milkBucket
|
||||
protected net.minecraft.block.Block field_149770_b # unlocalizedName
|
||||
public net.minecraft.server.management.PlayerManager func_72690_a(IIZ)Lnet/minecraft/server/management/PlayerManager$PlayerInstance; # getOrCreateChunkWatcher
|
||||
public net.minecraft.server.management.PlayerManager$PlayerInstance
|
||||
public net.minecraft.server.management.PlayerManager$PlayerInstance field_73263_b # playersWatchingChunk
|
||||
public net.minecraft.entity.EntityLiving field_70728_aV # experienceValue
|
||||
public net.minecraft.entity.EntityLiving field_82174_bp # equipmentDropChances
|
||||
|
||||
# Thermal Expansion
|
||||
public net.minecraft.entity.Entity field_83001_bt # invulnerable
|
||||
public net.minecraft.entity.Entity field_70178_ae # isImmuneToFire
|
||||
public net.minecraft.entity.player.EntityPlayer field_71074_e # itemInUse
|
||||
public net.minecraft.server.management.ItemInWorldManager field_73094_o #durabilityRemainingOnBlock
|
||||
|
||||
# PC Core
|
||||
public net.minecraft.client.gui.GuiScreen field_146289_q # fontRenderer
|
||||
public net.minecraft.client.gui.inventory.GuiContainer field_147003_i # guiLeft
|
||||
public net.minecraft.client.gui.inventory.GuiContainer field_147009_r # guiTop
|
||||
public net.minecraft.world.WorldServer field_73068_P # allPlayersSleeping
|
||||
|
||||
# CoFH Core
|
||||
protected net.minecraft.inventory.Container * # senseless to have private stuff here
|
||||
protected net.minecraft.client.gui.inventory.GuiContainer * # senseless to have private stuff here
|
||||
protected net.minecraft.client.gui.FontRenderer func_78280_d(Ljava/lang/String;I)Ljava/lang/String; # wrapFormattedStringToWidth
|
||||
protected net.minecraft.client.gui.FontRenderer func_78255_a(Ljava/lang/String;Z)V # renderStringAtPos
|
||||
public net.minecraft.entity.projectile.EntityFishHook * # (nearly) literally everything is private
|
||||
protected net.minecraft.entity.player.EntityPlayer field_71072_f # itemInUseCount
|
||||
public net.minecraft.item.ItemPickaxe field_150915_c # blocksEffectiveAgainst
|
||||
public net.minecraft.item.ItemSpade field_150916_c # blocksEffectiveAgainst
|
||||
public net.minecraft.item.ItemAxe field_150917_c # blocksEffectiveAgainst
|
||||
public net.minecraft.util.RegistrySimple field_82596_a # registryObjects
|
||||
public-f net.minecraft.util.RegistryNamespaced field_148759_a # underlyingIntegerMap
|
||||
public net.minecraft.world.World field_72998_d # collidingBoundingBoxes
|
||||
|
||||
# WorldProxy
|
||||
public-f net.minecraft.world.World *()V # Doesn't matter what it is, we need it public
|
||||
public-f net.minecraft.world.WorldServer *()V # Doesn't matter what it is, we need it public
|
|
@ -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>
|
63
build.gradle
63
build.gradle
|
@ -1,66 +1,57 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
name = "forge"
|
||||
url = "http://files.minecraftforge.net/maven"
|
||||
}
|
||||
maven { url = "http://files.minecraftforge.net/maven" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
|
||||
ext.configFile = file "build.properties"
|
||||
configFile.withReader {
|
||||
def prop = new Properties()
|
||||
prop.load(it)
|
||||
project.ext.config = new ConfigSlurper().parse prop
|
||||
}
|
||||
version = "1.0.0"
|
||||
group = "com.blamejared.modtweaker"
|
||||
archivesBaseName = "modtweaker"
|
||||
|
||||
version=config.mod.version
|
||||
group= "modtweaker" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "ModTweaker2"
|
||||
|
||||
minecraft {
|
||||
version = "${config.forge.version}"
|
||||
runDir = "eclipse"
|
||||
replace "@modVersion@", config.mod.version
|
||||
mappings = "stable_29"
|
||||
}
|
||||
sourceCompatibility = targetCompatibility = "1.8" // Need this here so eclipse task generates correctly.
|
||||
sourceCompatibility = targetCompatibility = "1.8"
|
||||
compileJava {
|
||||
sourceCompatibility = targetCompatibility = "1.8"
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = "1.11.2-13.20.0.2309"
|
||||
runDir = "run"
|
||||
mappings = "snapshot_20161220"
|
||||
useDepAts = true
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "http://dvs1.progwml6.com/files/maven"
|
||||
}
|
||||
|
||||
maven {
|
||||
url "http://maven.blamejared.com"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
deobfCompile "mezz.jei:jei_1.11.2:4.3.6.280"
|
||||
deobfCompile "MineTweaker3:MineTweaker3-MC1112-Main:1.11.2-3.0.25.99"
|
||||
deobfCompile "com.blamejared:MTLib:2.+"
|
||||
}
|
||||
|
||||
processResources
|
||||
{
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mcversion", config.minecraft.version
|
||||
inputs.property "mcversion", project.minecraft.version
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
|
||||
expand 'version':project.version, 'mcversion':config.minecraft.version
|
||||
|
||||
expand 'version': project.version, 'mcversion': project.minecraft.version
|
||||
}
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
}
|
||||
}
|
||||
|
||||
task deobfJar(type: Jar) {
|
||||
from sourceSets.main.output
|
||||
classifier = 'deobf'
|
||||
}
|
||||
|
||||
tasks.build.dependsOn deobfJar
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
minecraft.version=1.10.2
|
||||
forge.version=1.10.2-12.18.3.2254
|
||||
mod.version=2.0.12
|
3
gradle.properties
Normal file
3
gradle.properties
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
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.7-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8963
mcp/fields.csv
8963
mcp/fields.csv
File diff suppressed because it is too large
Load diff
8550
mcp/methods.csv
8550
mcp/methods.csv
File diff suppressed because it is too large
Load diff
25
src/main/java/com/blamejared/ModTweaker.java
Normal file
25
src/main/java/com/blamejared/ModTweaker.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package com.blamejared;
|
||||
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.*;
|
||||
|
||||
import static com.blamejared.reference.Reference.*;
|
||||
|
||||
@Mod(modid = MODID, name = NAME, version = VERSION, dependencies = DEPENDENCIES)
|
||||
public class ModTweaker {
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent e) {
|
||||
|
||||
}
|
||||
}
|
9
src/main/java/com/blamejared/reference/Reference.java
Normal file
9
src/main/java/com/blamejared/reference/Reference.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
package com.blamejared.reference;
|
||||
|
||||
public class Reference {
|
||||
|
||||
public static final String MODID = "modtweaker";
|
||||
public static final String NAME = "Modtweaker";
|
||||
public static final String VERSION = "1.0.0";
|
||||
public static final String DEPENDENCIES = "required-after:crafttweaker;required-after:mtlib;";
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package modtweaker;
|
||||
|
||||
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 static com.blamejared.mtlib.helpers.LogHelper.print;
|
||||
|
||||
public class ClientEvents {
|
||||
public static int cooldown;
|
||||
public static boolean active;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrawTooltip(ItemTooltipEvent event) {
|
||||
|
||||
IPlayer player = MineTweakerMC.getIPlayer(event.getEntityPlayer());
|
||||
if (player != null) {
|
||||
IItemStack hand = MineTweakerMC.getIItemStack(event.getItemStack());
|
||||
if (hand != null) {
|
||||
if (active) {
|
||||
|
||||
String print = hand.toString();
|
||||
event.getToolTip().add(print);
|
||||
if (GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSprint)) {
|
||||
if (cooldown <= 0) {
|
||||
cooldown = 30;
|
||||
print(print + " -- " + hand.getDisplayName());
|
||||
} else
|
||||
cooldown--;
|
||||
} else
|
||||
cooldown--;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package modtweaker;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker.commands.EntityMappingLogger;
|
||||
import modtweaker.mods.botania.commands.*;
|
||||
import modtweaker.mods.botania.lexicon.commands.*;
|
||||
import modtweaker.mods.chisel.commands.ChiselGroupLogger;
|
||||
import modtweaker.mods.chisel.commands.ChiselVariationLogger;
|
||||
import modtweaker.mods.randomthings.commands.RandomThingsLogger;
|
||||
import modtweaker.mods.tconstruct.commands.MaterialLogger;
|
||||
import modtweaker.mods.tconstruct.commands.ModifierLogger;
|
||||
import modtweaker.mods.tconstruct.commands.TConstructLogger;
|
||||
|
||||
public class Commands {
|
||||
|
||||
public static void registerCommands() {
|
||||
if(MineTweakerAPI.server != null) {
|
||||
|
||||
MineTweakerAPI.server.addMineTweakerCommand("tooltips", new String[]{"/minetweaker tooltips", " Adds tooltips to all items ingame with their mt script name, press ctrl on an item to print to the log"}, new ICommandFunction() {
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
ClientEvents.active = !ClientEvents.active;
|
||||
}
|
||||
});
|
||||
|
||||
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("randomthings")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("randomthings", new String[]{"/minetweaker randomthings [HANDLER]", " Outputs a list of all Random Things recipes."}, new RandomThingsLogger());
|
||||
}
|
||||
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("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", " Outputs a list of chisel variations"}, new ChiselVariationLogger());
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerMineTweakerCommand(String commandName, String[] usages, ICommandFunction commandFunction) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand(commandName, usages, commandFunction);
|
||||
ModTweaker.logger.info("\nRegistering command " + commandName + ".");
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package modtweaker;
|
||||
|
||||
import mezz.jei.api.*;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.ingredients.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.compat.DummyJEIRecipeRegistry;
|
||||
import minetweaker.mods.jei.JEIRecipeRegistry;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
|
||||
@mezz.jei.api.JEIPlugin
|
||||
public class JEIAddonPlugin implements IModPlugin {
|
||||
|
||||
public static IJeiHelpers jeiHelpers;
|
||||
public static IIngredientRegistry itemRegistry;
|
||||
public static IRecipeRegistry recipeRegistry;
|
||||
|
||||
public static IDrawable castingTable;
|
||||
public static IDrawable castingBasin;
|
||||
|
||||
@Override
|
||||
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIngredients(IModIngredientRegistration registry) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(IModRegistry registry) {
|
||||
jeiHelpers = registry.getJeiHelpers();
|
||||
itemRegistry = registry.getIngredientRegistry();
|
||||
ResourceLocation rec = new ResourceLocation("tconstruct", "textures/gui/jei/casting.png");
|
||||
this.castingTable = jeiHelpers.getGuiHelper().createDrawable(rec, 141, 0, 16, 16);
|
||||
this.castingBasin = jeiHelpers.getGuiHelper().createDrawable(rec, 141, 16, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRuntimeAvailable(IJeiRuntime iJeiRuntime) {
|
||||
recipeRegistry = iJeiRuntime.getRecipeRegistry();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package modtweaker;
|
||||
|
||||
public class ModProps {
|
||||
|
||||
public static final String NAME = "Mod Tweaker", name = NAME;
|
||||
public static final String MODID = "modtweaker", modid = MODID;
|
||||
public static final String VERSION = "@modVersion@", version = VERSION;
|
||||
public static final String DEPENDENCIES = "required-after:MineTweaker3;required-after:mtlib;", dependencies = DEPENDENCIES;
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
package modtweaker;
|
||||
|
||||
import com.blamejared.ctgui.api.GuiRegistry;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.runtime.providers.ScriptProviderDirectory;
|
||||
import modtweaker.mods.actuallyadditions.ActuallyAdditions;
|
||||
import modtweaker.mods.bloodmagic.BloodMagic;
|
||||
import modtweaker.mods.botania.Botania;
|
||||
import modtweaker.mods.chisel.Chisel;
|
||||
import modtweaker.mods.extrautils.ExtraUtilities;
|
||||
import modtweaker.mods.forestry.Forestry;
|
||||
import modtweaker.mods.randomthings.RandomThings;
|
||||
import modtweaker.mods.refinedstorage.RefinedStorage;
|
||||
import modtweaker.mods.tconstruct.TConstruct;
|
||||
import modtweaker.mods.embers.Embers;
|
||||
import modtweaker.proxy.CommonProxy;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.*;
|
||||
import net.minecraftforge.fml.common.Mod.*;
|
||||
import net.minecraftforge.fml.common.event.*;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import org.apache.logging.log4j.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Mod(modid = ModProps.modid, version = ModProps.version, dependencies = ModProps.dependencies)
|
||||
public class ModTweaker {
|
||||
|
||||
public static Logger logger = LogManager.getLogger(ModProps.modid);
|
||||
|
||||
@SidedProxy(clientSide = "modtweaker.proxy.ClientProxy", serverSide = "modtweaker.proxy.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@Instance(ModProps.modid)
|
||||
public ModTweaker instance;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
logger.info("Starting PreInitialization for " + ModProps.modid);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
logger.info("Starting Initialization for " + ModProps.modid);
|
||||
TweakerPlugin.register("forestry", Forestry.class);
|
||||
TweakerPlugin.register("tconstruct", TConstruct.class);
|
||||
TweakerPlugin.register("randomthings", RandomThings.class);
|
||||
TweakerPlugin.register("Botania", Botania.class);
|
||||
TweakerPlugin.register("chisel", Chisel.class);
|
||||
TweakerPlugin.register("BloodMagic", BloodMagic.class);
|
||||
TweakerPlugin.register("actuallyadditions", ActuallyAdditions.class);
|
||||
TweakerPlugin.register("refinedstorage", RefinedStorage.class);
|
||||
TweakerPlugin.register("embers", Embers.class);
|
||||
|
||||
TweakerPlugin.register("extrautils2", ExtraUtilities.class);
|
||||
|
||||
if(FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
MinecraftForge.EVENT_BUS.register(new ClientEvents());
|
||||
}
|
||||
|
||||
MineTweakerImplementationAPI.onReloadEvent(event1 -> proxy.registerCommands());
|
||||
|
||||
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 serverStart(FMLServerStartingEvent event) {
|
||||
logger.info("Starting ServerStart for " + ModProps.modid);
|
||||
proxy.registerCommands();
|
||||
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package modtweaker;
|
||||
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class TweakerPlugin {
|
||||
private static List<String> mods = new LinkedList<String>();
|
||||
|
||||
public static void register(String mod, Class<?> clazz) {
|
||||
if (Loader.isModLoaded(mod)) {
|
||||
load(mod, clazz);
|
||||
}
|
||||
}
|
||||
|
||||
public static void load(String mod, Class<?> clazz) {
|
||||
try {
|
||||
clazz.newInstance();
|
||||
mods.add(mod);
|
||||
} catch (Exception e) {
|
||||
mods.remove(mod);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLoaded(String string) {
|
||||
return mods.contains(string);
|
||||
}
|
||||
|
||||
public static List<String> getMods() {
|
||||
return mods;
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
package modtweaker.brackets;
|
||||
|
||||
import minetweaker.IBracketHandler;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.annotations.BracketHandler;
|
||||
import minetweaker.api.item.IngredientAny;
|
||||
import modtweaker.brackets.util.IMaterial;
|
||||
import modtweaker.brackets.util.MCMaterial;
|
||||
import slimeknights.tconstruct.library.TinkerRegistry;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Jared on 6/16/2016.
|
||||
*/
|
||||
@BracketHandler(priority = 100)
|
||||
public class MaterialBracketHandler implements IBracketHandler {
|
||||
|
||||
public static IMaterial getMaterial(String name) {
|
||||
return new MCMaterial(TinkerRegistry.getMaterial(name));
|
||||
}
|
||||
|
||||
private final IZenSymbol symbolAny;
|
||||
private final IJavaMethod method;
|
||||
|
||||
public MaterialBracketHandler() {
|
||||
|
||||
symbolAny = MineTweakerAPI.getJavaStaticFieldSymbol(IngredientAny.class, "INSTANCE");
|
||||
method = MineTweakerAPI.getJavaMethod(MaterialBracketHandler.class, "getMaterial", 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("material") && 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 (int i = startIndex; i < endIndex; i++) {
|
||||
Token token = tokens.get(i);
|
||||
valueBuilder.append(token.getValue());
|
||||
}
|
||||
IMaterial material = getMaterial(valueBuilder.toString());
|
||||
if (!material.getName().equals("unknown")) {
|
||||
MineTweakerAPI.logInfo("Material wasn't null");
|
||||
return new MaterialReferenceSymbol(environment, valueBuilder.toString());
|
||||
}
|
||||
MineTweakerAPI.logInfo("Material was null");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private class MaterialReferenceSymbol implements IZenSymbol {
|
||||
private final IEnvironmentGlobal environment;
|
||||
private final String name;
|
||||
|
||||
public MaterialReferenceSymbol(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));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
package modtweaker.brackets.util;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import stanhebben.zenscript.annotations.ZenSetter;
|
||||
|
||||
/**
|
||||
* Created by Jared on 6/16/2016.
|
||||
*/
|
||||
@ZenClass("modtweaker.materials.IMaterial")
|
||||
public interface IMaterial {
|
||||
|
||||
@ZenGetter
|
||||
String getName();
|
||||
|
||||
@ZenMethod
|
||||
boolean matches(IMaterial var1);
|
||||
|
||||
Object getInternal();
|
||||
|
||||
@ZenGetter("definition")
|
||||
IMaterialDefinition getDefinition();
|
||||
|
||||
@ZenSetter("durabilityHead")
|
||||
void setDurabilityHead(int durability);
|
||||
|
||||
@ZenGetter("durabilityHead")
|
||||
int getDurabilityHead();
|
||||
|
||||
@ZenSetter("miningSpeedHead")
|
||||
void setMiningSpeedHead(float miningSpeed);
|
||||
|
||||
@ZenGetter("miningSpeedHead")
|
||||
float getMiningSpeedHead();
|
||||
|
||||
@ZenSetter("attackHead")
|
||||
void setAttackHead(float attack);
|
||||
|
||||
@ZenGetter("attackHead")
|
||||
float getAttackHead();
|
||||
|
||||
@ZenSetter("harvestLevelHead")
|
||||
void setHarvestLevelHead(int level);
|
||||
|
||||
@ZenGetter("harvestLevelHead")
|
||||
int getHarvestLevelHead();
|
||||
|
||||
|
||||
@ZenSetter("durabilityHandle")
|
||||
void setDurabilityHandle(int durability);
|
||||
|
||||
@ZenGetter("durabilityHandle")
|
||||
int getDurabilityHandle();
|
||||
|
||||
@ZenSetter("modifierHandle")
|
||||
void setModifierHandle(float modifier);
|
||||
|
||||
@ZenGetter("modifierHandle")
|
||||
float getModifierHandle();
|
||||
|
||||
@ZenSetter("durabilityExtra")
|
||||
void setDurabilityExtra(int durability);
|
||||
|
||||
@ZenGetter("durabilityExtra")
|
||||
int getDurabilityExtra();
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package modtweaker.brackets.util;
|
||||
|
||||
import stanhebben.zenscript.annotations.*;
|
||||
|
||||
/**
|
||||
* Created by Jared on 6/16/2016.
|
||||
*/
|
||||
@ZenClass("modtweaker.material.IMaterialDefinition")
|
||||
public interface IMaterialDefinition {
|
||||
|
||||
@ZenOperator(OperatorType.MUL)
|
||||
public IMaterial asMaterial();
|
||||
|
||||
@ZenGetter("name")
|
||||
public String getName();
|
||||
|
||||
@ZenGetter("displayName")
|
||||
public String getDisplayName();
|
||||
|
||||
}
|
|
@ -1,111 +0,0 @@
|
|||
package modtweaker.brackets.util;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker.mods.tconstruct.actions.*;
|
||||
import slimeknights.tconstruct.library.materials.HandleMaterialStats;
|
||||
import slimeknights.tconstruct.library.materials.HeadMaterialStats;
|
||||
import slimeknights.tconstruct.library.materials.Material;
|
||||
|
||||
/**
|
||||
* Created by Jared on 6/16/2016.
|
||||
*/
|
||||
public class MCMaterial implements IMaterial {
|
||||
private final Material material;
|
||||
|
||||
public MCMaterial(Material material) {
|
||||
this.material = material;
|
||||
System.out.println("added: " + material.getIdentifier());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return material.getIdentifier();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(IMaterial var1) {
|
||||
return var1.getName().equals(getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getInternal() {
|
||||
return material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMaterialDefinition getDefinition() {
|
||||
return new MCMaterialDefinition(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDurabilityHead(int durability) {
|
||||
MineTweakerAPI.apply(new SetDurabilityAction(this, "head", durability));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityHead() {
|
||||
return ((HeadMaterialStats) material.getStats("head")).durability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMiningSpeedHead(float miningSpeed) {
|
||||
MineTweakerAPI.apply(new SetMiningSpeedAction(this, "head", miningSpeed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMiningSpeedHead() {
|
||||
return ((HeadMaterialStats) material.getStats("head")).miningspeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttackHead(float attack) {
|
||||
MineTweakerAPI.apply(new SetAttackAction(this, "head", attack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAttackHead() {
|
||||
return ((HeadMaterialStats) material.getStats("head")).attack;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setHarvestLevelHead(int level) {
|
||||
MineTweakerAPI.apply(new SetHarvestLevelAction(this, "head", level));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHarvestLevelHead() {
|
||||
return ((HeadMaterialStats) material.getStats("head")).harvestLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDurabilityHandle(int durability) {
|
||||
MineTweakerAPI.apply(new SetDurabilityAction(this, "handle", durability));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityHandle() {
|
||||
return ((HandleMaterialStats) material.getStats("handle")).durability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setModifierHandle(float modifier) {
|
||||
MineTweakerAPI.apply(new SetModifierAction(this, "handle", modifier));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getModifierHandle() {
|
||||
return ((HandleMaterialStats) material.getStats("handle")).modifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDurabilityExtra(int durability) {
|
||||
MineTweakerAPI.apply(new SetDurabilityAction(this, "extra", durability));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityExtra() {
|
||||
return ((HandleMaterialStats) material.getStats("extra")).durability;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package modtweaker.brackets.util;
|
||||
|
||||
import slimeknights.tconstruct.library.materials.Material;
|
||||
|
||||
/**
|
||||
* Created by Jared on 6/16/2016.
|
||||
*/
|
||||
|
||||
public class MCMaterialDefinition implements IMaterialDefinition {
|
||||
private final Material material;
|
||||
|
||||
public MCMaterialDefinition(Material material) {
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMaterial asMaterial() {
|
||||
return new MCMaterial(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return material.getLocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return material.getLocalizedName();
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package modtweaker.commands;
|
||||
|
||||
import com.blamejared.mtlib.commands.CommandLogger;
|
||||
import net.minecraft.entity.EntityList;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class EntityMappingLogger extends CommandLogger {
|
||||
|
||||
@Override
|
||||
public Collection<? extends String> getList() {
|
||||
return EntityList.NAME_TO_CLASS.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Mob Keys";
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package modtweaker.mods.actuallyadditions;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker.mods.actuallyadditions.handlers.AtomicReconstructor;
|
||||
import modtweaker.mods.actuallyadditions.handlers.CoffeeMaker;
|
||||
import modtweaker.mods.actuallyadditions.handlers.Compost;
|
||||
import modtweaker.mods.actuallyadditions.handlers.Crusher;
|
||||
import modtweaker.mods.actuallyadditions.handlers.Empowerer;
|
||||
|
||||
public class ActuallyAdditions {
|
||||
public ActuallyAdditions() {
|
||||
MineTweakerAPI.registerClass(Crusher.class);
|
||||
MineTweakerAPI.registerClass(AtomicReconstructor.class);
|
||||
MineTweakerAPI.registerClass(Empowerer.class);
|
||||
MineTweakerAPI.registerClass(Compost.class);
|
||||
MineTweakerAPI.registerClass(CoffeeMaker.class);
|
||||
}
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
package modtweaker.mods.actuallyadditions.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseListAddition;
|
||||
import com.blamejared.mtlib.utils.BaseListRemoval;
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toIItemStack;
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toStack;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.actuallyadditions.AtomicReconstructor")
|
||||
public class AtomicReconstructor {
|
||||
protected static final String name = "Actually Additions Atomic Reconstructor";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output, int energyUse) {
|
||||
MineTweakerAPI.apply(new Add(new LensConversionRecipe(toStack(input), toStack(output), energyUse, ActuallyAdditionsAPI.lensDefaultConversion)));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<LensConversionRecipe> {
|
||||
public Add(LensConversionRecipe recipe) {
|
||||
super(AtomicReconstructor.name, ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES);
|
||||
|
||||
this.recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(LensConversionRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.inputStack);
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IIngredient output) {
|
||||
List<LensConversionRecipe> recipes = new LinkedList<LensConversionRecipe>();
|
||||
|
||||
if(output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
for(LensConversionRecipe recipe : ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES) {
|
||||
if(matches(output, toIItemStack(recipe.inputStack)))
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for output %s. Command ignored!", AtomicReconstructor.name,
|
||||
output.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<LensConversionRecipe> {
|
||||
public Remove(List<LensConversionRecipe> recipes) {
|
||||
super(AtomicReconstructor.name, ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(LensConversionRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.inputStack);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
package modtweaker.mods.actuallyadditions.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseListAddition;
|
||||
import com.blamejared.mtlib.utils.BaseListRemoval;
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toIItemStack;
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toStack;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.actuallyadditions.Coffee")
|
||||
public class CoffeeMaker {
|
||||
protected static final String name = "Actually Additions Coffee Maker";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack ingredient, int maxAmplifier, String[] effectStrings, int[] effectDurations) {
|
||||
|
||||
ArrayList<PotionEffect> potionTypeArrayList = new ArrayList<PotionEffect>();
|
||||
for(int i = 0; i < effectStrings.length; i++) {
|
||||
potionTypeArrayList.add(new PotionEffect(Potion.getPotionFromResourceLocation(effectStrings[i]), effectDurations[i]));
|
||||
}
|
||||
|
||||
PotionEffect[] potionTypeArray = new PotionEffect[potionTypeArrayList.size()];
|
||||
for(int i = 0; i < potionTypeArrayList.size(); i++) {
|
||||
potionTypeArray[i] = potionTypeArrayList.get(i);
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(new CoffeeIngredient(toStack(ingredient), potionTypeArray, maxAmplifier)));
|
||||
}
|
||||
|
||||
|
||||
private static class Add extends BaseListAddition<CoffeeIngredient> {
|
||||
public Add(CoffeeIngredient recipe) {
|
||||
super(CoffeeMaker.name, ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS);
|
||||
|
||||
this.recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(CoffeeIngredient recipe) {
|
||||
return LogHelper.getStackDescription(recipe.ingredient);
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IIngredient input) {
|
||||
List<CoffeeIngredient> recipes = new LinkedList<CoffeeIngredient>();
|
||||
|
||||
if(input == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
for(CoffeeIngredient recipe : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS) {
|
||||
if(matches(input, toIItemStack(recipe.ingredient)))
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for output %s. Command ignored!", CoffeeMaker.name,
|
||||
input.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<CoffeeIngredient> {
|
||||
public Remove(List<CoffeeIngredient> recipes) {
|
||||
super(CoffeeMaker.name, ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(CoffeeIngredient recipe) {
|
||||
return LogHelper.getStackDescription(recipe.ingredient);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
package modtweaker.mods.actuallyadditions.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseListAddition;
|
||||
import com.blamejared.mtlib.utils.BaseListRemoval;
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toIItemStack;
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toStack;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.actuallyadditions.Compost")
|
||||
public class Compost {
|
||||
protected static final String name = "Actually Additions Compost";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input,IItemStack output) {
|
||||
if(!InputHelper.isABlock(input) || !InputHelper.isABlock(output)){
|
||||
LogHelper.logWarning(String.format("Invalid %s Recipe found for %s. Input and output must be blocks.", Empowerer.name,
|
||||
output.toString()));
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(new CompostRecipe(toStack(input), Block.getBlockFromItem(toStack(input).getItem()), toStack(output), Block.getBlockFromItem(toStack(output).getItem()))));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack displayInput, IItemStack output, IItemStack displayOutput) {
|
||||
if(!InputHelper.isABlock(displayInput) || !InputHelper.isABlock(displayOutput)){
|
||||
LogHelper.logWarning(String.format("Invalid %s Recipe found for %s. Input and output must be blocks.", Empowerer.name,
|
||||
output.toString()));
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(new CompostRecipe(toStack(input), Block.getBlockFromItem(toStack(displayInput).getItem()), toStack(output), Block.getBlockFromItem(toStack(displayOutput).getItem()))));
|
||||
}
|
||||
|
||||
|
||||
private static class Add extends BaseListAddition<CompostRecipe> {
|
||||
public Add(CompostRecipe recipe) {
|
||||
super(Compost.name, ActuallyAdditionsAPI.COMPOST_RECIPES);
|
||||
|
||||
this.recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(CompostRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.output);
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IIngredient input) {
|
||||
List<CompostRecipe> recipes = new LinkedList<CompostRecipe>();
|
||||
|
||||
if (input == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
for (CompostRecipe recipe : ActuallyAdditionsAPI.COMPOST_RECIPES) {
|
||||
if (matches(input, toIItemStack(recipe.input)))
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for output %s. Command ignored!", Compost.name,
|
||||
input.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<CompostRecipe> {
|
||||
public Remove(List<CompostRecipe> recipes) {
|
||||
super(Compost.name, ActuallyAdditionsAPI.COMPOST_RECIPES, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(CompostRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.output);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
package modtweaker.mods.actuallyadditions.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseListAddition;
|
||||
import com.blamejared.mtlib.utils.BaseListRemoval;
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toIItemStack;
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toStack;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.actuallyadditions.Crusher")
|
||||
public class Crusher {
|
||||
protected static final String name = "Actually Additions Crusher";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack outputOne, @Optional IItemStack outputTwo, @Optional int outputTwoChance) {
|
||||
MineTweakerAPI.apply(new Add(new CrusherRecipe(toStack(input), toStack(outputOne), toStack(outputTwo), outputTwoChance)));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<CrusherRecipe> {
|
||||
public Add(CrusherRecipe recipe) {
|
||||
super(Crusher.name, ActuallyAdditionsAPI.CRUSHER_RECIPES);
|
||||
|
||||
this.recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(CrusherRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.inputStack);
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IIngredient input) {
|
||||
List<CrusherRecipe> recipes = new LinkedList<CrusherRecipe>();
|
||||
|
||||
if (input == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
for (CrusherRecipe recipe : ActuallyAdditionsAPI.CRUSHER_RECIPES) {
|
||||
if (matches(input, toIItemStack(recipe.inputStack)))
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for output %s. Command ignored!", Crusher.name,
|
||||
input.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<CrusherRecipe> {
|
||||
public Remove(List<CrusherRecipe> recipes) {
|
||||
super(Crusher.name, ActuallyAdditionsAPI.CRUSHER_RECIPES, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(CrusherRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.inputStack);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
package modtweaker.mods.actuallyadditions.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseListAddition;
|
||||
import com.blamejared.mtlib.utils.BaseListRemoval;
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toIItemStack;
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toStack;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.actuallyadditions.Empowerer")
|
||||
public class Empowerer {
|
||||
protected static final String name = "Actually Additions Empowerer";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output, IItemStack modifier1,
|
||||
IItemStack modifier2, IItemStack modifier3, IItemStack modifier4, int energyPerStand,
|
||||
int time, @Optional float redValue, @Optional float greenValue, @Optional float blueValue) {
|
||||
|
||||
|
||||
float[] particleColor = new float[]{redValue,greenValue,blueValue};
|
||||
MineTweakerAPI.apply(new Add(
|
||||
new EmpowererRecipe(toStack(input), toStack(output), toStack(modifier1), toStack(modifier2), toStack(modifier3), toStack(modifier4), energyPerStand, time, particleColor)));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<EmpowererRecipe> {
|
||||
public Add(EmpowererRecipe recipe) {
|
||||
super(Empowerer.name, ActuallyAdditionsAPI.EMPOWERER_RECIPES);
|
||||
|
||||
this.recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(EmpowererRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.output);
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IIngredient input, IIngredient output) {
|
||||
List<EmpowererRecipe> recipes = new LinkedList<EmpowererRecipe>();
|
||||
|
||||
if (output == null || input == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
for (EmpowererRecipe recipe : ActuallyAdditionsAPI.EMPOWERER_RECIPES) {
|
||||
if (matches(output, toIItemStack(recipe.output))){
|
||||
if(matches(input, toIItemStack(recipe.input))){
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for output %s. Command ignored!", Empowerer.name,
|
||||
output.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<EmpowererRecipe> {
|
||||
public Remove(List<EmpowererRecipe> recipes) {
|
||||
super(Empowerer.name, ActuallyAdditionsAPI.EMPOWERER_RECIPES, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(EmpowererRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.output);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package modtweaker.mods.bloodmagic;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker.mods.bloodmagic.handlers.AlchemyTable;
|
||||
import modtweaker.mods.bloodmagic.handlers.Altar;
|
||||
import modtweaker.mods.bloodmagic.handlers.SoulForge;
|
||||
|
||||
public class BloodMagic
|
||||
{
|
||||
public BloodMagic()
|
||||
{
|
||||
MineTweakerAPI.registerClass(SoulForge.class);
|
||||
MineTweakerAPI.registerClass(AlchemyTable.class);
|
||||
MineTweakerAPI.registerClass(Altar.class);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package modtweaker.mods.bloodmagic;
|
||||
|
||||
import WayofTime.bloodmagic.api.ItemStackWrapper;
|
||||
import WayofTime.bloodmagic.api.recipe.AlchemyTableRecipe;
|
||||
import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
|
||||
import WayofTime.bloodmagic.api.registry.AlchemyTableRecipeRegistry;
|
||||
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
|
||||
import WayofTime.bloodmagic.api.registry.TartaricForgeRecipeRegistry;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.blamejared.mtlib.helpers.ReflectionHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BloodMagicHelper
|
||||
{
|
||||
public static List<TartaricForgeRecipe> soulForgeList = null;
|
||||
public static List<AlchemyTableRecipe> alchemyTableList = null;
|
||||
public static BiMap<List<ItemStackWrapper>, AltarRecipeRegistry.AltarRecipe> altarBiMap = null;
|
||||
|
||||
|
||||
static {
|
||||
try {
|
||||
soulForgeList = ReflectionHelper.getStaticObject(TartaricForgeRecipeRegistry.class, "recipeList");
|
||||
alchemyTableList = ReflectionHelper.getStaticObject(AlchemyTableRecipeRegistry.class, "recipeList");
|
||||
altarBiMap = ReflectionHelper.getStaticObject(AltarRecipeRegistry.class, "recipes");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
private BloodMagicHelper(){}
|
||||
}
|
|
@ -1,239 +0,0 @@
|
|||
package modtweaker.mods.bloodmagic.handlers;
|
||||
|
||||
import WayofTime.bloodmagic.api.recipe.AlchemyTableRecipe;
|
||||
import WayofTime.bloodmagic.compat.jei.alchemyTable.AlchemyTableRecipeJEI;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.*;
|
||||
import modtweaker.JEIAddonPlugin;
|
||||
import modtweaker.mods.bloodmagic.BloodMagicHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.*;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.*;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.bloodmagic.AlchemyTable")
|
||||
public class AlchemyTable {
|
||||
|
||||
protected static final String name = "Blood Magic Alchemy Table";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, int lpDrained, int ticksRequired, int tierRequired, IIngredient[] input) {
|
||||
if(output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
} else if(lpDrained < 0) {
|
||||
LogHelper.logWarning(String.format("LP drained can't be below 0 (%d) for %s Recipe", lpDrained, name));
|
||||
return;
|
||||
} else if(ticksRequired < 0) {
|
||||
LogHelper.logWarning(String.format("Ticks required can't be below 0 (%d) for %s Recipe", ticksRequired, name));
|
||||
return;
|
||||
} else if(tierRequired < 1) {
|
||||
LogHelper.logWarning(String.format("Tier required can't be below 1 (%d) for %s Recipe", tierRequired, name));
|
||||
return;
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(new AlchemyTableRecipe(toStack(output), lpDrained, ticksRequired, tierRequired, toObjects(input)), BloodMagicHelper.alchemyTableList));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<AlchemyTableRecipe> {
|
||||
|
||||
public Add(AlchemyTableRecipe recipe, List<AlchemyTableRecipe> list) {
|
||||
super(AlchemyTable.name, list);
|
||||
this.recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if(recipes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(AlchemyTableRecipe recipe : recipes) {
|
||||
if(recipe != null) {
|
||||
if(list.add(recipe)) {
|
||||
successful.add(recipe);
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new AlchemyTableRecipeJEI(recipe));
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error adding %s Recipe for %s", name, getRecipeInfo(recipe)));
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error adding %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if(this.successful.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(AlchemyTableRecipe recipe : successful) {
|
||||
if(recipe != null) {
|
||||
if(!list.remove(recipe)) {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe for %s", name, this.getRecipeInfo(recipe)));
|
||||
} else {
|
||||
List<AlchemyTableRecipeJEI> wrappers = JEIAddonPlugin.recipeRegistry.getRecipeWrappers(JEIAddonPlugin.recipeRegistry.getRecipeCategories(Arrays.asList("BloodMagic:salchemyTable")).get(0));
|
||||
final AlchemyTableRecipeJEI[] recipeToRemove = {null};
|
||||
wrappers.forEach(wrap -> {
|
||||
ArrayList<Object> wrapperStacks = wrap.getRecipe().getInput();
|
||||
int size = recipe.getInput().size();
|
||||
if(wrapperStacks.size() == size) {
|
||||
boolean valid = true;
|
||||
for(int i = 0; i < size; i++) {
|
||||
if(wrapperStacks.get(i) instanceof ItemStack) {
|
||||
ItemStack wrapperStack = (ItemStack) wrapperStacks.get(i);
|
||||
ItemStack recipeStack = (ItemStack) recipe.getInput().get(i);
|
||||
if(!wrapperStack.isItemEqual(recipeStack)) {
|
||||
valid = false;
|
||||
}
|
||||
} else {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
if(valid) {
|
||||
recipeToRemove[0] = wrap;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(recipeToRemove[0]);
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(AlchemyTableRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutput(null));
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
remove(output, BloodMagicHelper.alchemyTableList);
|
||||
}
|
||||
|
||||
public static void remove(IIngredient output, List<AlchemyTableRecipe> list) {
|
||||
if(output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
List<AlchemyTableRecipe> recipes = new LinkedList<>();
|
||||
|
||||
for(AlchemyTableRecipe recipe : list) {
|
||||
ItemStack stack = null;
|
||||
try {
|
||||
stack = (ItemStack) getField(recipe.getClass(), "output").get(recipe);
|
||||
} catch(IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(matches(output, toIItemStack(stack))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(list, recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for output %s. Command ignored!", AlchemyTable.name, output.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Field getField(Class<?> clazz, String name) {
|
||||
Field field = null;
|
||||
while(clazz != null && field == null) {
|
||||
try {
|
||||
field = clazz.getDeclaredField(name);
|
||||
} catch(Exception e) {
|
||||
}
|
||||
clazz = clazz.getSuperclass();
|
||||
}
|
||||
if(field != null)
|
||||
field.setAccessible(true);
|
||||
return field;
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<AlchemyTableRecipe> {
|
||||
|
||||
public Remove(List<AlchemyTableRecipe> list, List<AlchemyTableRecipe> recipes) {
|
||||
super(AlchemyTable.name, list, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if(recipes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for(AlchemyTableRecipe recipe : this.recipes) {
|
||||
if(recipe != null) {
|
||||
if(this.list.remove(recipe)) {
|
||||
successful.add(recipe);
|
||||
List<AlchemyTableRecipeJEI> wrappers = JEIAddonPlugin.recipeRegistry.getRecipeWrappers(JEIAddonPlugin.recipeRegistry.getRecipeCategories(Arrays.asList("BloodMagic:salchemyTable")).get(0));
|
||||
final AlchemyTableRecipeJEI[] recipeToRemove = {null};
|
||||
wrappers.forEach(wrap -> {
|
||||
ArrayList<Object> wrapperStacks = wrap.getRecipe().getInput();
|
||||
int size = recipe.getInput().size();
|
||||
if(wrapperStacks.size() == size) {
|
||||
boolean valid = true;
|
||||
for(int i = 0; i < size; i++) {
|
||||
if(wrapperStacks.get(i) instanceof ItemStack) {
|
||||
ItemStack wrapperStack = (ItemStack) wrapperStacks.get(i);
|
||||
ItemStack recipeStack = (ItemStack) recipe.getInput().get(i);
|
||||
if(!wrapperStack.isItemEqual(recipeStack)) {
|
||||
valid = false;
|
||||
}
|
||||
} else {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
if(valid) {
|
||||
recipeToRemove[0] = wrap;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(recipeToRemove[0]);
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe for %s", name, getRecipeInfo(recipe)));
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if (successful.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (AlchemyTableRecipe recipe : successful) {
|
||||
if (recipe != null) {
|
||||
if (!list.add(recipe)) {
|
||||
LogHelper.logError(String.format("Error restoring %s Recipe for %s", name, getRecipeInfo(recipe)));
|
||||
}else{
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new AlchemyTableRecipeJEI(recipe));
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error restoring %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(AlchemyTableRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutput(null));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,251 +0,0 @@
|
|||
package modtweaker.mods.bloodmagic.handlers;
|
||||
|
||||
import WayofTime.bloodmagic.api.*;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
|
||||
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
|
||||
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry.AltarRecipe;
|
||||
import WayofTime.bloodmagic.compat.jei.altar.AltarRecipeJEI;
|
||||
import com.blamejared.mtlib.helpers.*;
|
||||
import com.blamejared.mtlib.utils.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.*;
|
||||
import modtweaker.JEIAddonPlugin;
|
||||
import modtweaker.mods.bloodmagic.BloodMagicHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeModContainer;
|
||||
import stanhebben.zenscript.annotations.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.*;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.bloodmagic.Altar")
|
||||
public class Altar
|
||||
{
|
||||
protected static final String name = "Blood Magic Altar";
|
||||
|
||||
private static final EnumAltarTier[] altarTiers = EnumAltarTier.values();
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, int minTier, int syphon, int consumeRate, int drainRate, IItemStack[] input)
|
||||
{
|
||||
if (output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
else if(minTier <= 0 || minTier > altarTiers.length)
|
||||
{
|
||||
LogHelper.logWarning(String.format("Invalid altar tier (%d) required for %s Recipe", minTier, Altar.name));
|
||||
return;
|
||||
}
|
||||
else if(syphon < 0)
|
||||
{
|
||||
LogHelper.logWarning(String.format("Syphon can't be below 0 (%d) for %s Recipe", syphon, Altar.name));
|
||||
return;
|
||||
}
|
||||
else if(consumeRate < 0)
|
||||
{
|
||||
LogHelper.logWarning(String.format("Consume rate can't be below 0 (%d) for %s Recipe", consumeRate, Altar.name));
|
||||
return;
|
||||
}
|
||||
else if(drainRate < 0)
|
||||
{
|
||||
LogHelper.logWarning(String.format("Drain rate can't be below 0 (%d) for %s Recipe", drainRate, Altar.name));
|
||||
return;
|
||||
}
|
||||
|
||||
List<ItemStack> inputs = Arrays.asList(toStacks(input));
|
||||
AltarRecipeRegistry.AltarRecipe temp = new AltarRecipeRegistry.AltarRecipe(inputs, toStack(output), altarTiers[minTier-1], syphon, consumeRate, drainRate);
|
||||
MineTweakerAPI.apply(new Add(temp.getInput(), temp, BloodMagicHelper.altarBiMap));
|
||||
}
|
||||
|
||||
private static class Add extends BaseMapAddition<List<ItemStackWrapper>, AltarRecipe>
|
||||
{
|
||||
public Add(List<ItemStackWrapper> inputs, AltarRecipe altarRecipe, Map<List<ItemStackWrapper>, AltarRecipe> map)
|
||||
{
|
||||
super(Altar.name, map);
|
||||
this.recipes.put(inputs, altarRecipe);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if(recipes.isEmpty())
|
||||
return;
|
||||
|
||||
for(Entry<List<ItemStackWrapper>, AltarRecipe> entry : recipes.entrySet()) {
|
||||
List<ItemStackWrapper> key = entry.getKey();
|
||||
AltarRecipe value = entry.getValue();
|
||||
AltarRecipe oldValue = map.put(key, value);
|
||||
|
||||
if(oldValue != null) {
|
||||
LogHelper.logWarning(String.format("Overwritten %s Recipe for %s", name, getRecipeInfo( new AbstractMap.SimpleEntry<List<ItemStackWrapper>, AltarRecipe>(entry.getKey(), value))));
|
||||
overwritten.put(key, oldValue);
|
||||
}
|
||||
|
||||
successful.put(key, value);
|
||||
List input = ItemStackWrapper.toStackList(value.getInput());
|
||||
ItemStack output = (value).getOutput();
|
||||
int requiredTier = (value).getMinTier().toInt();
|
||||
int requiredLP = (value).getSyphon();
|
||||
int consumptionRate = (value).getConsumeRate();
|
||||
int drainRate = (value).getDrainRate();
|
||||
if(output.getItem() == ForgeModContainer.getInstance().universalBucket && requiredLP == 1000) {
|
||||
output = BloodMagicAPI.getLifeEssenceBucket();
|
||||
}
|
||||
|
||||
AltarRecipeJEI recipe = new AltarRecipeJEI(input, output, requiredTier, requiredLP, consumptionRate, drainRate);
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if(successful.isEmpty() && overwritten.isEmpty())
|
||||
return;
|
||||
|
||||
for(Entry<List<ItemStackWrapper>, AltarRecipe> entry : successful.entrySet()) {
|
||||
List<ItemStackWrapper> key = entry.getKey();
|
||||
AltarRecipe value = map.remove(key);
|
||||
|
||||
if(value == null) {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe: null object", name));
|
||||
}else {
|
||||
successful.put(key, value);
|
||||
List<AltarRecipeJEI> list = JEIAddonPlugin.recipeRegistry.getRecipeWrappers(JEIAddonPlugin.recipeRegistry.getRecipeCategories(Arrays.asList("BloodMagic:altar")).get(0));
|
||||
final AltarRecipeJEI[] recipe = {null};
|
||||
list.forEach(rec -> {
|
||||
ItemStack input = ((List<ItemStack>) ReflectionHelper.getFinalObject(rec, "input")).get(0);
|
||||
ItemStack output = ReflectionHelper.getFinalObject(rec, "output");
|
||||
if(input.isItemEqual(value.getInput().get(0).toStack()) && output.isItemEqual(value.getOutput())) {
|
||||
recipe[0] = rec;
|
||||
}
|
||||
});
|
||||
if(recipe[0] != null)
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(recipe[0]);
|
||||
}
|
||||
}
|
||||
|
||||
for(Entry<List<ItemStackWrapper>, AltarRecipe> entry : overwritten.entrySet()) {
|
||||
List<ItemStackWrapper> key = entry.getKey();
|
||||
AltarRecipe value = entry.getValue();
|
||||
AltarRecipe oldValue = map.put(key, value);
|
||||
|
||||
if(oldValue != null) {
|
||||
LogHelper.logWarning(String.format("Overwritten %s Recipe which should not exist for %s", name, getRecipeInfo(new AbstractMap.SimpleEntry<List<ItemStackWrapper>, AltarRecipe>(entry.getKey(), value))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<List<ItemStackWrapper>, AltarRecipe> recipe)
|
||||
{
|
||||
ItemStack output = ReflectionHelper.getFinalObject(recipe.getValue(), "output");
|
||||
return LogHelper.getStackDescription(output);
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output)
|
||||
{
|
||||
remove(output, BloodMagicHelper.altarBiMap);
|
||||
}
|
||||
|
||||
public static void remove(IIngredient output, Map<List<ItemStackWrapper>, AltarRecipe> map)
|
||||
{
|
||||
if (output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
Map<List<ItemStackWrapper>, AltarRecipe> recipes = new HashMap<>();
|
||||
|
||||
for(AltarRecipe altarRecipe : map.values())
|
||||
{
|
||||
ItemStack recipeOutput = ReflectionHelper.getFinalObject(altarRecipe, "output");
|
||||
if(matches(output, toIItemStack(recipeOutput))) {
|
||||
recipes.put(altarRecipe.getInput(), altarRecipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty())
|
||||
{
|
||||
MineTweakerAPI.apply(new Remove(map, recipes));
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for output %s. Command ignored!", Altar.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseMapRemoval<List<ItemStackWrapper>, AltarRecipe>
|
||||
{
|
||||
public Remove(Map<List<ItemStackWrapper>, AltarRecipe> map, Map<List<ItemStackWrapper>, AltarRecipe> inputs)
|
||||
{
|
||||
super(Altar.name, map, inputs);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if(recipes.isEmpty())
|
||||
return;
|
||||
|
||||
for(List<ItemStackWrapper> key : recipes.keySet()) {
|
||||
AltarRecipe oldValue = map.remove(key);
|
||||
if(oldValue != null) {
|
||||
successful.put(key, oldValue);
|
||||
List<AltarRecipeJEI> list = JEIAddonPlugin.recipeRegistry.getRecipeWrappers(JEIAddonPlugin.recipeRegistry.getRecipeCategories(Arrays.asList("BloodMagic:altar")).get(0));
|
||||
final AltarRecipeJEI[] recipe = {null};
|
||||
list.forEach(rec -> {
|
||||
ItemStack input = ((List<ItemStack>) ReflectionHelper.getFinalObject(rec, "input")).get(0);
|
||||
ItemStack output = ReflectionHelper.getFinalObject(rec, "output");
|
||||
if(input.isItemEqual(oldValue.getInput().get(0).toStack()) && output.isItemEqual(oldValue.getOutput())) {
|
||||
recipe[0] = rec;
|
||||
}
|
||||
});
|
||||
if(recipe[0] != null)
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(recipe[0]);
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe : null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if(successful.isEmpty())
|
||||
return;
|
||||
|
||||
for(Entry<List<ItemStackWrapper>, AltarRecipe> entry : successful.entrySet()) {
|
||||
if(entry != null) {
|
||||
AltarRecipe oldValue = map.put(entry.getKey(), entry.getValue());
|
||||
if(oldValue != null) {
|
||||
LogHelper.logWarning(String.format("Overwritten %s Recipe for %s while restoring.", name, getRecipeInfo(entry)));
|
||||
}else{
|
||||
List input = ItemStackWrapper.toStackList(entry.getValue().getInput());
|
||||
ItemStack output = (entry).getValue().getOutput();
|
||||
int requiredTier = (entry).getValue().getMinTier().toInt();
|
||||
int requiredLP = (entry).getValue().getSyphon();
|
||||
int consumptionRate = (entry).getValue().getConsumeRate();
|
||||
int drainRate = (entry).getValue().getDrainRate();
|
||||
if(output.getItem() == ForgeModContainer.getInstance().universalBucket && requiredLP == 1000) {
|
||||
output = BloodMagicAPI.getLifeEssenceBucket();
|
||||
}
|
||||
|
||||
AltarRecipeJEI recipe = new AltarRecipeJEI(input, output, requiredTier, requiredLP, consumptionRate, drainRate);
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<List<ItemStackWrapper>, AltarRecipe> recipe)
|
||||
{
|
||||
ItemStack output = ReflectionHelper.getFinalObject(recipe.getValue(), "output");
|
||||
return LogHelper.getStackDescription(output);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,160 +0,0 @@
|
|||
package modtweaker.mods.bloodmagic.handlers;
|
||||
|
||||
import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
|
||||
import WayofTime.bloodmagic.compat.jei.forge.TartaricForgeRecipeJEI;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseListAddition;
|
||||
import com.blamejared.mtlib.utils.BaseListRemoval;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker.mods.bloodmagic.BloodMagicHelper;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.*;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.bloodmagic.SoulForge")
|
||||
public class SoulForge
|
||||
{
|
||||
protected static final String name = "Blood Magic Soul Forge";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, double minimumSouls, double drain, IIngredient[] input)
|
||||
{
|
||||
MineTweakerAPI.apply(new Add(new TartaricForgeRecipe(toStack(output), minimumSouls, drain, toObjects(input)), BloodMagicHelper.soulForgeList));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<TartaricForgeRecipe> {
|
||||
public Add(TartaricForgeRecipe recipe, List<TartaricForgeRecipe> list) {
|
||||
super(SoulForge.name, list);
|
||||
this.recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if(recipes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(TartaricForgeRecipe recipe : recipes) {
|
||||
if(recipe != null) {
|
||||
if(list.add(recipe)) {
|
||||
successful.add(recipe);
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new TartaricForgeRecipeJEI(recipe));
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error adding %s Recipe for %s", name, getRecipeInfo(recipe)));
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error adding %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if(this.successful.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(TartaricForgeRecipe recipe : successful) {
|
||||
if(recipe != null) {
|
||||
if(!list.remove(recipe)) {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe for %s", name, this.getRecipeInfo(recipe)));
|
||||
}else{
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new TartaricForgeRecipeJEI(recipe));
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo(TartaricForgeRecipe recipe)
|
||||
{
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output)
|
||||
{
|
||||
remove(output, BloodMagicHelper.soulForgeList);
|
||||
}
|
||||
|
||||
public static void remove(IIngredient output, List<TartaricForgeRecipe> list) {
|
||||
if (output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
List<TartaricForgeRecipe> recipes = new LinkedList<>();
|
||||
|
||||
for(TartaricForgeRecipe recipe : list)
|
||||
{
|
||||
if(matches(output, toIItemStack(recipe.getRecipeOutput())))
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty())
|
||||
{
|
||||
MineTweakerAPI.apply(new Remove(list, recipes));
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for output %s. Command ignored!", SoulForge.name, output.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<TartaricForgeRecipe> {
|
||||
public Remove(List<TartaricForgeRecipe> list, List<TartaricForgeRecipe> recipes) {
|
||||
super(SoulForge.name, list, recipes);
|
||||
}
|
||||
@Override
|
||||
public void apply() {
|
||||
if (recipes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (TartaricForgeRecipe recipe : this.recipes) {
|
||||
if (recipe != null) {
|
||||
if (this.list.remove(recipe)) {
|
||||
|
||||
successful.add(recipe);
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new TartaricForgeRecipeJEI(recipe));
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe for %s", name, getRecipeInfo(recipe)));
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if (successful.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (TartaricForgeRecipe recipe : successful) {
|
||||
if (recipe != null) {
|
||||
if (!list.add(recipe)) {
|
||||
LogHelper.logError(String.format("Error restoring %s Recipe for %s", name, getRecipeInfo(recipe)));
|
||||
}else{
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new TartaricForgeRecipeJEI(recipe));
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error restoring %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected String getRecipeInfo(TartaricForgeRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package modtweaker.mods.botania;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker.mods.botania.handlers.*;
|
||||
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)));
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package modtweaker.mods.botania;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.KnowledgeType;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package modtweaker.mods.botania.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
package modtweaker.mods.botania.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StringHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
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);",
|
||||
//TODO CHECK THIS
|
||||
LogHelper.getStackDescription(recipe.getOutputs()),
|
||||
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()),
|
||||
//TODO CHECK THIS
|
||||
LogHelper.getStackDescription(new ItemStack(recipe.getOutputState().getBlock(), 1))));
|
||||
}
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package modtweaker.mods.botania.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
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));
|
||||
}
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseListAddition;
|
||||
import com.blamejared.mtlib.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;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toObjects;
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toStack;
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.*;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@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<>();
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StringHelper;
|
||||
import com.blamejared.mtlib.utils.BaseListAddition;
|
||||
import com.blamejared.mtlib.utils.BaseListRemoval;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.*;
|
||||
import com.blamejared.mtlib.utils.BaseListAddition;
|
||||
import com.blamejared.mtlib.utils.BaseListRemoval;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.mc1102.item.MCItemStack;
|
||||
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.RecipeElvenTrade;
|
||||
import vazkii.botania.client.integration.jei.elventrade.ElvenTradeRecipeWrapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toObjects;
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toStacks;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.botania.ElvenTrade")
|
||||
public class ElvenTrade {
|
||||
|
||||
protected static final String name = "Botania Eleven Trade";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack[] outputs, IIngredient[] input) {
|
||||
MineTweakerAPI.apply(new Add(new RecipeElvenTrade(InputHelper.toStacks(outputs), toObjects(input))));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipeElvenTrade> {
|
||||
public Add(RecipeElvenTrade recipe) {
|
||||
super(ElvenTrade.name, BotaniaAPI.elvenTradeRecipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
successful.forEach(rec ->{
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new ElvenTradeRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.apply();
|
||||
successful.forEach(rec ->{
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new ElvenTradeRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(RecipeElvenTrade recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutputs());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@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.getOutputs() != null && matches(output, toStacks(entry.getOutputs().toArray(new ItemStack[entry.getOutputs().size()])))) {
|
||||
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()));
|
||||
}
|
||||
|
||||
}
|
||||
public static IItemStack[] toStacks(ItemStack[] iIngredient) {
|
||||
ArrayList<IItemStack> stacks = new ArrayList<>();
|
||||
|
||||
for(ItemStack stack : iIngredient) {
|
||||
stacks.add(new MCItemStack(stack));
|
||||
}
|
||||
|
||||
return stacks.toArray(new IItemStack[stacks.size()]);
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<RecipeElvenTrade> {
|
||||
public Remove(List<RecipeElvenTrade> recipes) {
|
||||
super(ElvenTrade.name, BotaniaAPI.elvenTradeRecipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
successful.forEach(rec ->{
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new ElvenTradeRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.apply();
|
||||
successful.forEach(rec ->{
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new ElvenTradeRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(RecipeElvenTrade recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutputs());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,444 +0,0 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.recipes.ShapedRecipe;
|
||||
import minetweaker.mc1102.recipes.RecipeConverter;
|
||||
import modtweaker.mods.botania.BotaniaHelper;
|
||||
import modtweaker.mods.botania.lexicon.*;
|
||||
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.*;
|
||||
import vazkii.botania.api.recipe.*;
|
||||
import vazkii.botania.common.lexicon.page.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.*;
|
||||
|
||||
@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,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++)
|
||||
{
|
||||
//TODO test
|
||||
recipes.add(new RecipeElvenTrade(toStacks(outputs),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.isStringValidEntityName(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)));
|
||||
}
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseListAddition;
|
||||
import com.blamejared.mtlib.utils.BaseListRemoval;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.*;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
|
||||
@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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
package modtweaker.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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.helpers.StackHelper;
|
||||
import com.blamejared.mtlib.utils.BaseListAddition;
|
||||
import com.blamejared.mtlib.utils.BaseListRemoval;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.*;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipePureDaisy;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@ZenClass("mods.botania.PureDaisy")
|
||||
public class PureDaisy {
|
||||
|
||||
public static final String name = "Botania PureDaisy";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IIngredient blockInput, IItemStack blockOutput, @Optional int time) {
|
||||
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()).getDefaultState(), time);
|
||||
|
||||
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.getOutputState().getBlock(), 1));
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
List<RecipePureDaisy> recipes = new LinkedList<>();
|
||||
|
||||
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
IItemStack out = InputHelper.toIItemStack(new ItemStack(recipe.getOutputState().getBlock(), 1));
|
||||
|
||||
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.getOutputState().getBlock(), 1));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseListAddition;
|
||||
import com.blamejared.mtlib.utils.BaseListRemoval;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.*;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package modtweaker.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;
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
package modtweaker.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;
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package modtweaker.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;
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
package modtweaker.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;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package modtweaker.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;
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
package modtweaker.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;
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package modtweaker.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;
|
||||
}
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package modtweaker.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;
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package modtweaker.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;
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package modtweaker.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;
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package modtweaker.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;
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package modtweaker.mods.botania.lexicon.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LexiconCategoryLogger implements ICommandFunction{
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
List<LexiconCategory> categories=BotaniaAPI.getAllCategories();
|
||||
System.out.println("Categories: " + categories.size());
|
||||
for (LexiconCategory category : categories) {
|
||||
System.out.println("Category " + category.getUnlocalizedName());
|
||||
MineTweakerAPI.logCommand(category.getUnlocalizedName());
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package modtweaker.mods.botania.lexicon.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker.mods.botania.BotaniaHelper;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LexiconEntryLogger implements ICommandFunction{
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
LexiconCategory category=null;
|
||||
if(arguments.length>0)
|
||||
{
|
||||
category= BotaniaHelper.findCatagory(arguments[0]);
|
||||
if(category==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Category not found (" + arguments[0]+")");
|
||||
return;
|
||||
}
|
||||
}
|
||||
List<LexiconEntry> entries=BotaniaAPI.getAllEntries();
|
||||
System.out.println("Entries: " + entries.size());
|
||||
for (LexiconEntry entry : entries) {
|
||||
if(category==null || entry.category==category)
|
||||
{
|
||||
System.out.println("Entry " + entry.getUnlocalizedName());
|
||||
MineTweakerAPI.logCommand(entry.getUnlocalizedName());
|
||||
}
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package modtweaker.mods.botania.lexicon.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class LexiconKnowledgeTypesLogger implements ICommandFunction{
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
Set<String> types=BotaniaAPI.knowledgeTypes.keySet();
|
||||
System.out.println("Knowledge Types: " + types.size());
|
||||
for (String key : types) {
|
||||
System.out.println("Knowledge Type " + key);
|
||||
MineTweakerAPI.logCommand(key);
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package modtweaker.mods.botania.lexicon.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker.mods.botania.BotaniaHelper;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LexiconPageLogger implements ICommandFunction{
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
LexiconEntry entry=null;
|
||||
if(arguments.length>0)
|
||||
{
|
||||
entry= BotaniaHelper.findEntry(arguments[0]);
|
||||
if(entry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Entry not found (" + arguments[0]+")");
|
||||
return;
|
||||
}
|
||||
}
|
||||
List<LexiconEntry> entries;
|
||||
List<LexiconPage> pages=new ArrayList();
|
||||
if(entry!=null)
|
||||
pages.addAll(entry.pages);
|
||||
else
|
||||
for (LexiconEntry current_Entry : BotaniaAPI.getAllEntries())
|
||||
pages.addAll(current_Entry.pages);
|
||||
System.out.println("Pages: " + pages.size());
|
||||
|
||||
for (LexiconPage page : pages) {
|
||||
System.out.println("Page " + page.getUnlocalizedName() + " (" + page.getClass() + ")");
|
||||
MineTweakerAPI.logCommand(page.getUnlocalizedName() + " (" + page.getClass() + ")");
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package modtweaker.mods.chisel;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker.mods.chisel.handlers.Groups;
|
||||
|
||||
public class Chisel {
|
||||
public Chisel() {
|
||||
MineTweakerAPI.registerClass(Groups.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
package modtweaker.mods.chisel;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import team.chisel.api.carving.CarvingUtils;
|
||||
import team.chisel.api.carving.ICarvingGroup;
|
||||
import team.chisel.api.carving.ICarvingVariation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toStack;
|
||||
|
||||
public class ChiselHelper {
|
||||
|
||||
public static ICarvingGroup getGroup(String name) {
|
||||
return CarvingUtils.getChiselRegistry().getGroup(name);
|
||||
}
|
||||
|
||||
public static ICarvingGroup getGroup(IItemStack stack) {
|
||||
return CarvingUtils.getChiselRegistry().getGroup(toStack(stack));
|
||||
}
|
||||
|
||||
public static ICarvingVariation getVariation(IItemStack stack) {
|
||||
ICarvingGroup g = getGroup(stack);
|
||||
if (g != null) {
|
||||
for (ICarvingVariation v : g.getVariations()) {
|
||||
if (v.getStack().isItemEqual(toStack(stack))) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ICarvingVariation makeVariation(IItemStack stack) {
|
||||
Block block = Block.getBlockFromItem(toStack(stack).getItem());
|
||||
IBlockState state = block.getStateFromMeta(toStack(stack).getItemDamage());
|
||||
return CarvingUtils.getDefaultVariationFor(state, 0);
|
||||
}
|
||||
|
||||
public static ICarvingGroup makeGroup(String name) {
|
||||
return new CarvingGroup(name);
|
||||
}
|
||||
|
||||
public static boolean groupContainsVariation(ICarvingGroup group, ICarvingVariation variation) {
|
||||
for (ICarvingVariation otherVariation : group.getVariations()) {
|
||||
if (otherVariation.getStack().isItemEqual(variation.getStack())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class CarvingVariation implements ICarvingVariation {
|
||||
Block block;
|
||||
|
||||
public CarvingVariation(Block block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getBlockState() {
|
||||
return block.getDefaultState();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return new ItemStack(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 99;
|
||||
}
|
||||
}
|
||||
|
||||
static class CarvingGroup implements ICarvingGroup {
|
||||
private String name;
|
||||
private String sound;
|
||||
private String oreName;
|
||||
|
||||
private List<ICarvingVariation> variations = Lists.newArrayList();
|
||||
|
||||
public CarvingGroup(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<ICarvingVariation> getVariations() {
|
||||
return Lists.newArrayList(variations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addVariation(ICarvingVariation variation) {
|
||||
variations.add(variation);
|
||||
Collections.sort(variations, new Comparator<ICarvingVariation>() {
|
||||
|
||||
@Override
|
||||
public int compare(ICarvingVariation o1, ICarvingVariation o2) {
|
||||
return CarvingUtils.compare(o1, o2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeVariation(ICarvingVariation variation) {
|
||||
ICarvingVariation toRemove = null;
|
||||
for (ICarvingVariation v : variations) {
|
||||
if (v.getStack().isItemEqual(variation.getStack())) {
|
||||
toRemove = v;
|
||||
}
|
||||
}
|
||||
return toRemove == null ? false : variations.remove(toRemove);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSound() {
|
||||
return sound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSound(String sound) {
|
||||
this.sound = sound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOreName() {
|
||||
return oreName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOreName(String oreName) {
|
||||
this.oreName = oreName;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package modtweaker.mods.chisel.commands;
|
||||
|
||||
import com.blamejared.mtlib.commands.CommandLogger;
|
||||
import team.chisel.api.carving.CarvingUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
public class ChiselGroupLogger extends CommandLogger {
|
||||
|
||||
@Override
|
||||
public Collection<? extends String> getList() {
|
||||
return CarvingUtils.getChiselRegistry().getSortedGroupNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Chisel Groups";
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package modtweaker.mods.chisel.commands;
|
||||
|
||||
import com.blamejared.mtlib.commands.CommandLogger;
|
||||
import net.minecraft.item.Item;
|
||||
import team.chisel.api.carving.CarvingUtils;
|
||||
import team.chisel.api.carving.ICarvingVariation;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ChiselVariationLogger extends CommandLogger {
|
||||
|
||||
@Override
|
||||
public Collection<? extends String> getList() {
|
||||
List<String> var = new LinkedList<>();
|
||||
for(String s : CarvingUtils.getChiselRegistry().getSortedGroupNames()) {
|
||||
for(ICarvingVariation variation : CarvingUtils.getChiselRegistry().getGroup(s).getVariations()) {
|
||||
String stringedVariation = "<" + Item.REGISTRY.getNameForObject(Item.getItemFromBlock(variation.getBlock())) + ":" + variation.getStack().getItemDamage() + ">";
|
||||
stringedVariation += " " + s;
|
||||
System.out.println("Chisel Variation " + stringedVariation);
|
||||
var.add(stringedVariation);
|
||||
}
|
||||
}
|
||||
return var;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Chisel Variations";
|
||||
}
|
||||
}
|
|
@ -1,226 +0,0 @@
|
|||
package modtweaker.mods.chisel.handlers;
|
||||
|
||||
import minetweaker.*;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker.mods.chisel.ChiselHelper;
|
||||
import stanhebben.zenscript.annotations.*;
|
||||
import team.chisel.api.carving.*;
|
||||
|
||||
|
||||
@ZenClass("mods.chisel.Groups")
|
||||
public class Groups {
|
||||
|
||||
@ZenMethod
|
||||
public static void addVariation(String groupName, IItemStack stack) {
|
||||
ICarvingGroup group = ChiselHelper.getGroup(groupName);
|
||||
ICarvingVariation variation = ChiselHelper.makeVariation(stack);
|
||||
if(group == null) {
|
||||
MineTweakerAPI.getLogger().logError("Cannot find group " + groupName);
|
||||
return;
|
||||
}
|
||||
if(variation == null) {
|
||||
MineTweakerAPI.getLogger().logError("Can't create variation from " + stack);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new AddVariation(group, variation, stack.toString()));
|
||||
}
|
||||
|
||||
static class AddVariation implements IUndoableAction {
|
||||
|
||||
ICarvingGroup group;
|
||||
ICarvingVariation variation;
|
||||
String variationName;
|
||||
|
||||
public AddVariation(ICarvingGroup group, ICarvingVariation variation, String variationName) {
|
||||
this.group = group;
|
||||
this.variation = variation;
|
||||
this.variationName = variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
CarvingUtils.getChiselRegistry().addVariation(group.getName(), variation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return group != null && variation != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Variation: " + variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Variation: " + variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
CarvingUtils.getChiselRegistry().removeVariation(variation.getBlockState(), group.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void removeVariation(IItemStack stack) {
|
||||
ICarvingVariation variation = ChiselHelper.getVariation(stack);
|
||||
if(variation == null) {
|
||||
MineTweakerAPI.getLogger().logError("Can't find variation from " + stack);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new RemoveVariation(variation, stack.toString()));
|
||||
}
|
||||
|
||||
|
||||
static class RemoveVariation implements IUndoableAction {
|
||||
|
||||
ICarvingVariation variation;
|
||||
String variationName;
|
||||
ICarvingGroup group;
|
||||
|
||||
public RemoveVariation(ICarvingVariation variation, String variationName) {
|
||||
this.variation = variation;
|
||||
this.variationName = variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
group = CarvingUtils.getChiselRegistry().getGroup(variation.getStack());
|
||||
CarvingUtils.getChiselRegistry().removeVariation(variation.getBlockState(), group.getName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return group != null && variation != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Variation: " + variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Adding Variation: " + variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
CarvingUtils.getChiselRegistry().addVariation(group.getName(), variation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addGroup(String groupName) {
|
||||
ICarvingGroup group = ChiselHelper.getGroup(groupName);
|
||||
if(group != null) {
|
||||
MineTweakerAPI.getLogger().logError("Group already exists " + groupName);
|
||||
return;
|
||||
}
|
||||
group = ChiselHelper.makeGroup(groupName);
|
||||
MineTweakerAPI.apply(new AddGroup(group));
|
||||
}
|
||||
|
||||
static class AddGroup implements IUndoableAction {
|
||||
|
||||
ICarvingGroup group;
|
||||
|
||||
public AddGroup(ICarvingGroup group) {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
CarvingUtils.getChiselRegistry().addGroup(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return group != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Group: " + group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Group: " + group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
CarvingUtils.getChiselRegistry().removeGroup(group.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeGroup(String groupName) {
|
||||
ICarvingGroup group = ChiselHelper.getGroup(groupName);
|
||||
if(group == null) {
|
||||
MineTweakerAPI.getLogger().logError("Could not find group " + groupName);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new RemoveGroup(group));
|
||||
}
|
||||
|
||||
static class RemoveGroup implements IUndoableAction {
|
||||
|
||||
ICarvingGroup group;
|
||||
|
||||
public RemoveGroup(ICarvingGroup group) {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
CarvingUtils.getChiselRegistry().removeGroup(group.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return group != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Group: " + group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Adding Group: " + group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
CarvingUtils.getChiselRegistry().addGroup(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package modtweaker.mods.embers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker.mods.embers.handlers.Melter;
|
||||
import modtweaker.mods.embers.handlers.Mixer;
|
||||
import modtweaker.mods.embers.handlers.Stamper;
|
||||
|
||||
public class Embers {
|
||||
public Embers() {
|
||||
MineTweakerAPI.registerClass(Melter.class);
|
||||
MineTweakerAPI.registerClass(Stamper.class);
|
||||
MineTweakerAPI.registerClass(Mixer.class);
|
||||
}
|
||||
}
|
|
@ -1,183 +0,0 @@
|
|||
package modtweaker.mods.embers.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import minetweaker.api.oredict.IOreDictEntry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.*;
|
||||
import teamroots.embers.compat.jei.MeltingRecipeWrapper;
|
||||
import teamroots.embers.recipe.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.*;
|
||||
|
||||
@ZenClass("mods.embers.Melter")
|
||||
public class Melter {
|
||||
|
||||
public static String name = "Embers Melter";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, ILiquidStack outputOne, boolean matchMeta, boolean matchNBT) {
|
||||
MineTweakerAPI.apply(new Add(toStack(input), new ItemMeltingRecipe(toStack(input), toFluid(outputOne), matchMeta, matchNBT)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addOreRecipe(IOreDictEntry key, ILiquidStack outputOne, boolean matchMeta, boolean matchNBT) {
|
||||
MineTweakerAPI.apply(new AddOre(key.getName(), new ItemMeltingOreRecipe(key.getName(), toFluid(outputOne))));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(ILiquidStack fluid) {
|
||||
List<ItemStack> recipes = new ArrayList<>();
|
||||
List<String> oreRecipes = new ArrayList<>();
|
||||
if(fluid == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i = 0; i < RecipeRegistry.meltingRecipes.size(); i++) {
|
||||
if(((ItemMeltingRecipe) RecipeRegistry.meltingRecipes.values().toArray()[i]).getFluid().getFluid().getName().equals(toFluid(fluid).getFluid().getName())) {
|
||||
recipes.add(((ItemStack) RecipeRegistry.meltingRecipes.keySet().toArray()[i]));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < RecipeRegistry.meltingOreRecipes.size(); i++) {
|
||||
if(((ItemMeltingOreRecipe) RecipeRegistry.meltingOreRecipes.values().toArray()[i]).getFluid().getFluid().getName().equals(toFluid(fluid).getFluid().getName())) {
|
||||
oreRecipes.add(((String) RecipeRegistry.meltingOreRecipes.keySet().toArray()[i]));
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
Map<ItemStack, ItemMeltingRecipe> map = new HashMap<ItemStack, ItemMeltingRecipe>();
|
||||
for(int i = 0; i < recipes.size(); i++) {
|
||||
map.put(recipes.get(i), RecipeRegistry.meltingRecipes.get(recipes.get(i)));
|
||||
}
|
||||
MineTweakerAPI.apply(new Remove(map));
|
||||
} else if(!oreRecipes.isEmpty()) {
|
||||
Map<String, ItemMeltingOreRecipe> map = new HashMap<String, ItemMeltingOreRecipe>();
|
||||
for(int i = 0; i < oreRecipes.size(); i++) {
|
||||
map.put(oreRecipes.get(i), RecipeRegistry.meltingOreRecipes.get(oreRecipes.get(i)));
|
||||
}
|
||||
MineTweakerAPI.apply(new RemoveOre(map));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for output %s. Command ignored!", Melter.name, fluid.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class AddOre extends BaseMapAddition<String, ItemMeltingOreRecipe> {
|
||||
|
||||
public AddOre(String stack, ItemMeltingOreRecipe recipe) {
|
||||
super(Melter.name, RecipeRegistry.meltingOreRecipes);
|
||||
|
||||
this.recipes.put(stack, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
successful.forEach((stack, recipe) -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new MeltingRecipeWrapper(recipe));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
successful.forEach((stack, recipe) -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new MeltingRecipeWrapper(recipe));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<String, ItemMeltingOreRecipe> arg0) {
|
||||
return arg0.getValue().getOreName();
|
||||
}
|
||||
}
|
||||
|
||||
private static class Add extends BaseMapAddition<ItemStack, ItemMeltingRecipe> {
|
||||
|
||||
public Add(ItemStack stack, ItemMeltingRecipe recipe) {
|
||||
super(Melter.name, RecipeRegistry.meltingRecipes);
|
||||
this.recipes.put(stack, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
successful.forEach((stack, recipe) -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new MeltingRecipeWrapper(recipe));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
successful.forEach((stack, recipe) -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new MeltingRecipeWrapper(recipe));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<ItemStack, ItemMeltingRecipe> arg0) {
|
||||
return LogHelper.getStackDescription(arg0.getValue().getStack());
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseMapRemoval<ItemStack, ItemMeltingRecipe> {
|
||||
|
||||
public Remove(Map<ItemStack, ItemMeltingRecipe> recipes) {
|
||||
super(Melter.name, RecipeRegistry.meltingRecipes, recipes);
|
||||
}
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
successful.forEach((stack, recipe) -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new MeltingRecipeWrapper(recipe));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
successful.forEach((stack, recipe) -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new MeltingRecipeWrapper(recipe));
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<ItemStack, ItemMeltingRecipe> arg0) {
|
||||
return LogHelper.getStackDescription(arg0.getValue().getStack());
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveOre extends BaseMapRemoval<String, ItemMeltingOreRecipe> {
|
||||
|
||||
public RemoveOre(Map<String, ItemMeltingOreRecipe> recipes) {
|
||||
super(Melter.name, RecipeRegistry.meltingOreRecipes, recipes);
|
||||
}
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
successful.forEach((stack, recipe) -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new MeltingRecipeWrapper(recipe));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
successful.forEach((stack, recipe) -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new MeltingRecipeWrapper(recipe));
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<String, ItemMeltingOreRecipe> arg0) {
|
||||
return arg0.getValue().getOreName();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
package modtweaker.mods.embers.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import stanhebben.zenscript.annotations.*;
|
||||
import teamroots.embers.compat.jei.MixingRecipeWrapper;
|
||||
import teamroots.embers.recipe.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toFluid;
|
||||
|
||||
@ZenClass("mods.embers.Mixer")
|
||||
public class Mixer {
|
||||
|
||||
public static String name = "Embers Mixer";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack input1, ILiquidStack input2, ILiquidStack input3, ILiquidStack input4, ILiquidStack output) {
|
||||
ArrayList<FluidStack> fluids = new ArrayList<>();
|
||||
if(input1 != null) {
|
||||
fluids.add(toFluid(input1));
|
||||
}
|
||||
if(input2 != null) {
|
||||
fluids.add(toFluid(input2));
|
||||
}
|
||||
if(input3 != null) {
|
||||
fluids.add(toFluid(input3));
|
||||
}
|
||||
if(input4 != null) {
|
||||
fluids.add(toFluid(input4));
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(new FluidMixingRecipe(fluids.toArray(new FluidStack[fluids.size()]), toFluid(output))));
|
||||
}
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(ILiquidStack output) {
|
||||
List<FluidMixingRecipe> recipes = new ArrayList<>();
|
||||
|
||||
for(int i = 0; i < RecipeRegistry.mixingRecipes.size(); i++) {
|
||||
if(RecipeRegistry.mixingRecipes.get(i).output.getFluid().getName().equals(toFluid(output).getFluid().getName())) {
|
||||
recipes.add(RecipeRegistry.mixingRecipes.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
for(int i = 0; i < recipes.size(); i++) {
|
||||
MineTweakerAPI.apply(new Remove(recipes.get(i)));
|
||||
}
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for output %s. Command ignored!", Mixer.name, output.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<FluidMixingRecipe> {
|
||||
|
||||
public Add(FluidMixingRecipe recipe) {
|
||||
super(Mixer.name, RecipeRegistry.mixingRecipes);
|
||||
this.recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
successful.forEach(rec ->{
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new MixingRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
successful.forEach(rec ->{
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new MixingRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(FluidMixingRecipe arg0) {
|
||||
return LogHelper.getStackDescription(arg0.output);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<FluidMixingRecipe> {
|
||||
|
||||
public Remove(FluidMixingRecipe recipe) {
|
||||
super(Mixer.name, RecipeRegistry.mixingRecipes);
|
||||
this.recipes.remove(recipe);
|
||||
}
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
successful.forEach(rec ->{
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new MixingRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
successful.forEach(rec ->{
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new MixingRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected String getRecipeInfo(FluidMixingRecipe arg0) {
|
||||
return LogHelper.getStackDescription(arg0.output);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,199 +0,0 @@
|
|||
package modtweaker.mods.embers.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import minetweaker.api.oredict.IOreDictEntry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.*;
|
||||
import teamroots.embers.compat.jei.StampingRecipeWrapper;
|
||||
import teamroots.embers.item.EnumStampType;
|
||||
import teamroots.embers.recipe.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.*;
|
||||
|
||||
@ZenClass("mods.embers.Stamper")
|
||||
public class Stamper {
|
||||
|
||||
public static String name = "Embers Stamper";
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, ILiquidStack fluidInput, String stampType, IItemStack result, boolean matchMeta, boolean matchNBT) {
|
||||
MineTweakerAPI.apply(new Add(new ItemStampingRecipe(toStack(itemInput), toFluid(fluidInput), getStampFromString(stampType), toStack(result), matchMeta, matchNBT)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IOreDictEntry key, ILiquidStack fluidInput, String stampType, IItemStack result) {
|
||||
MineTweakerAPI.apply(new AddOre(new ItemStampingOreRecipe(key.getName(), toFluid(fluidInput), getStampFromString(stampType), toStack(result), false, false)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IItemStack item) {
|
||||
List<ItemStampingRecipe> recipes = new ArrayList<ItemStampingRecipe>();
|
||||
List<ItemStampingOreRecipe> oreRecipes = new ArrayList<ItemStampingOreRecipe>();
|
||||
|
||||
if(item == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i = 0; i < RecipeRegistry.stampingRecipes.size(); i++) {
|
||||
if(ItemStack.areItemsEqual(RecipeRegistry.stampingRecipes.get(i).result, toStack(item))) {
|
||||
recipes.add(RecipeRegistry.stampingRecipes.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < RecipeRegistry.stampingOreRecipes.size(); i++) {
|
||||
if(ItemStack.areItemsEqual(RecipeRegistry.stampingOreRecipes.get(i).result, toStack(item))) {
|
||||
oreRecipes.add(RecipeRegistry.stampingOreRecipes.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else if(!oreRecipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveOre(oreRecipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for output %s. Command ignored!", Stamper.name, item.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class AddOre extends BaseListAddition<ItemStampingOreRecipe> {
|
||||
|
||||
public AddOre(ItemStampingOreRecipe recipe) {
|
||||
super(Stamper.name, RecipeRegistry.stampingOreRecipes);
|
||||
|
||||
this.recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
successful.forEach(rec -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new StampingRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
successful.forEach(rec -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new StampingRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ItemStampingOreRecipe arg0) {
|
||||
return arg0.getOre();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class Add extends BaseListAddition<ItemStampingRecipe> {
|
||||
|
||||
public Add(ItemStampingRecipe recipe) {
|
||||
super(Stamper.name, RecipeRegistry.stampingRecipes);
|
||||
|
||||
this.recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
successful.forEach(rec -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new StampingRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
successful.forEach(rec -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new StampingRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ItemStampingRecipe arg0) {
|
||||
return LogHelper.getStackDescription(arg0.getStack());
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<ItemStampingRecipe> {
|
||||
|
||||
public Remove(List<ItemStampingRecipe> recipes) {
|
||||
super(Stamper.name, RecipeRegistry.stampingRecipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
successful.forEach(rec -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new StampingRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
successful.forEach(rec -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new StampingRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ItemStampingRecipe arg0) {
|
||||
return LogHelper.getStackDescription(arg0.getStack());
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveOre extends BaseListRemoval<ItemStampingOreRecipe> {
|
||||
|
||||
public RemoveOre(List<ItemStampingOreRecipe> recipes) {
|
||||
super(Stamper.name, RecipeRegistry.stampingOreRecipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
successful.forEach(rec -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new StampingRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
successful.forEach(rec -> {
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new StampingRecipeWrapper(rec));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ItemStampingOreRecipe arg0) {
|
||||
return arg0.getOre();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static EnumStampType getStampFromString(String string) {
|
||||
switch(string) {
|
||||
default:
|
||||
return EnumStampType.TYPE_NULL;
|
||||
case "flat":
|
||||
return EnumStampType.TYPE_FLAT;
|
||||
case "bar":
|
||||
return EnumStampType.TYPE_BAR;
|
||||
case "plate":
|
||||
return EnumStampType.TYPE_PLATE;
|
||||
case "null":
|
||||
return EnumStampType.TYPE_NULL;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package modtweaker.mods.extrautils;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker.mods.extrautils.handlers.Resonator;
|
||||
|
||||
public class ExtraUtilities {
|
||||
|
||||
|
||||
public ExtraUtilities() {
|
||||
MineTweakerAPI.registerClass(Resonator.class);
|
||||
}
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
package modtweaker.mods.extrautils.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.*;
|
||||
import com.blamejared.mtlib.utils.*;
|
||||
import com.rwtema.extrautils2.tile.TileResonator;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ZenClass("mods.extrautils.Resonator")
|
||||
public class Resonator {
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void add(IItemStack output, IItemStack input, int energy, boolean addOwnerTag) {
|
||||
MineTweakerAPI.apply(new Add(new TileResonator.ResonatorRecipe(InputHelper.toStack(input), InputHelper.toStack(output), energy, addOwnerTag)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IItemStack output) {
|
||||
List<TileResonator.ResonatorRecipe> removed = new ArrayList<>();
|
||||
TileResonator.resonatorRecipes.forEach(i -> {
|
||||
if(i.output.isItemEqual(InputHelper.toStack(output))) {
|
||||
removed.add(i);
|
||||
}
|
||||
});
|
||||
|
||||
if(!removed.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(removed));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", "Resonator", output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class Add extends BaseListAddition<TileResonator.ResonatorRecipe> {
|
||||
|
||||
protected Add(TileResonator.ResonatorRecipe recipe) {
|
||||
super("Resonator", TileResonator.resonatorRecipes, Arrays.asList(recipe));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
|
||||
successful.forEach(i -> {
|
||||
if(i.input.getItemDamage() != 32767 && i.input.getHasSubtypes()) {
|
||||
TileResonator.ResonatorRecipe.SpecificItems.add(new ItemStack(i.input.getItem(), 1, i.input.getItemDamage()));
|
||||
} else {
|
||||
TileResonator.ResonatorRecipe.WildCardItems.add(i.input.getItem());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
successful.forEach(i -> {
|
||||
if(i.input.getItemDamage() != 32767 && i.input.getHasSubtypes()) {
|
||||
TileResonator.ResonatorRecipe.SpecificItems.remove(new ItemStack(i.input.getItem(), 1, i.input.getItemDamage()));
|
||||
} else {
|
||||
TileResonator.ResonatorRecipe.WildCardItems.remove(i.input.getItem());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(TileResonator.ResonatorRecipe recipe) {
|
||||
return recipe.toString();
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<TileResonator.ResonatorRecipe> {
|
||||
|
||||
protected Remove(List<TileResonator.ResonatorRecipe> recipes) {
|
||||
super("Resonator", TileResonator.resonatorRecipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
successful.forEach(i -> {
|
||||
if(i.input.getItemDamage() != 32767 && i.input.getHasSubtypes()) {
|
||||
TileResonator.ResonatorRecipe.SpecificItems.remove(new ItemStack(i.input.getItem(), 1, i.input.getItemDamage()));
|
||||
} else {
|
||||
TileResonator.ResonatorRecipe.WildCardItems.remove(i.input.getItem());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
|
||||
successful.forEach(i -> {
|
||||
if(i.input.getItemDamage() != 32767 && i.input.getHasSubtypes()) {
|
||||
TileResonator.ResonatorRecipe.SpecificItems.add(new ItemStack(i.input.getItem(), 1, i.input.getItemDamage()));
|
||||
} else {
|
||||
TileResonator.ResonatorRecipe.WildCardItems.add(i.input.getItem());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(TileResonator.ResonatorRecipe recipe) {
|
||||
return recipe.toString();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package modtweaker.mods.forestry;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker.mods.forestry.handlers.*;
|
||||
|
||||
public class Forestry {
|
||||
|
||||
public Forestry() {
|
||||
MineTweakerAPI.registerClass(Fermenter.class);
|
||||
MineTweakerAPI.registerClass(Still.class);
|
||||
MineTweakerAPI.registerClass(Moistener.class);
|
||||
MineTweakerAPI.registerClass(Carpenter.class);
|
||||
MineTweakerAPI.registerClass(Squeezer.class);
|
||||
MineTweakerAPI.registerClass(Centrifuge.class);
|
||||
MineTweakerAPI.registerClass(ThermionicFabricator.class);
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
package modtweaker.mods.forestry;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseListAddition;
|
||||
import forestry.api.recipes.IForestryRecipe;
|
||||
import forestry.api.recipes.ICraftingProvider;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public abstract class ForestryListAddition<T extends IForestryRecipe> extends BaseListAddition<T> {
|
||||
private final ICraftingProvider manager;
|
||||
|
||||
protected ForestryListAddition(String name, ICraftingProvider manager) {
|
||||
super(name, new ArrayList(manager.recipes()));
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected abstract String getRecipeInfo(T recipe);
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (T recipe : recipes) {
|
||||
if (recipe != null) {
|
||||
if (manager.addRecipe(recipe)){
|
||||
successful.add(recipe);
|
||||
IRecipeWrapper wrapped = wrapRecipe(recipe);
|
||||
if (wrapped != null){
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(wrapped);
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error adding %s Recipe for %s", name, getRecipeInfo(recipe)));
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error adding %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void undo() {
|
||||
for (T recipe : successful) {
|
||||
if (recipe != null) {
|
||||
if (!manager.removeRecipe(recipe)) {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe for %s", name, this.getRecipeInfo(recipe)));
|
||||
}else{
|
||||
IRecipeWrapper wrapped = wrapRecipe(recipe);
|
||||
if (wrapped != null){
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(wrapped);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
package modtweaker.mods.forestry;
|
||||
|
||||
import forestry.api.recipes.ICraftingProvider;
|
||||
import forestry.api.recipes.IForestryRecipe;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseListRemoval;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ForestryListRemoval<T extends IForestryRecipe, C extends ICraftingProvider<T>> extends BaseListRemoval<T> {
|
||||
private final C craftingProvider;
|
||||
|
||||
public ForestryListRemoval(String name, C craftingProvider, List<T> recipes) {
|
||||
super(name, new ArrayList<T>(craftingProvider.recipes()), recipes);
|
||||
this.craftingProvider = craftingProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected abstract String getRecipeInfo(T recipe);
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (T recipe : recipes) {
|
||||
if (recipe != null) {
|
||||
if (craftingProvider.removeRecipe(recipe)) {
|
||||
successful.add(recipe);
|
||||
IRecipeWrapper wrapped = wrapRecipe(recipe);
|
||||
if (wrapped != null){
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(wrapped);
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe for %s", name, getRecipeInfo(recipe)));
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void undo() {
|
||||
for (T recipe : successful) {
|
||||
if (recipe != null) {
|
||||
if (!craftingProvider.addRecipe(recipe)) {
|
||||
LogHelper.logError(String.format("Error restoring %s Recipe for %s", name, getRecipeInfo(recipe)));
|
||||
}else{
|
||||
IRecipeWrapper wrapped = wrapRecipe(recipe);
|
||||
if (wrapped != null){
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(wrapped);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error restoring %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,166 +0,0 @@
|
|||
package modtweaker.mods.forestry.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import forestry.api.recipes.*;
|
||||
import forestry.core.recipes.ShapedRecipeCustom;
|
||||
import forestry.factory.recipes.jei.carpenter.CarpenterRecipeWrapper;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.*;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import modtweaker.mods.forestry.*;
|
||||
import modtweaker.mods.forestry.recipes.CarpenterRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.*;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.forestry.Carpenter")
|
||||
public class Carpenter {
|
||||
|
||||
public static final String name = "Forestry Carpenter";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds shaped recipe to Carpenter
|
||||
*
|
||||
* @param output recipe product
|
||||
* @param ingredients required ingredients
|
||||
* @param packagingTime amount of ticks per crafting operation
|
||||
* * @param fluidInput required mB of fluid (optional)
|
||||
* * @param box required box in top slot (optional)
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IIngredient[][] ingredients, int packagingTime, @Optional ILiquidStack fluidInput, @Optional IItemStack box) {
|
||||
MineTweakerAPI.apply(new Add(new CarpenterRecipe(packagingTime, toFluid(fluidInput), toStack(box), new ShapedRecipeCustom(toStack(output), toShapedObjects(ingredients)))));
|
||||
}
|
||||
|
||||
private static IItemStack[][] transform(IItemStack[] arr, int N) {
|
||||
int M = (arr.length + N - 1) / N;
|
||||
IItemStack[][] mat = new IItemStack[M][];
|
||||
int start = 0;
|
||||
for(int r = 0; r < M; r++) {
|
||||
int L = Math.min(N, arr.length - start);
|
||||
mat[r] = java.util.Arrays.copyOfRange(arr, start, start + L);
|
||||
start += L;
|
||||
}
|
||||
return mat;
|
||||
}
|
||||
|
||||
private static class Add extends ForestryListAddition<ICarpenterRecipe> {
|
||||
|
||||
public Add(ICarpenterRecipe recipe) {
|
||||
super(Carpenter.name, RecipeManagers.carpenterManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void apply() {
|
||||
// for(ICarpenterRecipe recipe : recipes) {
|
||||
// if(recipe != null) {
|
||||
// if(RecipeManagers.carpenterManager.addRecipe(recipe)) {
|
||||
// successful.add(recipe);
|
||||
// } else {
|
||||
// LogHelper.logError(String.format("Error adding %s Recipe for %s", name, getRecipeInfo(recipe)));
|
||||
// }
|
||||
// } else {
|
||||
// LogHelper.logError(String.format("Error removing %s Recipe: null object", name));
|
||||
// }
|
||||
// }
|
||||
// successful.forEach(ent -> {
|
||||
// if(!CarpenterRecipeManager.getRecipeFluids().contains(ent.getFluidResource().getFluid())) {
|
||||
// CarpenterRecipeManager.getRecipeFluids().add(ent.getFluidResource().getFluid());
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ICarpenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getCraftingGridRecipe().getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(ICarpenterRecipe recipe){
|
||||
return new CarpenterRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds shapeless recipe to Carpenter
|
||||
*
|
||||
* @param output recipe product
|
||||
* @param ingredients required ingredients
|
||||
* @param packagingTime amount of ticks per crafting operation
|
||||
** @param fluidInput required mB of fluid (optional)
|
||||
** @param box required box in top slot (optional)
|
||||
** @param remainingItems no idea (optional)
|
||||
*/
|
||||
//TODO
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes recipe from Carpenter
|
||||
*
|
||||
* @param output = recipe result
|
||||
* * @param fluidInput = required type of fluid (optional)
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output, @Optional IIngredient fluidInput) {
|
||||
List<ICarpenterRecipe> recipes = new LinkedList<ICarpenterRecipe>();
|
||||
|
||||
for(ICarpenterRecipe recipe : RecipeManagers.carpenterManager.recipes()) {
|
||||
if(recipe != null) {
|
||||
ItemStack recipeResult = recipe.getCraftingGridRecipe().getRecipeOutput();
|
||||
if(recipeResult != null && matches(output, toIItemStack(recipeResult))) {
|
||||
if(fluidInput != null) {
|
||||
if(matches(fluidInput, toILiquidStack(recipe.getFluidResource())))
|
||||
recipes.add(recipe);
|
||||
} else {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Carpenter.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends ForestryListRemoval<ICarpenterRecipe, ICarpenterManager> {
|
||||
|
||||
public Remove(List<ICarpenterRecipe> recipes) {
|
||||
super(Carpenter.name, RecipeManagers.carpenterManager, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
// successful.forEach(ent -> {
|
||||
// if(CarpenterRecipeManager.getRecipeFluids().contains(ent.getFluidResource().getFluid())) {
|
||||
// RecipeManagers.carpenterManager.removeRecipe()
|
||||
// CarpenterRecipeManager.getRecipeFluids().remove(ent.getFluidResource().getFluid());
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ICarpenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getCraftingGridRecipe().getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(ICarpenterRecipe recipe){
|
||||
return new CarpenterRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
package modtweaker.mods.forestry.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import forestry.api.recipes.*;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.*;
|
||||
import modtweaker.mods.forestry.*;
|
||||
import modtweaker.mods.forestry.recipes.CentrifugeRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.*;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
import forestry.factory.recipes.jei.centrifuge.*;
|
||||
|
||||
|
||||
@ZenClass("mods.forestry.Centrifuge")
|
||||
public class Centrifuge {
|
||||
|
||||
public static final String name = "Forestry Centrifuge";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds recipe to Centrifuge
|
||||
*
|
||||
* @param output recipe product
|
||||
* @param ingredients required ingredients
|
||||
* @param packagingTime amount of ticks per crafting operation
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(WeightedItemStack[] output, IItemStack ingredients, int packagingTime) {
|
||||
Map<ItemStack, Float> products = new HashMap<ItemStack, Float>();
|
||||
for(WeightedItemStack product : output) {
|
||||
products.put(toStack(product.getStack()), product.getChance());
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(new CentrifugeRecipe(packagingTime, toStack(ingredients), products)));
|
||||
}
|
||||
|
||||
private static class Add extends ForestryListAddition<ICentrifugeRecipe> {
|
||||
|
||||
public Add(ICentrifugeRecipe recipe) {
|
||||
super(Centrifuge.name, RecipeManagers.centrifugeManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ICentrifugeRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getInput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(ICentrifugeRecipe recipe){
|
||||
return new CentrifugeRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Centrifuge
|
||||
*
|
||||
* @param input type of item in input
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient input) {
|
||||
List<ICentrifugeRecipe> recipes = new LinkedList<ICentrifugeRecipe>();
|
||||
|
||||
for(ICentrifugeRecipe recipe : RecipeManagers.centrifugeManager.recipes()) {
|
||||
if(recipe != null && matches(input, toIItemStack(recipe.getInput()))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Centrifuge.name, input.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends ForestryListRemoval<ICentrifugeRecipe, ICentrifugeManager> {
|
||||
|
||||
public Remove(List<ICentrifugeRecipe> recipes) {
|
||||
super(Centrifuge.name, RecipeManagers.centrifugeManager, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ICentrifugeRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getInput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(ICentrifugeRecipe recipe){
|
||||
return new CentrifugeRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,182 +0,0 @@
|
|||
package modtweaker.mods.forestry.handlers;
|
||||
|
||||
import forestry.api.fuels.FermenterFuel;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.recipes.IFermenterManager;
|
||||
import forestry.api.recipes.IFermenterRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.factory.recipes.jei.fermenter.*;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import modtweaker.mods.forestry.*;
|
||||
import modtweaker.mods.forestry.recipes.FermenterRecipe;
|
||||
import com.blamejared.mtlib.utils.BaseMapAddition;
|
||||
import com.blamejared.mtlib.utils.BaseMapRemoval;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.*;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.forestry.Fermenter")
|
||||
public class Fermenter {
|
||||
|
||||
public static final String name = "Forestry Fermenter";
|
||||
public static final String nameFuel = name + " (Fuel)";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds recipe to fermenter
|
||||
* Amount of fluid output: fermentationValue * fluidOutputModifier
|
||||
* Note: the actual consumption of fluid input depends on the fermentation fuel
|
||||
*
|
||||
* @param fluidOutput type of fluid produced
|
||||
* @param resource organic item
|
||||
* @param fluidInput type of fluid required in input
|
||||
* @param fermentationValue amount of inputFluid on organic item requires
|
||||
* @param fluidOutputModifier Output multiplier (this is usually a from the input fluid)
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluidOutput, IItemStack resource, ILiquidStack fluidInput, int fermentationValue, float fluidOutputModifier) {
|
||||
MineTweakerAPI.apply(new Add(new FermenterRecipe(toStack(resource), fermentationValue, fluidOutputModifier, getFluid(fluidOutput), toFluid(fluidInput))));
|
||||
}
|
||||
|
||||
private static class Add extends ForestryListAddition<IFermenterRecipe> {
|
||||
public Add(IFermenterRecipe recipe) {
|
||||
super(Fermenter.name, RecipeManagers.fermenterManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFermenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(IFermenterRecipe recipe){
|
||||
return new FermenterRecipeWrapper(recipe, recipe.getResource());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes recipe from Fermenter
|
||||
*
|
||||
* @param input type of item in input
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient input) {
|
||||
List<IFermenterRecipe> recipes = new LinkedList<IFermenterRecipe>();
|
||||
|
||||
for(IFermenterRecipe recipe : RecipeManagers.fermenterManager.recipes()) {
|
||||
// check for input items
|
||||
if(recipe != null && recipe.getResource() != null && matches(input, toIItemStack(recipe.getResource()))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
// check for input liquids
|
||||
if(recipe != null && recipe.getResource() != null && matches(input, toILiquidStack(recipe.getFluidResource()))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Fermenter.name, input.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends ForestryListRemoval<IFermenterRecipe, IFermenterManager> {
|
||||
|
||||
public Remove(List<IFermenterRecipe> recipes) {
|
||||
super(Fermenter.name, RecipeManagers.fermenterManager, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(IFermenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(IFermenterRecipe recipe){
|
||||
return new FermenterRecipeWrapper(recipe, recipe.getResource());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds fermenter fuel
|
||||
* Note: the actual consumption of fluid input depends on the fermentation fuel
|
||||
*
|
||||
* @param item Item that is a valid fuel for the fermenter
|
||||
* @param fermentPerCycle How much is fermented per work cycle, i.e. how much fluid of the input is consumed.
|
||||
* @param burnDuration Amount of work cycles a single item of this fuel lasts before expiring.
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addFuel(IItemStack item, int fermentPerCycle, int burnDuration) {
|
||||
MineTweakerAPI.apply(new AddFuel(new FermenterFuel(toStack(item), fermentPerCycle, burnDuration)));
|
||||
}
|
||||
|
||||
private static class AddFuel extends BaseMapAddition<ItemStack, FermenterFuel> {
|
||||
public AddFuel(FermenterFuel fuelEntry) {
|
||||
super(Fermenter.nameFuel, FuelManager.fermenterFuel);
|
||||
recipes.put(fuelEntry.getItem(), fuelEntry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<ItemStack, FermenterFuel> fuelEntry) {
|
||||
return LogHelper.getStackDescription(fuelEntry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes fermenter fuel
|
||||
*
|
||||
* @param fermenterItem Item that is a valid fuel for the fermenter
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void removeFuel(IIngredient fermenterItem) {
|
||||
Map<ItemStack, FermenterFuel> fuelItems = new HashMap<ItemStack, FermenterFuel>();
|
||||
|
||||
for(Entry<ItemStack, FermenterFuel> fuelItem : FuelManager.fermenterFuel.entrySet()) {
|
||||
if(fuelItem != null && matches(fermenterItem, toIItemStack(fuelItem.getValue().getItem()))) {
|
||||
fuelItems.put(fuelItem.getKey(), fuelItem.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if(!fuelItems.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveFuel(fuelItems));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Fermenter.name, fermenterItem.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveFuel extends BaseMapRemoval<ItemStack, FermenterFuel> {
|
||||
public RemoveFuel(Map<ItemStack, FermenterFuel> recipes) {
|
||||
super(Fermenter.nameFuel, FuelManager.fermenterFuel, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<ItemStack, FermenterFuel> fuelEntry) {
|
||||
return LogHelper.getStackDescription(fuelEntry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,164 +0,0 @@
|
|||
package modtweaker.mods.forestry.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.*;
|
||||
import forestry.api.fuels.*;
|
||||
import forestry.api.recipes.*;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.*;
|
||||
import modtweaker.mods.forestry.*;
|
||||
import modtweaker.mods.forestry.recipes.MoistenerRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.*;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.forestry.Moistener")
|
||||
public class Moistener {
|
||||
|
||||
public static final String name = "Forestry Moistener";
|
||||
public static final String nameFuel = name + " (Fuel)";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds recipe to Moistener
|
||||
*
|
||||
* @param output recipe product
|
||||
* @param input required item
|
||||
* @param packagingTime amount of ticks per crafting operation
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input, int packagingTime) {
|
||||
MineTweakerAPI.apply(new Add(new MoistenerRecipe(toStack(input), toStack(output), packagingTime)));
|
||||
}
|
||||
|
||||
private static class Add extends ForestryListAddition<IMoistenerRecipe> {
|
||||
public Add(IMoistenerRecipe recipe) {
|
||||
super(Moistener.name, RecipeManagers.moistenerManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IMoistenerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getProduct());
|
||||
}
|
||||
|
||||
//It's not clear to me how the moistener recipes should be wrapped
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(IMoistenerRecipe recipe){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes recipe from Fermenter
|
||||
*
|
||||
* @param output recipe product
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
List<IMoistenerRecipe> recipes = new LinkedList<IMoistenerRecipe>();
|
||||
for (IMoistenerRecipe recipe : RecipeManagers.moistenerManager.recipes()) {
|
||||
if (recipe != null && recipe.getProduct() != null && matches(output, toIItemStack(recipe.getProduct()))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Moistener.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends ForestryListRemoval<IMoistenerRecipe, IMoistenerManager> {
|
||||
public Remove(List<IMoistenerRecipe> recipes) {
|
||||
super(Moistener.name, RecipeManagers.moistenerManager, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IMoistenerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getProduct());
|
||||
}
|
||||
|
||||
//It's not clear to me how the moistener recipes should be wrapped
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(IMoistenerRecipe recipe){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds Moistener fuel
|
||||
*
|
||||
* @param item The item to use
|
||||
* @param product The item that leaves the moistener's working slot (i.e. mouldy wheat, decayed wheat, mulch)
|
||||
* @param moistenerValue How much this item contributes to the final product of the moistener (i.e. mycelium)
|
||||
* @param stage What stage this product represents. Resources with lower stage value will be consumed first. (First Stage is 0)
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addFuel(IItemStack item, IItemStack product, int moistenerValue, int stage) {
|
||||
if(stage >= 0) {
|
||||
MineTweakerAPI.apply(new AddFuel(new MoistenerFuel(toStack(item), toStack(product), moistenerValue, stage)));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe add for %s. Stage parameter must positive!", Moistener.name, item.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class AddFuel extends BaseMapAddition<ItemStack, MoistenerFuel> {
|
||||
public AddFuel(MoistenerFuel fuelEntry) {
|
||||
super(Moistener.nameFuel, FuelManager.moistenerResource);
|
||||
recipes.put(fuelEntry.getItem(), fuelEntry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<ItemStack, MoistenerFuel> fuelEntry) {
|
||||
return LogHelper.getStackDescription(fuelEntry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes Moistener fuel.
|
||||
*
|
||||
* @param moistenerItem Item that is a valid fuel for the moistener
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void removeFuel(IIngredient moistenerItem) {
|
||||
Map<ItemStack, MoistenerFuel> fuelItems = new HashMap<ItemStack, MoistenerFuel>();
|
||||
|
||||
for(Entry<ItemStack, MoistenerFuel> fuelItem : FuelManager.moistenerResource.entrySet()) {
|
||||
if(fuelItem != null && matches(moistenerItem, toIItemStack(fuelItem.getValue().getItem()))) {
|
||||
fuelItems.put(fuelItem.getKey(), fuelItem.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if(!fuelItems.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveFuel(fuelItems));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Moistener.name, moistenerItem.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveFuel extends BaseMapRemoval<ItemStack, MoistenerFuel> {
|
||||
public RemoveFuel(Map<ItemStack, MoistenerFuel> recipes) {
|
||||
super(Moistener.nameFuel, FuelManager.moistenerResource, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<ItemStack, MoistenerFuel> fuelEntry) {
|
||||
return LogHelper.getStackDescription(fuelEntry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,123 +0,0 @@
|
|||
package modtweaker.mods.forestry.handlers;
|
||||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import forestry.api.recipes.*;
|
||||
import forestry.factory.recipes.jei.squeezer.*;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.*;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import minetweaker.mc1102.item.MCItemStack;
|
||||
import modtweaker.mods.forestry.*;
|
||||
import modtweaker.mods.forestry.recipes.SqueezerRecipe;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.*;
|
||||
import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.forestry.Squeezer")
|
||||
public class Squeezer {
|
||||
|
||||
public static final String name = "Forestry Squeezer";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds recipe to Squeezer
|
||||
*
|
||||
* @param fluidOutput recipe fluid amount
|
||||
* @param ingredients recipe ingredients
|
||||
* @param timePerItem time per crafting operation
|
||||
* * @param itemOutput recipe output (optional)
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluidOutput, IItemStack[] ingredients, int timePerItem, @Optional WeightedItemStack itemOutput) {
|
||||
if(itemOutput == null) {
|
||||
itemOutput = new WeightedItemStack(new MCItemStack(new ItemStack(Blocks.AIR)), 0);
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(new SqueezerRecipe(timePerItem, toStacks(ingredients), toFluid(fluidOutput), toStack(itemOutput.getStack()), itemOutput.getChance())));
|
||||
}
|
||||
|
||||
private static class Add extends ForestryListAddition<ISqueezerRecipe> {
|
||||
|
||||
public Add(ISqueezerRecipe recipe) {
|
||||
super(Squeezer.name, RecipeManagers.squeezerManager);
|
||||
recipes.add(recipe);
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new SqueezerRecipeWrapper(recipe));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(ISqueezerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getFluidOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(ISqueezerRecipe recipe){
|
||||
return new SqueezerRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Centrifuge
|
||||
*
|
||||
* @param liquid liquid output
|
||||
* * @param ingredients list of ingredients (optional)
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient liquid, @Optional IIngredient[] ingredients) {
|
||||
List<ISqueezerRecipe> recipes = new LinkedList<ISqueezerRecipe>();
|
||||
|
||||
for(ISqueezerRecipe r : RecipeManagers.squeezerManager.recipes()) {
|
||||
if(r != null && r.getFluidOutput() != null && matches(liquid, toILiquidStack(r.getFluidOutput()))) {
|
||||
// optional check for ingredients
|
||||
if(ingredients != null) {
|
||||
boolean matched = false;
|
||||
for(int i = 0; i < ingredients.length; i++) {
|
||||
if(matches(ingredients[i], toIItemStack(r.getResources()[i])))
|
||||
matched = true;
|
||||
else {
|
||||
matched = false;
|
||||
// if one ingredients doesn't match abort all further checks
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if some ingredient doesn't match, the last one is false
|
||||
if(matched)
|
||||
recipes.add(r);
|
||||
} else {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Squeezer.name, LogHelper.getStackDescription(liquid)));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends ForestryListRemoval<ISqueezerRecipe, ISqueezerManager> {
|
||||
|
||||
public Remove(List<ISqueezerRecipe> recipes) {
|
||||
super(Squeezer.name, RecipeManagers.squeezerManager, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(ISqueezerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getFluidOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(ISqueezerRecipe recipe){
|
||||
return new SqueezerRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue