sp614x / optifine

1.77k stars 420 forks source link

[CEM] Camel 'root' bone #7633

Closed ZenithRogue closed 3 months ago

ZenithRogue commented 3 months ago

Camel entities currently have un-cancelable animations, due to their base animations animating the root of the model. Adding a root bone has been shown to allow these animations to be overwritten.

Below are the relevant changes that were made to allow this animation

Current:

  public ModelPart getModelRenderer(Model model, String modelPart) {
    if (!(model instanceof CamelModel))
      return null; 
    CamelModel modelCamel = (CamelModel)model;
    if (mapParts.containsKey(modelPart)) {
      String name = mapParts.get(modelPart);
      return modelCamel.m_142109_().getChildModelDeep(name);
    } 
    return null;
  }

Proposed:

  public ModelPart getModelRenderer(Model model, String modelPart) {
    if (!(model instanceof CamelModel))
      return null; 
    CamelModel modelCamel = (CamelModel)model;
    if (modelPart.equals("root"))
      return modelCamel.m_142109_(); 
    if (mapParts.containsKey(modelPart)) {
      String name = mapParts.get(modelPart);
      return modelCamel.m_142109_().getChildModelDeep(name);
    } 
    return null;
  }
sp614x commented 3 months ago

A lot of models support a root bone, should it also be added for them?

AllayModel          PufferfishBigModel
BatModel            PufferfishMidModel
BlazeModel          PufferfishSmallModel
BreezeModel         RavagerModel
CamelModel          SalmonModel
CodModel            ShulkerBulletModel
CreeperModel        SilverfishModel
DolphinModel        SlimeModel
EndermiteModel      SnifferModel
EvokerFangsModel    SnowGolemModel
FrogModel           SpiderModel
GhastModel          SquidModel
GuardianModel       StriderModel
PhantomModel        TropicalFishModelA
IllagerModel        TropicalFishModelB
IronGolemModel      VexModel
LavaSlimeModel      VillagerModel
LeashKnotModel      WardenModel
LlamaSpitModel      WindChargeModel
MinecartModel       WitherBossModel
ParrotModel         
ZenithRogue commented 3 months ago

I cant say i have experience with all of the models listed, but I can definitely it being used for a fair number of these. I'd say add it to all applicable

ewanhowell5195 commented 3 months ago

yes it should be added

sp614x commented 3 months ago

Added root bone for all supporting models.