Allow AreaEffectCloud#setColor to reset color for null (#12760)

This commit is contained in:
David
2025-07-16 22:00:54 +02:00
committed by GitHub
parent a6e0c08fdf
commit e792779dd8
2 changed files with 3 additions and 3 deletions

View File

@@ -241,9 +241,9 @@ public interface AreaEffectCloud extends Entity {
/** /**
* Sets the color of this cloud. Will be applied as a tint to its particles. * Sets the color of this cloud. Will be applied as a tint to its particles.
* *
* @param color cloud color * @param color cloud color or {@code null} to reset to default
*/ */
void setColor(@NotNull Color color); void setColor(@Nullable Color color);
/** /**
* Retrieve the original source of this cloud. * Retrieve the original source of this cloud.

View File

@@ -128,7 +128,7 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
@Override @Override
public void setColor(Color color) { public void setColor(Color color) {
PotionContents old = this.getHandle().potionContents; PotionContents old = this.getHandle().potionContents;
this.getHandle().setPotionContents(new PotionContents(old.potion(), Optional.of(color.asRGB()), old.customEffects(), old.customName())); this.getHandle().setPotionContents(new PotionContents(old.potion(), Optional.ofNullable(color).map(Color::asRGB), old.customEffects(), old.customName()));
} }
@Override @Override