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 TypeMethodDescriptiondoublegetFactor(@Nullable ICitizenData data) Get the factor of the happiness.getId()Get the unique happiness id.doubleGet the weight of the happiness.voidread(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compoundNBT, boolean persist) Read the modifier from nbt.voidwrite(net.minecraft.core.HolderLookup.Provider provider, 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
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(@NotNull net.minecraft.core.HolderLookup.Provider provider, 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(@NotNull net.minecraft.core.HolderLookup.Provider provider, 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.
-