mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-26 09:42:06 -07:00
Allow AreaEffectCloud#setColor to reset color for null (#12760)
This commit is contained in:
@@ -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.
|
||||||
|
@@ -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
|
||||||
|
Reference in New Issue
Block a user