Class FpModelRenderer

java.lang.Object
com.github.razorplay01.fp_pal.firstperson.FpModelRenderer

public final class FpModelRenderer extends Object
Renders a Bedrock geo.json model in PAL's first-person arm pass, using the same bone transforms the FP animation produces (FpRenderState.getExtraBone(String)). The root bone is already applied by FpArmRenderUtil.applyRootTransform(PoseStack, PlayerAnimBone), arm bones are skipped (PAL draws the vanilla arms on them) and every other bone is rendered with its animated transform plus the static geo rotation.

The model is resolved automatically when a first-person animation is played (see loadForAnimation(Identifier)), and only when both the .geo.json and the matching texture exist. /fp_anim model remains as an explicit override.

  • Method Summary

    Modifier and Type
    Method
    Description
    static int
     
    static void
    Stops rendering the preview model.
    static net.minecraft.resources.Identifier
    geoLocation(net.minecraft.resources.Identifier id)
     
    static boolean
     
    static String
     
    static boolean
    load(net.minecraft.resources.Identifier id)
    Loads assets/<namespace>/fp_models/<path>.geo.json and points the renderer at assets/<namespace>/textures/fp/<path>.png.
    static boolean
    load(net.minecraft.resources.Identifier id, net.minecraft.resources.Identifier textureLocation)
    Loads a model with an explicit texture.
    static boolean
    loadForAnimation(net.minecraft.resources.Identifier animationId)
    Resolves and loads the item model that belongs to a first-person animation: the animation id itself first, then the .animation.json file it was declared in.
    static net.minecraft.resources.Identifier
     
    static void
    render(com.mojang.blaze3d.vertex.PoseStack poseStack, FpRenderBuffer render, int packedLight)
    Renders the selected model in the current pose.
    static void
    setAutoResolve(boolean value)
    Enables or disables automatic model selection for future FP animations.
    static net.minecraft.resources.Identifier
     

    Methods inherited from class Object

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

    • load

      public static boolean load(net.minecraft.resources.Identifier id)
      Loads assets/<namespace>/fp_models/<path>.geo.json and points the renderer at assets/<namespace>/textures/fp/<path>.png.
      Parameters:
      id - model id, for example player_animation_library:peacemaker
      Returns:
      true when the model was parsed
    • load

      public static boolean load(net.minecraft.resources.Identifier id, net.minecraft.resources.Identifier textureLocation)
      Loads a model with an explicit texture.
    • clear

      public static void clear()
      Stops rendering the preview model.
    • loadForAnimation

      public static boolean loadForAnimation(net.minecraft.resources.Identifier animationId)
      Resolves and loads the item model that belongs to a first-person animation: the animation id itself first, then the .animation.json file it was declared in. When neither has a model the preview is cleared, so a previous animation's model is never shown.
      Returns:
      true when a model was loaded
    • setAutoResolve

      public static void setAutoResolve(boolean value)
      Enables or disables automatic model selection for future FP animations. Loading a model explicitly with load(Identifier) re-enables it.
    • isAutoResolve

      public static boolean isAutoResolve()
    • modelId

      @Nullable public static net.minecraft.resources.Identifier modelId()
    • texture

      @Nullable public static net.minecraft.resources.Identifier texture()
    • lastError

      @Nullable public static String lastError()
    • boneCount

      public static int boneCount()
    • geoLocation

      public static net.minecraft.resources.Identifier geoLocation(net.minecraft.resources.Identifier id)
      Returns:
      the resource id a model id maps to (fp_models/<path>.geo.json)
    • render

      public static void render(com.mojang.blaze3d.vertex.PoseStack poseStack, FpRenderBuffer render, int packedLight)
      Renders the selected model in the current pose. The pose must already be the model frame (hand anchor + display transform + root bone), exactly like the arm pass.