Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @OnlyIn(Dist.CLIENT)
- public class StrawberryParticle extends SpriteTexturedParticle {
- private final IAnimatedSprite spriteWithAge;
- private StrawberryParticle(ClientWorld world, double x, double y, double z, double p_i232429_8_, double motionY, double p_i232429_12_, IAnimatedSprite spriteWithAge) {
- super(world, x, y, z, 0.05D, motionY, 0.05D);
- this.spriteWithAge = spriteWithAge;
- this.motionY *= 0.004D;
- if (p_i232429_8_ == 0.0D && p_i232429_12_ == 0.0D) {
- this.motionX *= 0.004D;
- this.motionZ *= 0.004D;
- }
- this.particleScale *= 1.0F;
- this.maxAge = (int)(6.0D / (Math.random() * 0.4D + 0.2D));
- this.canCollide = false;
- this.selectSpriteWithAge(spriteWithAge);
- }
- @Override
- public IParticleRenderType getRenderType() {
- return IParticleRenderType.PARTICLE_SHEET_OPAQUE;
- }
- @Override
- public void tick() {
- this.prevPosX = this.posX;
- this.prevPosY = this.posY;
- this.prevPosZ = this.posZ;
- if (this.age++ >= this.maxAge) {
- this.setExpired();
- } else {
- this.selectSpriteWithAge(this.spriteWithAge);
- this.motionY += 0.004D;
- this.move(this.motionX, this.motionY, this.motionZ);
- if (this.posY == this.prevPosY) {
- this.motionX *= 1.1D;
- this.motionZ *= 1.1D;
- }
- this.motionX *= 0.96F;
- this.motionY *= 0.96F;
- this.motionZ *= 0.96F;
- }
- }
- @OnlyIn(Dist.CLIENT)
- public static class AmbientMobFactory implements IParticleFactory<BasicParticleType> {
- private final IAnimatedSprite spriteSet;
- public AmbientMobFactory(IAnimatedSprite spriteSet) {
- this.spriteSet = spriteSet;
- }
- public Particle makeParticle(BasicParticleType typeIn, ClientWorld worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
- Particle particle = new StrawberryParticle(worldIn, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet);
- particle.setColor((float)xSpeed, (float)ySpeed, (float)zSpeed);
- return particle;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement