From 869c6fac84360b49e238e7e26ce623a27e591eb7 Mon Sep 17 00:00:00 2001 From: Sollace Date: Wed, 22 Jun 2022 23:29:55 +0200 Subject: [PATCH] Added kirin models --- .../client/model/part/LionTail.java | 93 +++++++++++++++++++ .../models/components/ears.json | 11 ++- .../models/components/horn.json | 16 ++-- .../models/components/lion_tail.json | 75 +++++++++++++++ .../models/races/alex/kirin.json | 7 +- .../models/races/steve/kirin.json | 59 +++++++++++- 6 files changed, 250 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/minelittlepony/client/model/part/LionTail.java create mode 100644 src/main/resources/assets/minelittlepony/models/components/lion_tail.json diff --git a/src/main/java/com/minelittlepony/client/model/part/LionTail.java b/src/main/java/com/minelittlepony/client/model/part/LionTail.java new file mode 100644 index 00000000..94448414 --- /dev/null +++ b/src/main/java/com/minelittlepony/client/model/part/LionTail.java @@ -0,0 +1,93 @@ +package com.minelittlepony.client.model.part; + +import net.minecraft.client.model.ModelPart; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.util.math.MathHelper; + +import com.minelittlepony.api.model.IPart; +import com.minelittlepony.client.model.IPonyModel; +import com.minelittlepony.common.util.animation.Interpolator; +import com.minelittlepony.mson.api.ModelContext; +import com.minelittlepony.mson.api.MsonModel; + +import java.util.UUID; + +public class LionTail implements IPart, MsonModel { + + private ModelPart tail; + private IPonyModel model; + + public LionTail(ModelPart tree) { + tail = tree.getChild("tail"); + } + + @Override + public void init(ModelContext context) { + model = context.getModel(); + } + + @Override + public void setRotationAndAngles(boolean rainboom, UUID interpolatorId, float move, float swing, float bodySwing, float ticks) { + + float baseSail = 1F; + + float speed = swing > 0.01F ? 6 : 90; + Interpolator interpolator = Interpolator.linear(interpolatorId); + + float straightness = 1.6F * (1 + (float)Math.sin(ticks / speed) / 8F); + float bend = (float)Math.sin(Math.PI/2F + 2 * ticks / speed) / 16F; + + if (model.getAttributes().isCrouching) { + baseSail += 1; + straightness += 0.5F; + } + + straightness = interpolator.interpolate("kirin_tail_straightness", straightness, 10); + bend = interpolator.interpolate("kirin_tail_bendiness", bend, 10); + + tail.pitch = baseSail; + tail.pitch += swing / 2; + tail.yaw = bend; + tail.roll = bodySwing * 2; + + float sinTickFactor = MathHelper.sin(ticks * 0.067f) * 0.05f; + tail.pitch += sinTickFactor; + tail.yaw += sinTickFactor; + + var tail2 = tail.getChild("tail2"); + tail2.pitch = -(baseSail + sinTickFactor) / straightness; + tail2.yaw = bend; + tail2.roll = bodySwing; + + var tail3 = tail2.getChild("tail3"); + tail3.pitch = tail2.pitch / straightness; + tail3.yaw = tail2.yaw; + tail3.roll = -bodySwing; + + var tail4 = tail3.getChild("tail4"); + tail4.pitch = tail3.pitch / straightness; + tail4.yaw = -tail3.yaw * 7F; + tail4.roll = -bodySwing; + + var tail5 = tail4.getChild("tail5"); + tail5.pitch = -tail4.pitch * straightness; + tail5.yaw = -tail4.yaw * 2F; + tail5.roll = -bodySwing * 2; + + var tail6 = tail5.getChild("tail6"); + tail6.pitch = tail5.pitch * straightness; + tail6.yaw = tail5.yaw; + tail6.roll = -bodySwing * 2F; + } + + @Override + public void setVisible(boolean visible) { + tail.visible = visible; + } + + @Override + public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) { + tail.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); + } +} diff --git a/src/main/resources/assets/minelittlepony/models/components/ears.json b/src/main/resources/assets/minelittlepony/models/components/ears.json index 2158b5c3..26495b7d 100644 --- a/src/main/resources/assets/minelittlepony/models/components/ears.json +++ b/src/main/resources/assets/minelittlepony/models/components/ears.json @@ -3,22 +3,27 @@ "locals": { "x": 0, "y": 0, - "z": 0 + "z": 0, + "ear_pronouncement": 0, + "ear_spread": 0, + "ear_spread_neg": [0, "-", "#ear_spread"] }, "data": { "right": { "texture": {"u": 12, "v": 16}, "pivot": ["#x", "#y", "#z"], + "rotate": [0, 0, "#ear_spread"], "cubes": [ - { "from": [-4, -8, -1], "size": [2, 2, 2] } + { "from": [-4, -8, -1], "size": [2, 2, 2], "dilate": [0, "#ear_pronouncement", 0] } ] }, "left": { "texture": {"u": 12, "v": 16}, "pivot": ["#x", "#y", "#z"], "mirror": [true, false, false], + "rotate": [0, 0, "#ear_spread_neg"], "cubes": [ - { "from": [2, -8, -1], "size": [2, 2, 2] } + { "from": [2, -8, -1], "size": [2, 2, 2], "dilate": [0, "#ear_pronouncement", 0] } ] } } diff --git a/src/main/resources/assets/minelittlepony/models/components/horn.json b/src/main/resources/assets/minelittlepony/models/components/horn.json index 6609bf12..dc6029fc 100644 --- a/src/main/resources/assets/minelittlepony/models/components/horn.json +++ b/src/main/resources/assets/minelittlepony/models/components/horn.json @@ -3,32 +3,36 @@ "locals": { "x": 0, "y": 0, - "z": 0 + "z": 0, + "scale": 0, + "incline": 29, + "corona_inner_dilate": ["#scale", "+", 0.5], + "corona_outer_dilate": ["#scale", "+", 0.8] }, "data": { "bone": { - "rotate": [29, 0, 0], + "rotate": ["#incline", 0, 0], "pivot": ["#x", "#y", "#z"], "cubes": [ - { "from": [-0.5, -11, -3.5], "size": [1, 4, 1] } + { "from": [-0.5, -11, -3.5], "size": [1, 4, 1], "dilate": "#scale" } ] }, "corona": { - "rotate": [29, 0, 0], + "rotate": ["#incline", 0, 0], "pivot": ["#x", "#y", "#z"], "cubes": [ { "type": "mson:cone", "size": [1, 4, 1], "from": [-0.5, -11, -3.5], - "dilate": 0.5, + "dilate": "#corona_inner_dilate", "taper": 0.4 }, { "type": "mson:cone", "size": [1, 3, 1], "from": [-0.5, -11, -3.5], - "dilate": 0.8, + "dilate": "#corona_outer_dilate", "taper": 0.4 } ] diff --git a/src/main/resources/assets/minelittlepony/models/components/lion_tail.json b/src/main/resources/assets/minelittlepony/models/components/lion_tail.json new file mode 100644 index 00000000..dc2f344a --- /dev/null +++ b/src/main/resources/assets/minelittlepony/models/components/lion_tail.json @@ -0,0 +1,75 @@ +{ + "texture": {"w": 64, "h": 64}, + "data": { + "tail": { + "texture": {"u": 32, "v": 0}, + "pivot": [0, 3, 17], + "cubes": [ + { "from": [-1, -1, -1], "size": [2, 4, 2], "dilate": 0.3 } + ], + "children": { + "tail2": { + "texture": {"u": 32, "v": 0}, + "pivot": [0, 3, 0], + "cubes": [ + { "from": [-1, -1, -1], "size": [2, 4, 2] } + ], + "children": { + "tail3": { + "texture": {"u": 32, "v": 0}, + "pivot": [0, 3, 0], + "cubes": [ + { "from": [-1, -1, -1], "size": [2, 4, 2], "dilate": -0.2 } + ], + "children": { + "tail4": { + "texture": {"u": 32, "v": 0}, + "pivot": [0, 3, 0], + "cubes": [ + { "from": [-1, -1, -1], "size": [2, 4, 2], "dilate": -0.3 } + ], + "children": { + "tail5": { + "texture": {"u": 32, "v": 0}, + "pivot": [0, 3, 0], + "cubes": [ + { "from": [-1, -1, -1], "size": [2, 4, 2], "dilate": -0.4 } + ], + "children": { + "tail6": { + "texture": {"u": 32, "v": 0}, + "pivot": [0, 3, 0], + "cubes": [ + { "from": [-1, -1, -1], "size": [2, 4, 2], "dilate": -0.4 } + ], + "children": { + "flare_x": { + "texture": {"u": 33, "v": 6}, + "pivot": [0, 2, -1], + "rotate": [0,-20,90], + "cubes": [ + { "from": [0, 0, 0], "size": [4, 0.001, 2] } + ] + }, + "flare_z": { + "texture": {"u": 33, "v": 6}, + "pivot": [-1, 2, 0], + "rotate": [90,-20,90], + "cubes": [ + { "from": [0, 0, 0], "size": [4, 0.001, 2] } + ] + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/src/main/resources/assets/minelittlepony/models/races/alex/kirin.json b/src/main/resources/assets/minelittlepony/models/races/alex/kirin.json index 8090a2db..c90920c5 100644 --- a/src/main/resources/assets/minelittlepony/models/races/alex/kirin.json +++ b/src/main/resources/assets/minelittlepony/models/races/alex/kirin.json @@ -1,3 +1,8 @@ { - "parent": "minelittlepony:races/alex/unicorn" + "parent": "minelittlepony:races/alex/kirin", + "locals": { + "arm_width": 3, + "arm_rotation_x": 2, + "arm_rotation_y": 8.5 + } } diff --git a/src/main/resources/assets/minelittlepony/models/races/steve/kirin.json b/src/main/resources/assets/minelittlepony/models/races/steve/kirin.json index 17eab8e0..df174c14 100644 --- a/src/main/resources/assets/minelittlepony/models/races/steve/kirin.json +++ b/src/main/resources/assets/minelittlepony/models/races/steve/kirin.json @@ -1,3 +1,60 @@ { - "parent": "minelittlepony:races/steve/unicorn" + "parent": "minelittlepony:races/steve/unicorn", + "data": { + "head": { + "pivot": [ 0, 0, -2 ], + "cubes": [ + { "from": [-4, -6, -6], "size": [ 8, 8, 8] } + ], + "children": { + "snout": { + "type": "mson:slot", + "name": "snout", + "implementation": "com.minelittlepony.client.model.part.PonySnout", + "data": "minelittlepony:components/snout" + }, + "ears": { + "type": "mson:slot", + "name": "ears", + "implementation": "com.minelittlepony.client.model.part.PonyEars", + "locals": { + "ear_pronouncement": 0.9, + "ear_spread": 3 + }, + "data": "minelittlepony:components/ears" + }, + "horn": { + "type": "mson:slot", + "name": "horn", + "implementation": "com.minelittlepony.client.model.part.UnicornHorn", + "locals": { + "incline": 19, + "scale": 0.5 + }, + "data": "minelittlepony:components/horn" + } + } + }, + "body": { + "texture": { "u": 16, "v": 16 }, + "cubes": [ + { "from": [-4, 4, -2], "size": [ 8, 8, 4] } + ], + "children": { + "beard": { + "pivot": [-4, 2, -2], + "rotate": [-20, 0, 0], + "cubes": [ + { "from": [0, 0, 0], "size": [ 8, 8, 4], "dilate": [0.5, -0.5, 0] } + ] + } + } + }, + "tail": { + "type": "mson:slot", + "name": "tail", + "implementation": "com.minelittlepony.client.model.part.LionTail", + "data": "minelittlepony:components/lion_tail" + } + } }