use of com.minecolonies.api.colony.buildings.modules.settings.ISetting in project minecolonies by ldtteam.
the class SettingsModule method serializeNBT.
@Override
public void serializeNBT(final CompoundNBT compound) {
final CompoundNBT settingsCompound = new CompoundNBT();
final ListNBT list = new ListNBT();
for (final Map.Entry<ISettingKey<?>, ISetting> setting : settings.entrySet()) {
final CompoundNBT entryCompound = new CompoundNBT();
entryCompound.putString("key", setting.getKey().getUniqueId().toString());
entryCompound.put("value", StandardFactoryController.getInstance().serialize(setting.getValue()));
list.add(entryCompound);
}
settingsCompound.put("settingslist", list);
compound.put("settings", settingsCompound);
}
use of com.minecolonies.api.colony.buildings.modules.settings.ISetting in project minecolonies by ldtteam.
the class SettingsModuleView method trigger.
@Override
public void trigger(final ISettingKey<?> key) {
final ISetting setting = settings.get(key);
setting.trigger();
Network.getNetwork().sendToServer(new TriggerSettingMessage(buildingView, key, setting));
}
use of com.minecolonies.api.colony.buildings.modules.settings.ISetting in project minecolonies by ldtteam.
the class SettingsModuleView method deserialize.
@Override
public void deserialize(@NotNull final PacketBuffer buf) {
settings.clear();
final int size = buf.readInt();
for (int i = 0; i < size; i++) {
final ResourceLocation key = buf.readResourceLocation();
final ISetting setting = StandardFactoryController.getInstance().deserialize(buf);
settings.put(new SettingKey<>(setting.getClass(), key), setting);
}
}
Aggregations