Jump to content

Re: Blaster Delay Between Firing


Trigga_scopez

Recommended Posts

Here is my ItemRapidPistol class

 

 

package alex.modtut.items;

 

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.EnumAction;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.world.World;

import alex.modtut.MainClass;

import alex.modtut.lib.Constants;

 

 

public class ItemRapidPistol extends Item {

    private World worldObj;

    private double posX;

    private double posZ;

    private double posY;

    private Object explosionRadius;

   

   

   

 

   

   

    public ItemRapidPistol() {

        super();

        setCreativeTab(MainClass.GunsNStuff);

        setUnlocalizedName("RapidPistol");

        setTextureName(Constants.MODID + ":RapidPistol");

       

       

       

   

 

    }

   

 

 

 

 

    @Override

    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,EntityPlayer par3EntityPlayer) {

   

 

   

        if(par3EntityPlayer.capabilities.isCreativeMode||par3EntityPlayer.inventory.consumeInventoryItem(ModItems.orangeItem))

       

        {

       

            par2World.playSoundAtEntity(par3EntityPlayer, "mob.irongolem.hit", 0.4F, 3F / (itemRand.nextFloat() * 0.4F + 0.8F));

 

            {

                par2World.spawnEntityInWorld(new alex.modtut.items.M16EntityBlasterBolt(par2World, par3EntityPlayer));

            }

        }

        return par1ItemStack;

        }

}

 

 

Link to comment
Share on other sites

i tried this code

 

package alex.modtut.items;

 

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.EnumAction;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.world.World;

import alex.modtut.MainClass;

import alex.modtut.lib.Constants;

 

 

public class ItemRapidPistol extends Item {

    private World worldObj;

    private double posX;

    private double posZ;

    private double posY;

    private Object explosionRadius;

   

   

   

    private int counter =20;

   

   

    public ItemRapidPistol() {

        super();

        setCreativeTab(MainClass.GunsNStuff);

        setUnlocalizedName("RapidPistol");

        setTextureName(Constants.MODID + ":RapidPistol");

       

       

       

   

 

    }

   

 

 

 

 

    @Override

    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,EntityPlayer par3EntityPlayer) {

   

 

   

        if(par3EntityPlayer.capabilities.isCreativeMode||par3EntityPlayer.inventory.consumeInventoryItem(ModItems.orangeItem))

       

        counter--;

        if(counter == 0)

       

        {

       

            par2World.playSoundAtEntity(par3EntityPlayer, "mob.irongolem.hit", 0.4F, 3F / (itemRand.nextFloat() * 0.4F + 0.8F));

 

            {

                par2World.spawnEntityInWorld(new alex.modtut.items.M16EntityBlasterBolt(par2World, par3EntityPlayer));

            }

           

            counter=20;

           

           

        }

        return par1ItemStack;

        }

   

   

}

 

   

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.