Class FpModelRenderer
java.lang.Object
com.github.razorplay01.fp_pal.firstperson.FpModelRenderer
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 TypeMethodDescriptionstatic intstatic voidclear()Stops rendering the preview model.static net.minecraft.resources.IdentifiergeoLocation(net.minecraft.resources.Identifier id) static booleanstatic Stringstatic booleanload(net.minecraft.resources.Identifier id) Loadsassets/<namespace>/fp_models/<path>.geo.jsonand points the renderer atassets/<namespace>/textures/fp/<path>.png.static booleanload(net.minecraft.resources.Identifier id, net.minecraft.resources.Identifier textureLocation) Loads a model with an explicit texture.static booleanloadForAnimation(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.jsonfile it was declared in.static net.minecraft.resources.IdentifiermodelId()static voidrender(com.mojang.blaze3d.vertex.PoseStack poseStack, FpRenderBuffer render, int packedLight) Renders the selected model in the current pose.static voidsetAutoResolve(boolean value) Enables or disables automatic model selection for future FP animations.static net.minecraft.resources.Identifiertexture()
-
Method Details
-
load
public static boolean load(net.minecraft.resources.Identifier id) Loadsassets/<namespace>/fp_models/<path>.geo.jsonand points the renderer atassets/<namespace>/textures/fp/<path>.png.- Parameters:
id- model id, for exampleplayer_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.jsonfile 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 withload(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
-
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.
-