52 lines
2 KiB
Java
52 lines
2 KiB
Java
/*
|
|
* Copyright (c) 2021 TeamMoeg
|
|
*
|
|
* This file is part of Frosted Heart.
|
|
*
|
|
* Frosted Heart is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, version 3.
|
|
*
|
|
* Frosted Heart is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with Frosted Heart. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
package com.teammoeg.steampowered.client;
|
|
|
|
import net.minecraft.client.particle.SpriteSet;
|
|
import net.minecraft.client.particle.ParticleProvider;
|
|
import net.minecraft.client.particle.Particle;
|
|
import net.minecraft.client.multiplayer.ClientLevel;
|
|
import net.minecraft.core.particles.SimpleParticleType;
|
|
|
|
public class SteamParticle extends ParticleBase {
|
|
|
|
public SteamParticle(ClientLevel world, double x, double y, double z, double motionX, double motionY, double motionZ) {
|
|
super(world, x, y, z, motionX, motionY, motionZ);
|
|
this.gravity = -0.1F;
|
|
this.rCol = this.gCol = this.bCol = (float) (Math.random() * 0.4) + 0.4f;
|
|
this.originalScale = 0.25F;
|
|
this.lifetime= (int) (12.0D / (Math.random() * 0.8D + 0.2D));
|
|
}
|
|
|
|
public static class Factory implements ParticleProvider<SimpleParticleType> {
|
|
private final SpriteSet spriteSet;
|
|
|
|
public Factory(SpriteSet spriteSet) {
|
|
this.spriteSet = spriteSet;
|
|
}
|
|
|
|
@Override
|
|
public Particle createParticle(SimpleParticleType typeIn, ClientLevel worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
|
|
SteamParticle steamParticle = new SteamParticle(worldIn, x, y, z, xSpeed, ySpeed, zSpeed);
|
|
steamParticle.pickSprite(this.spriteSet);
|
|
return steamParticle;
|
|
}
|
|
}
|
|
}
|