Texture Per Bone

This page covers how to change the texture of a bone.

Due to the added performance overhead of this renderer, it is recommended to exercise discretion in its usage. Evaluate whether the advantages outweigh the performance cost for your specific requirements before employing it unnecessarily. It is recommended to use GeoRenderLayers instead where possible.

In your Entities render, call extend DynamicGeoEntityRenderer instead of GeoEntityRenderer and then call getTextureOverrideForBone to set the texture on that bone.

public class PerBoneRenderer extends DynamicGeoEntityRenderer<PerBoneEntity> {
	private static final ResourceLocation BONE_TEXTURE =
		new ResourceLocation("modid", "textures/entity/perbonetexture.png");

	public PerBoneRenderer(EntityRendererProvider.Context renderManager) {
		super(renderManager, new PerBoneModel());
	}

	@Nullable
	@Override
	protected ResourceLocation getTextureOverrideForBone(GeoBone bone, PerBoneEntity animatable, float partialTick) {
		return bone.getName().equals("retextureme") ? BONE_TEXTURE : null;
	}
}

Last updated