Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.17
yarn_mappings=1.17+build.12
loader_version=0.11.3
minecraft_version=1.17.1
yarn_mappings=1.17.1+build.61
loader_version=0.11.7

# Mod Properties
mod_name=resolutioncontrol
Expand All @@ -15,7 +15,7 @@ archives_base_name=resolution-control-plus

# Dependencies
# https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api/
fabric_version=0.35.2+1.17
fabric_version=0.40.1+1.17
#developer_mode_version=1.0.15
mod_menu_version=2.0.2
smoothboot_version=1.16.5-1.6.0
smoothboot_version=1.16.5-1.6.0
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void onInitialize() {

ClientTickEvents.END_CLIENT_TICK.register(client -> {
while (settingsKey.wasPressed()) {
client.openScreen(SettingsScreen.getScreen(lastSettingsScreen));
client.setScreen(SettingsScreen.getScreen(lastSettingsScreen));
}
});

Expand Down Expand Up @@ -128,8 +128,7 @@ && getWindow().getX() != -32000) {

private void saveScreenshot(Framebuffer fb) {
ScreenshotRecorder.saveScreenshot(client.runDirectory,
RCUtil.getScreenshotFilename(client.runDirectory).toString(),
fb.textureWidth, fb.textureHeight, fb,
RCUtil.getScreenshotFilename(client.runDirectory), fb,
text -> client.player.sendMessage(text, false));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected void init() {
startX - menuButtonWidth - 20, startY + o.getValue(),
menuButtonWidth, menuButtonHeight,
r.getTitle(),
button -> client.openScreen(constructor.apply(this.parent))
button -> client.setScreen(constructor.apply(this.parent))
);

if (this.getClass().equals(c))
Expand All @@ -94,7 +94,7 @@ protected void init() {
new TranslatableText("gui.done"),
button -> {
applySettingsAndCleanup();
client.openScreen(this.parent);
client.setScreen(this.parent);
}
);
this.addDrawableChild(doneButton);
Expand Down Expand Up @@ -132,7 +132,7 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if ((ResolutionControlMod.getInstance().getSettingsKey().matchesKey(keyCode, scanCode))) {
this.applySettingsAndCleanup();
this.client.openScreen(this.parent);
this.client.setScreen(this.parent);
this.client.mouse.lockCursor();
return true;
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.ultimateboomer.resolutioncontrol.util;

import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
Expand Down Expand Up @@ -29,20 +28,19 @@ public static String formatMetric(long n) {
return String.format("%s %s", FORMAT.format(result), UNITS[log10 / 3 - 1]);
}

public static File getScreenshotFilename(File directory) {
public static String getScreenshotFilename(File directory) {
String string = DATE_FORMAT.format(new Date());
int i = 1;

while (true) {
File file = new File(new File(""), "fb" + string + (i == 1 ? "" : "_" + i) + ".png");
File entireDirectory = new File(new File(directory, "screenshots"), file.toString());
if (!entireDirectory.exists()) {
try {
entireDirectory.createNewFile();
} catch (IOException e) {
throw new IllegalStateException(e);
}
return file;
File screenshotDir = new File(directory, "screenshots");
screenshotDir.mkdir();

String fileName = "fb" + string + (i == 1 ? "" : "_" + i) + ".png";
File imagePath = new File(screenshotDir, fileName);

if (!imagePath.exists()) {
return fileName;
}

++i;
Expand Down