Jump to content

Recommended Posts

Posted

Hello, I've been looking all day to a way to animate any BidepModel (player, zombie, squelleton, any other biped, vanilla or not...) with the same animation/pose (all biped having the same "structure" arms, legs...).

My first approach was to use the render event hook that way:

    @SubscribeEvent 
    public void onRenderBiped(RenderLivingEvent.Pre event){
    	/*ICaster caster = CasterHandler.getCaster(event.getEntity());
    	if(caster!=null) {
    		ModelPlayer modelplayer = event.getRenderer().getMainModel();
    		modelplayer.bipedRightArm.
    	}*/
    	if(event.getRenderer().getMainModel() instanceof ModelBiped) {
    		event.setCanceled(true);
    		ModelBiped model = (ModelBiped)event.getRenderer().getMainModel();
    		model.bipedRightArm.rotateAngleX = 5f;
    	}
    }

but it does'nt work (because the rotate angle values are overrided by the model render method, and of course if I use RenderLivingEvent.Post the model is already rendered so it's too late).

 

I found some answers saying to create a custom BipedModel but it would mean to create as many Renderer as biped entity to override the vanilla BipedModel (and is it even possible?), plus would'nt it be a compatibility-killer?

 

Is there a better maintenable solution?

Posted (edited)

You can force the model to skip normal rendering by canceling the event with event.setCanceled(true). The plus side is you'll be able to do exactly what you want with the model. The down side is you'll have to write the entire rendering method, including rendering sleeping/sneaking conditions as well as nameplates.

Edited by Azaka7
Posted
4 minutes ago, Azaka7 said:

You can force the model to skip normal rendering by canceling the event with event.setCanceled(true). The plus side is you'll be able to do exactly what you want with the model. The down side is you'll have to write the entire rendering method, including rendering sleeping/sneaking conditions as well as nameplates.

I tough of this solution but imagine the render method changes in future versions or is used in other mods. It's kind the same problem as overriding the model. 

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.