Added Spellbinding Cloth from TT.

This commit is contained in:
Lizbeth Rika committed 2015-01-25 18:28:45 +00:00
1 parent ee9d87de04
commit 158002ade7
8 files changed
+139

No files matched your search

@@ -98,6 +98,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
addBlock(ModBlocks.forestEye);
addBlock(ModBlocks.enderEye);
addItem(ModItems.enderHand);
addItem(ModItems.spellCloth);
addItem(ModItems.craftingHalo);
addItem(ModItems.spawnerMover);
addBlock(ModBlocks.spawnerClaw);
@@ -0,0 +1,75 @@
/**
* 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 a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Jan 25, 2015, 6:16:13 PM (GMT)]
*/
package vazkii.botania.common.crafting.recipe;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import vazkii.botania.common.item.ModItems;
public class SpellClothRecipe implements IRecipe {
@Override
public boolean matches(InventoryCrafting var1, World var2) {
boolean foundCloth = false;
boolean foundEnchanted = false;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(stack.isItemEnchanted() && !foundEnchanted)
foundEnchanted = true;
else if(stack.getItem() == ModItems.spellCloth && !foundCloth)
foundCloth = true;
else return false; // Found an invalid item, breaking the recipe
}
}
return foundCloth && foundEnchanted;
}
@Override
public ItemStack getCraftingResult(InventoryCrafting var1) {
ItemStack stackToDisenchant = null;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null && stack.isItemEnchanted()) {
stackToDisenchant = stack.copy();
break;
}
}
if(stackToDisenchant == null)
return null;
NBTTagCompound cmp = (NBTTagCompound) stackToDisenchant.getTagCompound().copy();
cmp.removeTag("ench"); // Remove enchantments
stackToDisenchant.setTagCompound(cmp);
return stackToDisenchant;
}
@Override
public int getRecipeSize() {
return 10;
}
@Override
public ItemStack getRecipeOutput() {
return null;
}
}
@@ -0,0 +1,59 @@
/**
* 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 a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Jan 25, 2015, 6:14:13 PM (GMT)]
*/
package vazkii.botania.common.item;
import java.awt.Color;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.RecipeSorter.Category;
import vazkii.botania.common.crafting.recipe.SpellClothRecipe;
import vazkii.botania.common.lib.LibItemNames;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemSpellCloth extends ItemMod {
public ItemSpellCloth() {
setMaxDamage(35);
setMaxStackSize(1);
setNoRepair();
setUnlocalizedName(LibItemNames.SPELL_CLOTH);
GameRegistry.addRecipe(new SpellClothRecipe());
RecipeSorter.register("botania:spellCloth", SpellClothRecipe.class, Category.SHAPELESS, "");
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack par1ItemStack, int par2) {
return Color.HSBtoRGB(0.75F, ((float) par1ItemStack.getMaxDamage() - (float) par1ItemStack.getItemDamage()) / par1ItemStack.getMaxDamage() * 0.5F, 1F);
}
@Override
public boolean hasContainerItem() {
return true;
}
@Override
public ItemStack getContainerItem(ItemStack itemStack) {
itemStack.setItemDamage(itemStack.getItemDamage() + 1);
return itemStack;
}
@Override
public boolean doesContainerItemLeaveCraftingGrid(ItemStack par1ItemStack) {
return false;
}
}
@@ -197,6 +197,7 @@ public final class ModItems {
public static Item cobbleRod;
public static Item smeltRod;
public static Item worldSeed;
public static Item spellCloth;
public static void init() {
lexicon = new ItemLexicon();
@@ -301,6 +302,7 @@ public final class ModItems {
cobbleRod = new ItemCobbleRod();
smeltRod = new ItemSmeltRod();
worldSeed = new ItemWorldSeed();
spellCloth = new ItemSpellCloth();
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
for(int i = 0; i < 16; i++) {
@@ -116,6 +116,7 @@ public final class LibItemNames {
public static final String COBBLE_ROD = "cobbleRod";
public static final String SMELT_ROD = "smeltRod";
public static final String WORLD_SEED = "worldSeed";
public static final String SPELL_CLOTH = "spellCloth";
public static final String[] LENS_NAMES = new String[] {
"lensNormal",