Jump to content

Recommended Posts

Posted

Hello together. I have the following question: How do I use itemInteractionForEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving)? There were two arguments: Objects of ItemStack and EntitiyLiving. Now I want to get a certain item, if I click on an animal. This looks like this:

@Override
public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving)
{
	if (this.isFull == 0 && par2EntityLiving instanceof EntityOcelot {
		par1ItemStack = new ItemStack(Tutorial.FishBone);
	}	
	return true;
}

But obviously the item won't change. I've already tried with itemID, itemID+256, itemID-256, but all these didn't work. What do I have to improve? And what is the return-value standing for?

Posted

par1ItemStack.Id = somethingElse +256;

Also, is this.isFull just a standard Boolean, because that would cause multiplayer issues

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

Posted

Thanks so far, but I can't use par1ItemStack.Id. Id is simply not available. And sorry, if I was unprecise: This is the right code: without this.isFull (this.isFull was copied from a bucket and this.isFull means the bucket's content):

@Override
public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving)
{
	if (par2EntityLiving instanceof EntityOcelot {
		par1ItemStack.itemID =Tutorial.itemID+256;
	}	
	return true;
}

But anyway: How do I solve this problem now? And what does the return-value mean?

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.