use of net.coderbot.iris.shaderpack.ShaderPack in project Iris by IrisShaders.
the class ShaderPackScreen method init.
@Override
protected void init() {
super.init();
int bottomCenter = this.width / 2 - 50;
int topCenter = this.width / 2 - 76;
boolean inWorld = this.minecraft.level != null;
this.children.remove(this.shaderPackList);
this.children.remove(this.shaderOptionList);
this.shaderPackList = new ShaderPackSelectionList(this.minecraft, this.width, this.height, 32, this.height - 58, 0, this.width);
if (Iris.getCurrentPack().isPresent() && this.navigation != null) {
ShaderPack currentPack = Iris.getCurrentPack().get();
this.shaderOptionList = new ShaderPackOptionList(this, this.navigation, currentPack, this.minecraft, this.width, this.height, 32, this.height - 58, 0, this.width);
this.navigation.setActiveOptionList(this.shaderOptionList);
this.shaderOptionList.rebuild();
} else {
optionMenuOpen = false;
this.shaderOptionList = null;
}
if (inWorld) {
this.shaderPackList.setRenderBackground(false);
if (shaderOptionList != null) {
this.shaderOptionList.setRenderBackground(false);
}
}
if (optionMenuOpen && shaderOptionList != null) {
this.children.add(shaderOptionList);
} else {
this.children.add(shaderPackList);
}
this.buttons.clear();
this.addButton(new Button(bottomCenter + 104, this.height - 27, 100, 20, CommonComponents.GUI_DONE, button -> onClose()));
this.addButton(new Button(bottomCenter, this.height - 27, 100, 20, new TranslatableComponent("options.iris.apply"), button -> this.applyChanges()));
this.addButton(new Button(bottomCenter - 104, this.height - 27, 100, 20, CommonComponents.GUI_CANCEL, button -> this.dropChangesAndClose()));
this.addButton(new Button(topCenter - 78, this.height - 51, 152, 20, new TranslatableComponent("options.iris.openShaderPackFolder"), button -> openShaderPackFolder()));
this.screenSwitchButton = this.addButton(new Button(topCenter + 78, this.height - 51, 152, 20, new TranslatableComponent("options.iris.shaderPackList"), button -> {
this.optionMenuOpen = !this.optionMenuOpen;
this.init();
}));
refreshScreenSwitchButton();
}
use of net.coderbot.iris.shaderpack.ShaderPack in project Iris by IrisShaders.
the class ShaderPackScreen method refreshForChangedPack.
public void refreshForChangedPack() {
if (Iris.getCurrentPack().isPresent()) {
ShaderPack currentPack = Iris.getCurrentPack().get();
this.navigation = new NavigationController(currentPack.getMenuContainer());
if (this.shaderOptionList != null) {
this.shaderOptionList.applyShaderPack(currentPack);
this.shaderOptionList.rebuild();
}
} else {
this.navigation = null;
}
refreshScreenSwitchButton();
}
use of net.coderbot.iris.shaderpack.ShaderPack in project Iris by IrisShaders.
the class MixinClientLanguage method iris$lookupOverriddenEntry.
@Unique
private String iris$lookupOverriddenEntry(String key) {
ShaderPack pack = Iris.getCurrentPack().orElse(null);
if (pack == null) {
// This prevents a cryptic NullPointerException when shaderpack loading fails for some reason.
return null;
}
// Minecraft loads the "en_us" language code by default, and any other code will be right after it.
//
// So we also check if the user is loading a special language, and if the shaderpack has support for that
// language. If they do, we load that, but if they do not, we load "en_us" instead.
LanguageMap languageMap = pack.getLanguageMap();
if (storage.containsKey(key)) {
// TODO: Should we allow shader packs to override existing MC translations?
return null;
}
for (String code : languageCodes) {
Map<String, String> translations = languageMap.getTranslations(code);
if (translations != null) {
String translation = translations.get(key);
if (translation != null) {
return translation;
}
}
}
return null;
}
Aggregations