Added Phantom Ink.

This commit is contained in:
Lizbeth Rika committed 2015-03-17 18:08:56 +00:00
1 parent 1c47d1ff3c
commit a6ce966292
21 files changed
+180 -11

No files matched your search

@@ -0,0 +1,24 @@
/**
* This class was created by <Vazkii>. 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 the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 17, 2015, 4:57:44 PM (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.item.ItemStack;
/**
* An Item that implements this can be crafted with Phantom Ink.
*/
public interface IPhantomInkable {
public boolean hasPhantomInk(ItemStack stack);
public void setPhantomInk(ItemStack stack, boolean ink);
}
@@ -1,4 +1,4 @@
@API(owner = "Botania", apiVersion = "35", provides = "BotaniaAPI")
@API(owner = "Botania", apiVersion = "36", provides = "BotaniaAPI")
package vazkii.botania.api;
import cpw.mods.fml.common.API;
@@ -14,6 +14,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.StatCollector;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import vazkii.botania.api.item.IPhantomInkable;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.ItemRegenIvy;
import cpw.mods.fml.common.eventhandler.EventPriority;
@@ -102,7 +102,8 @@ public final class LibResources {
public static final String MODEL_HOLY_CLOAK = PREFIX_MODEL + "holyCloak.png";
public static final String MODEL_UNHOLY_CLOAK = PREFIX_MODEL + "unholyCloak.png";
public static final String MODEL_CORPOREA_INDEX = PREFIX_MODEL + "corporeaIndex.png";
public static final String MODEL_INVISIBLE_ARMOR = PREFIX_MODEL + "invisibleArmor.png";
public static final String MODEL_CAPE = "/assets/botania/textures/model/cape.png";
public static final String MISC_PARTICLES = PREFIX_MISC + "particles.png";
@@ -63,6 +63,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
addItem(ModItems.pestleAndMortar);
addItem(ModItems.dye);
addItem(ModItems.fertilizer);
addItem(ModItems.flowerBag);
addItem(ModItems.grassSeeds);
addItem(ModItems.blackLotus);
addItem(ModItems.twigWand);
@@ -170,6 +171,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
addItem(ModItems.terrasteelLegs);
addItem(ModItems.terrasteelBoots);
addItem(ModItems.ancientWill);
addItem(ModItems.phantomInk);
addItem(ModItems.tinyPlanet);
addBlock(ModBlocks.tinyPlanet);
@@ -241,6 +241,7 @@ public final class ModCraftingRecipes {
public static IRecipe recipeSwapRing;
public static IRecipe recipeSnowHorn;
public static IRecipe recipeFlowerBag;
public static IRecipe recipePhantomInk;
public static void init() {
// Lexicon Recipe
@@ -1600,6 +1601,10 @@ public final class ModCraftingRecipes {
'W', new ItemStack(Blocks.wool, 1, Short.MAX_VALUE));
recipeFlowerBag = BotaniaAPI.getLatestAddedRecipe();
// Phantom Ink Recipe
addShapelessOreDictRecipe(new ItemStack(ModItems.phantomInk, 4), LibOreDict.MANA_PEARL, new ItemStack(Items.dye), new ItemStack(Blocks.glass), new ItemStack(Items.glass_bottle), new ItemStack(Items.glass_bottle), new ItemStack(Items.glass_bottle), new ItemStack(Items.glass_bottle));
recipePhantomInk = BotaniaAPI.getLatestAddedRecipe();
// Storage Block Recipes
addOreDictRecipe(new ItemStack(ModBlocks.storage, 1, 0),
"III", "III", "III",
@@ -0,0 +1,73 @@
/**
* This class was created by <Vazkii>. 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 the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 17, 2015, 5:21:07 PM (GMT)]
*/
package vazkii.botania.common.crafting.recipe;
import vazkii.botania.api.item.IAncientWillContainer;
import vazkii.botania.api.item.IPhantomInkable;
import vazkii.botania.common.item.ModItems;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
public class PhantomInkRecipe implements IRecipe {
@Override
public boolean matches(InventoryCrafting var1, World var2) {
boolean foundInk = false;
boolean foundItem = false;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(stack.getItem() == ModItems.phantomInk && !foundInk)
foundInk = true;
else if(!foundItem) {
if(stack.getItem() instanceof IPhantomInkable)
foundItem = true;
else return false;
}
}
}
return foundInk && foundItem;
}
@Override
public ItemStack getCraftingResult(InventoryCrafting var1) {
ItemStack item = null;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null && stack.getItem() instanceof IPhantomInkable && item == null)
item = stack;
}
IPhantomInkable inkable = (IPhantomInkable) item.getItem();
if(inkable.hasPhantomInk(item))
return null;
ItemStack copy = item.copy();
inkable.setPhantomInk(copy, true);
return copy;
}
@Override
public int getRecipeSize() {
return 10;
}
@Override
public ItemStack getRecipeOutput() {
return null;
}
}
@@ -0,0 +1,28 @@
/**
* This class was created by <Vazkii>. 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 the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 17, 2015, 4:46:36 PM (GMT)]
*/
package vazkii.botania.common.item;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.RecipeSorter.Category;
import vazkii.botania.common.crafting.recipe.ManaGunLensRecipe;
import vazkii.botania.common.crafting.recipe.PhantomInkRecipe;
import vazkii.botania.common.lib.LibItemNames;
import cpw.mods.fml.common.registry.GameRegistry;
public class ItemPhantomInk extends ItemMod {
public ItemPhantomInk() {
setUnlocalizedName(LibItemNames.PHANTOM_INK);
GameRegistry.addRecipe(new PhantomInkRecipe());
RecipeSorter.register("botania:phantomInk", PhantomInkRecipe.class, Category.SHAPELESS, "");
}
}
@@ -211,7 +211,8 @@ public final class ModItems {
public static Item cosmetic;
public static Item swapRing;
public static Item flowerBag;
public static Item phantomInk;
public static void init() {
lexicon = new ItemLexicon();
petal = new ItemPetal();
@@ -326,6 +327,7 @@ public final class ModItems {
cosmetic = new ItemBaubleCosmetic();
swapRing = new ItemSwapRing();
flowerBag = new ItemFlowerBag();
phantomInk = new ItemPhantomInk();
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
for(int i = 0; i < 16; i++) {
@@ -19,7 +19,7 @@ public abstract class ItemElementiumArmor extends ItemManasteelArmor implements
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
public String getArmorTextureAfterInk(ItemStack stack, int slot) {
return slot == 2 ? LibResources.MODEL_ELEMENTIUM_1 : LibResources.MODEL_ELEMENTIUM_0;
}
@@ -26,21 +26,25 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.item.IPhantomInkable;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.core.BotaniaCreativeTab;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.tool.ToolCommons;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor, IManaUsingItem {
public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor, IManaUsingItem, IPhantomInkable {
private static final int MANA_PER_DAMAGE = 70;
private static final String TAG_PHANTOM_INK = "phantomInk";
public ItemManasteelArmor(int type, String name) {
this(type, name, BotaniaAPI.manasteelArmorMaterial);
}
@@ -96,7 +100,11 @@ public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor, IMan
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
public final String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
return hasPhantomInk(stack) ? LibResources.MODEL_INVISIBLE_ARMOR : getArmorTextureAfterInk(stack, slot);
}
public String getArmorTextureAfterInk(ItemStack stack, int slot) {
return slot == 2 ? LibResources.MODEL_MANASTEEL_1 : LibResources.MODEL_MANASTEEL_0;
}
@@ -118,6 +126,8 @@ public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor, IMan
ItemStack[] stacks = getArmorSetStacks();
for(int i = 0; i < stacks.length; i++)
addStringToTooltip((hasArmorSetItem(player, i) ? EnumChatFormatting.GREEN : "") + " - " + stacks[i].getDisplayName(), list);
if(hasPhantomInk(stack))
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.hasPhantomInk"), list);
} else addStringToTooltip(StatCollector.translateToLocal("botaniamisc.shiftinfo"), list);
}
@@ -179,4 +189,14 @@ public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor, IMan
addStringToTooltip(StatCollector.translateToLocal("botania.armorset.manasteel.desc"), list);
}
@Override
public boolean hasPhantomInk(ItemStack stack) {
return ItemNBTHelper.getBoolean(stack, TAG_PHANTOM_INK, false);
}
@Override
public void setPhantomInk(ItemStack stack, boolean ink) {
ItemNBTHelper.setBoolean(stack, TAG_PHANTOM_INK, true);
}
}
@@ -28,7 +28,7 @@ public class ItemTerrasteelArmor extends ItemManasteelArmor {
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
public String getArmorTextureAfterInk(ItemStack stack, int slot) {
return slot == 2 ? LibResources.MODEL_TERRASTEEL_1 : LibResources.MODEL_TERRASTEEL_0;
}
@@ -40,7 +40,7 @@ public class ItemElementiumHelmRevealing extends ItemElementiumHelm implements I
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
public String getArmorTextureAfterInk(ItemStack stack, int slot) {
return LibResources.MODEL_ELEMENTIUM_2;
}
@@ -40,7 +40,7 @@ public class ItemManasteelHelmRevealing extends ItemManasteelHelm implements IGo
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
public String getArmorTextureAfterInk(ItemStack stack, int slot) {
return LibResources.MODEL_MANASTEEL_2;
}
@@ -40,7 +40,7 @@ public class ItemTerrasteelHelmRevealing extends ItemTerrasteelHelm implements I
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
public String getArmorTextureAfterInk(ItemStack stack, int slot) {
return LibResources.MODEL_TERRASTEEL_2;
}
@@ -232,6 +232,7 @@ public final class LexiconData {
public static LexiconEntry starfield;
public static LexiconEntry dirtPath;
public static LexiconEntry mushrooms;
public static LexiconEntry phantomInk;
public static LexiconEntry tcIntegration;
public static LexiconEntry bcIntegration;
@@ -843,6 +844,9 @@ public final class LexiconData {
mushrooms = new BLexiconEntry(LibLexicon.MISC_MUSHROOMS, categoryMisc);
mushrooms.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipesMushrooms));
phantomInk = new BLexiconEntry(LibLexicon.MISC_PHANTOM_INK, categoryMisc);
phantomInk.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipePhantomInk));
if(Botania.bcTriggersLoaded) {
bcIntegration = new BLexiconEntry(LibLexicon.MISC_BC_INTEGRATION, categoryMisc);
bcIntegration.setLexiconPages(new PageText("0")).setIcon(new ItemStack(Items.redstone));
@@ -126,7 +126,8 @@ public final class LibItemNames {
public static final String COSMETIC = "cosmetic";
public static final String SWAP_RING = "swapRing";
public static final String FLOWER_BAG = "flowerBag";
public static final String PHANTOM_INK = "phantomInk";
public static final String[] LENS_NAMES = new String[] {
"lensNormal",
"lensSpeed",
@@ -203,6 +203,7 @@ public final class LibLexicon {
public static final String MISC_STARFIELD = "starfield";
public static final String MISC_DIRT_PATH = "dirtPath";
public static final String MISC_MUSHROOMS = "mushrooms";
public static final String MISC_PHANTOM_INK = "phantomInk";
public static final String MISC_TC_INTEGRATION = "tcIntegration";
public static final String MISC_BC_INTEGRATION = "bcIntegration";