Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Seroemod.Lightsabers;
- import Seroemod.SeroeMod;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- import net.minecraft.client.renderer.texture.IconRegister;
- import net.minecraft.creativetab.CreativeTabs;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.item.EnumAction;
- import net.minecraft.item.EnumToolMaterial;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.item.ItemSword;
- import net.minecraft.item.ItemTool;
- import net.minecraft.potion.Potion;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.world.World;
- public class BlueLightsaber extends ItemSword
- {
- public BlueLightsaber(int par1, EnumToolMaterial par2EnumToolMaterial) {
- super(par1, par2EnumToolMaterial);
- this.setUnlocalizedName("blue_lightsaber");
- this.setCreativeTab(CreativeTabs.tabCombat);
- this.canRepair = true;
- }
- /**
- * Adds the shiny effect
- */
- public boolean hasEffect(ItemStack par1ItemStack)
- {
- return true;
- }
- // Adds a potion effect when the item is held
- public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5, EntityPlayer par6)
- {
- if(par6.getCurrentEquippedItem().equals(getUnlocalizedName()))
- {
- par6.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 100, 3, true));
- }
- else
- {
- par6.curePotionEffects(par1ItemStack);
- }
- }
- @Override
- public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
- {
- par2World.playSoundAtEntity(par3EntityPlayer, "seroemod:return", 500.0F, 1.0F);
- return new ItemStack(SeroeMod.hiltBlueLightsaber, 1 , par1ItemStack.getItemDamage());
- }
- @Override
- public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
- {
- par1ItemStack.damageItem(1, par3EntityLivingBase);
- par2EntityLivingBase.worldObj.playSoundAtEntity(par2EntityLivingBase, "seroemod:swing", 500.0F, 1.0F);
- return true;
- }
- @SideOnly(Side.CLIENT)
- public void registerIcons(IconRegister reg)
- {
- this.itemIcon = reg.registerIcon("seroemod:blue_lightsaber");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment