Draylar / identity

A modern morph mod for Fabric.
https://www.curseforge.com/minecraft/mc-mods/identity
MIT License
105 stars 45 forks source link

How to add more types of modded mobs #572

Open thefrogline opened 1 year ago

thefrogline commented 1 year ago

Hello! I want to add a custom mob to the mod, I already know how your ability registration system works and how to create one, but the only thing that fails me is how do I add my entity from another mod), to yours, I know that It is by entity type, the most I get is to obtain it through the entity regirstry, but I can't put it, I only need that, I don't know if it's possible just obtaining it by name, maybe an example would be nice to leave it alone Does anyone have any doubts in the future? 😞

Draylar commented 1 year ago

Hi - Identity will automatically pick up any LivingEntity added to the game (and will include an option for it in the menu). If you want to register an ability for a mob you don't control from a separate mod, it would be something like this...

public class CustomMobAbility extends IdentityAbility<OtherModEntityType> {

    // ...
}
AbilityRegistry.register(EntityTypes.OTHER_MOD_TYPE, new CustomMobAbility());

The you need the entity class & type for this. If you don't have access to the entity class (eg. the the other mod isn't loaded in your dev environment), you can use IdentityAbility<LivingEntity>, and then look up the EntityType by id. Does this help to answer your question?

Natedogwoooof commented 1 year ago

Hi - Identity will automatically pick up any LivingEntity added to the game (and will include an option for it in the menu). If you want to register an ability for a mob you don't control from a separate mod, it would be something like this...

public class CustomMobAbility extends IdentityAbility<OtherModEntityType> {

    // ...
}
AbilityRegistry.register(EntityTypes.OTHER_MOD_TYPE, new CustomMobAbility());

The you need the entity class & type for this. If you don't have access to the entity class (eg. the the other mod isn't loaded in your dev environment), you can use IdentityAbility<LivingEntity>, and then look up the EntityType by id. Does this help to answer your question?

Maybe in one of the next updates you should add a GUI for it

thefrogline commented 1 year ago

I did it, thank you very much, sorry I'm something new in this topic of using forge apis, also a doubt, with the topic of the arms would it be the same? why use

EntityArms.register(....);

and it didn't work, do I have to register something else, or only from there? (srry my bad english jeje)