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.IAnimatedSprite;
|
|
import net.minecraft.client.particle.IParticleFactory;
|
|
import net.minecraft.client.particle.Particle;
|
|
import net.minecraft.client.world.ClientWorld;
|
|
import net.minecraft.particles.BasicParticleType;
|
|
|
|
public class SteamParticle extends ParticleBase {
|
|
|
|
public SteamParticle(ClientWorld world, double x, double y, double z, double motionX, double motionY, double motionZ) {
|
|
super(world, x, y, z, motionX, motionY + 0.4f, motionZ);
|
|
this.gravity = -0.05F;
|
|
this.rCol = this.gCol = this.bCol = 1.0f;
|
|
this.originalScale = 0.6F;
|
|
this.lifetime= (int) (160.0D / (Math.random() * 0.2D + 0.8D));
|
|
}
|
|
|
|
public static class Factory implements IParticleFactory<BasicParticleType> {
|
|
private final IAnimatedSprite spriteSet;
|
|
|
|
public Factory(IAnimatedSprite spriteSet) {
|
|
this.spriteSet = spriteSet;
|
|
}
|
|
|
|
@Override
|
|
public Particle createParticle(BasicParticleType typeIn, ClientWorld 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;
|
|
}
|
|
}
|
|
}
|