58 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.client.particle;
 | |
| 
 | |
| import net.fabricmc.api.EnvType;
 | |
| import net.fabricmc.api.Environment;
 | |
| import net.minecraft.client.multiplayer.ClientLevel;
 | |
| import net.minecraft.core.particles.SimpleParticleType;
 | |
| 
 | |
| @Environment(EnvType.CLIENT)
 | |
| public class HugeExplosionParticle extends TextureSheetParticle {
 | |
| 	private final SpriteSet sprites;
 | |
| 
 | |
| 	protected HugeExplosionParticle(ClientLevel level, double x, double y, double z, double quadSizeMultiplier, SpriteSet sprites) {
 | |
| 		super(level, x, y, z, 0.0, 0.0, 0.0);
 | |
| 		this.lifetime = 6 + this.random.nextInt(4);
 | |
| 		float f = this.random.nextFloat() * 0.6F + 0.4F;
 | |
| 		this.rCol = f;
 | |
| 		this.gCol = f;
 | |
| 		this.bCol = f;
 | |
| 		this.quadSize = 2.0F * (1.0F - (float)quadSizeMultiplier * 0.5F);
 | |
| 		this.sprites = sprites;
 | |
| 		this.setSpriteFromAge(sprites);
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public int getLightColor(float partialTick) {
 | |
| 		return 15728880;
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public void tick() {
 | |
| 		this.xo = this.x;
 | |
| 		this.yo = this.y;
 | |
| 		this.zo = this.z;
 | |
| 		if (this.age++ >= this.lifetime) {
 | |
| 			this.remove();
 | |
| 		} else {
 | |
| 			this.setSpriteFromAge(this.sprites);
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public ParticleRenderType getRenderType() {
 | |
| 		return ParticleRenderType.PARTICLE_SHEET_OPAQUE;
 | |
| 	}
 | |
| 
 | |
| 	@Environment(EnvType.CLIENT)
 | |
| 	public static class Provider implements ParticleProvider<SimpleParticleType> {
 | |
| 		private final SpriteSet sprites;
 | |
| 
 | |
| 		public Provider(SpriteSet sprites) {
 | |
| 			this.sprites = sprites;
 | |
| 		}
 | |
| 
 | |
| 		public Particle createParticle(SimpleParticleType type, ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
 | |
| 			return new HugeExplosionParticle(level, x, y, z, xSpeed, this.sprites);
 | |
| 		}
 | |
| 	}
 | |
| }
 |