Class ConstantDuration

java.lang.Object
com.pixelmonmod.pixelmon.api.daycare.impl.duration.AbstractDuration
com.pixelmonmod.pixelmon.api.daycare.impl.duration.ConstantDuration
All Implemented Interfaces:
DayCareDuration

public class ConstantDuration extends AbstractDuration
Duration type that adds the given amount in the specified units
Since:
13/07/2022
  • Field Summary

    Fields inherited from class com.pixelmonmod.pixelmon.api.daycare.impl.duration.AbstractDuration

    id
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.network.chat.Component
    Get the display Component
    long
     
    long
    getMillisecondValue(net.minecraft.server.level.ServerPlayer player, DayCareBox box, long currentTime)
    Calculates the value in milliseconds that will get ADDED to the timestamp when the end timestamp is calculated
    int
    Gets the duration type's priority (higher priority = will be calculated first)
    void
    read(com.google.gson.Gson gson, com.google.gson.JsonElement json)
    Reads the duration from JSON

    Methods inherited from class com.pixelmonmod.pixelmon.api.daycare.impl.duration.AbstractDuration

    getId

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ConstantDuration

      public ConstantDuration()
  • Method Details

    • getPriority

      public int getPriority()
      Description copied from interface: DayCareDuration
      Gets the duration type's priority (higher priority = will be calculated first)
      Specified by:
      getPriority in interface DayCareDuration
      Overrides:
      getPriority in class AbstractDuration
      Returns:
      The priority
    • getMillisecondValue

      public long getMillisecondValue(net.minecraft.server.level.ServerPlayer player, DayCareBox box, long currentTime)
      Description copied from interface: DayCareDuration
      Calculates the value in milliseconds that will get ADDED to the timestamp when the end timestamp is calculated
      Parameters:
      player - The player this is relevant to
      box - The box this is relevant to from the player
      currentTime - The already calculated time
      Returns:
      The milliseconds value
    • read

      public void read(com.google.gson.Gson gson, com.google.gson.JsonElement json)
      Description copied from interface: DayCareDuration
      Reads the duration from JSON
      Parameters:
      gson - The GSON
      json - The JSON element
    • getDisplay

      public net.minecraft.network.chat.Component getDisplay()
      Description copied from interface: DayCareDuration
      Get the display Component
      Specified by:
      getDisplay in interface DayCareDuration
      Specified by:
      getDisplay in class AbstractDuration
      Returns:
      the Component
    • getMilliseconds

      public long getMilliseconds()