-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
118 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
api/src/main/java/org/allaymc/api/entity/EntityStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.allaymc.api.entity; | ||
|
||
import lombok.Getter; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
/** | ||
* Represents the status of an entity. | ||
* | ||
* @author daoge_cmd | ||
*/ | ||
public enum EntityStatus { | ||
/** | ||
* The entity is despawned. | ||
*/ | ||
DESPAWNED(false), | ||
/** | ||
* The entity will be spawn in the next tick. | ||
*/ | ||
SPAWNED_NEXT_TICK(false, DESPAWNED), | ||
/** | ||
* The entity is alive. | ||
*/ | ||
ALIVE(true, SPAWNED_NEXT_TICK), | ||
/** | ||
* The entity is dead. | ||
*/ | ||
DEAD(true, ALIVE), | ||
/** | ||
* The entity will be despawned in the next tick. | ||
*/ | ||
DESPAWNED_NEXT_TICK(false, DEAD, ALIVE); | ||
|
||
@Getter | ||
private final boolean spawned; | ||
/** | ||
* The possible previous statuses of the entity. Can be {@code null} if previous status is not exist. | ||
*/ | ||
@Getter | ||
private final Set<EntityStatus> previousStatuses; | ||
|
||
EntityStatus(boolean spawned, EntityStatus... previousStatuses) { | ||
this.spawned = spawned; | ||
this.previousStatuses = new HashSet<>(); | ||
this.previousStatuses.addAll(Arrays.asList(previousStatuses)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters