#Help with "BABY_TRANSFORMER" ModelTransformer used to make baby animals smaller.

4 messages · Page 1 of 1 (latest)

mystic wolf
#

I recently followed the kaupenjoe mantis entity tutorial but I did so on 1.21.4. I got everything working but my method for rendering baby mantis was just by downscaling the parent model by Overriding the Render function in MantisRenderer. This felt a bit odd since there is a distinct spot to put a baby model in the MantsisRenderer function. I went looking at how minecraft handles baby entities and found that most animals with baby variants have a ModelTransformer variable called BABY_TRANSFORMER. (Code examples are from CamelEntityModel.class)

public class CamelEntityModel extends EntityModel<CamelEntityRenderState> {
    private static final float LIMB_ANGLE_SCALE = 2.0F;
    private static final float LIMB_DISTANCE_SCALE = 2.5F;
    public static final ModelTransformer BABY_TRANSFORMER = ModelTransformer.scaling(0.45F); // <--
    private static final String SADDLE = "saddle";
    private static final String BRIDLE = "bridle";
    private static final String REINS = "reins";
    private final ModelPart head;
    private final ModelPart[] saddleAndBridle;
    private final ModelPart[] reins;```

All references to this variable were obfuscated in the MC code, and while my current code works, I would like to know if anyone has gotten the BABY_TRANSFORMER way to work.
sudden tide
#

I have worked with a different model transformer

#

the transformer is used in the baby layer that is registered

EntityModelLayerRegistry.registerModelLayer(
  new EntityModelLayer(MYMOD_ID, "main"),
  CamelEntityModel::getTexturedModelData
);
EntityModelLayerRegistry.registerModelLayer(
  new EntityModelLayer(MYMOD_ID.withSuffixedPath("_baby"), "main"),
  () -> CamelEntityModel
          .getTexturedModelData()
          .transform(CamelEntityModel.BABY_TRANSFORMER)
);
#

for example