Skip to content

Commit

Permalink
holler funni
Browse files Browse the repository at this point in the history
  • Loading branch information
MehVahdJukaar committed Oct 31, 2024
1 parent 5e162fa commit 6ebed97
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import galena.doom_and_gloom.client.ORenderTypes;
import galena.doom_and_gloom.content.entity.holler.Holler;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.HeadedModel;
Expand All @@ -23,7 +22,7 @@ public class HollerModel<T extends Holler> extends EntityModel<T> implements Hea
private double yHover;
private float alphaMult;

private Vec3 posDelta;
private Vec3 prevPosDelta;
private float prevRotDelta;

public HollerModel(ModelPart root) {
Expand Down Expand Up @@ -68,7 +67,7 @@ public void prepareMobModel(T entity, float pLimbSwing, float pLimbSwingAmount,
// luckily we only rotate on Y. Could be done better on the renderer level
// no clue why z needs to be flipped...

posDelta = entity.getPosDelta(pPartialTick)
prevPosDelta = entity.getPosDelta(pPartialTick)
.multiply(-1, 1, 1)
.yRot(-currentBodyRot * Mth.DEG_TO_RAD);

Expand Down Expand Up @@ -97,7 +96,7 @@ public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ag
public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight,
int packedOverlay, float red, float green, float blue, float alpha) {

double alphaDecayFactor = posDelta.lengthSqr() * 100f;
double alphaDecayFactor = prevPosDelta.lengthSqr() * 100f;
alphaDecayFactor = Math.min(alphaDecayFactor, 1);
int step = 6;

Expand All @@ -115,7 +114,7 @@ public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, i
poseStack.pushPose();
//scale trail further back
float trailScalar = 4;
var stepDelta = posDelta.scale(i / (float) step * trailScalar);
var stepDelta = prevPosDelta.scale(i / (float) step * trailScalar);
poseStack.translate(stepDelta.x, stepDelta.y + yHover, stepDelta.z);
poseStack.mulPose(Axis.YN.rotationDegrees(stepYRot * i));
float scale = 1 - (0.3f * i / (float) (step));
Expand Down

0 comments on commit 6ebed97

Please sign in to comment.