| 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.client.renderer.texture.TextureAtlasSprite;
|
| 7 | import net.minecraft.core.BlockPos;
|
| 8 | import net.minecraft.core.particles.ParticleOptions;
|
| 9 | import net.minecraft.core.particles.ParticleTypes;
|
| 10 | import net.minecraft.core.particles.SimpleParticleType;
|
| 11 | import net.minecraft.sounds.SoundEvent;
|
| 12 | import net.minecraft.sounds.SoundEvents;
|
| 13 | import net.minecraft.sounds.SoundSource;
|
| 14 | import net.minecraft.util.LightCoordsUtil;
|
| 15 | import net.minecraft.util.Mth;
|
| 16 | import net.minecraft.util.RandomSource;
|
| 17 | import net.minecraft.world.level.material.Fluid;
|
| 18 | import net.minecraft.world.level.material.FluidState;
|
| 19 | import net.minecraft.world.level.material.Fluids;
|
| 20 |
|
| 21 | @Environment(EnvType.CLIENT)
|
| 22 | public class DripParticle extends SingleQuadParticle {
|
| 23 | private final Fluid type;
|
| 24 | protected boolean isGlowing;
|
| 25 |
|
| 26 | private DripParticle(final ClientLevel level, final double x, final double y, final double z, final Fluid type, final TextureAtlasSprite sprite) {
|
| 27 | super(level, x, y, z, sprite);
|
| 28 | this.setSize(0.01F, 0.01F);
|
| 29 | this.gravity = 0.06F;
|
| 30 | this.type = type;
|
| 31 | }
|
| 32 |
|
| 33 | protected Fluid getType() {
|
| 34 | return this.type;
|
| 35 | }
|
| 36 |
|
| 37 | @Override
|
| 38 | public SingleQuadParticle.Layer getLayer() {
|
| 39 | return SingleQuadParticle.Layer.OPAQUE;
|
| 40 | }
|
| 41 |
|
| 42 | @Override
|
| 43 | public int getLightCoords(final float a) {
|
| 44 | return this.isGlowing ? LightCoordsUtil.withBlock(super.getLightCoords(a), 15) : super.getLightCoords(a);
|
| 45 | }
|
| 46 |
|
| 47 | @Override
|
| 48 | public void tick() {
|
| 49 | this.xo = this.x;
|
| 50 | this.yo = this.y;
|
| 51 | this.zo = this.z;
|
| 52 | this.preMoveUpdate();
|
| 53 | if (!this.removed) {
|
| 54 | this.yd = this.yd - this.gravity;
|
| 55 | this.move(this.xd, this.yd, this.zd);
|
| 56 | this.postMoveUpdate();
|
| 57 | if (!this.removed) {
|
| 58 | this.xd *= 0.98F;
|
| 59 | this.yd *= 0.98F;
|
| 60 | this.zd *= 0.98F;
|
| 61 | if (this.type != Fluids.EMPTY) {
|
| 62 | BlockPos pos = BlockPos.containing(this.x, this.y, this.z);
|
| 63 | FluidState fluidState = this.level.getFluidState(pos);
|
| 64 | if (fluidState.is(this.type) && this.y < pos.getY() + fluidState.getHeight(this.level, pos)) {
|
| 65 | this.remove();
|
| 66 | }
|
| 67 | }
|
| 68 | }
|
| 69 | }
|
| 70 | }
|
| 71 |
|
| 72 | protected void preMoveUpdate() {
|
| 73 | if (this.lifetime-- <= 0) {
|
| 74 | this.remove();
|
| 75 | }
|
| 76 | }
|
| 77 |
|
| 78 | protected void postMoveUpdate() {
|
| 79 | }
|
| 80 |
|
| 81 | @Environment(EnvType.CLIENT)
|
| 82 | private static class CoolingDripHangParticle extends DripParticle.DripHangParticle {
|
| 83 | private CoolingDripHangParticle(
|
| 84 | final ClientLevel level,
|
| 85 | final double x,
|
| 86 | final double y,
|
| 87 | final double z,
|
| 88 | final Fluid type,
|
| 89 | final ParticleOptions fallingParticle,
|
| 90 | final TextureAtlasSprite sprite
|
| 91 | ) {
|
| 92 | super(level, x, y, z, type, fallingParticle, sprite);
|
| 93 | }
|
| 94 |
|
| 95 | @Override
|
| 96 | protected void preMoveUpdate() {
|
| 97 | this.rCol = 1.0F;
|
| 98 | this.gCol = 16.0F / (40 - this.lifetime + 16);
|
| 99 | this.bCol = 4.0F / (40 - this.lifetime + 8);
|
| 100 | super.preMoveUpdate();
|
| 101 | }
|
| 102 | }
|
| 103 |
|
| 104 | @Environment(EnvType.CLIENT)
|
| 105 | private static class DripHangParticle extends DripParticle {
|
| 106 | private final ParticleOptions fallingParticle;
|
| 107 |
|
| 108 | private DripHangParticle(
|
| 109 | final ClientLevel level,
|
| 110 | final double x,
|
| 111 | final double y,
|
| 112 | final double z,
|
| 113 | final Fluid type,
|
| 114 | final ParticleOptions fallingParticle,
|
| 115 | final TextureAtlasSprite sprite
|
| 116 | ) {
|
| 117 | super(level, x, y, z, type, sprite);
|
| 118 | this.fallingParticle = fallingParticle;
|
| 119 | this.gravity *= 0.02F;
|
| 120 | this.lifetime = 40;
|
| 121 | }
|
| 122 |
|
| 123 | @Override
|
| 124 | protected void preMoveUpdate() {
|
| 125 | if (this.lifetime-- <= 0) {
|
| 126 | this.remove();
|
| 127 | this.level.addParticle(this.fallingParticle, this.x, this.y, this.z, this.xd, this.yd, this.zd);
|
| 128 | }
|
| 129 | }
|
| 130 |
|
| 131 | @Override
|
| 132 | protected void postMoveUpdate() {
|
| 133 | this.xd *= 0.02;
|
| 134 | this.yd *= 0.02;
|
| 135 | this.zd *= 0.02;
|
| 136 | }
|
| 137 | }
|
| 138 |
|
| 139 | @Environment(EnvType.CLIENT)
|
| 140 | private static class DripLandParticle extends DripParticle {
|
| 141 | private DripLandParticle(final ClientLevel level, final double x, final double y, final double z, final Fluid type, final TextureAtlasSprite sprite) {
|
| 142 | super(level, x, y, z, type, sprite);
|
| 143 | this.lifetime = (int)(16.0 / (this.random.nextFloat() * 0.8 + 0.2));
|
| 144 | }
|
| 145 | }
|
| 146 |
|
| 147 | @Environment(EnvType.CLIENT)
|
| 148 | private static class DripstoneFallAndLandParticle extends DripParticle.FallAndLandParticle {
|
| 149 | private DripstoneFallAndLandParticle(
|
| 150 | final ClientLevel level,
|
| 151 | final double x,
|
| 152 | final double y,
|
| 153 | final double z,
|
| 154 | final Fluid type,
|
| 155 | final ParticleOptions landParticle,
|
| 156 | final TextureAtlasSprite sprite
|
| 157 | ) {
|
| 158 | super(level, x, y, z, type, landParticle, sprite);
|
| 159 | }
|
| 160 |
|
| 161 | @Override
|
| 162 | protected void postMoveUpdate() {
|
| 163 | if (this.onGround) {
|
| 164 | this.remove();
|
| 165 | this.level.addParticle(this.landParticle, this.x, this.y, this.z, 0.0, 0.0, 0.0);
|
| 166 | SoundEvent sound = this.getType() == Fluids.LAVA ? SoundEvents.POINTED_DRIPSTONE_DRIP_LAVA : SoundEvents.POINTED_DRIPSTONE_DRIP_WATER;
|
| 167 | float volume = Mth.randomBetween(this.random, 0.3F, 1.0F);
|
| 168 | this.level.playLocalSound(this.x, this.y, this.z, sound, SoundSource.BLOCKS, volume, 1.0F, false);
|
| 169 | }
|
| 170 | }
|
| 171 | }
|
| 172 |
|
| 173 | @Environment(EnvType.CLIENT)
|
| 174 | public static class DripstoneLavaFallProvider implements ParticleProvider<SimpleParticleType> {
|
| 175 | private final SpriteSet sprite;
|
| 176 |
|
| 177 | public DripstoneLavaFallProvider(final SpriteSet sprite) {
|
| 178 | this.sprite = sprite;
|
| 179 | }
|
| 180 |
|
| 181 | public Particle createParticle(
|
| 182 | final SimpleParticleType options,
|
| 183 | final ClientLevel level,
|
| 184 | final double x,
|
| 185 | final double y,
|
| 186 | final double z,
|
| 187 | final double xAux,
|
| 188 | final double yAux,
|
| 189 | final double zAux,
|
| 190 | final RandomSource random
|
| 191 | ) {
|
| 192 | DripParticle particle = new DripParticle.DripstoneFallAndLandParticle(level, x, y, z, Fluids.LAVA, ParticleTypes.LANDING_LAVA, this.sprite.get(random));
|
| 193 | particle.setColor(1.0F, 0.2857143F, 0.083333336F);
|
| 194 | return particle;
|
| 195 | }
|
| 196 | }
|
| 197 |
|
| 198 | @Environment(EnvType.CLIENT)
|
| 199 | public static class DripstoneLavaHangProvider implements ParticleProvider<SimpleParticleType> {
|
| 200 | private final SpriteSet sprite;
|
| 201 |
|
| 202 | public DripstoneLavaHangProvider(final SpriteSet sprite) {
|
| 203 | this.sprite = sprite;
|
| 204 | }
|
| 205 |
|
| 206 | public Particle createParticle(
|
| 207 | final SimpleParticleType options,
|
| 208 | final ClientLevel level,
|
| 209 | final double x,
|
| 210 | final double y,
|
| 211 | final double z,
|
| 212 | final double xAux,
|
| 213 | final double yAux,
|
| 214 | final double zAux,
|
| 215 | final RandomSource random
|
| 216 | ) {
|
| 217 | return new DripParticle.CoolingDripHangParticle(level, x, y, z, Fluids.LAVA, ParticleTypes.FALLING_DRIPSTONE_LAVA, this.sprite.get(random));
|
| 218 | }
|
| 219 | }
|
| 220 |
|
| 221 | @Environment(EnvType.CLIENT)
|
| 222 | public static class DripstoneWaterFallProvider implements ParticleProvider<SimpleParticleType> {
|
| 223 | private final SpriteSet sprite;
|
| 224 |
|
| 225 | public DripstoneWaterFallProvider(final SpriteSet sprite) {
|
| 226 | this.sprite = sprite;
|
| 227 | }
|
| 228 |
|
| 229 | public Particle createParticle(
|
| 230 | final SimpleParticleType options,
|
| 231 | final ClientLevel level,
|
| 232 | final double x,
|
| 233 | final double y,
|
| 234 | final double z,
|
| 235 | final double xAux,
|
| 236 | final double yAux,
|
| 237 | final double zAux,
|
| 238 | final RandomSource random
|
| 239 | ) {
|
| 240 | DripParticle particle = new DripParticle.DripstoneFallAndLandParticle(level, x, y, z, Fluids.WATER, ParticleTypes.SPLASH, this.sprite.get(random));
|
| 241 | particle.setColor(0.2F, 0.3F, 1.0F);
|
| 242 | return particle;
|
| 243 | }
|
| 244 | }
|
| 245 |
|
| 246 | @Environment(EnvType.CLIENT)
|
| 247 | public static class DripstoneWaterHangProvider implements ParticleProvider<SimpleParticleType> {
|
| 248 | private final SpriteSet sprite;
|
| 249 |
|
| 250 | public DripstoneWaterHangProvider(final SpriteSet sprite) {
|
| 251 | this.sprite = sprite;
|
| 252 | }
|
| 253 |
|
| 254 | public Particle createParticle(
|
| 255 | final SimpleParticleType options,
|
| 256 | final ClientLevel level,
|
| 257 | final double x,
|
| 258 | final double y,
|
| 259 | final double z,
|
| 260 | final double xAux,
|
| 261 | final double yAux,
|
| 262 | final double zAux,
|
| 263 | final RandomSource random
|
| 264 | ) {
|
| 265 | DripParticle particle = new DripParticle.DripHangParticle(level, x, y, z, Fluids.WATER, ParticleTypes.FALLING_DRIPSTONE_WATER, this.sprite.get(random));
|
| 266 | particle.setColor(0.2F, 0.3F, 1.0F);
|
| 267 | return particle;
|
| 268 | }
|
| 269 | }
|
| 270 |
|
| 271 | @Environment(EnvType.CLIENT)
|
| 272 | private static class FallAndLandParticle extends DripParticle.FallingParticle {
|
| 273 | protected final ParticleOptions landParticle;
|
| 274 |
|
| 275 | private FallAndLandParticle(
|
| 276 | final ClientLevel level,
|
| 277 | final double x,
|
| 278 | final double y,
|
| 279 | final double z,
|
| 280 | final Fluid type,
|
| 281 | final ParticleOptions landParticle,
|
| 282 | final TextureAtlasSprite sprite
|
| 283 | ) {
|
| 284 | super(level, x, y, z, type, sprite);
|
| 285 | this.lifetime = (int)(64.0 / (this.random.nextFloat() * 0.8 + 0.2));
|
| 286 | this.landParticle = landParticle;
|
| 287 | }
|
| 288 |
|
| 289 | @Override
|
| 290 | protected void postMoveUpdate() {
|
| 291 | if (this.onGround) {
|
| 292 | this.remove();
|
| 293 | this.level.addParticle(this.landParticle, this.x, this.y, this.z, 0.0, 0.0, 0.0);
|
| 294 | }
|
| 295 | }
|
| 296 | }
|
| 297 |
|
| 298 | @Environment(EnvType.CLIENT)
|
| 299 | private static class FallingParticle extends DripParticle {
|
| 300 | private FallingParticle(final ClientLevel level, final double x, final double y, final double z, final Fluid type, final TextureAtlasSprite sprite) {
|
| 301 | super(level, x, y, z, type, sprite);
|
| 302 | }
|
| 303 |
|
| 304 | @Override
|
| 305 | protected void postMoveUpdate() {
|
| 306 | if (this.onGround) {
|
| 307 | this.remove();
|
| 308 | }
|
| 309 | }
|
| 310 | }
|
| 311 |
|
| 312 | @Environment(EnvType.CLIENT)
|
| 313 | private static class HoneyFallAndLandParticle extends DripParticle.FallAndLandParticle {
|
| 314 | private HoneyFallAndLandParticle(
|
| 315 | final ClientLevel level,
|
| 316 | final double x,
|
| 317 | final double y,
|
| 318 | final double z,
|
| 319 | final Fluid type,
|
| 320 | final ParticleOptions landParticle,
|
| 321 | final TextureAtlasSprite sprite
|
| 322 | ) {
|
| 323 | super(level, x, y, z, type, landParticle, sprite);
|
| 324 | }
|
| 325 |
|
| 326 | @Override
|
| 327 | protected void postMoveUpdate() {
|
| 328 | if (this.onGround) {
|
| 329 | this.remove();
|
| 330 | this.level.addParticle(this.landParticle, this.x, this.y, this.z, 0.0, 0.0, 0.0);
|
| 331 | float volume = Mth.randomBetween(this.random, 0.3F, 1.0F);
|
| 332 | this.level.playLocalSound(this.x, this.y, this.z, SoundEvents.BEEHIVE_DRIP, SoundSource.BLOCKS, volume, 1.0F, false);
|
| 333 | }
|
| 334 | }
|
| 335 | }
|
| 336 |
|
| 337 | @Environment(EnvType.CLIENT)
|
| 338 | public static class HoneyFallProvider implements ParticleProvider<SimpleParticleType> {
|
| 339 | private final SpriteSet sprite;
|
| 340 |
|
| 341 | public HoneyFallProvider(final SpriteSet sprite) {
|
| 342 | this.sprite = sprite;
|
| 343 | }
|
| 344 |
|
| 345 | public Particle createParticle(
|
| 346 | final SimpleParticleType options,
|
| 347 | final ClientLevel level,
|
| 348 | final double x,
|
| 349 | final double y,
|
| 350 | final double z,
|
| 351 | final double xAux,
|
| 352 | final double yAux,
|
| 353 | final double zAux,
|
| 354 | final RandomSource random
|
| 355 | ) {
|
| 356 | DripParticle particle = new DripParticle.HoneyFallAndLandParticle(level, x, y, z, Fluids.EMPTY, ParticleTypes.LANDING_HONEY, this.sprite.get(random));
|
| 357 | particle.gravity = 0.01F;
|
| 358 | particle.setColor(0.582F, 0.448F, 0.082F);
|
| 359 | return particle;
|
| 360 | }
|
| 361 | }
|
| 362 |
|
| 363 | @Environment(EnvType.CLIENT)
|
| 364 | public static class HoneyHangProvider implements ParticleProvider<SimpleParticleType> {
|
| 365 | private final SpriteSet sprite;
|
| 366 |
|
| 367 | public HoneyHangProvider(final SpriteSet sprite) {
|
| 368 | this.sprite = sprite;
|
| 369 | }
|
| 370 |
|
| 371 | public Particle createParticle(
|
| 372 | final SimpleParticleType options,
|
| 373 | final ClientLevel level,
|
| 374 | final double x,
|
| 375 | final double y,
|
| 376 | final double z,
|
| 377 | final double xAux,
|
| 378 | final double yAux,
|
| 379 | final double zAux,
|
| 380 | final RandomSource random
|
| 381 | ) {
|
| 382 | DripParticle.DripHangParticle particle = new DripParticle.DripHangParticle(
|
| 383 | level, x, y, z, Fluids.EMPTY, ParticleTypes.FALLING_HONEY, this.sprite.get(random)
|
| 384 | );
|
| 385 | particle.gravity *= 0.01F;
|
| 386 | particle.lifetime = 100;
|
| 387 | particle.setColor(0.622F, 0.508F, 0.082F);
|
| 388 | return particle;
|
| 389 | }
|
| 390 | }
|
| 391 |
|
| 392 | @Environment(EnvType.CLIENT)
|
| 393 | public static class HoneyLandProvider implements ParticleProvider<SimpleParticleType> {
|
| 394 | private final SpriteSet sprite;
|
| 395 |
|
| 396 | public HoneyLandProvider(final SpriteSet sprite) {
|
| 397 | this.sprite = sprite;
|
| 398 | }
|
| 399 |
|
| 400 | public Particle createParticle(
|
| 401 | final SimpleParticleType options,
|
| 402 | final ClientLevel level,
|
| 403 | final double x,
|
| 404 | final double y,
|
| 405 | final double z,
|
| 406 | final double xAux,
|
| 407 | final double yAux,
|
| 408 | final double zAux,
|
| 409 | final RandomSource random
|
| 410 | ) {
|
| 411 | DripParticle particle = new DripParticle.DripLandParticle(level, x, y, z, Fluids.EMPTY, this.sprite.get(random));
|
| 412 | particle.lifetime = (int)(128.0 / (random.nextFloat() * 0.8 + 0.2));
|
| 413 | particle.setColor(0.522F, 0.408F, 0.082F);
|
| 414 | return particle;
|
| 415 | }
|
| 416 | }
|
| 417 |
|
| 418 | @Environment(EnvType.CLIENT)
|
| 419 | public static class LavaFallProvider implements ParticleProvider<SimpleParticleType> {
|
| 420 | private final SpriteSet sprite;
|
| 421 |
|
| 422 | public LavaFallProvider(final SpriteSet sprite) {
|
| 423 | this.sprite = sprite;
|
| 424 | }
|
| 425 |
|
| 426 | public Particle createParticle(
|
| 427 | final SimpleParticleType options,
|
| 428 | final ClientLevel level,
|
| 429 | final double x,
|
| 430 | final double y,
|
| 431 | final double z,
|
| 432 | final double xAux,
|
| 433 | final double yAux,
|
| 434 | final double zAux,
|
| 435 | final RandomSource random
|
| 436 | ) {
|
| 437 | DripParticle particle = new DripParticle.FallAndLandParticle(level, x, y, z, Fluids.LAVA, ParticleTypes.LANDING_LAVA, this.sprite.get(random));
|
| 438 | particle.setColor(1.0F, 0.2857143F, 0.083333336F);
|
| 439 | return particle;
|
| 440 | }
|
| 441 | }
|
| 442 |
|
| 443 | @Environment(EnvType.CLIENT)
|
| 444 | public static class LavaHangProvider implements ParticleProvider<SimpleParticleType> {
|
| 445 | private final SpriteSet sprite;
|
| 446 |
|
| 447 | public LavaHangProvider(final SpriteSet sprite) {
|
| 448 | this.sprite = sprite;
|
| 449 | }
|
| 450 |
|
| 451 | public Particle createParticle(
|
| 452 | final SimpleParticleType options,
|
| 453 | final ClientLevel level,
|
| 454 | final double x,
|
| 455 | final double y,
|
| 456 | final double z,
|
| 457 | final double xAux,
|
| 458 | final double yAux,
|
| 459 | final double zAux,
|
| 460 | final RandomSource random
|
| 461 | ) {
|
| 462 | return new DripParticle.CoolingDripHangParticle(level, x, y, z, Fluids.LAVA, ParticleTypes.FALLING_LAVA, this.sprite.get(random));
|
| 463 | }
|
| 464 | }
|
| 465 |
|
| 466 | @Environment(EnvType.CLIENT)
|
| 467 | public static class LavaLandProvider implements ParticleProvider<SimpleParticleType> {
|
| 468 | private final SpriteSet sprite;
|
| 469 |
|
| 470 | public LavaLandProvider(final SpriteSet sprite) {
|
| 471 | this.sprite = sprite;
|
| 472 | }
|
| 473 |
|
| 474 | public Particle createParticle(
|
| 475 | final SimpleParticleType options,
|
| 476 | final ClientLevel level,
|
| 477 | final double x,
|
| 478 | final double y,
|
| 479 | final double z,
|
| 480 | final double xAux,
|
| 481 | final double yAux,
|
| 482 | final double zAux,
|
| 483 | final RandomSource random
|
| 484 | ) {
|
| 485 | DripParticle particle = new DripParticle.DripLandParticle(level, x, y, z, Fluids.LAVA, this.sprite.get(random));
|
| 486 | particle.setColor(1.0F, 0.2857143F, 0.083333336F);
|
| 487 | return particle;
|
| 488 | }
|
| 489 | }
|
| 490 |
|
| 491 | @Environment(EnvType.CLIENT)
|
| 492 | public static class NectarFallProvider implements ParticleProvider<SimpleParticleType> {
|
| 493 | private final SpriteSet sprite;
|
| 494 |
|
| 495 | public NectarFallProvider(final SpriteSet sprite) {
|
| 496 | this.sprite = sprite;
|
| 497 | }
|
| 498 |
|
| 499 | public Particle createParticle(
|
| 500 | final SimpleParticleType options,
|
| 501 | final ClientLevel level,
|
| 502 | final double x,
|
| 503 | final double y,
|
| 504 | final double z,
|
| 505 | final double xAux,
|
| 506 | final double yAux,
|
| 507 | final double zAux,
|
| 508 | final RandomSource random
|
| 509 | ) {
|
| 510 | DripParticle particle = new DripParticle.FallingParticle(level, x, y, z, Fluids.EMPTY, this.sprite.get(random));
|
| 511 | particle.lifetime = (int)(16.0 / (random.nextFloat() * 0.8 + 0.2));
|
| 512 | particle.gravity = 0.007F;
|
| 513 | particle.setColor(0.92F, 0.782F, 0.72F);
|
| 514 | return particle;
|
| 515 | }
|
| 516 | }
|
| 517 |
|
| 518 | @Environment(EnvType.CLIENT)
|
| 519 | public static class ObsidianTearFallProvider implements ParticleProvider<SimpleParticleType> {
|
| 520 | private final SpriteSet sprite;
|
| 521 |
|
| 522 | public ObsidianTearFallProvider(final SpriteSet sprite) {
|
| 523 | this.sprite = sprite;
|
| 524 | }
|
| 525 |
|
| 526 | public Particle createParticle(
|
| 527 | final SimpleParticleType options,
|
| 528 | final ClientLevel level,
|
| 529 | final double x,
|
| 530 | final double y,
|
| 531 | final double z,
|
| 532 | final double xAux,
|
| 533 | final double yAux,
|
| 534 | final double zAux,
|
| 535 | final RandomSource random
|
| 536 | ) {
|
| 537 | DripParticle particle = new DripParticle.FallAndLandParticle(level, x, y, z, Fluids.EMPTY, ParticleTypes.LANDING_OBSIDIAN_TEAR, this.sprite.get(random));
|
| 538 | particle.isGlowing = true;
|
| 539 | particle.gravity = 0.01F;
|
| 540 | particle.setColor(0.51171875F, 0.03125F, 0.890625F);
|
| 541 | return particle;
|
| 542 | }
|
| 543 | }
|
| 544 |
|
| 545 | @Environment(EnvType.CLIENT)
|
| 546 | public static class ObsidianTearHangProvider implements ParticleProvider<SimpleParticleType> {
|
| 547 | private final SpriteSet sprite;
|
| 548 |
|
| 549 | public ObsidianTearHangProvider(final SpriteSet sprite) {
|
| 550 | this.sprite = sprite;
|
| 551 | }
|
| 552 |
|
| 553 | public Particle createParticle(
|
| 554 | final SimpleParticleType options,
|
| 555 | final ClientLevel level,
|
| 556 | final double x,
|
| 557 | final double y,
|
| 558 | final double z,
|
| 559 | final double xAux,
|
| 560 | final double yAux,
|
| 561 | final double zAux,
|
| 562 | final RandomSource random
|
| 563 | ) {
|
| 564 | DripParticle.DripHangParticle particle = new DripParticle.DripHangParticle(
|
| 565 | level, x, y, z, Fluids.EMPTY, ParticleTypes.FALLING_OBSIDIAN_TEAR, this.sprite.get(random)
|
| 566 | );
|
| 567 | particle.isGlowing = true;
|
| 568 | particle.gravity *= 0.01F;
|
| 569 | particle.lifetime = 100;
|
| 570 | particle.setColor(0.51171875F, 0.03125F, 0.890625F);
|
| 571 | return particle;
|
| 572 | }
|
| 573 | }
|
| 574 |
|
| 575 | @Environment(EnvType.CLIENT)
|
| 576 | public static class ObsidianTearLandProvider implements ParticleProvider<SimpleParticleType> {
|
| 577 | private final SpriteSet sprite;
|
| 578 |
|
| 579 | public ObsidianTearLandProvider(final SpriteSet sprite) {
|
| 580 | this.sprite = sprite;
|
| 581 | }
|
| 582 |
|
| 583 | public Particle createParticle(
|
| 584 | final SimpleParticleType options,
|
| 585 | final ClientLevel level,
|
| 586 | final double x,
|
| 587 | final double y,
|
| 588 | final double z,
|
| 589 | final double xAux,
|
| 590 | final double yAux,
|
| 591 | final double zAux,
|
| 592 | final RandomSource random
|
| 593 | ) {
|
| 594 | DripParticle particle = new DripParticle.DripLandParticle(level, x, y, z, Fluids.EMPTY, this.sprite.get(random));
|
| 595 | particle.isGlowing = true;
|
| 596 | particle.lifetime = (int)(28.0 / (random.nextFloat() * 0.8 + 0.2));
|
| 597 | particle.setColor(0.51171875F, 0.03125F, 0.890625F);
|
| 598 | return particle;
|
| 599 | }
|
| 600 | }
|
| 601 |
|
| 602 | @Environment(EnvType.CLIENT)
|
| 603 | public static class SporeBlossomFallProvider implements ParticleProvider<SimpleParticleType> {
|
| 604 | private final SpriteSet sprite;
|
| 605 |
|
| 606 | public SporeBlossomFallProvider(final SpriteSet sprite) {
|
| 607 | this.sprite = sprite;
|
| 608 | }
|
| 609 |
|
| 610 | public Particle createParticle(
|
| 611 | final SimpleParticleType options,
|
| 612 | final ClientLevel level,
|
| 613 | final double x,
|
| 614 | final double y,
|
| 615 | final double z,
|
| 616 | final double xAux,
|
| 617 | final double yAux,
|
| 618 | final double zAux,
|
| 619 | final RandomSource random
|
| 620 | ) {
|
| 621 | DripParticle particle = new DripParticle.FallingParticle(level, x, y, z, Fluids.EMPTY, this.sprite.get(random));
|
| 622 | particle.lifetime = (int)(64.0F / Mth.randomBetween(particle.random, 0.1F, 0.9F));
|
| 623 | particle.gravity = 0.005F;
|
| 624 | particle.setColor(0.32F, 0.5F, 0.22F);
|
| 625 | return particle;
|
| 626 | }
|
| 627 | }
|
| 628 |
|
| 629 | @Environment(EnvType.CLIENT)
|
| 630 | public static class WaterFallProvider implements ParticleProvider<SimpleParticleType> {
|
| 631 | private final SpriteSet sprite;
|
| 632 |
|
| 633 | public WaterFallProvider(final SpriteSet sprite) {
|
| 634 | this.sprite = sprite;
|
| 635 | }
|
| 636 |
|
| 637 | public Particle createParticle(
|
| 638 | final SimpleParticleType options,
|
| 639 | final ClientLevel level,
|
| 640 | final double x,
|
| 641 | final double y,
|
| 642 | final double z,
|
| 643 | final double xAux,
|
| 644 | final double yAux,
|
| 645 | final double zAux,
|
| 646 | final RandomSource random
|
| 647 | ) {
|
| 648 | DripParticle particle = new DripParticle.FallAndLandParticle(level, x, y, z, Fluids.WATER, ParticleTypes.SPLASH, this.sprite.get(random));
|
| 649 | particle.setColor(0.2F, 0.3F, 1.0F);
|
| 650 | return particle;
|
| 651 | }
|
| 652 | }
|
| 653 |
|
| 654 | @Environment(EnvType.CLIENT)
|
| 655 | public static class WaterHangProvider implements ParticleProvider<SimpleParticleType> {
|
| 656 | private final SpriteSet sprite;
|
| 657 |
|
| 658 | public WaterHangProvider(final SpriteSet sprite) {
|
| 659 | this.sprite = sprite;
|
| 660 | }
|
| 661 |
|
| 662 | public Particle createParticle(
|
| 663 | final SimpleParticleType options,
|
| 664 | final ClientLevel level,
|
| 665 | final double x,
|
| 666 | final double y,
|
| 667 | final double z,
|
| 668 | final double xAux,
|
| 669 | final double yAux,
|
| 670 | final double zAux,
|
| 671 | final RandomSource random
|
| 672 | ) {
|
| 673 | DripParticle particle = new DripParticle.DripHangParticle(level, x, y, z, Fluids.WATER, ParticleTypes.FALLING_WATER, this.sprite.get(random));
|
| 674 | particle.setColor(0.2F, 0.3F, 1.0F);
|
| 675 | return particle;
|
| 676 | }
|
| 677 | }
|
| 678 | }
|
| 679 |
|