Custom Skeleton Mob Renderer

Started by Thermoza on Sun, 06/05/2022 - 10:29

Topic category: User side tutorials

Last seen on 21:30, 8. Aug 2022
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Custom Skeleton Mob Renderer
Sun, 06/05/2022 - 10:29

This is a snippet of my renderer to allow my custom skeleton mob use the skeleton model with the armor rendered. The custom skeleton is called ArmoredSkeleton



package net.mcreator.earthdungeons.client.renderer;



import net.minecraft.resources.ResourceLocation;

import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer;

import net.minecraft.client.renderer.entity.HumanoidMobRenderer;

import net.minecraft.client.renderer.entity.EntityRendererProvider;

import net.minecraft.client.model.geom.ModelLayers;

import net.minecraft.client.model.SkeletonModel;



import net.mcreator.earthdungeons.entity.ArmoredSkeletonEntity;



public class ArmoredSkeletonRenderer extends HumanoidMobRenderer<ArmoredSkeletonEntity, SkeletonModel<ArmoredSkeletonEntity>> {

    public ArmoredSkeletonRenderer(EntityRendererProvider.Context context) {

        super(context, new SkeletonModel(context.bakeLayer(ModelLayers.SKELETON)), 0.5f);

        this.addLayer(new HumanoidArmorLayer(this, new SkeletonModel(context.bakeLayer(ModelLayers.SKELETON_INNER_ARMOR)),

                new SkeletonModel(context.bakeLayer(ModelLayers.SKELETON_OUTER_ARMOR))));

    }



    @Override

    public ResourceLocation getTextureLocation(ArmoredSkeletonEntity entity) {

        return new ResourceLocation("earth_dungeons:textures/skeleton.png");

    }

}