/* * Decompiled with CFR 0.152. */ package com.vinlanx.explosionoverhaul.client; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.VertexConsumer; import com.vinlanx.explosionoverhaul.SmokeParticleOptions; import com.vinlanx.explosionoverhaul.client.ExplosionWindController; import net.minecraft.client.Camera; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.ParticleRenderType; import net.minecraft.client.particle.SpriteSet; import net.minecraft.client.particle.TextureSheetParticle; import net.minecraft.world.phys.Vec3; public class SmokeParticle extends TextureSheetParticle { private final float initialAlpha; private final boolean isHeavy; private final float windSpeed; private final float heightPercent; protected SmokeParticle(ClientLevel pLevel, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed, SmokeParticleOptions options, SpriteSet spriteSet) { super(pLevel, pX, pY, pZ, pXSpeed, pYSpeed, pZSpeed); this.f_172258_ = 0.96f; this.f_107226_ = 0.0f; this.f_107225_ = options.getLifetime(); this.f_107663_ = options.getScale(); this.f_107227_ = options.getRed(); this.f_107228_ = options.getGreen(); this.f_107229_ = options.getBlue(); this.f_107230_ = options.getAlpha(); this.initialAlpha = options.getAlpha(); this.isHeavy = options.isHeavy(); this.windSpeed = options.getWindSpeed(); this.heightPercent = options.getHeightPercent(); this.m_108337_(spriteSet.m_213979_(this.f_107223_)); } public void m_5744_(VertexConsumer pBuffer, Camera pRenderInfo, float pPartialTicks) { RenderSystem.depthMask((this.f_107230_ > 0.3f ? 1 : 0) != 0); super.m_5744_(pBuffer, pRenderInfo, pPartialTicks); RenderSystem.depthMask((boolean)true); } public void m_5989_() { Vec3 direction; this.f_107209_ = this.f_107212_; this.f_107210_ = this.f_107213_; this.f_107211_ = this.f_107214_; if (this.f_107224_++ >= this.f_107225_) { this.m_107274_(); return; } if (this.isHeavy) { this.f_107216_ = -0.04; } this.m_6257_(this.f_107215_, this.f_107216_, this.f_107217_); this.f_107215_ *= (double)this.f_172258_; this.f_107216_ *= (double)this.f_172258_; this.f_107217_ *= (double)this.f_172258_; if (this.windSpeed > 0.0f && (direction = ExplosionWindController.getWindDirection()) != Vec3.f_82478_) { double targetX = direction.f_82479_ * (double)this.windSpeed; double targetZ = direction.f_82481_ * (double)this.windSpeed; this.f_107215_ += (targetX - this.f_107215_) * 0.12; this.f_107217_ += (targetZ - this.f_107217_) * 0.12; } float lifeProgress = (float)this.f_107224_ / (float)this.f_107225_; this.f_107230_ = this.initialAlpha * (1.0f - lifeProgress); } public boolean shouldCull() { return false; } public ParticleRenderType m_7556_() { return ParticleRenderType.f_107431_; } public static class Provider implements ParticleProvider { private final SpriteSet sprites; public Provider(SpriteSet pSprites) { this.sprites = pSprites; } public Particle createParticle(SmokeParticleOptions options, ClientLevel pLevel, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) { return new SmokeParticle(pLevel, pX, pY, pZ, pXSpeed, pYSpeed, pZSpeed, options, this.sprites); } } }