use of icyllis.modernui.test.discard.IModule in project ModernUI by BloCamLimb.
the class SettingGeneral method addGameCategory.
private void addGameCategory(List<SettingCategoryGroup> groups) {
List<SettingEntry> list = new ArrayList<>();
List<String> difficulties = Lists.newArrayList(Difficulty.values()).stream().map(d -> d.getDisplayName().getString()).collect(Collectors.toCollection(ArrayList::new));
if (minecraft.world != null) {
difficultyEntry = new DropdownSettingEntry(window, I18n.format("options.difficulty"), difficulties, minecraft.world.getDifficulty().getId(), i -> {
Difficulty difficulty = Difficulty.values()[i];
Objects.requireNonNull(minecraft.getConnection()).sendPacket(new CSetDifficultyPacket(difficulty));
});
list.add(difficultyEntry);
if (minecraft.isSingleplayer() && !minecraft.world.getWorldInfo().isHardcore()) {
boolean locked = minecraft.world.getWorldInfo().isDifficultyLocked();
lockEntry = new BooleanSettingEntry(window, I18n.format("difficulty.lock.title"), locked, yes -> {
if (yes) {
IModule popup = new PopupConfirm(this::lockDifficulty, 3).setConfirmTitle(I18n.format("gui.modernui.button.Lock")).setDescription(I18n.format("gui.modernui.popup.lockDifficulty"));
UIManager.getInstance().openPopup(popup, true);
}
}, true);
difficultyEntry.setAvailable(!locked);
lockEntry.setAvailable(!locked);
list.add(lockEntry);
} else {
difficultyEntry.setAvailable(false);
}
}
list.add(SettingsManager.REALMS_NOTIFICATIONS.apply(window));
SettingCategoryGroup categoryGroup = new SettingCategoryGroup(window, I18n.format("gui.modernui.settings.category.game"), list);
groups.add(categoryGroup);
}
use of icyllis.modernui.test.discard.IModule in project ModernUI by BloCamLimb.
the class IngameMenuHome method exitToTitle.
private void exitToTitle() {
playSound(Registration.BUTTON_CLICK_2);
IModule popup = new PopupConfirm(this::confirmExit).setConfirmTitle(I18n.format("gui.modernui.button.exit")).setDescription(I18n.format("gui.modernui.popup.exit"));
UIManager.getInstance().openPopup(popup, true);
}
Aggregations