Class VanillaAttachment
java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.armature.vanilla.VanillaAttachment
An armature worn on a part of a vanilla model: wings on a zombie's body, a tail on a player, a hat on a villager's
head. It moves with the part (vanilla's animation, clips,
VanillaPose changes), and has its own animator, so
it can play clips, swing on springs and react to the entity. Model it in Blockbench with its origin where it meets the
part; then move it with offset.
VanillaModels.player().attach("body", Armature.of("mymod", "wings"))
.offset(0, -2, 2)
.animate(animator -> animator.layer("base").drive(ctx -> ctx.living().isFallFlying() ? GLIDE : FOLD))
.when(player -> player.getItemBySlot(EquipmentSlot.CHEST).is(MyItems.WING_HARNESS));
-
Method Summary
Modifier and TypeMethodDescriptionSets up its animator when it is first worn by an entity.armature()offset(float x, float y, float z) Moves it from the part's pivot, in pixels (Y up, the model's front north, as in Blockbench).part()rotate(float x, float y, float z) Turns it on the part, in degrees.scale(float scale) setups()booleantest(net.minecraft.world.entity.LivingEntity entity) texture(Function<net.minecraft.world.entity.LivingEntity, @Nullable net.minecraft.resources.Identifier> texture) Swaps its first texture per entity; null keeps the armature's.@Nullable net.minecraft.resources.Identifiertexture(net.minecraft.world.entity.LivingEntity entity) voidtransform(com.mojang.blaze3d.vertex.PoseStack poseStack) Its offset, turn and scale, from the part's pivot (blocks, Blockbench's axes).org.joml.Matrix4ftransform(org.joml.Matrix4f matrix) Wears it only on entities that pass, asked every frame.
-
Method Details
-
offset
Moves it from the part's pivot, in pixels (Y up, the model's front north, as in Blockbench). -
rotate
Turns it on the part, in degrees. -
scale
-
animate
Sets up its animator when it is first worn by an entity. -
when
Wears it only on entities that pass, asked every frame. -
texture
public VanillaAttachment texture(Function<net.minecraft.world.entity.LivingEntity, @Nullable net.minecraft.resources.Identifier> texture) Swaps its first texture per entity; null keeps the armature's. -
part
-
armature
-
setups
-
test
@Internal public boolean test(net.minecraft.world.entity.LivingEntity entity) -
texture
@Internal @Nullable public @Nullable net.minecraft.resources.Identifier texture(net.minecraft.world.entity.LivingEntity entity) -
transform
@Internal public void transform(com.mojang.blaze3d.vertex.PoseStack poseStack) Its offset, turn and scale, from the part's pivot (blocks, Blockbench's axes). -
transform
@Internal public org.joml.Matrix4f transform(org.joml.Matrix4f matrix)
-