Class SettingsModule
java.lang.Object
com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
com.minecolonies.core.colony.buildings.modules.SettingsModule
- All Implemented Interfaces:
IBuildingModule,ICommonSettingsModule,IPersistentModule,ISettingsModule,IHasDirty
public class SettingsModule
extends AbstractBuildingModule
implements IPersistentModule, ISettingsModule
Module containing all settings.
-
Field Summary
Fields inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
building, isDirty -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Deserialize the module.getOptionalSetting(ISettingKey<T> key) Get a specific setting.<T extends ISetting<?>>
TgetSetting(ISettingKey<T> key) Get a specific setting.<S,T extends ISetting<S>>
SgetSettingValueOrDefault(ISettingKey<T> key, S def) Get setting value or default.voidserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Serialize the module from a compound.voidserializeToView(net.minecraft.network.RegistryFriendlyByteBuf buf) Serialization method to send the module data to the client side.voidupdateSetting(ISettingKey<?> settingKey, ISetting<?> value, net.minecraft.server.level.ServerPlayer sender) Update a given settings value.with(ISettingKey<?> key, ISetting<?> setting) Register a new setting.Methods inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
checkDirty, clearDirty, getBuilding, getProducer, markDirty, setBuilding, setProducerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.buildings.modules.IBuildingModule
getBuilding, getProducer, serializeToView, setBuilding, setProducerMethods inherited from interface com.minecolonies.api.colony.buildings.modules.ICommonSettingsModule
triggerMethods inherited from interface com.minecolonies.api.util.IHasDirty
checkDirty, clearDirty, markDirty
-
Constructor Details
-
SettingsModule
public SettingsModule()
-
-
Method Details
-
getSetting
Description copied from interface:ICommonSettingsModuleGet a specific setting.- Specified by:
getSettingin interfaceICommonSettingsModule- Type Parameters:
T- the type of setting.- Parameters:
key- the key of the setting.- Returns:
- the setting.
-
getOptionalSetting
Description copied from interface:ISettingsModuleGet a specific setting.- Specified by:
getOptionalSettingin interfaceISettingsModule- Type Parameters:
T- the type of setting.- Parameters:
key- the key of the setting.- Returns:
- the setting, if it exists and is active.
-
with
Description copied from interface:ISettingsModuleRegister a new setting.- Specified by:
within interfaceISettingsModule- Parameters:
key- the key of the setting.setting- the setting.- Returns:
- the instance of the module.
-
deserializeNBT
public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Description copied from interface:IPersistentModuleDeserialize the module.- Specified by:
deserializeNBTin interfaceIPersistentModule- Parameters:
compound- the nbt compound.
-
serializeNBT
public void serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Description copied from interface:IPersistentModuleSerialize the module from a compound.- Specified by:
serializeNBTin interfaceIPersistentModule- Parameters:
compound- the compound.
-
serializeToView
public void serializeToView(net.minecraft.network.RegistryFriendlyByteBuf buf) Description copied from interface:IBuildingModuleSerialization method to send the module data to the client side.- Specified by:
serializeToViewin interfaceIBuildingModule- Parameters:
buf- the buffer to write it to.
-
updateSetting
public void updateSetting(ISettingKey<?> settingKey, ISetting<?> value, net.minecraft.server.level.ServerPlayer sender) Description copied from interface:ICommonSettingsModuleUpdate a given settings value.- Specified by:
updateSettingin interfaceICommonSettingsModule- Parameters:
settingKey- the given key.value- the value.sender- the player that updated the setting.
-
getSettingValueOrDefault
Description copied from interface:ISettingsModuleGet setting value or default.- Specified by:
getSettingValueOrDefaultin interfaceISettingsModule- Type Parameters:
S- the setting value type.T- the type of setting.- Parameters:
key- the key of the setting.def- the default.- Returns:
- the setting value or the default.
-