Jump to content

Recommended Posts

Posted

Hello,  :)

 

I am trying to make a mod that includes survival spawn eggs and I want them to be noticeably different from the creative ones. Would it be possible to:

  • Give the shine effect (the one on enchanted items and on other items like the Notch Apple) to the spawn eggs
  • Rename the spawn eggs to "Creative Spawn [mob]"

I want to try to do this in the most efficient (and least confusing) way possible. I believe I have seen something like this done before in other mods. Also, there have been various other posts I have seen, but they're all either outdated or don't exactly apply to what I want to do. And if you are going to suggest the @Override (I don't know if this pertains to this), please try to give me a more detailed description of how I'm supposed to use it, because I'm completely clueless about it. I am in forge 1.8-11.14.3.1450, if that matters.

 

Thanks!

ComputerCraze  ;)

Posted

The shine effect is controlled by the return value of

Item#hasEffect

. The default implementation only returns

true

when the

ItemStack

is enchanted (i.e. it has a compound tag with the

"ench"

key). This means there's no easy way to force an existing item to always display the effect without replacing it your own or resorting to ASM (neither of which is desirable).

 

Changing the display name is much easier, just add a translation with the same key as the vanilla one (

item.monsterPlacer.name

) in your own lang files.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

The shine effect is controlled by the return value of

Item#hasEffect

. The default implementation only returns

true

when the

ItemStack

is enchanted (i.e. it has a compound tag with the

"ench"

key). This means there's no easy way to force an existing item to always display the effect without replacing it your own or resorting to ASM (neither of which is desirable).

 

Changing the display name is much easier, just add a translation with the same key as the vanilla one (

item.monsterPlacer.name

) in your own lang files.

 

Just out of curiosity, what is ASM? Is it easier than replacing all of the spawn eggs with items in my mod?

Posted

Just out of curiosity, what is ASM? Is it easier than replacing all of the spawn eggs with items in my mod?

 

ASM is a library that allows you to manipulate the bytecode of classes at runtime. There aren't many tutorials on using it in coremods, since you should avoid using it unless you have a solid understanding of the bytecode format and you absolutely need to use it.

 

Replacing the vanilla item with your own won't be easy and may not be possible. You can remove it from the creative menu, but players will still be able to obtain it through NEI or the

/give

command.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Just out of curiosity, what is ASM? Is it easier than replacing all of the spawn eggs with items in my mod?

 

ASM is a library that allows you to manipulate the bytecode of classes at runtime. There aren't many tutorials on using it in coremods, since you should avoid using it unless you have a solid understanding of the bytecode format and you absolutely need to use it.

 

Replacing the vanilla item with your own won't be easy and may not be possible. You can remove it from the creative menu, but players will still be able to obtain it through NEI or the

/give

command.

 

Ah. Thanks, you've really helped me. But just in case I'm missing something, is there possibly another alternative to adding the shine effect? Also, I only want to make the vanilla spawn eggs different from the new kind of spawn eggs I am adding.

Posted

Ah. Thanks, you've really helped me. But just in case I'm missing something, is there possibly another alternative to adding the shine effect? Also, I only want to make the vanilla spawn eggs different from the new kind of spawn eggs I am adding.

 

Have you considered just using a different texture for your own item or changing its design to be something other than an egg?

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Ah. Thanks, you've really helped me. But just in case I'm missing something, is there possibly another alternative to adding the shine effect? Also, I only want to make the vanilla spawn eggs different from the new kind of spawn eggs I am adding.

 

Have you considered just using a different texture for your own item or changing its design to be something other than an egg?

Wow I can't believe I hadn't though of that. I sometimes really do think too hard  ;D Thanks so much!

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.