Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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?

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

 

ლ(́◉◞౪◟◉‵ლ

  • Author

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.