Class DynamicHappinessSupplier
java.lang.Object
com.minecolonies.api.entity.citizen.happiness.DynamicHappinessSupplier
- All Implemented Interfaces:
IHappinessSupplierWrapper,net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Dynamic Happiness supplier.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for deserialization.DynamicHappinessSupplier(net.minecraft.resources.ResourceLocation key) Create a new dynamic supplier. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag nbt) doubleGet the last cache value in absence of the citizen.doublegetValue(ICitizenData citizenData) Get the matching value.net.minecraft.nbt.CompoundTagserializeNBT(net.minecraft.core.HolderLookup.Provider provider)
-
Constructor Details
-
DynamicHappinessSupplier
public DynamicHappinessSupplier(net.minecraft.resources.ResourceLocation key) Create a new dynamic supplier.- Parameters:
key- the key of the function.
-
DynamicHappinessSupplier
public DynamicHappinessSupplier()Default constructor for deserialization.
-
-
Method Details
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider) - Specified by:
serializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
deserializeNBT
public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag nbt) - Specified by:
deserializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
getValue
Description copied from interface:IHappinessSupplierWrapperGet the matching value.- Specified by:
getValuein interfaceIHappinessSupplierWrapper- Parameters:
citizenData- the context.- Returns:
- the value.
-
getLastCachedValue
public double getLastCachedValue()Description copied from interface:IHappinessSupplierWrapperGet the last cache value in absence of the citizen.- Specified by:
getLastCachedValuein interfaceIHappinessSupplierWrapper- Returns:
- the last cached value.
-