| 1 | package net.minecraft.client.particle;
|
| 2 |
|
| 3 | import net.fabricmc.api.EnvType;
|
| 4 | import net.fabricmc.api.Environment;
|
| 5 | import net.minecraft.client.multiplayer.ClientLevel;
|
| 6 | import net.minecraft.core.particles.GeyserBaseParticleOptions;
|
| 7 | import net.minecraft.util.RandomSource;
|
| 8 |
|
| 9 | @Environment(EnvType.CLIENT)
|
| 10 | public class GeyserBaseParticle extends BaseAshSmokeParticle {
|
| 11 | private static final float BURST_IMPULSE_FACTOR = 0.25F;
|
| 12 | private static final float PARTICLE_SIZE_BASE = 3.0F;
|
| 13 | private static final float PARTICLE_SIZE_FACTOR = 0.125F;
|
| 14 | private static final float SPAWN_OFFSET_Y = 0.2F;
|
| 15 | private static final float RANDOM_SPAWN_SPREAD = 0.5F;
|
| 16 | private static final int MAX_LIFETIME = 25;
|
| 17 | private static final float FRICTION = 0.725F;
|
| 18 |
|
| 19 | private GeyserBaseParticle(
|
| 20 | final ClientLevel level,
|
| 21 | final double x,
|
| 22 | final double y,
|
| 23 | final double z,
|
| 24 | final double xAux,
|
| 25 | final double yAux,
|
| 26 | final double zAux,
|
| 27 | final int waterBlocks,
|
| 28 | final float burstImpulseBase,
|
| 29 | final SpriteSet sprites
|
| 30 | ) {
|
| 31 | float burstImpulse = burstImpulseBase + 0.25F * waterBlocks;
|
| 32 | float size = 3.0F + 0.125F * waterBlocks;
|
| 33 | super(level, x, y, z, burstImpulse, burstImpulse, burstImpulse, xAux, yAux, zAux, size, sprites, 0.0F, 0, 0.0F, true);
|
| 34 | this.friction = 0.725F;
|
| 35 | this.rCol = 1.0F;
|
| 36 | this.gCol = 1.0F;
|
| 37 | this.bCol = 1.0F;
|
| 38 | this.yd = Math.abs(this.yd);
|
| 39 | float lifetimeFactor = 0.8F + 0.2F * level.getRandom().nextFloat();
|
| 40 | this.lifetime = (int)(25.0F * lifetimeFactor);
|
| 41 | }
|
| 42 |
|
| 43 | @Environment(EnvType.CLIENT)
|
| 44 | public static class Provider implements ParticleProvider<GeyserBaseParticleOptions> {
|
| 45 | private final SpriteSet sprites;
|
| 46 |
|
| 47 | public Provider(final SpriteSet sprites) {
|
| 48 | this.sprites = sprites;
|
| 49 | }
|
| 50 |
|
| 51 | public Particle createParticle(
|
| 52 | final GeyserBaseParticleOptions options,
|
| 53 | final ClientLevel level,
|
| 54 | final double x,
|
| 55 | final double y,
|
| 56 | final double z,
|
| 57 | final double xAux,
|
| 58 | final double yAux,
|
| 59 | final double zAux,
|
| 60 | final RandomSource random
|
| 61 | ) {
|
| 62 | double randomX = x + (random.nextFloat() - 0.5F) * 0.5F;
|
| 63 | double randomY = y + (random.nextFloat() - 0.5F) * 0.5F + 0.2F;
|
| 64 | double randomZ = z + (random.nextFloat() - 0.5F) * 0.5F;
|
| 65 | return new GeyserBaseParticle(level, randomX, randomY, randomZ, xAux, yAux, zAux, options.waterBlocks(), options.burstImpulseBase(), this.sprites);
|
| 66 | }
|
| 67 | }
|
| 68 | }
|
| 69 |
|