Update visual fire handling with TriState support (#12303)

Replaced the Boolean-based visual fire system with TriState for improved clarity and flexibility, enabling three distinct states: TRUE, FALSE, and NOT_SET. Deprecated older methods in favor of new ones and updated internal handling to reflect these changes. Adjusted serialization and deserialization logic to accommodate the new TriState implementation.
This commit is contained in:
David
2025-05-07 23:33:41 +02:00
committed by GitHub
parent ab0253fecd
commit cbcf75a57c
4 changed files with 102 additions and 11 deletions

View File

@ -5,6 +5,7 @@ import java.util.Set;
import java.util.UUID;
import io.papermc.paper.datacomponent.DataComponentView;
import io.papermc.paper.entity.LookAnchor;
import net.kyori.adventure.util.TriState;
import org.bukkit.Chunk; // Paper
import org.bukkit.EntityEffect;
import org.bukkit.Location;
@ -296,17 +297,43 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
/**
* Sets if the entity has visual fire (it will always appear to be on fire).
*
* @deprecated This method doesn't allow visually extinguishing a burning entity,
* use {@link #setVisualFire(TriState)} instead
* @param fire whether visual fire is enabled
*/
@Deprecated
void setVisualFire(boolean fire);
/**
* Sets if the entity has visual fire (it will always appear to be on fire).
* <ul>
* <li>{@link TriState#NOT_SET} will revert the entity's visual fire to default</li>
* <li>{@link TriState#TRUE} will make the entity appear to be on fire</li>
* <li>{@link TriState#FALSE} will make the entity appear to be not on fire</li>
* </ul>
*
* @param fire a TriState value representing the state of the visual fire.
*/
void setVisualFire(@NotNull TriState fire);
/**
* Gets if the entity has visual fire (it will always appear to be on fire).
*
* @deprecated This method can't properly reflect the three possible states of visual fire,
* use {@link #getVisualFire()} instead
* @return whether visual fire is enabled
*/
@Deprecated
boolean isVisualFire();
/**
* Retrieves the visual fire state of the object.
*
* @return A TriState indicating the current visual fire state.
*/
@NotNull
TriState getVisualFire();
/**
* Returns the entity's current freeze ticks (amount of ticks the entity has
* been in powdered snow).