// Native Minecraft 1.21.11
package com.xfestudio.mydimensionlord.client.gear;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.renderer.entity.state.HumanoidRenderState;
import net.minecraft.client.renderer.entity.state.ArmorStandRenderState;
import net.minecraft.world.entity.EquipmentSlot;
/** Pose is rebuilt from each submitted entity's state, never shared across wearers. */
public final class LordArmorModel extends HumanoidModel<HumanoidRenderState> {
public LordArmorModel(EquipmentSlot slot) { super(LordArmorGeometry.create(slot).bakeRoot()); }
@Override public void setupAnim(HumanoidRenderState state) {
super.setupAnim(state);
if (state instanceof ArmorStandRenderState stand) {
rotation(head,stand.headPose); rotation(body,stand.bodyPose);
rotation(leftArm,stand.leftArmPose); rotation(rightArm,stand.rightArmPose);
rotation(leftLeg,stand.leftLegPose); rotation(rightLeg,stand.rightLegPose);
}
animate(net.minecraft.util.Util.getMillis());
}
private static void rotation(ModelPart part,net.minecraft.core.Rotations rotation) {
part.xRot=rotation.x()*(float)(Math.PI/180);
part.yRot=rotation.y()*(float)(Math.PI/180);
part.zRot=rotation.z()*(float)(Math.PI/180);
}
public void animate(long millis) {
for (ModelPart part : new ModelPart[]{head,body,leftArm,rightArm,leftLeg,rightLeg}) {
part.getAllParts().forEach(bone -> {
if (bone != part) bone.resetPose();
});
}
animatePart(head,"crown_spark",millis,0,.3);
animatePart(head,"crown_tip",millis,0,.3);
animatePart(body,"chest_core",millis,.4,.12);
animatePart(body,"back_core",millis,1.5,.16);
animatePart(body,"belt_core",millis,.8,.12);
animatePart(body,"hip_spark_-1",millis,0,.22);
animatePart(body,"hip_spark_1",millis,2,.22);
animatePart(body,"shoulder_spark_1",millis,0,.35);
animatePart(body,"shoulder_spark_-1",millis,2,.35);
for (ModelPart leg:new ModelPart[]{leftLeg,rightLeg}) {
animatePart(leg,"knee_core",millis,1,.1);
animatePart(leg,"boot_core",millis,.6,.12);
animatePart(leg,"heel_spark",millis,1,.2);
}
}
private static void animatePart(ModelPart parent,String name,long millis,double phase,double amplitude) {
if (!parent.hasChild(name)) return;
ModelPart bone=parent.getChild(name);
bone.y+=(float)(GearAnimation.bob(millis,phase)*amplitude);
bone.yRot+=(float)(GearAnimation.bob(millis,phase+1)*.24);
}
}
// Native Minecraft 1.21.11
package com.xfestudio.mydimensionlord.client.gear;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.renderer.entity.state.HumanoidRenderState;
import net.minecraft.client.renderer.entity.state.ArmorStandRenderState;
import net.minecraft.world.entity.EquipmentSlot;
/** Pose is rebuilt from each submitted entity's state, never shared across wearers. */
public final class LordArmorModel extends HumanoidModel<HumanoidRenderState> {
public LordArmorModel(EquipmentSlot slot) { super(LordArmorGeometry.create(slot).bakeRoot()); }
@Override public void setupAnim(HumanoidRenderState state) {
super.setupAnim(state);
if (state instanceof ArmorStandRenderState stand) {
rotation(head,stand.headPose); rotation(body,stand.bodyPose);
rotation(leftArm,stand.leftArmPose); rotation(rightArm,stand.rightArmPose);
rotation(leftLeg,stand.leftLegPose); rotation(rightLeg,stand.rightLegPose);
}
animate(net.minecraft.util.Util.getMillis());
}
private static void rotation(ModelPart part,net.minecraft.core.Rotations rotation) {
part.xRot=rotation.x()*(float)(Math.PI/180);
part.yRot=rotation.y()*(float)(Math.PI/180);
part.zRot=rotation.z()*(float)(Math.PI/180);
}
public void animate(long millis) {
for (ModelPart part : new ModelPart[]{head,body,leftArm,rightArm,leftLeg,rightLeg}) {
part.getAllParts().forEach(bone -> {
if (bone != part) bone.resetPose();
});
}
animatePart(head,"crown_spark",millis,0,.3);
animatePart(head,"crown_tip",millis,0,.3);
animatePart(body,"chest_core",millis,.4,.12);
animatePart(body,"back_core",millis,1.5,.16);
animatePart(body,"belt_core",millis,.8,.12);
animatePart(body,"hip_spark_-1",millis,0,.22);
animatePart(body,"hip_spark_1",millis,2,.22);
animatePart(body,"shoulder_spark_1",millis,0,.35);
animatePart(body,"shoulder_spark_-1",millis,2,.35);
for (ModelPart leg:new ModelPart[]{leftLeg,rightLeg}) {
animatePart(leg,"knee_core",millis,1,.1);
animatePart(leg,"boot_core",millis,.6,.12);
animatePart(leg,"heel_spark",millis,1,.2);
}
}
private static void animatePart(ModelPart parent,String name,long millis,double phase,double amplitude) {
if (!parent.hasChild(name)) return;
ModelPart bone=parent.getChild(name);
bone.y+=(float)(GearAnimation.bob(millis,phase)*amplitude);
bone.yRot+=(float)(GearAnimation.bob(millis,phase+1)*.24);
}
}