Jump to content

Questionis about Item and ItemStack processing


WeAthFolD

Recommended Posts

I wonder how does ItemStack's calling function works.

if two ItemStacks were used and called theirs' item's onItemRightClick() function,etc

are they calling the exactly same instance of the item?

 

if I made an Item like this:

 

public class WeaponWhatever extends Item {
         
        public Boolean isUsed;

public WeaponWhatever(int par1ID) {
	super(par1ID);
	setItemName("Whateveer it is");
	setTextureFile(ClientProxy.ITEMS_TEXTURE_PATH);
	setIconCoord(0,0);

                isUsed = false;
}


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

              if(!isUsed)System.out.println("Item hasn't been yet used." );
              else System.out.println("Item has been used. ");
              isUsed = true;
              return par1ItemStack;
    }
}

 

if I put two of the Item in my inventory,and I right click the first one

when I right click the second one,will the result be "Item has been used"?

 

If so , how can I do to make ItemStacks use seperate same processing func with different local variables?

 

Thanks a lot  ;D

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.