Jump to content

Recommended Posts

Posted

I'm guessing onCraftedBy is only called when it's crafted and not called when, for instance, you get an item through commands or the creative tab. Is there another method that gets called every time when an item is created or is there another way I should go in order to do some stuff when an item is created?

Posted

There is no such method. ItemStacks are created by the game all the time for many reasons. e.g. copying, deserializing from the disk or network, etc.

If this is another part of your NBT questions, NBT is meant to be "optional" data. If your data is not present you need to provide a default value.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted (edited)

Capabilities have some support for initializing data. See ItemStack.forgeInit() and Item.initCapabilities()

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted
9 minutes ago, warjort said:

If this is another part of your NBT questions, NBT is meant to be "optional" data. If your data is not present you need to provide a default value.

It is indeed. I needed that info as I needed to create the tag element and put the starting value but couldn't do it in hurtEnemy cause it would get called continously. Gotcha, thanks. I was asking because I remember in some older version there was an onCreated method somewhere, can't recall exactly where though

Posted
7 minutes ago, warjort said:

Capabilities have some support for initializing data. See ItemStack.forgeInit() and Item.initCapabilities()

Capabilities seem pretty complex and unnecessary for what I'm doing, I'll check it out though if I feel like I need it, thank you

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.