com.parzivail.util.client.particle.DecalParticle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pswg Show documentation
Show all versions of pswg Show documentation
Explore the galaxy with Galaxies: Parzi's Star Wars Mod!
package com.parzivail.util.client.particle;
import ;
import F;
import I;
import com.parzivail.util.math.MathUtil;
import com.parzivail.util.math.QuatUtil;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.class_2338;
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 DecalParticle extends class_708
{
protected DecalParticle(class_638 clientWorld, double x, double y, double z, class_4002 spriteProvider)
{
super(clientWorld, x, y, z, spriteProvider, 0.0F);
}
@Override
public void method_3070()
{
if (this.field_3866++ >= this.field_3847)
this.method_3085();
this.method_18142(this.field_17866);
if (this.field_3866 > this.field_3847 / 2)
this.method_3083(1.0F - ((float)this.field_3866 - (float)(this.field_3847 / 2)) / (float)this.field_3847);
var normal = new class_243(field_3852, field_3869, field_3850).method_1029();
var pos = new class_243(this.field_3874, this.field_3854, this.field_3871);
var hostBlockPos = new class_2338(MathUtil.floorInt(pos.method_1020(normal.method_1021(0.1f))));
if (field_3851.method_22347(hostBlockPos))
this.method_3085();
}
@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.method_10216());
var g = (float)(class_3532.method_16436(tickDelta, this.field_3838, this.field_3854) - vec3d.method_10214());
var h = (float)(class_3532.method_16436(tickDelta, this.field_3856, this.field_3871) - vec3d.method_10215());
// We're abusing the velocity component as a normal vector
var normal = new class_243(field_3852, field_3869, field_3850).method_1029();
Quaternionf rotation = QuatUtil.lookAt(class_243.field_1353, normal);
rotation.rotateZ(field_3839);
var z = (1 - this.field_3866 / (float)this.field_3847) * 0.005f;
var corners = new Vector3f[] {
new Vector3f(-1.0F, -1.0F, z),
new Vector3f(-1.0F, 1.0F, z),
new Vector3f(1.0F, 1.0F, z),
new Vector3f(1.0F, -1.0F, z)
};
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[3].x, corners[3].y, corners[3].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[2].x, corners[2].y, corners[2].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[1].x, corners[1].y, corners[1].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[0].x, corners[0].y, corners[0].z).method_22913(l, 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