diff --git a/elements/McalecsVilager.mod.json b/elements/McalecsVilager.mod.json index 1d10d48..67cc035 100644 --- a/elements/McalecsVilager.mod.json +++ b/elements/McalecsVilager.mod.json @@ -23,9 +23,9 @@ }, "modelLayers": [], "modelWidth": 0.6, - "modelHeight": 1.8, + "modelHeight": 1.95, "modelShadowSize": 0.5, - "mountedYOffset": 0.3, + "mountedYOffset": 0.4, "hasSpawnEgg": true, "spawnEggBaseColor": { "value": -6710887, diff --git a/models/mojmap-1.20.x/ModelVillager.java b/models/mojmap-1.20.x/ModelVillager.java index 0a6dc3f..57b13cb 100644 --- a/models/mojmap-1.20.x/ModelVillager.java +++ b/models/mojmap-1.20.x/ModelVillager.java @@ -8,47 +8,70 @@ public class ModelVillager extends EntityModel { public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation( new ResourceLocation("modid", "villager"), "main"); private final ModelPart head; + private final ModelPart nose; + private final ModelPart headwear; + private final ModelPart headwear2; private final ModelPart body; + private final ModelPart bodywear; private final ModelPart arms; - private final ModelPart rightLeg; - private final ModelPart leftLeg; + private final ModelPart right_leg; + private final ModelPart left_leg; public ModelVillager(ModelPart root) { this.head = root.getChild("head"); + this.nose = root.getChild("nose"); + this.headwear = root.getChild("headwear"); + this.headwear2 = root.getChild("headwear2"); this.body = root.getChild("body"); + this.bodywear = root.getChild("bodywear"); this.arms = root.getChild("arms"); - this.rightLeg = root.getChild("rightLeg"); - this.leftLeg = root.getChild("leftLeg"); + this.right_leg = root.getChild("right_leg"); + this.left_leg = root.getChild("left_leg"); } public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition head = partdefinition.addOrReplaceChild("head", - CubeListBuilder.create().texOffs(0, 0) - .addBox(-4.0F, -9.5F, -4.0F, 8.0F, 10.0F, 8.0F, new CubeDeformation(0.0F)).texOffs(24, 0) - .addBox(-1.0F, -2.5F, -6.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), - PartPose.offset(0.0F, 1.0F, 0.0F)); + PartDefinition head = partdefinition.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 0).addBox( + -4.0F, -10.0F, -4.0F, 8.0F, 10.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - PartDefinition body = partdefinition.addOrReplaceChild("body", - CubeListBuilder.create().texOffs(16, 20) - .addBox(-4.0F, -21.0F, -3.0F, 8.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)).texOffs(0, 38) - .addBox(-4.0F, -21.0F, -3.0F, 8.0F, 20.0F, 6.0F, new CubeDeformation(0.3F)), - PartPose.offset(0.0F, 22.0F, 0.0F)); + PartDefinition nose = partdefinition.addOrReplaceChild("nose", CubeListBuilder.create().texOffs(24, 0).addBox( + -1.0F, -1.0F, -6.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -2.0F, 0.0F)); + + PartDefinition headwear = partdefinition.addOrReplaceChild("headwear", CubeListBuilder.create().texOffs(32, 0) + .addBox(-4.0F, -10.0F, -4.0F, 8.0F, 10.0F, 8.0F, new CubeDeformation(0.51F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition headwear2 = partdefinition + .addOrReplaceChild("headwear2", + CubeListBuilder.create().texOffs(30, 47).addBox(-8.0F, -8.0F, -6.0F, 16.0F, 16.0F, 1.0F, + new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -1.5708F, 0.0F, 0.0F)); + + PartDefinition body = partdefinition.addOrReplaceChild("body", CubeListBuilder.create().texOffs(16, 20).addBox( + -4.0F, 0.0F, -3.0F, 8.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition bodywear = partdefinition.addOrReplaceChild("bodywear", CubeListBuilder.create().texOffs(0, 38) + .addBox(-4.0F, 0.0F, -3.0F, 8.0F, 20.0F, 6.0F, new CubeDeformation(0.5F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); PartDefinition arms = partdefinition.addOrReplaceChild("arms", - CubeListBuilder.create().texOffs(44, 22) - .addBox(-8.0F, -4.9667F, -2.0F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.0F)).texOffs(44, 22) - .addBox(4.0F, -4.9667F, -2.0F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.0F)).texOffs(40, 38) - .addBox(-4.0F, -0.9667F, -2.0F, 8.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)), - PartPose.offsetAndRotation(0.0F, 6.4667F, -3.0F, -0.7418F, 0.0F, 0.0F)); + CubeListBuilder.create().texOffs(40, 38) + .addBox(-4.0F, 2.0F, -2.0F, 8.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)).texOffs(44, 22) + .addBox(-8.0F, -2.0F, -2.0F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 2.95F, -1.05F, -0.7505F, 0.0F, 0.0F)); + + PartDefinition mirrored = arms.addOrReplaceChild("mirrored", + CubeListBuilder.create().texOffs(44, 22).mirror() + .addBox(4.0F, -23.05F, -3.05F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offset(0.0F, 21.05F, 1.05F)); - PartDefinition rightLeg = partdefinition.addOrReplaceChild("rightLeg", CubeListBuilder.create().texOffs(0, 22) + PartDefinition right_leg = partdefinition.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(0, 22) .addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-2.0F, 12.0F, 0.0F)); - PartDefinition leftLeg = partdefinition.addOrReplaceChild("leftLeg", CubeListBuilder.create().texOffs(0, 22) + PartDefinition left_leg = partdefinition.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(0, 22) .addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(2.0F, 12.0F, 0.0F)); @@ -59,17 +82,27 @@ public static LayerDefinition createBodyLayer() { public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { head.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); + nose.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); + headwear.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); + headwear2.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); body.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); + bodywear.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); arms.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); - rightLeg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); - leftLeg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); + right_leg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); + left_leg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); } public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { this.head.yRot = netHeadYaw / (180F / (float) Math.PI); this.head.xRot = headPitch / (180F / (float) Math.PI); - this.rightLeg.xRot = Mth.cos(limbSwing * 1.0F) * 1.0F * limbSwingAmount; - this.leftLeg.xRot = Mth.cos(limbSwing * 1.0F) * -1.0F * limbSwingAmount; + this.nose.yRot = netHeadYaw / (180F / (float) Math.PI); + this.nose.xRot = headPitch / (180F / (float) Math.PI); + this.headwear.yRot = netHeadYaw / (180F / (float) Math.PI); + this.headwear.xRot = headPitch / (180F / (float) Math.PI); + this.headwear2.yRot = netHeadYaw / (180F / (float) Math.PI); + this.headwear2.xRot = headPitch / (180F / (float) Math.PI); + this.left_leg.xRot = Mth.cos(limbSwing * 1.0F) * -1.0F * limbSwingAmount; + this.right_leg.xRot = Mth.cos(limbSwing * 1.0F) * 1.0F * limbSwingAmount; } } \ No newline at end of file diff --git a/src/main/java/net/mcalec/mcalecs/client/model/ModelVillager.java b/src/main/java/net/mcalec/mcalecs/client/model/ModelVillager.java index 72f4631..b543a9f 100644 --- a/src/main/java/net/mcalec/mcalecs/client/model/ModelVillager.java +++ b/src/main/java/net/mcalec/mcalecs/client/model/ModelVillager.java @@ -24,49 +24,69 @@ public class ModelVillager extends EntityModel { // the entity renderer and passed into this model's constructor public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation("mcalecs", "model_villager"), "main"); public final ModelPart head; + public final ModelPart nose; + public final ModelPart headwear; + public final ModelPart headwear2; public final ModelPart body; + public final ModelPart bodywear; public final ModelPart arms; - public final ModelPart rightLeg; - public final ModelPart leftLeg; + public final ModelPart right_leg; + public final ModelPart left_leg; public ModelVillager(ModelPart root) { this.head = root.getChild("head"); + this.nose = root.getChild("nose"); + this.headwear = root.getChild("headwear"); + this.headwear2 = root.getChild("headwear2"); this.body = root.getChild("body"); + this.bodywear = root.getChild("bodywear"); this.arms = root.getChild("arms"); - this.rightLeg = root.getChild("rightLeg"); - this.leftLeg = root.getChild("leftLeg"); + this.right_leg = root.getChild("right_leg"); + this.left_leg = root.getChild("left_leg"); } public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition head = partdefinition.addOrReplaceChild("head", - CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -9.5F, -4.0F, 8.0F, 10.0F, 8.0F, new CubeDeformation(0.0F)).texOffs(24, 0).addBox(-1.0F, -2.5F, -6.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), - PartPose.offset(0.0F, 1.0F, 0.0F)); - PartDefinition body = partdefinition.addOrReplaceChild("body", - CubeListBuilder.create().texOffs(16, 20).addBox(-4.0F, -21.0F, -3.0F, 8.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)).texOffs(0, 38).addBox(-4.0F, -21.0F, -3.0F, 8.0F, 20.0F, 6.0F, new CubeDeformation(0.3F)), - PartPose.offset(0.0F, 22.0F, 0.0F)); - PartDefinition arms = partdefinition.addOrReplaceChild("arms", CubeListBuilder.create().texOffs(44, 22).addBox(-8.0F, -4.9667F, -2.0F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.0F)).texOffs(44, 22) - .addBox(4.0F, -4.9667F, -2.0F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.0F)).texOffs(40, 38).addBox(-4.0F, -0.9667F, -2.0F, 8.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)), - PartPose.offsetAndRotation(0.0F, 6.4667F, -3.0F, -0.7418F, 0.0F, 0.0F)); - PartDefinition rightLeg = partdefinition.addOrReplaceChild("rightLeg", CubeListBuilder.create().texOffs(0, 22).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-2.0F, 12.0F, 0.0F)); - PartDefinition leftLeg = partdefinition.addOrReplaceChild("leftLeg", CubeListBuilder.create().texOffs(0, 22).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(2.0F, 12.0F, 0.0F)); + PartDefinition head = partdefinition.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -10.0F, -4.0F, 8.0F, 10.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition nose = partdefinition.addOrReplaceChild("nose", CubeListBuilder.create().texOffs(24, 0).addBox(-1.0F, -1.0F, -6.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -2.0F, 0.0F)); + PartDefinition headwear = partdefinition.addOrReplaceChild("headwear", CubeListBuilder.create().texOffs(32, 0).addBox(-4.0F, -10.0F, -4.0F, 8.0F, 10.0F, 8.0F, new CubeDeformation(0.51F)), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition headwear2 = partdefinition.addOrReplaceChild("headwear2", CubeListBuilder.create().texOffs(30, 47).addBox(-8.0F, -8.0F, -6.0F, 16.0F, 16.0F, 1.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -1.5708F, 0.0F, 0.0F)); + PartDefinition body = partdefinition.addOrReplaceChild("body", CubeListBuilder.create().texOffs(16, 20).addBox(-4.0F, 0.0F, -3.0F, 8.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition bodywear = partdefinition.addOrReplaceChild("bodywear", CubeListBuilder.create().texOffs(0, 38).addBox(-4.0F, 0.0F, -3.0F, 8.0F, 20.0F, 6.0F, new CubeDeformation(0.5F)), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition arms = partdefinition.addOrReplaceChild("arms", + CubeListBuilder.create().texOffs(40, 38).addBox(-4.0F, 2.0F, -2.0F, 8.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)).texOffs(44, 22).addBox(-8.0F, -2.0F, -2.0F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 2.95F, -1.05F, -0.7505F, 0.0F, 0.0F)); + PartDefinition mirrored = arms.addOrReplaceChild("mirrored", CubeListBuilder.create().texOffs(44, 22).mirror().addBox(4.0F, -23.05F, -3.05F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, 21.05F, 1.05F)); + PartDefinition right_leg = partdefinition.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(0, 22).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-2.0F, 12.0F, 0.0F)); + PartDefinition left_leg = partdefinition.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(0, 22).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(2.0F, 12.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 64, 64); } @Override public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { head.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); + nose.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); + headwear.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); + headwear2.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); body.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); + bodywear.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); arms.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); - rightLeg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); - leftLeg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); + right_leg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); + left_leg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); } public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { this.head.yRot = netHeadYaw / (180F / (float) Math.PI); this.head.xRot = headPitch / (180F / (float) Math.PI); - this.rightLeg.xRot = Mth.cos(limbSwing * 1.0F) * 1.0F * limbSwingAmount; - this.leftLeg.xRot = Mth.cos(limbSwing * 1.0F) * -1.0F * limbSwingAmount; + this.nose.yRot = netHeadYaw / (180F / (float) Math.PI); + this.nose.xRot = headPitch / (180F / (float) Math.PI); + this.headwear.yRot = netHeadYaw / (180F / (float) Math.PI); + this.headwear.xRot = headPitch / (180F / (float) Math.PI); + this.headwear2.yRot = netHeadYaw / (180F / (float) Math.PI); + this.headwear2.xRot = headPitch / (180F / (float) Math.PI); + this.left_leg.xRot = Mth.cos(limbSwing * 1.0F) * -1.0F * limbSwingAmount; + this.right_leg.xRot = Mth.cos(limbSwing * 1.0F) * 1.0F * limbSwingAmount; } } diff --git a/src/main/java/net/mcalec/mcalecs/entity/McalecsVilagerEntity.java b/src/main/java/net/mcalec/mcalecs/entity/McalecsVilagerEntity.java index c265a7c..7fc029e 100644 --- a/src/main/java/net/mcalec/mcalecs/entity/McalecsVilagerEntity.java +++ b/src/main/java/net/mcalec/mcalecs/entity/McalecsVilagerEntity.java @@ -89,7 +89,7 @@ public boolean removeWhenFarAway(double distanceToClosestPlayer) { @Override public double getPassengersRidingOffset() { - return super.getPassengersRidingOffset() + 0.3; + return super.getPassengersRidingOffset() + 0.4; } @Override diff --git a/src/main/java/net/mcalec/mcalecs/init/McalecsModEntities.java b/src/main/java/net/mcalec/mcalecs/init/McalecsModEntities.java index 4bee54c..90eeba3 100644 --- a/src/main/java/net/mcalec/mcalecs/init/McalecsModEntities.java +++ b/src/main/java/net/mcalec/mcalecs/init/McalecsModEntities.java @@ -36,7 +36,7 @@ public class McalecsModEntities { public static final RegistryObject> MCALECS_VILAGER = register("mcalecs_vilager", EntityType.Builder.of(McalecsVilagerEntity::new, MobCategory.CREATURE).setShouldReceiveVelocityUpdates(true).setTrackingRange(32).setUpdateInterval(3).setCustomClientFactory(McalecsVilagerEntity::new) - .sized(0.6f, 1.8f)); + .sized(0.6f, 1.95f)); public static final RegistryObject> BOYKISSER = register("boykisser", EntityType.Builder.of(BoykisserEntity::new, MobCategory.CREATURE).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(BoykisserEntity::new)