Class ArmatureMobRenderer<T extends net.minecraft.world.entity.LivingEntity>

java.lang.Object
net.minecraft.client.renderer.entity.EntityRenderer<T, ArmatureMobRenderer.State>
net.minecraft.client.renderer.entity.LivingEntityRenderer<T, ArmatureMobRenderer.State, ArmatureMobRenderer.LayerModel>
net.ixdarklord.coolcatcanvas.api.client.armature.render.ArmatureMobRenderer<T>
All Implemented Interfaces:
net.minecraft.client.renderer.entity.RenderLayerParent<ArmatureMobRenderer.State, ArmatureMobRenderer.LayerModel>

public class ArmatureMobRenderer<T extends net.minecraft.world.entity.LivingEntity> extends net.minecraft.client.renderer.entity.LivingEntityRenderer<T, ArmatureMobRenderer.State, ArmatureMobRenderer.LayerModel>
Draws a living entity with an armature. Everything vanilla does for mobs still happens: the hurt flash, the death topple (unless turned off for a death clip), sleeping, freezing shakes, invisibility, the glowing outline, name tags, leashes, and any RenderLayers added. Each entity gets its own Animator.
EntityRendererRegistry.register(MyEntities.WISP, ArmatureMobRenderer.of(Armature.of("mymod", "wisp"), 0.4F, renderer -> renderer
        .animate(animator -> {
            animator.layer("base").drive(ctx -> ctx.moving() ? WALK : IDLE);
            animator.lookAt("head");
        })
        .holdItem("right_hand", EquipmentSlot.MAINHAND)));
Or subclass it and override setupAnimator(Animator, T), for typed access to the entity.
  • Constructor Details

    • ArmatureMobRenderer

      public ArmatureMobRenderer(net.minecraft.client.renderer.entity.EntityRendererProvider.Context context, Armature armature, float shadowRadius)
  • Method Details

    • of

      public static <T extends net.minecraft.world.entity.LivingEntity> net.minecraft.client.renderer.entity.EntityRendererProvider<T> of(Armature armature, float shadowRadius, Consumer<ArmatureMobRenderer<T>> configure)
      A renderer provider, for registering without a class of your own.
    • of

      public static <T extends net.minecraft.world.entity.LivingEntity> net.minecraft.client.renderer.entity.EntityRendererProvider<T> of(Armature armature, float shadowRadius)
    • armature

      public Armature armature()
    • animate

      public ArmatureMobRenderer<T> animate(Consumer<Animator> setup)
      Sets up each entity's animator when it is made. Several setups run in the order given.
    • texture

      public ArmatureMobRenderer<T> texture(Function<T, @Nullable net.minecraft.resources.Identifier> texture)
      Swaps the armature's first texture per entity (variants, colours); null keeps the armature's.
    • armature

      public ArmatureMobRenderer<T> armature(Function<T, @Nullable Armature> pick)
      Picks the armature per entity, for variants whose bodies differ (not only their textures, see texture(Function)). Each entity's animator is made for the armature it is drawn with, and made afresh, set up again, if that changes. Null keeps the renderer's own armature, which is also the one armature() gives.
    • tint

      Tints the whole model per entity, asked each frame with the partial tick: an ARGB colour multiplied into every face, on top of vanilla's own tint. Its alpha shows only while the entity is drawn translucent.
    • translucent

      public ArmatureMobRenderer<T> translucent(ArmatureMobRenderer.Translucency<T> translucent)
      Whether an entity is drawn see-through this frame (a ghost, a hallucination, something fading in): its lit parts blended with what is behind them, so the alpha of its tint shows. Glowing parts are drawn as before.
    • scale

      public ArmatureMobRenderer<T> scale(float scale)
      Scales the model, on top of the entity's own scale.
    • deathFlip

      public ArmatureMobRenderer<T> deathFlip(boolean flip)
      Whether a dying entity topples over as vanilla mobs do; turn it off when a clip shows the death.
    • attach

      public ArmatureMobRenderer<T> attach(String point, ArmatureAttachment attachment)
      Draws something at a point of the armature.
    • holdItem

      public ArmatureMobRenderer<T> holdItem(String point, net.minecraft.world.entity.EquipmentSlot slot)
      Shows what the entity holds or wears in a slot at a point, held as a vanilla hand holds it: put the point (a locator) at the hand, with the model at rest pointing the arm down.
    • socket

      public ArmatureMobRenderer<T> socket(ItemSocket<T> socket)
      Shows an item at a point.
    • glow

      How bright its _glow textures are, asked each frame with the partial tick: 1 as they are, 0 dark. Eyes that open, a lantern lit and put out.
    • setupAnimator

      protected void setupAnimator(Animator animator, T entity)
    • createRenderState

      public ArmatureMobRenderer.State createRenderState()
      Specified by:
      createRenderState in class net.minecraft.client.renderer.entity.EntityRenderer<T extends net.minecraft.world.entity.LivingEntity, ArmatureMobRenderer.State>
    • extractRenderState

      public void extractRenderState(T entity, ArmatureMobRenderer.State state, float partialTicks)
      Overrides:
      extractRenderState in class net.minecraft.client.renderer.entity.LivingEntityRenderer<T extends net.minecraft.world.entity.LivingEntity, ArmatureMobRenderer.State, ArmatureMobRenderer.LayerModel>
    • getTextureLocation

      public net.minecraft.resources.Identifier getTextureLocation(ArmatureMobRenderer.State state)
      Specified by:
      getTextureLocation in class net.minecraft.client.renderer.entity.LivingEntityRenderer<T extends net.minecraft.world.entity.LivingEntity, ArmatureMobRenderer.State, ArmatureMobRenderer.LayerModel>
    • getFlipDegrees

      protected float getFlipDegrees()
      Overrides:
      getFlipDegrees in class net.minecraft.client.renderer.entity.LivingEntityRenderer<T extends net.minecraft.world.entity.LivingEntity, ArmatureMobRenderer.State, ArmatureMobRenderer.LayerModel>
    • getBoundingBoxForCulling

      protected net.minecraft.world.phys.AABB getBoundingBoxForCulling(T entity)
      Overrides:
      getBoundingBoxForCulling in class net.minecraft.client.renderer.entity.LivingEntityRenderer<T extends net.minecraft.world.entity.LivingEntity, ArmatureMobRenderer.State, ArmatureMobRenderer.LayerModel>
    • submit

      public void submit(ArmatureMobRenderer.State state, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.SubmitNodeCollector collector, net.minecraft.client.renderer.state.level.CameraRenderState camera)
      Overrides:
      submit in class net.minecraft.client.renderer.entity.LivingEntityRenderer<T extends net.minecraft.world.entity.LivingEntity, ArmatureMobRenderer.State, ArmatureMobRenderer.LayerModel>