Contents
Class TimeResource
java.lang.Object
com.hypixel.hytale.server.core.modules.time.TimeResource
- All Implemented Interfaces:
Resource<EntityStore>, Cloneable
An entity store resource that holds the current time, regardless of world time.
Useful for fetching the lifetime of a world regardless of the worlds day time cycle.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<TimeResource> The codec used to parseTimeResourceinstances.Fields inherited from interface Resource
EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionEmpty Constructor for aTimeResourceinstance.TimeResource(Instant now) Default Constructor for aTimeResourceinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(long time, TemporalUnit unit) Called to add the given time of the given unit to the current time instant.voidCalled to add the given duration to the current time instant.clone()getNow()static ResourceType<EntityStore, TimeResource> floatvoidCalled to set the current time instant of this resource.voidsetTimeDilationModifier(float timeDilationModifier) Called to set the time dilation modifier for this resource.toString()
-
Field Details
-
CODEC
The codec used to parseTimeResourceinstances.
-
-
Constructor Details
-
TimeResource
public TimeResource()Empty Constructor for aTimeResourceinstance.Used by the codec to instantiate
TimeResourceinstances. -
TimeResource
Default Constructor for aTimeResourceinstance.- Parameters:
now- The current time instant to set.
-
-
Method Details
-
getResourceType
- Returns:
- the
TimeResourceresource type.
-
getTimeDilationModifier
public float getTimeDilationModifier()- Returns:
- The time dilation modifier for this resource.
-
setTimeDilationModifier
public void setTimeDilationModifier(float timeDilationModifier) Called to set the time dilation modifier for this resource.- Parameters:
timeDilationModifier- The time dilation modifier to set.
-
getNow
- Returns:
- the current time instant of this resource.
-
setNow
Called to set the current time instant of this resource.- Parameters:
now- The time instant to set.
-
add
Called to add the given duration to the current time instant.- Parameters:
duration- The duration to increment the time instant by.
-
add
Called to add the given time of the given unit to the current time instant.- Parameters:
time- The amount of time to increment the time instant by.unit- The time unit of the time amount.
-
clone
- Specified by:
clonein interfaceResource<EntityStore>- Returns:
- a clone instance of the original resource instance.
-
toString
-