Fix dust particle data

This commit is contained in:
Camotoy 2021-06-08 20:07:34 -04:00
parent e3169866ef
commit 5b5334c2be
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
3 changed files with 25 additions and 25 deletions

View file

@ -4,11 +4,11 @@ import lombok.Getter;
@Getter
public class DustColorTransitionParticleData extends DustParticleData {
private final double newRed;
private final double newGreen;
private final double newBlue;
private final float newRed;
private final float newGreen;
private final float newBlue;
public DustColorTransitionParticleData(double red, double green, double blue, float scale, double newRed, double newGreen, double newBlue) {
public DustColorTransitionParticleData(float red, float green, float blue, float scale, float newRed, float newGreen, float newBlue) {
super(red, green, blue, scale);
this.newRed = newRed;
this.newGreen = newGreen;

View file

@ -6,8 +6,8 @@ import lombok.Data;
@Data
@AllArgsConstructor
public class DustParticleData implements ParticleData {
private final double red; // 0 - 1
private final double green; // 0 - 1
private final double blue; // 0 - 1
private final float red; // 0 - 1
private final float green; // 0 - 1
private final float blue; // 0 - 1
private final float scale; // clamped between 0.01 and 4
}

View file

@ -12,19 +12,19 @@ public interface ParticleData {
case BLOCK:
return new BlockParticleData(in.readVarInt());
case DUST:
double red = in.readDouble();
double green = in.readDouble();
double blue = in.readDouble();
float red = in.readFloat();
float green = in.readFloat();
float blue = in.readFloat();
float scale = in.readFloat();
return new DustParticleData(red, green, blue, scale);
case DUST_COLOR_TRANSITION:
red = in.readDouble();
green = in.readDouble();
blue = in.readDouble();
red = in.readFloat();
green = in.readFloat();
blue = in.readFloat();
scale = in.readFloat();
double newRed = in.readDouble();
double newGreen = in.readDouble();
double newBlue = in.readDouble();
float newRed = in.readFloat();
float newGreen = in.readFloat();
float newBlue = in.readFloat();
return new DustColorTransitionParticleData(red, green, blue, scale, newRed, newGreen, newBlue);
case FALLING_DUST:
return new FallingDustParticleData(in.readVarInt());
@ -41,19 +41,19 @@ public interface ParticleData {
out.writeVarInt(((BlockParticleData) data).getBlockState());
break;
case DUST:
out.writeDouble(((DustParticleData) data).getRed());
out.writeDouble(((DustParticleData) data).getGreen());
out.writeDouble(((DustParticleData) data).getBlue());
out.writeFloat(((DustParticleData) data).getRed());
out.writeFloat(((DustParticleData) data).getGreen());
out.writeFloat(((DustParticleData) data).getBlue());
out.writeFloat(((DustParticleData) data).getScale());
break;
case DUST_COLOR_TRANSITION:
out.writeDouble(((DustParticleData) data).getRed());
out.writeDouble(((DustParticleData) data).getGreen());
out.writeDouble(((DustParticleData) data).getBlue());
out.writeFloat(((DustParticleData) data).getRed());
out.writeFloat(((DustParticleData) data).getGreen());
out.writeFloat(((DustParticleData) data).getBlue());
out.writeFloat(((DustParticleData) data).getScale());
out.writeDouble(((DustColorTransitionParticleData) data).getNewRed());
out.writeDouble(((DustColorTransitionParticleData) data).getNewGreen());
out.writeDouble(((DustColorTransitionParticleData) data).getNewBlue());
out.writeFloat(((DustColorTransitionParticleData) data).getNewRed());
out.writeFloat(((DustColorTransitionParticleData) data).getNewGreen());
out.writeFloat(((DustColorTransitionParticleData) data).getNewBlue());
break;
case FALLING_DUST:
out.writeVarInt(((FallingDustParticleData) data).getBlockState());