Class LimbBend

java.lang.Object
net.ixdarklord.coolcatcanvas.internal.client.armature.vanilla.LimbBend

public final class LimbBend extends Object
Bends a vanilla limb the way an elbow or knee bends: a smooth arc through the middle of its length, the end beyond it turned whole. The part above the bend stays put, the bend itself is a curved stretch (not a fold between two rigid halves), so the limb keeps its outline with no gap, crease or overlap, and the texture follows round the curve.

Only the faces running along the limb are cut, into thin slices through the bend; the ends are moved whole. All of it happens as the part is drawn, with no new model and nothing allocated, so armor, sleeves and anything else drawn on the same part bend the same way when given the same bend.

Geometry: the limb runs down its Y (vanilla's Y points down, so from shoulder to hand); a point s toward the bend direction and y along the limb, within the bend [a, b], goes round an arc of radius R - s (with R = (b - a) / angle) through (y - a) / (b - a) of the angle. That keeps the limb's centre line its own length, squeezes the inside of the bend and stretches the outside, as skin does.

  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    bendTree(net.minecraft.client.model.geom.ModelPart part, float amount, float direction, float start, float end, List<net.minecraft.client.model.geom.ModelPart> touched)
    Bends a part and everything on it (sleeves, pants: layers made as its children) the same way.
    static void
    draw(BendablePart bend, com.mojang.blaze3d.vertex.PoseStack.Pose pose, com.mojang.blaze3d.vertex.VertexConsumer buffer, int light, int overlay, int color)
    Draws a bent part's cubes; called in place of vanilla's drawing of them.
    static void
    followEnd(BendablePart bend, com.mojang.blaze3d.vertex.PoseStack poseStack)
    Moves a pose stack at a bent part's pivot to where its far end has gone, so what hangs at the end (an item in a hand) follows the bend.
    static float[]
    zone(net.minecraft.client.model.geom.ModelPart part)
    The bend's stretch along a part: its middle third, from its cubes' extent along Y.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • zone

      public static float[] zone(net.minecraft.client.model.geom.ModelPart part)
      The bend's stretch along a part: its middle third, from its cubes' extent along Y.
    • draw

      public static void draw(BendablePart bend, com.mojang.blaze3d.vertex.PoseStack.Pose pose, com.mojang.blaze3d.vertex.VertexConsumer buffer, int light, int overlay, int color)
      Draws a bent part's cubes; called in place of vanilla's drawing of them.
    • followEnd

      public static void followEnd(BendablePart bend, com.mojang.blaze3d.vertex.PoseStack poseStack)
      Moves a pose stack at a bent part's pivot to where its far end has gone, so what hangs at the end (an item in a hand) follows the bend. Nothing is done for a straight part.
    • bendTree

      public static void bendTree(net.minecraft.client.model.geom.ModelPart part, float amount, float direction, float start, float end, List<net.minecraft.client.model.geom.ModelPart> touched)
      Bends a part and everything on it (sleeves, pants: layers made as its children) the same way.