use of com.minecolonies.coremod.colony.buildings.modules.settings.SettingKey in project minecolonies by Minecolonies.
the class SettingsModule method deserializeNBT.
@Override
public void deserializeNBT(final CompoundNBT compound) {
final CompoundNBT settingsCompound = compound.getCompound("settings");
final ListNBT list = settingsCompound.getList("settingslist", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < list.size(); i++) {
final CompoundNBT entryCompound = list.getCompound(i);
final ResourceLocation key = new ResourceLocation(entryCompound.getString("key"));
try {
final ISetting setting = StandardFactoryController.getInstance().deserialize(entryCompound.getCompound("value"));
final ISettingKey<?> settingsKey = new SettingKey<>(setting.getClass(), key);
if (settings.containsKey(settingsKey)) {
settings.put(settingsKey, setting);
}
} catch (final IllegalArgumentException ex) {
Log.getLogger().warn("Detected Removed Setting");
}
}
}
use of com.minecolonies.coremod.colony.buildings.modules.settings.SettingKey in project minecolonies by ldtteam.
the class SettingsModule method deserializeNBT.
@Override
public void deserializeNBT(final CompoundNBT compound) {
final CompoundNBT settingsCompound = compound.getCompound("settings");
final ListNBT list = settingsCompound.getList("settingslist", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < list.size(); i++) {
final CompoundNBT entryCompound = list.getCompound(i);
final ResourceLocation key = new ResourceLocation(entryCompound.getString("key"));
try {
final ISetting setting = StandardFactoryController.getInstance().deserialize(entryCompound.getCompound("value"));
final ISettingKey<?> settingsKey = new SettingKey<>(setting.getClass(), key);
if (settings.containsKey(settingsKey)) {
settings.put(settingsKey, setting);
}
} catch (final IllegalArgumentException ex) {
Log.getLogger().warn("Detected Removed Setting");
}
}
}
Aggregations