Package thaumic.tinkerer.common.item

Source Code of thaumic.tinkerer.common.item.ItemSpellCloth

/**
* This class was created by <Vazkii>. It's distributed as
* part of the ThaumicTinkerer Mod.
*
* ThaumicTinkerer 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)
*
* ThaumicTinkerer is a Derivative Work on Thaumcraft 4.
* Thaumcraft 4 (c) Azanor 2012
* (http://www.minecraftforum.net/topic/1585216-)
*
* File Created @ [9 Sep 2013, 01:20:22 (GMT)]
*/
package thaumic.tinkerer.common.item;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumcraft.common.config.ConfigItems;
import thaumic.tinkerer.common.lib.LibFeatures;
import thaumic.tinkerer.common.lib.LibItemNames;
import thaumic.tinkerer.common.lib.LibResearch;
import thaumic.tinkerer.common.registry.ItemBase;
import thaumic.tinkerer.common.registry.ThaumicTinkererCrucibleRecipe;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;

import java.awt.*;

public class ItemSpellCloth extends ItemBase {

  public ItemSpellCloth() {
    super();
    setMaxDamage(LibFeatures.SPELL_CLOTH_USES);
    setMaxStackSize(1);
    setNoRepair();

    CraftingManager.getInstance().getRecipeList().add(new SpellClothRecipe(this));
  }

  @Override
  public boolean shouldDisplayInTab() {
    return true;
  }

  @Override
  public IRegisterableResearch getResearchItem() {

    IRegisterableResearch research = (TTResearchItem) new TTResearchItem(LibResearch.KEY_SPELL_CLOTH, new AspectList().add(Aspect.MAGIC, 2).add(Aspect.CLOTH, 1), 3, 2, 2, new ItemStack(this)).setParentsHidden("ENCHFABRIC")
        .setPages(new ResearchPage("0"), ResearchHelper.crucibleRecipePage(LibResearch.KEY_SPELL_CLOTH));
    return research;

  }

  @Override
  public ThaumicTinkererRecipe getRecipeItem() {
    return new ThaumicTinkererCrucibleRecipe(LibResearch.KEY_SPELL_CLOTH, new ItemStack(this), new ItemStack(ConfigItems.itemResource, 0, 7), new AspectList().add(Aspect.MAGIC, 10).add(Aspect.ENTROPY, 6).add(Aspect.EXCHANGE, 4));

  }

  @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;
  }

  @Override
  @SideOnly(Side.CLIENT)
  public boolean hasEffect(ItemStack par1ItemStack) {
    return false;
  }

  @Override
  @SideOnly(Side.CLIENT)
  public EnumRarity getRarity(ItemStack par1ItemStack) {
    return EnumRarity.uncommon;
  }

  @Override
  public String getItemName() {
    return LibItemNames.SPELL_CLOTH;
  }
}
TOP

Related Classes of thaumic.tinkerer.common.item.ItemSpellCloth

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.