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

com.parzivail.util.client.particle.CrossPointingParticle Maven / Gradle / Ivy

There is a newer version: 0.0.114+1.20.2
Show newest version
package com.parzivail.util.client.particle;

import ;
import F;
import I;
import com.parzivail.util.math.QuatUtil;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.class_243;
import net.minecraft.class_3532;
import net.minecraft.class_4002;
import net.minecraft.class_4184;
import net.minecraft.class_4588;
import net.minecraft.class_638;
import net.minecraft.class_708;
import org.joml.Quaternionf;
import org.joml.Vector3f;

@Environment(EnvType.CLIENT)
public class CrossPointingParticle extends class_708
{
	protected CrossPointingParticle(class_638 clientWorld, double x, double y, double z, class_4002 spriteProvider)
	{
		super(clientWorld, x, y, z, spriteProvider, 0.0F);
	}

	@Override
	public void method_3074(class_4588 vertexConsumer, class_4184 camera, float tickDelta)
	{
		var vec3d = camera.method_19326();
		var f = (float)(class_3532.method_16436(tickDelta, this.field_3858, this.field_3874) - vec3d.field_1352);
		var g = (float)(class_3532.method_16436(tickDelta, this.field_3838, this.field_3854) - vec3d.field_1351);
		var h = (float)(class_3532.method_16436(tickDelta, this.field_3856, this.field_3871) - vec3d.field_1350);

		Quaternionf rotation = QuatUtil.lookAt(class_243.field_1353, new class_243(field_3852, field_3869, field_3850));
		rotation.mul(QuatUtil.ROT_Y_POS90);
		rotation.mul(QuatUtil.ROT_X_POS45);

		var corners = new Vector3f[] {
				new Vector3f(-1.0F, -1.0F, 0.0F),
				new Vector3f(-1.0F, 1.0F, 0.0F),
				new Vector3f(1.0F, 1.0F, 0.0F),
				new Vector3f(1.0F, -1.0F, 0.0F)
		};

		var j = this.method_18132(tickDelta);

		var l = this.method_18133();
		var m = this.method_18134();
		var n = this.method_18135();
		var o = this.method_18136();
		var p = this.method_3068(tickDelta);

		for (var k = 0; k < 4; ++k)
		{
			var vec3f2 = corners[k];
			vec3f2.rotate(rotation);
			vec3f2.mul(j);
			vec3f2.add(f, g, h);
		}

		vertexConsumer.method_22912(corners[0].x, corners[0].y, corners[0].z).method_22913(m, o).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();
		vertexConsumer.method_22912(corners[1].x, corners[1].y, corners[1].z).method_22913(m, n).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();
		vertexConsumer.method_22912(corners[2].x, corners[2].y, corners[2].z).method_22913(l, n).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();
		vertexConsumer.method_22912(corners[3].x, corners[3].y, corners[3].z).method_22913(l, o).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();

		vertexConsumer.method_22912(corners[3].x, corners[3].y, corners[3].z).method_22913(l, o).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();
		vertexConsumer.method_22912(corners[2].x, corners[2].y, corners[2].z).method_22913(l, n).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();
		vertexConsumer.method_22912(corners[1].x, corners[1].y, corners[1].z).method_22913(m, n).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();
		vertexConsumer.method_22912(corners[0].x, corners[0].y, corners[0].z).method_22913(m, o).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();

		corners = new Vector3f[] {
				new Vector3f(-1.0F, 0.0F, 1.0F),
				new Vector3f(-1.0F, 0.0F, -1.0F),
				new Vector3f(1.0F, 0.0F, -1.0F),
				new Vector3f(1.0F, 0.0F, 1.0F)
		};

		for (var k = 0; k < 4; ++k)
		{
			var vec3f2 = corners[k];
			vec3f2.rotate(rotation);
			vec3f2.mul(j);
			vec3f2.add(f, g, h);
		}

		vertexConsumer.method_22912(corners[0].x, corners[0].y, corners[0].z).method_22913(m, o).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();
		vertexConsumer.method_22912(corners[1].x, corners[1].y, corners[1].z).method_22913(m, n).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();
		vertexConsumer.method_22912(corners[2].x, corners[2].y, corners[2].z).method_22913(l, n).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();
		vertexConsumer.method_22912(corners[3].x, corners[3].y, corners[3].z).method_22913(l, o).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();

		vertexConsumer.method_22912(corners[3].x, corners[3].y, corners[3].z).method_22913(l, o).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();
		vertexConsumer.method_22912(corners[2].x, corners[2].y, corners[2].z).method_22913(l, n).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();
		vertexConsumer.method_22912(corners[1].x, corners[1].y, corners[1].z).method_22913(m, n).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();
		vertexConsumer.method_22912(corners[0].x, corners[0].y, corners[0].z).method_22913(m, o).method_22915(this.field_3861, this.field_3842, this.field_3859, this.field_3841).method_22916(p).method_1344();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy