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

@ -6,10 +6,10 @@ import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleFactory;
import net.minecraft.client.particle.ParticleTextureSheet;
import net.minecraft.client.particle.SpriteBillboardParticle;
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.client.multiplayer.ClientLevel;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.util.Mth;
import ru.betterend.util.MHelper;
@Environment(EnvType.CLIENT)
@ -21,28 +21,29 @@ public class ParticleSulphur extends SpriteBillboardParticle {
private double nextVX;
private double nextVY;
private double nextVZ;
protected ParticleSulphur(ClientWorld world, double x, double y, double z, double r, double g, double b, SpriteProvider sprites) {
protected ParticleSulphur(ClientLevel world, double x, double y, double z, double r, double g, double b,
SpriteSet sprites) {
super(world, x, y, z, r, g, b);
setSprite(sprites);
this.maxAge = MHelper.randRange(150, 300, random);
this.scale = MHelper.randRange(0.05F, 0.15F, random);
this.setColor(1, 1, 1);
this.setColorAlpha(0);
preVX = random.nextGaussian() * 0.015;
preVY = random.nextGaussian() * 0.015;
preVZ = random.nextGaussian() * 0.015;
nextVX = random.nextGaussian() * 0.015;
nextVY = random.nextGaussian() * 0.015;
nextVZ = random.nextGaussian() * 0.015;
}
@Override
public void tick() {
ticks ++;
ticks++;
if (ticks > 200) {
preVX = nextVX;
preVY = nextVY;
@ -56,41 +57,41 @@ public class ParticleSulphur extends SpriteBillboardParticle {
ticks = 0;
}
double delta = (double) ticks / 200.0;
if (this.age <= 40) {
this.setColorAlpha(this.age / 40F);
}
else if (this.age >= this.maxAge - 40) {
} else if (this.age >= this.maxAge - 40) {
this.setColorAlpha((this.maxAge - this.age) / 40F);
}
if (this.age >= this.maxAge) {
this.markDead();
}
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();
}
@Override
public ParticleTextureSheet getType() {
return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT;
}
@Environment(EnvType.CLIENT)
public static class FactorySulphur implements ParticleFactory<DefaultParticleType> {
public static class FactorySulphur implements ParticleFactory<SimpleParticleType> {
private final SpriteProvider sprites;
private final SpriteSet sprites;
public FactorySulphur(SpriteProvider sprites) {
public FactorySulphur(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 ParticleSulphur(world, x, y, z, 1, 1, 1, sprites);
}
}