Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.boxtop.epicloot;
- import cpw.mods.fml.common.Side;
- import cpw.mods.fml.common.asm.SideOnly;
- import net.minecraft.src.Block;
- import net.minecraft.src.CreativeTabs;
- import net.minecraft.src.Entity;
- import net.minecraft.src.EntityLiving;
- import net.minecraft.src.EntityPlayer;
- import net.minecraft.src.EnumAction;
- import net.minecraft.src.Item;
- import net.minecraft.src.ItemStack;
- import net.minecraft.src.EnumToolMaterial;
- import net.minecraft.src.Material;
- import net.minecraft.src.NBTTagCompound;
- import net.minecraft.src.NBTTagList;
- import net.minecraft.src.NBTTagString;
- import net.minecraft.src.World;
- import net.minecraftforge.client.MinecraftForgeClient;
- import net.minecraftforge.common.MinecraftForge;
- public class ItemRandomSword extends Item {
- private int weaponDamage;
- private EnumToolMaterial toolMaterial;
- public ItemRandomSword(int itemID, EnumToolMaterial par2EnumToolMaterial)
- {
- super(itemID);
- this.toolMaterial = par2EnumToolMaterial;
- this.maxStackSize = 1;
- this.setMaxDamage(par2EnumToolMaterial.getMaxUses());
- this.weaponDamage = 4 + par2EnumToolMaterial.getDamageVsEntity();
- this.setTextureFile("/epicloot/gfx/items/swords.png");
- }
- @SideOnly(Side.CLIENT)
- public String getTextureFile()
- {
- return "/epicloot/gfx/items/swords.png";
- }
- public void setEnumToolMaterial(EnumToolMaterial par2EnumToolMaterial)
- {
- this.toolMaterial = par2EnumToolMaterial;
- this.maxStackSize = 1;
- this.setMaxDamage(par2EnumToolMaterial.getMaxUses());
- this.weaponDamage = 4 + par2EnumToolMaterial.getDamageVsEntity();
- }
- public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
- {
- return false;
- }
- public int getItemEnchantability()
- {
- return 0;
- }
- public int func_82803_g()
- {
- return this.toolMaterial.getDamageVsEntity();
- }
- /**
- * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
- * sword
- */
- public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
- {
- if (par2Block.blockID == Block.web.blockID)
- {
- return 15.0F;
- }
- else
- {
- Material var3 = par2Block.blockMaterial;
- return var3 != Material.plants && var3 != Material.vine && var3 != Material.field_76261_t && var3 != Material.leaves && var3 != Material.pumpkin ? 1.0F : 1.5F;
- }
- }
- /**
- * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
- * the damage on the stack.
- */
- public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
- {
- par1ItemStack.damageItem(1, par3EntityLiving);
- return true;
- }
- public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving)
- {
- if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D)
- {
- par1ItemStack.damageItem(2, par7EntityLiving);
- }
- return true;
- }
- /**
- * Returns the damage against a given entity.
- */
- public int getDamageVsEntity(Entity par1Entity)
- {
- return this.weaponDamage;
- }
- @SideOnly(Side.CLIENT)
- /**
- * Returns True is the item is renderer in full 3D when hold.
- */
- public boolean isFull3D()
- {
- return true;
- }
- /**
- * returns the action that specifies what animation to play when the items is being used
- */
- public EnumAction getItemUseAction(ItemStack par1ItemStack)
- {
- return EnumAction.block;
- }
- /**
- * How long it takes to use or consume an item
- */
- public int getMaxItemUseDuration(ItemStack par1ItemStack)
- {
- return 72000;
- }
- /**
- * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
- */
- public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
- {
- par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
- return par1ItemStack;
- }
- /**
- * Returns if the item (tool) can harvest results from the block type.
- */
- public boolean canHarvestBlock(Block par1Block)
- {
- return par1Block.blockID == Block.web.blockID;
- }
- public String func_77825_f()
- {
- return this.toolMaterial.toString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement