All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.parzivail.pswg.client.render.entity.fish.LaaEntityRenderer Maven / Gradle / Ivy

There is a newer version: 0.0.114+1.20.2
Show newest version
package com.parzivail.pswg.client.render.entity.fish;

import F;
import com.parzivail.pswg.Client;
import com.parzivail.pswg.Resources;
import com.parzivail.util.math.MathUtil;
import net.minecraft.class_1422;
import net.minecraft.class_2960;
import net.minecraft.class_3532;
import net.minecraft.class_4587;
import net.minecraft.class_5597;
import net.minecraft.class_5617;
import net.minecraft.class_630;
import net.minecraft.class_927;
import org.joml.Quaternionf;

public class LaaEntityRenderer extends class_927>
{
	public LaaEntityRenderer(class_5617.class_5618 context)
	{
		super(context, Client.NEM_MANAGER.getModel(Resources.id("mob/fish/laa"), LaaEntityRenderer::setAngles), 0.5f);
	}

	@Override
	public class_2960 getTexture(class_1422 entity)
	{
		return Resources.id("textures/entity/fish/laa.png");
	}

	public static void setAngles(class_5597 model, class_1422 entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch, float tickDelta)
	{
		if (entity.method_5987())
			animationProgress = 0;

		var body = model.method_32008().method_32086("body");
		var pectoralFinLeft = body.method_32086("pectoralFinLeft");
		var tail = body.method_32086("tail");
		var tail1 = tail.method_32086("tail_1");
		var flailTop = body.method_32086("flailTop");
		var flailBottom = body.method_32086("flailBottom");
		var pectoralFinRight = body.method_32086("pectoralFinLeft_1");

		var f = 1.0F;
		if (!entity.method_5799())
		{
			f = 1.5F;
		}

		var tailProgress = class_3532.method_15374(0.6F * animationProgress);
		tail1.field_3675 = -f * 0.3F * tailProgress;
		tail.field_3675 = -f * 0.1F * tailProgress;

		var finProgress = class_3532.method_15374(0.1F * animationProgress);
		pectoralFinLeft.field_3675 = -1f - f * 0.15F * finProgress;
		pectoralFinRight.field_3675 = 1f + f * 0.15F * finProgress;

		flailTop.field_3654 = f * 0.05F * finProgress;
		flailBottom.field_3654 = -0.3490658503988659F - f * 0.05F * finProgress;
	}

	@Override
	protected void setupTransforms(class_1422 entity, class_4587 matrixStack, float f, float g, float h)
	{
		super.method_4058(entity, matrixStack, f, g, h);

		if (entity.method_5987())
			return;

		var i = 4.3F * class_3532.method_15374(0.6F * f);
		matrixStack.method_22907(new Quaternionf().rotationY(MathUtil.toRadians(i)));
		if (!entity.method_5799())
		{
			matrixStack.method_46416(0.1f, 1f, -1f);
			matrixStack.method_22907(new Quaternionf().rotationZ((float)(Math.PI / 2)));
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy