This repository has been archived by the owner on May 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
986 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/main/java/com/min01/pillagerqueen/client/render/PillagerQueenAnimations.java
Large diffs are not rendered by default.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
src/main/java/com/min01/pillagerqueen/client/render/PillagerQueenRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.min01.pillagerqueen.client.render; | ||
|
||
import com.min01.pillagerqueen.client.render.model.ModModelLayers; | ||
import com.min01.pillagerqueen.client.render.model.PillagerQueenModel; | ||
import com.min01.pillagerqueen.common.entity.PillagerQueenEntity; | ||
|
||
import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; | ||
import net.minecraft.client.renderer.entity.MobRenderer; | ||
import net.minecraft.resources.ResourceLocation; | ||
|
||
public class PillagerQueenRenderer extends MobRenderer<PillagerQueenEntity, PillagerQueenModel> | ||
{ | ||
private static final ResourceLocation TEXTURE = new ResourceLocation("pillagerqueen", "textures/entity/pillagerqueen.png"); | ||
|
||
public PillagerQueenRenderer(Context p_174304_) | ||
{ | ||
super(p_174304_, new PillagerQueenModel(p_174304_.bakeLayer(ModModelLayers.PILLAGER_QUEEN)), 0.5F); | ||
} | ||
|
||
@Override | ||
public ResourceLocation getTextureLocation(PillagerQueenEntity p_115812_) | ||
{ | ||
return TEXTURE; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/min01/pillagerqueen/client/render/model/ModModelLayers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.min01.pillagerqueen.client.render.model; | ||
|
||
import com.min01.pillagerqueen.core.ModMain; | ||
|
||
import net.minecraft.client.model.geom.ModelLayerLocation; | ||
import net.minecraft.resources.ResourceLocation; | ||
|
||
public class ModModelLayers | ||
{ | ||
public static final ModelLayerLocation PILLAGER_QUEEN = new ModelLayerLocation(new ResourceLocation(ModMain.MOD_ID, "pillager_queen"), "main"); | ||
} |
126 changes: 126 additions & 0 deletions
126
src/main/java/com/min01/pillagerqueen/client/render/model/PillagerQueenModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
package com.min01.pillagerqueen.client.render.model; | ||
|
||
import com.min01.pillagerqueen.client.render.PillagerQueenAnimations; | ||
import com.min01.pillagerqueen.common.entity.PillagerQueenEntity; | ||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.blaze3d.vertex.VertexConsumer; | ||
import com.mojang.math.Vector3f; | ||
|
||
import net.minecraft.client.animation.KeyframeAnimations; | ||
import net.minecraft.client.model.HierarchicalModel; | ||
import net.minecraft.client.model.geom.ModelPart; | ||
import net.minecraft.client.model.geom.PartPose; | ||
import net.minecraft.client.model.geom.builders.CubeDeformation; | ||
import net.minecraft.client.model.geom.builders.CubeListBuilder; | ||
import net.minecraft.client.model.geom.builders.LayerDefinition; | ||
import net.minecraft.client.model.geom.builders.MeshDefinition; | ||
import net.minecraft.client.model.geom.builders.PartDefinition; | ||
import net.minecraft.util.Mth; | ||
|
||
public class PillagerQueenModel extends HierarchicalModel<PillagerQueenEntity> | ||
{ | ||
private static final Vector3f ANIMATION_VECTOR_CACHE = new Vector3f(); | ||
|
||
private final ModelPart root; | ||
|
||
private final ModelPart head; | ||
|
||
private final ModelPart leftLeg; | ||
|
||
private final ModelPart rightLeg; | ||
|
||
//private final ModelPart leftArm; | ||
|
||
//private final ModelPart rightArm; | ||
|
||
public PillagerQueenModel(ModelPart root) | ||
{ | ||
this.root = root; | ||
this.head = root.getChild("root").getChild("torso").getChild("head"); | ||
this.leftLeg = root.getChild("root").getChild("leg_left"); | ||
this.rightLeg = root.getChild("root").getChild("leg_right"); | ||
//this.leftArm = root.getChild("root").getChild("torso").getChild("arm_left"); | ||
//this.rightArm = root.getChild("root").getChild("torso").getChild("arm_right"); | ||
} | ||
|
||
public static LayerDefinition createBodyLayer() | ||
{ | ||
MeshDefinition meshdefinition = new MeshDefinition(); | ||
PartDefinition partdefinition = meshdefinition.getRoot(); | ||
PartDefinition root = partdefinition.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 23.0F, 0.0F)); | ||
root.addOrReplaceChild("skirt", CubeListBuilder.create().texOffs(55, 23).addBox(-4.0F, 0.5F, 0.0F, 8.0F, 7.0F, 4.0F, new CubeDeformation(0.5F)), PartPose.offset(0.0F, -12.5F, -2.0F)); | ||
root.addOrReplaceChild("leg_right", CubeListBuilder.create().texOffs(112, 13).addBox(-4.0F, 0.0F, -2.0F, 4.0F, 13.0F, 4.0F, new CubeDeformation(0.5F)) | ||
.texOffs(39, 23).addBox(-4.0F, 0.0F, -2.0F, 4.0F, 13.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -12.0F, 0.0F)); | ||
root.addOrReplaceChild("leg_left", CubeListBuilder.create().texOffs(112, 13).mirror().addBox(0.0F, 0.0F, -2.0F, 4.0F, 13.0F, 4.0F, new CubeDeformation(0.5F)).mirror(false) | ||
.texOffs(39, 23).mirror().addBox(0.0F, 0.0F, -2.0F, 4.0F, 13.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, -12.0F, 0.0F)); | ||
PartDefinition torso = root.addOrReplaceChild("torso", CubeListBuilder.create().texOffs(1, 23).addBox(-4.0F, -13.0F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -11.0F, 0.0F)); | ||
PartDefinition arm_left = torso.addOrReplaceChild("arm_left", CubeListBuilder.create().texOffs(25, 23).addBox(0.0F, -2.5F, -2.5F, 3.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)) | ||
.texOffs(0, 44).mirror().addBox(0.0F, -2.5F, -2.5F, 3.0F, 12.0F, 4.0F, new CubeDeformation(0.5F)).mirror(false), PartPose.offset(4.0F, -10.5F, 0.5F)); | ||
arm_left.addOrReplaceChild("arm_left_shoulder_r1", CubeListBuilder.create().texOffs(92, 23).mirror().addBox(0.0F, -3.0F, -3.0F, 5.0F, 3.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.0873F)); | ||
PartDefinition arm_left_sword = arm_left.addOrReplaceChild("arm_left_sword", CubeListBuilder.create().texOffs(56, 55).mirror().addBox(-1.0F, -1.0151F, -3.8732F, 2.0F, 2.0F, 8.0F, new CubeDeformation(0.0F)).mirror(false) | ||
.texOffs(0, 39).mirror().addBox(-0.5F, -2.0151F, -25.8732F, 1.0F, 4.0F, 21.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(1.0F, 8.9151F, -0.6268F)); | ||
arm_left_sword.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(65, 14).mirror().addBox(-1.0F, 0.0F, -0.8F, 2.0F, 4.0F, 1.0F, new CubeDeformation(0.001F)).mirror(false), PartPose.offsetAndRotation(0.0F, -0.0151F, -3.8732F, -0.1309F, 0.0F, 0.0F)); | ||
arm_left_sword.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(65, 14).mirror().addBox(-1.0F, -4.0F, -0.8F, 2.0F, 4.0F, 1.0F, new CubeDeformation(0.001F)).mirror(false), PartPose.offsetAndRotation(0.0F, 0.0849F, -3.8732F, 0.1309F, 0.0F, 0.0F)); | ||
arm_left_sword.addOrReplaceChild("cube_r3", CubeListBuilder.create().texOffs(107, 31).mirror().addBox(5.0F, -1.6F, -1.0F, 1.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-5.5F, 0.3849F, -26.1732F, 0.7854F, 0.0F, 0.0F)); | ||
PartDefinition arm_right = torso.addOrReplaceChild("arm_right", CubeListBuilder.create().texOffs(25, 23).mirror().addBox(-3.0F, -2.5F, -2.5F, 3.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false) | ||
.texOffs(0, 44).addBox(-3.0F, -2.5F, -2.5F, 3.0F, 12.0F, 4.0F, new CubeDeformation(0.5F)), PartPose.offset(-4.0F, -10.5F, 0.5F)); | ||
arm_right.addOrReplaceChild("arm_right_shoulder_r1", CubeListBuilder.create().texOffs(92, 23).addBox(-5.0F, -3.0F, -3.0F, 5.0F, 3.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0873F)); | ||
PartDefinition arm_right_sword = arm_right.addOrReplaceChild("arm_right_sword", CubeListBuilder.create().texOffs(71, 26).addBox(-1.0F, -1.0151F, -3.8732F, 2.0F, 2.0F, 8.0F, new CubeDeformation(0.0F)) | ||
.texOffs(0, 39).addBox(-0.5F, -2.0151F, -25.8732F, 1.0F, 4.0F, 21.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.0F, 8.9151F, -0.6268F)); | ||
arm_right_sword.addOrReplaceChild("cube_r4", CubeListBuilder.create().texOffs(65, 14).addBox(-1.0F, 0.0F, -0.8F, 2.0F, 4.0F, 1.0F, new CubeDeformation(0.001F)), PartPose.offsetAndRotation(0.0F, -0.0151F, -3.8732F, -0.1309F, 0.0F, 0.0F)); | ||
arm_right_sword.addOrReplaceChild("cube_r5", CubeListBuilder.create().texOffs(65, 14).addBox(-1.0F, -4.0F, -0.8F, 2.0F, 4.0F, 1.0F, new CubeDeformation(0.001F)), PartPose.offsetAndRotation(0.0F, 0.0849F, -3.8732F, 0.1309F, 0.0F, 0.0F)); | ||
arm_right_sword.addOrReplaceChild("cube_r6", CubeListBuilder.create().texOffs(107, 31).addBox(-6.0F, -1.6F, -1.0F, 1.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(5.5F, 0.3849F, -26.1732F, 0.7854F, 0.0F, 0.0F)); | ||
PartDefinition chest = torso.addOrReplaceChild("chest", CubeListBuilder.create(), PartPose.offset(0.0F, -12.0F, -2.0F)); | ||
chest.addOrReplaceChild("chest_r1", CubeListBuilder.create().texOffs(88, 13).addBox(-4.0F, 0.0F, 0.0F, 8.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -0.6545F, 0.0F, 0.0F)); | ||
PartDefinition head = torso.addOrReplaceChild("head", CubeListBuilder.create().texOffs(23, 42).addBox(-2.6291F, -10.7333F, -3.8348F, 8.0F, 10.0F, 8.0F, new CubeDeformation(0.0F)) | ||
.texOffs(102, -13).addBox(1.3709F, -13.7333F, -3.8348F, 0.0F, 13.0F, 13.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.3709F, -12.2667F, -0.1652F)); | ||
head.addOrReplaceChild("hair_extension_r1", CubeListBuilder.create().texOffs(70, 0).addBox(-9.0F, -39.0F, 0.0F, 7.0F, 15.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(1.8709F, 23.4667F, 0.1652F, 0.0F, -0.576F, 0.0F)); | ||
PartDefinition hair = head.addOrReplaceChild("hair", CubeListBuilder.create().texOffs(1, 0).addBox(-16.0F, 0.0F, 0.0F, 32.0F, 13.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(1.3709F, -0.7333F, 4.1652F, 0.0873F, 0.0F, 0.0F)); | ||
hair.addOrReplaceChild("hair_tip", CubeListBuilder.create().texOffs(1, 12).addBox(-16.0F, 0.0F, 0.0F, 32.0F, 11.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 13.0F, 0.0F, 0.1745F, 0.0F, 0.0F)); | ||
PartDefinition helmet = head.addOrReplaceChild("helmet", CubeListBuilder.create(), PartPose.offsetAndRotation(1.3709F, 15.7167F, 10.8652F, -0.0436F, 0.0F, 0.0F)); | ||
helmet.addOrReplaceChild("helmet_flair_right_r1", CubeListBuilder.create().texOffs(47, 35).addBox(-5.2326F, -2.5F, 2.7326F, 0.0F, 5.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0461F, -24.1302F, -13.8635F, 0.7333F, -0.639F, -0.493F)); | ||
helmet.addOrReplaceChild("helmet_flair_left_r1", CubeListBuilder.create().texOffs(47, 35).mirror().addBox(4.3F, -30.3F, 3.6F, 0.0F, 5.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.7333F, 0.639F, 0.493F)); | ||
helmet.addOrReplaceChild("helmet_top_r1", CubeListBuilder.create().texOffs(83, 31).addBox(-7.4506F, -28.54F, -7.4506F, 8.0F, 5.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -16.3F, 9.8F, 1.1475F, -0.3897F, -0.7006F)); | ||
helmet.addOrReplaceChild("helmet_r1", CubeListBuilder.create().texOffs(57, 36).addBox(-4.0F, -30.0F, -4.0F, 8.0F, 5.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, -0.6F, 0.7333F, -0.639F, -0.493F)); | ||
head.addOrReplaceChild("nose", CubeListBuilder.create().texOffs(65, 19).addBox(-1.0F, -2.0F, -1.0F, 2.0F, 6.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(1.3709F, -3.7333F, -4.8348F)); | ||
PartDefinition wing_right = torso.addOrReplaceChild("wing_right", CubeListBuilder.create().texOffs(10, 64).addBox(-11.0F, -7.0F, 0.0F, 11.0F, 16.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, -11.0F, 2.0F, 0.0055F, 0.1747F, -0.0861F)); | ||
wing_right.addOrReplaceChild("wing_right_tip", CubeListBuilder.create().texOffs(33, 93).addBox(-22.0F, -22.0F, 0.0F, 22.0F, 35.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-11.0F, 1.0F, 0.0F, 0.0F, -0.829F, 0.0F)); | ||
PartDefinition wing_left = torso.addOrReplaceChild("wing_left", CubeListBuilder.create().texOffs(10, 64).mirror().addBox(0.0F, -7.0F, 0.0F, 11.0F, 16.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(1.0F, -11.0F, 2.0F, 0.0055F, -0.1747F, 0.0861F)); | ||
wing_left.addOrReplaceChild("wing_left_tip", CubeListBuilder.create().texOffs(33, 93).mirror().addBox(0.0F, -22.0F, 0.0F, 22.0F, 35.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(11.0F, 1.0F, 0.0F, 0.0F, 0.829F, 0.0F)); | ||
return LayerDefinition.create(meshdefinition, 128, 128); | ||
} | ||
|
||
@Override | ||
public void setupAnim(PillagerQueenEntity pillagerQueen, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) | ||
{ | ||
this.root().getAllParts().forEach(ModelPart::resetPose); | ||
this.head.yRot = netHeadYaw * 0.017453292F; | ||
this.head.xRot = headPitch * 0.017453292F; | ||
KeyframeAnimations.animate(this, PillagerQueenAnimations.PILLAGERQUEEN_IDLE, (long)(50.0F * ageInTicks), 1.0F, ANIMATION_VECTOR_CACHE); | ||
this.rightLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount * 0.5F; | ||
this.rightLeg.yRot = 0.0F; | ||
this.rightLeg.zRot = 0.0F; | ||
this.leftLeg.xRot = Mth.cos(limbSwing * 0.6662F + 3.1415927F) * 1.4F * limbSwingAmount * 0.5F; | ||
this.leftLeg.yRot = 0.0F; | ||
this.leftLeg.zRot = 0.0F; | ||
animate(pillagerQueen.meleeAttackAnimationState, PillagerQueenAnimations.PILLAGERQUEEN_MELEE, ageInTicks); | ||
if (!pillagerQueen.meleeAttackAnimationState.isStarted()) | ||
animate(pillagerQueen.walkAnimationState, PillagerQueenAnimations.PILLAGERQUEEN_WALK, ageInTicks); | ||
if ((float)pillagerQueen.meleeAttackAnimationState.getAccumulatedTime()/ 1000.0F >= PillagerQueenAnimations.PILLAGERQUEEN_MELEE.lengthInSeconds()) | ||
pillagerQueen.meleeAttackAnimationState.stop(); | ||
animate(pillagerQueen.floatingAnimationState, PillagerQueenAnimations.PILLAGERQUEEN_FLOATING, ageInTicks); | ||
animate(pillagerQueen.fallingAnimationState, PillagerQueenAnimations.PILLAGERQUEEN_FALLING, ageInTicks); | ||
} | ||
|
||
@Override | ||
public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) | ||
{ | ||
this.root.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); | ||
} | ||
|
||
@Override | ||
public ModelPart root() | ||
{ | ||
return this.root; | ||
} | ||
} |
Oops, something went wrong.