Skip to content

Commit

Permalink
Add Keys.FROZEN_TIME & Keys.MAX_FROZEN_TIME
Browse files Browse the repository at this point in the history
  • Loading branch information
avaruus1 authored and Faithcaio committed Oct 4, 2023
1 parent 9f33e03 commit 3cd95e5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/org/spongepowered/api/data/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,11 @@ public final class Keys {
*/
public static final Key<Value<FoxType>> FOX_TYPE = Keys.key(ResourceKey.sponge("fox_type"), FoxType.class);

/**
* The time (in ticks) an {@link Entity} is frozen.
*/
public static final Key<Value<Ticks>> FROZEN_TIME = Keys.key(ResourceKey.sponge("frozen_time"), Ticks.class);

/**
* Represents the {@link Key} for the amount of fuel left in a {@link BrewingStand} or {@link FurnaceBlockEntity} or {@link FurnaceMinecart}
*
Expand Down Expand Up @@ -2242,6 +2247,13 @@ public final class Keys {
*/
public static final Key<Value<Integer>> MAX_FOOD_LEVEL = Keys.key(ResourceKey.sponge("max_food_level"), Integer.class);

/**
* The frozen time after which an {@link Entity} is completely frozen. Readonly.
*
* @see Keys#FROZEN_TIME
*/
public static final Key<Value<Ticks>> MAX_FROZEN_TIME = Keys.key(ResourceKey.sponge("max_frozen_time"), Ticks.class);

/**
* The maximum health of a {@link Living}.
*
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/org/spongepowered/api/entity/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,15 @@ default Value.Mutable<Double> fallDistance() {
return this.requireValue(Keys.FALL_DISTANCE).asMutable();
}

/**
* {@link Keys#FROZEN_TIME}
*
* @return The frozen time
*/
default Value.Mutable<Ticks> frozenTime() {
return this.requireValue(Keys.FROZEN_TIME).asMutable();
}

/**
* {@link Keys#PASSENGERS}
*
Expand Down Expand Up @@ -589,6 +598,15 @@ default Value.Mutable<Integer> maxAir() {
return this.requireValue(Keys.MAX_AIR).asMutable();
}

/**
* {@link Keys#MAX_FROZEN_TIME}
*
* @return The max frozen time
*/
default Value.Mutable<Ticks> maxFrozenTime() {
return this.requireValue(Keys.MAX_FROZEN_TIME).asMutable();
}

/**
* {@link Keys#REMAINING_AIR}
*
Expand Down

0 comments on commit 3cd95e5

Please sign in to comment.