Start migration

This commit is contained in:
Aleksey 2021-04-08 21:55:07 +03:00
parent 6630ce0cab
commit 47ed597358
491 changed files with 12045 additions and 11953 deletions

View file

@ -2,17 +2,17 @@ package ru.betterend.particle;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.particle.AnimatedParticle;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.SimpleAnimatedParticle;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleFactory;
import net.minecraft.client.particle.SpriteProvider;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.DefaultParticleType;
import net.minecraft.util.math.MathHelper;
import net.minecraft.client.particle.SpriteSet;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.util.Mth;
import ru.betterend.util.MHelper;
@Environment(EnvType.CLIENT)
public class ParticleGlowingSphere extends AnimatedParticle {
public class ParticleGlowingSphere extends SimpleAnimatedParticle {
private int ticks;
private double preVX;
private double preVY;
@ -20,27 +20,28 @@ public class ParticleGlowingSphere extends AnimatedParticle {
private double nextVX;
private double nextVY;
private double nextVZ;
protected ParticleGlowingSphere(ClientWorld world, double x, double y, double z, SpriteProvider sprites, double r, double g, double b) {
protected ParticleGlowingSphere(ClientLevel world, double x, double y, double z, SpriteSet sprites, double r,
double g, double b) {
super(world, x, y, z, sprites, 0);
setSprite(sprites.getSprite(random));
this.maxAge = MHelper.randRange(150, 300, random);
setSprite(sprites.get(random));
this.lifetime = MHelper.randRange(150, 300, random);
this.scale = MHelper.randRange(0.05F, 0.15F, random);
this.setTargetColor(15916745);
this.setSpriteForAge(spriteProvider);
this.setFadeColor(15916745);
this.setSpriteFromAge(sprites);
preVX = random.nextGaussian() * 0.02;
preVY = random.nextGaussian() * 0.02;
preVZ = random.nextGaussian() * 0.02;
nextVX = random.nextGaussian() * 0.02;
nextVY = random.nextGaussian() * 0.02;
nextVZ = random.nextGaussian() * 0.02;
}
@Override
public void tick() {
ticks ++;
ticks++;
if (ticks > 30) {
preVX = nextVX;
preVY = nextVY;
@ -51,25 +52,26 @@ public class ParticleGlowingSphere extends AnimatedParticle {
ticks = 0;
}
double delta = (double) ticks / 30.0;
this.velocityX = MathHelper.lerp(delta, preVX, nextVX);
this.velocityY = MathHelper.lerp(delta, preVY, nextVY);
this.velocityZ = MathHelper.lerp(delta, preVZ, nextVZ);
this.velocityX = Mth.lerp(delta, preVX, nextVX);
this.velocityY = Mth.lerp(delta, preVY, nextVY);
this.velocityZ = Mth.lerp(delta, preVZ, nextVZ);
super.tick();
}
@Environment(EnvType.CLIENT)
public static class FactoryGlowingSphere implements ParticleFactory<DefaultParticleType> {
public static class FactoryGlowingSphere implements ParticleFactory<SimpleParticleType> {
private final SpriteProvider sprites;
private final SpriteSet sprites;
public FactoryGlowingSphere(SpriteProvider sprites) {
public FactoryGlowingSphere(SpriteSet sprites) {
this.sprites = sprites;
}
@Override
public Particle createParticle(DefaultParticleType type, ClientWorld world, double x, double y, double z, double vX, double vY, double vZ) {
public Particle createParticle(SimpleParticleType type, ClientLevel world, double x, double y, double z,
double vX, double vY, double vZ) {
return new ParticleGlowingSphere(world, x, y, z, sprites, 1, 1, 1);
}
}