Jump to content

[1.16.5] Adding more possible CatTypes to CatEntity


Recommended Posts

So, I’ve been dabbling a bit with forge, and I’m trying to make a mod for 1.16.5 that adds various new cat textures, in addition to some other features.


However, the issue I’m running into is how exactly to create these variations. I would like to have various items, when interacted with a tamed cat to change the CatType tag (I’ve done this much on my own, and it works).

This being said, I want to add my new cat textures as new CatTypes, so that the texture data is properly stored in each entity instance. I, however, even after examining the cat and wolf files, can’t seem to figure out how I could add more variants via these NBT tags.

Is this the way I should be doing this, or is there a much easier approach I should be taking?


Thanks in advance.



I seem to have found the spot within CatEntity.java that contains the code for randomly choosing a CatType when a CatEntity is spawned. Line 348 at finalizespawn contains helped me understand how textures are randomly chosen. However, I assume that somewhere there is a json mapping (or something similar) that maps each number CatType to a filepath for the texture, similar to how you would use a lang file to properly format localizations of items or tab labels for your mod.


I don't really care about being able to randomly generate the new cat textures (CatTypes) in the world, I just want to have the additional CatType Mapping. (EX: CatType 12, 13, 14, etc.) "mapped" correctly to the location of the textures included in the assets folder of my mod. I'm not sure where/what to do in order to add these additional types, as I assume I'd need to override some sort of vanilla mapping or file, but I'm really not sure. I have an idea of WHAT I need to do, but I'd really appreciate any help on locating WHERE / HOW to do it, as this is my first real attempt at modding Minecraft.

Edited by Splurpy_
Adding more relevant information / Reformatting Title
Link to comment
Share on other sites

  • Splurpy_ changed the title to [1.16.5] Adding more possible CatTypes to CatEntity

Okay so, thought I'd leave a reply as to not make the initial post any longer.

Not sure how much help I'll really get because this seems so niche, so I'll just document my progress for now.


I somehow completely missed this the first time around. I found the map that connects the textures to CatType in EntityCat.java, but now I just need to figure out how I can override/add my own mappings with textures to this list, especially since it's static. A link to the code I'm referring to is below.

CatType Texture Map

Link to comment
Share on other sites

To my understanding, there's no way to change an immutable object (public static final Map), so it seems like my main options are going to be:

  1. Completely override the old EntityCat from the game, by extending a custom entity class that is the exact same but with more texture mappings (I really hope I DON'T have to do this).
  2. Create a class which overrides getResourceLocation to look for textures from a different Map (I'm not sure how to implement this, but it seems like the best way to go, and it seems MUCH easier, but I don't know where to start).

On that note, is it possible to override/modify methods for pre-existing/Vanilla classes?

Edited by Splurpy_
Adding relevant question
Link to comment
Share on other sites

13 minutes ago, poopoodice said:

Access Transformers allows you do get rid of the final modifier.

Could you maybe explain a little bit more? I'm not sure what you mean by "get rid of the final modifier".

From what I can see, it allows using "smaller-scope" methods out of their localized scopes? Or am I misunderstanding?


EDIT: NEVERMIND, just realized you meant the literal "final" modifier of public static final. Thanks!

Edited by Splurpy_
i'm dumb
Link to comment
Share on other sites

One new issue I'm finding is how to actually use the transformer in the accesstransformer.cfg file within META-INF.


I understand that I need the MojMap (I think) in order to do this, but I don't know where to get/how to format the map for this specific field.

Is it as simple as:

public-f net.minecraft.entity.passive.CatEntity TEXTURE_BY_TYPE


Because I tried this, and it didn't actually seem to affect the "public static final" aspect within CatEntity.java, even after refreshing the build.gradle.


Any help is greatly appreciated!



I was actually able to use my IDE to get the AT value, so now I have:

public-f net.minecraft.entity.passive.CatEntity field_213425_bD # TEXTURE_BY_TYPE

This, however, still doesn't change anything in the source code. I'm not sure if it's supposed to or not. It's kind of difficult to find a lot on ATs.

Should I be able to redefine the field from another class, or am I missing the point?

Edited by Splurpy_
New info
Link to comment
Share on other sites

4 hours ago, poopoodice said:

You need to specify the AT file in your build.gradle, and reimport/refresh the gradle.

I did this, but nothing seems to have updated.

I've typed:

 accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

And even after refreshing the gradle, nothing changes.

Edited by Splurpy_
Link to comment
Share on other sites

I've redefined the field inside the item that's supposed to change them, but when I call setCatType(), it randomly selects a new integer if its anything larger than the predefined method's bound.

I'm a little new to Forge, so any tips on how to go about dealing with this?

Link to comment
Share on other sites

22 minutes ago, Splurpy_ said:

I'm a little new to Forge, so any tips on how to go about dealing with this?

this is not possible (with Mixin yes), the only solution for this is to replace the CatRenderer
unfortunately i never done this before so no idea what exactly you need to do

Edited by Luis_ST
Link to comment
Share on other sites

8 hours ago, diesieben07 said:

There is no way to safely add new types to the exiting cat entity, as they are using hardcoded integer IDs. Do not attempt this, it will cause nothing but trouble.

Make your own entity based on CatEntity.

Okay thanks. Is this as easy as simply extending CatEntity, and then modifying the new class?

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.