Jump to content

Each item in its own


Abyssal

Recommended Posts

Hi,

I started yesterday in forge coding and I need to do one thing, but don't know how.. I have an item class which has an overrided method, RightClick. The problem is that I can't make it individual for each Item created. Bit confusing, isn't it? Let me throw an example:

Player crafted an Item. Player crafted the same Item again. When he right clicks one (no matter which) of the items, the action executes for both.

 

Can someone help me? It is the only missing thing preventing me to finish the mod.

 

Link to comment
Share on other sites

And Im saying that the item itself is only ever created ONCE.

Every time that someone crafts the item they get a unique ItemStack not a unique Item.

Look into the ItemStack, if you want to have two of the same items different.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Sorry, I had read your text too fast and understood it wrong. (plus the fact i don't speak well english)

Well, is there a way to make it different for undefined number of items? Like the IC2 nano saber, which I can turn one whithout turning another. (don't get well the ItemStack thing. I just use it for meta items and returns)

Link to comment
Share on other sites

Sorry, I had read your text too fast and understood it wrong. (plus the fact i don't speak well english)

Well, is there a way to make it different for undefined number of items? Like the IC2 nano saber, which I can turn one whithout turning another. (don't get well the ItemStack thing. I just use it for meta items and returns)

If you need to store data for individual items then store it in the ItemStack metadata/damage if it will fit a short, else save it in the ItemStack NBT data.  That is the only way.

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.



×
×
  • Create New...

Important Information

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