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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceHow bright an entity's glow textures are drawn (seeglow).static final classThe modelRenderLayers see: it has no parts of its own (the armature draws itself).static classWhat an armature-driven mob is drawn from, each frame.static interfaceAn entity's tint this frame (seetint).static interfaceWhether an entity is see-through this frame (seeArmatureMobRenderer.Translucency.translucent(T, float)). -
Field Summary
Fields inherited from class net.minecraft.client.renderer.entity.LivingEntityRenderer
itemModelResolver, layers, modelFields inherited from class net.minecraft.client.renderer.entity.EntityRenderer
entityRenderDispatcher, NAMETAG_SCALE, shadowRadius, shadowStrength -
Constructor Summary
ConstructorsConstructorDescriptionArmatureMobRenderer(net.minecraft.client.renderer.entity.EntityRendererProvider.Context context, Armature armature, float shadowRadius) -
Method Summary
Modifier and TypeMethodDescriptionSets up each entity's animator when it is made.armature()Picks the armature per entity, for variants whose bodies differ (not only their textures, seetexture(Function)).attach(String point, ArmatureAttachment attachment) Draws something at a point of the armature.deathFlip(boolean flip) Whether a dying entity topples over as vanilla mobs do; turn it off when a clip shows the death.voidextractRenderState(T entity, ArmatureMobRenderer.State state, float partialTicks) protected net.minecraft.world.phys.AABBgetBoundingBoxForCulling(T entity) protected floatnet.minecraft.resources.IdentifierHow bright its_glowtextures are, asked each frame with the partial tick: 1 as they are, 0 dark.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.static <T extends net.minecraft.world.entity.LivingEntity>
net.minecraft.client.renderer.entity.EntityRendererProvider<T> 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.scale(float scale) Scales the model, on top of the entity's own scale.protected voidsetupAnimator(Animator animator, T entity) socket(ItemSocket<T> socket) Shows an item at a point.voidsubmit(ArmatureMobRenderer.State state, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.SubmitNodeCollector collector, net.minecraft.client.renderer.state.level.CameraRenderState camera) Swaps the armature's first texture per entity (variants, colours); null keeps the armature's.tint(ArmatureMobRenderer.Tint<T> 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.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 itstintshows.Methods inherited from class net.minecraft.client.renderer.entity.LivingEntityRenderer
addLayer, extractNameTags, getModel, getModelTint, getOverlayCoords, getRenderType, getShadowRadius, getWhiteOverlayProgress, isBodyVisible, isEntityUpsideDown, isShaking, isUpsideDownName, scale, setupRotations, shouldRenderLayers, shouldShowNameMethods inherited from class net.minecraft.client.renderer.entity.EntityRenderer
affectedByCulling, createRenderState, extractNameTags, finalizeRenderState, getBlockLightLevel, getFont, getNameTag, getPackedLightCoords, getRenderOffset, getShadowStrength, getSkyLightLevel, shouldRender, submitNameDisplay, submitNameDisplay
-
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
-
animate
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
Picks the armature per entity, for variants whose bodies differ (not only their textures, seetexture(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 onearmature()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 drawntranslucent. -
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 itstintshows. Glowing parts are drawn as before. -
scale
Scales the model, on top of the entity's own scale. -
deathFlip
Whether a dying entity topples over as vanilla mobs do; turn it off when a clip shows the death. -
attach
Draws something at a point of the armature. -
holdItem
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
Shows an item at a point. -
glow
How bright its_glowtextures are, asked each frame with the partial tick: 1 as they are, 0 dark. Eyes that open, a lantern lit and put out. -
setupAnimator
-
createRenderState
- Specified by:
createRenderStatein classnet.minecraft.client.renderer.entity.EntityRenderer<T extends net.minecraft.world.entity.LivingEntity, ArmatureMobRenderer.State>
-
extractRenderState
- Overrides:
extractRenderStatein classnet.minecraft.client.renderer.entity.LivingEntityRenderer<T extends net.minecraft.world.entity.LivingEntity, ArmatureMobRenderer.State, ArmatureMobRenderer.LayerModel>
-
getTextureLocation
- Specified by:
getTextureLocationin classnet.minecraft.client.renderer.entity.LivingEntityRenderer<T extends net.minecraft.world.entity.LivingEntity, ArmatureMobRenderer.State, ArmatureMobRenderer.LayerModel>
-
getFlipDegrees
protected float getFlipDegrees()- Overrides:
getFlipDegreesin classnet.minecraft.client.renderer.entity.LivingEntityRenderer<T extends net.minecraft.world.entity.LivingEntity, ArmatureMobRenderer.State, ArmatureMobRenderer.LayerModel>
-
getBoundingBoxForCulling
- Overrides:
getBoundingBoxForCullingin classnet.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:
submitin classnet.minecraft.client.renderer.entity.LivingEntityRenderer<T extends net.minecraft.world.entity.LivingEntity, ArmatureMobRenderer.State, ArmatureMobRenderer.LayerModel>
-