mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-10-26 14:24:54 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
0cc3fa06c2
commit
655636b7e9
231 files changed
+10024
-8585
No files matched your search
+6
-6
@@ -6,12 +6,12 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
public class ExtendedCraftingManager {
|
||||
|
||||
public static final ExtendedCraftingManager getInstance() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public static final ExtendedCraftingManager getInstance() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public List<IRecipe> getRecipeList() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public List<IRecipe> getRecipeList() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
+15
-15
@@ -6,24 +6,24 @@ import net.minecraft.world.World;
|
||||
|
||||
public class ExtendedShapedRecipes implements IExtendedRecipe {
|
||||
|
||||
public ExtendedShapedRecipes(int width, int height, ItemStack[] recipe, ItemStack stack) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public ExtendedShapedRecipes(int width, int height, ItemStack[] recipe, ItemStack stack) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean matches(InventoryCrafting inventory, World world) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public boolean matches(InventoryCrafting inventory, World world) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventory) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventory) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public int getRecipeSize() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public int getRecipeSize() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public ItemStack getRecipeOutput() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public ItemStack getRecipeOutput() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
+15
-15
@@ -8,24 +8,24 @@ import net.minecraft.world.World;
|
||||
|
||||
public class ExtendedShapelessRecipes implements IExtendedRecipe {
|
||||
|
||||
public ExtendedShapelessRecipes(ItemStack output, List<ItemStack> input) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public ExtendedShapelessRecipes(ItemStack output, List<ItemStack> input) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean matches(InventoryCrafting inventory, World world) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public boolean matches(InventoryCrafting inventory, World world) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventory) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventory) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public int getRecipeSize() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public int getRecipeSize() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public ItemStack getRecipeOutput() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public ItemStack getRecipeOutput() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +1,43 @@
|
||||
package modtweaker2;
|
||||
|
||||
import static modtweaker2.helpers.LogHelper.print;
|
||||
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.minecraft.MineTweakerMC;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class ClientEvents {
|
||||
public static int cooldown;
|
||||
public static boolean active;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrawTooltip(ItemTooltipEvent event) {
|
||||
public static int cooldown;
|
||||
public static boolean active;
|
||||
|
||||
IPlayer player = MineTweakerMC.getIPlayer(event.entityPlayer);
|
||||
if (player != null) {
|
||||
IItemStack hand = MineTweakerMC.getIItemStack(event.itemStack);
|
||||
if (hand != null) {
|
||||
if (active) {
|
||||
@SubscribeEvent
|
||||
public void onDrawTooltip(ItemTooltipEvent event) {
|
||||
|
||||
String print = hand.toString();
|
||||
event.toolTip.add(print);
|
||||
if (GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSprint)) {
|
||||
if (cooldown <= 0) {
|
||||
cooldown = 30;
|
||||
print(print + " -- " + hand.getDisplayName());
|
||||
} else
|
||||
cooldown--;
|
||||
} else
|
||||
cooldown--;
|
||||
}
|
||||
IPlayer player = MineTweakerMC.getIPlayer(event.entityPlayer);
|
||||
if (player != null) {
|
||||
IItemStack hand = MineTweakerMC.getIItemStack(event.itemStack);
|
||||
if (hand != null) {
|
||||
if (active) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
String print = hand.toString();
|
||||
event.toolTip.add(print);
|
||||
if (GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSprint)) {
|
||||
if (cooldown <= 0) {
|
||||
cooldown = 30;
|
||||
print(print + " -- " + hand.getDisplayName());
|
||||
} else cooldown--;
|
||||
} else cooldown--;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,80 +30,174 @@ import modtweaker2.utils.TweakerPlugin;
|
||||
|
||||
public class Commands {
|
||||
|
||||
public static void registerCommands() {
|
||||
if (MineTweakerAPI.server != null) {
|
||||
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(
|
||||
"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() {
|
||||
|
||||
MineTweakerAPI.server.addMineTweakerCommand("entities", new String[] { "/minetweaker entities", " Outputs a list of entities class mapping keys and the entity IDs" }, new EntityMappingLogger());
|
||||
|
||||
if (TweakerPlugin.isLoaded("appliedenergistics2-core")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("appeng", new String[] {"/minetweaker appeng [HANDLER]", " Outputs a list of all Applied Energistics 2 recipes."}, new AppliedEnergisticsLogger());
|
||||
}
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
ClientEvents.active = !ClientEvents.active;
|
||||
}
|
||||
});
|
||||
|
||||
if (TweakerPlugin.isLoaded("aura")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("auras", new String[] { "/minetweaker auras", "Outputs a list of Aura Types" }, new AuraLogger());
|
||||
}
|
||||
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("Botania")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("lexiconCategories", new String[] { "/minetweaker lexiconCategories", " Outputs a list of lexicon categories" }, new LexiconCategoryLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand("lexiconPages", new String[] { "/minetweaker lexiconPages", "/minetweaker lexiconPages [ENTRY]", " Outputs a list of lexicon pages for the entry" }, new LexiconPageLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand("botaniaBrews", new String[] { "/minetweaker botaniaBrews", " Outputs a list of keys for botania brews" }, new BotaniaBrewLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand("lexiconKnowledgeTypes", new String[] { "/minetweaker lexiconKnowledgeTypes", " Outputs a list of keys for lexicon knowledge types" }, new LexiconKnowledgeTypesLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand("botaniaOrechid", new String[] { "/minetweaker botaniaOrechid", " Outputs a list of keys for botania orechid weights" }, new BotaniaOrechidLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand("botania", new String[] { "/minetweaker botania [HANDLER]", " Outputs a list of all Botania recipes." }, new BotaniaLogger());
|
||||
}
|
||||
if (TweakerPlugin.isLoaded("appliedenergistics2-core")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"appeng",
|
||||
new String[] { "/minetweaker appeng [HANDLER]",
|
||||
" Outputs a list of all Applied Energistics 2 recipes." },
|
||||
new AppliedEnergisticsLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("shadowfox_botany")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("treeCrafting", new String[] { "/minetweaker treeCrafting", " Outputs a list of all Botanical Addons Tree Crafting recipes." }, new BotanicalAddonsDendricLogger());
|
||||
}
|
||||
if (TweakerPlugin.isLoaded("aura")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"auras",
|
||||
new String[] { "/minetweaker auras", "Outputs a list of Aura Types" },
|
||||
new AuraLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("chisel")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("chiselGroups", new String[] { "/minetweaker chiselGroups", " Outputs a list of chisel groups" }, new ChiselGroupLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand("chiselVariations", new String[] { "/minetweaker chiselVariations", "/minetweaker chiselVariations [GROUP]", " Outputs a list of chisel variations" }, new ChiselVariationLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("exnihilo")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("exnihilo", new String[] {"/minetweaker exnihilo [HANDLER]", " Outputs a list of all ExNihilo recipes."}, new ExNihiloLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("factorization")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("factorization", new String[] {"/minetweaker factorization [HANDLER]", " Outputs a list of all Factorization recipes."}, new FactorizationLogger());
|
||||
}
|
||||
if (TweakerPlugin.isLoaded("Botania")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"lexiconCategories",
|
||||
new String[] { "/minetweaker lexiconCategories", " Outputs a list of lexicon categories" },
|
||||
new LexiconCategoryLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"lexiconPages",
|
||||
new String[] { "/minetweaker lexiconPages", "/minetweaker lexiconPages [ENTRY]",
|
||||
" Outputs a list of lexicon pages for the entry" },
|
||||
new LexiconPageLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"botaniaBrews",
|
||||
new String[] { "/minetweaker botaniaBrews", " Outputs a list of keys for botania brews" },
|
||||
new BotaniaBrewLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"lexiconKnowledgeTypes",
|
||||
new String[] { "/minetweaker lexiconKnowledgeTypes",
|
||||
" Outputs a list of keys for lexicon knowledge types" },
|
||||
new LexiconKnowledgeTypesLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"botaniaOrechid",
|
||||
new String[] { "/minetweaker botaniaOrechid",
|
||||
" Outputs a list of keys for botania orechid weights" },
|
||||
new BotaniaOrechidLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"botania",
|
||||
new String[] { "/minetweaker botania [HANDLER]", " Outputs a list of all Botania recipes." },
|
||||
new BotaniaLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("Mekanism")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("gases", new String[] { "/minetweaker gases", " Outputs a list of all gas names in the game to the minetweaker log" }, new GasLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand("mekanism", new String[] { "/minetweaker mekanism [HANDLER]", " Outputs a list of all Mekanism recipes." }, new MekanismLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("Railcraft")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("railcraft", new String[] {"/minetweaker railcraft [HANDLER]", " Outputs a list of all Railcraft recipes."}, new RailcraftLogger());
|
||||
}
|
||||
if (TweakerPlugin.isLoaded("shadowfox_botany")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"treeCrafting",
|
||||
new String[] { "/minetweaker treeCrafting",
|
||||
" Outputs a list of all Botanical Addons Tree Crafting recipes." },
|
||||
new BotanicalAddonsDendricLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("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", "/minetweaker chiselVariations [GROUP]",
|
||||
" Outputs a list of chisel variations" },
|
||||
new ChiselVariationLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("Thaumcraft")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("research", new String[] { "/minetweaker research", "/minetweaker research [CATEGORY]", " Outputs a list of all category names in the game to the minetweaker log," + " or outputs a list of all research keys in a category to the log." }, new ResearchLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand("aspectList", new String[] { "/minetweaker aspectList", " Outputs a list of all aspects registered to entities and items" }, new AspectLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("ThermalExpansion")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("thermalexpansion", new String[] {"/minetweaker thermalexpansion [HANDLER]", " Outputs a list of all Thermal Expansion recipes."}, new ThermalExpansionLogger());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (TweakerPlugin.isLoaded("exnihilo")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"exnihilo",
|
||||
new String[] { "/minetweaker exnihilo [HANDLER]",
|
||||
" Outputs a list of all ExNihilo recipes." },
|
||||
new ExNihiloLogger());
|
||||
}
|
||||
|
||||
public static void registerMineTweakerCommand(String commandName, String[] usages, ICommandFunction commandFunction) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand(commandName, usages, commandFunction);
|
||||
ModTweaker2.logger.info("\nRegistering command " + commandName + ".");
|
||||
}
|
||||
if (TweakerPlugin.isLoaded("factorization")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"factorization",
|
||||
new String[] { "/minetweaker factorization [HANDLER]",
|
||||
" Outputs a list of all Factorization recipes." },
|
||||
new FactorizationLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("Mekanism")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"gases",
|
||||
new String[] { "/minetweaker gases",
|
||||
" Outputs a list of all gas names in the game to the minetweaker log" },
|
||||
new GasLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"mekanism",
|
||||
new String[] { "/minetweaker mekanism [HANDLER]",
|
||||
" Outputs a list of all Mekanism recipes." },
|
||||
new MekanismLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("Railcraft")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"railcraft",
|
||||
new String[] { "/minetweaker railcraft [HANDLER]",
|
||||
" Outputs a list of all Railcraft recipes." },
|
||||
new RailcraftLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("TConstruct")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"materials",
|
||||
new String[] { "/minetweaker materials",
|
||||
" Outputs a list of all Tinker's Construct material names in the game to the minetweaker log" },
|
||||
new MaterialLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"modifiers",
|
||||
new String[] { "/minetweaker modifiers",
|
||||
" Outputs a list of all Tinker's Construct modifier names in the game to the minetweaker log" },
|
||||
new ModifierLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"tconstruct",
|
||||
new String[] { "/minetweaker tconstruct [HANDLER]",
|
||||
" Outputs a list of all Tinkers Construct recipes." },
|
||||
new TConstructLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("Thaumcraft")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"research",
|
||||
new String[] { "/minetweaker research", "/minetweaker research [CATEGORY]",
|
||||
" Outputs a list of all category names in the game to the minetweaker log,"
|
||||
+ " or outputs a list of all research keys in a category to the log." },
|
||||
new ResearchLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"aspectList",
|
||||
new String[] { "/minetweaker aspectList",
|
||||
" Outputs a list of all aspects registered to entities and items" },
|
||||
new AspectLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("ThermalExpansion")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand(
|
||||
"thermalexpansion",
|
||||
new String[] { "/minetweaker thermalexpansion [HANDLER]",
|
||||
" Outputs a list of all Thermal Expansion recipes." },
|
||||
new ThermalExpansionLogger());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerMineTweakerCommand(String commandName, String[] usages,
|
||||
ICommandFunction commandFunction) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand(commandName, usages, commandFunction);
|
||||
ModTweaker2.logger.info("\nRegistering command " + commandName + ".");
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,9 @@ package modtweaker2;
|
||||
|
||||
public class ModProps {
|
||||
|
||||
public static final String NAME = "Mod Tweaker 2", name = NAME;
|
||||
public static final String MODID = "modtweaker2", modid = MODID;
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION", version = VERSION;
|
||||
public static final String DEPENDENCIES = "required-after:MineTweaker3;after:Forestry@[4.1.0,);", dependencies = DEPENDENCIES;
|
||||
public static final String NAME = "Mod Tweaker 2", name = NAME;
|
||||
public static final String MODID = "modtweaker2", modid = MODID;
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION", version = VERSION;
|
||||
public static final String DEPENDENCIES = "required-after:MineTweaker3;after:Forestry@[4.1.0,);",
|
||||
dependencies = DEPENDENCIES;
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import modtweaker2.mods.thaumcraft.Thaumcraft;
|
||||
import modtweaker2.mods.thermalexpansion.ThermalExpansion;
|
||||
import modtweaker2.proxy.CommonProxy;
|
||||
import modtweaker2.utils.TweakerPlugin;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -46,73 +47,72 @@ import cpw.mods.fml.relauncher.Side;
|
||||
@Mod(modid = ModProps.modid, version = ModProps.version, dependencies = ModProps.dependencies)
|
||||
public class ModTweaker2 {
|
||||
|
||||
public static Logger logger = LogManager.getLogger(ModProps.modid);
|
||||
public static Logger logger = LogManager.getLogger(ModProps.modid);
|
||||
|
||||
public static File baseIMCFolder;
|
||||
@Instance(ModProps.modid)
|
||||
public ModTweaker2 instance;
|
||||
public static File baseIMCFolder;
|
||||
@Instance(ModProps.modid)
|
||||
public ModTweaker2 instance;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
logger.info("Starting PreInitialization for " + ModProps.modid);
|
||||
}
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
logger.info("Starting PreInitialization for " + ModProps.modid);
|
||||
}
|
||||
|
||||
@SidedProxy(clientSide = "modtweaker2.proxy.ClientProxy", serverSide = "modtweaker2.proxy.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
@SidedProxy(clientSide = "modtweaker2.proxy.ClientProxy", serverSide = "modtweaker2.proxy.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
logger.info("Starting Initialization for " + ModProps.modid);
|
||||
TweakerPlugin.register("appliedenergistics2-core", AppliedEnergistics.class);
|
||||
TweakerPlugin.register("Botania", Botania.class);
|
||||
TweakerPlugin.register("shadowfox_botany", BotanicalAddons.class);
|
||||
TweakerPlugin.register("exnihilo", ExNihilo.class);
|
||||
TweakerPlugin.register("extendedWorkbench", ExtendedWorkbench.class);
|
||||
TweakerPlugin.register("factorization", Factorization.class);
|
||||
TweakerPlugin.register("Mariculture", Mariculture.class);
|
||||
TweakerPlugin.register("Mekanism", Mekanism.class);
|
||||
TweakerPlugin.register("Metallurgy", Metallurgy.class);
|
||||
TweakerPlugin.register("PneumaticCraft", PneumaticCraft.class);
|
||||
TweakerPlugin.register("Railcraft", Railcraft.class);
|
||||
TweakerPlugin.register("TConstruct", TConstruct.class);
|
||||
TweakerPlugin.register("Thaumcraft", Thaumcraft.class);
|
||||
TweakerPlugin.register("ThermalExpansion", ThermalExpansion.class);
|
||||
TweakerPlugin.register("Forestry", Forestry.class);
|
||||
TweakerPlugin.register("chisel", Chisel.class);
|
||||
TweakerPlugin.register("aura", AuraCascade.class);
|
||||
TweakerPlugin.register("ExtraUtilities", ExtraUtils.class);
|
||||
TweakerPlugin.register("IC2", IC2C.class);
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
logger.info("Starting Initialization for " + ModProps.modid);
|
||||
TweakerPlugin.register("appliedenergistics2-core", AppliedEnergistics.class);
|
||||
TweakerPlugin.register("Botania", Botania.class);
|
||||
TweakerPlugin.register("shadowfox_botany", BotanicalAddons.class);
|
||||
TweakerPlugin.register("exnihilo", ExNihilo.class);
|
||||
TweakerPlugin.register("extendedWorkbench", ExtendedWorkbench.class);
|
||||
TweakerPlugin.register("factorization", Factorization.class);
|
||||
TweakerPlugin.register("Mariculture", Mariculture.class);
|
||||
TweakerPlugin.register("Mekanism", Mekanism.class);
|
||||
TweakerPlugin.register("Metallurgy", Metallurgy.class);
|
||||
TweakerPlugin.register("PneumaticCraft", PneumaticCraft.class);
|
||||
TweakerPlugin.register("Railcraft", Railcraft.class);
|
||||
TweakerPlugin.register("TConstruct", TConstruct.class);
|
||||
TweakerPlugin.register("Thaumcraft", Thaumcraft.class);
|
||||
TweakerPlugin.register("ThermalExpansion", ThermalExpansion.class);
|
||||
TweakerPlugin.register("Forestry", Forestry.class);
|
||||
TweakerPlugin.register("chisel", Chisel.class);
|
||||
TweakerPlugin.register("aura", AuraCascade.class);
|
||||
TweakerPlugin.register("ExtraUtilities", ExtraUtils.class);
|
||||
TweakerPlugin.register("IC2", IC2C.class);
|
||||
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
MinecraftForge.EVENT_BUS.register(new ClientEvents());
|
||||
}
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
MinecraftForge.EVENT_BUS.register(new ClientEvents());
|
||||
}
|
||||
|
||||
MineTweakerImplementationAPI.onReloadEvent(new IEventHandler<MineTweakerImplementationAPI.ReloadEvent>() {
|
||||
MineTweakerImplementationAPI.onReloadEvent(new IEventHandler<MineTweakerImplementationAPI.ReloadEvent>() {
|
||||
|
||||
@Override
|
||||
public void handle(ReloadEvent event) {
|
||||
proxy.registerCommands();
|
||||
@Override
|
||||
public void handle(ReloadEvent event) {
|
||||
proxy.registerCommands();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
File scripts = new File("scripts");
|
||||
if (!scripts.exists()) {
|
||||
scripts.mkdir();
|
||||
}
|
||||
MineTweakerImplementationAPI.setScriptProvider(new ScriptProviderDirectory(scripts));
|
||||
}
|
||||
File scripts = new File("scripts");
|
||||
if (!scripts.exists()) {
|
||||
scripts.mkdir();
|
||||
}
|
||||
MineTweakerImplementationAPI.setScriptProvider(new ScriptProviderDirectory(scripts));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
logger.info("Starting PostInitialization for " + ModProps.modid);
|
||||
}
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
logger.info("Starting PostInitialization for " + ModProps.modid);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStart(FMLServerStartingEvent event) {
|
||||
logger.info("Starting ServerStart for " + ModProps.modid);
|
||||
proxy.registerCommands();
|
||||
@EventHandler
|
||||
public void serverStart(FMLServerStartingEvent event) {
|
||||
logger.info("Starting ServerStart for " + ModProps.modid);
|
||||
proxy.registerCommands();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,26 +7,29 @@ import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker2.ModTweaker2;
|
||||
|
||||
import net.minecraft.entity.EntityList;
|
||||
|
||||
public class EntityMappingLogger implements ICommandFunction {
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings("unchecked")
|
||||
Set<Integer> keys = EntityList.stringToIDMapping.keySet();
|
||||
|
||||
System.out.println("Mob Keys: " + keys.size());
|
||||
|
||||
for (Integer key : keys) {
|
||||
ModTweaker2.logger.info("Mob Key " + EntityList.getStringFromID(key) + " : " + key);
|
||||
MineTweakerAPI.logCommand("Mob Key " + EntityList.getStringFromID(key) + " : " + key);
|
||||
|
||||
}
|
||||
System.out.println("Mob Keys: " + keys.size());
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
for (Integer key : keys) {
|
||||
ModTweaker2.logger.info("Mob Key " + EntityList.getStringFromID(key) + " : " + key);
|
||||
MineTweakerAPI.logCommand("Mob Key " + EntityList.getStringFromID(key) + " : " + key);
|
||||
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,11 +13,13 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class ForgeHelper {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static Map translate = null;
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -28,16 +30,20 @@ public class ForgeHelper {
|
||||
try {
|
||||
seeds = getStaticObject(ForgeHooks.class, "seedList");
|
||||
loot = getStaticObject(ChestGenHooks.class, "chestInfo");
|
||||
translate = getFinalObject(getStaticObject(StatCollector.class, "localizedName", "field_74839_a"), "languageList", "field_74816_c");
|
||||
} catch (Exception e) { }
|
||||
translate = getFinalObject(
|
||||
getStaticObject(StatCollector.class, "localizedName", "field_74839_a"),
|
||||
"languageList",
|
||||
"field_74816_c");
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
private ForgeHelper() {
|
||||
}
|
||||
private ForgeHelper() {}
|
||||
|
||||
public static Object getSeedEntry(ItemStack stack, int weight) {
|
||||
Object seedEntry = getInstance(getConstructor("net.minecraftforge.common.ForgeHooks$SeedEntry",
|
||||
ItemStack.class, int.class), stack, weight);
|
||||
Object seedEntry = getInstance(
|
||||
getConstructor("net.minecraftforge.common.ForgeHooks$SeedEntry", ItemStack.class, int.class),
|
||||
stack,
|
||||
weight);
|
||||
|
||||
if (seedEntry == null) {
|
||||
throw new NullPointerException("Failed to instantiate SeedEntry");
|
||||
|
||||
@@ -10,6 +10,7 @@ import minetweaker.api.liquid.ILiquidStack;
|
||||
import minetweaker.api.oredict.IOreDictEntry;
|
||||
import minetweaker.mc1710.item.MCItemStack;
|
||||
import minetweaker.mc1710.liquid.MCLiquidStack;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -18,181 +19,173 @@ import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class InputHelper {
|
||||
public static boolean isABlock(IItemStack block) {
|
||||
if (!(isABlock(toStack(block)))) {
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
|
||||
public static <T> T[][] getMultiDimensionalArray(Class<T> clazz, T[] array, int height, int width) {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
T[][] multiDim = (T[][])Array.newInstance(clazz, new int[] {height, width});
|
||||
|
||||
for(int y = 0; y < height; y++) {
|
||||
for(int x = 0; x < width; x++) {
|
||||
multiDim[y][x] = array[x + (y * width)];
|
||||
}
|
||||
}
|
||||
|
||||
return multiDim;
|
||||
}
|
||||
|
||||
public static IItemStack[] toStacks(IIngredient[] iIngredient) {
|
||||
ArrayList<IItemStack> stacks = new ArrayList<IItemStack>();
|
||||
|
||||
for (IIngredient ing : iIngredient) {
|
||||
for (IItemStack stack : ing.getItems()) {
|
||||
stacks.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
return stacks.toArray(new IItemStack[stacks.size()]);
|
||||
}
|
||||
|
||||
public static boolean isABlock(ItemStack block) {
|
||||
return block.getItem() instanceof ItemBlock;
|
||||
}
|
||||
public static boolean isABlock(IItemStack block) {
|
||||
if (!(isABlock(toStack(block)))) {
|
||||
return false;
|
||||
} else return true;
|
||||
}
|
||||
|
||||
public static Entity toEntity(IEntity iEntity) {
|
||||
return null;
|
||||
}
|
||||
public static <T> T[][] getMultiDimensionalArray(Class<T> clazz, T[] array, int height, int width) {
|
||||
|
||||
public static ItemStack toStack(IItemStack iStack) {
|
||||
if (iStack == null) {
|
||||
return null;
|
||||
} else {
|
||||
Object internal = iStack.getInternal();
|
||||
if (!(internal instanceof ItemStack)) {
|
||||
LogHelper.logError("Not a valid item stack: " + iStack);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
T[][] multiDim = (T[][]) Array.newInstance(clazz, new int[] { height, width });
|
||||
|
||||
return (ItemStack) internal;
|
||||
}
|
||||
}
|
||||
|
||||
public static IIngredient toIngredient(ItemStack stack) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
multiDim[y][x] = array[x + (y * width)];
|
||||
}
|
||||
}
|
||||
|
||||
return multiDim;
|
||||
}
|
||||
|
||||
public static IItemStack[] toStacks(IIngredient[] iIngredient) {
|
||||
ArrayList<IItemStack> stacks = new ArrayList<IItemStack>();
|
||||
|
||||
for (IIngredient ing : iIngredient) {
|
||||
for (IItemStack stack : ing.getItems()) {
|
||||
stacks.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
return stacks.toArray(new IItemStack[stacks.size()]);
|
||||
}
|
||||
|
||||
public static boolean isABlock(ItemStack block) {
|
||||
return block.getItem() instanceof ItemBlock;
|
||||
}
|
||||
|
||||
public static Entity toEntity(IEntity iEntity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack toStack(IItemStack iStack) {
|
||||
if (iStack == null) {
|
||||
return null;
|
||||
} else {
|
||||
Object internal = iStack.getInternal();
|
||||
if (!(internal instanceof ItemStack)) {
|
||||
LogHelper.logError("Not a valid item stack: " + iStack);
|
||||
}
|
||||
|
||||
return (ItemStack) internal;
|
||||
}
|
||||
}
|
||||
|
||||
public static IIngredient toIngredient(ItemStack stack) {
|
||||
return toIItemStack(stack);
|
||||
}
|
||||
|
||||
public static IIngredient toIngredient(FluidStack stack) {
|
||||
if(stack == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new MCLiquidStack(stack);
|
||||
}
|
||||
|
||||
public static IItemStack toIItemStack(ItemStack stack) {
|
||||
if(stack == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new MCItemStack(stack);
|
||||
}
|
||||
|
||||
public static ILiquidStack toILiquidStack(FluidStack stack) {
|
||||
if(stack == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new MCLiquidStack(stack);
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack[] toStacks(IItemStack[] iStack) {
|
||||
if (iStack == null) {
|
||||
return null;
|
||||
} else {
|
||||
ItemStack[] output = new ItemStack[iStack.length];
|
||||
for (int i = 0; i < iStack.length; i++) {
|
||||
output[i] = toStack(iStack[i]);
|
||||
}
|
||||
public static IIngredient toIngredient(FluidStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
return new MCLiquidStack(stack);
|
||||
}
|
||||
|
||||
public static Object toObject(IIngredient iStack) {
|
||||
if (iStack == null)
|
||||
return null;
|
||||
else {
|
||||
if (iStack instanceof IOreDictEntry) {
|
||||
return toString((IOreDictEntry) iStack);
|
||||
} else if (iStack instanceof IItemStack) {
|
||||
return toStack((IItemStack) iStack);
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static IItemStack toIItemStack(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Object[] toObjects(IIngredient[] ingredient) {
|
||||
if (ingredient == null)
|
||||
return null;
|
||||
else {
|
||||
Object[] output = new Object[ingredient.length];
|
||||
for (int i = 0; i < ingredient.length; i++) {
|
||||
if (ingredient[i] != null) {
|
||||
output[i] = toObject(ingredient[i]);
|
||||
} else
|
||||
output[i] = "";
|
||||
}
|
||||
return new MCItemStack(stack);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
public static ILiquidStack toILiquidStack(FluidStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
return new MCLiquidStack(stack);
|
||||
}
|
||||
|
||||
public static ItemStack[] toStacks(IItemStack[] iStack) {
|
||||
if (iStack == null) {
|
||||
return null;
|
||||
} else {
|
||||
ItemStack[] output = new ItemStack[iStack.length];
|
||||
for (int i = 0; i < iStack.length; i++) {
|
||||
output[i] = toStack(iStack[i]);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object toObject(IIngredient iStack) {
|
||||
if (iStack == null) return null;
|
||||
else {
|
||||
if (iStack instanceof IOreDictEntry) {
|
||||
return toString((IOreDictEntry) iStack);
|
||||
} else if (iStack instanceof IItemStack) {
|
||||
return toStack((IItemStack) iStack);
|
||||
} else return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object[] toObjects(IIngredient[] ingredient) {
|
||||
if (ingredient == null) return null;
|
||||
else {
|
||||
Object[] output = new Object[ingredient.length];
|
||||
for (int i = 0; i < ingredient.length; i++) {
|
||||
if (ingredient[i] != null) {
|
||||
output[i] = toObject(ingredient[i]);
|
||||
} else output[i] = "";
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static Object[] toShapedObjects(IIngredient[][] ingredients) {
|
||||
if (ingredients == null)
|
||||
return null;
|
||||
else {
|
||||
ArrayList prep = new ArrayList();
|
||||
prep.add("abc");
|
||||
prep.add("def");
|
||||
prep.add("ghi");
|
||||
char[][] map = new char[][]{{'a', 'b', 'c'}, {'d', 'e', 'f'}, {'g', 'h', 'i'}};
|
||||
for (int x = 0; x < ingredients.length; x++) {
|
||||
if (ingredients[x] != null) {
|
||||
for (int y = 0; y < ingredients[x].length; y++) {
|
||||
if (ingredients[x][y] != null && x < map.length && y < map[x].length) {
|
||||
prep.add(map[x][y]);
|
||||
prep.add(toObject(ingredients[x][y]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return prep.toArray();
|
||||
}
|
||||
}
|
||||
if (ingredients == null) return null;
|
||||
else {
|
||||
ArrayList prep = new ArrayList();
|
||||
prep.add("abc");
|
||||
prep.add("def");
|
||||
prep.add("ghi");
|
||||
char[][] map = new char[][] { { 'a', 'b', 'c' }, { 'd', 'e', 'f' }, { 'g', 'h', 'i' } };
|
||||
for (int x = 0; x < ingredients.length; x++) {
|
||||
if (ingredients[x] != null) {
|
||||
for (int y = 0; y < ingredients[x].length; y++) {
|
||||
if (ingredients[x][y] != null && x < map.length && y < map[x].length) {
|
||||
prep.add(map[x][y]);
|
||||
prep.add(toObject(ingredients[x][y]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return prep.toArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static String toString(IOreDictEntry entry) {
|
||||
return ((IOreDictEntry) entry).getName();
|
||||
}
|
||||
public static String toString(IOreDictEntry entry) {
|
||||
return ((IOreDictEntry) entry).getName();
|
||||
}
|
||||
|
||||
public static FluidStack toFluid(ILiquidStack iStack) {
|
||||
if (iStack == null) {
|
||||
return null;
|
||||
} else
|
||||
return FluidRegistry.getFluidStack(iStack.getName(), iStack.getAmount());
|
||||
}
|
||||
public static FluidStack toFluid(ILiquidStack iStack) {
|
||||
if (iStack == null) {
|
||||
return null;
|
||||
} else return FluidRegistry.getFluidStack(iStack.getName(), iStack.getAmount());
|
||||
}
|
||||
|
||||
public static Fluid getFluid(ILiquidStack iStack) {
|
||||
if (iStack == null) {
|
||||
return null;
|
||||
} else
|
||||
return FluidRegistry.getFluid(iStack.getName());
|
||||
public static Fluid getFluid(ILiquidStack iStack) {
|
||||
if (iStack == null) {
|
||||
return null;
|
||||
} else return FluidRegistry.getFluid(iStack.getName());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static FluidStack[] toFluids(IIngredient[] input) {
|
||||
return toFluids((IItemStack[]) input);
|
||||
}
|
||||
public static FluidStack[] toFluids(IIngredient[] input) {
|
||||
return toFluids((IItemStack[]) input);
|
||||
}
|
||||
|
||||
public static FluidStack[] toFluids(ILiquidStack[] iStack) {
|
||||
FluidStack[] stack = new FluidStack[iStack.length];
|
||||
for (int i = 0; i < stack.length; i++)
|
||||
stack[i] = toFluid(iStack[i]);
|
||||
return stack;
|
||||
}
|
||||
public static FluidStack[] toFluids(ILiquidStack[] iStack) {
|
||||
FluidStack[] stack = new FluidStack[iStack.length];
|
||||
for (int i = 0; i < stack.length; i++) stack[i] = toFluid(iStack[i]);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import modtweaker2.mods.mekanism.gas.MCGasStack;
|
||||
import modtweaker2.mods.thaumcraft.aspect.AspectStack;
|
||||
import modtweaker2.mods.thaumcraft.aspect.MCAspectStack;
|
||||
import modtweaker2.utils.TweakerPlugin;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
@@ -24,13 +25,17 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class LogHelper {
|
||||
|
||||
public static void logPrinted(IPlayer player) {
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,19 +49,19 @@ public class LogHelper {
|
||||
System.out.println(string);
|
||||
MineTweakerAPI.logCommand(string);
|
||||
}
|
||||
|
||||
|
||||
public static void logError(String message) {
|
||||
MineTweakerAPI.logError("[ModTweaker2] " + message);
|
||||
}
|
||||
|
||||
|
||||
public static void logError(String message, Throwable exception) {
|
||||
MineTweakerAPI.logError("[ModTweaker2] " + message, exception);
|
||||
}
|
||||
|
||||
|
||||
public static void logWarning(String message) {
|
||||
MineTweakerAPI.logWarning("[ModTweaker2] " + message);
|
||||
}
|
||||
|
||||
|
||||
public static void logInfo(String message) {
|
||||
MineTweakerAPI.logInfo("[ModTweaker2] " + message);
|
||||
}
|
||||
@@ -65,37 +70,37 @@ public class LogHelper {
|
||||
* Returns a string representation of the item which can also be used in scripts
|
||||
*/
|
||||
public static String getStackDescription(Object object) {
|
||||
if(object instanceof IIngredient) {
|
||||
return getStackDescription((IIngredient)object);
|
||||
if (object instanceof IIngredient) {
|
||||
return getStackDescription((IIngredient) object);
|
||||
} else if (object instanceof ItemStack) {
|
||||
return new MCItemStack((ItemStack)object).toString();
|
||||
return new MCItemStack((ItemStack) object).toString();
|
||||
} else if (object instanceof FluidStack) {
|
||||
return getStackDescription((FluidStack) object);
|
||||
} else if (object instanceof Block) {
|
||||
return new MCItemStack(new ItemStack((Block)object, 1, 0)).toString();
|
||||
return new MCItemStack(new ItemStack((Block) object, 1, 0)).toString();
|
||||
} else if (TweakerPlugin.isLoaded("Mekanism") && object instanceof GasStack) {
|
||||
return new MCGasStack((GasStack)object).toString();
|
||||
return new MCGasStack((GasStack) object).toString();
|
||||
} else if (TweakerPlugin.isLoaded("Thaumcraft") && object instanceof AspectStack) {
|
||||
return new MCAspectStack((AspectStack)object).toString();
|
||||
} else if(TweakerPlugin.isLoaded("Thaumcraft") && object instanceof AspectList) {
|
||||
return new MCAspectStack((AspectStack) object).toString();
|
||||
} else if (TweakerPlugin.isLoaded("Thaumcraft") && object instanceof AspectList) {
|
||||
List<AspectStack> stacks = new LinkedList<AspectStack>();
|
||||
for(Aspect a : ((AspectList)object).getAspects()) {
|
||||
stacks.add(new AspectStack(a, ((AspectList)object).getAmount(a)));
|
||||
for (Aspect a : ((AspectList) object).getAspects()) {
|
||||
stacks.add(new AspectStack(a, ((AspectList) object).getAmount(a)));
|
||||
}
|
||||
return(getListDescription(stacks));
|
||||
return (getListDescription(stacks));
|
||||
} else if (object instanceof String) {
|
||||
// Check if string specifies an oredict entry
|
||||
List<ItemStack> ores = OreDictionary.getOres((String)object);
|
||||
List<ItemStack> ores = OreDictionary.getOres((String) object);
|
||||
|
||||
if(!ores.isEmpty()) {
|
||||
return "<ore:" + (String)object + ">";
|
||||
if (!ores.isEmpty()) {
|
||||
return "<ore:" + (String) object + ">";
|
||||
} else {
|
||||
return "\"" + (String)object + "\"";
|
||||
return "\"" + (String) object + "\"";
|
||||
}
|
||||
} else if (object instanceof List) {
|
||||
return getListDescription((List)object);
|
||||
} else if(object instanceof Object[]) {
|
||||
return getListDescription(Arrays.asList((Object[])object));
|
||||
return getListDescription((List) object);
|
||||
} else if (object instanceof Object[]) {
|
||||
return getListDescription(Arrays.asList((Object[]) object));
|
||||
} else if (object != null) {
|
||||
return "\"" + object.toString() + "\"";
|
||||
} else {
|
||||
@@ -119,49 +124,45 @@ public class LogHelper {
|
||||
|
||||
public static String getStackDescription(FluidStack stack) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
|
||||
sb.append("<liquid:").append(stack.getFluid().getName()).append('>');
|
||||
|
||||
if(stack.amount > 1) {
|
||||
|
||||
if (stack.amount > 1) {
|
||||
sb.append(" * ").append(stack.amount);
|
||||
}
|
||||
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public static String getListDescription(List<?> objects) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if(objects.isEmpty()) {
|
||||
|
||||
if (objects.isEmpty()) {
|
||||
sb.append("[]");
|
||||
} else {
|
||||
sb.append('[');
|
||||
for(Object object : objects) {
|
||||
if(object instanceof List) {
|
||||
sb.append(getListDescription((List)object)).append(", ");
|
||||
} else if(object instanceof Object[]) {
|
||||
sb.append(getListDescription(Arrays.asList((Object[])object))).append(", ");
|
||||
} else {
|
||||
for (Object object : objects) {
|
||||
if (object instanceof List) {
|
||||
sb.append(getListDescription((List) object)).append(", ");
|
||||
} else if (object instanceof Object[]) {
|
||||
sb.append(getListDescription(Arrays.asList((Object[]) object))).append(", ");
|
||||
} else {
|
||||
sb.append(getStackDescription(object)).append(", ");
|
||||
}
|
||||
}
|
||||
sb.setLength(sb.length() - 2);
|
||||
sb.append(']');
|
||||
}
|
||||
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String getCraftingDescription(IRecipe recipe) {
|
||||
if(recipe instanceof ShapelessOreRecipe)
|
||||
return LogHelper.getCraftingDescription((ShapelessOreRecipe)recipe);
|
||||
else if(recipe instanceof ShapedOreRecipe)
|
||||
return LogHelper.getCraftingDescription((ShapedOreRecipe)recipe);
|
||||
else if(recipe instanceof ShapelessRecipes)
|
||||
return LogHelper.getCraftingDescription((ShapelessRecipes)recipe);
|
||||
else if(recipe instanceof ShapedRecipes)
|
||||
return LogHelper.getCraftingDescription((ShapedRecipes)recipe);
|
||||
|
||||
if (recipe instanceof ShapelessOreRecipe) return LogHelper.getCraftingDescription((ShapelessOreRecipe) recipe);
|
||||
else if (recipe instanceof ShapedOreRecipe) return LogHelper.getCraftingDescription((ShapedOreRecipe) recipe);
|
||||
else if (recipe instanceof ShapelessRecipes) return LogHelper.getCraftingDescription((ShapelessRecipes) recipe);
|
||||
else if (recipe instanceof ShapedRecipes) return LogHelper.getCraftingDescription((ShapedRecipes) recipe);
|
||||
|
||||
return recipe.toString();
|
||||
}
|
||||
|
||||
@@ -176,14 +177,15 @@ public class LogHelper {
|
||||
public static String getCraftingDescription(ShapedOreRecipe recipe) {
|
||||
int height = ReflectionHelper.<Integer>getObject(recipe, "width");
|
||||
int width = ReflectionHelper.<Integer>getObject(recipe, "height");
|
||||
|
||||
|
||||
Object[][] recipes = InputHelper.getMultiDimensionalArray(Object.class, recipe.getInput(), height, width);
|
||||
|
||||
|
||||
return getListDescription(Arrays.asList(recipes));
|
||||
}
|
||||
|
||||
public static String getCraftingDescription(ShapedRecipes recipe) {
|
||||
ItemStack[][] recipes = InputHelper.getMultiDimensionalArray(ItemStack.class, recipe.recipeItems, recipe.recipeHeight, recipe.recipeWidth);
|
||||
ItemStack[][] recipes = InputHelper
|
||||
.getMultiDimensionalArray(ItemStack.class, recipe.recipeItems, recipe.recipeHeight, recipe.recipeWidth);
|
||||
return getListDescription(Arrays.asList(recipes));
|
||||
}
|
||||
}
|
||||
@@ -5,46 +5,53 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
public class ReflectionHelper {
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance with the provided constructor and arguments.
|
||||
*
|
||||
* @param constructor The constructor of the class for which a new instance should be created.
|
||||
* @param arguments Array of objects to be passed as arguments to the constructor call.
|
||||
* @param arguments Array of objects to be passed as arguments to the constructor call.
|
||||
* @return A new object created by calling the constructor.
|
||||
*/
|
||||
public static <T> T getInstance(Constructor<T> constructor, Object... arguments) {
|
||||
try {
|
||||
return constructor.newInstance(arguments);
|
||||
} catch (Exception e) { LogHelper.logError("Exception creating instance of " + constructor.getClass().getName(), e); }
|
||||
} catch (Exception e) {
|
||||
LogHelper.logError("Exception creating instance of " + constructor.getClass().getName(), e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtains the constructor for the named class identified by the parameter types.
|
||||
* @param className The fully qualified name of the class.
|
||||
*
|
||||
* @param className The fully qualified name of the class.
|
||||
* @param argumentTypes Parameter types to identify the constructor.
|
||||
* @return Constructor object representing the declared constructor for the parameter types.
|
||||
*/
|
||||
public static Constructor<?> getConstructor(final String className, final Class<?>... argumentTypes) {
|
||||
if(className == null || argumentTypes == null) {
|
||||
if (className == null || argumentTypes == null) {
|
||||
LogHelper.logError("The provided class name or arguments can't be null.");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
Class<?> clazz = Class.forName(className);
|
||||
Constructor<?> constructor = clazz.getDeclaredConstructor(argumentTypes);
|
||||
constructor.setAccessible(true);
|
||||
return constructor;
|
||||
} catch (Exception ex) { LogHelper.logError("Exception getting constructor of " + className, ex); }
|
||||
} catch (Exception ex) {
|
||||
LogHelper.logError("Exception getting constructor of " + className, ex);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtains the constructor for the class identified by the parameter types.
|
||||
* @param clazz The Class for which the constructor should be obtained.
|
||||
*
|
||||
* @param clazz The Class for which the constructor should be obtained.
|
||||
* @param argumentTypes Parameter types to identify the constructor.
|
||||
* @return Constructor object representing the declared constructor for the parameter types.
|
||||
*/
|
||||
@@ -53,16 +60,19 @@ public class ReflectionHelper {
|
||||
Constructor<T> constructor = clazz.getDeclaredConstructor(types);
|
||||
constructor.setAccessible(true);
|
||||
return constructor;
|
||||
} catch (Exception ex) { LogHelper.logError("Exception getting constructor of " + clazz.getName(), ex); }
|
||||
} catch (Exception ex) {
|
||||
LogHelper.logError("Exception getting constructor of " + clazz.getName(), ex);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of a private field for an object instance.
|
||||
* @param object An object instance from which the field value is to be extracted.
|
||||
* @param fieldNames A list of field names for which the value should be extracted.
|
||||
* The functions returns value of the first field found.
|
||||
*
|
||||
* @param object An object instance from which the field value is to be extracted.
|
||||
* @param fieldNames A list of field names for which the value should be extracted. The functions returns value of
|
||||
* the first field found.
|
||||
* @return The value of the provided field name.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -73,19 +83,22 @@ public class ReflectionHelper {
|
||||
Field result = cls.getDeclaredField(field);
|
||||
result.setAccessible(true);
|
||||
return (T) result.get(object);
|
||||
} catch (Exception ex) { LogHelper.logError("Exception in getObject()", ex); }
|
||||
} catch (Exception ex) {
|
||||
LogHelper.logError("Exception in getObject()", ex);
|
||||
}
|
||||
}
|
||||
|
||||
LogHelper.logError("Could not retrieve any object for the provided field names.");
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of a private final field for an object instance and removes the final modifier.
|
||||
* @param object An object instance from which the field value is to be extracted.
|
||||
* @param fieldNames A list of field names for which the value should be extracted.
|
||||
* The functions returns value of the first field found.
|
||||
*
|
||||
* @param object An object instance from which the field value is to be extracted.
|
||||
* @param fieldNames A list of field names for which the value should be extracted. The functions returns value of
|
||||
* the first field found.
|
||||
* @return The value of the provided field name.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -99,17 +112,20 @@ public class ReflectionHelper {
|
||||
modifiersField.setAccessible(true);
|
||||
modifiersField.setInt(result, result.getModifiers() & ~Modifier.FINAL);
|
||||
return (T) result.get(object);
|
||||
} catch (Exception ex) { LogHelper.logError("Exception in getFinalObject()", ex); }
|
||||
} catch (Exception ex) {
|
||||
LogHelper.logError("Exception in getFinalObject()", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LogHelper.logError("Could not retrieve any final object for the provided field names.");
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of a private static field for a class.
|
||||
* @param clazz The class for which the field value is to be extracted.
|
||||
*
|
||||
* @param clazz The class for which the field value is to be extracted.
|
||||
* @param fieldNames A list of field names for which the value should be extracted.
|
||||
* @return The value of the provided field name.
|
||||
*/
|
||||
@@ -120,17 +136,20 @@ public class ReflectionHelper {
|
||||
Field result = clazz.getDeclaredField(field);
|
||||
result.setAccessible(true);
|
||||
return (T) result.get(null);
|
||||
} catch (Exception e) { LogHelper.logError("Exception in getStaticObject()", e); }
|
||||
} catch (Exception e) {
|
||||
LogHelper.logError("Exception in getStaticObject()", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LogHelper.logError("Could not retrieve any static object for the provided field names.");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the value of a private static field for a class.
|
||||
* @param className The fully qualified name of the class.
|
||||
*
|
||||
* @param className The fully qualified name of the class.
|
||||
* @param fieldNames A list of field names for which the value should be extracted.
|
||||
* @return The value of the provided field name.
|
||||
*/
|
||||
@@ -138,10 +157,12 @@ public class ReflectionHelper {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(className);
|
||||
return getStaticObject(clazz, fieldNames);
|
||||
} catch (ClassNotFoundException e) { LogHelper.logError("Exception in getStaticObject()", e); }
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
LogHelper.logError("Exception in getStaticObject()", e);
|
||||
}
|
||||
|
||||
LogHelper.logError("Could not retrieve any static object for the provided field names.");
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -150,11 +171,13 @@ public class ReflectionHelper {
|
||||
Field f = cls.getDeclaredField(field);
|
||||
f.setAccessible(true);
|
||||
f.setInt(null, var);
|
||||
} catch (Exception e) { LogHelper.logError("Exception in setPrivateValue()", e); }
|
||||
} catch (Exception e) {
|
||||
LogHelper.logError("Exception in setPrivateValue()", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static void setPrivateValue( Class cls, Object o, String field, Object var) {
|
||||
public static void setPrivateValue(Class cls, Object o, String field, Object var) {
|
||||
cpw.mods.fml.relauncher.ReflectionHelper.setPrivateValue(cls, o, var, field);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package modtweaker2.helpers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.item.IngredientAny;
|
||||
@@ -9,120 +10,122 @@ import modtweaker2.mods.botania.Botania;
|
||||
import modtweaker2.mods.mekanism.MekanismHelper;
|
||||
import modtweaker2.mods.mekanism.gas.IGasStack;
|
||||
import modtweaker2.utils.TweakerPlugin;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class StackHelper {
|
||||
|
||||
/**
|
||||
* Compares two ItemStack instances, trying to match the referenced item.
|
||||
*/
|
||||
public static boolean areEqual(ItemStack stack1, ItemStack stack2) {
|
||||
if (stack1 == null || stack2 == null) {
|
||||
return false;
|
||||
} else if (TweakerPlugin.isLoaded("Botania") && Botania.isSubtile(stack1) && Botania.isSubtile(stack2)) {
|
||||
return Botania.subtileMatches(stack1, stack2);
|
||||
} else {
|
||||
return stack1.isItemEqual(stack2);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean areEqual(FluidStack stack1, FluidStack stack2) {
|
||||
if(stack1 == null || stack2 == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return stack1.isFluidEqual(stack2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two ItemStack instances if they reference the same object or
|
||||
* are both null. If false, the method areEqual() is called to check if the
|
||||
* two instances reference the same item.
|
||||
*/
|
||||
public static boolean areEqual(ItemStack stack1, ItemStack stack2) {
|
||||
if (stack1 == null || stack2 == null) {
|
||||
return false;
|
||||
} else if (TweakerPlugin.isLoaded("Botania") && Botania.isSubtile(stack1) && Botania.isSubtile(stack2)) {
|
||||
return Botania.subtileMatches(stack1, stack2);
|
||||
} else {
|
||||
return stack1.isItemEqual(stack2);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean areEqual(FluidStack stack1, FluidStack stack2) {
|
||||
if (stack1 == null || stack2 == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return stack1.isFluidEqual(stack2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two ItemStack instances if they reference the same object or are both null. If false, the method
|
||||
* areEqual() is called to check if the two instances reference the same item.
|
||||
*/
|
||||
public static boolean areEqualOrNull(ItemStack stack1, ItemStack stack2) {
|
||||
// Check if they reference the same object or are are both null
|
||||
if(stack1 == stack2) {
|
||||
if (stack1 == stack2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return(areEqual(stack1, stack2));
|
||||
return (areEqual(stack1, stack2));
|
||||
}
|
||||
|
||||
|
||||
public static boolean areEqualOrNull(FluidStack stack1, FluidStack stack2) {
|
||||
// Check if they reference the same object or are are both null
|
||||
if(stack1 == stack2) {
|
||||
if (stack1 == stack2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return(areEqual(stack1, stack2));
|
||||
|
||||
return (areEqual(stack1, stack2));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds extra check to IIngredient matches() for Botania special flowers
|
||||
* Adds extra check to IIngredient matches() for Botania special flowers
|
||||
*/
|
||||
public static boolean matches(IIngredient ingredient, IItemStack itemStack) {
|
||||
if(ingredient == null) {
|
||||
if (ingredient == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!ingredient.matches(itemStack)) {
|
||||
|
||||
if (!ingredient.matches(itemStack)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Check for Botania special flowers
|
||||
if(ingredient.getItems() != null && TweakerPlugin.isLoaded("Botania") && Botania.isSubtile(toStack(itemStack))) {
|
||||
for(IItemStack item : ingredient.getItems()) {
|
||||
if(areEqual(toStack(item), toStack(itemStack))) {
|
||||
if (ingredient.getItems() != null && TweakerPlugin.isLoaded("Botania")
|
||||
&& Botania.isSubtile(toStack(itemStack))) {
|
||||
for (IItemStack item : ingredient.getItems()) {
|
||||
if (areEqual(toStack(item), toStack(itemStack))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function compares an ingredient with a fluid. MCLiquidStack.matches() function
|
||||
* is currently broken in MineTweaker3, thus this function is only a workaround.
|
||||
* This function compares an ingredient with a fluid. MCLiquidStack.matches() function is currently broken in
|
||||
* MineTweaker3, thus this function is only a workaround.
|
||||
*/
|
||||
public static boolean matches(IIngredient ingredient, ILiquidStack liquidStack) {
|
||||
if(ingredient == null) {
|
||||
if (ingredient == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do we have a wildcard (<*>) ?
|
||||
if(ingredient.matches(liquidStack)) {
|
||||
if (ingredient.matches(liquidStack)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Does ingredient reference liquids?
|
||||
if(ingredient.getLiquids() != null) {
|
||||
if (ingredient.getLiquids() != null) {
|
||||
for (ILiquidStack liquid : ingredient.getLiquids()) {
|
||||
if(InputHelper.toFluid(liquid).isFluidEqual(InputHelper.toFluid(liquidStack))) {
|
||||
if (InputHelper.toFluid(liquid).isFluidEqual(InputHelper.toFluid(liquidStack))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static boolean matches(IIngredient ingredient, IGasStack gasStack) {
|
||||
if(ingredient == null) {
|
||||
if (ingredient == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(ingredient == IngredientAny.INSTANCE) {
|
||||
|
||||
if (ingredient == IngredientAny.INSTANCE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(ingredient instanceof IGasStack) {
|
||||
return MekanismHelper.toGas((IGasStack)ingredient).isGasEqual(MekanismHelper.toGas(gasStack));
|
||||
|
||||
if (ingredient instanceof IGasStack) {
|
||||
return MekanismHelper.toGas((IGasStack) ingredient).isGasEqual(MekanismHelper.toGas(gasStack));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,52 +4,53 @@ import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
public class StringHelper {
|
||||
|
||||
public static List<String> toLowerCase(List<String> stringList) {
|
||||
ListIterator<String> iterator = stringList.listIterator();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
iterator.set(iterator.next().toLowerCase());
|
||||
}
|
||||
|
||||
|
||||
return stringList;
|
||||
}
|
||||
|
||||
|
||||
public static String join(List<String> list, String conjunction) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if(conjunction == null) {
|
||||
|
||||
if (conjunction == null) {
|
||||
conjunction = ", ";
|
||||
}
|
||||
|
||||
if(list != null && !list.isEmpty()) {
|
||||
for(String string : list) {
|
||||
|
||||
if (list != null && !list.isEmpty()) {
|
||||
for (String string : list) {
|
||||
sb.append(string).append(conjunction);
|
||||
}
|
||||
|
||||
|
||||
sb.setLength(sb.length() - conjunction.length());
|
||||
}
|
||||
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public static String wildcardToRegex(String expression) {
|
||||
if(expression == null) return null;
|
||||
|
||||
if (expression == null) return null;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append('^');
|
||||
|
||||
for(int i = 0; i < expression.length(); i ++) {
|
||||
|
||||
for (int i = 0; i < expression.length(); i++) {
|
||||
char c = expression.charAt(i);
|
||||
|
||||
switch(c) {
|
||||
|
||||
switch (c) {
|
||||
case '*':
|
||||
sb.append(".*");
|
||||
break;
|
||||
case '?':
|
||||
sb.append('.');
|
||||
break;
|
||||
|
||||
case '(':
|
||||
|
||||
case '(':
|
||||
case ')':
|
||||
case '[':
|
||||
case ']':
|
||||
@@ -67,7 +68,7 @@ public class StringHelper {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sb.append('$');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import modtweaker2.mods.appeng.handlers.Inscriber;
|
||||
|
||||
public class AppliedEnergistics {
|
||||
|
||||
public AppliedEnergistics() {
|
||||
MineTweakerAPI.registerClass(Inscriber.class);
|
||||
MineTweakerAPI.registerClass(Grind.class);
|
||||
}
|
||||
public AppliedEnergistics() {
|
||||
MineTweakerAPI.registerClass(Inscriber.class);
|
||||
MineTweakerAPI.registerClass(Grind.class);
|
||||
}
|
||||
}
|
||||
@@ -1,77 +1,79 @@
|
||||
package modtweaker2.mods.appeng;
|
||||
|
||||
import static modtweaker2.helpers.StackHelper.areEqualOrNull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.IGrinderEntry;
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
|
||||
public class AppliedEnergisticsHelper {
|
||||
|
||||
/**
|
||||
* Compares two IInscriberRecipe objects, if they are the same or have the same inputs
|
||||
*/
|
||||
public static boolean equals(IInscriberRecipe r1, IInscriberRecipe r2) {
|
||||
if(r1 == r2) {
|
||||
if (r1 == r2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (r1 == null || r2 == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!areEqualOrNull(r1.getTopOptional().orNull(), r2.getTopOptional().orNull())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!areEqualOrNull(r1.getBottomOptional().orNull(), r2.getBottomOptional().orNull())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(r1.getInputs() == null && r2.getInputs() != null || r1.getInputs() != null && r2.getInputs() == null) {
|
||||
if (!areEqualOrNull(r1.getTopOptional().orNull(), r2.getTopOptional().orNull())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(r1.getInputs() != null && r2.getInputs() != null) {
|
||||
if(r1.getInputs().size() != r2.getInputs().size()) {
|
||||
|
||||
if (!areEqualOrNull(r1.getBottomOptional().orNull(), r2.getBottomOptional().orNull())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (r1.getInputs() == null && r2.getInputs() != null || r1.getInputs() != null && r2.getInputs() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (r1.getInputs() != null && r2.getInputs() != null) {
|
||||
if (r1.getInputs().size() != r2.getInputs().size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Check if every item in recipe 1 is in recipe 2
|
||||
for(ItemStack i1 : r1.getInputs()) {
|
||||
for (ItemStack i1 : r1.getInputs()) {
|
||||
boolean found = false;
|
||||
|
||||
for(ItemStack i2 : r2.getInputs()) {
|
||||
if(areEqualOrNull(i1, i2)) {
|
||||
|
||||
for (ItemStack i2 : r2.getInputs()) {
|
||||
if (areEqualOrNull(i1, i2)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
|
||||
if (!found) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compares two IGrinderEntry objects, if they are the same or have the same inputs
|
||||
*/
|
||||
public static boolean equals(IGrinderEntry r1, IGrinderEntry r2) {
|
||||
if(r1 == r2) {
|
||||
if (r1 == r2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (r1 == null || r2 == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!areEqualOrNull(r1.getInput(), r2.getInput())) {
|
||||
|
||||
if (!areEqualOrNull(r1.getInput(), r2.getInput())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -17,48 +17,57 @@ import appeng.api.features.IInscriberRecipe;
|
||||
public class AppliedEnergisticsLogger implements ICommandFunction {
|
||||
|
||||
private static final List<String> validArguments = new LinkedList<String>();
|
||||
|
||||
|
||||
static {
|
||||
validArguments.add("Grinder");
|
||||
validArguments.add("Inscriber");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
List<String> args = StringHelper.toLowerCase(Arrays.asList(arguments));
|
||||
|
||||
if(!validArguments.containsAll(args)) {
|
||||
if(player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("Invalid arguments for command. Valid arguments: " + StringHelper.join(validArguments, ", ")));
|
||||
}
|
||||
} else {
|
||||
if(args.isEmpty() || args.contains("Grinder")) {
|
||||
for(IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes()) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.appeng.Grinder.addRecipe(%s, %s, %d, %s, %s, %s, %s);",
|
||||
LogHelper.getStackDescription(recipe.getInput()),
|
||||
LogHelper.getStackDescription(recipe.getOutput()),
|
||||
recipe.getEnergyCost(),
|
||||
LogHelper.getStackDescription(recipe.getOptionalOutput()),
|
||||
recipe.getOptionalChance(),
|
||||
LogHelper.getStackDescription(recipe.getSecondOptionalOutput()),
|
||||
recipe.getSecondOptionalChance()));
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("Inscriber")) {
|
||||
for(IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes()) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.appeng.Inscriber.addRecipe(%s, %s, %s, %s, \"%s\");",
|
||||
LogHelper.getListDescription(recipe.getInputs()),
|
||||
LogHelper.getStackDescription(recipe.getTopOptional().orNull()),
|
||||
LogHelper.getStackDescription(recipe.getBottomOptional().orNull()),
|
||||
LogHelper.getStackDescription(recipe.getOutput()),
|
||||
recipe.getProcessType().toString()));
|
||||
}
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
List<String> args = StringHelper.toLowerCase(Arrays.asList(arguments));
|
||||
|
||||
if (!validArguments.containsAll(args)) {
|
||||
if (player != null) {
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform.getMessage(
|
||||
"Invalid arguments for command. Valid arguments: "
|
||||
+ StringHelper.join(validArguments, ", ")));
|
||||
}
|
||||
} else {
|
||||
if (args.isEmpty() || args.contains("Grinder")) {
|
||||
for (IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes()) {
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.appeng.Grinder.addRecipe(%s, %s, %d, %s, %s, %s, %s);",
|
||||
LogHelper.getStackDescription(recipe.getInput()),
|
||||
LogHelper.getStackDescription(recipe.getOutput()),
|
||||
recipe.getEnergyCost(),
|
||||
LogHelper.getStackDescription(recipe.getOptionalOutput()),
|
||||
recipe.getOptionalChance(),
|
||||
LogHelper.getStackDescription(recipe.getSecondOptionalOutput()),
|
||||
recipe.getSecondOptionalChance()));
|
||||
}
|
||||
}
|
||||
|
||||
if (args.isEmpty() || args.contains("Inscriber")) {
|
||||
for (IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes()) {
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.appeng.Inscriber.addRecipe(%s, %s, %s, %s, \"%s\");",
|
||||
LogHelper.getListDescription(recipe.getInputs()),
|
||||
LogHelper.getStackDescription(recipe.getTopOptional().orNull()),
|
||||
LogHelper.getStackDescription(recipe.getBottomOptional().orNull()),
|
||||
LogHelper.getStackDescription(recipe.getOutput()),
|
||||
recipe.getProcessType().toString()));
|
||||
}
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package modtweaker2.mods.appeng.handlers;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.IGrinderEntry;
|
||||
import appeng.core.features.registries.entries.AppEngGrinderRecipe;
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
@@ -15,178 +18,229 @@ import modtweaker2.utils.BaseListRemoval;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.IGrinderEntry;
|
||||
import appeng.core.features.registries.entries.AppEngGrinderRecipe;
|
||||
|
||||
@ZenClass("mods.appeng.Grinder")
|
||||
public class Grind {
|
||||
|
||||
protected static final String name = "Applied Energistics 2 Grindstone";
|
||||
protected static final String name = "Applied Energistics 2 Grindstone";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a shaped recipe for the Grindstone
|
||||
* @param outputs
|
||||
* @param inputStack
|
||||
* @param turns
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(WeightedItemStack[] outputs, IItemStack inputStack, int turns) {
|
||||
IGrinderEntry recipe;
|
||||
if (outputs.length == 1)
|
||||
recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputs[0].getStack()), turns);
|
||||
else if (outputs.length == 2)
|
||||
recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputs[0].getStack()), InputHelper.toStack(outputs[1].getStack()), outputs[1].getChance(), turns);
|
||||
else if (outputs.length == 3)
|
||||
recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputs[0].getStack()), InputHelper.toStack(outputs[1].getStack()), InputHelper.toStack(outputs[2].getStack()), outputs[1].getChance(), outputs[2].getChance(), turns);
|
||||
else {
|
||||
LogHelper.logWarning(String.format("No more then 3 output stacks are allowed in %s. Command ignored!", name, LogHelper.getStackDescription(toStack(inputStack))));
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Adds a shaped recipe for the Grindstone
|
||||
*
|
||||
* @param outputs
|
||||
* @param inputStack
|
||||
* @param turns
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(WeightedItemStack[] outputs, IItemStack inputStack, int turns) {
|
||||
IGrinderEntry recipe;
|
||||
if (outputs.length == 1) recipe = new AppEngGrinderRecipe(
|
||||
InputHelper.toStack(inputStack),
|
||||
InputHelper.toStack(outputs[0].getStack()),
|
||||
turns);
|
||||
else if (outputs.length == 2) recipe = new AppEngGrinderRecipe(
|
||||
InputHelper.toStack(inputStack),
|
||||
InputHelper.toStack(outputs[0].getStack()),
|
||||
InputHelper.toStack(outputs[1].getStack()),
|
||||
outputs[1].getChance(),
|
||||
turns);
|
||||
else if (outputs.length == 3) recipe = new AppEngGrinderRecipe(
|
||||
InputHelper.toStack(inputStack),
|
||||
InputHelper.toStack(outputs[0].getStack()),
|
||||
InputHelper.toStack(outputs[1].getStack()),
|
||||
InputHelper.toStack(outputs[2].getStack()),
|
||||
outputs[1].getChance(),
|
||||
outputs[2].getChance(),
|
||||
turns);
|
||||
else {
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"No more then 3 output stacks are allowed in %s. Command ignored!",
|
||||
name,
|
||||
LogHelper.getStackDescription(toStack(inputStack))));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the recipe is already present, we don't want to add duplicates
|
||||
for (IGrinderEntry r : AEApi.instance().registries().grinder().getRecipes()) {
|
||||
if (r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
|
||||
LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", name, LogHelper.getStackDescription(toStack(inputStack))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Check if the recipe is already present, we don't want to add duplicates
|
||||
for (IGrinderEntry r : AEApi.instance().registries().grinder().getRecipes()) {
|
||||
if (r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"Duplicate %s Recipe found for %s. Command ignored!",
|
||||
name,
|
||||
LogHelper.getStackDescription(toStack(inputStack))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a shaped recipe for the Grindstone
|
||||
*
|
||||
* @param outputStack - Product of the Recipe
|
||||
* @param inputStack - Ingredient of the Recipe
|
||||
* @param inputEnergy - Energy requirement of the Recipe
|
||||
* @optionalParam outputStack2 - Second product of the Recipe
|
||||
* @optionalParam outputStack2Chance - Chance for the acquirement of the second product
|
||||
* @optionalParam outputStack3 - Third product of the Recipe
|
||||
* @optionalParam outputStack3Chance - Chance for the acquirement of the third product
|
||||
**/
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack outputStack, IItemStack inputStack, @Optional IItemStack outputStack2, @Optional float outputStack2Chance, @Optional IItemStack outputStack3, @Optional float outputStack3Chance, int inputEnergy) {
|
||||
if (inputStack == null || outputStack == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Adds a shaped recipe for the Grindstone
|
||||
*
|
||||
* @param outputStack - Product of the Recipe
|
||||
* @param inputStack - Ingredient of the Recipe
|
||||
* @param inputEnergy - Energy requirement of the Recipe
|
||||
* @optionalParam outputStack2 - Second product of the Recipe
|
||||
* @optionalParam outputStack2Chance - Chance for the acquirement of the second product
|
||||
* @optionalParam outputStack3 - Third product of the Recipe
|
||||
* @optionalParam outputStack3Chance - Chance for the acquirement of the third product
|
||||
**/
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack outputStack, IItemStack inputStack, @Optional IItemStack outputStack2,
|
||||
@Optional float outputStack2Chance, @Optional IItemStack outputStack3, @Optional float outputStack3Chance,
|
||||
int inputEnergy) {
|
||||
if (inputStack == null || outputStack == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
// Create recipe
|
||||
IGrinderEntry recipe;
|
||||
// Create recipe
|
||||
IGrinderEntry recipe;
|
||||
|
||||
if (outputStack2 != null && outputStack3 != null)
|
||||
recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputStack), InputHelper.toStack(outputStack2), InputHelper.toStack(outputStack3), outputStack2Chance, outputStack3Chance, inputEnergy);
|
||||
else if (outputStack2 != null)
|
||||
recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputStack), InputHelper.toStack(outputStack2), outputStack2Chance, inputEnergy);
|
||||
else
|
||||
recipe = new AppEngGrinderRecipe(InputHelper.toStack(inputStack), InputHelper.toStack(outputStack), inputEnergy);
|
||||
if (outputStack2 != null && outputStack3 != null) recipe = new AppEngGrinderRecipe(
|
||||
InputHelper.toStack(inputStack),
|
||||
InputHelper.toStack(outputStack),
|
||||
InputHelper.toStack(outputStack2),
|
||||
InputHelper.toStack(outputStack3),
|
||||
outputStack2Chance,
|
||||
outputStack3Chance,
|
||||
inputEnergy);
|
||||
else if (outputStack2 != null) recipe = new AppEngGrinderRecipe(
|
||||
InputHelper.toStack(inputStack),
|
||||
InputHelper.toStack(outputStack),
|
||||
InputHelper.toStack(outputStack2),
|
||||
outputStack2Chance,
|
||||
inputEnergy);
|
||||
else recipe = new AppEngGrinderRecipe(
|
||||
InputHelper.toStack(inputStack),
|
||||
InputHelper.toStack(outputStack),
|
||||
inputEnergy);
|
||||
|
||||
// Check if the recipe is already present, we don't want to add duplicates
|
||||
for (IGrinderEntry r : AEApi.instance().registries().grinder().getRecipes()) {
|
||||
if (r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
|
||||
LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", name, LogHelper.getStackDescription(toStack(inputStack))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Check if the recipe is already present, we don't want to add duplicates
|
||||
for (IGrinderEntry r : AEApi.instance().registries().grinder().getRecipes()) {
|
||||
if (r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"Duplicate %s Recipe found for %s. Command ignored!",
|
||||
name,
|
||||
LogHelper.getStackDescription(toStack(inputStack))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output, int energy, @Optional IItemStack output2, @Optional float chance2, @Optional IItemStack output3, @Optional float chance3) {
|
||||
if (input == null || output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output, int energy, @Optional IItemStack output2,
|
||||
@Optional float chance2, @Optional IItemStack output3, @Optional float chance3) {
|
||||
if (input == null || output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
// Create recipe
|
||||
IGrinderEntry recipe;
|
||||
// Create recipe
|
||||
IGrinderEntry recipe;
|
||||
|
||||
if (output2 != null && output3 != null)
|
||||
recipe = new AppEngGrinderRecipe(InputHelper.toStack(input), InputHelper.toStack(output), InputHelper.toStack(output2), InputHelper.toStack(output3), chance2, chance3, energy);
|
||||
else if (output2 != null)
|
||||
recipe = new AppEngGrinderRecipe(InputHelper.toStack(input), InputHelper.toStack(output), InputHelper.toStack(output2), chance2, energy);
|
||||
else
|
||||
recipe = new AppEngGrinderRecipe(InputHelper.toStack(input), InputHelper.toStack(output), energy);
|
||||
if (output2 != null && output3 != null) recipe = new AppEngGrinderRecipe(
|
||||
InputHelper.toStack(input),
|
||||
InputHelper.toStack(output),
|
||||
InputHelper.toStack(output2),
|
||||
InputHelper.toStack(output3),
|
||||
chance2,
|
||||
chance3,
|
||||
energy);
|
||||
else if (output2 != null) recipe = new AppEngGrinderRecipe(
|
||||
InputHelper.toStack(input),
|
||||
InputHelper.toStack(output),
|
||||
InputHelper.toStack(output2),
|
||||
chance2,
|
||||
energy);
|
||||
else recipe = new AppEngGrinderRecipe(InputHelper.toStack(input), InputHelper.toStack(output), energy);
|
||||
|
||||
// Check if the recipe is already present, we don't want to add duplicates
|
||||
for (IGrinderEntry r : AEApi.instance().registries().grinder().getRecipes()) {
|
||||
if (r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
|
||||
LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", name, LogHelper.getStackDescription(toStack(input))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Check if the recipe is already present, we don't want to add duplicates
|
||||
for (IGrinderEntry r : AEApi.instance().registries().grinder().getRecipes()) {
|
||||
if (r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"Duplicate %s Recipe found for %s. Command ignored!",
|
||||
name,
|
||||
LogHelper.getStackDescription(toStack(input))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<IGrinderEntry> {
|
||||
private static class Add extends BaseListAddition<IGrinderEntry> {
|
||||
|
||||
public Add(IGrinderEntry recipe) {
|
||||
super(Grind.name, AEApi.instance().registries().grinder().getRecipes());
|
||||
recipes.add(recipe);
|
||||
}
|
||||
public Add(IGrinderEntry recipe) {
|
||||
super(Grind.name, AEApi.instance().registries().grinder().getRecipes());
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IGrinderEntry recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getInput());
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo(IGrinderEntry recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getInput());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean equals(IGrinderEntry recipe, IGrinderEntry otherRecipe) {
|
||||
return AppliedEnergisticsHelper.equals(recipe, otherRecipe);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@Override
|
||||
protected boolean equals(IGrinderEntry recipe, IGrinderEntry otherRecipe) {
|
||||
return AppliedEnergisticsHelper.equals(recipe, otherRecipe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Grindstone
|
||||
*
|
||||
* @param input - Product of the Recipe
|
||||
**/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient input) {
|
||||
if (input == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Get list of existing recipes, matching with parameter
|
||||
LinkedList<IGrinderEntry> result = new LinkedList<IGrinderEntry>();
|
||||
/**
|
||||
* Removes a recipe for the Grindstone
|
||||
*
|
||||
* @param input - Product of the Recipe
|
||||
**/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient input) {
|
||||
if (input == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
for (IGrinderEntry entry : AEApi.instance().registries().grinder().getRecipes()) {
|
||||
if (entry != null && entry.getOutput() != null && matches(input, toIItemStack(entry.getOutput()))) {
|
||||
result.add(entry);
|
||||
}
|
||||
}
|
||||
// Get list of existing recipes, matching with parameter
|
||||
LinkedList<IGrinderEntry> result = new LinkedList<IGrinderEntry>();
|
||||
|
||||
// Check if we found the recipes and apply the action
|
||||
if (!result.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(result));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", name, input.toString()));
|
||||
}
|
||||
}
|
||||
for (IGrinderEntry entry : AEApi.instance().registries().grinder().getRecipes()) {
|
||||
if (entry != null && entry.getOutput() != null && matches(input, toIItemStack(entry.getOutput()))) {
|
||||
result.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<IGrinderEntry> {
|
||||
public Remove(LinkedList<IGrinderEntry> recipes) {
|
||||
super(Grind.name, AEApi.instance().registries().grinder().getRecipes(), recipes);
|
||||
}
|
||||
// Check if we found the recipes and apply the action
|
||||
if (!result.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(result));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", name, input.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IGrinderEntry recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getInput());
|
||||
}
|
||||
}
|
||||
private static class Remove extends BaseListRemoval<IGrinderEntry> {
|
||||
|
||||
}
|
||||
public Remove(LinkedList<IGrinderEntry> recipes) {
|
||||
super(Grind.name, AEApi.instance().registries().grinder().getRecipes(), recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IGrinderEntry recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getInput());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,173 +25,208 @@ import appeng.core.features.registries.entries.InscriberRecipe;
|
||||
|
||||
@ZenClass("mods.appeng.Inscriber")
|
||||
public class Inscriber {
|
||||
|
||||
|
||||
protected static final String name = "Applied Energistics 2 Inscriber";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a shaped recipe for the Carpenter
|
||||
*
|
||||
* @param outputStack - Product of the Recipe
|
||||
* @param inputArray - Ingredients of the Recipe
|
||||
* @param inputStackPlateA - Ingredient of the Recipe for Plate Slot A
|
||||
* @param inputStackPlateB - Ingredient of the Recipe for Plate Slot B
|
||||
* @param typeString - Type that decides whether to consume the ItemStack in Plate Slot A/B
|
||||
**/
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack outputStack, IItemStack[] inputArray, IItemStack inputStackPlateA, IItemStack inputStackPlateB, String typeString) {
|
||||
if(inputArray == null || outputStack == null || (!typeString.equals("Press") && !typeString.equals("Inscribe"))) {
|
||||
* Adds a shaped recipe for the Carpenter
|
||||
*
|
||||
* @param outputStack - Product of the Recipe
|
||||
* @param inputArray - Ingredients of the Recipe
|
||||
* @param inputStackPlateA - Ingredient of the Recipe for Plate Slot A
|
||||
* @param inputStackPlateB - Ingredient of the Recipe for Plate Slot B
|
||||
* @param typeString - Type that decides whether to consume the ItemStack in Plate Slot A/B
|
||||
**/
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack outputStack, IItemStack[] inputArray, IItemStack inputStackPlateA,
|
||||
IItemStack inputStackPlateB, String typeString) {
|
||||
if (inputArray == null || outputStack == null
|
||||
|| (!typeString.equals("Press") && !typeString.equals("Inscribe"))) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", Inscriber.name));
|
||||
return;
|
||||
}
|
||||
|
||||
// Create recipe
|
||||
IInscriberRecipe recipe = new InscriberRecipe(ArrayUtils.toArrayList(toStacks(inputArray)), toStack(outputStack), toStack(inputStackPlateA), toStack(inputStackPlateB), InscriberProcessType.valueOf(typeString));
|
||||
|
||||
|
||||
// Create recipe
|
||||
IInscriberRecipe recipe = new InscriberRecipe(
|
||||
ArrayUtils.toArrayList(toStacks(inputArray)),
|
||||
toStack(outputStack),
|
||||
toStack(inputStackPlateA),
|
||||
toStack(inputStackPlateB),
|
||||
InscriberProcessType.valueOf(typeString));
|
||||
|
||||
// Check if the recipe is already present, we don't want to add duplicates
|
||||
for(IInscriberRecipe r : AEApi.instance().registries().inscriber().getRecipes()) {
|
||||
if(r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
|
||||
LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", Inscriber.name, LogHelper.getStackDescription(toStack(outputStack))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack[] imprintable, IItemStack plateA, IItemStack plateB, IItemStack out, String type) {
|
||||
if(imprintable == null || out == null || (!type.equals("Press") && !type.equals("Inscribe"))) {
|
||||
for (IInscriberRecipe r : AEApi.instance().registries().inscriber().getRecipes()) {
|
||||
if (r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"Duplicate %s Recipe found for %s. Command ignored!",
|
||||
Inscriber.name,
|
||||
LogHelper.getStackDescription(toStack(outputStack))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack[] imprintable, IItemStack plateA, IItemStack plateB, IItemStack out,
|
||||
String type) {
|
||||
if (imprintable == null || out == null || (!type.equals("Press") && !type.equals("Inscribe"))) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", Inscriber.name));
|
||||
return;
|
||||
}
|
||||
|
||||
// Create recipe
|
||||
IInscriberRecipe recipe = new InscriberRecipe(ArrayUtils.toArrayList(toStacks(imprintable)), toStack(out), toStack(plateA), toStack(plateB), InscriberProcessType.valueOf(type));
|
||||
|
||||
|
||||
// Create recipe
|
||||
IInscriberRecipe recipe = new InscriberRecipe(
|
||||
ArrayUtils.toArrayList(toStacks(imprintable)),
|
||||
toStack(out),
|
||||
toStack(plateA),
|
||||
toStack(plateB),
|
||||
InscriberProcessType.valueOf(type));
|
||||
|
||||
// Check if the recipe is already present, we don't want to add duplicates
|
||||
for(IInscriberRecipe r : AEApi.instance().registries().inscriber().getRecipes()) {
|
||||
if(r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
|
||||
LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s. Command ignored!", Inscriber.name, LogHelper.getStackDescription(toStack(out))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
for (IInscriberRecipe r : AEApi.instance().registries().inscriber().getRecipes()) {
|
||||
if (r != null && AppliedEnergisticsHelper.equals(r, recipe)) {
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"Duplicate %s Recipe found for %s. Command ignored!",
|
||||
Inscriber.name,
|
||||
LogHelper.getStackDescription(toStack(out))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Add extends BaseListAddition<IInscriberRecipe> {
|
||||
public Add(IInscriberRecipe recipe) {
|
||||
super(Inscriber.name, new ArrayList<>(AEApi.instance().registries().inscriber().getRecipes()));
|
||||
recipes.add(recipe);
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if(recipes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
public static class Add extends BaseListAddition<IInscriberRecipe> {
|
||||
|
||||
for(IInscriberRecipe recipe : recipes) {
|
||||
try {
|
||||
AEApi.instance().registries().inscriber().addRecipe(recipe);
|
||||
successful.add(recipe);
|
||||
} catch (Exception ex) { LogHelper.logError("Error adding inscriber recipe.", ex); }
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if(successful.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
public Add(IInscriberRecipe recipe) {
|
||||
super(Inscriber.name, new ArrayList<>(AEApi.instance().registries().inscriber().getRecipes()));
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
for(IInscriberRecipe recipe : successful) {
|
||||
@Override
|
||||
public void apply() {
|
||||
if (recipes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (IInscriberRecipe recipe : recipes) {
|
||||
try {
|
||||
AEApi.instance().registries().inscriber().addRecipe(recipe);
|
||||
successful.add(recipe);
|
||||
} catch (Exception ex) {
|
||||
LogHelper.logError("Error adding inscriber recipe.", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if (successful.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (IInscriberRecipe recipe : successful) {
|
||||
try {
|
||||
AEApi.instance().registries().inscriber().removeRecipe(recipe);
|
||||
} catch (Exception ex) { LogHelper.logError("Error removing inscriber recipe.", ex); }
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
LogHelper.logError("Error removing inscriber recipe.", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IInscriberRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean equals(IInscriberRecipe recipe, IInscriberRecipe otherRecipe) {
|
||||
return AppliedEnergisticsHelper.equals(recipe, otherRecipe);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a shaped recipe for the Carpenter
|
||||
*
|
||||
* @param outputStack - Product of the Recipe
|
||||
**/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient outputStack) {
|
||||
if(outputStack == null) {
|
||||
* Adds a shaped recipe for the Carpenter
|
||||
*
|
||||
* @param outputStack - Product of the Recipe
|
||||
**/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient outputStack) {
|
||||
if (outputStack == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", Inscriber.name));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get list of existing recipes, matching with parameter
|
||||
LinkedList<IInscriberRecipe> result = new LinkedList<IInscriberRecipe>();
|
||||
|
||||
for(IInscriberRecipe entry : AEApi.instance().registries().inscriber().getRecipes()) {
|
||||
if(entry != null && entry.getOutput() != null && matches(outputStack, toIItemStack(entry.getOutput()))) {
|
||||
|
||||
for (IInscriberRecipe entry : AEApi.instance().registries().inscriber().getRecipes()) {
|
||||
if (entry != null && entry.getOutput() != null && matches(outputStack, toIItemStack(entry.getOutput()))) {
|
||||
result.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check if we found the recipes and apply the action
|
||||
if(!result.isEmpty()) {
|
||||
if (!result.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(result));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Inscriber.name, outputStack.toString()));
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"No %s Recipe found for %s. Command ignored!",
|
||||
Inscriber.name,
|
||||
outputStack.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class Remove extends BaseListRemoval<IInscriberRecipe> {
|
||||
public Remove(LinkedList<IInscriberRecipe> recipes) {
|
||||
super(Inscriber.name, new ArrayList<>(AEApi.instance().registries().inscriber().getRecipes()), recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if(this.recipes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(IInscriberRecipe recipe : recipes) {
|
||||
public static class Remove extends BaseListRemoval<IInscriberRecipe> {
|
||||
|
||||
public Remove(LinkedList<IInscriberRecipe> recipes) {
|
||||
super(Inscriber.name, new ArrayList<>(AEApi.instance().registries().inscriber().getRecipes()), recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if (this.recipes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (IInscriberRecipe recipe : recipes) {
|
||||
try {
|
||||
AEApi.instance().registries().inscriber().removeRecipe(recipe);
|
||||
successful.add(recipe);
|
||||
} catch (Exception ex) { LogHelper.logError("Error removing inscriber recipe.", ex); }
|
||||
} catch (Exception ex) {
|
||||
LogHelper.logError("Error removing inscriber recipe.", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if(successful.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(IInscriberRecipe recipe : successful) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if (successful.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (IInscriberRecipe recipe : successful) {
|
||||
try {
|
||||
AEApi.instance().registries().inscriber().addRecipe(recipe);
|
||||
} catch (Exception ex) { LogHelper.logError("Error restoring inscriber recipe.", ex); }
|
||||
} catch (Exception ex) {
|
||||
LogHelper.logError("Error restoring inscriber recipe.", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IInscriberRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo(IInscriberRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,10 @@ import modtweaker2.mods.auracascade.aura.AuraBracketHandler;
|
||||
import modtweaker2.mods.auracascade.handlers.Pylon;
|
||||
|
||||
public class AuraCascade {
|
||||
public AuraCascade(){
|
||||
MineTweakerAPI.registerBracketHandler(new AuraBracketHandler());
|
||||
MineTweakerAPI.registerClass(Pylon.class);
|
||||
}
|
||||
|
||||
public AuraCascade() {
|
||||
MineTweakerAPI.registerBracketHandler(new AuraBracketHandler());
|
||||
MineTweakerAPI.registerClass(Pylon.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,20 +5,21 @@ import pixlepix.auracascade.data.AuraQuantity;
|
||||
import pixlepix.auracascade.data.EnumAura;
|
||||
|
||||
public class AuraCascadeHelper {
|
||||
public static AuraQuantity toAura(IAuraStack iStack) {
|
||||
if (iStack == null) {
|
||||
return null;
|
||||
} else return new AuraQuantity(EnumAura.valueOf(iStack.getName()), iStack.getAmount());
|
||||
}
|
||||
|
||||
// public static GasStack[] toGases(IIngredient[] input) {
|
||||
// return toGases((IGasStack[]) input);
|
||||
// }
|
||||
//
|
||||
// public static GasStack[] toGases(IGasStack[] iStack) {
|
||||
// GasStack[] stack = new GasStack[iStack.length];
|
||||
// for (int i = 0; i < stack.length; i++)
|
||||
// stack[i] = toGas(iStack[i]);
|
||||
// return stack;
|
||||
// }
|
||||
public static AuraQuantity toAura(IAuraStack iStack) {
|
||||
if (iStack == null) {
|
||||
return null;
|
||||
} else return new AuraQuantity(EnumAura.valueOf(iStack.getName()), iStack.getAmount());
|
||||
}
|
||||
|
||||
// public static GasStack[] toGases(IIngredient[] input) {
|
||||
// return toGases((IGasStack[]) input);
|
||||
// }
|
||||
//
|
||||
// public static GasStack[] toGases(IGasStack[] iStack) {
|
||||
// GasStack[] stack = new GasStack[iStack.length];
|
||||
// for (int i = 0; i < stack.length; i++)
|
||||
// stack[i] = toGas(iStack[i]);
|
||||
// return stack;
|
||||
// }
|
||||
}
|
||||
@@ -20,66 +20,67 @@ import stanhebben.zenscript.util.ZenPosition;
|
||||
@BracketHandler(priority = 100)
|
||||
public class AuraBracketHandler implements IBracketHandler {
|
||||
|
||||
public static IAuraStack getAura(String name) {
|
||||
EnumAura aura = EnumAura.valueOf(name);
|
||||
if (aura != null) {
|
||||
return new MCAuraStack(new AuraQuantity(aura, 1));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static IAuraStack getAura(String name) {
|
||||
EnumAura aura = EnumAura.valueOf(name);
|
||||
if (aura != null) {
|
||||
return new MCAuraStack(new AuraQuantity(aura, 1));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private final IZenSymbol symbolAny;
|
||||
private final IJavaMethod method;
|
||||
private final IZenSymbol symbolAny;
|
||||
private final IJavaMethod method;
|
||||
|
||||
public AuraBracketHandler() {
|
||||
symbolAny = MineTweakerAPI.getJavaStaticFieldSymbol(IngredientAny.class, "INSTANCE");
|
||||
method = MineTweakerAPI.getJavaMethod(AuraBracketHandler.class, "getAura", String.class);
|
||||
}
|
||||
public AuraBracketHandler() {
|
||||
symbolAny = MineTweakerAPI.getJavaStaticFieldSymbol(IngredientAny.class, "INSTANCE");
|
||||
method = MineTweakerAPI.getJavaMethod(AuraBracketHandler.class, "getAura", String.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IZenSymbol resolve(IEnvironmentGlobal environment, List<Token> tokens) {
|
||||
// any symbol
|
||||
if (tokens.size() == 1 && tokens.get(0).getValue().equals("*")) {
|
||||
return symbolAny;
|
||||
}
|
||||
@Override
|
||||
public IZenSymbol resolve(IEnvironmentGlobal environment, List<Token> tokens) {
|
||||
// any symbol
|
||||
if (tokens.size() == 1 && tokens.get(0).getValue().equals("*")) {
|
||||
return symbolAny;
|
||||
}
|
||||
|
||||
if (tokens.size() > 2) {
|
||||
if (tokens.get(0).getValue().equals("aura") && tokens.get(1).getValue().equals(":")) {
|
||||
return find(environment, tokens, 2, tokens.size());
|
||||
}
|
||||
}
|
||||
if (tokens.size() > 2) {
|
||||
if (tokens.get(0).getValue().equals("aura") && tokens.get(1).getValue().equals(":")) {
|
||||
return find(environment, tokens, 2, tokens.size());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private IZenSymbol find(IEnvironmentGlobal environment, List<Token> tokens, int startIndex, int endIndex) {
|
||||
//StringBuilder valueBuilder = new StringBuilder();
|
||||
private IZenSymbol find(IEnvironmentGlobal environment, List<Token> tokens, int startIndex, int endIndex) {
|
||||
// StringBuilder valueBuilder = new StringBuilder();
|
||||
|
||||
for (EnumAura a : EnumAura.values()) {
|
||||
for (int i = startIndex; i < endIndex; i++) {
|
||||
Token token = tokens.get(i);
|
||||
if (a.name().equals(token.getValue())) {
|
||||
return new AuraReferenceSymbol(environment, token.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (EnumAura a : EnumAura.values()) {
|
||||
for (int i = startIndex; i < endIndex; i++) {
|
||||
Token token = tokens.get(i);
|
||||
if (a.name().equals(token.getValue())) {
|
||||
return new AuraReferenceSymbol(environment, token.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private class AuraReferenceSymbol implements IZenSymbol {
|
||||
private final IEnvironmentGlobal environment;
|
||||
private final String name;
|
||||
private class AuraReferenceSymbol implements IZenSymbol {
|
||||
|
||||
public AuraReferenceSymbol(IEnvironmentGlobal environment, String name) {
|
||||
this.environment = environment;
|
||||
this.name = name;
|
||||
}
|
||||
private final IEnvironmentGlobal environment;
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public IPartialExpression instance(ZenPosition position) {
|
||||
return new ExpressionCallStatic(position, environment, method, new ExpressionString(position, name));
|
||||
}
|
||||
}
|
||||
}
|
||||
public AuraReferenceSymbol(IEnvironmentGlobal environment, String name) {
|
||||
this.environment = environment;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPartialExpression instance(ZenPosition position) {
|
||||
return new ExpressionCallStatic(position, environment, method, new ExpressionString(position, name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import stanhebben.zenscript.annotations.ZenOperator;
|
||||
|
||||
@ZenClass("modtweaker.auraCascade.IAuraDefinition")
|
||||
public interface IAuraDefinition {
|
||||
|
||||
|
||||
@ZenOperator(OperatorType.MUL)
|
||||
public IAuraStack asAura(int amount);
|
||||
|
||||
@@ -16,4 +16,4 @@ public interface IAuraDefinition {
|
||||
|
||||
@ZenGetter("displayName")
|
||||
public String getDisplayName();
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import stanhebben.zenscript.annotations.ZenOperator;
|
||||
|
||||
@ZenClass("modtweaker.auraCascade.IAuraStack")
|
||||
public interface IAuraStack {
|
||||
|
||||
@ZenGetter("definition")
|
||||
public IAuraDefinition getDefinition();
|
||||
|
||||
@@ -25,4 +26,4 @@ public interface IAuraStack {
|
||||
public IAuraStack withAmount(int amount);
|
||||
|
||||
public Object getInternal();
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package modtweaker2.mods.auracascade.aura;
|
||||
|
||||
import pixlepix.auracascade.data.AuraQuantity;
|
||||
|
||||
|
||||
public class MCAuraDefinition implements IAuraDefinition {
|
||||
|
||||
private final AuraQuantity aura;
|
||||
|
||||
public MCAuraDefinition(AuraQuantity aura) {
|
||||
@@ -20,8 +20,8 @@ public class MCAuraDefinition implements IAuraDefinition {
|
||||
return aura.getType().name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAuraStack asAura(int amount) {
|
||||
return new MCAuraStack(new AuraQuantity(aura.getType(), aura.getNum()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public IAuraStack asAura(int amount) {
|
||||
return new MCAuraStack(new AuraQuantity(aura.getType(), aura.getNum()));
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package modtweaker2.mods.auracascade.aura;
|
||||
|
||||
import pixlepix.auracascade.data.AuraQuantity;
|
||||
|
||||
|
||||
public class MCAuraStack implements IAuraStack {
|
||||
|
||||
private final AuraQuantity aura;
|
||||
|
||||
public MCAuraStack(AuraQuantity aura) {
|
||||
@@ -40,4 +40,4 @@ public class MCAuraStack implements IAuraStack {
|
||||
public Object getInternal() {
|
||||
return aura;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,20 +9,21 @@ import pixlepix.auracascade.data.EnumAura;
|
||||
|
||||
public class AuraLogger implements ICommandFunction {
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
|
||||
|
||||
System.out.println("Aura Types: " + EnumAura.values().length);
|
||||
MineTweakerAPI.logCommand("Aura Types: " + EnumAura.values().length);
|
||||
for (EnumAura aura : EnumAura.values()) {
|
||||
ModTweaker2.logger.info("Aura Type: " + aura.name() + ".");
|
||||
MineTweakerAPI.logCommand("Aura Type: " + aura.name() + ".");
|
||||
System.out.println("Aura Types: " + EnumAura.values().length);
|
||||
MineTweakerAPI.logCommand("Aura Types: " + EnumAura.values().length);
|
||||
for (EnumAura aura : EnumAura.values()) {
|
||||
ModTweaker2.logger.info("Aura Type: " + aura.name() + ".");
|
||||
MineTweakerAPI.logCommand("Aura Type: " + aura.name() + ".");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
if (player != null) {
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,65 +22,74 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.auraCascade.Pylon")
|
||||
public class Pylon {
|
||||
|
||||
|
||||
protected static final String name = "Aura Cascade Pylon";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack ouput, IAuraStack stack, IItemStack input) {
|
||||
addRecipe(ouput, stack, input, stack, input, stack, input, stack, input);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack ouput, IAuraStack aura1, IItemStack input1, IAuraStack aura2, IItemStack input2, IAuraStack aura3, IItemStack input3, IAuraStack aura4, IItemStack input4) {
|
||||
List<PylonRecipe> recipes = new LinkedList<PylonRecipe>();
|
||||
|
||||
recipes.add(new PylonRecipe(toStack(ouput), new PylonRecipeComponent(AuraCascadeHelper.toAura(aura1), toStack(input1)), new PylonRecipeComponent(AuraCascadeHelper.toAura(aura2), toStack(input2)), new PylonRecipeComponent(AuraCascadeHelper.toAura(aura3), toStack(input3)), new PylonRecipeComponent(AuraCascadeHelper.toAura(aura1), toStack(input4))));
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipes));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack ouput, IAuraStack stack, IItemStack input) {
|
||||
addRecipe(ouput, stack, input, stack, input, stack, input, stack, input);
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<PylonRecipe> {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack ouput, IAuraStack aura1, IItemStack input1, IAuraStack aura2,
|
||||
IItemStack input2, IAuraStack aura3, IItemStack input3, IAuraStack aura4, IItemStack input4) {
|
||||
List<PylonRecipe> recipes = new LinkedList<PylonRecipe>();
|
||||
|
||||
recipes.add(
|
||||
new PylonRecipe(
|
||||
toStack(ouput),
|
||||
new PylonRecipeComponent(AuraCascadeHelper.toAura(aura1), toStack(input1)),
|
||||
new PylonRecipeComponent(AuraCascadeHelper.toAura(aura2), toStack(input2)),
|
||||
new PylonRecipeComponent(AuraCascadeHelper.toAura(aura3), toStack(input3)),
|
||||
new PylonRecipeComponent(AuraCascadeHelper.toAura(aura1), toStack(input4))));
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipes));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<PylonRecipe> {
|
||||
|
||||
public Add(List<PylonRecipe> recipes) {
|
||||
super(Pylon.name, PylonRecipeRegistry.recipes, recipes);
|
||||
}
|
||||
|
||||
public Add(List<PylonRecipe> recipes) {
|
||||
super(Pylon.name, PylonRecipeRegistry.recipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(PylonRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.result);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
List<PylonRecipe> recipes = new LinkedList<PylonRecipe>();
|
||||
|
||||
|
||||
for (PylonRecipe r : PylonRecipeRegistry.recipes) {
|
||||
if (output.matches(toIItemStack(r.result))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check if we found the recipes and apply the action
|
||||
if(!recipes.isEmpty()) {
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Pylon.name, output.toString()));
|
||||
LogHelper.logWarning(
|
||||
String.format("No %s Recipe found for %s. Command ignored!", Pylon.name, output.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<PylonRecipe> {
|
||||
public Remove(List<PylonRecipe> recipes) {
|
||||
super(Pylon.name, PylonRecipeRegistry.recipes, recipes);
|
||||
}
|
||||
private static class Remove extends BaseListRemoval<PylonRecipe> {
|
||||
|
||||
public Remove(List<PylonRecipe> recipes) {
|
||||
super(Pylon.name, PylonRecipeRegistry.recipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(PylonRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,13 @@ import modtweaker2.mods.botania.handlers.ManaInfusion;
|
||||
import modtweaker2.mods.botania.handlers.Orechid;
|
||||
import modtweaker2.mods.botania.handlers.PureDaisy;
|
||||
import modtweaker2.mods.botania.handlers.RuneAltar;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
|
||||
public class Botania {
|
||||
|
||||
public Botania() {
|
||||
MineTweakerAPI.registerClass(Apothecary.class);
|
||||
MineTweakerAPI.registerClass(Brew.class);
|
||||
|
||||
@@ -8,32 +8,25 @@ import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
public class BotaniaHelper {
|
||||
public static LexiconCategory findCatagory(String name)
|
||||
{
|
||||
List<LexiconCategory> catagories=BotaniaAPI.getAllCategories();
|
||||
for(int i=0;i<catagories.size();i++)
|
||||
{
|
||||
if(catagories.get(i).getUnlocalizedName().equalsIgnoreCase(name))
|
||||
return catagories.get(i);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static LexiconEntry findEntry(String name)
|
||||
{
|
||||
List<LexiconEntry> entries=BotaniaAPI.getAllEntries();
|
||||
for(int i=0;i<entries.size();i++)
|
||||
{
|
||||
if(entries.get(i).getUnlocalizedName().equalsIgnoreCase(name))
|
||||
return entries.get(i);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static 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 KnowledgeType findKnowledgeType(String name)
|
||||
{
|
||||
if(BotaniaAPI.knowledgeTypes.containsKey(name))
|
||||
return BotaniaAPI.knowledgeTypes.get(name);
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,11 @@ import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
public class BotaniaBrewLogger implements ICommandFunction{
|
||||
public class BotaniaBrewLogger implements ICommandFunction {
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
Set<String> brew_keys=BotaniaAPI.brewMap.keySet();
|
||||
Set<String> brew_keys = BotaniaAPI.brewMap.keySet();
|
||||
System.out.println("Brews: " + brew_keys.size());
|
||||
for (String key : brew_keys) {
|
||||
System.out.println("Brew " + key);
|
||||
@@ -20,7 +20,9 @@ public class BotaniaBrewLogger implements ICommandFunction{
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,9 @@ import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.helpers.StringHelper;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
@@ -20,9 +22,9 @@ import vazkii.botania.api.recipe.RecipePureDaisy;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
|
||||
public class BotaniaLogger implements ICommandFunction {
|
||||
|
||||
|
||||
private static final List<String> validArguments = new LinkedList<String>();
|
||||
|
||||
|
||||
static {
|
||||
validArguments.add("Apothecary");
|
||||
validArguments.add("Brew");
|
||||
@@ -35,69 +37,86 @@ public class BotaniaLogger implements ICommandFunction {
|
||||
@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, ", ")));
|
||||
|
||||
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("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("Brew")) {
|
||||
for (RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.botania.Brew.addRecipe(%s, \"%s\");",
|
||||
LogHelper.getListDescription(recipe.getInputs()),
|
||||
recipe.getBrew().getKey()));
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("ElvenTrade")) {
|
||||
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.botania.ElvenTrade.addRecipe(%s, %s);",
|
||||
LogHelper.getStackDescription(recipe.getOutput()),
|
||||
LogHelper.getListDescription(recipe.getInputs()
|
||||
)));
|
||||
|
||||
if (args.isEmpty() || args.contains("ElvenTrade")) {
|
||||
for (RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.botania.ElvenTrade.addRecipe(%s, %s);",
|
||||
LogHelper.getStackDescription(recipe.getOutput()),
|
||||
LogHelper.getListDescription(recipe.getInputs())));
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("ManaInfusion")) {
|
||||
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.botania.ManaInfusion.add%s(%s, %s, %d);",
|
||||
recipe.isAlchemy() ? "Alchemy" : recipe.isConjuration() ? "Conjuration" : "Infusion",
|
||||
LogHelper.getStackDescription(recipe.getOutput()),
|
||||
LogHelper.getStackDescription(recipe.getInput()),
|
||||
recipe.getManaToConsume()
|
||||
));
|
||||
|
||||
if (args.isEmpty() || args.contains("ManaInfusion")) {
|
||||
for (RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.botania.ManaInfusion.add%s(%s, %s, %d);",
|
||||
recipe.isAlchemy() ? "Alchemy"
|
||||
: recipe.isConjuration() ? "Conjuration" : "Infusion",
|
||||
LogHelper.getStackDescription(recipe.getOutput()),
|
||||
LogHelper.getStackDescription(recipe.getInput()),
|
||||
recipe.getManaToConsume()));
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("PureDaisy")) {
|
||||
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.botania.PureDaisy.addRecipe(%s, %s);",
|
||||
LogHelper.getStackDescription(recipe.getInput()),
|
||||
LogHelper.getStackDescription(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta()))));
|
||||
|
||||
if (args.isEmpty() || args.contains("PureDaisy")) {
|
||||
for (RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.botania.PureDaisy.addRecipe(%s, %s);",
|
||||
LogHelper.getStackDescription(recipe.getInput()),
|
||||
LogHelper.getStackDescription(
|
||||
new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta()))));
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("RuneAltar")) {
|
||||
for(RecipeRuneAltar recipe : BotaniaAPI.runeAltarRecipes) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.botania.RuneAltar.addRecipe(%s, %s, %d);",
|
||||
LogHelper.getStackDescription(recipe.getOutput()),
|
||||
LogHelper.getListDescription(recipe.getInputs()),
|
||||
recipe.getManaUsage()
|
||||
));
|
||||
|
||||
if (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"));
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,18 +10,20 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
public class BotaniaOrechidLogger implements ICommandFunction {
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
|
||||
Set<String> keys = BotaniaAPI.oreWeights.keySet();
|
||||
System.out.println("Orechid Keys: " + keys.size());
|
||||
for (String str : BotaniaAPI.oreWeights.keySet()) {
|
||||
System.out.println("Orechid Key: " + str);
|
||||
MineTweakerAPI.logCommand(str + ": " + BotaniaAPI.oreWeights.get(str) + "\n");
|
||||
}
|
||||
Set<String> keys = BotaniaAPI.oreWeights.keySet();
|
||||
System.out.println("Orechid Keys: " + keys.size());
|
||||
for (String str : BotaniaAPI.oreWeights.keySet()) {
|
||||
System.out.println("Orechid Key: " + str);
|
||||
MineTweakerAPI.logCommand(str + ": " + BotaniaAPI.oreWeights.get(str) + "\n");
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
if (player != null) {
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,9 +22,9 @@ import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
|
||||
@ZenClass("mods.botania.Apothecary")
|
||||
public class Apothecary {
|
||||
|
||||
|
||||
protected static final String name = "Botania Petal";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
@@ -38,6 +38,7 @@ public class Apothecary {
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipePetals> {
|
||||
|
||||
public Add(RecipePetals recipe) {
|
||||
super("Botania Petal", BotaniaAPI.petalRecipes);
|
||||
recipes.add(recipe);
|
||||
@@ -55,18 +56,19 @@ public class Apothecary {
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
// Get list of existing recipes, matching with parameter
|
||||
LinkedList<RecipePetals> result = new LinkedList<RecipePetals>();
|
||||
|
||||
for(RecipePetals entry : BotaniaAPI.petalRecipes) {
|
||||
if(entry != null && entry.getOutput() != null && matches(output, toIItemStack(entry.getOutput()))) {
|
||||
|
||||
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()) {
|
||||
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()));
|
||||
LogHelper.logWarning(
|
||||
String.format("No %s Recipe found for %s. Command ignored!", Apothecary.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +78,7 @@ public class Apothecary {
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<RecipePetals> {
|
||||
|
||||
public Remove(List<RecipePetals> recipes) {
|
||||
super(Apothecary.name, BotaniaAPI.petalRecipes, recipes);
|
||||
}
|
||||
|
||||
@@ -19,27 +19,27 @@ import vazkii.botania.api.recipe.RecipeBrew;
|
||||
|
||||
@ZenClass("mods.botania.Brew")
|
||||
public class Brew {
|
||||
|
||||
|
||||
public static final String name = "Botania Brew";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IIngredient[] inputItems, String brewName) {
|
||||
if(inputItems == null || inputItems.length == 0 || brewName == null || brewName.length() == 0) {
|
||||
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)) {
|
||||
|
||||
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) {
|
||||
@@ -50,36 +50,36 @@ public class Brew {
|
||||
@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) {
|
||||
|
||||
for (RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
matcher.reset(recipe.getBrew().getKey());
|
||||
if(matcher.matches()) {
|
||||
if (matcher.matches()) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
|
||||
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();
|
||||
|
||||
@@ -21,17 +21,18 @@ import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
|
||||
@ZenClass("mods.botania.ElvenTrade")
|
||||
public class ElvenTrade {
|
||||
|
||||
|
||||
protected static final String name = "Botania Eleven Trade";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IIngredient[] input) {
|
||||
MineTweakerAPI.apply(new Add(new RecipeElvenTrade(toStack(output), toObjects(input))));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipeElvenTrade> {
|
||||
|
||||
public Add(RecipeElvenTrade recipe) {
|
||||
super(ElvenTrade.name, BotaniaAPI.elvenTradeRecipes);
|
||||
recipes.add(recipe);
|
||||
@@ -49,22 +50,24 @@ public class ElvenTrade {
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
// Get list of existing recipes, matching with parameter
|
||||
LinkedList<RecipeElvenTrade> recipes = new LinkedList<RecipeElvenTrade>();
|
||||
|
||||
for(RecipeElvenTrade entry : BotaniaAPI.elvenTradeRecipes) {
|
||||
if(entry != null && entry.getOutput() != null && matches(output, toIItemStack(entry.getOutput()))) {
|
||||
|
||||
for (RecipeElvenTrade entry : BotaniaAPI.elvenTradeRecipes) {
|
||||
if (entry != null && entry.getOutput() != null && matches(output, toIItemStack(entry.getOutput()))) {
|
||||
recipes.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check if we found the recipes and apply the action
|
||||
if(!recipes.isEmpty()) {
|
||||
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()));
|
||||
LogHelper.logWarning(
|
||||
String.format("No %s Recipe found for %s. Command ignored!", ElvenTrade.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<RecipeElvenTrade> {
|
||||
|
||||
public Remove(List<RecipeElvenTrade> recipes) {
|
||||
super(ElvenTrade.name, BotaniaAPI.elvenTradeRecipes, recipes);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.init.Blocks;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
@@ -26,8 +24,10 @@ import modtweaker2.mods.botania.lexicon.RemoveRecipeMapping;
|
||||
import modtweaker2.mods.botania.lexicon.SetCategoryIcon;
|
||||
import modtweaker2.mods.botania.lexicon.SetCategoryPriority;
|
||||
import modtweaker2.mods.botania.lexicon.SetEntryKnowledgeType;
|
||||
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
@@ -56,417 +56,379 @@ import vazkii.botania.common.lexicon.page.PageText;
|
||||
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));
|
||||
public static void addBrewPage(String name, String entry, int page_number, String brew, IIngredient[] recipe,
|
||||
String bottomText) {
|
||||
LexiconEntry lexiconEntry = BotaniaHelper.findEntry(entry);
|
||||
if (lexiconEntry == null) {
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry " + entry);
|
||||
return;
|
||||
}
|
||||
if (page_number > lexiconEntry.pages.size()) {
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for " + entry);
|
||||
return;
|
||||
}
|
||||
if (BotaniaAPI.getBrewFromKey(brew) == null) {
|
||||
MineTweakerAPI.getLogger().logError("Cannot find brew " + brew);
|
||||
return;
|
||||
}
|
||||
RecipeBrew page_recipe = new RecipeBrew(BotaniaAPI.getBrewFromKey(brew), toObjects(recipe));
|
||||
LexiconPage page = new PageBrew(page_recipe, name, bottomText);
|
||||
MineTweakerAPI.apply(new AddPage(name, lexiconEntry, page, page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addCraftingPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[][][] inputs) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
if(outputs.length!=inputs.length)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Length of input and output must match");
|
||||
return;
|
||||
}
|
||||
List<IRecipe> recipes=new ArrayList<IRecipe>();
|
||||
for(int i=0;i<outputs.length;i++)
|
||||
{
|
||||
recipes.add(RecipeConverter.convert(new ShapedRecipe(outputs[i],inputs[i],null,false)));
|
||||
}
|
||||
LexiconPage page=new PageCraftingRecipe(name, recipes);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
public static void addCraftingPage(String name, String entry, int page_number, IItemStack[] outputs,
|
||||
IIngredient[][][] inputs) {
|
||||
LexiconEntry lexiconEntry = BotaniaHelper.findEntry(entry);
|
||||
if (lexiconEntry == null) {
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry " + entry);
|
||||
return;
|
||||
}
|
||||
if (page_number > lexiconEntry.pages.size()) {
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for " + entry);
|
||||
return;
|
||||
}
|
||||
if (outputs.length != inputs.length) {
|
||||
MineTweakerAPI.getLogger().logError("Length of input and output must match");
|
||||
return;
|
||||
}
|
||||
List<IRecipe> recipes = new ArrayList<IRecipe>();
|
||||
for (int i = 0; i < outputs.length; i++) {
|
||||
recipes.add(RecipeConverter.convert(new ShapedRecipe(outputs[i], inputs[i], null, false)));
|
||||
}
|
||||
LexiconPage page = new PageCraftingRecipe(name, recipes);
|
||||
MineTweakerAPI.apply(new AddPage(name, lexiconEntry, page, page_number));
|
||||
}
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addElvenPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[][] inputs) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
if(outputs.length!=inputs.length)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Length of input and output must match");
|
||||
return;
|
||||
}
|
||||
List<RecipeElvenTrade> recipes=new ArrayList<RecipeElvenTrade>();
|
||||
for(int i=0;i<outputs.length;i++)
|
||||
{
|
||||
recipes.add(new RecipeElvenTrade(toStack(outputs[i]),toObjects(inputs[i])));
|
||||
}
|
||||
LexiconPage page=new PageElvenRecipe(name,recipes);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
public static void addElvenPage(String name, String entry, int page_number, IItemStack[] outputs,
|
||||
IIngredient[][] inputs) {
|
||||
LexiconEntry lexiconEntry = BotaniaHelper.findEntry(entry);
|
||||
if (lexiconEntry == null) {
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry " + entry);
|
||||
return;
|
||||
}
|
||||
if (page_number > lexiconEntry.pages.size()) {
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for " + entry);
|
||||
return;
|
||||
}
|
||||
if (outputs.length != inputs.length) {
|
||||
MineTweakerAPI.getLogger().logError("Length of input and output must match");
|
||||
return;
|
||||
}
|
||||
List<RecipeElvenTrade> recipes = new ArrayList<RecipeElvenTrade>();
|
||||
for (int i = 0; i < outputs.length; i++) {
|
||||
recipes.add(new RecipeElvenTrade(toStack(outputs[i]), toObjects(inputs[i])));
|
||||
}
|
||||
LexiconPage page = new PageElvenRecipe(name, recipes);
|
||||
MineTweakerAPI.apply(new AddPage(name, lexiconEntry, page, page_number));
|
||||
}
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addEntityPage(String name, String entry, int page_number, String entity, int size) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
if(!EntityList.stringToClassMapping.containsKey(entity))
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("No such entity "+entity);
|
||||
return;
|
||||
}
|
||||
LexiconPage page=new PageEntity(entity, entity, size);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
LexiconEntry lexiconEntry = BotaniaHelper.findEntry(entry);
|
||||
if (lexiconEntry == null) {
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry " + entry);
|
||||
return;
|
||||
}
|
||||
if (page_number > lexiconEntry.pages.size()) {
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for " + entry);
|
||||
return;
|
||||
}
|
||||
if (!EntityList.stringToClassMapping.containsKey(entity)) {
|
||||
MineTweakerAPI.getLogger().logError("No such entity " + entity);
|
||||
return;
|
||||
}
|
||||
LexiconPage page = new PageEntity(entity, entity, size);
|
||||
MineTweakerAPI.apply(new AddPage(name, lexiconEntry, page, page_number));
|
||||
}
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addImagePage(String name, String entry, int page_number, String resource) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
LexiconPage page=new PageImage(name, resource);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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;
|
||||
}
|
||||
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));
|
||||
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);
|
||||
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;
|
||||
}
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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;
|
||||
}
|
||||
if (LexiconRecipeMappings.getDataForStack(toStack(stack)) == null) {
|
||||
MineTweakerAPI.getLogger().logError("There isn't a recipe mapping for " + stack);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new RemoveRecipeMapping(toStack(stack)));
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,11 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
|
||||
|
||||
@ZenClass("mods.botania.ManaInfusion")
|
||||
public class ManaInfusion {
|
||||
|
||||
|
||||
protected static final String name = "Botania Mana Infusion";
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addInfusion(IItemStack output, IIngredient input, int mana) {
|
||||
MineTweakerAPI.apply(new Add(new RecipeManaInfusion(toStack(output), toObject(input), mana)));
|
||||
@@ -45,6 +44,7 @@ public class ManaInfusion {
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipeManaInfusion> {
|
||||
|
||||
public Add(RecipeManaInfusion recipe) {
|
||||
super(ManaInfusion.name, BotaniaAPI.manaInfusionRecipes);
|
||||
recipes.add(recipe);
|
||||
@@ -62,22 +62,24 @@ public class ManaInfusion {
|
||||
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()) {
|
||||
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()));
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ 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));
|
||||
@@ -20,6 +21,7 @@ public class Orechid {
|
||||
}
|
||||
|
||||
private static class Add implements IUndoableAction {
|
||||
|
||||
String oreDict;
|
||||
int weight;
|
||||
|
||||
@@ -72,6 +74,7 @@ public class Orechid {
|
||||
}
|
||||
|
||||
private static class Remove implements IUndoableAction {
|
||||
|
||||
String oreDict;
|
||||
int weight;
|
||||
|
||||
|
||||
@@ -11,8 +11,10 @@ import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.helpers.StackHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
@@ -20,71 +22,76 @@ import vazkii.botania.api.recipe.RecipePureDaisy;
|
||||
|
||||
@ZenClass("mods.botania.PureDaisy")
|
||||
public class PureDaisy {
|
||||
|
||||
|
||||
public static final String name = "Botania PureDaisy";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IIngredient blockInput, IItemStack blockOutput) {
|
||||
if(blockInput == null || blockOutput == null) {
|
||||
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))) {
|
||||
|
||||
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());
|
||||
|
||||
if (input instanceof ItemStack) input = Block.getBlockFromItem(((ItemStack) input).getItem());
|
||||
ItemStack output = InputHelper.toStack(blockOutput);
|
||||
|
||||
RecipePureDaisy recipe = new RecipePureDaisy(input, Block.getBlockFromItem(output.getItem()), output.getItemDamage());
|
||||
|
||||
|
||||
RecipePureDaisy recipe = new RecipePureDaisy(
|
||||
input,
|
||||
Block.getBlockFromItem(output.getItem()),
|
||||
output.getItemDamage());
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
|
||||
private static class Add extends BaseListAddition<RecipePureDaisy> {
|
||||
|
||||
public Add(RecipePureDaisy recipe) {
|
||||
super(PureDaisy.name, BotaniaAPI.pureDaisyRecipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(RecipePureDaisy recipe) {
|
||||
return LogHelper.getStackDescription(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
List<RecipePureDaisy> recipes = new LinkedList<RecipePureDaisy>();
|
||||
|
||||
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
|
||||
for (RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
IItemStack out = InputHelper.toIItemStack(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta()));
|
||||
|
||||
if(StackHelper.matches(output, out)) {
|
||||
|
||||
if (StackHelper.matches(output, out)) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class Remove extends BaseListRemoval<RecipePureDaisy> {
|
||||
|
||||
public Remove(List<RecipePureDaisy> recipes) {
|
||||
super(PureDaisy.name, BotaniaAPI.pureDaisyRecipes, recipes);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(RecipePureDaisy recipe) {
|
||||
return LogHelper.getStackDescription(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta()));
|
||||
|
||||
@@ -21,20 +21,21 @@ import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
|
||||
@ZenClass("mods.botania.RuneAltar")
|
||||
public class RuneAltar {
|
||||
|
||||
|
||||
protected static final String name = "Botania Rune Altar";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IIngredient[] input, int mana) {
|
||||
MineTweakerAPI.apply(new Add(new RecipeRuneAltar(toStack(output), mana, toObjects(input))));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipeRuneAltar> {
|
||||
|
||||
public Add(RecipeRuneAltar recipe) {
|
||||
super(RuneAltar.name, BotaniaAPI.runeAltarRecipes);
|
||||
|
||||
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@@ -50,22 +51,24 @@ public class RuneAltar {
|
||||
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()) {
|
||||
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()));
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -5,40 +5,40 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
|
||||
public class AddCategory implements IUndoableAction {
|
||||
|
||||
LexiconCategory category;
|
||||
|
||||
LexiconCategory category;
|
||||
|
||||
public AddCategory(LexiconCategory category) {
|
||||
this.category=category;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
BotaniaAPI.addCategory(category);
|
||||
}
|
||||
public void apply() {
|
||||
BotaniaAPI.addCategory(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return category != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Lexicon Category: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Lexicon Category: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
BotaniaAPI.getAllCategories().remove(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
BotaniaAPI.getAllCategories().remove(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,41 +5,41 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
public class AddEntry implements IUndoableAction {
|
||||
|
||||
LexiconEntry Entry;
|
||||
|
||||
LexiconEntry Entry;
|
||||
|
||||
public AddEntry(LexiconEntry Entry) {
|
||||
this.Entry=Entry;
|
||||
this.Entry = Entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
BotaniaAPI.addEntry(Entry, Entry.category);
|
||||
}
|
||||
public void apply() {
|
||||
BotaniaAPI.addEntry(Entry, Entry.category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return Entry != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Lexicon Entry: " + Entry.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
Entry.category.entries.remove(Entry);
|
||||
BotaniaAPI.getAllEntries().remove(Entry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,46 +5,46 @@ 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;
|
||||
|
||||
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;
|
||||
this.Name = Name;
|
||||
this.Entry = Entry;
|
||||
this.page = page;
|
||||
this.page_number = page_number;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
Entry.pages.add(page_number, page);
|
||||
}
|
||||
public void apply() {
|
||||
Entry.pages.add(page_number, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return Name != null && Entry != null && page != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Lexicon Page: " + Name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Lexicon Page: " + Name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
Entry.pages.remove(page_number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
Entry.pages.remove(page_number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,51 @@
|
||||
package modtweaker2.mods.botania.lexicon;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
|
||||
public class AddRecipeMapping implements IUndoableAction {
|
||||
|
||||
ItemStack stack;
|
||||
LexiconEntry entry;
|
||||
int page;
|
||||
|
||||
ItemStack stack;
|
||||
LexiconEntry entry;
|
||||
int page;
|
||||
|
||||
public AddRecipeMapping(ItemStack stack, LexiconEntry entry, int page) {
|
||||
this.stack =stack;
|
||||
this.entry=entry;
|
||||
this.page=page;
|
||||
this.stack = stack;
|
||||
this.entry = entry;
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
LexiconRecipeMappings.map(stack, entry, page);
|
||||
}
|
||||
public void apply() {
|
||||
LexiconRecipeMappings.map(stack, entry, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
LexiconRecipeMappings.remove(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
LexiconRecipeMappings.remove(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,40 +5,40 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
|
||||
public class RemoveCategory implements IUndoableAction {
|
||||
|
||||
LexiconCategory category;
|
||||
|
||||
LexiconCategory category;
|
||||
|
||||
public RemoveCategory(LexiconCategory category) {
|
||||
this.category=category;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
BotaniaAPI.getAllCategories().remove(category);
|
||||
}
|
||||
public void apply() {
|
||||
BotaniaAPI.getAllCategories().remove(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return category != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Lexicon Category: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Adding Lexicon Category: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
BotaniaAPI.addCategory(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
BotaniaAPI.addCategory(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,41 +5,41 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
public class RemoveEntry implements IUndoableAction {
|
||||
|
||||
LexiconEntry Entry;
|
||||
|
||||
LexiconEntry Entry;
|
||||
|
||||
public RemoveEntry(LexiconEntry Entry) {
|
||||
this.Entry=Entry;
|
||||
this.Entry = Entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
Entry.category.entries.remove(Entry);
|
||||
BotaniaAPI.getAllEntries().remove(Entry);
|
||||
}
|
||||
public void apply() {
|
||||
Entry.category.entries.remove(Entry);
|
||||
BotaniaAPI.getAllEntries().remove(Entry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return Entry != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Lexicon Entry: " + Entry.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
BotaniaAPI.addEntry(Entry, Entry.category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,44 +5,44 @@ import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
|
||||
public class RemovePage implements IUndoableAction {
|
||||
|
||||
int page_number;
|
||||
LexiconEntry Entry;
|
||||
LexiconPage page;
|
||||
|
||||
int page_number;
|
||||
LexiconEntry Entry;
|
||||
LexiconPage page;
|
||||
|
||||
public RemovePage(LexiconEntry Entry, int page_number) {
|
||||
this.Entry=Entry;
|
||||
this.page_number=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);
|
||||
}
|
||||
public void apply() {
|
||||
this.page = Entry.pages.get(page_number);
|
||||
Entry.pages.remove(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return Entry != null && page != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Lexicon Page: " + Entry.pages.get(page_number).getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
Entry.pages.add(page_number, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +1,53 @@
|
||||
package modtweaker2.mods.botania.lexicon;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings.EntryData;
|
||||
|
||||
public class RemoveRecipeMapping implements IUndoableAction {
|
||||
|
||||
ItemStack stack;
|
||||
LexiconEntry entry;
|
||||
int page;
|
||||
|
||||
ItemStack stack;
|
||||
LexiconEntry entry;
|
||||
int page;
|
||||
|
||||
public RemoveRecipeMapping(ItemStack stack) {
|
||||
this.stack =stack;
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
EntryData data=LexiconRecipeMappings.getDataForStack(stack);
|
||||
this.entry=data.entry;
|
||||
this.page=data.page;
|
||||
LexiconRecipeMappings.remove(stack);
|
||||
}
|
||||
public void apply() {
|
||||
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
|
||||
this.entry = data.entry;
|
||||
this.page = data.page;
|
||||
LexiconRecipeMappings.remove(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
LexiconRecipeMappings.map(stack, entry, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,48 +1,50 @@
|
||||
package modtweaker2.mods.botania.lexicon;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
|
||||
public class SetCategoryIcon implements IUndoableAction {
|
||||
|
||||
LexiconCategory category;
|
||||
ResourceLocation oldIcon;
|
||||
ResourceLocation newIcon;
|
||||
|
||||
LexiconCategory category;
|
||||
ResourceLocation oldIcon;
|
||||
ResourceLocation newIcon;
|
||||
|
||||
public SetCategoryIcon(LexiconCategory category, String icon) {
|
||||
this.category=category;
|
||||
this.newIcon=new ResourceLocation(icon);
|
||||
this.category = category;
|
||||
this.newIcon = new ResourceLocation(icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
oldIcon=category.getIcon();
|
||||
category.setIcon(newIcon);
|
||||
}
|
||||
public void apply() {
|
||||
oldIcon = category.getIcon();
|
||||
category.setIcon(newIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return category != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Setting Lexicon Category priority: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Unsetting Lexicon Category priority: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
category.setIcon(oldIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
category.setIcon(oldIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -4,44 +4,44 @@ import minetweaker.IUndoableAction;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
|
||||
public class SetCategoryPriority implements IUndoableAction {
|
||||
|
||||
LexiconCategory category;
|
||||
int oldPriority;
|
||||
int newPriority;
|
||||
|
||||
LexiconCategory category;
|
||||
int oldPriority;
|
||||
int newPriority;
|
||||
|
||||
public SetCategoryPriority(LexiconCategory category, int priority) {
|
||||
this.category=category;
|
||||
this.newPriority=priority;
|
||||
this.category = category;
|
||||
this.newPriority = priority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
oldPriority=category.getSortingPriority();
|
||||
category.setPriority(newPriority);
|
||||
}
|
||||
public void apply() {
|
||||
oldPriority = category.getSortingPriority();
|
||||
category.setPriority(newPriority);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return category != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Setting Lexicon Category priority: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Unsetting Lexicon Category priority: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
category.setPriority(oldPriority);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
category.setPriority(oldPriority);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,44 +5,44 @@ import vazkii.botania.api.lexicon.KnowledgeType;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
public class SetEntryKnowledgeType implements IUndoableAction {
|
||||
|
||||
LexiconEntry Entry;
|
||||
KnowledgeType newType;
|
||||
KnowledgeType oldType;
|
||||
|
||||
LexiconEntry Entry;
|
||||
KnowledgeType newType;
|
||||
KnowledgeType oldType;
|
||||
|
||||
public SetEntryKnowledgeType(LexiconEntry Entry, KnowledgeType type) {
|
||||
this.Entry=Entry;
|
||||
this.newType=type;
|
||||
this.Entry = Entry;
|
||||
this.newType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
oldType=Entry.getKnowledgeType();
|
||||
Entry.setKnowledgeType(newType);
|
||||
}
|
||||
public void apply() {
|
||||
oldType = Entry.getKnowledgeType();
|
||||
Entry.setKnowledgeType(newType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return Entry != null && oldType != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Setting Knowledge type for: " + Entry.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Unsetting Knowledge type for: " + Entry.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
Entry.setKnowledgeType(oldType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
Entry.setKnowledgeType(oldType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,11 @@ import minetweaker.api.server.ICommandFunction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
|
||||
public class LexiconCategoryLogger implements ICommandFunction{
|
||||
public class LexiconCategoryLogger implements ICommandFunction {
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
List<LexiconCategory> categories=BotaniaAPI.getAllCategories();
|
||||
List<LexiconCategory> categories = BotaniaAPI.getAllCategories();
|
||||
System.out.println("Categories: " + categories.size());
|
||||
for (LexiconCategory category : categories) {
|
||||
System.out.println("Category " + category.getUnlocalizedName());
|
||||
@@ -21,7 +21,9 @@ public class LexiconCategoryLogger implements ICommandFunction{
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,32 +11,31 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
public class LexiconEntryLogger implements ICommandFunction{
|
||||
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();
|
||||
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 (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"));
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-3
@@ -8,11 +8,11 @@ import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
public class LexiconKnowledgeTypesLogger implements ICommandFunction{
|
||||
public class LexiconKnowledgeTypesLogger implements ICommandFunction {
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
Set<String> types=BotaniaAPI.knowledgeTypes.keySet();
|
||||
Set<String> types = BotaniaAPI.knowledgeTypes.keySet();
|
||||
System.out.println("Knowledge Types: " + types.size());
|
||||
for (String key : types) {
|
||||
System.out.println("Knowledge Type " + key);
|
||||
@@ -20,7 +20,9 @@ public class LexiconKnowledgeTypesLogger implements ICommandFunction{
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,36 +12,33 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
|
||||
public class LexiconPageLogger implements ICommandFunction{
|
||||
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);
|
||||
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() + ")");
|
||||
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"));
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import modtweaker2.mods.botanicaladdons.handlers.DendricSuffuser;
|
||||
import modtweaker2.mods.botanicaladdons.handlers.IridescentTree;
|
||||
|
||||
public class BotanicalAddons {
|
||||
|
||||
public BotanicalAddons() {
|
||||
MineTweakerAPI.registerClass(DendricSuffuser.class);
|
||||
MineTweakerAPI.registerClass(IridescentTree.class);
|
||||
|
||||
+11
-8
@@ -8,22 +8,25 @@ import modtweaker2.helpers.LogHelper;
|
||||
import ninja.shadowfox.shadowfox_botany.api.ShadowFoxAPI;
|
||||
import ninja.shadowfox.shadowfox_botany.api.recipe.RecipeTreeCrafting;
|
||||
|
||||
public class BotanicalAddonsDendricLogger implements ICommandFunction{
|
||||
public class BotanicalAddonsDendricLogger implements ICommandFunction {
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
System.out.println("Recipes: " + ShadowFoxAPI.treeRecipes.size());
|
||||
for (RecipeTreeCrafting recipe : ShadowFoxAPI.treeRecipes) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.botanicaladdons.DendricSuffuser.addRecipe(%s, %s, %s, %s);",
|
||||
LogHelper.getStackDescription(recipe.getOutput()),
|
||||
recipe.getManaUsage(),
|
||||
recipe.getThrottle(),
|
||||
LogHelper.getListDescription(recipe.getInputs())
|
||||
));
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.botanicaladdons.DendricSuffuser.addRecipe(%s, %s, %s, %s);",
|
||||
LogHelper.getStackDescription(recipe.getOutput()),
|
||||
recipe.getManaUsage(),
|
||||
recipe.getThrottle(),
|
||||
LogHelper.getListDescription(recipe.getInputs())));
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,11 @@
|
||||
package modtweaker2.mods.botanicaladdons.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.InputHelper.toObjects;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
@@ -8,20 +14,15 @@ import modtweaker2.helpers.InputHelper;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import ninja.shadowfox.shadowfox_botany.api.ShadowFoxAPI;
|
||||
import ninja.shadowfox.shadowfox_botany.api.recipe.RecipeTreeCrafting;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.InputHelper.toObjects;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.botanicaladdons.DendricSuffuser")
|
||||
public class DendricSuffuser {
|
||||
|
||||
@@ -32,12 +33,18 @@ public class DendricSuffuser {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack blockOutput, int mana, int throttle, IIngredient[] input) {
|
||||
Object output = InputHelper.toObject(blockOutput);
|
||||
if(output == null || !(output instanceof ItemStack) || !InputHelper.isABlock((ItemStack)output)) {
|
||||
if (output == null || !(output instanceof ItemStack) || !InputHelper.isABlock((ItemStack) output)) {
|
||||
LogHelper.logError("Output must be a block.");
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(new RecipeTreeCrafting(mana, Block.getBlockFromItem(((ItemStack)output).getItem()),
|
||||
((ItemStack)output).getItemDamage(), throttle, toObjects(input))));
|
||||
MineTweakerAPI.apply(
|
||||
new Add(
|
||||
new RecipeTreeCrafting(
|
||||
mana,
|
||||
Block.getBlockFromItem(((ItemStack) output).getItem()),
|
||||
((ItemStack) output).getItemDamage(),
|
||||
throttle,
|
||||
toObjects(input))));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@@ -46,6 +53,7 @@ public class DendricSuffuser {
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipeTreeCrafting> {
|
||||
|
||||
public Add(RecipeTreeCrafting recipe) {
|
||||
super(DendricSuffuser.name, ShadowFoxAPI.treeRecipes);
|
||||
|
||||
@@ -72,14 +80,19 @@ public class DendricSuffuser {
|
||||
}
|
||||
|
||||
// Check if we found the recipes and apply the action
|
||||
if(!recipes.isEmpty()) {
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", DendricSuffuser.name, output.toString()));
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"No %s Recipe found for %s. Command ignored!",
|
||||
DendricSuffuser.name,
|
||||
output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<RecipeTreeCrafting> {
|
||||
|
||||
public Remove(List<RecipeTreeCrafting> recipes) {
|
||||
super(DendricSuffuser.name, ShadowFoxAPI.treeRecipes, recipes);
|
||||
}
|
||||
@@ -90,4 +103,3 @@ public class DendricSuffuser {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package modtweaker2.mods.botanicaladdons.handlers;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
@@ -7,17 +9,16 @@ import modtweaker2.helpers.InputHelper;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import ninja.shadowfox.shadowfox_botany.api.ShadowFoxAPI;
|
||||
import ninja.shadowfox.shadowfox_botany.api.trees.IIridescentSaplingVariant;
|
||||
import ninja.shadowfox.shadowfox_botany.api.trees.IridescentSaplingBaseVariant;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@ZenClass("mods.botanicaladdons.IridescentTree")
|
||||
public class IridescentTree {
|
||||
|
||||
@@ -26,30 +27,38 @@ public class IridescentTree {
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void addVariant(IItemStack blockSoil, IItemStack blockWood, IItemStack blockLeaves, int metaMin, int metaMax, int metaShift) {
|
||||
public static void addVariant(IItemStack blockSoil, IItemStack blockWood, IItemStack blockLeaves, int metaMin,
|
||||
int metaMax, int metaShift) {
|
||||
Object soil = InputHelper.toObject(blockSoil);
|
||||
Object wood = InputHelper.toObject(blockWood);
|
||||
Object leaves = InputHelper.toObject(blockLeaves);
|
||||
if (soil == null || !(soil instanceof ItemStack) || !InputHelper.isABlock((ItemStack)soil)) {
|
||||
if (soil == null || !(soil instanceof ItemStack) || !InputHelper.isABlock((ItemStack) soil)) {
|
||||
LogHelper.logError("Soil must be a block.");
|
||||
return;
|
||||
}
|
||||
else if (wood == null || !(wood instanceof ItemStack) || !InputHelper.isABlock((ItemStack)wood)) {
|
||||
} else if (wood == null || !(wood instanceof ItemStack) || !InputHelper.isABlock((ItemStack) wood)) {
|
||||
LogHelper.logError("Wood must be a block.");
|
||||
return;
|
||||
}
|
||||
else if(leaves == null || !(leaves instanceof ItemStack) || !InputHelper.isABlock((ItemStack)leaves)) {
|
||||
} else if (leaves == null || !(leaves instanceof ItemStack) || !InputHelper.isABlock((ItemStack) leaves)) {
|
||||
LogHelper.logError("Leaves must be a block.");
|
||||
return;
|
||||
}
|
||||
Block soilBlock = Block.getBlockFromItem(((ItemStack)soil).getItem());
|
||||
Block woodBlock = Block.getBlockFromItem(((ItemStack)wood).getItem());
|
||||
Block leavesBlock = Block.getBlockFromItem(((ItemStack)leaves).getItem());
|
||||
MineTweakerAPI.apply(new Add(new IridescentSaplingBaseVariant(soilBlock, woodBlock, leavesBlock, metaMin, metaMax, metaShift)));
|
||||
Block soilBlock = Block.getBlockFromItem(((ItemStack) soil).getItem());
|
||||
Block woodBlock = Block.getBlockFromItem(((ItemStack) wood).getItem());
|
||||
Block leavesBlock = Block.getBlockFromItem(((ItemStack) leaves).getItem());
|
||||
MineTweakerAPI.apply(
|
||||
new Add(
|
||||
new IridescentSaplingBaseVariant(
|
||||
soilBlock,
|
||||
woodBlock,
|
||||
leavesBlock,
|
||||
metaMin,
|
||||
metaMax,
|
||||
metaShift)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addVariant(IItemStack blockSoil, IItemStack blockWood, IItemStack blockLeaves, int metaMin, int metaMax) {
|
||||
public static void addVariant(IItemStack blockSoil, IItemStack blockWood, IItemStack blockLeaves, int metaMin,
|
||||
int metaMax) {
|
||||
addVariant(blockSoil, blockWood, blockLeaves, metaMin, metaMax, 0);
|
||||
}
|
||||
|
||||
@@ -64,6 +73,7 @@ public class IridescentTree {
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<IIridescentSaplingVariant> {
|
||||
|
||||
public Add(IIridescentSaplingVariant recipe) {
|
||||
super(IridescentTree.name, ShadowFoxAPI.treeVariants);
|
||||
|
||||
@@ -83,11 +93,11 @@ public class IridescentTree {
|
||||
// Get list of existing recipes, matching with parameter
|
||||
|
||||
Object soil = InputHelper.toObject(blockSoil);
|
||||
if (soil == null || !(soil instanceof ItemStack) || !InputHelper.isABlock((ItemStack)soil)) {
|
||||
if (soil == null || !(soil instanceof ItemStack) || !InputHelper.isABlock((ItemStack) soil)) {
|
||||
LogHelper.logError("Soil must be a block.");
|
||||
return;
|
||||
}
|
||||
Block soilBlock = Block.getBlockFromItem(((ItemStack)soil).getItem());
|
||||
Block soilBlock = Block.getBlockFromItem(((ItemStack) soil).getItem());
|
||||
|
||||
List<IIridescentSaplingVariant> recipes = new LinkedList<IIridescentSaplingVariant>();
|
||||
|
||||
@@ -98,14 +108,19 @@ public class IridescentTree {
|
||||
}
|
||||
|
||||
// Check if we found the recipes and apply the action
|
||||
if(!recipes.isEmpty()) {
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", IridescentTree.name, soilBlock.toString()));
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"No %s Recipe found for %s. Command ignored!",
|
||||
IridescentTree.name,
|
||||
soilBlock.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<IIridescentSaplingVariant> {
|
||||
|
||||
public Remove(List<IIridescentSaplingVariant> recipes) {
|
||||
super(IridescentTree.name, ShadowFoxAPI.treeVariants, recipes);
|
||||
}
|
||||
@@ -116,4 +131,3 @@ public class IridescentTree {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import minetweaker.MineTweakerAPI;
|
||||
import modtweaker2.mods.chisel.handlers.Groups;
|
||||
|
||||
public class Chisel {
|
||||
|
||||
public Chisel() {
|
||||
MineTweakerAPI.registerClass(Groups.class);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.api.item.IItemStack;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
||||
@@ -16,143 +17,138 @@ import com.google.common.collect.Lists;
|
||||
|
||||
public class ChiselHelper {
|
||||
|
||||
public static ICarvingGroup getGroup(String name)
|
||||
{
|
||||
return CarvingUtils.getChiselRegistry().getGroup(name);
|
||||
}
|
||||
|
||||
public static ICarvingGroup getGroup(IItemStack stack)
|
||||
{
|
||||
return CarvingUtils.getChiselRegistry().getGroup(Block.getBlockFromItem(toStack(stack).getItem()), stack.getDamage());
|
||||
}
|
||||
|
||||
public static ICarvingVariation getVariation(IItemStack stack)
|
||||
{
|
||||
ICarvingGroup g = getGroup(stack);
|
||||
if (g != null) {
|
||||
for (ICarvingVariation v : g.getVariations()) {
|
||||
if (v.getBlock() == Block.getBlockFromItem(toStack(stack).getItem()) && v.getBlockMeta() == stack.getDamage()) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static ICarvingGroup getGroup(String name) {
|
||||
return CarvingUtils.getChiselRegistry().getGroup(name);
|
||||
}
|
||||
|
||||
public static ICarvingVariation makeVariation(IItemStack stack)
|
||||
{
|
||||
return new CarvingVariation(Block.getBlockFromItem(toStack(stack).getItem()), stack.getDamage());
|
||||
}
|
||||
public static ICarvingGroup getGroup(IItemStack stack) {
|
||||
return CarvingUtils.getChiselRegistry()
|
||||
.getGroup(Block.getBlockFromItem(toStack(stack).getItem()), stack.getDamage());
|
||||
}
|
||||
|
||||
public static ICarvingGroup makeGroup(String name)
|
||||
{
|
||||
return new CarvingGroup(name);
|
||||
}
|
||||
|
||||
public static boolean groupContainsVariation(ICarvingGroup group, ICarvingVariation variation)
|
||||
{
|
||||
for(ICarvingVariation otherVariation : group.getVariations())
|
||||
{
|
||||
if(otherVariation.getBlock()==variation.getBlock() && otherVariation.getBlockMeta()==variation.getBlockMeta())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static class CarvingVariation implements ICarvingVariation
|
||||
{
|
||||
Block block;
|
||||
int meta;
|
||||
|
||||
public CarvingVariation(Block block, int meta)
|
||||
{
|
||||
this.block=block;
|
||||
this.meta=meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
public static ICarvingVariation getVariation(IItemStack stack) {
|
||||
ICarvingGroup g = getGroup(stack);
|
||||
if (g != null) {
|
||||
for (ICarvingVariation v : g.getVariations()) {
|
||||
if (v.getBlock() == Block.getBlockFromItem(toStack(stack).getItem())
|
||||
&& v.getBlockMeta() == stack.getDamage()) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockMeta() {
|
||||
return meta;
|
||||
}
|
||||
public static ICarvingVariation makeVariation(IItemStack stack) {
|
||||
return new CarvingVariation(Block.getBlockFromItem(toStack(stack).getItem()), stack.getDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemMeta() {
|
||||
return meta;
|
||||
}
|
||||
public static ICarvingGroup makeGroup(String name) {
|
||||
return new CarvingGroup(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 99;
|
||||
}
|
||||
}
|
||||
public static boolean groupContainsVariation(ICarvingGroup group, ICarvingVariation variation) {
|
||||
for (ICarvingVariation otherVariation : group.getVariations()) {
|
||||
if (otherVariation.getBlock() == variation.getBlock()
|
||||
&& otherVariation.getBlockMeta() == variation.getBlockMeta())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static class CarvingGroup implements ICarvingGroup
|
||||
{
|
||||
private String name;
|
||||
private String sound;
|
||||
private String oreName;
|
||||
static class CarvingVariation implements ICarvingVariation {
|
||||
|
||||
private List<ICarvingVariation> variations = Lists.newArrayList();
|
||||
Block block;
|
||||
int meta;
|
||||
|
||||
public CarvingGroup(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public CarvingVariation(Block block, int meta) {
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public List<ICarvingVariation> getVariations() {
|
||||
return Lists.newArrayList(variations);
|
||||
}
|
||||
@Override
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addVariation(ICarvingVariation variation) {
|
||||
variations.add(variation);
|
||||
Collections.sort(variations, new Comparator<ICarvingVariation>() {
|
||||
@Override
|
||||
public int getBlockMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(ICarvingVariation o1, ICarvingVariation o2) {
|
||||
return CarvingUtils.compare(o1, o2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeVariation(ICarvingVariation variation) {
|
||||
ICarvingVariation toRemove = null;
|
||||
for (ICarvingVariation v : variations) {
|
||||
if (v.getBlock() == variation.getBlock() && v.getBlockMeta() == variation.getBlockMeta()) {
|
||||
toRemove = v;
|
||||
}
|
||||
}
|
||||
return toRemove == null ? false : variations.remove(toRemove);
|
||||
}
|
||||
@Override
|
||||
public int getItemMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 99;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSound() {
|
||||
return sound;
|
||||
}
|
||||
static class CarvingGroup implements ICarvingGroup {
|
||||
|
||||
@Override
|
||||
public void setSound(String sound) {
|
||||
this.sound = sound;
|
||||
}
|
||||
private String name;
|
||||
private String sound;
|
||||
private String oreName;
|
||||
|
||||
@Override
|
||||
public String getOreName() {
|
||||
return oreName;
|
||||
}
|
||||
private List<ICarvingVariation> variations = Lists.newArrayList();
|
||||
|
||||
@Override
|
||||
public void setOreName(String oreName) {
|
||||
this.oreName = oreName;
|
||||
}
|
||||
}
|
||||
public CarvingGroup(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<ICarvingVariation> getVariations() {
|
||||
return Lists.newArrayList(variations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addVariation(ICarvingVariation variation) {
|
||||
variations.add(variation);
|
||||
Collections.sort(variations, new Comparator<ICarvingVariation>() {
|
||||
|
||||
@Override
|
||||
public int compare(ICarvingVariation o1, ICarvingVariation o2) {
|
||||
return CarvingUtils.compare(o1, o2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeVariation(ICarvingVariation variation) {
|
||||
ICarvingVariation toRemove = null;
|
||||
for (ICarvingVariation v : variations) {
|
||||
if (v.getBlock() == variation.getBlock() && v.getBlockMeta() == variation.getBlockMeta()) {
|
||||
toRemove = v;
|
||||
}
|
||||
}
|
||||
return toRemove == null ? false : variations.remove(toRemove);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSound() {
|
||||
return sound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSound(String sound) {
|
||||
this.sound = sound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOreName() {
|
||||
return oreName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOreName(String oreName) {
|
||||
this.oreName = oreName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,11 @@ import minetweaker.api.server.ICommandFunction;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
||||
|
||||
public class ChiselGroupLogger implements ICommandFunction{
|
||||
public class ChiselGroupLogger implements ICommandFunction {
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
List<String> keys=CarvingUtils.getChiselRegistry().getSortedGroupNames();
|
||||
List<String> keys = CarvingUtils.getChiselRegistry().getSortedGroupNames();
|
||||
System.out.println("Chisel Groups: " + keys.size());
|
||||
for (String key : keys) {
|
||||
System.out.println("Chisel Group " + key);
|
||||
@@ -21,7 +21,9 @@ public class ChiselGroupLogger implements ICommandFunction{
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,48 +10,46 @@ import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker2.mods.chisel.ChiselHelper;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
|
||||
public class ChiselVariationLogger implements ICommandFunction{
|
||||
public class ChiselVariationLogger implements ICommandFunction {
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
Map<ICarvingVariation, ICarvingGroup> variations=new HashMap<ICarvingVariation, ICarvingGroup>();
|
||||
List<String> keys=CarvingUtils.getChiselRegistry().getSortedGroupNames();
|
||||
if(arguments.length>0)
|
||||
{
|
||||
ICarvingGroup group=ChiselHelper.getGroup(arguments[0]);
|
||||
if(group==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Group not found (" + arguments[0]+")");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
keys.clear();
|
||||
keys.add(arguments[0]);
|
||||
}
|
||||
}
|
||||
for (String key : keys) {
|
||||
ICarvingGroup group=CarvingUtils.getChiselRegistry().getGroup(key);
|
||||
for(ICarvingVariation variation : group.getVariations())
|
||||
variations.put(variation, group);
|
||||
}
|
||||
Map<ICarvingVariation, ICarvingGroup> variations = new HashMap<ICarvingVariation, ICarvingGroup>();
|
||||
List<String> keys = CarvingUtils.getChiselRegistry().getSortedGroupNames();
|
||||
if (arguments.length > 0) {
|
||||
ICarvingGroup group = ChiselHelper.getGroup(arguments[0]);
|
||||
if (group == null) {
|
||||
MineTweakerAPI.getLogger().logError("Group not found (" + arguments[0] + ")");
|
||||
return;
|
||||
} else {
|
||||
keys.clear();
|
||||
keys.add(arguments[0]);
|
||||
}
|
||||
}
|
||||
for (String key : keys) {
|
||||
ICarvingGroup group = CarvingUtils.getChiselRegistry().getGroup(key);
|
||||
for (ICarvingVariation variation : group.getVariations()) variations.put(variation, group);
|
||||
}
|
||||
System.out.println("Chisel Variations: " + variations.size());
|
||||
for (Entry<ICarvingVariation, ICarvingGroup> entry: variations.entrySet()) {
|
||||
String stringedVariation="<"+Item.itemRegistry.getNameForObject(Item.getItemFromBlock(entry.getKey().getBlock()))+":"+entry.getKey().getBlockMeta()+">";
|
||||
if(arguments.length==0)
|
||||
stringedVariation+=" "+entry.getValue().getName();
|
||||
for (Entry<ICarvingVariation, ICarvingGroup> entry : variations.entrySet()) {
|
||||
String stringedVariation = "<" + Item.itemRegistry.getNameForObject(
|
||||
Item.getItemFromBlock(entry.getKey().getBlock())) + ":" + entry.getKey().getBlockMeta() + ">";
|
||||
if (arguments.length == 0) stringedVariation += " " + entry.getValue().getName();
|
||||
System.out.println("Chisel Variation " + stringedVariation);
|
||||
MineTweakerAPI.logCommand(stringedVariation);
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,221 +13,215 @@ import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
|
||||
@ZenClass("mods.chisel.Groups")
|
||||
public class Groups {
|
||||
|
||||
@ZenMethod
|
||||
public static void addVariation(String groupName, IItemStack stack) {
|
||||
ICarvingGroup group=ChiselHelper.getGroup(groupName);
|
||||
ICarvingVariation variation=ChiselHelper.makeVariation(stack);
|
||||
if(group==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find group " + groupName);
|
||||
return;
|
||||
}
|
||||
if(variation==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Can't create variation from " + stack);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new AddVariation(group,variation, stack.toString()));
|
||||
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;
|
||||
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);
|
||||
}
|
||||
public void apply() {
|
||||
CarvingUtils.getChiselRegistry().addVariation(group.getName(), variation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return group != null && variation != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Variation: " + variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Variation: " + variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
CarvingUtils.getChiselRegistry().removeVariation(variation.getBlock(),variation.getBlockMeta());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Variation: " + variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Variation: " + variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
CarvingUtils.getChiselRegistry().removeVariation(variation.getBlock(), variation.getBlockMeta());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeVariation(IItemStack stack) {
|
||||
ICarvingVariation variation=ChiselHelper.getVariation(stack);
|
||||
if(variation==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Can't find variation from " + stack);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new RemoveVariation(variation, stack.toString()));
|
||||
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;
|
||||
|
||||
ICarvingVariation variation;
|
||||
String variationName;
|
||||
ICarvingGroup group;
|
||||
|
||||
public RemoveVariation(ICarvingVariation variation, String variationName) {
|
||||
this.variation=variation;
|
||||
this.variationName=variationName;
|
||||
this.variation = variation;
|
||||
this.variationName = variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
group=CarvingUtils.getChiselRegistry().getGroup(variation.getBlock(),variation.getBlockMeta());
|
||||
CarvingUtils.getChiselRegistry().removeVariation(variation.getBlock(),variation.getBlockMeta());
|
||||
}
|
||||
public void apply() {
|
||||
group = CarvingUtils.getChiselRegistry().getGroup(variation.getBlock(), variation.getBlockMeta());
|
||||
CarvingUtils.getChiselRegistry().removeVariation(variation.getBlock(), variation.getBlockMeta());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return group!= null && variation != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return group != null && variation != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Variation: " + variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Adding Variation: " + variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
CarvingUtils.getChiselRegistry().addVariation(group.getName(),variation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@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));
|
||||
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;
|
||||
|
||||
ICarvingGroup group;
|
||||
|
||||
public AddGroup(ICarvingGroup group) {
|
||||
this.group=group;
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
CarvingUtils.getChiselRegistry().addGroup(group);
|
||||
}
|
||||
public void apply() {
|
||||
CarvingUtils.getChiselRegistry().addGroup(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return group != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Group: " + group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Group: " + group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
CarvingUtils.getChiselRegistry().removeGroup(group.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@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));
|
||||
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;
|
||||
|
||||
ICarvingGroup group;
|
||||
|
||||
public RemoveGroup(ICarvingGroup group) {
|
||||
this.group=group;
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
CarvingUtils.getChiselRegistry().removeGroup(group.getName());
|
||||
}
|
||||
public void apply() {
|
||||
CarvingUtils.getChiselRegistry().removeGroup(group.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return group != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Group: " + group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Adding Group: " + group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
CarvingUtils.getChiselRegistry().addGroup(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
CarvingUtils.getChiselRegistry().addGroup(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import modtweaker2.mods.exnihilo.handlers.Hammer;
|
||||
import modtweaker2.mods.exnihilo.handlers.Sieve;
|
||||
|
||||
public class ExNihilo {
|
||||
|
||||
public ExNihilo() {
|
||||
MineTweakerAPI.registerClass(Compost.class);
|
||||
MineTweakerAPI.registerClass(Crucible.class);
|
||||
|
||||
@@ -7,6 +7,7 @@ import exnihilo.registries.HeatRegistry;
|
||||
import exnihilo.utils.ItemInfo;
|
||||
|
||||
public class ExNihiloHelper {
|
||||
|
||||
public static Map<ItemInfo, Float> getHeatMap() {
|
||||
return ReflectionHelper.<Map<ItemInfo, Float>>getStaticObject(HeatRegistry.class, "heatmap");
|
||||
}
|
||||
|
||||
@@ -13,8 +13,10 @@ import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.helpers.StringHelper;
|
||||
import modtweaker2.mods.exnihilo.ExNihiloHelper;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import exnihilo.registries.CompostRegistry;
|
||||
import exnihilo.registries.CrucibleRegistry;
|
||||
import exnihilo.registries.HammerRegistry;
|
||||
@@ -28,71 +30,87 @@ import exnihilo.utils.ItemInfo;
|
||||
public class ExNihiloLogger implements ICommandFunction {
|
||||
|
||||
private static final List<String> validArguments = new LinkedList<String>();
|
||||
|
||||
|
||||
static {
|
||||
validArguments.add("Composting");
|
||||
validArguments.add("Crucible");
|
||||
validArguments.add("Hammer");
|
||||
validArguments.add("Sieve");
|
||||
}
|
||||
|
||||
|
||||
@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, ", ")));
|
||||
|
||||
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("Composting")) {
|
||||
for(Entry<ItemInfo, Compostable> recipe : CompostRegistry.entries.entrySet()) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.exnihilo.Composting.addRecipe(%s, %s, \"%s\");",
|
||||
LogHelper.getStackDescription(recipe.getKey().getStack()),
|
||||
recipe.getValue().value,
|
||||
Integer.toHexString(recipe.getValue().color.toInt()).substring(2)));
|
||||
if (args.isEmpty() || args.contains("Composting")) {
|
||||
for (Entry<ItemInfo, Compostable> recipe : CompostRegistry.entries.entrySet()) {
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.exnihilo.Composting.addRecipe(%s, %s, \"%s\");",
|
||||
LogHelper.getStackDescription(recipe.getKey().getStack()),
|
||||
recipe.getValue().value,
|
||||
Integer.toHexString(recipe.getValue().color.toInt()).substring(2)));
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("Crucible")) {
|
||||
for(Meltable recipe : CrucibleRegistry.entries.values()) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.exnihilo.Crucible.addRecipe(%s, %s);",
|
||||
LogHelper.getStackDescription(new ItemStack(recipe.block, 1, recipe.meta)),
|
||||
LogHelper.getStackDescription(new FluidStack(recipe.fluid, (int)recipe.fluidVolume))));
|
||||
|
||||
if (args.isEmpty() || args.contains("Crucible")) {
|
||||
for (Meltable recipe : CrucibleRegistry.entries.values()) {
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.exnihilo.Crucible.addRecipe(%s, %s);",
|
||||
LogHelper.getStackDescription(new ItemStack(recipe.block, 1, recipe.meta)),
|
||||
LogHelper.getStackDescription(
|
||||
new FluidStack(recipe.fluid, (int) recipe.fluidVolume))));
|
||||
}
|
||||
|
||||
for(Entry<ItemInfo, Float> recipe : ExNihiloHelper.getHeatMap().entrySet()) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.exnihilo.Crucible.addHeatSource(%s, %s);",
|
||||
LogHelper.getStackDescription(recipe.getKey().getStack()),
|
||||
recipe.getValue()));
|
||||
|
||||
for (Entry<ItemInfo, Float> recipe : ExNihiloHelper.getHeatMap().entrySet()) {
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.exnihilo.Crucible.addHeatSource(%s, %s);",
|
||||
LogHelper.getStackDescription(recipe.getKey().getStack()),
|
||||
recipe.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("Hammer")) {
|
||||
for(Entry<ItemInfo, ArrayList<Smashable>> entry : HammerRegistry.getRewards().entrySet()) {
|
||||
for(Smashable recipe : entry.getValue()) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.exnihilo.Hammer.addRecipe(%s, %s, %s, %s);",
|
||||
LogHelper.getStackDescription(entry.getKey().getStack()),
|
||||
LogHelper.getStackDescription(new ItemStack(recipe.item, 1, recipe.meta)),
|
||||
recipe.chance,
|
||||
recipe.luckMultiplier));
|
||||
|
||||
if (args.isEmpty() || args.contains("Hammer")) {
|
||||
for (Entry<ItemInfo, ArrayList<Smashable>> entry : HammerRegistry.getRewards().entrySet()) {
|
||||
for (Smashable recipe : entry.getValue()) {
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.exnihilo.Hammer.addRecipe(%s, %s, %s, %s);",
|
||||
LogHelper.getStackDescription(entry.getKey().getStack()),
|
||||
LogHelper.getStackDescription(new ItemStack(recipe.item, 1, recipe.meta)),
|
||||
recipe.chance,
|
||||
recipe.luckMultiplier));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("Sieve")) {
|
||||
for(Entry<ItemInfo, ArrayList<SiftingResult>> entry : SieveRegistry.getSiftables().entrySet()) {
|
||||
for(SiftingResult recipe : entry.getValue()) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.exnihilo.Sieve.addRecipe(%s, %s, %s);",
|
||||
LogHelper.getStackDescription(entry.getKey().getStack()),
|
||||
LogHelper.getStackDescription(new ItemStack(recipe.item, 1, recipe.meta)),
|
||||
recipe.rarity));
|
||||
|
||||
if (args.isEmpty() || args.contains("Sieve")) {
|
||||
for (Entry<ItemInfo, ArrayList<SiftingResult>> entry : SieveRegistry.getSiftables().entrySet()) {
|
||||
for (SiftingResult recipe : entry.getValue()) {
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.exnihilo.Sieve.addRecipe(%s, %s, %s);",
|
||||
LogHelper.getStackDescription(entry.getKey().getStack()),
|
||||
LogHelper.getStackDescription(new ItemStack(recipe.item, 1, recipe.meta)),
|
||||
recipe.rarity));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,37 +22,35 @@ import exnihilo.registries.helpers.Color;
|
||||
import exnihilo.registries.helpers.Compostable;
|
||||
import exnihilo.utils.ItemInfo;
|
||||
|
||||
|
||||
@ZenClass("mods.exnihilo.Composting")
|
||||
public class Compost {
|
||||
|
||||
|
||||
public static final String name = "ExNihilo Composting";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, double value, @Optional String hex) {
|
||||
if(input == null) {
|
||||
if (input == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
hex = (hex == null || hex.equals("")) ? "35A82A" : hex;
|
||||
|
||||
|
||||
Map<ItemInfo, Compostable> recipes = new HashMap<ItemInfo, Compostable>();
|
||||
|
||||
recipes.put(
|
||||
new ItemInfo(toStack(input)),
|
||||
new Compostable(Math.min(1.0F, (float)value), new Color(hex)));
|
||||
|
||||
|
||||
recipes.put(new ItemInfo(toStack(input)), new Compostable(Math.min(1.0F, (float) value), new Color(hex)));
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipes));
|
||||
}
|
||||
|
||||
|
||||
private static class Add extends BaseMapAddition<ItemInfo, Compostable> {
|
||||
|
||||
public Add(Map<ItemInfo, Compostable> recipes) {
|
||||
super(Compost.name, CompostRegistry.entries, recipes);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<ItemInfo, Compostable> recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getKey().getStack());
|
||||
@@ -64,26 +62,28 @@ public class Compost {
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient input) {
|
||||
Map<ItemInfo, Compostable> recipes = new HashMap<ItemInfo, Compostable>();
|
||||
|
||||
for(Entry<ItemInfo, Compostable> recipe : CompostRegistry.entries.entrySet()) {
|
||||
if(matches(input, toIItemStack(recipe.getKey().getStack()))) {
|
||||
|
||||
for (Entry<ItemInfo, Compostable> recipe : CompostRegistry.entries.entrySet()) {
|
||||
if (matches(input, toIItemStack(recipe.getKey().getStack()))) {
|
||||
recipes.put(recipe.getKey(), recipe.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s recipes found for %s. Command ignored!", Compost.name, input.toString()));
|
||||
LogHelper.logWarning(
|
||||
String.format("No %s recipes found for %s. Command ignored!", Compost.name, input.toString()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static class Remove extends BaseMapRemoval<ItemInfo, Compostable> {
|
||||
|
||||
public Remove(Map<ItemInfo, Compostable> recipes) {
|
||||
super(Compost.name, CompostRegistry.entries, recipes);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<ItemInfo, Compostable> recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getKey().getStack());
|
||||
|
||||
@@ -19,9 +19,11 @@ import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.mods.exnihilo.ExNihiloHelper;
|
||||
import modtweaker2.utils.BaseMapAddition;
|
||||
import modtweaker2.utils.BaseMapRemoval;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import exnihilo.registries.CrucibleRegistry;
|
||||
@@ -33,27 +35,27 @@ public class Crucible {
|
||||
|
||||
public static final String nameMelting = "ExNihilo Crucible (Melting)";
|
||||
public static final String nameHeatSource = "ExNihilo Crucible (Heat source)";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/************************************************ Crucible Melting ************************************************/
|
||||
//Adding a Ex Nihilo Crucible recipe
|
||||
// Adding a Ex Nihilo Crucible recipe
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, ILiquidStack fluid) {
|
||||
if(input == null || fluid == null) {
|
||||
if (input == null || fluid == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s recipe.", nameMelting));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isABlock(input)) {
|
||||
|
||||
if (!isABlock(input)) {
|
||||
LogHelper.logError(String.format("Input item for %s recipe must be a block.", nameMelting));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Map<String, Meltable> recipes = new HashMap<String, Meltable>();
|
||||
Block theBlock = Block.getBlockFromItem(toStack(input).getItem());
|
||||
int theMeta = toStack(input).getItemDamage();
|
||||
|
||||
|
||||
recipes.put(
|
||||
theBlock + ":" + theMeta,
|
||||
new Meltable(theBlock, theMeta, 2000, toFluid(fluid).getFluid(), toFluid(fluid).amount, theBlock));
|
||||
@@ -61,12 +63,13 @@ public class Crucible {
|
||||
MineTweakerAPI.apply(new AddRecipe(recipes));
|
||||
}
|
||||
|
||||
//Passes the list to the map list implementation, and adds the recipe
|
||||
// Passes the list to the map list implementation, and adds the recipe
|
||||
private static class AddRecipe extends BaseMapAddition<String, Meltable> {
|
||||
|
||||
public AddRecipe(Map<String, Meltable> recipes) {
|
||||
super(nameMelting, CrucibleRegistry.entries, recipes);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<String, Meltable> recipe) {
|
||||
return LogHelper.getStackDescription(new ItemStack(recipe.getValue().block, 1, recipe.getValue().meta));
|
||||
@@ -75,27 +78,32 @@ public class Crucible {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Removing a Ex Nihilo Crucible recipe
|
||||
// Removing a Ex Nihilo Crucible recipe
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
Map<String, Meltable> recipes = new HashMap<String, Meltable>();
|
||||
|
||||
for(Entry<String, Meltable> entry : CrucibleRegistry.entries.entrySet()) {
|
||||
FluidStack fluid = new FluidStack(entry.getValue().fluid, (int)entry.getValue().fluidVolume);
|
||||
if(matches(output, toILiquidStack(fluid))) {
|
||||
|
||||
for (Entry<String, Meltable> entry : CrucibleRegistry.entries.entrySet()) {
|
||||
FluidStack fluid = new FluidStack(entry.getValue().fluid, (int) entry.getValue().fluidVolume);
|
||||
if (matches(output, toILiquidStack(fluid))) {
|
||||
recipes.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveRecipe(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s. Command ignored!", Crucible.nameMelting, output.toString()));
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"No %s recipe found for %s. Command ignored!",
|
||||
Crucible.nameMelting,
|
||||
output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
//Removes a recipe, will always remove the key, so all should be good
|
||||
// Removes a recipe, will always remove the key, so all should be good
|
||||
private static class RemoveRecipe extends BaseMapRemoval<String, Meltable> {
|
||||
|
||||
public RemoveRecipe(Map<String, Meltable> recipes) {
|
||||
super(nameMelting, CrucibleRegistry.entries, recipes);
|
||||
}
|
||||
@@ -106,71 +114,77 @@ public class Crucible {
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************** Crucible Heat Sources **********************************************/
|
||||
//Adding a Ex Nihilo Crucible heat source
|
||||
/**********************************************
|
||||
* Crucible Heat Sources
|
||||
**********************************************/
|
||||
// Adding a Ex Nihilo Crucible heat source
|
||||
@ZenMethod
|
||||
public static void addHeatSource(IItemStack input, double value) {
|
||||
if(input == null) {
|
||||
if (input == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s recipe.", nameMelting));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isABlock(input)) {
|
||||
|
||||
if (!isABlock(input)) {
|
||||
LogHelper.logError(String.format("Input item for %s recipe must be a block.", nameMelting));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Map<ItemInfo, Float> recipes = new HashMap<ItemInfo, Float>();
|
||||
recipes.put(new ItemInfo(toStack(input)), (float)value);
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
recipes.put(new ItemInfo(toStack(input)), (float) value);
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new AddHeatSource(recipes));
|
||||
}
|
||||
}
|
||||
|
||||
//Passes the list to the base map implementation, and adds the recipe
|
||||
private static class AddHeatSource extends BaseMapAddition<ItemInfo, Float>
|
||||
{
|
||||
public AddHeatSource(Map<ItemInfo, Float> recipes) {
|
||||
super(Crucible.nameHeatSource, ExNihiloHelper.getHeatMap(), recipes);
|
||||
}
|
||||
// Passes the list to the base map implementation, and adds the recipe
|
||||
private static class AddHeatSource extends BaseMapAddition<ItemInfo, Float> {
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<ItemInfo, Float> recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getKey().getStack());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Removing a Ex Nihilo Crucible heat source
|
||||
@ZenMethod
|
||||
public static void removeHeatSource(IIngredient output) {
|
||||
Map<ItemInfo, Float> recipes = new HashMap<ItemInfo, Float>();
|
||||
|
||||
for(Entry<ItemInfo, Float> entry : ExNihiloHelper.getHeatMap().entrySet()) {
|
||||
if(matches(output, toIItemStack(entry.getKey().getStack()))) {
|
||||
recipes.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveHeatSource(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s. Command ignored!", Crucible.nameMelting, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
//Removes a recipe, will always remove the key, so all should be good
|
||||
private static class RemoveHeatSource extends BaseMapRemoval<ItemInfo, Float>
|
||||
{
|
||||
public RemoveHeatSource(Map<ItemInfo, Float> recipes) {
|
||||
super(Crucible.nameHeatSource, ExNihiloHelper.getHeatMap(), recipes);
|
||||
public AddHeatSource(Map<ItemInfo, Float> recipes) {
|
||||
super(Crucible.nameHeatSource, ExNihiloHelper.getHeatMap(), recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<ItemInfo, Float> recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getKey().getStack());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Removing a Ex Nihilo Crucible heat source
|
||||
@ZenMethod
|
||||
public static void removeHeatSource(IIngredient output) {
|
||||
Map<ItemInfo, Float> recipes = new HashMap<ItemInfo, Float>();
|
||||
|
||||
for (Entry<ItemInfo, Float> entry : ExNihiloHelper.getHeatMap().entrySet()) {
|
||||
if (matches(output, toIItemStack(entry.getKey().getStack()))) {
|
||||
recipes.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveHeatSource(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"No %s recipe found for %s. Command ignored!",
|
||||
Crucible.nameMelting,
|
||||
output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
// Removes a recipe, will always remove the key, so all should be good
|
||||
private static class RemoveHeatSource extends BaseMapRemoval<ItemInfo, Float> {
|
||||
|
||||
public RemoveHeatSource(Map<ItemInfo, Float> recipes) {
|
||||
super(Crucible.nameHeatSource, ExNihiloHelper.getHeatMap(), recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<ItemInfo, Float> recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getKey().getStack());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,10 @@ import minetweaker.api.item.IngredientAny;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.utils.BaseMapAddition;
|
||||
import modtweaker2.utils.BaseMapRemoval;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@@ -29,221 +31,251 @@ import exnihilo.utils.ItemInfo;
|
||||
|
||||
@ZenClass("mods.exnihilo.Hammer")
|
||||
public class Hammer {
|
||||
|
||||
|
||||
public static final String name = "ExNihilo Hammer";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output, double chance, double luck) {
|
||||
if(input == null || output == null) {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output, double chance, double luck) {
|
||||
if (input == null || output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
addRecipe(input, new IItemStack[] { output }, new double[] { chance }, new double[] { luck });
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack[] output, double[] chance, double[] luck) {
|
||||
if(input == null || output == null || chance == null || luck == null) {
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack[] output, double[] chance, double[] luck) {
|
||||
if (input == null || output == null || chance == null || luck == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isABlock(input)) {
|
||||
}
|
||||
|
||||
if (!isABlock(input)) {
|
||||
LogHelper.logError(String.format("Input item for %s recipe must be a block.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
if(output.length == 0 || output.length != chance.length || output.length != luck.length) {
|
||||
LogHelper.logError(String.format("Number of items in arrays are different or null (%d, %d, %d)", output.length, chance.length, luck.length));
|
||||
return;
|
||||
}
|
||||
|
||||
Map<ItemInfo, ArrayList<Smashable>> recipes = new HashMap<ItemInfo, ArrayList<Smashable>>();
|
||||
ArrayList<Smashable> list = new ArrayList<Smashable>();
|
||||
ItemInfo itemInfo = new ItemInfo(toStack(input));
|
||||
recipes.put(itemInfo, list);
|
||||
|
||||
for(int i = 0; i < output.length; i++) {
|
||||
ItemStack out = toStack(output[i]);
|
||||
list.add(new Smashable(Block.getBlockFromItem(itemInfo.getItem()), itemInfo.getMeta(), out.getItem(), out.getItemDamage(), (float)chance[i], (float)luck[i]));
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipes));
|
||||
}
|
||||
|
||||
private static class Add extends BaseMapAddition<ItemInfo, ArrayList<Smashable>> {
|
||||
public Add(Map<ItemInfo, ArrayList<Smashable>> recipes) {
|
||||
super(Hammer.name, HammerRegistry.getRewards(), recipes);
|
||||
}
|
||||
if (output.length == 0 || output.length != chance.length || output.length != luck.length) {
|
||||
LogHelper.logError(
|
||||
String.format(
|
||||
"Number of items in arrays are different or null (%d, %d, %d)",
|
||||
output.length,
|
||||
chance.length,
|
||||
luck.length));
|
||||
return;
|
||||
}
|
||||
|
||||
public void apply() {
|
||||
for(Entry<ItemInfo, ArrayList<Smashable>> entry : recipes.entrySet()) {
|
||||
if(!map.containsKey(entry.getKey())) {
|
||||
// no recipe for input available, add new entry
|
||||
map.put(entry.getKey(), new ArrayList<Smashable>(entry.getValue()));
|
||||
} else {
|
||||
// recipes already available, add to present list
|
||||
ArrayList<Smashable> list = map.get(entry.getKey());
|
||||
|
||||
// store old Smashable objects if present
|
||||
ArrayList<Smashable> backup = new ArrayList<Smashable>();
|
||||
for(Smashable recipe : entry.getValue()) {
|
||||
backup.addAll(removeFromList(list, recipe));
|
||||
}
|
||||
|
||||
if(!backup.isEmpty()) {
|
||||
LogHelper.logWarning(String.format("Overwritten %d %s recipe outputs for %s.", backup.size(), Hammer.name, LogHelper.getStackDescription(entry.getKey().getStack())));
|
||||
overwritten.put(entry.getKey(), backup);
|
||||
}
|
||||
|
||||
// add new Smashable objects
|
||||
list.addAll(entry.getValue());
|
||||
}
|
||||
|
||||
successful.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
Map<ItemInfo, ArrayList<Smashable>> recipes = new HashMap<ItemInfo, ArrayList<Smashable>>();
|
||||
ArrayList<Smashable> list = new ArrayList<Smashable>();
|
||||
ItemInfo itemInfo = new ItemInfo(toStack(input));
|
||||
recipes.put(itemInfo, list);
|
||||
|
||||
public void undo() {
|
||||
// remove all recipes
|
||||
for(Entry<ItemInfo, ArrayList<Smashable>> entry : successful.entrySet()) {
|
||||
ArrayList<Smashable> list = map.get(entry.getKey());
|
||||
for(Smashable recipe : entry.getValue()) {
|
||||
removeFromList(list, recipe);
|
||||
}
|
||||
}
|
||||
|
||||
// re-add overwritten recipes
|
||||
for(Entry<ItemInfo, ArrayList<Smashable>> entry : overwritten.entrySet()) {
|
||||
map.get(entry.getKey()).addAll(entry.getValue());
|
||||
}
|
||||
|
||||
// remove empty entries
|
||||
for(Iterator<Entry<ItemInfo, ArrayList<Smashable>>> it = map.entrySet().iterator(); it.hasNext(); ) {
|
||||
Entry<ItemInfo, ArrayList<Smashable>> entry = it.next();
|
||||
if(entry.getValue().isEmpty()) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<ItemInfo, ArrayList<Smashable>> recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getKey().getStack()) + " (" + recipe.getValue().size() + " entries)";
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < output.length; i++) {
|
||||
ItemStack out = toStack(output[i]);
|
||||
list.add(
|
||||
new Smashable(
|
||||
Block.getBlockFromItem(itemInfo.getItem()),
|
||||
itemInfo.getMeta(),
|
||||
out.getItem(),
|
||||
out.getItemDamage(),
|
||||
(float) chance[i],
|
||||
(float) luck[i]));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
MineTweakerAPI.apply(new Add(recipes));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack inputBlock, int inputBlockMeta, IItemStack outputItem, int outputItemMeta) {
|
||||
removeRecipe(toIItemStack(new ItemStack(toStack(inputBlock).getItem(), 1, inputBlockMeta)), toIItemStack(new ItemStack(toStack(outputItem).getItem(), 1, outputItemMeta)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient input, @Optional IIngredient output) {
|
||||
if(input == null) {
|
||||
private static class Add extends BaseMapAddition<ItemInfo, ArrayList<Smashable>> {
|
||||
|
||||
public Add(Map<ItemInfo, ArrayList<Smashable>> recipes) {
|
||||
super(Hammer.name, HammerRegistry.getRewards(), recipes);
|
||||
}
|
||||
|
||||
public void apply() {
|
||||
for (Entry<ItemInfo, ArrayList<Smashable>> entry : recipes.entrySet()) {
|
||||
if (!map.containsKey(entry.getKey())) {
|
||||
// no recipe for input available, add new entry
|
||||
map.put(entry.getKey(), new ArrayList<Smashable>(entry.getValue()));
|
||||
} else {
|
||||
// recipes already available, add to present list
|
||||
ArrayList<Smashable> list = map.get(entry.getKey());
|
||||
|
||||
// store old Smashable objects if present
|
||||
ArrayList<Smashable> backup = new ArrayList<Smashable>();
|
||||
for (Smashable recipe : entry.getValue()) {
|
||||
backup.addAll(removeFromList(list, recipe));
|
||||
}
|
||||
|
||||
if (!backup.isEmpty()) {
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"Overwritten %d %s recipe outputs for %s.",
|
||||
backup.size(),
|
||||
Hammer.name,
|
||||
LogHelper.getStackDescription(entry.getKey().getStack())));
|
||||
overwritten.put(entry.getKey(), backup);
|
||||
}
|
||||
|
||||
// add new Smashable objects
|
||||
list.addAll(entry.getValue());
|
||||
}
|
||||
|
||||
successful.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public void undo() {
|
||||
// remove all recipes
|
||||
for (Entry<ItemInfo, ArrayList<Smashable>> entry : successful.entrySet()) {
|
||||
ArrayList<Smashable> list = map.get(entry.getKey());
|
||||
for (Smashable recipe : entry.getValue()) {
|
||||
removeFromList(list, recipe);
|
||||
}
|
||||
}
|
||||
|
||||
// re-add overwritten recipes
|
||||
for (Entry<ItemInfo, ArrayList<Smashable>> entry : overwritten.entrySet()) {
|
||||
map.get(entry.getKey()).addAll(entry.getValue());
|
||||
}
|
||||
|
||||
// remove empty entries
|
||||
for (Iterator<Entry<ItemInfo, ArrayList<Smashable>>> it = map.entrySet().iterator(); it.hasNext();) {
|
||||
Entry<ItemInfo, ArrayList<Smashable>> entry = it.next();
|
||||
if (entry.getValue().isEmpty()) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<ItemInfo, ArrayList<Smashable>> recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getKey().getStack()) + " ("
|
||||
+ recipe.getValue().size()
|
||||
+ " entries)";
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack inputBlock, int inputBlockMeta, IItemStack outputItem,
|
||||
int outputItemMeta) {
|
||||
removeRecipe(
|
||||
toIItemStack(new ItemStack(toStack(inputBlock).getItem(), 1, inputBlockMeta)),
|
||||
toIItemStack(new ItemStack(toStack(outputItem).getItem(), 1, outputItemMeta)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient input, @Optional IIngredient output) {
|
||||
if (input == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
if(output == null) {
|
||||
|
||||
if (output == null) {
|
||||
output = IngredientAny.INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
Map<ItemInfo, ArrayList<Smashable>> recipes = new HashMap<ItemInfo, ArrayList<Smashable>>();
|
||||
|
||||
for(Entry<ItemInfo, ArrayList<Smashable>> entry : HammerRegistry.getRewards().entrySet()) {
|
||||
if(input.matches(toIItemStack(entry.getKey().getStack()))) {
|
||||
|
||||
for (Entry<ItemInfo, ArrayList<Smashable>> entry : HammerRegistry.getRewards().entrySet()) {
|
||||
if (input.matches(toIItemStack(entry.getKey().getStack()))) {
|
||||
ArrayList<Smashable> list = entry.getValue();
|
||||
ArrayList<Smashable> toRemove = new ArrayList<Smashable>();
|
||||
|
||||
for(Smashable recipe : list) {
|
||||
|
||||
for (Smashable recipe : list) {
|
||||
ItemStack item = new ItemStack(recipe.item, 1, recipe.meta);
|
||||
|
||||
if(matches(output, toIItemStack(item))) {
|
||||
|
||||
if (matches(output, toIItemStack(item))) {
|
||||
toRemove.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!toRemove.isEmpty()) {
|
||||
|
||||
if (!toRemove.isEmpty()) {
|
||||
recipes.put(entry.getKey(), toRemove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s recipes found for %s and %s. Command ignored!", name, input.toString(), output.toString()));
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"No %s recipes found for %s and %s. Command ignored!",
|
||||
name,
|
||||
input.toString(),
|
||||
output.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Removes a recipe, apply is never the same for anything, so will always
|
||||
// need to override it
|
||||
private static class Remove extends BaseMapRemoval<ItemInfo, ArrayList<Smashable>> {
|
||||
// Removes a recipe, apply is never the same for anything, so will always
|
||||
// need to override it
|
||||
private static class Remove extends BaseMapRemoval<ItemInfo, ArrayList<Smashable>> {
|
||||
|
||||
public Remove(Map<ItemInfo, ArrayList<Smashable>> recipes) {
|
||||
super(Hammer.name, HammerRegistry.getRewards(), recipes);
|
||||
}
|
||||
public Remove(Map<ItemInfo, ArrayList<Smashable>> recipes) {
|
||||
super(Hammer.name, HammerRegistry.getRewards(), recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (Entry<ItemInfo, ArrayList<Smashable>> entry : recipes.entrySet()) {
|
||||
ArrayList<Smashable> list = map.get(entry.getKey());
|
||||
|
||||
for (Smashable recipe : entry.getValue()) {
|
||||
removeFromList(list, recipe);
|
||||
}
|
||||
|
||||
successful.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for(Entry<ItemInfo, ArrayList<Smashable>> entry : recipes.entrySet()) {
|
||||
ArrayList<Smashable> list = map.get(entry.getKey());
|
||||
|
||||
for(Smashable recipe : entry.getValue()) {
|
||||
removeFromList(list, recipe);
|
||||
}
|
||||
|
||||
successful.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
// remove empty entries
|
||||
for(Iterator<Entry<ItemInfo, ArrayList<Smashable>>> it = map.entrySet().iterator(); it.hasNext(); ) {
|
||||
for (Iterator<Entry<ItemInfo, ArrayList<Smashable>>> it = map.entrySet().iterator(); it.hasNext();) {
|
||||
Entry<ItemInfo, ArrayList<Smashable>> entry = it.next();
|
||||
if(entry.getValue().isEmpty()) {
|
||||
if (entry.getValue().isEmpty()) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
for(Entry<ItemInfo, ArrayList<Smashable>> entry : successful.entrySet()) {
|
||||
if(!map.containsKey(entry.getKey())) {
|
||||
@Override
|
||||
public void undo() {
|
||||
for (Entry<ItemInfo, ArrayList<Smashable>> entry : successful.entrySet()) {
|
||||
if (!map.containsKey(entry.getKey())) {
|
||||
map.put(entry.getKey(), new ArrayList<Smashable>(entry.getValue()));
|
||||
} else {
|
||||
map.get(entry.getKey()).addAll(entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<ItemInfo, ArrayList<Smashable>> recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getKey().getStack()) + " (" + recipe.getValue().size() + " entries)";
|
||||
return LogHelper.getStackDescription(recipe.getKey().getStack()) + " ("
|
||||
+ recipe.getValue().size()
|
||||
+ " entries)";
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static ArrayList<Smashable> removeFromList(ArrayList<Smashable> list, Smashable s) {
|
||||
ArrayList<Smashable> removed = new ArrayList<Smashable>();
|
||||
ItemInfo toRemove = new ItemInfo(s.item, s.meta);
|
||||
for(Iterator<Smashable> it = list.iterator(); it.hasNext(); ) {
|
||||
for (Iterator<Smashable> it = list.iterator(); it.hasNext();) {
|
||||
Smashable itS = it.next();
|
||||
ItemInfo item = new ItemInfo(itS.item, itS.meta);
|
||||
|
||||
if(item.equals(toRemove)) {
|
||||
|
||||
if (item.equals(toRemove)) {
|
||||
removed.add(itS);
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return removed;
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,9 @@ import minetweaker.api.item.IngredientAny;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.utils.BaseMapAddition;
|
||||
import modtweaker2.utils.BaseMapRemoval;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@@ -28,203 +30,216 @@ import exnihilo.utils.ItemInfo;
|
||||
|
||||
@ZenClass("mods.exnihilo.Sieve")
|
||||
public class Sieve {
|
||||
|
||||
|
||||
public static final String name = "ExNihilo Sieve";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Adding a Ex Nihilo Sieve recipe
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output, int rarity) {
|
||||
if(input == null || output == null) {
|
||||
|
||||
// Adding a Ex Nihilo Sieve recipe
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output, int rarity) {
|
||||
if (input == null || output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
addRecipe(input, new IItemStack[] { output }, new int[] { rarity });
|
||||
}
|
||||
|
||||
addRecipe(input, new IItemStack[] { output }, new int[] { rarity });
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack[] output, int[] rarity) {
|
||||
if(input == null || output == null || rarity == null) {
|
||||
if (input == null || output == null || rarity == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isABlock(input)) {
|
||||
|
||||
if (!isABlock(input)) {
|
||||
LogHelper.logError(String.format("Input item for %s recipe must be a block.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
if(output.length == 0 || output.length != rarity.length) {
|
||||
LogHelper.logError(String.format("Number of items in arrays are different or null (%d, %d)", output.length, rarity.length));
|
||||
|
||||
if (output.length == 0 || output.length != rarity.length) {
|
||||
LogHelper.logError(
|
||||
String.format(
|
||||
"Number of items in arrays are different or null (%d, %d)",
|
||||
output.length,
|
||||
rarity.length));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Map<ItemInfo, ArrayList<SiftingResult>> recipes = new HashMap<ItemInfo, ArrayList<SiftingResult>>();
|
||||
ArrayList<SiftingResult> list = new ArrayList<SiftingResult>();
|
||||
ItemInfo itemInfo = new ItemInfo(toStack(input));
|
||||
recipes.put(itemInfo, list);
|
||||
|
||||
for(int i = 0; i < output.length; i++) {
|
||||
|
||||
for (int i = 0; i < output.length; i++) {
|
||||
ItemStack out = toStack(output[i]);
|
||||
list.add(new SiftingResult(out.getItem(), out.getItemDamage(), rarity[i]));
|
||||
}
|
||||
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipes));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Add extends BaseMapAddition<ItemInfo, ArrayList<SiftingResult>> {
|
||||
private static class Add extends BaseMapAddition<ItemInfo, ArrayList<SiftingResult>> {
|
||||
|
||||
public Add(Map<ItemInfo, ArrayList<SiftingResult>> recipes) {
|
||||
super(Sieve.name, SieveRegistry.getSiftables(), recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for(Entry<ItemInfo, ArrayList<SiftingResult>> entry : recipes.entrySet()) {
|
||||
if(!map.containsKey(entry.getKey())) {
|
||||
public Add(Map<ItemInfo, ArrayList<SiftingResult>> recipes) {
|
||||
super(Sieve.name, SieveRegistry.getSiftables(), recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (Entry<ItemInfo, ArrayList<SiftingResult>> entry : recipes.entrySet()) {
|
||||
if (!map.containsKey(entry.getKey())) {
|
||||
// no recipe for input available, add new entry
|
||||
map.put(entry.getKey(), new ArrayList<SiftingResult>(entry.getValue()));
|
||||
} else {
|
||||
// recipes already available, add to present list
|
||||
ArrayList<SiftingResult> list = map.get(entry.getKey());
|
||||
|
||||
|
||||
// store old SiftingResult objects if present
|
||||
ArrayList<SiftingResult> backup = new ArrayList<SiftingResult>();
|
||||
for(SiftingResult recipe : entry.getValue()) {
|
||||
for (SiftingResult recipe : entry.getValue()) {
|
||||
backup.addAll(removeFromList(list, recipe));
|
||||
}
|
||||
|
||||
if(!backup.isEmpty()) {
|
||||
LogHelper.logWarning(String.format("Overwritten %d %s recipe outputs for %s.", backup.size(), name, LogHelper.getStackDescription(entry.getKey().getStack())));
|
||||
|
||||
if (!backup.isEmpty()) {
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"Overwritten %d %s recipe outputs for %s.",
|
||||
backup.size(),
|
||||
name,
|
||||
LogHelper.getStackDescription(entry.getKey().getStack())));
|
||||
overwritten.put(entry.getKey(), backup);
|
||||
}
|
||||
|
||||
|
||||
// add new SiftingResult objects
|
||||
list.addAll(entry.getValue());
|
||||
}
|
||||
|
||||
|
||||
successful.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
// remove all recipes
|
||||
for(Entry<ItemInfo, ArrayList<SiftingResult>> entry : successful.entrySet()) {
|
||||
for (Entry<ItemInfo, ArrayList<SiftingResult>> entry : successful.entrySet()) {
|
||||
ArrayList<SiftingResult> list = map.get(entry.getKey());
|
||||
for(SiftingResult recipe : entry.getValue()) {
|
||||
for (SiftingResult recipe : entry.getValue()) {
|
||||
removeFromList(list, recipe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// re-add overwritten recipes
|
||||
for(Entry<ItemInfo, ArrayList<SiftingResult>> entry : overwritten.entrySet()) {
|
||||
for (Entry<ItemInfo, ArrayList<SiftingResult>> entry : overwritten.entrySet()) {
|
||||
map.get(entry.getKey()).addAll(entry.getValue());
|
||||
}
|
||||
|
||||
|
||||
// remove empty entries
|
||||
for(Iterator<Entry<ItemInfo, ArrayList<SiftingResult>>> it = map.entrySet().iterator(); it.hasNext(); ) {
|
||||
for (Iterator<Entry<ItemInfo, ArrayList<SiftingResult>>> it = map.entrySet().iterator(); it.hasNext();) {
|
||||
Entry<ItemInfo, ArrayList<SiftingResult>> entry = it.next();
|
||||
if(entry.getValue().isEmpty()) {
|
||||
if (entry.getValue().isEmpty()) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<ItemInfo, ArrayList<SiftingResult>> recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getKey().getStack()) + " (" + recipe.getValue().size() + " entries)";
|
||||
return LogHelper.getStackDescription(recipe.getKey().getStack()) + " ("
|
||||
+ recipe.getValue().size()
|
||||
+ " entries)";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack input, IItemStack output) {
|
||||
removeRecipe((IIngredient)input, (IIngredient)output);
|
||||
}
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack input, IItemStack output) {
|
||||
removeRecipe((IIngredient) input, (IIngredient) output);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void removeRewardFromAllBlocks(IItemStack output)
|
||||
{
|
||||
removeRecipe(IngredientAny.INSTANCE, (IIngredient)output);
|
||||
}
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void removeRewardFromAllBlocks(IItemStack output) {
|
||||
removeRecipe(IngredientAny.INSTANCE, (IIngredient) output);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void removeAllRewardsFromBlock(IItemStack output)
|
||||
{
|
||||
removeRecipe((IIngredient)output, IngredientAny.INSTANCE);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient input, @Optional IIngredient output) {
|
||||
if(input == null) {
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void removeAllRewardsFromBlock(IItemStack output) {
|
||||
removeRecipe((IIngredient) output, IngredientAny.INSTANCE);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient input, @Optional IIngredient output) {
|
||||
if (input == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
if(output == null) {
|
||||
|
||||
if (output == null) {
|
||||
output = IngredientAny.INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
Map<ItemInfo, ArrayList<SiftingResult>> recipes = new HashMap<ItemInfo, ArrayList<SiftingResult>>();
|
||||
|
||||
for(Entry<ItemInfo, ArrayList<SiftingResult>> entry : SieveRegistry.getSiftables().entrySet()) {
|
||||
if(input.matches(toIItemStack(entry.getKey().getStack()))) {
|
||||
|
||||
for (Entry<ItemInfo, ArrayList<SiftingResult>> entry : SieveRegistry.getSiftables().entrySet()) {
|
||||
if (input.matches(toIItemStack(entry.getKey().getStack()))) {
|
||||
ArrayList<SiftingResult> list = entry.getValue();
|
||||
ArrayList<SiftingResult> toRemove = new ArrayList<SiftingResult>();
|
||||
|
||||
for(SiftingResult recipe : list) {
|
||||
|
||||
for (SiftingResult recipe : list) {
|
||||
ItemStack item = new ItemStack(recipe.item, 1, recipe.meta);
|
||||
|
||||
if(matches(output, toIItemStack(item))) {
|
||||
|
||||
if (matches(output, toIItemStack(item))) {
|
||||
toRemove.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!toRemove.isEmpty()) {
|
||||
|
||||
if (!toRemove.isEmpty()) {
|
||||
recipes.put(entry.getKey(), toRemove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s recipes found for %s and %s. Command ignored!", name, input.toString(), output.toString()));
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"No %s recipes found for %s and %s. Command ignored!",
|
||||
name,
|
||||
input.toString(),
|
||||
output.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Removes a recipe, apply is never the same for anything, so will always
|
||||
// need to override it
|
||||
private static class Remove extends BaseMapRemoval<ItemInfo, ArrayList<SiftingResult>> {
|
||||
|
||||
public Remove(Map<ItemInfo, ArrayList<SiftingResult>> recipes) {
|
||||
super(Sieve.name, SieveRegistry.getSiftables(), recipes);
|
||||
}
|
||||
|
||||
// Removes a recipe, apply is never the same for anything, so will always
|
||||
// need to override it
|
||||
private static class Remove extends BaseMapRemoval<ItemInfo, ArrayList<SiftingResult>> {
|
||||
public Remove(Map<ItemInfo, ArrayList<SiftingResult>> recipes) {
|
||||
super(Sieve.name, SieveRegistry.getSiftables(), recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for(Entry<ItemInfo, ArrayList<SiftingResult>> entry : recipes.entrySet()) {
|
||||
for (Entry<ItemInfo, ArrayList<SiftingResult>> entry : recipes.entrySet()) {
|
||||
ArrayList<SiftingResult> list = map.get(entry.getKey());
|
||||
|
||||
for(SiftingResult recipe : entry.getValue()) {
|
||||
|
||||
for (SiftingResult recipe : entry.getValue()) {
|
||||
removeFromList(list, recipe);
|
||||
}
|
||||
|
||||
|
||||
successful.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
|
||||
// remove empty entries
|
||||
for(Iterator<Entry<ItemInfo, ArrayList<SiftingResult>>> it = map.entrySet().iterator(); it.hasNext(); ) {
|
||||
for (Iterator<Entry<ItemInfo, ArrayList<SiftingResult>>> it = map.entrySet().iterator(); it.hasNext();) {
|
||||
Entry<ItemInfo, ArrayList<SiftingResult>> entry = it.next();
|
||||
if(entry.getValue().isEmpty()) {
|
||||
if (entry.getValue().isEmpty()) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
@@ -232,36 +247,38 @@ public class Sieve {
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
for(Entry<ItemInfo, ArrayList<SiftingResult>> entry : successful.entrySet()) {
|
||||
if(!map.containsKey(entry.getKey())) {
|
||||
for (Entry<ItemInfo, ArrayList<SiftingResult>> entry : successful.entrySet()) {
|
||||
if (!map.containsKey(entry.getKey())) {
|
||||
map.put(entry.getKey(), new ArrayList<SiftingResult>(entry.getValue()));
|
||||
} else {
|
||||
map.get(entry.getKey()).addAll(entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Entry<ItemInfo, ArrayList<SiftingResult>> recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getKey().getStack()) + " (" + recipe.getValue().size() + " entries)";
|
||||
return LogHelper.getStackDescription(recipe.getKey().getStack()) + " ("
|
||||
+ recipe.getValue().size()
|
||||
+ " entries)";
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static ArrayList<SiftingResult> removeFromList(ArrayList<SiftingResult> list, SiftingResult s) {
|
||||
ArrayList<SiftingResult> removed = new ArrayList<SiftingResult>();
|
||||
ItemInfo toRemove = new ItemInfo(s.item, s.meta);
|
||||
for(Iterator<SiftingResult> it = list.iterator(); it.hasNext(); ) {
|
||||
for (Iterator<SiftingResult> it = list.iterator(); it.hasNext();) {
|
||||
SiftingResult itS = it.next();
|
||||
ItemInfo item = new ItemInfo(itS.item, itS.meta);
|
||||
|
||||
if(item.equals(toRemove)) {
|
||||
|
||||
if (item.equals(toRemove)) {
|
||||
removed.add(itS);
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return removed;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import minetweaker.MineTweakerAPI;
|
||||
import modtweaker2.mods.extendedworkbench.handlers.ExtendedCrafting;
|
||||
|
||||
public class ExtendedWorkbench {
|
||||
|
||||
public ExtendedWorkbench() {
|
||||
MineTweakerAPI.registerClass(ExtendedCrafting.class);
|
||||
}
|
||||
|
||||
@@ -16,16 +16,18 @@ import naruto1310.extendedWorkbench.crafting.ExtendedCraftingManager;
|
||||
import naruto1310.extendedWorkbench.crafting.ExtendedShapedRecipes;
|
||||
import naruto1310.extendedWorkbench.crafting.ExtendedShapelessRecipes;
|
||||
import naruto1310.extendedWorkbench.crafting.IExtendedRecipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.extendedworkbench")
|
||||
public class ExtendedCrafting {
|
||||
|
||||
|
||||
public static final String name = "Extended Workbench";
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addShaped(IItemStack output, IItemStack[][] ingredients) {
|
||||
MineTweakerAPI.apply(new Add(getShapedRecipe(output, ingredients)));
|
||||
@@ -33,10 +35,12 @@ public class ExtendedCrafting {
|
||||
|
||||
@ZenMethod
|
||||
public static void addShapeless(IItemStack output, IItemStack[] ingredients) {
|
||||
MineTweakerAPI.apply(new Add(new ExtendedShapelessRecipes(toStack(output), Arrays.asList(toStacks(ingredients)))));
|
||||
MineTweakerAPI
|
||||
.apply(new Add(new ExtendedShapelessRecipes(toStack(output), Arrays.asList(toStacks(ingredients)))));
|
||||
}
|
||||
|
||||
private static class Add extends BaseCraftingAddition {
|
||||
|
||||
public Add(IExtendedRecipe recipe) {
|
||||
super(ExtendedCrafting.name, ExtendedCraftingManager.getInstance().getRecipeList());
|
||||
recipes.add(recipe);
|
||||
@@ -71,12 +75,18 @@ public class ExtendedCrafting {
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
List<IRecipe> recipes = BaseCraftingRemoval.getRecipes(ExtendedCraftingManager.getInstance().getRecipeList(), output);
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new BaseCraftingRemoval(ExtendedCrafting.name, ExtendedCraftingManager.getInstance().getRecipeList(), recipes));
|
||||
List<IRecipe> recipes = BaseCraftingRemoval
|
||||
.getRecipes(ExtendedCraftingManager.getInstance().getRecipeList(), output);
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(
|
||||
new BaseCraftingRemoval(
|
||||
ExtendedCrafting.name,
|
||||
ExtendedCraftingManager.getInstance().getRecipeList(),
|
||||
recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ExtendedCrafting.name, output));
|
||||
LogHelper.logWarning(
|
||||
String.format("No %s Recipe found for %s. Command ignored!", ExtendedCrafting.name, output));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
package modtweaker2.mods.extraUtils;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker2.mods.appeng.handlers.Grind;
|
||||
import modtweaker2.mods.extraUtils.handlers.QED;
|
||||
|
||||
public class ExtraUtils {
|
||||
|
||||
public ExtraUtils() {
|
||||
MineTweakerAPI.registerClass(QED.class);
|
||||
}
|
||||
public ExtraUtils() {
|
||||
MineTweakerAPI.registerClass(QED.class);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package modtweaker2.mods.extraUtils.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
@@ -9,66 +12,71 @@ import modtweaker2.helpers.InputHelper;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import com.rwtema.extrautils.tileentity.enderconstructor.EnderConstructorRecipesHandler;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.extraUtils.QED")
|
||||
public class QED {
|
||||
|
||||
public static final String name = "ExtraUtilities Q.E.D.";
|
||||
public static final String name = "ExtraUtilities Q.E.D.";
|
||||
|
||||
@ZenMethod
|
||||
public static void addShapedRecipe(IItemStack output, IIngredient[][] recipe) {
|
||||
MineTweakerAPI.apply(new Add(new ShapedOreRecipe(InputHelper.toStack(output), InputHelper.toShapedObjects(recipe))));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<IRecipe> {
|
||||
@ZenMethod
|
||||
public static void addShapedRecipe(IItemStack output, IIngredient[][] recipe) {
|
||||
MineTweakerAPI
|
||||
.apply(new Add(new ShapedOreRecipe(InputHelper.toStack(output), InputHelper.toShapedObjects(recipe))));
|
||||
}
|
||||
|
||||
public Add(IRecipe recipe) {
|
||||
super("QED", EnderConstructorRecipesHandler.recipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
private static class Add extends BaseListAddition<IRecipe> {
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(IRecipe recipe) {
|
||||
return recipe.toString();
|
||||
}
|
||||
}
|
||||
public Add(IRecipe recipe) {
|
||||
super("QED", EnderConstructorRecipesHandler.recipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
LinkedList<IRecipe> recipes = new LinkedList<IRecipe>();
|
||||
@Override
|
||||
protected String getRecipeInfo(IRecipe recipe) {
|
||||
return recipe.toString();
|
||||
}
|
||||
}
|
||||
|
||||
for (IRecipe recipe : EnderConstructorRecipesHandler.recipes) {
|
||||
if (recipe != null && recipe.getRecipeOutput() != null && matches(output, toIItemStack(recipe.getRecipeOutput()))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
LinkedList<IRecipe> recipes = new LinkedList<IRecipe>();
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", QED.name, LogHelper.getStackDescription(output)));
|
||||
}
|
||||
}
|
||||
for (IRecipe recipe : EnderConstructorRecipesHandler.recipes) {
|
||||
if (recipe != null && recipe.getRecipeOutput() != null
|
||||
&& matches(output, toIItemStack(recipe.getRecipeOutput()))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Remove extends BaseListRemoval<IRecipe> {
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"No %s Recipe found for %s. Command ignored!",
|
||||
QED.name,
|
||||
LogHelper.getStackDescription(output)));
|
||||
}
|
||||
}
|
||||
|
||||
protected Remove(LinkedList<IRecipe> stacks) {
|
||||
super("QED", EnderConstructorRecipesHandler.recipes, stacks);
|
||||
}
|
||||
public static class Remove extends BaseListRemoval<IRecipe> {
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(IRecipe recipe) {
|
||||
return recipe.toString();
|
||||
}
|
||||
}
|
||||
protected Remove(LinkedList<IRecipe> stacks) {
|
||||
super("QED", EnderConstructorRecipesHandler.recipes, stacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(IRecipe recipe) {
|
||||
return recipe.toString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import modtweaker2.mods.factorization.handlers.Lacerator;
|
||||
import modtweaker2.mods.factorization.handlers.SlagFurnace;
|
||||
|
||||
public class Factorization {
|
||||
|
||||
public Factorization() {
|
||||
MineTweakerAPI.registerClass(Crystallizer.class);
|
||||
MineTweakerAPI.registerClass(Lacerator.class);
|
||||
|
||||
@@ -5,35 +5,54 @@ import static modtweaker2.helpers.ReflectionHelper.getStaticObject;
|
||||
import java.util.List;
|
||||
|
||||
import modtweaker2.helpers.ReflectionHelper;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FactorizationHelper {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static List lacerator = null;
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static List slag = null;
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static List crystallizer = null;
|
||||
|
||||
|
||||
static {
|
||||
try {
|
||||
lacerator = getStaticObject(Class.forName("factorization.oreprocessing.TileEntityGrinder"), "recipes");
|
||||
slag = ReflectionHelper.getObject(getStaticObject(Class.forName("factorization.oreprocessing.TileEntitySlagFurnace"), "recipes"), "list");
|
||||
crystallizer = ReflectionHelper.getObject(getStaticObject(Class.forName("factorization.oreprocessing.TileEntityCrystallizer"), "recipes"), "list");
|
||||
lacerator = getStaticObject(Class.forName("factorization.oreprocessing.TileEntityGrinder"), "recipes");
|
||||
slag = ReflectionHelper.getObject(
|
||||
getStaticObject(Class.forName("factorization.oreprocessing.TileEntitySlagFurnace"), "recipes"),
|
||||
"list");
|
||||
crystallizer = ReflectionHelper.getObject(
|
||||
getStaticObject(Class.forName("factorization.oreprocessing.TileEntityCrystallizer"), "recipes"),
|
||||
"list");
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
private FactorizationHelper() {}
|
||||
|
||||
public static Object getLaceratorRecipe(Object input, ItemStack output, float probability) {
|
||||
return ReflectionHelper.getInstance(ReflectionHelper.getConstructor("factorization.oreprocessing.TileEntityGrinder$GrinderRecipe", Object.class, ItemStack.class, float.class),
|
||||
return ReflectionHelper.getInstance(
|
||||
ReflectionHelper.getConstructor(
|
||||
"factorization.oreprocessing.TileEntityGrinder$GrinderRecipe",
|
||||
Object.class,
|
||||
ItemStack.class,
|
||||
float.class),
|
||||
input,
|
||||
output,
|
||||
probability);
|
||||
}
|
||||
|
||||
public static Object getSlagFurnaceRecipe(ItemStack input, float chance1, ItemStack output1, float chance2, ItemStack output2) {
|
||||
return ReflectionHelper.getInstance(ReflectionHelper.getConstructor("factorization.oreprocessing.TileEntitySlagFurnace$SmeltingResult", ItemStack.class, float.class, ItemStack.class, float.class, ItemStack.class),
|
||||
public static Object getSlagFurnaceRecipe(ItemStack input, float chance1, ItemStack output1, float chance2,
|
||||
ItemStack output2) {
|
||||
return ReflectionHelper.getInstance(
|
||||
ReflectionHelper.getConstructor(
|
||||
"factorization.oreprocessing.TileEntitySlagFurnace$SmeltingResult",
|
||||
ItemStack.class,
|
||||
float.class,
|
||||
ItemStack.class,
|
||||
float.class,
|
||||
ItemStack.class),
|
||||
input,
|
||||
chance1,
|
||||
output1,
|
||||
@@ -41,11 +60,18 @@ public class FactorizationHelper {
|
||||
output2);
|
||||
}
|
||||
|
||||
public static Object getCrystallizerRecipe(ItemStack input, ItemStack output, ItemStack solution, float output_count) {
|
||||
return ReflectionHelper.getInstance(ReflectionHelper.getConstructor("factorization.oreprocessing.TileEntityCrystallizer$CrystalRecipe", ItemStack.class, ItemStack.class, float.class, ItemStack.class),
|
||||
public static Object getCrystallizerRecipe(ItemStack input, ItemStack output, ItemStack solution,
|
||||
float output_count) {
|
||||
return ReflectionHelper.getInstance(
|
||||
ReflectionHelper.getConstructor(
|
||||
"factorization.oreprocessing.TileEntityCrystallizer$CrystalRecipe",
|
||||
ItemStack.class,
|
||||
ItemStack.class,
|
||||
float.class,
|
||||
ItemStack.class),
|
||||
input,
|
||||
output,
|
||||
output_count,
|
||||
solution);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,62 +12,83 @@ import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.helpers.ReflectionHelper;
|
||||
import modtweaker2.helpers.StringHelper;
|
||||
import modtweaker2.mods.factorization.FactorizationHelper;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FactorizationLogger implements ICommandFunction {
|
||||
|
||||
private static final List<String> validArguments = new LinkedList<String>();
|
||||
|
||||
|
||||
static {
|
||||
validArguments.add("Crystallizer");
|
||||
validArguments.add("Lacerator");
|
||||
validArguments.add("SlagFurnace");
|
||||
}
|
||||
|
||||
|
||||
@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, ", ")));
|
||||
|
||||
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("Crystallizer")) {
|
||||
for(Object recipe : FactorizationHelper.crystallizer) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.factorization.Crystallizer.addRecipe(%s, %s, %s, %s);",
|
||||
LogHelper.getStackDescription(ReflectionHelper.<ItemStack>getObject(recipe, "input")),
|
||||
LogHelper.getStackDescription(ReflectionHelper.<ItemStack>getObject(recipe, "output")),
|
||||
LogHelper.getStackDescription(ReflectionHelper.<ItemStack>getObject(recipe, "solution")),
|
||||
ReflectionHelper.<Float>getObject(recipe, "output_count")));
|
||||
if (args.isEmpty() || args.contains("Crystallizer")) {
|
||||
for (Object recipe : FactorizationHelper.crystallizer) {
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.factorization.Crystallizer.addRecipe(%s, %s, %s, %s);",
|
||||
LogHelper.getStackDescription(
|
||||
ReflectionHelper.<ItemStack>getObject(recipe, "input")),
|
||||
LogHelper.getStackDescription(
|
||||
ReflectionHelper.<ItemStack>getObject(recipe, "output")),
|
||||
LogHelper.getStackDescription(
|
||||
ReflectionHelper.<ItemStack>getObject(recipe, "solution")),
|
||||
ReflectionHelper.<Float>getObject(recipe, "output_count")));
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("Lacerator")) {
|
||||
for(Object recipe : FactorizationHelper.lacerator) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.factorization.Lacerator.addRecipe(%s, %s, %s);",
|
||||
ReflectionHelper.<String>getObject(recipe, "oreName") != null ?
|
||||
LogHelper.getStackDescription(ReflectionHelper.<String>getObject(recipe, "oreName")) :
|
||||
LogHelper.getStackDescription(ReflectionHelper.<ItemStack>getObject(recipe, "itemstack")),
|
||||
LogHelper.getStackDescription(ReflectionHelper.<ItemStack>getObject(recipe, "output")),
|
||||
ReflectionHelper.<Float>getObject(recipe, "probability")));
|
||||
|
||||
if (args.isEmpty() || args.contains("Lacerator")) {
|
||||
for (Object recipe : FactorizationHelper.lacerator) {
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.factorization.Lacerator.addRecipe(%s, %s, %s);",
|
||||
ReflectionHelper.<String>getObject(recipe, "oreName") != null
|
||||
? LogHelper.getStackDescription(
|
||||
ReflectionHelper.<String>getObject(recipe, "oreName"))
|
||||
: LogHelper.getStackDescription(
|
||||
ReflectionHelper.<ItemStack>getObject(recipe, "itemstack")),
|
||||
LogHelper.getStackDescription(
|
||||
ReflectionHelper.<ItemStack>getObject(recipe, "output")),
|
||||
ReflectionHelper.<Float>getObject(recipe, "probability")));
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("SlagFurnace")) {
|
||||
for(Object recipe : FactorizationHelper.slag) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.factorization.SlagFurnace.addRecipe(%s, %s, %s, %s, %s);",
|
||||
LogHelper.getStackDescription(ReflectionHelper.<ItemStack>getObject(recipe, "input")),
|
||||
LogHelper.getStackDescription(ReflectionHelper.<ItemStack>getObject(recipe, "output2")),
|
||||
ReflectionHelper.<Float>getObject(recipe, "prob2"),
|
||||
LogHelper.getStackDescription(ReflectionHelper.<ItemStack>getObject(recipe, "output1")),
|
||||
ReflectionHelper.<Float>getObject(recipe, "prob1")));
|
||||
|
||||
if (args.isEmpty() || args.contains("SlagFurnace")) {
|
||||
for (Object recipe : FactorizationHelper.slag) {
|
||||
MineTweakerAPI.logCommand(
|
||||
String.format(
|
||||
"mods.factorization.SlagFurnace.addRecipe(%s, %s, %s, %s, %s);",
|
||||
LogHelper.getStackDescription(
|
||||
ReflectionHelper.<ItemStack>getObject(recipe, "input")),
|
||||
LogHelper.getStackDescription(
|
||||
ReflectionHelper.<ItemStack>getObject(recipe, "output2")),
|
||||
ReflectionHelper.<Float>getObject(recipe, "prob2"),
|
||||
LogHelper.getStackDescription(
|
||||
ReflectionHelper.<ItemStack>getObject(recipe, "output1")),
|
||||
ReflectionHelper.<Float>getObject(recipe, "prob1")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
player.sendChat(
|
||||
MineTweakerImplementationAPI.platform
|
||||
.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,25 +15,28 @@ import modtweaker2.helpers.ReflectionHelper;
|
||||
import modtweaker2.mods.factorization.FactorizationHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
|
||||
@ZenClass("mods.factorization.Crystallizer")
|
||||
public class Crystallizer {
|
||||
|
||||
|
||||
public static final String name = "Factorization Crystallizer";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output, IItemStack solution, double output_count) {
|
||||
Object recipe = FactorizationHelper.getCrystallizerRecipe(toStack(input), toStack(output), toStack(solution), (float) output_count);
|
||||
Object recipe = FactorizationHelper
|
||||
.getCrystallizerRecipe(toStack(input), toStack(output), toStack(solution), (float) output_count);
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<Object> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Add(Object recipe) {
|
||||
super(Crystallizer.name, FactorizationHelper.crystallizer);
|
||||
@@ -42,7 +45,7 @@ public class Crystallizer {
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Object recipe) {
|
||||
return LogHelper.getStackDescription((ItemStack)ReflectionHelper.getObject(recipe, "output"));
|
||||
return LogHelper.getStackDescription((ItemStack) ReflectionHelper.getObject(recipe, "output"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +54,7 @@ public class Crystallizer {
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
List<Object> recipes = new LinkedList<Object>();
|
||||
|
||||
|
||||
for (Object r : FactorizationHelper.crystallizer) {
|
||||
if (r != null) {
|
||||
ItemStack out = (ItemStack) ReflectionHelper.getObject(r, "output");;
|
||||
@@ -60,15 +63,17 @@ public class Crystallizer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Crystallizer.name, output.toString()));
|
||||
LogHelper.logWarning(
|
||||
String.format("No %s Recipe found for %s. Command ignored!", Crystallizer.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<Object> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Remove(List<Object> recipes) {
|
||||
super(Crystallizer.name, FactorizationHelper.crystallizer, recipes);
|
||||
@@ -76,7 +81,7 @@ public class Crystallizer {
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Object recipe) {
|
||||
return LogHelper.getStackDescription((ItemStack)ReflectionHelper.getObject(recipe, "output"));
|
||||
return LogHelper.getStackDescription((ItemStack) ReflectionHelper.getObject(recipe, "output"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,17 +16,19 @@ import modtweaker2.helpers.ReflectionHelper;
|
||||
import modtweaker2.mods.factorization.FactorizationHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.factorization.Lacerator")
|
||||
public class Lacerator {
|
||||
|
||||
|
||||
public static final String name = "Factorization Lacerator";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IIngredient input, IItemStack output, double probability) {
|
||||
Object recipe = FactorizationHelper.getLaceratorRecipe(toObject(input), toStack(output), (float) probability);
|
||||
@@ -34,6 +36,7 @@ public class Lacerator {
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<Object> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Add(Object recipe) {
|
||||
super(Lacerator.name, FactorizationHelper.lacerator);
|
||||
@@ -52,22 +55,24 @@ public class Lacerator {
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
List<Object> recipes = new LinkedList<Object>();
|
||||
for (Object r : FactorizationHelper.lacerator) {
|
||||
if(r != null) {
|
||||
if (r != null) {
|
||||
ItemStack out = (ItemStack) ReflectionHelper.getObject(r, "output");
|
||||
if (output != null && matches(output, toIItemStack(out))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored", Lacerator.name, output.toString()));
|
||||
LogHelper.logWarning(
|
||||
String.format("No %s Recipe found for %s. Command ignored", Lacerator.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<Object> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Remove(List<Object> recipes) {
|
||||
super(Lacerator.name, FactorizationHelper.lacerator, recipes);
|
||||
|
||||
@@ -15,68 +15,78 @@ import modtweaker2.helpers.ReflectionHelper;
|
||||
import modtweaker2.mods.factorization.FactorizationHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.factorization.SlagFurnace")
|
||||
public class SlagFurnace {
|
||||
|
||||
|
||||
public static final String name = "Factorization Slag Furnace";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output1, double chance1, IItemStack output2, double chance2) {
|
||||
Object recipe = FactorizationHelper.getSlagFurnaceRecipe(toStack(input), (float) chance1, toStack(output1), (float) chance2, toStack(output2));
|
||||
MineTweakerAPI.apply(new Add(toStack(input), recipe));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<Object> {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Add(ItemStack input, Object recipe) {
|
||||
super(SlagFurnace.name, FactorizationHelper.slag);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output1, double chance1, IItemStack output2,
|
||||
double chance2) {
|
||||
Object recipe = FactorizationHelper.getSlagFurnaceRecipe(
|
||||
toStack(input),
|
||||
(float) chance1,
|
||||
toStack(output1),
|
||||
(float) chance2,
|
||||
toStack(output2));
|
||||
MineTweakerAPI.apply(new Add(toStack(input), recipe));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Object recipe) {
|
||||
return LogHelper.getStackDescription((ItemStack) ReflectionHelper.getObject(recipe, "input"));
|
||||
}
|
||||
}
|
||||
private static class Add extends BaseListAddition<Object> {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient input) {
|
||||
List<Object> recipes = new LinkedList<Object>();
|
||||
|
||||
for(Object r : FactorizationHelper.slag) {
|
||||
if(r != null) {
|
||||
ItemStack in = (ItemStack) ReflectionHelper.getObject(r, "input");
|
||||
|
||||
if(matches(input, toIItemStack(in))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", SlagFurnace.name, input));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<Object> {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Remove(List<Object> recipes) {
|
||||
super(SlagFurnace.name, FactorizationHelper.slag, recipes);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public Add(ItemStack input, Object recipe) {
|
||||
super(SlagFurnace.name, FactorizationHelper.slag);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Object recipe) {
|
||||
return LogHelper.getStackDescription((ItemStack) ReflectionHelper.getObject(recipe, "input"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient input) {
|
||||
List<Object> recipes = new LinkedList<Object>();
|
||||
|
||||
for (Object r : FactorizationHelper.slag) {
|
||||
if (r != null) {
|
||||
ItemStack in = (ItemStack) ReflectionHelper.getObject(r, "input");
|
||||
|
||||
if (matches(input, toIItemStack(in))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", SlagFurnace.name, input));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<Object> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Remove(List<Object> recipes) {
|
||||
super(SlagFurnace.name, FactorizationHelper.slag, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Object recipe) {
|
||||
return LogHelper.getStackDescription((ItemStack) ReflectionHelper.getObject(recipe, "input"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,13 +10,14 @@ import modtweaker2.mods.forestry.handlers.Still;
|
||||
import modtweaker2.mods.forestry.handlers.ThermionicFabricator;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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,55 +1,57 @@
|
||||
package modtweaker2.mods.forestry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.recipes.ICraftingProvider;
|
||||
import forestry.api.recipes.IForestryRecipe;
|
||||
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
|
||||
public abstract class ForestryListAddition<T extends IForestryRecipe, C extends ICraftingProvider<T>> extends BaseListAddition<T> {
|
||||
private final C craftingProvider;
|
||||
|
||||
protected ForestryListAddition(String name, C craftingProvider) {
|
||||
super(name, new ArrayList<T>(craftingProvider.recipes()));
|
||||
this.craftingProvider = craftingProvider;
|
||||
}
|
||||
|
||||
protected ForestryListAddition(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 final void apply() {
|
||||
for (T recipe : recipes) {
|
||||
if (recipe != null) {
|
||||
if (craftingProvider.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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void undo() {
|
||||
for (T recipe : successful) {
|
||||
if (recipe != null) {
|
||||
if (!craftingProvider.removeRecipe(recipe)) {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe for %s", name, this.getRecipeInfo(recipe)));
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
package modtweaker2.mods.forestry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import forestry.api.recipes.ICraftingProvider;
|
||||
import forestry.api.recipes.IForestryRecipe;
|
||||
|
||||
public abstract class ForestryListAddition<T extends IForestryRecipe, C extends ICraftingProvider<T>>
|
||||
extends BaseListAddition<T> {
|
||||
|
||||
private final C craftingProvider;
|
||||
|
||||
protected ForestryListAddition(String name, C craftingProvider) {
|
||||
super(name, new ArrayList<T>(craftingProvider.recipes()));
|
||||
this.craftingProvider = craftingProvider;
|
||||
}
|
||||
|
||||
protected ForestryListAddition(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 final void apply() {
|
||||
for (T recipe : recipes) {
|
||||
if (recipe != null) {
|
||||
if (craftingProvider.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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void undo() {
|
||||
for (T recipe : successful) {
|
||||
if (recipe != null) {
|
||||
if (!craftingProvider.removeRecipe(recipe)) {
|
||||
LogHelper.logError(
|
||||
String.format("Error removing %s Recipe for %s", name, this.getRecipeInfo(recipe)));
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +1,51 @@
|
||||
package modtweaker2.mods.forestry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.recipes.ICraftingProvider;
|
||||
import forestry.api.recipes.IForestryRecipe;
|
||||
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
|
||||
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 final void apply() {
|
||||
for (T recipe : recipes) {
|
||||
if (recipe != null) {
|
||||
if (craftingProvider.removeRecipe(recipe)) {
|
||||
successful.add(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 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 {
|
||||
LogHelper.logError(String.format("Error restoring %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
package modtweaker2.mods.forestry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
import forestry.api.recipes.ICraftingProvider;
|
||||
import forestry.api.recipes.IForestryRecipe;
|
||||
|
||||
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 final void apply() {
|
||||
for (T recipe : recipes) {
|
||||
if (recipe != null) {
|
||||
if (craftingProvider.removeRecipe(recipe)) {
|
||||
successful.add(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 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 {
|
||||
LogHelper.logError(String.format("Error restoring %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,8 @@ package modtweaker2.mods.forestry.handlers;
|
||||
import static modtweaker2.helpers.InputHelper.toFluid;
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.InputHelper.toILiquidStack;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.InputHelper.toStacks;
|
||||
import static modtweaker2.helpers.InputHelper.toShapedObjects;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
|
||||
import java.util.LinkedList;
|
||||
@@ -19,13 +18,13 @@ import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.mods.forestry.ForestryListAddition;
|
||||
import modtweaker2.mods.forestry.ForestryListRemoval;
|
||||
import modtweaker2.mods.forestry.recipes.CarpenterRecipe;
|
||||
import modtweaker2.mods.forestry.recipes.DescriptiveRecipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import modtweaker2.mods.forestry.recipes.DescriptiveRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import forestry.api.recipes.ICarpenterManager;
|
||||
import forestry.api.recipes.ICarpenterRecipe;
|
||||
import forestry.api.recipes.IDescriptiveRecipe;
|
||||
@@ -33,114 +32,134 @@ import forestry.api.recipes.RecipeManagers;
|
||||
|
||||
@ZenClass("mods.forestry.Carpenter")
|
||||
public class Carpenter {
|
||||
|
||||
public static final String name = "Forestry Carpenter";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
public static final String name = "Forestry Carpenter";
|
||||
|
||||
/**
|
||||
* Adds a shaped recipe for the Carpenter
|
||||
*
|
||||
* @param output recipe output
|
||||
* @param ingredients recipe ingredients
|
||||
* @param packagingTime time per crafting operation
|
||||
* @optionalParam box recipes casting item (optional)
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IIngredient[][] ingredients, int packagingTime, @Optional IItemStack box) {
|
||||
IDescriptiveRecipe craftRecipe = new DescriptiveRecipe(3, 3, toShapedObjects(ingredients), toStack(output), false);
|
||||
MineTweakerAPI.apply(new Add(new CarpenterRecipe(packagingTime, null, toStack(box), craftRecipe)));
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a shaped recipe for the Carpenter
|
||||
*
|
||||
* @param output recipe output
|
||||
* @param ingredients recipe ingredients
|
||||
* @param fluidInput recipe fluid amount
|
||||
* @param packagingTime time per crafting operation
|
||||
* @optionalParam box recipes casting item (optional)
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IIngredient[][] ingredients, ILiquidStack fluidInput, int packagingTime, @Optional IItemStack box) {
|
||||
IDescriptiveRecipe craftRecipe = new DescriptiveRecipe(3, 3, toShapedObjects(ingredients), toStack(output), false);
|
||||
MineTweakerAPI.apply(new Add(new CarpenterRecipe(packagingTime, toFluid(fluidInput), toStack(box), craftRecipe)));
|
||||
}
|
||||
/**
|
||||
* Adds a shaped recipe for the Carpenter
|
||||
*
|
||||
* @param output recipe output
|
||||
* @param ingredients recipe ingredients
|
||||
* @param packagingTime time per crafting operation
|
||||
* @optionalParam box recipes casting item (optional)
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IIngredient[][] ingredients, int packagingTime,
|
||||
@Optional IItemStack box) {
|
||||
IDescriptiveRecipe craftRecipe = new DescriptiveRecipe(
|
||||
3,
|
||||
3,
|
||||
toShapedObjects(ingredients),
|
||||
toStack(output),
|
||||
false);
|
||||
MineTweakerAPI.apply(new Add(new CarpenterRecipe(packagingTime, null, toStack(box), craftRecipe)));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(int packagingTime, ILiquidStack fluidInput, IItemStack[] ingredients, IItemStack box, IItemStack output) {
|
||||
IDescriptiveRecipe craftRecipe = new DescriptiveRecipe(3, 3, toShapedObjects(transform(ingredients, 3)), toStack(output), false);
|
||||
MineTweakerAPI.apply(new Add(new CarpenterRecipe(packagingTime, toFluid(fluidInput), toStack(box), craftRecipe)));
|
||||
}
|
||||
/**
|
||||
* Adds a shaped recipe for the Carpenter
|
||||
*
|
||||
* @param output recipe output
|
||||
* @param ingredients recipe ingredients
|
||||
* @param fluidInput recipe fluid amount
|
||||
* @param packagingTime time per crafting operation
|
||||
* @optionalParam box recipes casting item (optional)
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IIngredient[][] ingredients, ILiquidStack fluidInput,
|
||||
int packagingTime, @Optional IItemStack box) {
|
||||
IDescriptiveRecipe craftRecipe = new DescriptiveRecipe(
|
||||
3,
|
||||
3,
|
||||
toShapedObjects(ingredients),
|
||||
toStack(output),
|
||||
false);
|
||||
MineTweakerAPI
|
||||
.apply(new Add(new CarpenterRecipe(packagingTime, toFluid(fluidInput), toStack(box), craftRecipe)));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(int packagingTime, ILiquidStack fluidInput, IItemStack[] ingredients, IItemStack box,
|
||||
IItemStack output) {
|
||||
IDescriptiveRecipe craftRecipe = new DescriptiveRecipe(
|
||||
3,
|
||||
3,
|
||||
toShapedObjects(transform(ingredients, 3)),
|
||||
toStack(output),
|
||||
false);
|
||||
MineTweakerAPI
|
||||
.apply(new Add(new CarpenterRecipe(packagingTime, toFluid(fluidInput), toStack(box), craftRecipe)));
|
||||
}
|
||||
|
||||
private static class Add extends ForestryListAddition<ICarpenterRecipe, ICarpenterManager> {
|
||||
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;
|
||||
}
|
||||
|
||||
public Add(ICarpenterRecipe recipe) {
|
||||
super(Carpenter.name, RecipeManagers.carpenterManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ICarpenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getCraftingGridRecipe().getRecipeOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Carpenter
|
||||
*
|
||||
* @param output = item output
|
||||
* @optionalParam liquid = liquid input
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output, @Optional IIngredient liquid) {
|
||||
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 (liquid != null) {
|
||||
if (matches(liquid, 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
|
||||
protected String getRecipeInfo(ICarpenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getCraftingGridRecipe().getRecipeOutput());
|
||||
}
|
||||
}
|
||||
private static class Add extends ForestryListAddition<ICarpenterRecipe, ICarpenterManager> {
|
||||
|
||||
public Add(ICarpenterRecipe recipe) {
|
||||
super(Carpenter.name, RecipeManagers.carpenterManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ICarpenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getCraftingGridRecipe().getRecipeOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Carpenter
|
||||
*
|
||||
* @param output = item output
|
||||
* @optionalParam liquid = liquid input
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output, @Optional IIngredient liquid) {
|
||||
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 (liquid != null) {
|
||||
if (matches(liquid, 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
|
||||
protected String getRecipeInfo(ICarpenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getCraftingGridRecipe().getRecipeOutput());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,95 +17,97 @@ import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.mods.forestry.ForestryListAddition;
|
||||
import modtweaker2.mods.forestry.ForestryListRemoval;
|
||||
import modtweaker2.mods.forestry.recipes.CentrifugeRecipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import forestry.api.recipes.ICentrifugeManager;
|
||||
import forestry.api.recipes.ICentrifugeRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
|
||||
|
||||
@ZenClass("mods.forestry.Centrifuge")
|
||||
public class Centrifuge {
|
||||
|
||||
public static final String name = "Forestry Centrifuge";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a recipe for the Centrifuge
|
||||
*
|
||||
* @param output List of items to produce with associated chance
|
||||
* @param ingredient item input
|
||||
* @param timePerItem time per item to process
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(WeightedItemStack[] output, IItemStack ingredient, int timePerItem) {
|
||||
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(timePerItem, toStack(ingredient), products)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@Deprecated
|
||||
public static void addRecipe(int timePerItem, IItemStack itemInput, IItemStack[] output, int[] chances) {
|
||||
Map<ItemStack, Float> products = new HashMap<ItemStack, Float>();
|
||||
int i = 0;
|
||||
for (IItemStack product : output) {
|
||||
products.put(toStack(product), ((float) chances[i] / 100));
|
||||
i++;
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(new CentrifugeRecipe(timePerItem, toStack(itemInput), products)));
|
||||
}
|
||||
|
||||
private static class Add extends ForestryListAddition<ICentrifugeRecipe, ICentrifugeManager> {
|
||||
public Add(ICentrifugeRecipe recipe) {
|
||||
super(Centrifuge.name, RecipeManagers.centrifugeManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ICentrifugeRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getInput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Centrifuge
|
||||
*
|
||||
* @param input item 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());
|
||||
}
|
||||
}
|
||||
|
||||
public static final String name = "Forestry Centrifuge";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a recipe for the Centrifuge
|
||||
*
|
||||
* @param output List of items to produce with associated chance
|
||||
* @param ingredient item input
|
||||
* @param timePerItem time per item to process
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(WeightedItemStack[] output, IItemStack ingredient, int timePerItem) {
|
||||
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(timePerItem, toStack(ingredient), products)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@Deprecated
|
||||
public static void addRecipe(int timePerItem, IItemStack itemInput, IItemStack[] output, int[] chances) {
|
||||
Map<ItemStack, Float> products = new HashMap<ItemStack, Float>();
|
||||
int i = 0;
|
||||
for (IItemStack product : output) {
|
||||
products.put(toStack(product), ((float) chances[i] / 100));
|
||||
i++;
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(new CentrifugeRecipe(timePerItem, toStack(itemInput), products)));
|
||||
}
|
||||
|
||||
private static class Add extends ForestryListAddition<ICentrifugeRecipe, ICentrifugeManager> {
|
||||
|
||||
public Add(ICentrifugeRecipe recipe) {
|
||||
super(Centrifuge.name, RecipeManagers.centrifugeManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ICentrifugeRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getInput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Centrifuge
|
||||
*
|
||||
* @param input item 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import modtweaker2.mods.forestry.ForestryListRemoval;
|
||||
import modtweaker2.mods.forestry.recipes.FermenterRecipe;
|
||||
import modtweaker2.utils.BaseMapAddition;
|
||||
import modtweaker2.utils.BaseMapRemoval;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
@@ -36,141 +37,164 @@ import forestry.api.recipes.RecipeManagers;
|
||||
@ZenClass("mods.forestry.Fermenter")
|
||||
public class Fermenter {
|
||||
|
||||
public static final String name = "Forestry Fermenter";
|
||||
public static final String nameFuel = name + " (Fuel)";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a fermenter recipe. Amount of fluid output is calculated: 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))));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack resource, ILiquidStack fluidInput, int fermentationValue, float fluidOutputModifier, ILiquidStack fluidOutput) {
|
||||
MineTweakerAPI.apply(new Add(new FermenterRecipe(toStack(resource), fermentationValue, fluidOutputModifier, getFluid(fluidOutput), toFluid(fluidInput))));
|
||||
}
|
||||
public static final String name = "Forestry Fermenter";
|
||||
public static final String nameFuel = name + " (Fuel)";
|
||||
|
||||
private static class Add extends ForestryListAddition<IFermenterRecipe, IFermenterManager> {
|
||||
public Add(IFermenterRecipe recipe) {
|
||||
super(Fermenter.name, RecipeManagers.fermenterManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFermenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Adds a fermenter recipe. Amount of fluid output is calculated: 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))));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@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()));
|
||||
}
|
||||
}
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack resource, ILiquidStack fluidInput, int fermentationValue,
|
||||
float fluidOutputModifier, ILiquidStack fluidOutput) {
|
||||
MineTweakerAPI.apply(
|
||||
new Add(
|
||||
new FermenterRecipe(
|
||||
toStack(resource),
|
||||
fermentationValue,
|
||||
fluidOutputModifier,
|
||||
getFluid(fluidOutput),
|
||||
toFluid(fluidInput))));
|
||||
}
|
||||
|
||||
private static class Remove extends ForestryListRemoval<IFermenterRecipe, IFermenterManager> {
|
||||
private static class Add extends ForestryListAddition<IFermenterRecipe, IFermenterManager> {
|
||||
|
||||
public Remove(List<IFermenterRecipe> recipes) {
|
||||
super(Fermenter.name, RecipeManagers.fermenterManager, recipes);
|
||||
}
|
||||
public Add(IFermenterRecipe recipe) {
|
||||
super(Fermenter.name, RecipeManagers.fermenterManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(IFermenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 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.item, fuelEntry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<ItemStack, FermenterFuel> fuelEntry) {
|
||||
return LogHelper.getStackDescription(fuelEntry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a 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().item))) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo(IFermenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@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());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 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.item, fuelEntry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<ItemStack, FermenterFuel> fuelEntry) {
|
||||
return LogHelper.getStackDescription(fuelEntry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a 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().item))) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
@@ -20,6 +19,9 @@ import modtweaker2.mods.forestry.ForestryListRemoval;
|
||||
import modtweaker2.mods.forestry.recipes.MoistenerRecipe;
|
||||
import modtweaker2.utils.BaseMapAddition;
|
||||
import modtweaker2.utils.BaseMapRemoval;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
@@ -31,133 +33,148 @@ import forestry.api.recipes.RecipeManagers;
|
||||
@ZenClass("mods.forestry.Moistener")
|
||||
public class Moistener {
|
||||
|
||||
public static final String name = "Forestry Moistener";
|
||||
public static final String nameFuel = name + " (Fuel)";
|
||||
public static final String name = "Forestry Moistener";
|
||||
public static final String nameFuel = name + " (Fuel)";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a recipe for the Moistener
|
||||
*
|
||||
* @param output recipe output
|
||||
* @param resource organic item
|
||||
* @param timePerItem time per item to process
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack resource, int timePerItem) {
|
||||
MineTweakerAPI.apply(new Add(new MoistenerRecipe(toStack(resource), toStack(output), timePerItem)));
|
||||
}
|
||||
/**
|
||||
* Adds a recipe for the Moistener
|
||||
*
|
||||
* @param output recipe output
|
||||
* @param resource organic item
|
||||
* @param timePerItem time per item to process
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack resource, int timePerItem) {
|
||||
MineTweakerAPI.apply(new Add(new MoistenerRecipe(toStack(resource), toStack(output), timePerItem)));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(int timePerItem, IItemStack resource, IItemStack product) {
|
||||
MineTweakerAPI.apply(new Add(new MoistenerRecipe(toStack(resource), toStack(product), timePerItem)));
|
||||
}
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(int timePerItem, IItemStack resource, IItemStack product) {
|
||||
MineTweakerAPI.apply(new Add(new MoistenerRecipe(toStack(resource), toStack(product), timePerItem)));
|
||||
}
|
||||
|
||||
private static class Add extends ForestryListAddition<IMoistenerRecipe, IMoistenerManager> {
|
||||
public Add(IMoistenerRecipe recipe) {
|
||||
super(Moistener.name, RecipeManagers.moistenerManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
private static class Add extends ForestryListAddition<IMoistenerRecipe, IMoistenerManager> {
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IMoistenerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getProduct());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
public Add(IMoistenerRecipe recipe) {
|
||||
super(Moistener.name, RecipeManagers.moistenerManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo(IMoistenerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getProduct());
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IMoistenerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getProduct());
|
||||
}
|
||||
}
|
||||
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> {
|
||||
|
||||
/**
|
||||
* 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()));
|
||||
}
|
||||
}
|
||||
public Remove(List<IMoistenerRecipe> recipes) {
|
||||
super(Moistener.name, RecipeManagers.moistenerManager, recipes);
|
||||
}
|
||||
|
||||
private static class AddFuel extends BaseMapAddition<ItemStack, MoistenerFuel> {
|
||||
public AddFuel(MoistenerFuel fuelEntry) {
|
||||
super(Moistener.nameFuel, FuelManager.moistenerResource);
|
||||
recipes.put(fuelEntry.item, fuelEntry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<ItemStack, MoistenerFuel> fuelEntry) {
|
||||
return LogHelper.getStackDescription(fuelEntry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a 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().item))) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo(IMoistenerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getProduct());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 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.item, fuelEntry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<ItemStack, MoistenerFuel> fuelEntry) {
|
||||
return LogHelper.getStackDescription(fuelEntry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a 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().item))) {
|
||||
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,8 +1,8 @@
|
||||
package modtweaker2.mods.forestry.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toFluid;
|
||||
import static modtweaker2.helpers.InputHelper.toILiquidStack;
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.InputHelper.toILiquidStack;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.InputHelper.toStacks;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
@@ -10,10 +10,6 @@ import static modtweaker2.helpers.StackHelper.matches;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.recipes.ISqueezerManager;
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
@@ -26,107 +22,131 @@ import modtweaker2.mods.forestry.recipes.SqueezerRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.api.recipes.ISqueezerManager;
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
|
||||
@ZenClass("mods.forestry.Squeezer")
|
||||
public class Squeezer {
|
||||
|
||||
public static final String name = "Forestry Squeezer";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a recipe without additional item output
|
||||
*
|
||||
* @param fluidOutput recipe fluid amount
|
||||
* @param ingredients recipe ingredients
|
||||
* @param timePerItem time per crafting operation
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluidOutput, int timePerItem, IItemStack[] ingredients) {
|
||||
MineTweakerAPI.apply(new Add(new SqueezerRecipe(timePerItem, toStacks(ingredients), toFluid(fluidOutput), null, 0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a recipe with additional item output
|
||||
*
|
||||
* @param fluidOutput recipe fluid amount
|
||||
* @param itemOutput recipe output
|
||||
* @param ingredients recipe ingredients
|
||||
* @param timePerItem time per crafting operation
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluidOutput, WeightedItemStack itemOutput, IItemStack[] ingredients, int timePerItem) {
|
||||
MineTweakerAPI.apply(new Add(new SqueezerRecipe(timePerItem, toStacks(ingredients), toFluid(fluidOutput), toStack(itemOutput.getStack()), itemOutput.getChance())));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@Deprecated
|
||||
public static void addRecipe(int timePerItem, IItemStack[] resources, ILiquidStack liquid, IItemStack remnants, int chance) {
|
||||
MineTweakerAPI.apply(new Add(new SqueezerRecipe(timePerItem, toStacks(resources), toFluid(liquid), toStack(remnants), chance)));
|
||||
}
|
||||
|
||||
private static class Add extends ForestryListAddition<ISqueezerRecipe, ISqueezerManager> {
|
||||
public Add(ISqueezerRecipe recipe) {
|
||||
super(Squeezer.name, RecipeManagers.squeezerManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(ISqueezerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getFluidOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Centrifuge
|
||||
*
|
||||
* @param liquid liquid output
|
||||
* @param ingredients list of ingredients
|
||||
*/
|
||||
@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)));
|
||||
}
|
||||
}
|
||||
public static final String name = "Forestry Squeezer";
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a recipe without additional item output
|
||||
*
|
||||
* @param fluidOutput recipe fluid amount
|
||||
* @param ingredients recipe ingredients
|
||||
* @param timePerItem time per crafting operation
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluidOutput, int timePerItem, IItemStack[] ingredients) {
|
||||
MineTweakerAPI
|
||||
.apply(new Add(new SqueezerRecipe(timePerItem, toStacks(ingredients), toFluid(fluidOutput), null, 0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a recipe with additional item output
|
||||
*
|
||||
* @param fluidOutput recipe fluid amount
|
||||
* @param itemOutput recipe output
|
||||
* @param ingredients recipe ingredients
|
||||
* @param timePerItem time per crafting operation
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluidOutput, WeightedItemStack itemOutput, IItemStack[] ingredients,
|
||||
int timePerItem) {
|
||||
MineTweakerAPI.apply(
|
||||
new Add(
|
||||
new SqueezerRecipe(
|
||||
timePerItem,
|
||||
toStacks(ingredients),
|
||||
toFluid(fluidOutput),
|
||||
toStack(itemOutput.getStack()),
|
||||
itemOutput.getChance())));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@Deprecated
|
||||
public static void addRecipe(int timePerItem, IItemStack[] resources, ILiquidStack liquid, IItemStack remnants,
|
||||
int chance) {
|
||||
MineTweakerAPI.apply(
|
||||
new Add(
|
||||
new SqueezerRecipe(
|
||||
timePerItem,
|
||||
toStacks(resources),
|
||||
toFluid(liquid),
|
||||
toStack(remnants),
|
||||
chance)));
|
||||
}
|
||||
|
||||
private static class Add extends ForestryListAddition<ISqueezerRecipe, ISqueezerManager> {
|
||||
|
||||
public Add(ISqueezerRecipe recipe) {
|
||||
super(Squeezer.name, RecipeManagers.squeezerManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(ISqueezerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getFluidOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Centrifuge
|
||||
*
|
||||
* @param liquid liquid output
|
||||
* @param ingredients list of ingredients
|
||||
*/
|
||||
@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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,93 +17,96 @@ import modtweaker2.mods.forestry.recipes.StillRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import forestry.api.recipes.IStillManager;
|
||||
import forestry.api.recipes.IStillRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
|
||||
@ZenClass("mods.forestry.Still")
|
||||
public class Still {
|
||||
|
||||
public static final String name = "Forestry Still";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a recipe for the Still
|
||||
*
|
||||
* @param fluidOutput recipe fluid amount
|
||||
* @param fluidInput recipe fluid input
|
||||
* @param timePerUnit time per crafting operation
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluidOutput, ILiquidStack fluidInput, int timePerUnit) {
|
||||
fluidOutput.amount(fluidOutput.getAmount() / 100);
|
||||
fluidInput.amount(fluidInput.getAmount() / 100);
|
||||
|
||||
MineTweakerAPI.apply(new Add(new StillRecipe(timePerUnit, toFluid(fluidInput), toFluid(fluidOutput))));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(int timePerUnit, ILiquidStack input, ILiquidStack output) {
|
||||
output.amount(output.getAmount() / 100);
|
||||
input.amount(input.getAmount() / 100);
|
||||
|
||||
MineTweakerAPI.apply(new Add(new StillRecipe(timePerUnit, toFluid(input), toFluid(output))));
|
||||
}
|
||||
|
||||
private static class Add extends ForestryListAddition<IStillRecipe, IStillManager> {
|
||||
public Add(IStillRecipe recipe) {
|
||||
super("Forestry Still", RecipeManagers.stillManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IStillRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Still
|
||||
*
|
||||
* @param output = liquid output
|
||||
* @optionalParam liquid = liquid input
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output, @Optional ILiquidStack input) {
|
||||
List<IStillRecipe> recipes = new LinkedList<IStillRecipe>();
|
||||
|
||||
for (IStillRecipe r : RecipeManagers.stillManager.recipes()) {
|
||||
if (r != null && r.getOutput() != null && matches(output, toILiquidStack(r.getOutput()))) {
|
||||
if (input != null) {
|
||||
if (matches(input, toILiquidStack(r.getInput()))) {
|
||||
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!", Still.name, LogHelper.getStackDescription(output)));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends ForestryListRemoval<IStillRecipe, IStillManager> {
|
||||
public Remove(List<IStillRecipe> recipes) {
|
||||
super(Still.name, RecipeManagers.stillManager, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IStillRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
|
||||
public static final String name = "Forestry Still";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a recipe for the Still
|
||||
*
|
||||
* @param fluidOutput recipe fluid amount
|
||||
* @param fluidInput recipe fluid input
|
||||
* @param timePerUnit time per crafting operation
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluidOutput, ILiquidStack fluidInput, int timePerUnit) {
|
||||
fluidOutput.amount(fluidOutput.getAmount() / 100);
|
||||
fluidInput.amount(fluidInput.getAmount() / 100);
|
||||
|
||||
MineTweakerAPI.apply(new Add(new StillRecipe(timePerUnit, toFluid(fluidInput), toFluid(fluidOutput))));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(int timePerUnit, ILiquidStack input, ILiquidStack output) {
|
||||
output.amount(output.getAmount() / 100);
|
||||
input.amount(input.getAmount() / 100);
|
||||
|
||||
MineTweakerAPI.apply(new Add(new StillRecipe(timePerUnit, toFluid(input), toFluid(output))));
|
||||
}
|
||||
|
||||
private static class Add extends ForestryListAddition<IStillRecipe, IStillManager> {
|
||||
|
||||
public Add(IStillRecipe recipe) {
|
||||
super("Forestry Still", RecipeManagers.stillManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IStillRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Still
|
||||
*
|
||||
* @param output = liquid output
|
||||
* @optionalParam liquid = liquid input
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output, @Optional ILiquidStack input) {
|
||||
List<IStillRecipe> recipes = new LinkedList<IStillRecipe>();
|
||||
|
||||
for (IStillRecipe r : RecipeManagers.stillManager.recipes()) {
|
||||
if (r != null && r.getOutput() != null && matches(output, toILiquidStack(r.getOutput()))) {
|
||||
if (input != null) {
|
||||
if (matches(input, toILiquidStack(r.getInput()))) {
|
||||
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!",
|
||||
Still.name,
|
||||
LogHelper.getStackDescription(output)));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends ForestryListRemoval<IStillRecipe, IStillManager> {
|
||||
|
||||
public Remove(List<IStillRecipe> recipes) {
|
||||
super(Still.name, RecipeManagers.stillManager, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IStillRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,176 +13,207 @@ import minetweaker.api.liquid.ILiquidStack;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.mods.forestry.ForestryListAddition;
|
||||
import modtweaker2.mods.forestry.ForestryListRemoval;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import modtweaker2.mods.forestry.recipes.DescriptiveRecipe;
|
||||
import modtweaker2.mods.forestry.recipes.FabricatorRecipe;
|
||||
import modtweaker2.mods.forestry.recipes.FabricatorSmeltingRecipe;
|
||||
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import forestry.api.recipes.IDescriptiveRecipe;
|
||||
import forestry.api.recipes.IFabricatorManager;
|
||||
import forestry.api.recipes.IFabricatorRecipe;
|
||||
import forestry.api.recipes.IFabricatorSmeltingManager;
|
||||
import forestry.api.recipes.IFabricatorSmeltingRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.recipes.IFabricatorRecipe;
|
||||
|
||||
@ZenClass("mods.forestry.ThermionicFabricator")
|
||||
public class ThermionicFabricator {
|
||||
|
||||
public static final String nameSmelting = "Forestry Thermionic Fabricator (Smelting)";
|
||||
public static final String nameCasting = "Forestry Thermionic Fabricator (Casting)";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a smelting recipe for the Thermionic Fabricator
|
||||
*
|
||||
* @param fluidOutput recipe fluid amount
|
||||
* @param itemInput recipe input input
|
||||
* @param meltingPoint point at where itemInput melts down
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addSmelting(int fluidOutput, IItemStack itemInput, int meltingPoint) {
|
||||
//The machines internal tank accept only liquid glass, therefor this function only accept the amount and hardcode the fluid to glass
|
||||
MineTweakerAPI.apply(new AddSmelting(new FabricatorSmeltingRecipe(toStack(itemInput), FluidRegistry.getFluidStack("glass", fluidOutput), meltingPoint)));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addSmelting(IItemStack itemInput, int meltingPoint, int fluidOutput) {
|
||||
//The machines internal tank accept only liquid glass, therefor this function only accept the amount and hardcode the fluid to glass
|
||||
MineTweakerAPI.apply(new AddSmelting(new FabricatorSmeltingRecipe(toStack(itemInput), FluidRegistry.getFluidStack("glass", fluidOutput), meltingPoint)));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a casting recipe for the Thermionic Fabricator
|
||||
*
|
||||
* @param output recipe output item
|
||||
* @param ingredients list of input items
|
||||
* @param fluidInput recipe fluid input
|
||||
* @param plan recipe plan item
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addCast(IItemStack output, IIngredient[][] ingredients, int fluidInput, @Optional IItemStack plan) {
|
||||
IDescriptiveRecipe recipe = new DescriptiveRecipe(3, 3, toShapedObjects(ingredients), toStack(output), false);
|
||||
MineTweakerAPI.apply(new AddCast(new FabricatorRecipe(toStack(plan), FluidRegistry.getFluidStack("glass", fluidInput), recipe)));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addCast(ILiquidStack fluidInput, IIngredient[][] ingredients, IItemStack plan, IItemStack output) {
|
||||
IDescriptiveRecipe recipe = new DescriptiveRecipe(3, 3, toShapedObjects(ingredients), toStack(output), false);
|
||||
MineTweakerAPI.apply(new AddCast(new FabricatorRecipe(toStack(plan), toFluid(fluidInput), recipe)));
|
||||
}
|
||||
|
||||
/*
|
||||
Implements the actions to add a recipe
|
||||
Since the machine has two crafting Steps, this is a constructors for both
|
||||
*/
|
||||
private static class AddSmelting extends ForestryListAddition<IFabricatorSmeltingRecipe, IFabricatorSmeltingManager> {
|
||||
|
||||
public AddSmelting(IFabricatorSmeltingRecipe recipe) {
|
||||
super(ThermionicFabricator.nameSmelting, RecipeManagers.fabricatorSmeltingManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFabricatorSmeltingRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getResource());
|
||||
}
|
||||
}
|
||||
|
||||
private static class AddCast extends ForestryListAddition<IFabricatorRecipe, IFabricatorManager> {
|
||||
|
||||
public AddCast(IFabricatorRecipe recipe) {
|
||||
super(ThermionicFabricator.nameCasting, RecipeManagers.fabricatorManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFabricatorRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeSmelting(IIngredient itemInput) {
|
||||
List<IFabricatorSmeltingRecipe> recipes = new LinkedList<IFabricatorSmeltingRecipe>();
|
||||
|
||||
for (IFabricatorSmeltingRecipe r : RecipeManagers.fabricatorSmeltingManager.recipes()) {
|
||||
if (r != null && r.getResource() != null && matches(itemInput, toIItemStack(r.getResource()))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveSmelting(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ThermionicFabricator.nameSmelting, itemInput.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeCast(IIngredient product) {
|
||||
List<IFabricatorRecipe> recipes = new LinkedList<IFabricatorRecipe>();
|
||||
|
||||
for (IFabricatorRecipe r : RecipeManagers.fabricatorManager.recipes()) {
|
||||
if (r != null && r.getRecipeOutput() != null && matches(product, toIItemStack(r.getRecipeOutput()))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveCasts(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ThermionicFabricator.nameSmelting, product.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void removeCasts(IIngredient product) {
|
||||
List<IFabricatorRecipe> recipes = new LinkedList<IFabricatorRecipe>();
|
||||
|
||||
for (IFabricatorRecipe r : RecipeManagers.fabricatorManager.recipes()) {
|
||||
if (r != null && r.getRecipeOutput() != null && matches(product, toIItemStack(r.getRecipeOutput()))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveCasts(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ThermionicFabricator.nameSmelting, product.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveSmelting extends ForestryListRemoval<IFabricatorSmeltingRecipe, IFabricatorSmeltingManager> {
|
||||
public RemoveSmelting(List<IFabricatorSmeltingRecipe> recipes) {
|
||||
super(ThermionicFabricator.nameSmelting, RecipeManagers.fabricatorSmeltingManager, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFabricatorSmeltingRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getResource());
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveCasts extends ForestryListRemoval<IFabricatorRecipe, IFabricatorManager> {
|
||||
public RemoveCasts(List<IFabricatorRecipe> recipes) {
|
||||
super(ThermionicFabricator.nameCasting, RecipeManagers.fabricatorManager, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFabricatorRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
|
||||
public static final String nameSmelting = "Forestry Thermionic Fabricator (Smelting)";
|
||||
public static final String nameCasting = "Forestry Thermionic Fabricator (Casting)";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a smelting recipe for the Thermionic Fabricator
|
||||
*
|
||||
* @param fluidOutput recipe fluid amount
|
||||
* @param itemInput recipe input input
|
||||
* @param meltingPoint point at where itemInput melts down
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addSmelting(int fluidOutput, IItemStack itemInput, int meltingPoint) {
|
||||
// The machines internal tank accept only liquid glass, therefor this function only accept the amount and
|
||||
// hardcode the fluid to glass
|
||||
MineTweakerAPI.apply(
|
||||
new AddSmelting(
|
||||
new FabricatorSmeltingRecipe(
|
||||
toStack(itemInput),
|
||||
FluidRegistry.getFluidStack("glass", fluidOutput),
|
||||
meltingPoint)));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addSmelting(IItemStack itemInput, int meltingPoint, int fluidOutput) {
|
||||
// The machines internal tank accept only liquid glass, therefor this function only accept the amount and
|
||||
// hardcode the fluid to glass
|
||||
MineTweakerAPI.apply(
|
||||
new AddSmelting(
|
||||
new FabricatorSmeltingRecipe(
|
||||
toStack(itemInput),
|
||||
FluidRegistry.getFluidStack("glass", fluidOutput),
|
||||
meltingPoint)));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a casting recipe for the Thermionic Fabricator
|
||||
*
|
||||
* @param output recipe output item
|
||||
* @param ingredients list of input items
|
||||
* @param fluidInput recipe fluid input
|
||||
* @param plan recipe plan item
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addCast(IItemStack output, IIngredient[][] ingredients, int fluidInput,
|
||||
@Optional IItemStack plan) {
|
||||
IDescriptiveRecipe recipe = new DescriptiveRecipe(3, 3, toShapedObjects(ingredients), toStack(output), false);
|
||||
MineTweakerAPI.apply(
|
||||
new AddCast(
|
||||
new FabricatorRecipe(toStack(plan), FluidRegistry.getFluidStack("glass", fluidInput), recipe)));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addCast(ILiquidStack fluidInput, IIngredient[][] ingredients, IItemStack plan,
|
||||
IItemStack output) {
|
||||
IDescriptiveRecipe recipe = new DescriptiveRecipe(3, 3, toShapedObjects(ingredients), toStack(output), false);
|
||||
MineTweakerAPI.apply(new AddCast(new FabricatorRecipe(toStack(plan), toFluid(fluidInput), recipe)));
|
||||
}
|
||||
|
||||
/*
|
||||
* Implements the actions to add a recipe Since the machine has two crafting Steps, this is a constructors for both
|
||||
*/
|
||||
private static class AddSmelting
|
||||
extends ForestryListAddition<IFabricatorSmeltingRecipe, IFabricatorSmeltingManager> {
|
||||
|
||||
public AddSmelting(IFabricatorSmeltingRecipe recipe) {
|
||||
super(ThermionicFabricator.nameSmelting, RecipeManagers.fabricatorSmeltingManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFabricatorSmeltingRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getResource());
|
||||
}
|
||||
}
|
||||
|
||||
private static class AddCast extends ForestryListAddition<IFabricatorRecipe, IFabricatorManager> {
|
||||
|
||||
public AddCast(IFabricatorRecipe recipe) {
|
||||
super(ThermionicFabricator.nameCasting, RecipeManagers.fabricatorManager);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFabricatorRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeSmelting(IIngredient itemInput) {
|
||||
List<IFabricatorSmeltingRecipe> recipes = new LinkedList<IFabricatorSmeltingRecipe>();
|
||||
|
||||
for (IFabricatorSmeltingRecipe r : RecipeManagers.fabricatorSmeltingManager.recipes()) {
|
||||
if (r != null && r.getResource() != null && matches(itemInput, toIItemStack(r.getResource()))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveSmelting(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"No %s Recipe found for %s. Command ignored!",
|
||||
ThermionicFabricator.nameSmelting,
|
||||
itemInput.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeCast(IIngredient product) {
|
||||
List<IFabricatorRecipe> recipes = new LinkedList<IFabricatorRecipe>();
|
||||
|
||||
for (IFabricatorRecipe r : RecipeManagers.fabricatorManager.recipes()) {
|
||||
if (r != null && r.getRecipeOutput() != null && matches(product, toIItemStack(r.getRecipeOutput()))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveCasts(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"No %s Recipe found for %s. Command ignored!",
|
||||
ThermionicFabricator.nameSmelting,
|
||||
product.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void removeCasts(IIngredient product) {
|
||||
List<IFabricatorRecipe> recipes = new LinkedList<IFabricatorRecipe>();
|
||||
|
||||
for (IFabricatorRecipe r : RecipeManagers.fabricatorManager.recipes()) {
|
||||
if (r != null && r.getRecipeOutput() != null && matches(product, toIItemStack(r.getRecipeOutput()))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveCasts(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(
|
||||
String.format(
|
||||
"No %s Recipe found for %s. Command ignored!",
|
||||
ThermionicFabricator.nameSmelting,
|
||||
product.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveSmelting
|
||||
extends ForestryListRemoval<IFabricatorSmeltingRecipe, IFabricatorSmeltingManager> {
|
||||
|
||||
public RemoveSmelting(List<IFabricatorSmeltingRecipe> recipes) {
|
||||
super(ThermionicFabricator.nameSmelting, RecipeManagers.fabricatorSmeltingManager, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFabricatorSmeltingRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getResource());
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveCasts extends ForestryListRemoval<IFabricatorRecipe, IFabricatorManager> {
|
||||
|
||||
public RemoveCasts(List<IFabricatorRecipe> recipes) {
|
||||
super(ThermionicFabricator.nameCasting, RecipeManagers.fabricatorManager, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFabricatorRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +1,48 @@
|
||||
package modtweaker2.mods.forestry.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.ICarpenterRecipe;
|
||||
import forestry.api.recipes.IDescriptiveRecipe;
|
||||
|
||||
public class CarpenterRecipe implements ICarpenterRecipe {
|
||||
|
||||
private final int packagingTime;
|
||||
@Nullable
|
||||
private final FluidStack liquid;
|
||||
@Nullable
|
||||
private final ItemStack box;
|
||||
private final IDescriptiveRecipe internal;
|
||||
|
||||
public CarpenterRecipe(int packagingTime, @Nullable FluidStack liquid, @Nullable ItemStack box, IDescriptiveRecipe internal) {
|
||||
this.packagingTime = packagingTime;
|
||||
this.liquid = liquid;
|
||||
this.box = box;
|
||||
this.internal = internal;
|
||||
}
|
||||
|
||||
public int getPackagingTime() {
|
||||
return packagingTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack getBox() {
|
||||
return box;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public FluidStack getFluidResource() {
|
||||
return liquid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDescriptiveRecipe getCraftingGridRecipe() {
|
||||
return internal;
|
||||
}
|
||||
}
|
||||
package modtweaker2.mods.forestry.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.ICarpenterRecipe;
|
||||
import forestry.api.recipes.IDescriptiveRecipe;
|
||||
|
||||
public class CarpenterRecipe implements ICarpenterRecipe {
|
||||
|
||||
private final int packagingTime;
|
||||
@Nullable
|
||||
private final FluidStack liquid;
|
||||
@Nullable
|
||||
private final ItemStack box;
|
||||
private final IDescriptiveRecipe internal;
|
||||
|
||||
public CarpenterRecipe(int packagingTime, @Nullable FluidStack liquid, @Nullable ItemStack box,
|
||||
IDescriptiveRecipe internal) {
|
||||
this.packagingTime = packagingTime;
|
||||
this.liquid = liquid;
|
||||
this.box = box;
|
||||
this.internal = internal;
|
||||
}
|
||||
|
||||
public int getPackagingTime() {
|
||||
return packagingTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack getBox() {
|
||||
return box;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public FluidStack getFluidResource() {
|
||||
return liquid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDescriptiveRecipe getCraftingGridRecipe() {
|
||||
return internal;
|
||||
}
|
||||
}
|
||||
@@ -1,64 +1,63 @@
|
||||
package modtweaker2.mods.forestry.recipes;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.recipes.ICentrifugeRecipe;
|
||||
|
||||
public class CentrifugeRecipe implements ICentrifugeRecipe {
|
||||
|
||||
private final int processingTime;
|
||||
private final ItemStack input;
|
||||
private final Map<ItemStack, Float> outputs;
|
||||
|
||||
public CentrifugeRecipe(int processingTime, ItemStack input, Map<ItemStack, Float> outputs) {
|
||||
this.processingTime = processingTime;
|
||||
this.input = input;
|
||||
this.outputs = outputs;
|
||||
|
||||
for (ItemStack item : outputs.keySet()) {
|
||||
if (item == null) {
|
||||
throw new IllegalArgumentException("Tried to register a null product of " + input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessingTime() {
|
||||
return processingTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getProducts(Random random) {
|
||||
List<ItemStack> products = new ArrayList<ItemStack>();
|
||||
|
||||
for (Map.Entry<ItemStack, Float> entry : this.outputs.entrySet()) {
|
||||
float probability = entry.getValue();
|
||||
|
||||
if (probability >= 1.0) {
|
||||
products.add(entry.getKey().copy());
|
||||
} else if (random.nextFloat() < probability) {
|
||||
products.add(entry.getKey().copy());
|
||||
}
|
||||
}
|
||||
|
||||
return products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ItemStack, Float> getAllProducts() {
|
||||
return ImmutableMap.copyOf(outputs);
|
||||
}
|
||||
}
|
||||
package modtweaker2.mods.forestry.recipes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import forestry.api.recipes.ICentrifugeRecipe;
|
||||
|
||||
public class CentrifugeRecipe implements ICentrifugeRecipe {
|
||||
|
||||
private final int processingTime;
|
||||
private final ItemStack input;
|
||||
private final Map<ItemStack, Float> outputs;
|
||||
|
||||
public CentrifugeRecipe(int processingTime, ItemStack input, Map<ItemStack, Float> outputs) {
|
||||
this.processingTime = processingTime;
|
||||
this.input = input;
|
||||
this.outputs = outputs;
|
||||
|
||||
for (ItemStack item : outputs.keySet()) {
|
||||
if (item == null) {
|
||||
throw new IllegalArgumentException("Tried to register a null product of " + input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessingTime() {
|
||||
return processingTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getProducts(Random random) {
|
||||
List<ItemStack> products = new ArrayList<ItemStack>();
|
||||
|
||||
for (Map.Entry<ItemStack, Float> entry : this.outputs.entrySet()) {
|
||||
float probability = entry.getValue();
|
||||
|
||||
if (probability >= 1.0) {
|
||||
products.add(entry.getKey().copy());
|
||||
} else if (random.nextFloat() < probability) {
|
||||
products.add(entry.getKey().copy());
|
||||
}
|
||||
}
|
||||
|
||||
return products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ItemStack, Float> getAllProducts() {
|
||||
return ImmutableMap.copyOf(outputs);
|
||||
}
|
||||
}
|
||||
@@ -4,68 +4,67 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
import forestry.api.recipes.IDescriptiveRecipe;
|
||||
|
||||
public class DescriptiveRecipe implements IDescriptiveRecipe {
|
||||
|
||||
private final int width;
|
||||
private final int height;
|
||||
private final ShapedOreRecipe recipe;
|
||||
private final boolean preserveNBT;
|
||||
private final int width;
|
||||
private final int height;
|
||||
private final ShapedOreRecipe recipe;
|
||||
private final boolean preserveNBT;
|
||||
|
||||
public DescriptiveRecipe(int width, int height, Object[] ingredients, ItemStack output, boolean preserveNBT) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.recipe = new ShapedOreRecipe(output, ingredients);
|
||||
this.preserveNBT = preserveNBT;
|
||||
}
|
||||
public DescriptiveRecipe(int width, int height, Object[] ingredients, ItemStack output, boolean preserveNBT) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.recipe = new ShapedOreRecipe(output, ingredients);
|
||||
this.preserveNBT = preserveNBT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return recipe.getRecipeOutput();
|
||||
}
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return recipe.getRecipeOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getIngredients() {
|
||||
return recipe.getInput();
|
||||
}
|
||||
@Override
|
||||
public Object[] getIngredients() {
|
||||
return recipe.getInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preserveNBT() {
|
||||
return preserveNBT;
|
||||
}
|
||||
@Override
|
||||
public boolean preserveNBT() {
|
||||
return preserveNBT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inventoryCrafting, World world) {
|
||||
return recipe.matches(inventoryCrafting, world);
|
||||
}
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inventoryCrafting, World world) {
|
||||
return recipe.matches(inventoryCrafting, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean matches(IInventory inventoryCrafting, World world) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean matches(IInventory inventoryCrafting, World world) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) {
|
||||
return recipe.getCraftingResult(inventoryCrafting);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) {
|
||||
return recipe.getCraftingResult(inventoryCrafting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return width * height;
|
||||
}
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return width * height;
|
||||
}
|
||||
}
|
||||
@@ -1,77 +1,77 @@
|
||||
package modtweaker2.mods.forestry.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.IDescriptiveRecipe;
|
||||
import forestry.api.recipes.IFabricatorRecipe;
|
||||
|
||||
public class FabricatorRecipe implements IFabricatorRecipe {
|
||||
|
||||
private final ItemStack plan;
|
||||
private final FluidStack molten;
|
||||
private final IDescriptiveRecipe internal;
|
||||
|
||||
public FabricatorRecipe(ItemStack plan, FluidStack molten, ItemStack result, boolean preservesNbt, Object[] ingredients) {
|
||||
this(plan, molten, new DescriptiveRecipe(3, 3, ingredients, result, preservesNbt));
|
||||
}
|
||||
|
||||
public FabricatorRecipe(ItemStack plan, FluidStack molten, IDescriptiveRecipe internal) {
|
||||
this.plan = plan;
|
||||
this.molten = molten;
|
||||
this.internal = internal;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean matches(@Nullable ItemStack plan, ItemStack[][] resources) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getIngredients() {
|
||||
return internal.getIngredients();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return internal.getWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return internal.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preservesNbt() {
|
||||
return internal.preserveNBT();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack getPlan() {
|
||||
return plan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getLiquid() {
|
||||
return molten;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public ItemStack getCraftingResult(IInventory craftingInventory) {
|
||||
return getRecipeOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return internal.getRecipeOutput();
|
||||
}
|
||||
|
||||
}
|
||||
package modtweaker2.mods.forestry.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.IDescriptiveRecipe;
|
||||
import forestry.api.recipes.IFabricatorRecipe;
|
||||
|
||||
public class FabricatorRecipe implements IFabricatorRecipe {
|
||||
|
||||
private final ItemStack plan;
|
||||
private final FluidStack molten;
|
||||
private final IDescriptiveRecipe internal;
|
||||
|
||||
public FabricatorRecipe(ItemStack plan, FluidStack molten, ItemStack result, boolean preservesNbt,
|
||||
Object[] ingredients) {
|
||||
this(plan, molten, new DescriptiveRecipe(3, 3, ingredients, result, preservesNbt));
|
||||
}
|
||||
|
||||
public FabricatorRecipe(ItemStack plan, FluidStack molten, IDescriptiveRecipe internal) {
|
||||
this.plan = plan;
|
||||
this.molten = molten;
|
||||
this.internal = internal;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean matches(@Nullable ItemStack plan, ItemStack[][] resources) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getIngredients() {
|
||||
return internal.getIngredients();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return internal.getWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return internal.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preservesNbt() {
|
||||
return internal.preserveNBT();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack getPlan() {
|
||||
return plan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getLiquid() {
|
||||
return molten;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public ItemStack getCraftingResult(IInventory craftingInventory) {
|
||||
return getRecipeOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return internal.getRecipeOutput();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,38 +1,38 @@
|
||||
package modtweaker2.mods.forestry.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.IFabricatorSmeltingRecipe;
|
||||
|
||||
public class FabricatorSmeltingRecipe implements IFabricatorSmeltingRecipe {
|
||||
private final ItemStack resource;
|
||||
private final FluidStack product;
|
||||
private final int meltingPoint;
|
||||
|
||||
public FabricatorSmeltingRecipe(ItemStack resource, FluidStack molten, int meltingPoint) {
|
||||
if (resource == null) {
|
||||
throw new IllegalArgumentException("Resource cannot be null");
|
||||
}
|
||||
if (molten == null) {
|
||||
throw new IllegalArgumentException("Molten cannot be null");
|
||||
}
|
||||
|
||||
this.resource = resource;
|
||||
this.product = molten;
|
||||
this.meltingPoint = meltingPoint;
|
||||
}
|
||||
|
||||
public ItemStack getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public FluidStack getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
public int getMeltingPoint() {
|
||||
return meltingPoint;
|
||||
}
|
||||
}
|
||||
package modtweaker2.mods.forestry.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.IFabricatorSmeltingRecipe;
|
||||
|
||||
public class FabricatorSmeltingRecipe implements IFabricatorSmeltingRecipe {
|
||||
|
||||
private final ItemStack resource;
|
||||
private final FluidStack product;
|
||||
private final int meltingPoint;
|
||||
|
||||
public FabricatorSmeltingRecipe(ItemStack resource, FluidStack molten, int meltingPoint) {
|
||||
if (resource == null) {
|
||||
throw new IllegalArgumentException("Resource cannot be null");
|
||||
}
|
||||
if (molten == null) {
|
||||
throw new IllegalArgumentException("Molten cannot be null");
|
||||
}
|
||||
|
||||
this.resource = resource;
|
||||
this.product = molten;
|
||||
this.meltingPoint = meltingPoint;
|
||||
}
|
||||
|
||||
public ItemStack getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public FluidStack getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
public int getMeltingPoint() {
|
||||
return meltingPoint;
|
||||
}
|
||||
}
|
||||
@@ -1,68 +1,68 @@
|
||||
package modtweaker2.mods.forestry.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.IFermenterRecipe;
|
||||
|
||||
public class FermenterRecipe implements IFermenterRecipe {
|
||||
|
||||
private final ItemStack resource;
|
||||
private final int fermentationValue;
|
||||
private final float modifier;
|
||||
private final Fluid output;
|
||||
private final FluidStack fluidResource;
|
||||
|
||||
public FermenterRecipe(ItemStack resource, int fermentationValue, float modifier, Fluid output, FluidStack fluidResource) {
|
||||
if (resource == null) {
|
||||
throw new NullPointerException("Fermenter Resource cannot be null!");
|
||||
}
|
||||
|
||||
if (output == null) {
|
||||
throw new NullPointerException("Fermenter Output cannot be null!");
|
||||
}
|
||||
|
||||
if (fluidResource == null) {
|
||||
throw new NullPointerException("Fermenter Liquid cannot be null!");
|
||||
}
|
||||
|
||||
// assume that fermenter recipes want to use Forestry's honey and not the legacy "fluid.honey"
|
||||
if (fluidResource.getFluid().getName().equals("fluid.honey")) {
|
||||
fluidResource = new FluidStack(FluidRegistry.getFluid("fluid.for.honey"), fluidResource.amount);
|
||||
}
|
||||
|
||||
this.resource = resource;
|
||||
this.fermentationValue = fermentationValue;
|
||||
this.modifier = modifier;
|
||||
this.output = output;
|
||||
this.fluidResource = fluidResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getFluidResource() {
|
||||
return fluidResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFermentationValue() {
|
||||
return fermentationValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getModifier() {
|
||||
return modifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fluid getOutput() {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
package modtweaker2.mods.forestry.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.IFermenterRecipe;
|
||||
|
||||
public class FermenterRecipe implements IFermenterRecipe {
|
||||
|
||||
private final ItemStack resource;
|
||||
private final int fermentationValue;
|
||||
private final float modifier;
|
||||
private final Fluid output;
|
||||
private final FluidStack fluidResource;
|
||||
|
||||
public FermenterRecipe(ItemStack resource, int fermentationValue, float modifier, Fluid output,
|
||||
FluidStack fluidResource) {
|
||||
if (resource == null) {
|
||||
throw new NullPointerException("Fermenter Resource cannot be null!");
|
||||
}
|
||||
|
||||
if (output == null) {
|
||||
throw new NullPointerException("Fermenter Output cannot be null!");
|
||||
}
|
||||
|
||||
if (fluidResource == null) {
|
||||
throw new NullPointerException("Fermenter Liquid cannot be null!");
|
||||
}
|
||||
|
||||
// assume that fermenter recipes want to use Forestry's honey and not the legacy "fluid.honey"
|
||||
if (fluidResource.getFluid().getName().equals("fluid.honey")) {
|
||||
fluidResource = new FluidStack(FluidRegistry.getFluid("fluid.for.honey"), fluidResource.amount);
|
||||
}
|
||||
|
||||
this.resource = resource;
|
||||
this.fermentationValue = fermentationValue;
|
||||
this.modifier = modifier;
|
||||
this.output = output;
|
||||
this.fluidResource = fluidResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getFluidResource() {
|
||||
return fluidResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFermentationValue() {
|
||||
return fermentationValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getModifier() {
|
||||
return modifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fluid getOutput() {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,30 @@
|
||||
package modtweaker2.mods.forestry.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.recipes.IMoistenerRecipe;
|
||||
|
||||
public class MoistenerRecipe implements IMoistenerRecipe {
|
||||
|
||||
private final int timePerItem;
|
||||
private final ItemStack resource;
|
||||
private final ItemStack product;
|
||||
|
||||
public MoistenerRecipe(ItemStack resource, ItemStack product, int timePerItem) {
|
||||
this.timePerItem = timePerItem;
|
||||
this.resource = resource;
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
public int getTimePerItem() {
|
||||
return timePerItem;
|
||||
}
|
||||
|
||||
public ItemStack getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public ItemStack getProduct() {
|
||||
return product;
|
||||
}
|
||||
}
|
||||
package modtweaker2.mods.forestry.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.recipes.IMoistenerRecipe;
|
||||
|
||||
public class MoistenerRecipe implements IMoistenerRecipe {
|
||||
|
||||
private final int timePerItem;
|
||||
private final ItemStack resource;
|
||||
private final ItemStack product;
|
||||
|
||||
public MoistenerRecipe(ItemStack resource, ItemStack product, int timePerItem) {
|
||||
this.timePerItem = timePerItem;
|
||||
this.resource = resource;
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
public int getTimePerItem() {
|
||||
return timePerItem;
|
||||
}
|
||||
|
||||
public ItemStack getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public ItemStack getProduct() {
|
||||
return product;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +1,50 @@
|
||||
package modtweaker2.mods.forestry.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
|
||||
public class SqueezerRecipe implements ISqueezerRecipe {
|
||||
|
||||
private final int processingTime;
|
||||
private final ItemStack[] resources;
|
||||
private final FluidStack fluidOutput;
|
||||
private final ItemStack remnants;
|
||||
private final float remnantsChance;
|
||||
|
||||
public SqueezerRecipe(int processingTime, ItemStack[] resources, FluidStack fluidOutput, ItemStack remnants, float remnantsChance) {
|
||||
this.processingTime = processingTime;
|
||||
this.resources = resources;
|
||||
this.fluidOutput = fluidOutput;
|
||||
this.remnants = remnants;
|
||||
this.remnantsChance = remnantsChance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getResources() {
|
||||
return resources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRemnants() {
|
||||
return remnants;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRemnantsChance() {
|
||||
return remnantsChance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getFluidOutput() {
|
||||
return fluidOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessingTime() {
|
||||
return processingTime;
|
||||
}
|
||||
|
||||
}
|
||||
package modtweaker2.mods.forestry.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
|
||||
public class SqueezerRecipe implements ISqueezerRecipe {
|
||||
|
||||
private final int processingTime;
|
||||
private final ItemStack[] resources;
|
||||
private final FluidStack fluidOutput;
|
||||
private final ItemStack remnants;
|
||||
private final float remnantsChance;
|
||||
|
||||
public SqueezerRecipe(int processingTime, ItemStack[] resources, FluidStack fluidOutput, ItemStack remnants,
|
||||
float remnantsChance) {
|
||||
this.processingTime = processingTime;
|
||||
this.resources = resources;
|
||||
this.fluidOutput = fluidOutput;
|
||||
this.remnants = remnants;
|
||||
this.remnantsChance = remnantsChance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getResources() {
|
||||
return resources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRemnants() {
|
||||
return remnants;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRemnantsChance() {
|
||||
return remnantsChance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getFluidOutput() {
|
||||
return fluidOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessingTime() {
|
||||
return processingTime;
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 231 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user