From f7b552a3c7ee9f698c43e761d1b228493932e811 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Fri, 17 Oct 2014 12:23:08 -0400 Subject: [PATCH] Fix for BM's Whirlwind buff making Botania useless (<3) --- .../java/vazkii/botania/api/BotaniaAPI.java | 363 ++++++++++++++++++ .../api/internal/DummyManaNetwork.java | 51 +++ .../api/internal/DummyMethodHandler.java | 135 +++++++ .../botania/api/internal/DummyPage.java | 35 ++ .../botania/api/internal/DummySubTile.java | 18 + .../api/internal/IGuiLexiconEntry.java | 57 +++ .../api/internal/IInternalMethodHandler.java | 81 ++++ .../botania/api/internal/IManaBurst.java | 62 +++ .../botania/api/internal/IManaNetwork.java | 68 ++++ .../botania/api/item/IExoflameHeatable.java | 44 +++ .../api/item/IExtendedPlayerController.java | 29 ++ .../botania/api/item/IPetalApothecary.java | 30 ++ .../botania/api/item/IPixieSpawner.java | 30 ++ .../botania/api/lexicon/IAddonEntry.java | 29 ++ .../vazkii/botania/api/lexicon/ILexicon.java | 21 + .../botania/api/lexicon/ILexiconable.java | 29 ++ .../api/lexicon/IRecipeKeyProvider.java | 24 ++ .../botania/api/lexicon/KnowledgeType.java | 20 + .../botania/api/lexicon/LexiconCategory.java | 32 ++ .../botania/api/lexicon/LexiconEntry.java | 97 +++++ .../botania/api/lexicon/LexiconPage.java | 67 ++++ .../api/lexicon/LexiconRecipeMappings.java | 66 ++++ .../botania/api/mana/BurstProperties.java | 37 ++ .../botania/api/mana/IClientManaHandler.java | 21 + .../api/mana/ICreativeManaProvider.java | 26 ++ .../vazkii/botania/api/mana/IKeyLocked.java | 30 ++ .../botania/api/mana/ILaputaImmobile.java | 23 ++ .../java/vazkii/botania/api/mana/ILens.java | 43 +++ .../vazkii/botania/api/mana/ILensEffect.java | 49 +++ .../vazkii/botania/api/mana/IManaBlock.java | 26 ++ .../botania/api/mana/IManaCollector.java | 43 +++ .../botania/api/mana/IManaCollisionGhost.java | 22 ++ .../vazkii/botania/api/mana/IManaItem.java | 69 ++++ .../vazkii/botania/api/mana/IManaPool.java | 31 ++ .../botania/api/mana/IManaReceiver.java | 35 ++ .../vazkii/botania/api/mana/IManaTrigger.java | 24 ++ .../botania/api/mana/IManaUsingItem.java | 26 ++ .../api/mana/IPoolOverlayProvider.java | 26 ++ .../botania/api/mana/ITinyPlanetExcempt.java | 24 ++ .../botania/api/mana/ManaItemHandler.java | 201 ++++++++++ .../botania/api/mana/ManaNetworkEvent.java | 57 +++ .../botania/api/mana/TileSignature.java | 15 + .../api/mana/spark/ISparkAttachable.java | 54 +++ .../botania/api/mana/spark/ISparkEntity.java | 65 ++++ .../botania/api/mana/spark/SparkHelper.java | 33 ++ .../java/vazkii/botania/api/package-info.java | 4 + .../vazkii/botania/api/recipe/IElvenItem.java | 14 + .../botania/api/recipe/IFlowerComponent.java | 26 ++ .../botania/api/recipe/RecipeElvenTrade.java | 94 +++++ .../api/recipe/RecipeManaInfusion.java | 81 ++++ .../botania/api/recipe/RecipePetals.java | 97 +++++ .../botania/api/recipe/RecipeRuneAltar.java | 31 ++ .../botania/api/subtile/ISpecialFlower.java | 21 + .../api/subtile/ISubTileContainer.java | 30 ++ .../botania/api/subtile/SubTileEntity.java | 126 ++++++ .../api/subtile/SubTileFunctional.java | 212 ++++++++++ .../api/subtile/SubTileGenerating.java | 245 ++++++++++++ .../botania/api/wand/ICoordBoundItem.java | 18 + .../vazkii/botania/api/wand/ITileBound.java | 31 ++ .../botania/api/wand/IWandBindable.java | 36 ++ .../vazkii/botania/api/wand/IWandHUD.java | 26 ++ .../vazkii/botania/api/wand/IWandable.java | 29 ++ .../api/wand/IWireframeAABBProvider.java | 25 ++ .../botania/api/wiki/IWikiProvider.java | 39 ++ .../botania/api/wiki/SimpleWikiProvider.java | 73 ++++ .../vazkii/botania/api/wiki/WikiHooks.java | 43 +++ .../AlchemicalWizardry.java | 3 + .../common/AlchemicalWizardryEventHooks.java | 27 +- 68 files changed, 3688 insertions(+), 11 deletions(-) create mode 100644 1.7.10/api/java/vazkii/botania/api/BotaniaAPI.java create mode 100644 1.7.10/api/java/vazkii/botania/api/internal/DummyManaNetwork.java create mode 100644 1.7.10/api/java/vazkii/botania/api/internal/DummyMethodHandler.java create mode 100644 1.7.10/api/java/vazkii/botania/api/internal/DummyPage.java create mode 100644 1.7.10/api/java/vazkii/botania/api/internal/DummySubTile.java create mode 100644 1.7.10/api/java/vazkii/botania/api/internal/IGuiLexiconEntry.java create mode 100644 1.7.10/api/java/vazkii/botania/api/internal/IInternalMethodHandler.java create mode 100644 1.7.10/api/java/vazkii/botania/api/internal/IManaBurst.java create mode 100644 1.7.10/api/java/vazkii/botania/api/internal/IManaNetwork.java create mode 100644 1.7.10/api/java/vazkii/botania/api/item/IExoflameHeatable.java create mode 100644 1.7.10/api/java/vazkii/botania/api/item/IExtendedPlayerController.java create mode 100644 1.7.10/api/java/vazkii/botania/api/item/IPetalApothecary.java create mode 100644 1.7.10/api/java/vazkii/botania/api/item/IPixieSpawner.java create mode 100644 1.7.10/api/java/vazkii/botania/api/lexicon/IAddonEntry.java create mode 100644 1.7.10/api/java/vazkii/botania/api/lexicon/ILexicon.java create mode 100644 1.7.10/api/java/vazkii/botania/api/lexicon/ILexiconable.java create mode 100644 1.7.10/api/java/vazkii/botania/api/lexicon/IRecipeKeyProvider.java create mode 100644 1.7.10/api/java/vazkii/botania/api/lexicon/KnowledgeType.java create mode 100644 1.7.10/api/java/vazkii/botania/api/lexicon/LexiconCategory.java create mode 100644 1.7.10/api/java/vazkii/botania/api/lexicon/LexiconEntry.java create mode 100644 1.7.10/api/java/vazkii/botania/api/lexicon/LexiconPage.java create mode 100644 1.7.10/api/java/vazkii/botania/api/lexicon/LexiconRecipeMappings.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/BurstProperties.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/IClientManaHandler.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/ICreativeManaProvider.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/IKeyLocked.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/ILaputaImmobile.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/ILens.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/ILensEffect.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/IManaBlock.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/IManaCollector.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/IManaCollisionGhost.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/IManaItem.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/IManaPool.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/IManaReceiver.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/IManaTrigger.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/IManaUsingItem.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/IPoolOverlayProvider.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/ITinyPlanetExcempt.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/ManaItemHandler.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/ManaNetworkEvent.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/TileSignature.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/spark/ISparkAttachable.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/spark/ISparkEntity.java create mode 100644 1.7.10/api/java/vazkii/botania/api/mana/spark/SparkHelper.java create mode 100644 1.7.10/api/java/vazkii/botania/api/package-info.java create mode 100644 1.7.10/api/java/vazkii/botania/api/recipe/IElvenItem.java create mode 100644 1.7.10/api/java/vazkii/botania/api/recipe/IFlowerComponent.java create mode 100644 1.7.10/api/java/vazkii/botania/api/recipe/RecipeElvenTrade.java create mode 100644 1.7.10/api/java/vazkii/botania/api/recipe/RecipeManaInfusion.java create mode 100644 1.7.10/api/java/vazkii/botania/api/recipe/RecipePetals.java create mode 100644 1.7.10/api/java/vazkii/botania/api/recipe/RecipeRuneAltar.java create mode 100644 1.7.10/api/java/vazkii/botania/api/subtile/ISpecialFlower.java create mode 100644 1.7.10/api/java/vazkii/botania/api/subtile/ISubTileContainer.java create mode 100644 1.7.10/api/java/vazkii/botania/api/subtile/SubTileEntity.java create mode 100644 1.7.10/api/java/vazkii/botania/api/subtile/SubTileFunctional.java create mode 100644 1.7.10/api/java/vazkii/botania/api/subtile/SubTileGenerating.java create mode 100644 1.7.10/api/java/vazkii/botania/api/wand/ICoordBoundItem.java create mode 100644 1.7.10/api/java/vazkii/botania/api/wand/ITileBound.java create mode 100644 1.7.10/api/java/vazkii/botania/api/wand/IWandBindable.java create mode 100644 1.7.10/api/java/vazkii/botania/api/wand/IWandHUD.java create mode 100644 1.7.10/api/java/vazkii/botania/api/wand/IWandable.java create mode 100644 1.7.10/api/java/vazkii/botania/api/wand/IWireframeAABBProvider.java create mode 100644 1.7.10/api/java/vazkii/botania/api/wiki/IWikiProvider.java create mode 100644 1.7.10/api/java/vazkii/botania/api/wiki/SimpleWikiProvider.java create mode 100644 1.7.10/api/java/vazkii/botania/api/wiki/WikiHooks.java diff --git a/1.7.10/api/java/vazkii/botania/api/BotaniaAPI.java b/1.7.10/api/java/vazkii/botania/api/BotaniaAPI.java new file mode 100644 index 00000000..36f5aa5a --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/BotaniaAPI.java @@ -0,0 +1,363 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 14, 2014, 6:15:28 PM (GMT)] + */ +package vazkii.botania.api; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.item.ItemArmor.ArmorMaterial; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.EnumHelper; +import vazkii.botania.api.internal.DummyMethodHandler; +import vazkii.botania.api.internal.DummySubTile; +import vazkii.botania.api.internal.IInternalMethodHandler; +import vazkii.botania.api.lexicon.KnowledgeType; +import vazkii.botania.api.lexicon.LexiconCategory; +import vazkii.botania.api.lexicon.LexiconEntry; +import vazkii.botania.api.recipe.RecipeElvenTrade; +import vazkii.botania.api.recipe.RecipeManaInfusion; +import vazkii.botania.api.recipe.RecipePetals; +import vazkii.botania.api.recipe.RecipeRuneAltar; +import vazkii.botania.api.subtile.SubTileEntity; +import vazkii.botania.api.wiki.IWikiProvider; +import vazkii.botania.api.wiki.SimpleWikiProvider; +import vazkii.botania.api.wiki.WikiHooks; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; + +public final class BotaniaAPI { + + private static List categories = new ArrayList(); + private static List allEntries = new ArrayList(); + + public static Map knowledgeTypes = new HashMap(); + + public static List petalRecipes = new ArrayList(); + public static List runeAltarRecipes = new ArrayList(); + public static List manaInfusionRecipes = new ArrayList(); + public static List elvenTradeRecipes = new ArrayList(); + + private static BiMap> subTiles = HashBiMap.> create(); + public static Set subtilesForCreativeMenu = new LinkedHashSet(); + + public static Map oreWeights = new HashMap(); + + public static Map seeds = new HashMap(); + + public static ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", 16, new int[] { 2, 6, 5, 2 }, 18); + public static ToolMaterial manasteelToolMaterial = EnumHelper.addToolMaterial("MANASTEEL", 3, 300, 6.2F, 2F, 20); + + public static ArmorMaterial elementiumArmorMaterial = EnumHelper.addArmorMaterial("B_ELEMENTIUM", 18, new int[] { 2, 6, 5, 2 }, 18); + public static ToolMaterial elementiumToolMaterial = EnumHelper.addToolMaterial("B_ELEMENTIUM", 3, 720, 6.2F, 2F, 20); + + public static ArmorMaterial terrasteelArmorMaterial = EnumHelper.addArmorMaterial("TERRASTEEL", 34, new int[] {3, 8, 6, 3}, 26); + public static ToolMaterial terrasteelToolMaterial = EnumHelper.addToolMaterial("TERRASTEEL", 3, 2300, 9F, 3F, 26); + + public static KnowledgeType basicKnowledge, elvenKnowledge; + + static { + registerSubTile("", DummySubTile.class); + + basicKnowledge = registerKnowledgeType("minecraft", EnumChatFormatting.RESET, true); + elvenKnowledge = registerKnowledgeType("alfheim", EnumChatFormatting.DARK_GREEN, false); + + addOreWeight("oreAluminum", 3940); // Tinkers' Construct + addOreWeight("oreAmber", 2075); // Thaumcraft + addOreWeight("oreApatite", 1595); // Forestry + addOreWeight("oreBlueTopaz", 3195); // Ars Magica + addOreWeight("oreCassiterite", 1634); // GregTech + addOreWeight("oreCertusQuartz", 3975); // Applied Energistics + addOreWeight("oreChimerite", 3970); // Ars Magica + addOreWeight("oreCinnabar", 2585); // Thaumcraft + addOreWeight("oreCoal", 46525); // Vanilla + addOreWeight("oreCooperite", 5); // GregTech + addOreWeight("oreCopper", 8325); // IC2, Thermal Expansion, Tinkers' Construct, etc. + addOreWeight("oreDarkIron", 1700); // Factorization + addOreWeight("oreDiamond", 1265); // Vanilla + addOreWeight("oreEmerald", 780); // Vanilla + addOreWeight("oreEmery", 415); // GregTech + addOreWeight("oreGalena", 1000); // Factorization + addOreWeight("oreGold", 2970); // Vanilla + addOreWeight("oreInfusedAir", 925); // Thaumcraft + addOreWeight("oreInfusedEarth", 925); // Thaumcraft + addOreWeight("oreInfusedEntropy", 925); // Thaumcraft + addOreWeight("oreInfusedFire", 925); // Thaumcraft + addOreWeight("oreInfusedOrder", 925); // Thaumcraft + addOreWeight("oreInfusedWater", 925); // Thaumcraft + addOreWeight("oreIridium", 30); // GregTech + addOreWeight("oreIron", 20665); // Vanilla + addOreWeight("oreLapis", 1285); // Vanilla + addOreWeight("oreLead", 7985); // IC2, Thermal Expansion, Factorization, etc. + addOreWeight("oreMCropsEssence", 3085); // Magical Crops + addOreWeight("oreNickel", 2275); // Thermal Expansion + addOreWeight("oreOlivine", 1100); // Project RED + addOreWeight("oreRedstone", 6885); // Vanilla + addOreWeight("oreRuby", 1100); // Project RED + addOreWeight("oreSapphire", 1100); // Project RED + addOreWeight("oreSilver", 6300); // Thermal Expansion, Factorization, etc. + addOreWeight("oreSphalerite", 25); // GregTech + addOreWeight("oreSulfur", 1105); // Railcraft + addOreWeight("oreTetrahedrite", 4040); // GregTech + addOreWeight("oreTin", 9450); // IC2, Thermal Expansion, etc. + addOreWeight("oreTungstate", 20); // GregTech + addOreWeight("oreUranium", 1337); // IC2 + addOreWeight("oreVinteum", 5925); // Ars Magica + addOreWeight("oreYellorite", 3520); // Big Reactors + addOreWeight("oreZinc", 6485); // Flaxbeard's Steam Power + + addSeed(Items.wheat_seeds, Blocks.wheat); + addSeed(Items.potato, Blocks.potatoes); + addSeed(Items.carrot, Blocks.carrots); + addSeed(Items.nether_wart, Blocks.nether_wart); + addSeed(Items.pumpkin_seeds, Blocks.pumpkin_stem); + addSeed(Items.melon_seeds, Blocks.melon_stem); + + registerModWiki("Minecraft", new SimpleWikiProvider("Minecraft Wiki", "http://minecraft.gamepedia.com/%s")); + + IWikiProvider technicWiki = new SimpleWikiProvider("Technic Wiki", "http://wiki.technicpack.net/%s"); + IWikiProvider mekanismWiki = new SimpleWikiProvider("Mekanism Wiki", "http://wiki.aidancbrady.com/wiki/%s"); + IWikiProvider buildcraftWiki = new SimpleWikiProvider("BuildCraft Wiki", "http://www.mod-buildcraft.com/wiki/doku.php?id=%s"); + + registerModWiki("Mekanism", mekanismWiki); + registerModWiki("MekanismGenerators", mekanismWiki); + registerModWiki("MekanismTools", mekanismWiki); + registerModWiki("EnderIO", new SimpleWikiProvider("EnderIO Wiki", "http://wiki.enderio.com/%s")); + registerModWiki("TropiCraft", new SimpleWikiProvider("Tropicraft Wiki", "http://wiki.tropicraft.net/wiki/%s")); + registerModWiki("RandomThings", new SimpleWikiProvider("Random Things Wiki", "http://randomthingsminecraftmod.wikispaces.com/%s")); + registerModWiki("Witchery", new SimpleWikiProvider("Witchery Wiki", "https://sites.google.com/site/witcherymod/%s", "-")); + registerModWiki("AppliedEnergistics2", new SimpleWikiProvider("AE2 Wiki", "http://ae-mod.info/%s")); + registerModWiki("BigReactors", technicWiki); + registerModWiki("BuildCraft|Core", buildcraftWiki); + registerModWiki("BuildCraft|Builders", buildcraftWiki); + registerModWiki("BuildCraft|Energy", buildcraftWiki); + registerModWiki("BuildCraft|Factory", buildcraftWiki); + registerModWiki("BuildCraft|Silicon", buildcraftWiki); + registerModWiki("BuildCraft|Transport", buildcraftWiki); + registerModWiki("ArsMagica2", new SimpleWikiProvider("ArsMagica2 Wiki", "http://wiki.arsmagicamod.com/wiki/%s")); + registerModWiki("PneumaticCraft", new SimpleWikiProvider("PneumaticCraft Wiki", "http://www.minemaarten.com/wikis/pneumaticcraft-wiki/pneumaticcraft-wiki-%s")); + registerModWiki("StevesCarts2", new SimpleWikiProvider("Steve's Carts Wiki", "http://stevescarts2.wikispaces.com/%s")); + registerModWiki("GanysSurface", new SimpleWikiProvider("Gany's Surface Wiki", "http://ganys-surface.wikia.com/wiki/%s")); + registerModWiki("GanysNether", new SimpleWikiProvider("Gany's Nether Wiki", "http://ganys-nether.wikia.com/wiki/%s")); + registerModWiki("GanysEnd", new SimpleWikiProvider("Gany's End Wiki", "http://ganys-end.wikia.com/wiki/%s")); + } + + /** + * The internal method handler in use. Do not overwrite. + * @see IInternalMethodHandler + */ + public static IInternalMethodHandler internalHandler = new DummyMethodHandler(); + + + /** + * Registers a new Knowledge Type. + * @param id The ID for this knowledge type. + * @param color The color to display this knowledge type as. + */ + public static KnowledgeType registerKnowledgeType(String id, EnumChatFormatting color, boolean autoUnlock) { + KnowledgeType type = new KnowledgeType(id, color, autoUnlock); + knowledgeTypes.put(id, type); + return type; + } + + /** + * Registers a Petal Recipe. + * @param output The ItemStack to craft. + * @param inputs The objects for crafting. Can be ItemStack, MappableStackWrapper + * or String (case for Ore Dictionary). The array can't be larger than 16. + * @return The recipe created. + */ + public static RecipePetals registerPetalRecipe(ItemStack output, Object... inputs) { + RecipePetals recipe = new RecipePetals(output, inputs); + petalRecipes.add(recipe); + return recipe; + } + + /** + * Registers a Rune Altar + * @param output The ItemStack to craft. + * @param mana The amount of mana required. Don't go over 100000! + * @param inputs The objects for crafting. Can be ItemStack, MappableStackWrapper + * or String (case for Ore Dictionary). The array can't be larger than 16. + * @return The recipe created. + */ + public static RecipeRuneAltar registerRuneAltarRecipe(ItemStack output, int mana, Object... inputs) { + RecipeRuneAltar recipe = new RecipeRuneAltar(output, mana, inputs); + runeAltarRecipes.add(recipe); + return recipe; + } + + /** + * Registers a Mana Infusion Recipe (throw an item in a mana pool) + * @param output The ItemStack to craft + * @param input The input item, be it an ItemStack or an ore dictionary entry String. + * @param mana The amount of mana required. Don't go over 100000! + * @return The recipe created. + */ + public static RecipeManaInfusion registerManaInfusionRecipe(ItemStack output, Object input, int mana) { + RecipeManaInfusion recipe = new RecipeManaInfusion(output, input, mana); + manaInfusionRecipes.add(recipe); + return recipe; + } + + /** + * Register a Mana Infusion Recipe and flags it as an Alchemy recipe (requires an + * Alchemy Catalyst below the pool). + * @see BotaniaAPI#registerManaInfusionRecipe + */ + public static RecipeManaInfusion registerManaAlchemyRecipe(ItemStack output, Object input, int mana) { + RecipeManaInfusion recipe = registerManaInfusionRecipe(output, input, mana); + recipe.setAlchemy(true); + return recipe; + } + + /** + * Register a Mana Infusion Recipe and flags it as an Conjuration recipe (requires a + * Conjuration Catalyst below the pool). + * @see BotaniaAPI#registerManaInfusionRecipe + */ + public static RecipeManaInfusion registerManaConjurationRecipe(ItemStack output, Object input, int mana) { + RecipeManaInfusion recipe = registerManaInfusionRecipe(output, input, mana); + recipe.setConjuration(true); + return recipe; + } + + /** + * Registers a Elven Trade recipe (throw an item in an Alfheim Portal). + * @param output The ItemStack to return. + * @param inputs The items required, can be ItemStack or ore dictionary entry string. + * @return The recipe created. + */ + public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack output, Object... inputs) { + RecipeElvenTrade recipe = new RecipeElvenTrade(output, inputs); + elvenTradeRecipes.add(recipe); + return recipe; + } + + /** + * Registers a SubTileEntity, a new special flower. Look in the subtile package of the API. + */ + public static void registerSubTile(String key, Class subtileClass) { + subTiles.put(key, subtileClass); + } + + /** + * Adds the key for a SubTileEntity into the creative menu. This goes into the + * subtilesForCreativeMenu Set. + */ + public static void addSubTileToCreativeMenu(String key) { + subtilesForCreativeMenu.add(key); + } + + /** + * Adds a category to the list of registered categories to appear in the Lexicon. + */ + public static void addCategory(LexiconCategory category) { + categories.add(category); + } + + /** + * Gets all registered categories. + */ + public static List getAllCategories() { + return categories; + } + + /** + * Gets all registered entries. + */ + public static List getAllEntries() { + return allEntries; + } + + /** + * Registers a Lexicon Entry and adds it to the category passed in. + */ + public static void addEntry(LexiconEntry entry, LexiconCategory category) { + allEntries.add(entry); + category.entries.add(entry); + } + + /** + * Maps an ore (ore dictionary key) to it's weight on the world generation. This + * is used for the Orechid flower. Check the static block in the BotaniaAPI class + * to get the weights for the vanilla blocks.
+ * Alternatively get the values with the OreDetector mod:
+ * https://gist.github.com/Vazkii/9493322 + */ + public static void addOreWeight(String ore, int weight) { + oreWeights.put(ore, weight); + } + + public static int getOreWeight(String ore) { + return oreWeights.get(ore); + } + + /** + * Allows an item to be counted as a seed. Any item in this list can be + * dispensed by a dispenser, the block is the block to be placed. + */ + public static void addSeed(Item item, Block block) { + seeds.put(item, block); + } + + /** + * Gets the last recipe to have been added to the recipe list. + */ + public static IRecipe getLatestAddedRecipe() { + List list = CraftingManager.getInstance().getRecipeList(); + return list.get(list.size() - 1); + } + + /** + * Gets the last x recipes added to the recipe list. + */ + public static List getLatestAddedRecipes(int x) { + List list = CraftingManager.getInstance().getRecipeList(); + List newList = new ArrayList(); + for(int i = x - 1; i >= 0; i--) + newList.add(list.get(list.size() - 1 - i)); + + return newList; + } + + /** + * Registers a Wiki provider for a mod so it uses that instead of the fallback + * FTB wiki. Make sure to call this on PostInit only! + */ + public static void registerModWiki(String mod, IWikiProvider provider) { + WikiHooks.registerModWiki(mod, provider); + } + + public static Class getSubTileMapping(String key) { + if(!subTiles.containsKey(key)) + key = ""; + + return subTiles.get(key); + } + + public static String getSubTileStringMapping(Class clazz) { + return subTiles.inverse().get(clazz); + } +} diff --git a/1.7.10/api/java/vazkii/botania/api/internal/DummyManaNetwork.java b/1.7.10/api/java/vazkii/botania/api/internal/DummyManaNetwork.java new file mode 100644 index 00000000..53a8e421 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/internal/DummyManaNetwork.java @@ -0,0 +1,51 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Mar 7, 2014, 3:47:43 PM (GMT)] + */ +package vazkii.botania.api.internal; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; +import vazkii.botania.api.mana.TileSignature; + +public class DummyManaNetwork implements IManaNetwork { + + public static final DummyManaNetwork instance = new DummyManaNetwork(); + + @Override + public void clear() { + // NO-OP + } + + @Override + public TileEntity getClosestPool(ChunkCoordinates pos, World world, int limit) { + return null; + } + + @Override + public TileEntity getClosestCollector(ChunkCoordinates pos, World world, int limit) { + return null; + } + + @Override + public List getAllCollectorsInWorld(World world) { + return new ArrayList(); + } + + @Override + public List getAllPoolsInWorld(World world) { + return new ArrayList(); + } + +} diff --git a/1.7.10/api/java/vazkii/botania/api/internal/DummyMethodHandler.java b/1.7.10/api/java/vazkii/botania/api/internal/DummyMethodHandler.java new file mode 100644 index 00000000..549bd197 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/internal/DummyMethodHandler.java @@ -0,0 +1,135 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 14, 2014, 6:43:03 PM (GMT)] + */ +package vazkii.botania.api.internal; + +import java.util.List; + +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import vazkii.botania.api.lexicon.LexiconPage; +import vazkii.botania.api.recipe.RecipeElvenTrade; +import vazkii.botania.api.recipe.RecipeManaInfusion; +import vazkii.botania.api.recipe.RecipePetals; +import vazkii.botania.api.recipe.RecipeRuneAltar; + +public class DummyMethodHandler implements IInternalMethodHandler { + + @Override + public LexiconPage textPage(String key) { + return dummyPage(key); + } + + @Override + public LexiconPage imagePage(String key, String resource) { + return dummyPage(key); + } + + @Override + public LexiconPage craftingRecipesPage(String key, List recipes) { + return dummyPage(key); + } + + @Override + public LexiconPage craftingRecipePage(String key, IRecipe recipe) { + return dummyPage(key); + } + + @Override + public LexiconPage petalRecipesPage(String key, List recipes) { + return dummyPage(key); + } + + @Override + public LexiconPage petalRecipePage(String key, RecipePetals recipe) { + return dummyPage(key); + } + + @Override + public LexiconPage runeRecipesPage(String key, List recipes) { + return dummyPage(key); + } + + @Override + public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe) { + return dummyPage(key); + } + + @Override + public LexiconPage manaInfusionRecipesPage(String key, List recipes) { + return dummyPage(key); + } + + @Override + public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe) { + return dummyPage(key); + } + + @Override + public LexiconPage elvenTradePage(String key, List recipes) { + return dummyPage(key); + } + + @Override + public LexiconPage elvenTradesPage(String key, RecipeElvenTrade recipe) { + return dummyPage(key); + } + + private LexiconPage dummyPage(String key) { + return new DummyPage(key); + } + + @Override + public ItemStack getSubTileAsStack(String subTile) { + return new ItemStack(Blocks.stone, 0, 0); + } + + @Override + public IIcon getSubTileIconForName(String name) { + return Blocks.red_flower.getIcon(0, 0); + } + + @Override + public IManaNetwork getManaNetworkInstance() { + return DummyManaNetwork.instance; + } + + @Override + public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) { + // NO-OP + } + + @Override + public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) { + // NO-OP + } + + @Override + public IInventory getBaublesInventory(EntityPlayer player) { + return null; + } + + @Override + public boolean shouldForceCheck() { + return true; + } + + @Override + public int getPassiveFlowerDecay() { + return 0; + } +} diff --git a/1.7.10/api/java/vazkii/botania/api/internal/DummyPage.java b/1.7.10/api/java/vazkii/botania/api/internal/DummyPage.java new file mode 100644 index 00000000..33cbcf84 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/internal/DummyPage.java @@ -0,0 +1,35 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 14, 2014, 6:41:23 PM (GMT)] + */ +package vazkii.botania.api.internal; + +import vazkii.botania.api.lexicon.LexiconPage; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * A dummy page. It does absolutely nothing and is only + * existant to make sure everything goes right even if + * Botania isn't loaded. + */ +public class DummyPage extends LexiconPage { + + public DummyPage(String unlocalizedName) { + super(unlocalizedName); + } + + @Override + @SideOnly(Side.CLIENT) + public void renderScreen(IGuiLexiconEntry gui, int x, int y) { + // NO-OP + } + +} diff --git a/1.7.10/api/java/vazkii/botania/api/internal/DummySubTile.java b/1.7.10/api/java/vazkii/botania/api/internal/DummySubTile.java new file mode 100644 index 00000000..d23adced --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/internal/DummySubTile.java @@ -0,0 +1,18 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 24, 2014, 4:17:33 PM (GMT)] + */ +package vazkii.botania.api.internal; + +import vazkii.botania.api.subtile.SubTileEntity; + +public class DummySubTile extends SubTileEntity { + +} diff --git a/1.7.10/api/java/vazkii/botania/api/internal/IGuiLexiconEntry.java b/1.7.10/api/java/vazkii/botania/api/internal/IGuiLexiconEntry.java new file mode 100644 index 00000000..c8bf6da1 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/internal/IGuiLexiconEntry.java @@ -0,0 +1,57 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 14, 2014, 6:48:41 PM (GMT)] + */ +package vazkii.botania.api.internal; + +import vazkii.botania.api.lexicon.LexiconEntry; + +/** + * Internal interface for the Lexicon Entry GUI. This contains + * everything that can be accessed from it. It's safe to cast + * this type to GuiScreen. + */ +public interface IGuiLexiconEntry { + + /** + * Gets the entry currently portrayed in this gui. + */ + public LexiconEntry getEntry(); + + /** + * Gets the current page the lexicon GUI is browsing. + */ + public int getPageOn(); + + /** + * Gets the leftmost part of the GUI. + */ + public int getLeft(); + + /** + * Gets the topmost part of the GUI. + */ + public int getTop(); + + /** + * Gets the GUI's width. + */ + public int getWidth(); + + /** + * Gets the GUI's height + */ + public int getHeight(); + + /** + * Gets the GUI's Z level for rendering. + */ + public float getZLevel(); +} diff --git a/1.7.10/api/java/vazkii/botania/api/internal/IInternalMethodHandler.java b/1.7.10/api/java/vazkii/botania/api/internal/IInternalMethodHandler.java new file mode 100644 index 00000000..00a16a29 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/internal/IInternalMethodHandler.java @@ -0,0 +1,81 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 14, 2014, 6:34:34 PM (GMT)] + */ +package vazkii.botania.api.internal; + +import java.util.List; + +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import vazkii.botania.api.lexicon.LexiconPage; +import vazkii.botania.api.recipe.RecipeElvenTrade; +import vazkii.botania.api.recipe.RecipeManaInfusion; +import vazkii.botania.api.recipe.RecipePetals; +import vazkii.botania.api.recipe.RecipeRuneAltar; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * Any methods that refer to internal methods in Botania are here. + * This is defaulted to a dummy handler, whose methods do nothing. + * This handler is set to a proper one on PreInit. Make sure to + * make your mod load after Botania if you have any intention of + * doing anythign with this on PreInit. + */ +public interface IInternalMethodHandler { + + public LexiconPage textPage(String key); + + public LexiconPage imagePage(String key, String resource); + + public LexiconPage craftingRecipesPage(String key, List recipes); + + public LexiconPage craftingRecipePage(String key, IRecipe recipe); + + public LexiconPage petalRecipesPage(String key, List recipes); + + public LexiconPage petalRecipePage(String key, RecipePetals recipe); + + public LexiconPage runeRecipesPage(String key, List recipes); + + public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe); + + public LexiconPage manaInfusionRecipesPage(String key, List recipes); + + public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe); + + public LexiconPage elvenTradePage(String key, List recipes); + + public LexiconPage elvenTradesPage(String key, RecipeElvenTrade recipe); + + public IManaNetwork getManaNetworkInstance(); + + public ItemStack getSubTileAsStack(String subTile); + + public IIcon getSubTileIconForName(String name); + + public boolean shouldForceCheck(); + + public int getPassiveFlowerDecay(); + + public IInventory getBaublesInventory(EntityPlayer player); + + @SideOnly(Side.CLIENT) + public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res); + + public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/internal/IManaBurst.java b/1.7.10/api/java/vazkii/botania/api/internal/IManaBurst.java new file mode 100644 index 00000000..38c5fd8c --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/internal/IManaBurst.java @@ -0,0 +1,62 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 31, 2014, 4:36:13 PM (GMT)] + */ +package vazkii.botania.api.internal; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChunkCoordinates; + +/** + * Interface for the Mana Burst entity. This can safely be casted to EntityThrowable. + */ +public interface IManaBurst { + + public boolean isFake(); + + public void setMotion(double x, double y, double z); + + public int getColor(); + + public void setColor(int color); + + public int getMana(); + + public void setMana(int mana); + + public int getStartingMana(); + + public void setStartingMana(int mana); + + public int getMinManaLoss(); + + public void setMinManaLoss(int minManaLoss); + + public float getManaLossPerTick(); + + public void setManaLossPerTick(float mana); + + public float getGravity(); + + public void setGravity(float gravity); + + public ChunkCoordinates getBurstSourceChunkCoordinates(); + + public void setBurstSourceCoords(int x, int y, int z); + + public ItemStack getSourceLens(); + + public void setSourceLens(ItemStack lens); + + public boolean hasAlreadyCollidedAt(int x, int y, int z); + + public int getTicksExisted(); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/internal/IManaNetwork.java b/1.7.10/api/java/vazkii/botania/api/internal/IManaNetwork.java new file mode 100644 index 00000000..38e94197 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/internal/IManaNetwork.java @@ -0,0 +1,68 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Mar 7, 2014, 3:39:48 PM (GMT)] + */ +package vazkii.botania.api.internal; + +import java.util.List; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; +import vazkii.botania.api.mana.TileSignature; + +/** + * A basic interface for a world's Mana Network. + * @see IInternalMethodHandler#getManaNetworkInstance() + */ +public interface IManaNetwork { + + /** + * Clears the entire Mana Network of all it's contents, you probably + * don't want to call this unless you have a very good reason. + */ + public void clear(); + + /** + * Gets the closest Mana Collector (eg. Mana Spreader) in the network to the Chunk + * Coordinates passed in, in the given dimension.
+ * A way of getting the dimension is via worldObj.provider.dimensionId
+ * Note that this function *can* get performance intensive, it's reccomended you + * call it sparingly and take cache of the value returned. + * @param limit The maximum distance the closest block can be, if the closest block + * is farther away than that, null will be returned instead. + */ + public TileEntity getClosestCollector(ChunkCoordinates pos, World world, int limit); + + /** + * Gets the closest Mana Pool in the network to the Chunk Coordinates passed in, + * in the given dimension.
+ * A way of getting the dimension is via worldObj.provider.dimensionId
+ * Note that this function *can* get performance intensive, it's reccomended you + * call it sparingly and take cache of the value returned. + * @param limit The maximum distance the closest block can be, if the closest block + * is farther away than that, null will be returned instead. + */ + public TileEntity getClosestPool(ChunkCoordinates pos, World world, int limit); + + /** + * Gets the list of all Mana Collectors (eg. Mana Spreader) in the dimension + * passed in. Note that this is the actual list and not a copy, make sure to + * clone the list if you intend to change it in any way. + */ + public List getAllCollectorsInWorld(World world); + + /** + * Gets the list of all Mana Pools in the dimension passed in. Note that this + * is the actual list and not a copy, make sure to clone the list if you intend + * to change it in any way. + */ + public List getAllPoolsInWorld(World world); +} diff --git a/1.7.10/api/java/vazkii/botania/api/item/IExoflameHeatable.java b/1.7.10/api/java/vazkii/botania/api/item/IExoflameHeatable.java new file mode 100644 index 00000000..eb4815c6 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/item/IExoflameHeatable.java @@ -0,0 +1,44 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Aug 30, 2014, 4:28:29 PM (GMT)] + */ +package vazkii.botania.api.item; + +/** + * A TileEntity that implements this can be heated by an Exoflame flower. + */ +public interface IExoflameHeatable { + + /** + * Can this TileEntity smelt its contents. If true, the Exoflame is allowed + * to fuel it. + */ + public boolean canSmelt(); + + /** + * Gets the amount of ticks left for the fuel. If below 2, the exoflame + * will call boostBurnTime. + */ + public int getBurnTime(); + + /** + * Called to increase the amount of time this furnace should be burning + * the fuel for. Even if it doesn't have any fuel. + */ + public void boostBurnTime(); + + /** + * Called once every two ticks to increase the speed of the furnace. Feel + * free to not do anything if all you want is to allow the exoflame to feed + * it, not make it faster. + */ + public void boostCookTime(); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/item/IExtendedPlayerController.java b/1.7.10/api/java/vazkii/botania/api/item/IExtendedPlayerController.java new file mode 100644 index 00000000..67db3e64 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/item/IExtendedPlayerController.java @@ -0,0 +1,29 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Aug 6, 2014, 6:02:29 PM (GMT)] + */ +package vazkii.botania.api.item; + +/** + * An interface that defines an instance of PlayerControllerMP with + * the ability to modify reach. See vazkii.botania.client.core.handler.BotaniaPlayerController + */ +public interface IExtendedPlayerController { + + /** + * Sets the extra reach the player should have. + */ + public void setReachDistanceExtension(float f); + + /** + * Gets the current reach extension. + */ + public float getReachDistanceExtension(); +} diff --git a/1.7.10/api/java/vazkii/botania/api/item/IPetalApothecary.java b/1.7.10/api/java/vazkii/botania/api/item/IPetalApothecary.java new file mode 100644 index 00000000..d96f73f1 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/item/IPetalApothecary.java @@ -0,0 +1,30 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Aug 30, 2014, 4:22:15 PM (GMT)] + */ +package vazkii.botania.api.item; + +/** + * Base Interface for the Petal Apothecary block. Can + * be safely casted to TileEntity. + */ +public interface IPetalApothecary { + + /** + * Sets if the the apothecary has water or not. + */ + public void setWater(boolean water); + + /** + * Does the apothecary have water in it? + */ + public boolean hasWater(); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/item/IPixieSpawner.java b/1.7.10/api/java/vazkii/botania/api/item/IPixieSpawner.java new file mode 100644 index 00000000..c0d47f87 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/item/IPixieSpawner.java @@ -0,0 +1,30 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Aug 6, 2014, 6:06:27 PM (GMT)] + */ +package vazkii.botania.api.item; + +import net.minecraft.item.ItemStack; + +/** + * Any item that implements this allows for pixies to be spawned when the player takes damage when...
+ * - Case the item is armor, having it equipped.
+ * - Case the item is a bauble, having it worn.
+ * - On any other case, having the item being the current held item. + */ +public interface IPixieSpawner { + + /** + * The chance this item adds for pixies to be spawned. From 0.0 to 1.0. All values + * are put together when calculating. + */ + public float getPixieChance(ItemStack stack); + +} \ No newline at end of file diff --git a/1.7.10/api/java/vazkii/botania/api/lexicon/IAddonEntry.java b/1.7.10/api/java/vazkii/botania/api/lexicon/IAddonEntry.java new file mode 100644 index 00000000..fe2167b1 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/lexicon/IAddonEntry.java @@ -0,0 +1,29 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jun 8, 2014, 7:02:48 PM (GMT)] + */ +package vazkii.botania.api.lexicon; + +/** + * Have a LexiconEntry implement this to signify it's an "Addon entry", as + * in, one provided by an Addon. This allows it to draw a subtitle of + * sorts, to prevent the [Mod tag here] nonsense that happened with thaumcraft + * addons. It can also be used for other purposes, such as stating an + * entry is WIP. + */ +public interface IAddonEntry { + + /** + * Returns the unlocalized subtitle to show below the title. Here you'd + * return something like "(This Entry is provided by the Botanic Tinkerer addon)". + */ + public String getSubtitle(); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/lexicon/ILexicon.java b/1.7.10/api/java/vazkii/botania/api/lexicon/ILexicon.java new file mode 100644 index 00000000..ee07e17f --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/lexicon/ILexicon.java @@ -0,0 +1,21 @@ +package vazkii.botania.api.lexicon; + +import net.minecraft.item.ItemStack; + +/** + * Basic interface for the Lexica Botania. + */ +public interface ILexicon { + + /** + * Gets if a specific knowledge is unlocked. Check the knowledge types in + * BotaniaAPI. + */ + public boolean isKnowledgeUnlocked(ItemStack stack, KnowledgeType knowledge); + + /** + * Unlocks a specfic type of knowledge. + */ + public void unlockKnowledge(ItemStack stack, KnowledgeType knowledge); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/lexicon/ILexiconable.java b/1.7.10/api/java/vazkii/botania/api/lexicon/ILexiconable.java new file mode 100644 index 00000000..e8777db2 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/lexicon/ILexiconable.java @@ -0,0 +1,29 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 20, 2014, 7:05:44 PM (GMT)] + */ +package vazkii.botania.api.lexicon; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * Any block that implements this can be right clicked with + * a Lexica Botania to open a entry page. + */ +public interface ILexiconable { + + /** + * Gets the lexicon entry to open at this location. null works too. + */ + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/lexicon/IRecipeKeyProvider.java b/1.7.10/api/java/vazkii/botania/api/lexicon/IRecipeKeyProvider.java new file mode 100644 index 00000000..d07c0325 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/lexicon/IRecipeKeyProvider.java @@ -0,0 +1,24 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Mar 20, 2014, 6:08:48 PM (GMT)] + */ +package vazkii.botania.api.lexicon; + +import net.minecraft.item.ItemStack; + +/** + * Have an Item implement this so that the method used for mapping it into + * the lexicon recipe mappings isn't the typical id:meta key. + */ +public interface IRecipeKeyProvider { + + public String getKey(ItemStack stack); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/lexicon/KnowledgeType.java b/1.7.10/api/java/vazkii/botania/api/lexicon/KnowledgeType.java new file mode 100644 index 00000000..5a08c9ce --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/lexicon/KnowledgeType.java @@ -0,0 +1,20 @@ +package vazkii.botania.api.lexicon; + +import net.minecraft.util.EnumChatFormatting; + +public class KnowledgeType { + + public final String id; + public final EnumChatFormatting color; + public final boolean autoUnlock; + + public KnowledgeType(String id, EnumChatFormatting color, boolean autoUnlock) { + this.id = id; + this.color = color; + this.autoUnlock = autoUnlock; + } + + public String getUnlocalizedName() { + return "botania.knowledge." + id; + } +} diff --git a/1.7.10/api/java/vazkii/botania/api/lexicon/LexiconCategory.java b/1.7.10/api/java/vazkii/botania/api/lexicon/LexiconCategory.java new file mode 100644 index 00000000..76273419 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/lexicon/LexiconCategory.java @@ -0,0 +1,32 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 14, 2014, 6:23:47 PM (GMT)] + */ +package vazkii.botania.api.lexicon; + +import java.util.ArrayList; +import java.util.List; + +public final class LexiconCategory { + + public final String unlocalizedName; + public final List entries = new ArrayList(); + + /** + * @param unlocalizedName The unlocalized name of this category. This will be localized by the client display. + */ + public LexiconCategory(String unlocalizedName) { + this.unlocalizedName = unlocalizedName; + } + + public String getUnlocalizedName() { + return unlocalizedName; + } +} diff --git a/1.7.10/api/java/vazkii/botania/api/lexicon/LexiconEntry.java b/1.7.10/api/java/vazkii/botania/api/lexicon/LexiconEntry.java new file mode 100644 index 00000000..bbc475c4 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/lexicon/LexiconEntry.java @@ -0,0 +1,97 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 14, 2014, 6:17:06 PM (GMT)] + */ +package vazkii.botania.api.lexicon; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import net.minecraft.util.StatCollector; +import vazkii.botania.api.BotaniaAPI; + +public class LexiconEntry implements Comparable { + + public final String unlocalizedName; + public final LexiconCategory category; + + private KnowledgeType type = BotaniaAPI.basicKnowledge; + + public List pages = new ArrayList(); + private boolean priority = false; + + /** + * @param unlocalizedName The unlocalized name of this entry. This will be localized by the client display. + */ + public LexiconEntry(String unlocalizedName, LexiconCategory category) { + this.unlocalizedName = unlocalizedName; + this.category = category; + } + + /** + * Sets this page as prioritized, as in, will appear before others in the lexicon. + */ + public LexiconEntry setPriority() { + priority = true; + return this; + } + + /** + * Sets the Knowledge type of this entry. + */ + public LexiconEntry setKnowledgeType(KnowledgeType type) { + this.type = type; + return this; + } + + public KnowledgeType getKnowledgeType() { + return type; + } + + public boolean isPriority() { + return priority; + } + + public String getUnlocalizedName() { + return unlocalizedName; + } + + /** + * Sets what pages you want this entry to have. + */ + public LexiconEntry setLexiconPages(LexiconPage... pages) { + this.pages.addAll(Arrays.asList(pages)); + + for(int i = 0; i < this.pages.size(); i++) { + LexiconPage page = this.pages.get(i); + if(!page.skipRegistry) + page.onPageAdded(this, i); + } + + return this; + } + + /** + * Adds a page to the list of pages. + */ + public void addPage(LexiconPage page) { + pages.add(page); + } + + public final String getNameForSorting() { + return (priority ? 0 : 1) + StatCollector.translateToLocal(getUnlocalizedName()); + } + + @Override + public int compareTo(LexiconEntry o) { + return getNameForSorting().compareTo(o.getNameForSorting()); + } +} \ No newline at end of file diff --git a/1.7.10/api/java/vazkii/botania/api/lexicon/LexiconPage.java b/1.7.10/api/java/vazkii/botania/api/lexicon/LexiconPage.java new file mode 100644 index 00000000..f17f0c5e --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/lexicon/LexiconPage.java @@ -0,0 +1,67 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 14, 2014, 6:17:24 PM (GMT)] + */ +package vazkii.botania.api.lexicon; + +import vazkii.botania.api.internal.IGuiLexiconEntry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public abstract class LexiconPage { + + public String unlocalizedName; + public boolean skipRegistry; + + public LexiconPage(String unlocalizedName) { + this.unlocalizedName = unlocalizedName; + } + + /** + * Does the rendering for this page. + * @param gui The active GuiScreen + * @param mx The mouse's relative X position. + * @param my The mouse's relative Y position. + */ + @SideOnly(Side.CLIENT) + public abstract void renderScreen(IGuiLexiconEntry gui, int mx, int my); + + /** + * Called per update tick. + */ + @SideOnly(Side.CLIENT) + public void updateScreen() { + // NO-OP + } + + /** + * Called when a key is pressed. + */ + @SideOnly(Side.CLIENT) + public void onKeyPressed(char c, int key) { + // NO-OP + } + + /** + * Called when {@link LexiconEntry#setLexiconPages(LexiconPage...)} is called. + */ + public void onPageAdded(LexiconEntry entry, int index) { + // NO-OP + } + + public String getUnlocalizedName() { + return unlocalizedName; + } + + public LexiconPage setSkipRegistry() { + skipRegistry = true; + return this; + } +} diff --git a/1.7.10/api/java/vazkii/botania/api/lexicon/LexiconRecipeMappings.java b/1.7.10/api/java/vazkii/botania/api/lexicon/LexiconRecipeMappings.java new file mode 100644 index 00000000..49b2a133 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/lexicon/LexiconRecipeMappings.java @@ -0,0 +1,66 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Mar 6, 2014, 3:54:12 PM (GMT)] + */ +package vazkii.botania.api.lexicon; + +import java.util.HashMap; +import java.util.Map; + +import net.minecraft.item.ItemStack; + +/** + * This class contains mappings for which entry and page correspond to each + * craftable ItemStack. Use the map method to map an ItemStack to a page in + * an entry in the lexicon. + */ +public final class LexiconRecipeMappings { + + private static Map mappings = new HashMap(); + + /** + * Maps the given stack to the given page of the entry. + */ + public static void map(ItemStack stack, LexiconEntry entry, int page, boolean force) { + EntryData data = new EntryData(entry, page); + String str = stackToString(stack); + + if(force || !mappings.containsKey(str)) + mappings.put(str, data); + } + + public static void map(ItemStack stack, LexiconEntry entry, int page) { + map(stack, entry, page, false); + } + + + public static EntryData getDataForStack(ItemStack stack) { + return mappings.get(stackToString(stack)); + } + + public static String stackToString(ItemStack stack) { + if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider) + return ((IRecipeKeyProvider) stack.getItem()).getKey(stack); + + return stack.getUnlocalizedName() + "~" + stack.getItemDamage(); + } + + public static class EntryData { + + public final LexiconEntry entry; + public final int page; + + public EntryData(LexiconEntry entry, int page) { + this.entry = entry; + this.page = page; + } + + } +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/BurstProperties.java b/1.7.10/api/java/vazkii/botania/api/mana/BurstProperties.java new file mode 100644 index 00000000..eed74809 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/BurstProperties.java @@ -0,0 +1,37 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 31, 2014, 3:49:30 PM (GMT)] + */ +package vazkii.botania.api.mana; + +/** + * The properties of a mana burst, when shot. This is passed to the lens + * currently on the mana spreader to apply changes. + */ +public final class BurstProperties { + + public int maxMana; + public int ticksBeforeManaLoss; + public float manaLossPerTick; + public float gravity; + public float motionModifier; + + public int color; + + public BurstProperties(int maxMana, int ticksBeforeManaLoss, float manaLossPerTick, float gravity, float motionModifier, int color) { + this.maxMana = maxMana; + this.ticksBeforeManaLoss = ticksBeforeManaLoss; + this.manaLossPerTick = manaLossPerTick; + this.gravity = gravity; + this.motionModifier = motionModifier; + this.color = color; + } + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/IClientManaHandler.java b/1.7.10/api/java/vazkii/botania/api/mana/IClientManaHandler.java new file mode 100644 index 00000000..889cfb51 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/IClientManaHandler.java @@ -0,0 +1,21 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jul 2, 2014, 5:26:02 PM (GMT)] + */ +package vazkii.botania.api.mana; + +/** + * A TileEntity that implements this will get it's recieveMana call + * called on both client and server. If this is not implemented + * the call will only occur on the server. + */ +public interface IClientManaHandler extends IManaReceiver { + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/ICreativeManaProvider.java b/1.7.10/api/java/vazkii/botania/api/mana/ICreativeManaProvider.java new file mode 100644 index 00000000..51f3cce9 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/ICreativeManaProvider.java @@ -0,0 +1,26 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [May 25, 2014, 7:34:00 PM (GMT)] + */ +package vazkii.botania.api.mana; + +import net.minecraft.item.ItemStack; + +/** + * Have an item implement this to flag it as an infinite + * mana source for the purposes of the HUD rendered when + * an IManaUserItem implementing item is present. + */ +public interface ICreativeManaProvider { + + public boolean isCreative(ItemStack stack); + +} + diff --git a/1.7.10/api/java/vazkii/botania/api/mana/IKeyLocked.java b/1.7.10/api/java/vazkii/botania/api/mana/IKeyLocked.java new file mode 100644 index 00000000..a7870e6b --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/IKeyLocked.java @@ -0,0 +1,30 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jul 11, 2014, 4:29:32 PM (GMT)] + */ +package vazkii.botania.api.mana; + +/** + * A TileEntity that implements this interface has an IO key lock. This + * interface defines an input and output key.

+ * + * A Spreader can only shoot mana into a IKeyLocked interfaced TE if the Input + * key of the TE is equal to the Output key of the Spreader.

+ * + * A Spreader can only pull mana from a IKeyLocked interfaced IManaPool TE if the + * Output key of the IManaPool is equal to the Input key of the Spreader. + */ +public interface IKeyLocked { + + public String getInputKey(); + + public String getOutputKey(); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/ILaputaImmobile.java b/1.7.10/api/java/vazkii/botania/api/mana/ILaputaImmobile.java new file mode 100644 index 00000000..91cb0b93 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/ILaputaImmobile.java @@ -0,0 +1,23 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jul 26, 2014, 9:51:58 PM (GMT)] + */ +package vazkii.botania.api.mana; + +import net.minecraft.world.World; + +/** + * A block that implements this has a flag for whether it can be moved by the Shard of Laputa. + */ +public interface ILaputaImmobile { + + public boolean canMove(World world, int x, int y, int z); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/ILens.java b/1.7.10/api/java/vazkii/botania/api/mana/ILens.java new file mode 100644 index 00000000..628d102b --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/ILens.java @@ -0,0 +1,43 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 31, 2014, 3:03:04 PM (GMT)] + */ +package vazkii.botania.api.mana; + +import net.minecraft.item.ItemStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * Have an Item implement this to be counted as a lens for the mana spreader. + */ +public interface ILens extends ILensEffect { + + @SideOnly(Side.CLIENT) + public int getLensColor(ItemStack stack); + + /** + * Can the source lens be combined with the composite lens? This is called + * for both the ILens instance of ItemStack.getItem() of sourceLens and compositeLens. + */ + public boolean canCombineLenses(ItemStack sourceLens, ItemStack compositeLens); + + /** + * Gets the composite lens in the stack passed in, return null for none. + */ + public ItemStack getCompositeLens(ItemStack stack); + + /** + * Sets the composite lens for the sourceLens as the compositeLens, returns + * the ItemStack with the combination. + */ + public ItemStack setCompositeLens(ItemStack sourceLens, ItemStack compositeLens); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/ILensEffect.java b/1.7.10/api/java/vazkii/botania/api/mana/ILensEffect.java new file mode 100644 index 00000000..d97095b2 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/ILensEffect.java @@ -0,0 +1,49 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Apr 14, 2014, 7:30:00 PM (GMT)] + */ +package vazkii.botania.api.mana; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.MovingObjectPosition; +import vazkii.botania.api.internal.IManaBurst; + +/** + * Have an item implement this for it to count as a lens effect and + * be able to change the properties of Mana Bursts. + */ +public interface ILensEffect { + + /** + * Called when a mana spreader that has this focus shoots a burst. This is where + * you change the properties of the burst. + */ + public void apply(ItemStack stack, BurstProperties props); + + /** + * Called when a mana burst fired from a mana spreader with this focus collides against + * any block. This is called after the collision is handled. + * @return True to kill the burst. False to keep it alive. + */ + public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack); + + /** + * Called when a mana burst fired from a mana spreader with this focus is updated. + * This is called before the update is handled. + */ + public void updateBurst(IManaBurst burst, ItemStack stack); + + /** + * Called when the mana burst should do it's particles. Return false to not + * do any particles. + */ + public boolean doParticles(IManaBurst burst, ItemStack stack); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/IManaBlock.java b/1.7.10/api/java/vazkii/botania/api/mana/IManaBlock.java new file mode 100644 index 00000000..6896f059 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/IManaBlock.java @@ -0,0 +1,26 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 22, 2014, 4:59:05 PM (GMT)] + */ +package vazkii.botania.api.mana; + +/** + * A TileEntity that implements this is considered a Mana Block. + * Just being a Mana Block doesn't mean much, look at the other IMana + * interfaces. + */ +public interface IManaBlock { + + /** + * Gets the amount of mana currently in this block. + */ + public int getCurrentMana(); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/IManaCollector.java b/1.7.10/api/java/vazkii/botania/api/mana/IManaCollector.java new file mode 100644 index 00000000..a54d8c93 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/IManaCollector.java @@ -0,0 +1,43 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 22, 2014, 5:01:19 PM (GMT)] + */ +package vazkii.botania.api.mana; + +import vazkii.botania.api.internal.IManaBurst; + +/** + * Any TileEntity that implements this is considered a mana collector, by + * which nearby generating flowers will pump mana into it.

+ * + * Implementation Instructions:
+ * - Override invalidate() and onChunkUnload(), calling ManaNetworkEvent.removeCollector(this); on both.
+ * - On the first tick of onUpdate(), call ManaNetworkEvent.addCollector(this); + */ +public interface IManaCollector extends IManaReceiver { + + /** + * Called every tick on the client case the player is holding a Wand of the Forest. + */ + public void onClientDisplayTick(); + + /** + * Get the multiplier of mana to input into the block, 1.0 is the original amount of mana + * in the burst. 0.9, for example, is 90%, so 10% of the mana in the burst will get + * dissipated. + */ + public float getManaYieldMultiplier(IManaBurst burst); + + /** + * Gets the maximum amount of mana this collector can have. + */ + public int getMaxMana(); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/IManaCollisionGhost.java b/1.7.10/api/java/vazkii/botania/api/mana/IManaCollisionGhost.java new file mode 100644 index 00000000..420f683c --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/IManaCollisionGhost.java @@ -0,0 +1,22 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Mar 10, 2014, 7:49:19 PM (GMT)] + */ +package vazkii.botania.api.mana; + +/** + * Any TileEntity that implements this can be counted as a "ghost" block of + * sorts, that won't call the collision code for the mana bursts. + */ +public interface IManaCollisionGhost { + + public boolean isGhost(); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/IManaItem.java b/1.7.10/api/java/vazkii/botania/api/mana/IManaItem.java new file mode 100644 index 00000000..42dfef15 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/IManaItem.java @@ -0,0 +1,69 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Mar 6, 2014, 9:07:40 AM (GMT)] + */ +package vazkii.botania.api.mana; + +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +/** + * An item that implements this can be counted as an item that can + * contain mana. + */ +public interface IManaItem { + + /** + * Gets the amount of mana this item contains + */ + public int getMana(ItemStack stack); + + /** + * Gets the max amount of mana this item can hold. + */ + public int getMaxMana(ItemStack stack); + + /** + * Adds mana to this item. + */ + public void addMana(ItemStack stack, int mana); + + /** + * Can this item receive mana from a mana Pool? + * @param pool The pool it's receiving mana from, can be casted to IManaPool. + * @see IManaPool#isOutputtingPower() + */ + public boolean canReceiveManaFromPool(ItemStack stack, TileEntity pool); + + /** + * Can this item recieve mana from another item? + */ + public boolean canReceiveManaFromItem(ItemStack stack, ItemStack otherStack); + + /** + * Can this item export mana to a mana Pool? + * @param pool The pool it's exporting mana to, can be casted to IManaPool. + * @see IManaPool#isOutputtingPower() + */ + public boolean canExportManaToPool(ItemStack stack,TileEntity pool); + + /** + * Can this item export mana to another item? + */ + public boolean canExportManaToItem(ItemStack stack, ItemStack otherStack); + + /** + * If this item simply does not export mana at all, set this to true. This is + * used to skip items that contain mana but can't export it when drawing the + * mana bar above the XP bar. + */ + public boolean isNoExport(ItemStack stack); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/IManaPool.java b/1.7.10/api/java/vazkii/botania/api/mana/IManaPool.java new file mode 100644 index 00000000..b93bf6e8 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/IManaPool.java @@ -0,0 +1,31 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 22, 2014, 5:03:09 PM (GMT)] + */ +package vazkii.botania.api.mana; + +/** + * Any TileEntity that implements this is considered a Mana Pool, + * by which nearby functional flowers will pull mana from it.
+ * Mana Distributors will also accept it as valid output.

+ * + * Implementation Instructions:
+ * - Override invalidate() and onChunkUnload(), calling ManaNetworkEvent.removePool(this); on both.
+ * - On the first tick of onUpdate(), call ManaNetworkEvent.addPool(this); + */ +public interface IManaPool extends IManaReceiver { + + /** + * Returns false if the mana pool is accepting power from other power items, + * true if it's sending power into them. + */ + public boolean isOutputtingPower(); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/IManaReceiver.java b/1.7.10/api/java/vazkii/botania/api/mana/IManaReceiver.java new file mode 100644 index 00000000..2838c7b7 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/IManaReceiver.java @@ -0,0 +1,35 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 22, 2014, 4:55:00 PM (GMT)] + */ +package vazkii.botania.api.mana; + +/** + * Any TileEntity that implements this can receive mana from mana bursts. + */ +public interface IManaReceiver extends IManaBlock { + + /** + * Is this Mana Receiver is full? Being full means no mana bursts will be sent. + */ + public boolean isFull(); + + /** + * Called when this receiver receives mana. + */ + public void recieveMana(int mana); + + /** + * Can this tile receive mana from bursts? Generally set to false for + * implementations of IManaCollector. + */ + public boolean canRecieveManaFromBursts(); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/IManaTrigger.java b/1.7.10/api/java/vazkii/botania/api/mana/IManaTrigger.java new file mode 100644 index 00000000..684a2c1d --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/IManaTrigger.java @@ -0,0 +1,24 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [May 16, 2014, 7:52:53 PM (GMT)] + */ +package vazkii.botania.api.mana; + +import net.minecraft.world.World; +import vazkii.botania.api.internal.IManaBurst; + +/** + * Have a block implement this class to make it do something when a mana burst collides with it. + */ +public interface IManaTrigger { + + public void onBurstCollision(IManaBurst burst, World world, int x, int y, int z); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/IManaUsingItem.java b/1.7.10/api/java/vazkii/botania/api/mana/IManaUsingItem.java new file mode 100644 index 00000000..d06cf744 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/IManaUsingItem.java @@ -0,0 +1,26 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [May 25, 2014, 7:32:10 PM (GMT)] + */ +package vazkii.botania.api.mana; + +import net.minecraft.item.ItemStack; + +/** + * Any item that implements this interface is an item that would use mana + * from the player's inventory. If there's any items in the inventory or + * equipped in either the baubles or armor inventories that implement + * this interface, a mana bar will be rendered. + */ +public interface IManaUsingItem { + + public boolean usesMana(ItemStack stack); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/IPoolOverlayProvider.java b/1.7.10/api/java/vazkii/botania/api/mana/IPoolOverlayProvider.java new file mode 100644 index 00000000..f677c3ee --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/IPoolOverlayProvider.java @@ -0,0 +1,26 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jul 2, 2014, 6:36:54 PM (GMT)] + */ +package vazkii.botania.api.mana; + +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +/** + * A block that implements this can provide an IIcon (block icons only) + * to be used as an overlay for the mana pool, similarly to the mana void + * and catalysts. + */ +public interface IPoolOverlayProvider { + + public IIcon getIcon(World world, int x, int y, int z); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/ITinyPlanetExcempt.java b/1.7.10/api/java/vazkii/botania/api/mana/ITinyPlanetExcempt.java new file mode 100644 index 00000000..004c52ed --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/ITinyPlanetExcempt.java @@ -0,0 +1,24 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jul 22, 2014, 2:26:14 PM (GMT)] + */ +package vazkii.botania.api.mana; + +import net.minecraft.item.ItemStack; + +/** + * Any Item that implements ILensEffect and this will have + * a check before being pulled by the Tiny Planet. + */ +public interface ITinyPlanetExcempt { + + public boolean shouldPull(ItemStack stack); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/ManaItemHandler.java b/1.7.10/api/java/vazkii/botania/api/mana/ManaItemHandler.java new file mode 100644 index 00000000..74fb0053 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/ManaItemHandler.java @@ -0,0 +1,201 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Mar 13, 2014, 5:32:24 PM (GMT)] + */ +package vazkii.botania.api.mana; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import vazkii.botania.api.BotaniaAPI; + +public final class ManaItemHandler { + + /** + * Requests mana from items in a given player's inventory. + * @param manaToGet How much mana is to be requested, if less mana exists than this amount, + * the amount of mana existent will be returned instead, if you want exact values use requestManaExact. + * @param remove If true, the mana will be removed from the target item. Set to false to just check. + * @return The amount of mana received from the request. + */ + public static int requestMana(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) { + if(stack == null) + return 0; + + IInventory mainInv = player.inventory; + IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player); + + int invSize = mainInv.getSizeInventory(); + int size = invSize; + if(baublesInv != null) + size += baublesInv.getSizeInventory(); + + for(int i = 0; i < size; i++) { + boolean useBaubles = i >= invSize; + IInventory inv = useBaubles ? baublesInv : mainInv; + ItemStack stackInSlot = inv.getStackInSlot(i - (useBaubles ? invSize : 0)); + if(stackInSlot == stack) + continue; + + if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) { + IManaItem manaItem = (IManaItem) stackInSlot.getItem(); + if(manaItem.canExportManaToItem(stackInSlot, stack) && manaItem.getMana(stackInSlot) > 0) { + if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canReceiveManaFromItem(stack, stackInSlot)) + continue; + + int mana = Math.min(manaToGet, manaItem.getMana(stackInSlot)); + + if(remove) + manaItem.addMana(stackInSlot, -mana); + + return mana; + } + } + } + + return 0; + } + + /** + * Requests an exact amount of mana from items in a given player's inventory. + * @param manaToGet How much mana is to be requested, if less mana exists than this amount, + * false will be returned instead, and nothing will happen. + * @param remove If true, the mana will be removed from the target item. Set to false to just check. + * @return If the request was succesful. + */ + public static boolean requestManaExact(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) { + if(stack == null) + return false; + + IInventory mainInv = player.inventory; + IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player); + + int invSize = mainInv.getSizeInventory(); + int size = invSize; + if(baublesInv != null) + size += baublesInv.getSizeInventory(); + + for(int i = 0; i < size; i++) { + boolean useBaubles = i >= invSize; + IInventory inv = useBaubles ? baublesInv : mainInv; + ItemStack stackInSlot = inv.getStackInSlot(i - (useBaubles ? invSize : 0)); + if(stackInSlot == stack) + continue; + + if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) { + IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem(); + if(manaItemSlot.canExportManaToItem(stackInSlot, stack) && manaItemSlot.getMana(stackInSlot) > manaToGet) { + if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canReceiveManaFromItem(stack, stackInSlot)) + continue; + + if(remove) + manaItemSlot.addMana(stackInSlot, -manaToGet); + + return true; + } + } + } + + return false; + } + + /** + * Dispatches mana to items in a given player's inventory. Note that this method + * does not automatically remove mana from the item which is exporting. + * @param manaToSend How much mana is to be sent. + * @param remove If true, the mana will be added from the target item. Set to false to just check. + * @return The amount of mana actually sent. + */ + public static int dispatchMana(ItemStack stack, EntityPlayer player, int manaToSend, boolean add) { + if(stack == null) + return 0; + + IInventory mainInv = player.inventory; + IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player); + + int invSize = mainInv.getSizeInventory(); + int size = invSize; + if(baublesInv != null) + size += baublesInv.getSizeInventory(); + + for(int i = 0; i < size; i++) { + boolean useBaubles = i >= invSize; + IInventory inv = useBaubles ? baublesInv : mainInv; + ItemStack stackInSlot = inv.getStackInSlot(i - (useBaubles ? invSize : 0)); + if(stackInSlot == stack) + continue; + + if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) { + IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem(); + + if(manaItemSlot.canReceiveManaFromItem(stackInSlot, stack)) { + if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canExportManaToItem(stack, stackInSlot)) + continue; + + int received = 0; + if(manaItemSlot.getMana(stackInSlot) + manaToSend <= manaItemSlot.getMaxMana(stackInSlot)) + received = manaToSend; + else received = manaToSend - (manaItemSlot.getMana(stackInSlot) + manaToSend - manaItemSlot.getMaxMana(stackInSlot)); + + + if(add) + manaItemSlot.addMana(stackInSlot, manaToSend); + + return received; + } + } + } + + return 0; + } + + /** + * Dispatches an exact amount of mana to items in a given player's inventory. Note that this method + * does not automatically remove mana from the item which is exporting. + * @param manaToSend How much mana is to be sent. + * @param remove If true, the mana will be added from the target item. Set to false to just check. + * @return If an item received the mana sent. + */ + public static boolean dispatchManaExact(ItemStack stack, EntityPlayer player, int manaToSend, boolean add) { + if(stack == null) + return false; + + IInventory mainInv = player.inventory; + IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player); + + int invSize = mainInv.getSizeInventory(); + int size = invSize; + if(baublesInv != null) + size += baublesInv.getSizeInventory(); + + for(int i = 0; i < size; i++) { + boolean useBaubles = i >= invSize; + IInventory inv = useBaubles ? baublesInv : mainInv; + ItemStack stackInSlot = inv.getStackInSlot(i - (useBaubles ? invSize : 0)); + if(stackInSlot == stack) + continue; + + if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) { + IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem(); + if(manaItemSlot.getMana(stackInSlot) + manaToSend <= manaItemSlot.getMaxMana(stackInSlot) && manaItemSlot.canReceiveManaFromItem(stackInSlot, stack)) { + if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canExportManaToItem(stack, stackInSlot)) + continue; + + if(add) + manaItemSlot.addMana(stackInSlot, manaToSend); + + return true; + } + } + } + + return false; + } +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/ManaNetworkEvent.java b/1.7.10/api/java/vazkii/botania/api/mana/ManaNetworkEvent.java new file mode 100644 index 00000000..e04253a7 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/ManaNetworkEvent.java @@ -0,0 +1,57 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 22, 2014, 5:04:30 PM (GMT)] + */ +package vazkii.botania.api.mana; + +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.MinecraftForge; +import cpw.mods.fml.common.eventhandler.Event; + +public class ManaNetworkEvent extends Event { + + public final TileEntity tile; + public final ManaBlockType type; + public final Action action; + + public ManaNetworkEvent(TileEntity tile, ManaBlockType type, Action action) { + this.tile = tile; + this.type = type; + this.action = action; + } + + public static void addCollector(TileEntity tile) { + ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.COLLECTOR, Action.ADD); + MinecraftForge.EVENT_BUS.post(event); + } + + public static void removeCollector(TileEntity tile) { + ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.COLLECTOR, Action.REMOVE); + MinecraftForge.EVENT_BUS.post(event); + } + + public static void addPool(TileEntity tile) { + ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.POOL, Action.ADD); + MinecraftForge.EVENT_BUS.post(event); + } + + public static void removePool(TileEntity tile) { + ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.POOL, Action.REMOVE); + MinecraftForge.EVENT_BUS.post(event); + } + + public enum ManaBlockType { + POOL, COLLECTOR + } + + public enum Action { + REMOVE, ADD + } +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/TileSignature.java b/1.7.10/api/java/vazkii/botania/api/mana/TileSignature.java new file mode 100644 index 00000000..5573670d --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/TileSignature.java @@ -0,0 +1,15 @@ +package vazkii.botania.api.mana; + +import net.minecraft.tileentity.TileEntity; + +public class TileSignature { + + public final TileEntity tile; + public final boolean remoteWorld; + + public TileSignature(TileEntity tile, boolean remoteWorld) { + this.tile = tile; + this.remoteWorld = remoteWorld; + } + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/spark/ISparkAttachable.java b/1.7.10/api/java/vazkii/botania/api/mana/spark/ISparkAttachable.java new file mode 100644 index 00000000..4353f01c --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/spark/ISparkAttachable.java @@ -0,0 +1,54 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Aug 21, 2014, 5:44:13 PM (GMT)] + */ +package vazkii.botania.api.mana.spark; + +import net.minecraft.item.ItemStack; +import vazkii.botania.api.mana.IManaReceiver; + +/** + * A TileEntity that implements this can have a Spark attached to it. + * For the Spark to be allowed to have upgrades, it needs to be an IManaPool. + */ +public interface ISparkAttachable extends IManaReceiver { + + /** + * Can this block have a Spark attached to it. Note that this will not + * unattach the Spark if it's changed later. + */ + public boolean canAttachSpark(ItemStack stack); + + /** + * Called when the Spark is attached. + */ + public void attachSpark(ISparkEntity entity); + + /** + * Gets the Spark that is attached to this block. A common implementation is + * to check for Spark entities above: + * + List sparks = worldObj.getEntitiesWithinAABB(ISparkEntity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1, zCoord, xCoord + 1, yCoord + 2, zCoord + 1)); + if(sparks.size() == 1) { + Entity e = (Entity) sparks.get(0); + return (ISparkEntity) e; + } + + return null; + */ + public ISparkEntity getAttachedSpark(); + + /** + * Return true if this Tile no longer requires mana and all Sparks + * transferring mana to it should cancel their transfer. + */ + public boolean areIncomingTranfersDone(); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/spark/ISparkEntity.java b/1.7.10/api/java/vazkii/botania/api/mana/spark/ISparkEntity.java new file mode 100644 index 00000000..084b827c --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/spark/ISparkEntity.java @@ -0,0 +1,65 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Aug 21, 2014, 5:44:07 PM (GMT)] + */ +package vazkii.botania.api.mana.spark; + +import java.util.Collection; + +/** + * An Entity that implements this is considered a Spark. + */ +public interface ISparkEntity { + + /** + * Which TileEntity is this Spark attached to? A common implementation is checking the block below. + * + int x = MathHelper.floor_double(posX); + int y = MathHelper.floor_double(posY) - 1; + int z = MathHelper.floor_double(posZ); + TileEntity tile = worldObj.getTileEntity(x, y, z); + if(tile != null && tile instanceof ISparkAttachable) + return (ISparkAttachable) tile; + + return null; + */ + public ISparkAttachable getAttachedTile(); + + /** + * Gets a collection of all Sparks this is tranfering to. + */ + public Collection getTransfers(); + + /** + * Registers the Spark passed in as a Spark meant for mana to be transfered towards. + */ + public void registerTransfer(ISparkEntity entity); + + /** + * Gets which upgrade is in this Spark.
+ * 0: None
+ * 1: Dispersive
+ * 2: Dominant
+ * 3: Recessive
+ * 4: Isolated + */ + public int getUpgrade(); + + /** + * Sets the upgrade on this Spark. See {@link ISparkEntity#getUpgrade} + */ + public void setUpgrade(int upgrade); + + /** + * See {@link ISparkAttachable#areIncomingTranfersDone()} + */ + public boolean areIncomingTransfersDone(); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/mana/spark/SparkHelper.java b/1.7.10/api/java/vazkii/botania/api/mana/spark/SparkHelper.java new file mode 100644 index 00000000..6bb3196a --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/mana/spark/SparkHelper.java @@ -0,0 +1,33 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Aug 21, 2014, 7:16:11 PM (GMT)] + */ +package vazkii.botania.api.mana.spark; + +import java.util.List; + +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; + +public final class SparkHelper { + + public static final int SPARK_SCAN_RANGE = 12; + + public static List getSparksAround(World world, double x, double y, double z) { + return SparkHelper.getEntitiesAround(ISparkEntity.class, world, x, y, z); + } + + public static List getEntitiesAround(Class clazz, World world, double x, double y, double z) { + int r = SPARK_SCAN_RANGE; + List entities = world.getEntitiesWithinAABB(clazz, AxisAlignedBB.getBoundingBox(x - r, y - r, z - r, x + r, y + r, z + r)); + return entities; + } + +} diff --git a/1.7.10/api/java/vazkii/botania/api/package-info.java b/1.7.10/api/java/vazkii/botania/api/package-info.java new file mode 100644 index 00000000..82da263c --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/package-info.java @@ -0,0 +1,4 @@ +@API(owner = "Botania", apiVersion = "18", provides = "BotaniaAPI") +package vazkii.botania.api; +import cpw.mods.fml.common.API; + diff --git a/1.7.10/api/java/vazkii/botania/api/recipe/IElvenItem.java b/1.7.10/api/java/vazkii/botania/api/recipe/IElvenItem.java new file mode 100644 index 00000000..e614014d --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/recipe/IElvenItem.java @@ -0,0 +1,14 @@ +package vazkii.botania.api.recipe; + +import net.minecraft.item.ItemStack; + +/** + * Any Item that implements this is classified as an "Elven Item", by which, + * it'll not go through the alfheim portal. Any item that comes out of it + * must implement this or it'll just go back in. + */ +public interface IElvenItem { + + public boolean isElvenItem(ItemStack stack); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/recipe/IFlowerComponent.java b/1.7.10/api/java/vazkii/botania/api/recipe/IFlowerComponent.java new file mode 100644 index 00000000..fe5bf3cd --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/recipe/IFlowerComponent.java @@ -0,0 +1,26 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Feb 15, 2014, 2:36:35 PM (GMT)] + */ +package vazkii.botania.api.recipe; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + +/** + * Have an Item implement this to allow it to be used in the Petal Apothecary. + */ +public interface IFlowerComponent { + + public boolean canFit(ItemStack stack, IInventory apothecary); + + public int getParticleColor(ItemStack stack); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/recipe/RecipeElvenTrade.java b/1.7.10/api/java/vazkii/botania/api/recipe/RecipeElvenTrade.java new file mode 100644 index 00000000..dbea13e8 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/recipe/RecipeElvenTrade.java @@ -0,0 +1,94 @@ +package vazkii.botania.api.recipe; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +public class RecipeElvenTrade { + + ItemStack output; + List inputs; + + public RecipeElvenTrade(ItemStack output, Object... inputs) { + this.output = output; + + List inputsToSet = new ArrayList(); + for(Object obj : inputs) { + if(obj instanceof String || obj instanceof ItemStack) + inputsToSet.add(obj); + else throw new IllegalArgumentException("Invalid input"); + } + + this.inputs = inputsToSet; + } + + public boolean matches(List stacks, boolean remove) { + List inputsMissing = new ArrayList(inputs); + List stacksToRemove = new ArrayList(); + + for(ItemStack stack : stacks) { + if(stack == null) { + continue; + } + if(inputsMissing.isEmpty()) + break; + + int stackIndex = -1, oredictIndex = -1; + + for(int j = 0; j < inputsMissing.size(); j++) { + Object input = inputsMissing.get(j); + if(input instanceof String) { + List validStacks = OreDictionary.getOres((String) input); + boolean found = false; + for(ItemStack ostack : validStacks) { + ItemStack cstack = ostack.copy(); + if(cstack.getItemDamage() == Short.MAX_VALUE) + cstack.setItemDamage(stack.getItemDamage()); + + if(stack.isItemEqual(cstack)) { + if(!stacksToRemove.contains(stack)) + stacksToRemove.add(stack); + oredictIndex = j; + found = true; + break; + } + } + + if(found) + break; + } else if(input instanceof ItemStack && simpleAreStacksEqual((ItemStack) input, stack)) { + if(!stacksToRemove.contains(stack)) + stacksToRemove.add(stack); + stackIndex = j; + break; + } + } + + if(stackIndex != -1) + inputsMissing.remove(stackIndex); + else if(oredictIndex != -1) + inputsMissing.remove(oredictIndex); + } + + if(remove) + for(ItemStack r : stacksToRemove) + stacks.remove(r); + + return inputsMissing.isEmpty(); + } + + boolean simpleAreStacksEqual(ItemStack stack, ItemStack stack2) { + return stack.getItem() == stack2.getItem() && stack.getItemDamage() == stack2.getItemDamage(); + } + + public List getInputs() { + return new ArrayList(inputs); + } + + public ItemStack getOutput() { + return output; + } + +} diff --git a/1.7.10/api/java/vazkii/botania/api/recipe/RecipeManaInfusion.java b/1.7.10/api/java/vazkii/botania/api/recipe/RecipeManaInfusion.java new file mode 100644 index 00000000..e87b002d --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/recipe/RecipeManaInfusion.java @@ -0,0 +1,81 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 30, 2014, 5:57:07 PM (GMT)] + */ +package vazkii.botania.api.recipe; + +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +public class RecipeManaInfusion { + + ItemStack output; + Object input; + int mana; + boolean isAlchemy = false; + boolean isConjuration = false; + + public RecipeManaInfusion(ItemStack output, Object input, int mana) { + this.output = output; + this.input = input; + this.mana = mana; + } + + public boolean matches(ItemStack stack) { + if(input instanceof ItemStack) + return stack.isItemEqual((ItemStack) input); + + if(input instanceof String) { + List validStacks = OreDictionary.getOres((String) input); + + for(ItemStack ostack : validStacks) { + ItemStack cstack = ostack.copy(); + if(cstack.getItemDamage() == Short.MAX_VALUE) + cstack.setItemDamage(stack.getItemDamage()); + + if(stack.isItemEqual(cstack)) + return true; + } + } + + return false; + } + + public void setAlchemy(boolean alchemy) { + isAlchemy = alchemy; + } + + public boolean isAlchemy() { + return isAlchemy; + } + + public void setConjuration(boolean conjuration) { + isConjuration = conjuration; + } + + public boolean isConjuration() { + return isConjuration; + } + + public Object getInput() { + return input; + } + + public ItemStack getOutput() { + return output; + } + + public int getManaToConsume() { + return mana; + } +} + diff --git a/1.7.10/api/java/vazkii/botania/api/recipe/RecipePetals.java b/1.7.10/api/java/vazkii/botania/api/recipe/RecipePetals.java new file mode 100644 index 00000000..0dba51ac --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/recipe/RecipePetals.java @@ -0,0 +1,97 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 22, 2014, 2:02:44 PM (GMT)] + */ +package vazkii.botania.api.recipe; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +public class RecipePetals { + + ItemStack output; + List inputs; + + public RecipePetals(ItemStack output, Object... inputs) { + this.output = output; + + List inputsToSet = new ArrayList(); + for(Object obj : inputs) { + if(obj instanceof String || obj instanceof ItemStack) + inputsToSet.add(obj); + else throw new IllegalArgumentException("Invalid input"); + } + + this.inputs = inputsToSet; + } + + public boolean matches(IInventory inv) { + List inputsMissing = new ArrayList(inputs); + + for(int i = 0; i < inv.getSizeInventory(); i++) { + ItemStack stack = inv.getStackInSlot(i); + if(stack == null) + break; + + int stackIndex = -1, oredictIndex = -1; + + for(int j = 0; j < inputsMissing.size(); j++) { + Object input = inputsMissing.get(j); + if(input instanceof String) { + List validStacks = OreDictionary.getOres((String) input); + boolean found = false; + for(ItemStack ostack : validStacks) { + ItemStack cstack = ostack.copy(); + if(cstack.getItemDamage() == Short.MAX_VALUE) + cstack.setItemDamage(stack.getItemDamage()); + + if(stack.isItemEqual(cstack)) { + oredictIndex = j; + found = true; + break; + } + } + + + if(found) + break; + } else if(input instanceof ItemStack && simpleAreStacksEqual((ItemStack) input, stack)) { + stackIndex = j; + break; + } + } + + if(stackIndex != -1) + inputsMissing.remove(stackIndex); + else if(oredictIndex != -1) + inputsMissing.remove(oredictIndex); + else return false; + } + + return inputsMissing.isEmpty(); + } + + boolean simpleAreStacksEqual(ItemStack stack, ItemStack stack2) { + return stack.getItem() == stack2.getItem() && stack.getItemDamage() == stack2.getItemDamage(); + } + + public List getInputs() { + return new ArrayList(inputs); + } + + public ItemStack getOutput() { + return output; + } + +} diff --git a/1.7.10/api/java/vazkii/botania/api/recipe/RecipeRuneAltar.java b/1.7.10/api/java/vazkii/botania/api/recipe/RecipeRuneAltar.java new file mode 100644 index 00000000..745c9573 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/recipe/RecipeRuneAltar.java @@ -0,0 +1,31 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Feb 5, 2014, 1:41:14 PM (GMT)] + */ +package vazkii.botania.api.recipe; + +import net.minecraft.item.ItemStack; + +public class RecipeRuneAltar extends RecipePetals { + + ItemStack output; + int mana; + + public RecipeRuneAltar(ItemStack output, int mana, Object... inputs) { + super(output, inputs); + this.output = output; + this.mana = mana; + } + + public int getManaUsage() { + return mana; + } + +} diff --git a/1.7.10/api/java/vazkii/botania/api/subtile/ISpecialFlower.java b/1.7.10/api/java/vazkii/botania/api/subtile/ISpecialFlower.java new file mode 100644 index 00000000..0ef31493 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/subtile/ISpecialFlower.java @@ -0,0 +1,21 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 22, 2014, 7:12:28 PM (GMT)] + */ +package vazkii.botania.api.subtile; + +/** + * The special flowers in botania implement this. Used for cases where + * BlockFlower would be checked against, but isn't convenient for + * the special flowers with effects. For Azanor and Lycaon. + */ +public interface ISpecialFlower { + +} diff --git a/1.7.10/api/java/vazkii/botania/api/subtile/ISubTileContainer.java b/1.7.10/api/java/vazkii/botania/api/subtile/ISubTileContainer.java new file mode 100644 index 00000000..ddfaee7f --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/subtile/ISubTileContainer.java @@ -0,0 +1,30 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Aug 26, 2014, 5:42:16 PM (GMT)] + */ +package vazkii.botania.api.subtile; + +/** + * A TileEntity that implements this contains a SubTileEntity. + */ +public interface ISubTileContainer { + + /** + * Gets the SubTile in this block. Generally shouldn't return null, but in that + * case use the fallback DummySubTile. + */ + public SubTileEntity getSubTile(); + + /** + * Sets the SubTile on this block from it's name. + */ + public void setSubTile(String name); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/subtile/SubTileEntity.java b/1.7.10/api/java/vazkii/botania/api/subtile/SubTileEntity.java new file mode 100644 index 00000000..619d00f3 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/subtile/SubTileEntity.java @@ -0,0 +1,126 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 24, 2014, 3:59:06 PM (GMT)] + */ +package vazkii.botania.api.subtile; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.IIcon; +import vazkii.botania.api.BotaniaAPI; +import vazkii.botania.api.lexicon.LexiconEntry; +import vazkii.botania.api.wand.IWandBindable; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * A Sub-TileEntity, this is used for the flower system. Make sure to map subclasses + * of this using BotaniaAPI.mapSubTile(String, Class). Any subclass of this must have + * a no parameter constructor. + */ +public class SubTileEntity { + + protected TileEntity supertile; + + /** The Tag items should use to store which sub tile they are. **/ + public static final String TAG_TYPE = "type"; + + public void setSupertile(TileEntity tile) { + supertile = tile; + } + + public boolean canUpdate() { + return false; + } + + public void onUpdate() { } + + /** + * Writes some extra data to a network packet. This data is read + * by readFromPacketNBT on the client that receives the packet. + * Note: This method is also used to write to the world NBT. + */ + public void writeToPacketNBT(NBTTagCompound cmp) { } + + /** + * Reads data from a network packet. This data is written by + * writeToPacketNBT in the server. Note: This method is also used + * to read from the world NBT. + */ + public void readFromPacketNBT(NBTTagCompound cmp) { } + + public void sync() { + supertile.getWorldObj().markBlockForUpdate(supertile.xCoord, supertile.yCoord, supertile.zCoord); + } + + public String getUnlocalizedName() { + return BotaniaAPI.getSubTileStringMapping(getClass()); + } + + /** + * Gets the icon for this SubTileEntity, this is a block icon. + */ + @SideOnly(Side.CLIENT) + public IIcon getIcon() { + return BotaniaAPI.internalHandler.getSubTileIconForName(getUnlocalizedName()); + } + + /** + * Called when a Wand of the Forest is used on this sub tile. Note that the + * player parameter can be null if this is called from a dispenser. + */ + public boolean onWanded(EntityPlayer player, ItemStack wand) { + return false; + } + + /** + * Gets which Lexicon Entry to open when this sub tile is right clicked with a lexicon. + */ + public LexiconEntry getEntry() { + return null; + } + + /** + * Gets the block coordinates this is bound to, for use with the wireframe render + * when the sub tile is being hovered with a wand of the forest. + */ + @SideOnly(Side.CLIENT) + public ChunkCoordinates getBinding() { + return null; + } + + /** + * @see IWandBindable#canSelect(EntityPlayer, ItemStack, int, int, int, int) + */ + public boolean canSelect(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) { + return false; + } + + /** + * @see IWandBindable#bindTo(EntityPlayer, ItemStack, int, int, int, int) + */ + public boolean bindTo(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) { + return false; + } + + /** + * Called on the client when the block being pointed at is the one with this sub tile. + * Used to render a HUD portraying some data from this sub tile. + */ + @SideOnly(Side.CLIENT) + public void renderHUD(Minecraft mc, ScaledResolution res) { + // NO-OP + } +} diff --git a/1.7.10/api/java/vazkii/botania/api/subtile/SubTileFunctional.java b/1.7.10/api/java/vazkii/botania/api/subtile/SubTileFunctional.java new file mode 100644 index 00000000..7d95afe7 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/subtile/SubTileFunctional.java @@ -0,0 +1,212 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 24, 2014, 8:03:44 PM (GMT)] + */ +package vazkii.botania.api.subtile; + +import java.awt.Color; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.StatCollector; +import net.minecraftforge.common.util.ForgeDirection; +import vazkii.botania.api.BotaniaAPI; +import vazkii.botania.api.internal.IManaNetwork; +import vazkii.botania.api.mana.IManaPool; + +/** + * The basic class for a Functional Flower. + */ +public class SubTileFunctional extends SubTileEntity { + + private static final String TAG_MANA = "mana"; + + private static final String TAG_POOL_X = "poolX"; + private static final String TAG_POOL_Y = "poolY"; + private static final String TAG_POOL_Z = "poolZ"; + + public int mana; + + public int redstoneSignal = 0; + + int sizeLastCheck = -1; + TileEntity linkedPool = null; + public int knownMana = -1; + + ChunkCoordinates cachedPoolCoordinates = null; + + @Override + public boolean canUpdate() { + return true; + } + + /** + * If set to true, redstoneSignal will be updated every tick. + */ + public boolean acceptsRedstone() { + return false; + } + + @Override + public void onUpdate() { + super.onUpdate(); + + linkPool(); + + if(linkedPool != null) { + IManaPool pool = (IManaPool) linkedPool; + int manaInPool = pool.getCurrentMana(); + int manaMissing = getMaxMana() - mana; + int manaToRemove = Math.min(manaMissing, manaInPool); + pool.recieveMana(-manaToRemove); + addMana(manaToRemove); + } + + if(acceptsRedstone()) { + redstoneSignal = 0; + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + int redstoneSide = supertile.getWorldObj().getIndirectPowerLevelTo(supertile.xCoord + dir.offsetX, supertile.yCoord + dir.offsetY, supertile.zCoord + dir.offsetZ, dir.ordinal()); + redstoneSignal = Math.max(redstoneSignal, redstoneSide); + } + } + + if(supertile.getWorldObj().isRemote) { + double particleChance = 1F - (double) mana / (double) getMaxMana() / 3.5F; + Color color = new Color(getColor()); + if(Math.random() > particleChance) + BotaniaAPI.internalHandler.sparkleFX(supertile.getWorldObj(), supertile.xCoord + 0.3 + Math.random() * 0.5, supertile.yCoord + 0.5 + Math.random() * 0.5, supertile.zCoord + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5); + } + } + + public void linkPool() { + final int range = 10; + + boolean needsNew = false; + if(linkedPool == null) { + needsNew = true; + + if(cachedPoolCoordinates != null && supertile.getWorldObj().blockExists(cachedPoolCoordinates.posX, cachedPoolCoordinates.posY, cachedPoolCoordinates.posZ)) { + TileEntity tileAt = supertile.getWorldObj().getTileEntity(cachedPoolCoordinates.posX, cachedPoolCoordinates.posY, cachedPoolCoordinates.posZ); + if(tileAt != null && tileAt instanceof IManaPool) { + linkedPool = tileAt; + needsNew = false; + } + cachedPoolCoordinates = null; + } + } + + if(!needsNew) { + TileEntity tileAt = supertile.getWorldObj().getTileEntity(linkedPool.xCoord, linkedPool.yCoord, linkedPool.zCoord); + if(!(tileAt instanceof IManaPool)) { + linkedPool = null; + needsNew = true; + } else linkedPool = tileAt; + } + + if(needsNew) { + IManaNetwork network = BotaniaAPI.internalHandler.getManaNetworkInstance(); + int size = network.getAllPoolsInWorld(supertile.getWorldObj()).size(); + if(BotaniaAPI.internalHandler.shouldForceCheck() || size != sizeLastCheck) { + ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord, supertile.yCoord, supertile.zCoord); + linkedPool = network.getClosestPool(coords, supertile.getWorldObj(), range); + sizeLastCheck = size; + } + } + } + + public void addMana(int mana) { + this.mana = Math.min(getMaxMana(), this.mana + mana); + } + + @Override + public boolean onWanded(EntityPlayer player, ItemStack wand) { + if(player == null) + return false; + + knownMana = mana; + player.worldObj.playSoundAtEntity(player, "botania:ding", 0.1F, 1F); + + return super.onWanded(player, wand); + } + + public int getMaxMana() { + return 20; + } + + public int getColor() { + return 0xFFFFFF; + } + + @Override + public void readFromPacketNBT(NBTTagCompound cmp) { + mana = cmp.getInteger(TAG_MANA); + + int x = cmp.getInteger(TAG_POOL_X); + int y = cmp.getInteger(TAG_POOL_Y); + int z = cmp.getInteger(TAG_POOL_Z); + + cachedPoolCoordinates = new ChunkCoordinates(x, y, z); + } + + @Override + public void writeToPacketNBT(NBTTagCompound cmp) { + cmp.setInteger(TAG_MANA, mana); + + int x = linkedPool == null ? 0 : linkedPool.xCoord; + int y = linkedPool == null ? -1 : linkedPool.yCoord; + int z = linkedPool == null ? 0 : linkedPool.zCoord; + + cmp.setInteger(TAG_POOL_X, x); + cmp.setInteger(TAG_POOL_Y, y); + cmp.setInteger(TAG_POOL_Z, z); + } + + @Override + public ChunkCoordinates getBinding() { + if(linkedPool == null) + return null; + return new ChunkCoordinates(linkedPool.xCoord, linkedPool.yCoord, linkedPool.zCoord); + } + + @Override + public boolean canSelect(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) { + return true; + } + + @Override + public boolean bindTo(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) { + int range = 10; + range *= range; + + double dist = (x - supertile.xCoord) * (x - supertile.xCoord) + (y - supertile.yCoord) * (y - supertile.yCoord) + (z - supertile.zCoord) * (z - supertile.zCoord); + if(range >= dist) { + TileEntity tile = player.worldObj.getTileEntity(x, y, z); + if(tile instanceof IManaPool) { + linkedPool = tile; + return true; + } + } + + return false; + } + + @Override + public void renderHUD(Minecraft mc, ScaledResolution res) { + String name = StatCollector.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name"); + int color = 0x66000000 | getColor(); + BotaniaAPI.internalHandler.drawSimpleManaHUD(color, knownMana, getMaxMana(), name, res); + } + +} diff --git a/1.7.10/api/java/vazkii/botania/api/subtile/SubTileGenerating.java b/1.7.10/api/java/vazkii/botania/api/subtile/SubTileGenerating.java new file mode 100644 index 00000000..9c44868d --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/subtile/SubTileGenerating.java @@ -0,0 +1,245 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 24, 2014, 8:03:36 PM (GMT)] + */ +package vazkii.botania.api.subtile; + +import java.awt.Color; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.StatCollector; +import vazkii.botania.api.BotaniaAPI; +import vazkii.botania.api.internal.IManaNetwork; +import vazkii.botania.api.mana.IManaCollector; + +/** + * The basic class for a Generating Flower. + */ +public class SubTileGenerating extends SubTileEntity { + + private static final String TAG_MANA = "mana"; + private static final String TAG_TICKS_EXISTED = "ticksExisted"; + + private static final String TAG_COLLECTOR_X = "collectorX"; + private static final String TAG_COLLECTOR_Y = "collectorY"; + private static final String TAG_COLLECTOR_Z = "collectorZ"; + + protected int mana; + + int ticksExisted = 0; + int sizeLastCheck = -1; + protected TileEntity linkedCollector = null; + public int knownMana = -1; + + ChunkCoordinates cachedCollectorCoordinates = null; + + @Override + public boolean canUpdate() { + return true; + } + + @Override + public void onUpdate() { + super.onUpdate(); + + linkCollector(); + + if(canGeneratePassively()) { + int delay = getDelayBetweenPassiveGeneration(); + if(delay > 0 && supertile.getWorldObj().getWorldTime() % delay == 0) { + if(shouldSyncPassiveGeneration()) + sync(); + addMana(getValueForPassiveGeneration()); + } + } + emptyManaIntoCollector(); + + if(supertile.getWorldObj().isRemote) { + double particleChance = 1F - (double) mana / (double) getMaxMana() / 3.5F; + Color color = new Color(getColor()); + if(Math.random() > particleChance) + BotaniaAPI.internalHandler.sparkleFX(supertile.getWorldObj(), supertile.xCoord + 0.3 + Math.random() * 0.5, supertile.yCoord + 0.5 + Math.random() * 0.5, supertile.zCoord + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5); + } + + if(!supertile.getWorldObj().isRemote) { + ++ticksExisted; + int muhBalance = BotaniaAPI.internalHandler.getPassiveFlowerDecay(); + + if(isPassiveFlower() && muhBalance > 0 && ticksExisted > muhBalance) { + supertile.getWorldObj().playAuxSFX(2001, supertile.xCoord, supertile.yCoord, supertile.zCoord, Block.getIdFromBlock(supertile.getBlockType())); + supertile.getWorldObj().setBlockToAir(supertile.xCoord, supertile.yCoord, supertile.zCoord); + } + } + } + + public void linkCollector() { + final int range = 6; + + boolean needsNew = false; + if(linkedCollector == null) { + needsNew = true; + + if(cachedCollectorCoordinates != null && supertile.getWorldObj().blockExists(cachedCollectorCoordinates.posX, cachedCollectorCoordinates.posY, cachedCollectorCoordinates.posZ)) { + TileEntity tileAt = supertile.getWorldObj().getTileEntity(cachedCollectorCoordinates.posX, cachedCollectorCoordinates.posY, cachedCollectorCoordinates.posZ); + if(tileAt != null && tileAt instanceof IManaCollector) { + linkedCollector = tileAt; + needsNew = false; + } + cachedCollectorCoordinates = null; + } + } + + if(!needsNew) { + TileEntity tileAt = supertile.getWorldObj().getTileEntity(linkedCollector.xCoord, linkedCollector.yCoord, linkedCollector.zCoord); + if(!(tileAt instanceof IManaCollector)) { + linkedCollector = null; + needsNew = true; + } else linkedCollector = tileAt; + } + + if(needsNew) { + IManaNetwork network = BotaniaAPI.internalHandler.getManaNetworkInstance(); + int size = network.getAllCollectorsInWorld(supertile.getWorldObj()).size(); + if(BotaniaAPI.internalHandler.shouldForceCheck() || size != sizeLastCheck) { + ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord, supertile.yCoord, supertile.zCoord); + linkedCollector = network.getClosestCollector(coords, supertile.getWorldObj(), range); + sizeLastCheck = size; + } + } + } + + public void addMana(int mana) { + this.mana = Math.min(getMaxMana(), this.mana + mana); + } + + public void emptyManaIntoCollector() { + if(linkedCollector != null) { + IManaCollector collector = (IManaCollector) linkedCollector; + if(!collector.isFull() && mana > 0) { + int manaval = Math.min(mana, collector.getMaxMana() - collector.getCurrentMana()); + mana -= manaval; + collector.recieveMana(manaval); + } + } + } + + public boolean isPassiveFlower() { + return false; + } + + public boolean shouldSyncPassiveGeneration() { + return false; + } + + public boolean canGeneratePassively() { + return false; + } + + public int getDelayBetweenPassiveGeneration() { + return 20; + } + + public int getValueForPassiveGeneration() { + return 1; + } + + @Override + public boolean onWanded(EntityPlayer player, ItemStack wand) { + if(player == null) + return false; + + if(!player.worldObj.isRemote) + sync(); + + knownMana = mana; + player.worldObj.playSoundAtEntity(player, "botania:ding", 0.1F, 1F); + + return super.onWanded(player, wand); + } + + public int getMaxMana() { + return 20; + } + + public int getColor() { + return 0xFFFFFF; + } + + @Override + public void readFromPacketNBT(NBTTagCompound cmp) { + mana = cmp.getInteger(TAG_MANA); + if(!cmp.hasKey(TAG_TICKS_EXISTED)) + ticksExisted = cmp.getInteger(TAG_TICKS_EXISTED); + + int x = cmp.getInteger(TAG_COLLECTOR_X); + int y = cmp.getInteger(TAG_COLLECTOR_Y); + int z = cmp.getInteger(TAG_COLLECTOR_Z); + + cachedCollectorCoordinates = new ChunkCoordinates(x, y, z); + } + + @Override + public void writeToPacketNBT(NBTTagCompound cmp) { + cmp.setInteger(TAG_MANA, mana); + cmp.setInteger(TAG_TICKS_EXISTED, ticksExisted); + + int x = linkedCollector == null ? 0 : linkedCollector.xCoord; + int y = linkedCollector == null ? -1 : linkedCollector.yCoord; + int z = linkedCollector == null ? 0 : linkedCollector.zCoord; + + cmp.setInteger(TAG_COLLECTOR_X, x); + cmp.setInteger(TAG_COLLECTOR_Y, y); + cmp.setInteger(TAG_COLLECTOR_Z, z); + } + + @Override + public ChunkCoordinates getBinding() { + if(linkedCollector == null) + return null; + return new ChunkCoordinates(linkedCollector.xCoord, linkedCollector.yCoord, linkedCollector.zCoord); + } + + @Override + public boolean canSelect(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) { + return true; + } + + @Override + public boolean bindTo(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) { + int range = 6; + range *= range; + + double dist = (x - supertile.xCoord) * (x - supertile.xCoord) + (y - supertile.yCoord) * (y - supertile.yCoord) + (z - supertile.zCoord) * (z - supertile.zCoord); + if(range >= dist) { + TileEntity tile = player.worldObj.getTileEntity(x, y, z); + if(tile instanceof IManaCollector) { + linkedCollector = tile; + return true; + } + } + + return false; + } + + @Override + public void renderHUD(Minecraft mc, ScaledResolution res) { + String name = StatCollector.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name"); + int color = 0x66000000 | getColor(); + BotaniaAPI.internalHandler.drawSimpleManaHUD(color, knownMana, getMaxMana(), name, res); + } + +} diff --git a/1.7.10/api/java/vazkii/botania/api/wand/ICoordBoundItem.java b/1.7.10/api/java/vazkii/botania/api/wand/ICoordBoundItem.java new file mode 100644 index 00000000..f7c8036d --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/wand/ICoordBoundItem.java @@ -0,0 +1,18 @@ +package vazkii.botania.api.wand; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChunkCoordinates; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * The item equivalent of ITileBound, renders when the + * item is in hand. + * @see ITileBound + */ +public interface ICoordBoundItem { + + @SideOnly(Side.CLIENT) + public ChunkCoordinates getBinding(ItemStack stack); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/wand/ITileBound.java b/1.7.10/api/java/vazkii/botania/api/wand/ITileBound.java new file mode 100644 index 00000000..25a8683c --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/wand/ITileBound.java @@ -0,0 +1,31 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Mar 24, 2014, 6:47:53 PM (GMT)] + */ +package vazkii.botania.api.wand; + +import net.minecraft.util.ChunkCoordinates; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * Any TileEntity that implements this is technically bound + * to something, and the binding will be shown when hovering + * over with a Wand of the Forest. + */ +public interface ITileBound { + + /** + * Gets where this block is bound to, can return null. + */ + @SideOnly(Side.CLIENT) + public ChunkCoordinates getBinding(); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/wand/IWandBindable.java b/1.7.10/api/java/vazkii/botania/api/wand/IWandBindable.java new file mode 100644 index 00000000..02d0771c --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/wand/IWandBindable.java @@ -0,0 +1,36 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Oct 9, 2014, 3:01:58 PM (GMT)] + */ +package vazkii.botania.api.wand; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MovingObjectPosition; + +/** + * A TileEntity that implements this can be bound to another block + * via the Wand of the Forest. Also see IWireframeAABBProvider to change + * the displayed bounding box. + */ +public interface IWandBindable extends ITileBound { + + /** + * Return true if the Wand can select this tile. + */ + public boolean canSelect(EntityPlayer player, ItemStack wand, int x, int y, int z, int side); + + /** + * Call to bind the TileEntity to where the player clicked. Return true to deselect + * the TileEntity for another bind or false case the TileEntity should stay selected. + */ + public boolean bindTo(EntityPlayer player, ItemStack wand, int x, int y, int z, int side); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/wand/IWandHUD.java b/1.7.10/api/java/vazkii/botania/api/wand/IWandHUD.java new file mode 100644 index 00000000..57c7e313 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/wand/IWandHUD.java @@ -0,0 +1,26 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Feb 5, 2014, 1:34:44 PM (GMT)] + */ +package vazkii.botania.api.wand; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.world.World; + +/** + * Any block that implements this has a HUD rendered when being hovered + * with a Wand of the Forest. + */ +public interface IWandHUD { + + public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/wand/IWandable.java b/1.7.10/api/java/vazkii/botania/api/wand/IWandable.java new file mode 100644 index 00000000..0cdcf1f1 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/wand/IWandable.java @@ -0,0 +1,29 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jan 22, 2014, 5:12:53 PM (GMT)] + */ +package vazkii.botania.api.wand; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * Any block that implements this can be used with the Wand for the Forest for some purpose. + */ +public interface IWandable { + + /** + * Called when the block is used by a wand. Note that the player parameter can be null + * if this function is called from a dispenser. + */ + public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/wand/IWireframeAABBProvider.java b/1.7.10/api/java/vazkii/botania/api/wand/IWireframeAABBProvider.java new file mode 100644 index 00000000..d20b6660 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/wand/IWireframeAABBProvider.java @@ -0,0 +1,25 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Apr 19, 2014, 7:23:59 PM (GMT)] + */ +package vazkii.botania.api.wand; + +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; + +/** + * A block that implements this can provide a custom AABB + * for rendering the wireframe with ITileBound. + */ +public interface IWireframeAABBProvider { + + public AxisAlignedBB getWireframeAABB(World world, int x, int y, int z); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/wiki/IWikiProvider.java b/1.7.10/api/java/vazkii/botania/api/wiki/IWikiProvider.java new file mode 100644 index 00000000..42e61147 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/wiki/IWikiProvider.java @@ -0,0 +1,39 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Sep 2, 2014, 5:57:35 PM (GMT)] + */ +package vazkii.botania.api.wiki; + +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +/** + * An interface for a Wiki Provider, these are registered to allow a mod to provide a wiki + * for all the blocks in them, used for the world interaction with the Lexica Botania. + * A simple, mostly all-inclusive implementation can be found on SimpleWikiProvider. + */ +public interface IWikiProvider { + + /** + * Gets the name of the block being looked at for display. + */ + public String getBlockName(World world, MovingObjectPosition pos); + + /** + * Gets the URL to open when the block is clicked. + */ + public String getWikiURL(World world, MovingObjectPosition pos); + + /** + * Gets the name of the wiki for display. + */ + public String getWikiName(World world, MovingObjectPosition pos); + +} diff --git a/1.7.10/api/java/vazkii/botania/api/wiki/SimpleWikiProvider.java b/1.7.10/api/java/vazkii/botania/api/wiki/SimpleWikiProvider.java new file mode 100644 index 00000000..6105c718 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/wiki/SimpleWikiProvider.java @@ -0,0 +1,73 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Sep 2, 2014, 5:58:39 PM (GMT)] + */ +package vazkii.botania.api.wiki; + +import org.apache.commons.lang3.text.WordUtils; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class SimpleWikiProvider implements IWikiProvider { + + final String name, urlBase, replacement; + + public SimpleWikiProvider(String name, String urlBase) { + this(name, urlBase, "%20"); + } + + public SimpleWikiProvider(String name, String urlBase, String replacement) { + this.name = name; + this.urlBase = urlBase; + this.replacement = replacement; + } + + @Override + public String getBlockName(World world, MovingObjectPosition pos) { + int x = pos.blockX; + int y = pos.blockY; + int z = pos.blockZ; + + Block block = world.getBlock(x, y, z); + if(block == null) + return null; + + ItemStack stack = block.getPickBlock(pos, world, x, y, z); + + if(stack == null || stack.getItem() == null) + stack = new ItemStack(block, 1, world.getBlockMetadata(x, y, z)); + + if(stack.getItem() == null) + return null; + + String name = stack.getDisplayName(); + if(name == null || name.isEmpty()) + return null; + + return name; + } + + @Override + public String getWikiURL(World world, MovingObjectPosition pos) { + String name = getBlockName(world, pos); + if(name == null) + return null; + return String.format(urlBase, WordUtils.capitalizeFully(name).replaceAll(" ", replacement)); + } + + @Override + public String getWikiName(World world, MovingObjectPosition pos) { + return name; + } + +} diff --git a/1.7.10/api/java/vazkii/botania/api/wiki/WikiHooks.java b/1.7.10/api/java/vazkii/botania/api/wiki/WikiHooks.java new file mode 100644 index 00000000..40f586e6 --- /dev/null +++ b/1.7.10/api/java/vazkii/botania/api/wiki/WikiHooks.java @@ -0,0 +1,43 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Sep 2, 2014, 6:05:03 PM (GMT)] + */ +package vazkii.botania.api.wiki; + +import java.util.HashMap; +import java.util.Map; + +import net.minecraft.block.Block; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; + +public class WikiHooks { + + private static final IWikiProvider FALLBACK_PROVIDER = new SimpleWikiProvider("FTB Wiki", "http://wiki.feed-the-beast.com/%s"); + + private static final Map modWikis = new HashMap(); + + public static IWikiProvider getWikiFor(Block block) { + UniqueIdentifier mod = GameRegistry.findUniqueIdentifierFor(block); + return getWikiFor(mod.modId.toLowerCase()); + } + + public static IWikiProvider getWikiFor(String mod) { + if(!modWikis.containsKey(mod)) + modWikis.put(mod, FALLBACK_PROVIDER); + + return modWikis.get(mod); + } + + public static void registerModWiki(String mod, IWikiProvider provider) { + modWikis.put(mod.toLowerCase(), provider); + } + +} diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java index abff05cc..febb24e5 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java @@ -126,6 +126,7 @@ public class AlchemicalWizardry public static boolean isThaumcraftLoaded; public static boolean isForestryLoaded; + public static boolean isBotaniaLoaded; public static boolean wimpySettings; public static boolean respawnWithDebuff; @@ -853,6 +854,8 @@ public class AlchemicalWizardry MineTweakerIntegration.register(); System.out.println("Loaded MineTweaker 3 Integration"); } + + this.isBotaniaLoaded = Loader.isModLoaded("Botania"); BloodMagicConfiguration.loadBlacklist(); } diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java index 8e3bd318..205ff4b2 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java @@ -1,13 +1,11 @@ package WayofTime.alchemicalWizardry.common; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; -import cpw.mods.fml.common.ObfuscationReflectionHelper; -import cpw.mods.fml.common.eventhandler.Event.Result; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IProjectile; @@ -28,8 +26,15 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn; - -import java.util.*; +import vazkii.botania.api.internal.IManaBurst; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; +import cpw.mods.fml.common.ObfuscationReflectionHelper; +import cpw.mods.fml.common.eventhandler.Event.Result; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; public class AlchemicalWizardryEventHooks { @@ -317,7 +322,7 @@ public class AlchemicalWizardryEventHooks continue; } - if (!(projectile instanceof IProjectile)) + if (!(projectile instanceof IProjectile) || (projectile instanceof IManaBurst)) { continue; }