Incompatibility with Smart Moving and RenderPlayerAPI
makamys opened this issue ยท 1 comments
The issue
-
When Smart Moving is installed, the player model remains the vanilla one, just with the texture messed up, and an additional pair of (slim) arms being rendered. Ears parts still show up correctly.
-
When RenderPlayerAPI is installed, the game crashes when loading a world, since RenderPlayerAPI is trying to cast
RenderPlayer.modelBipedMain
to itsapi.player.model.ModelPlayer
class, which fails since inamendPlayerRenderer
Ears had replaced it with a newModelBiped
instance.
For more context on the second problem, this is what RenderPlayer()
looks like with Ears and RenderPlayerAPI both present.
public RenderPlayer() {
super(new ModelPlayer(0.0F, "main"), 0.5F);
RenderPlayerAPI.beforeLocalConstructing(this);
this.field_77109_a = (ModelBiped)this.field_77045_g;
this.field_77108_b = new ModelPlayer(1.0F, "chestplate");
this.field_77111_i = new ModelPlayer(0.5F, "armor");
Ears.amendPlayerRenderer(this);
RenderPlayerAPI.afterLocalConstructing(this);
}
How to fix
These incompatibilities can be fixed in the following way: all ModelBiped
and ModelRenderer
instances must be modified in-place. See How-to-make-an-existing-mod-compatible-with-Smart-Moving for more details.
As a proof of concept I hacked 64x64 texture support into the right arm in this way. I can confirm this makes the right arm show up correctly with Smart Moving and RenderPlayerAPI installed.
https://gist.github.com/makamys/a248117e7a505764cfb0575119e9d12e
For the slim/fat arms, remember that child models can have their visibility toggled individually, so you could keep both types of arms inside a single ModelRenderer
.
Edit: I realized this method may not work correctly in multiplayer when multiple player models are present, further research is needed.