Jump to content

[1.7.10] Including or making instanceof Entities from other mods?


Recommended Posts

It is possible, but not using instanceof. What you need to do is check that the Classes are equal(Use .class or .getClass to get the classes), make sure you only do this if CustomNPCs is loaded.





It's like saying "If you get a key, you can open a lock, but only by using exact copy of that key, not the original."


If you can compare classes without getting crash (compilation error) you can most certainly can make instanceof keyword.


Problem of this thread lies here:

Does mod in question have API / dev-release / deobfuscated open source?

You basically need to add it to your project (dependency) depending on what you got from author.


If you have such dependency you can reference anything in it like you reference vanilla code - also mobs.


Also remember - if you do such stuff you need to add dependency to your @Mod or take care of things when given "parent" mod is not present.


As to other "soft" solutions. You can make non-dependency checks. Every entity is registered into EntityRegistry. You can easily compare registry names and/or even class names without having hard dependency.



Oh and btw - if you'd be on 1.8+ you wouldn't have to have deobfuscated mod (dev release) - you could basically just grab it and throw into libs. BOOM - in your face pre-1.8! But seriously - update (magic of new things).

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

I believe that he wants to grab an instance of the entity not create one as, creating a new instance of a CustomNPC Entity would be kinda pointless since you would be able to call any of the functions added by Custom NPCs.


I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.

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.