BloodMagic/BM_src/WayofTime/alchemicalWizardry/common/items/thaumcraft/FocusBase.java
Fenn e3644f2d2b Massive rework of configs, items and blocks.
I redone where the items/blocsks are stored and how the configs are
handled to clean up it and give space. You can change the config line to
AWWayofTime if you want to keep the compatibility with old configs. Now
you reference the blocks from the ModBlocks and Items from the ModItems.
2014-01-17 21:05:38 +00:00

168 lines
4.2 KiB
Java

package WayofTime.alchemicalWizardry.common.items.thaumcraft;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.wands.IWandFocus;
import java.util.List;
public abstract class FocusBase extends EnergyItems implements IWandFocus {
protected Icon ornament, depth;
public FocusBase(int par1)
{
super(par1);
setMaxDamage(1);
setNoRepair();
setMaxStackSize(1);
}
boolean hasOrnament()
{
return false;
}
boolean hasDepth()
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
super.registerIcons(iconRegister);
// if(hasOrnament())
// {
// ornament = iconRegister.registerIcon("AlchemicalWizardry:" + this.getUnlocalizedName() + "Orn");
// }
// if(hasDepth())
// {
// depth = iconRegister.registerIcon("AlchemicalWizardry:" + this.getUnlocalizedName() + "Depth");
// }
}
@Override
public boolean isItemTool(ItemStack par1ItemStack)
{
return true;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
AspectList cost = getVisCost();
if (cost != null && cost.size() > 0)
{
par3List.add(StatCollector.translateToLocal(isVisCostPerTick() ? "item.Focus.cost2" : "item.Focus.cost1"));
for (Aspect aspect : cost.getAspectsSorted())
{
float amount = cost.getAmount(aspect) / 100.0F;
par3List.add(" " + '\u00a7' + aspect.getChatcolor() + aspect.getName() + '\u00a7' + "r x " + amount);
}
}
}
@Override
public int getItemEnchantability()
{
return 5;
}
@Override
public EnumRarity getRarity(ItemStack itemstack)
{
return EnumRarity.rare;
}
@Override
public Icon getOrnament()
{
return ornament;
}
@Override
public Icon getFocusDepthLayerIcon()
{
return depth;
}
@Override
public WandFocusAnimation getAnimation()
{
return WandFocusAnimation.WAVE;
}
@Override
public boolean isVisCostPerTick()
{
return false;
}
public boolean isUseItem()
{
return isVisCostPerTick();
}
@Override
public ItemStack onFocusRightClick(ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer, MovingObjectPosition paramMovingObjectPosition)
{
if (isUseItem())
{
paramEntityPlayer.setItemInUse(paramItemStack, Integer.MAX_VALUE);
}
return paramItemStack;
}
@Override
public void onUsingFocusTick(ItemStack paramItemStack, EntityPlayer paramEntityPlayer, int paramInt)
{
// NO-OP
}
@Override
public void onPlayerStoppedUsingFocus(ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer, int paramInt)
{
// NO-OP
}
@Override
public String getSortingHelper(ItemStack paramItemStack)
{
return "00";
}
@Override
public boolean onFocusBlockStartBreak(ItemStack paramItemStack, int paramInt1, int paramInt2, int paramInt3, EntityPlayer paramEntityPlayer)
{
return false;
}
@Override
public boolean acceptsEnchant(int id)
{
if (id == ThaumcraftApi.enchantFrugal ||
id == ThaumcraftApi.enchantPotency)
{
return true;
}
return false;
}
}