Code style changes, entities fixes

This commit is contained in:
paulevsGitch 2021-07-08 00:21:47 +03:00
parent 9d604b2d25
commit 44962e18b6
377 changed files with 5038 additions and 4914 deletions

View file

@ -19,7 +19,7 @@ public class FireflyParticle extends SimpleAnimatedParticle {
private double nextVX;
private double nextVY;
private double nextVZ;
protected FireflyParticle(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.get(random));
@ -28,16 +28,16 @@ public class FireflyParticle extends SimpleAnimatedParticle {
this.setFadeColor(15916745);
this.setSpriteFromAge(sprites);
this.setAlpha(0);
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() {
int ticks = this.age & 31;
@ -50,18 +50,18 @@ public class FireflyParticle extends SimpleAnimatedParticle {
nextVZ = random.nextGaussian() * 0.02;
}
double delta = (double) ticks / 31.0;
this.xd = Mth.lerp(delta, preVX, nextVX);
this.yd = Mth.lerp(delta, preVY, nextVY);
this.zd = Mth.lerp(delta, preVZ, nextVZ);
if (this.age <= 60) {
this.setAlpha(this.age / 60F);
}
else if (this.age > lifetime - 60) {
this.setAlpha((lifetime - this.age) / 60F);
}
super.tick();
}

View file

@ -10,7 +10,7 @@ import net.minecraft.client.particle.SpriteSet;
import net.minecraft.client.particle.TextureSheetParticle;
public class InfusionParticle extends TextureSheetParticle {
private final SpriteSet spriteProvider;
public InfusionParticle(ClientLevel clientWorld, double x, double y, double z, double velocityX, double velocityY, double velocityZ, float[] palette, SpriteSet spriteProvider) {
@ -30,7 +30,7 @@ public class InfusionParticle extends TextureSheetParticle {
public ParticleRenderType getRenderType() {
return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;
}
@Override
public void tick() {
this.xo = this.x;
@ -38,7 +38,8 @@ public class InfusionParticle extends TextureSheetParticle {
this.zo = this.z;
if (this.age++ >= this.lifetime) {
this.remove();
} else {
}
else {
this.setSpriteFromAge(spriteProvider);
double velocityX = 2.0D * this.xd * this.random.nextDouble();
double velocityY = 3.0D * this.yd * this.random.nextDouble();
@ -50,11 +51,11 @@ public class InfusionParticle extends TextureSheetParticle {
@Environment(EnvType.CLIENT)
public static class InfusionFactory implements ParticleProvider<InfusionParticleType> {
private final SpriteSet spriteProvider;
public InfusionFactory(SpriteSet spriteProvider) {
this.spriteProvider = spriteProvider;
}
public Particle createParticle(InfusionParticleType particleType, ClientLevel clientWorld, double d, double e, double f, double g, double h, double i) {
return new InfusionParticle(clientWorld, d, e, f, g, h, i, particleType.getPalette(), this.spriteProvider);
}

View file

@ -3,7 +3,6 @@ package ru.betterend.particle;
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.serialization.Codec;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.commands.arguments.item.ItemInput;
@ -33,20 +32,20 @@ public class InfusionParticleType extends ParticleType<InfusionParticleType> imp
return new InfusionParticleType(particleType, packetByteBuf.readItem());
}
};
private final ParticleType<InfusionParticleType> type;
private final ItemStack itemStack;
public InfusionParticleType(ParticleType<InfusionParticleType> particleType, ItemStack stack) {
super(true, PARAMETERS_FACTORY);
this.type = particleType;
this.itemStack = stack;
}
public InfusionParticleType(ItemStack stack) {
this(EndParticles.INFUSION, stack);
}
@Environment(EnvType.CLIENT)
public float[] getPalette() {
int color = ColorUtil.extractColor(itemStack.getItem());

View file

@ -20,25 +20,25 @@ public class ParticleBlackSpore extends SimpleAnimatedParticle {
private double nextVX;
private double nextVY;
private double nextVZ;
protected ParticleBlackSpore(ClientLevel world, double x, double y, double z, double r, double g, double b, SpriteSet sprites) {
super(world, x, y, z, sprites, 0);
setSprite(sprites.get(random));
this.lifetime = MHelper.randRange(30, 60, random);
this.quadSize = MHelper.randRange(0.05F, 0.15F, random);
this.setColor(1, 1, 1);
this.setAlpha(0);
preVX = random.nextGaussian() * 0.015;
preVY = 0;
preVZ = random.nextGaussian() * 0.015;
nextVX = random.nextGaussian() * 0.015;
nextVY = random.nextFloat() * 0.02 + 0.01;
nextVZ = random.nextGaussian() * 0.015;
}
@Override
public void tick() {
int ticks = this.age & 15;
@ -51,25 +51,25 @@ public class ParticleBlackSpore extends SimpleAnimatedParticle {
nextVZ = random.nextGaussian() * 0.015;
}
double delta = (double) ticks / 15.0;
if (this.age <= 15) {
this.setAlpha(this.age / 15F);
}
else if (this.age >= this.lifetime - 15) {
this.setAlpha((this.lifetime - this.age) / 15F);
}
if (this.age >= this.lifetime) {
this.remove();
}
this.xd = Mth.lerp(delta, preVX, nextVX);
this.yd = Mth.lerp(delta, preVY, nextVY);
this.zd = Mth.lerp(delta, preVZ, nextVZ);
super.tick();
}
@Override
public ParticleRenderType getRenderType() {
return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;

View file

@ -17,7 +17,7 @@ public class ParticleGeyser extends TextureSheetParticle {
private MutableBlockPos mut = new MutableBlockPos();
private boolean changeDir = false;
private boolean check = true;
protected ParticleGeyser(ClientLevel world, double x, double y, double z, double vx, double vy, double vz, SpriteSet sprites) {
super(world, x, y, z, vx, vy, vz);
pickSprite(sprites);
@ -27,10 +27,10 @@ public class ParticleGeyser extends TextureSheetParticle {
this.zd = vz;
this.yo = y - 0.125;
}
@Override
public void tick() {
if (this.yo == this.y || this.age > this.lifetime) {
this.remove();
}
@ -38,10 +38,10 @@ public class ParticleGeyser extends TextureSheetParticle {
if (this.age >= this.lifetime - 200) {
this.setAlpha((this.lifetime - this.age) / 200F);
}
this.quadSize += 0.005F;
this.yd = 0.125;
if (changeDir) {
changeDir = false;
check = false;
@ -56,7 +56,7 @@ public class ParticleGeyser extends TextureSheetParticle {
}
super.tick();
}
@Override
public ParticleRenderType getRenderType() {
return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;

View file

@ -20,7 +20,7 @@ public class ParticleGlowingSphere extends SimpleAnimatedParticle {
private double nextVX;
private double nextVY;
private double nextVZ;
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.get(random));
@ -28,19 +28,19 @@ public class ParticleGlowingSphere extends SimpleAnimatedParticle {
this.quadSize = MHelper.randRange(0.05F, 0.15F, random);
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,11 +51,11 @@ public class ParticleGlowingSphere extends SimpleAnimatedParticle {
ticks = 0;
}
double delta = (double) ticks / 30.0;
this.xd = Mth.lerp(delta, preVX, nextVX);
this.yd = Mth.lerp(delta, preVY, nextVY);
this.zd = Mth.lerp(delta, preVZ, nextVZ);
super.tick();
}

View file

@ -12,7 +12,7 @@ import ru.bclib.util.MHelper;
@Environment(EnvType.CLIENT)
public class ParticleJungleSpore extends SimpleAnimatedParticle {
protected ParticleJungleSpore(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.get(random));
@ -22,11 +22,11 @@ public class ParticleJungleSpore extends SimpleAnimatedParticle {
this.setSpriteFromAge(sprites);
this.setAlpha(0);
}
@Override
public void tick() {
super.tick();
int ticks = this.age % 30;
if (ticks == 0) {
this.xd = random.nextGaussian() * 0.02;
@ -34,7 +34,7 @@ public class ParticleJungleSpore extends SimpleAnimatedParticle {
this.zd = random.nextGaussian() * 0.02;
ticks = 0;
}
if (this.age <= 30) {
float delta = ticks / 30F;
this.setAlpha(delta);
@ -48,7 +48,7 @@ public class ParticleJungleSpore extends SimpleAnimatedParticle {
else {
this.setAlpha(1);
}
this.yd -= 0.001F;
this.xd *= 0.99F;
this.zd *= 0.99F;

View file

@ -21,27 +21,27 @@ public class ParticleSnowflake extends TextureSheetParticle {
private double nextVX;
private double nextVY;
private double nextVZ;
protected ParticleSnowflake(ClientLevel world, double x, double y, double z, double r, double g, double b, SpriteSet sprites) {
super(world, x, y, z, r, g, b);
pickSprite(sprites);
this.lifetime = MHelper.randRange(150, 300, random);
this.quadSize = MHelper.randRange(0.05F, 0.2F, random);
this.setAlpha(0F);
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;
@ -55,25 +55,25 @@ public class ParticleSnowflake extends TextureSheetParticle {
ticks = 0;
}
double delta = (double) ticks / 200.0;
if (this.age <= 40) {
this.setAlpha(this.age / 40F);
}
else if (this.age >= this.lifetime - 40) {
this.setAlpha((this.lifetime - this.age) / 40F);
}
if (this.age >= this.lifetime) {
this.remove();
}
this.xd = Mth.lerp(delta, preVX, nextVX);
this.yd = Mth.lerp(delta, preVY, nextVY);
this.zd = Mth.lerp(delta, preVZ, nextVZ);
super.tick();
}
@Override
public ParticleRenderType getRenderType() {
return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;

View file

@ -21,28 +21,28 @@ public class ParticleSulphur extends TextureSheetParticle {
private double nextVX;
private double nextVY;
private double nextVZ;
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);
pickSprite(sprites);
this.lifetime = MHelper.randRange(150, 300, random);
this.quadSize = MHelper.randRange(0.05F, 0.15F, random);
this.setColor(1, 1, 1);
this.setAlpha(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,25 +56,25 @@ public class ParticleSulphur extends TextureSheetParticle {
ticks = 0;
}
double delta = (double) ticks / 200.0;
if (this.age <= 40) {
this.setAlpha(this.age / 40F);
}
else if (this.age >= this.lifetime - 40) {
this.setAlpha((this.lifetime - this.age) / 40F);
}
if (this.age >= this.lifetime) {
this.remove();
}
this.xd = Mth.lerp(delta, preVX, nextVX);
this.yd = Mth.lerp(delta, preVY, nextVY);
this.zd = Mth.lerp(delta, preVZ, nextVZ);
super.tick();
}
@Override
public ParticleRenderType getRenderType() {
return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;

View file

@ -19,18 +19,18 @@ import ru.betterend.registry.EndBlocks;
@Environment(EnvType.CLIENT)
public class ParticleTenaneaPetal extends TextureSheetParticle {
private static BlockColor provider;
private double preVX;
private double preVY;
private double preVZ;
private double nextVX;
private double nextVY;
private double nextVZ;
protected ParticleTenaneaPetal(ClientLevel world, double x, double y, double z, double r, double g, double b, SpriteSet sprites) {
super(world, x, y, z, r, g, b);
pickSprite(sprites);
if (provider == null) {
IColorProvider block = (IColorProvider) EndBlocks.TENANEA_FLOWERS;
provider = block.getProvider();
@ -39,15 +39,15 @@ public class ParticleTenaneaPetal extends TextureSheetParticle {
this.rCol = ((color >> 16) & 255) / 255F;
this.gCol = ((color >> 8) & 255) / 255F;
this.bCol = ((color) & 255) / 255F;
this.lifetime = MHelper.randRange(120, 200, random);
this.quadSize = MHelper.randRange(0.05F, 0.15F, random);
this.setAlpha(0);
preVX = 0;
preVY = 0;
preVZ = 0;
nextVX = random.nextGaussian() * 0.02;
nextVY = -random.nextDouble() * 0.02 - 0.02;
nextVZ = random.nextGaussian() * 0.02;
@ -57,7 +57,7 @@ public class ParticleTenaneaPetal extends TextureSheetParticle {
public int getLightColor(float tint) {
return 15728880;
}
@Override
public void tick() {
int ticks = this.age & 63;
@ -70,25 +70,25 @@ public class ParticleTenaneaPetal extends TextureSheetParticle {
nextVZ = random.nextGaussian() * 0.02;
}
double delta = (double) ticks / 63.0;
if (this.age <= 40) {
this.setAlpha(this.age / 40F);
}
else if (this.age >= this.lifetime - 40) {
this.setAlpha((this.lifetime - this.age) / 40F);
}
if (this.age >= this.lifetime) {
this.remove();
}
this.xd = Mth.lerp(delta, preVX, nextVX);
this.yd = Mth.lerp(delta, preVY, nextVY);
this.zd = Mth.lerp(delta, preVZ, nextVZ);
super.tick();
}
@Override
public ParticleRenderType getRenderType() {
return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;

View file

@ -19,7 +19,7 @@ public class PaticlePortalSphere extends SimpleAnimatedParticle {
private double nextVX;
private double nextVY;
private double nextVZ;
public PaticlePortalSphere(ClientLevel world, double x, double y, double z, SpriteSet spriteProvider) {
super(world, x, y, z, spriteProvider, 0);
setSprite(spriteProvider.get(random));
@ -28,16 +28,16 @@ public class PaticlePortalSphere extends SimpleAnimatedParticle {
this.setColor(0xFEBBD5);
this.setFadeColor(0xBBFEE4);
this.setSpriteFromAge(spriteProvider);
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++;
@ -51,11 +51,11 @@ public class PaticlePortalSphere extends SimpleAnimatedParticle {
ticks = 0;
}
double delta = (double) ticks / 30.0;
this.xd = Mth.lerp(delta, preVX, nextVX);
this.yd = Mth.lerp(delta, preVY, nextVY);
this.zd = Mth.lerp(delta, preVZ, nextVZ);
super.tick();
}

View file

@ -20,25 +20,25 @@ public class SmaragdantParticle extends SimpleAnimatedParticle {
private double nextVX;
private double nextVY;
private double nextVZ;
protected SmaragdantParticle(ClientLevel world, double x, double y, double z, double r, double g, double b, SpriteSet sprites) {
super(world, x, y, z, sprites, 0);
setSprite(sprites.get(random));
this.lifetime = MHelper.randRange(60, 120, random);
this.quadSize = MHelper.randRange(0.05F, 0.15F, random);
this.setColor(1, 1, 1);
this.setAlpha(0);
preVX = random.nextGaussian() * 0.01;
preVY = random.nextGaussian() * 0.01;
preVZ = random.nextGaussian() * 0.01;
nextVX = random.nextGaussian() * 0.01;
nextVY = random.nextGaussian() * 0.01;
nextVZ = random.nextGaussian() * 0.01;
}
@Override
public void tick() {
int ticks = this.age & 31;
@ -51,25 +51,25 @@ public class SmaragdantParticle extends SimpleAnimatedParticle {
nextVZ = random.nextGaussian() * 0.015;
}
double delta = (double) ticks / 31.0;
if (this.age <= 31) {
this.setAlpha(this.age / 31F);
}
else if (this.age >= this.lifetime - 31) {
this.setAlpha((this.lifetime - this.age) / 31F);
}
if (this.age >= this.lifetime) {
this.remove();
}
this.xd = Mth.lerp(delta, preVX, nextVX);
this.yd = Mth.lerp(delta, preVY, nextVY);
this.zd = Mth.lerp(delta, preVZ, nextVZ);
super.tick();
}
@Override
public ParticleRenderType getRenderType() {
return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;