Interface IHappinessModifier

All Known Subinterfaces:
ITimeBasedHappinessModifier
All Known Implementing Classes:
AbstractHappinessModifier, ExpirationBasedHappinessModifier, StaticHappinessModifier, TimeBasedHappinessModifier

public interface IHappinessModifier
Interface describing possible happiness factors.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    getFactor(@Nullable ICitizenData data)
    Get the factor of the happiness.
    Get the unique happiness id.
    double
    Get the weight of the happiness.
    void
    read(net.minecraft.nbt.CompoundTag compoundNBT, boolean persist)
    Read the modifier from nbt.
    void
    write(net.minecraft.nbt.CompoundTag compoundNBT, boolean persist)
    Write it to NBT.
  • Method Details

    • getId

      String getId()
      Get the unique happiness id.
      Returns:
      the string id.
    • getFactor

      double getFactor(@Nullable @Nullable ICitizenData data)
      Get the factor of the happiness. value between 0 and 1 if negative. value above 1 if positive.
      Parameters:
      data - the citizen the factor is for.
      Returns:
      the value of the factor.
    • getWeight

      double getWeight()
      Get the weight of the happiness.
      Returns:
      the weight.
    • read

      void read(net.minecraft.nbt.CompoundTag compoundNBT, boolean persist)
      Read the modifier from nbt.
      Parameters:
      compoundNBT - the compound to read it from.
      persist - whether we're reading from persisted data or from networking.
    • write

      void write(net.minecraft.nbt.CompoundTag compoundNBT, boolean persist)
      Write it to NBT.
      Parameters:
      compoundNBT - the compound to write it to.
      persist - whether we're reading from persisted data or from networking.