Skip to content

Commit a22f02e

Browse files
Working 1.17
1 parent 844ba39 commit a22f02e

File tree

15 files changed

+139
-123
lines changed

15 files changed

+139
-123
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ jobs:
1212
matrix:
1313
# Use these Java versions
1414
java: [
15-
1.8, # Minimum supported by Minecraft
16-
11, # Current Java LTS
17-
15 # Latest version
15+
16 # Minimum supported by Minecraft
1816
]
1917
# and run on both Linux and Windows
2018
os: [ubuntu-20.04, windows-latest]
@@ -34,7 +32,7 @@ jobs:
3432
- name: build
3533
run: ./gradlew build
3634
- name: capture build artifacts
37-
if: ${{ runner.os == 'Linux' && matrix.java == '11' }} # Only upload artifacts built from LTS java on one OS
35+
if: ${{ runner.os == 'Linux' && matrix.java == '16' }} # Only upload artifacts built from latest java on one OS
3836
uses: actions/upload-artifact@v2
3937
with:
4038
name: Artifacts

build.gradle

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
plugins {
2-
id 'fabric-loom' version '0.5-SNAPSHOT'
2+
id 'fabric-loom' version '0.8-SNAPSHOT'
33
id 'maven-publish'
44
}
55

6-
sourceCompatibility = JavaVersion.VERSION_1_8
7-
targetCompatibility = JavaVersion.VERSION_1_8
6+
sourceCompatibility = JavaVersion.VERSION_16
7+
targetCompatibility = JavaVersion.VERSION_16
88

99
archivesBaseName = project.archives_base_name
1010
version = project.mod_version
@@ -23,49 +23,49 @@ repositories {
2323
dependencies {
2424
minecraft "com.mojang:minecraft:${project.minecraft_version}"
2525
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
26-
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
26+
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
2727

2828
// Fabric API. This is technically optional, but you probably want it anyway.
29-
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
29+
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
3030

3131
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
3232
// You may need to force-disable transitivity on them.
3333
//modCompile "com.jamieswhiteshirt:developer-mode:${project.developer_mode_version}"
34-
modCompile "com.terraformersmc:modmenu:${project.mod_menu_version}"
34+
modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}"
3535

36-
modRuntime "com.github.ultimateboomer:mc-smoothboot:1.16.5-1.6.0"
36+
modRuntime "com.github.ultimateboomer:mc-smoothboot:${project.smoothboot_version}"
3737
}
3838

3939
processResources {
4040
inputs.property "version", project.version
4141

42-
from(sourceSets.main.resources.srcDirs) {
43-
include "fabric.mod.json"
42+
filesMatching("fabric.mod.json") {
4443
expand "version": project.version
4544
}
46-
47-
from(sourceSets.main.resources.srcDirs) {
48-
exclude "fabric.mod.json"
49-
}
5045
}
5146

52-
// ensure that the encoding is set to UTF-8, no matter what the system default is
53-
// this fixes some edge cases with special characters not displaying correctly
54-
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
55-
tasks.withType(JavaCompile) {
56-
options.encoding = "UTF-8"
47+
tasks.withType(JavaCompile).configureEach {
48+
// ensure that the encoding is set to UTF-8, no matter what the system default is
49+
// this fixes some edge cases with special characters not displaying correctly
50+
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
51+
// If Javadoc is generated, this must be specified in that task too.
52+
it.options.encoding = "UTF-8"
53+
54+
// Minecraft 1.17 (21w19a) upwards uses Java 16.
55+
it.options.release = 16
5756
}
5857

59-
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
60-
// if it is present.
61-
// If you remove this task, sources will not be generated.
62-
task sourcesJar(type: Jar, dependsOn: classes) {
63-
classifier = "sources"
64-
from sourceSets.main.allSource
58+
java {
59+
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
60+
// if it is present.
61+
// If you remove this line, sources will not be generated.
62+
withSourcesJar()
6563
}
6664

6765
jar {
68-
from "LICENSE"
66+
from("LICENSE") {
67+
rename { "${it}_${project.archivesBaseName}"}
68+
}
6969
}
7070

7171
// configure the maven publication
@@ -82,9 +82,11 @@ publishing {
8282
}
8383
}
8484

85-
// select the repositories you want to publish to
85+
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
8686
repositories {
87-
// uncomment to publish to the local maven
88-
// mavenLocal()
87+
// Add repositories to publish to here.
88+
// Notice: This block does NOT have the same function as the block in the top level.
89+
// The repositories here will be used for publishing your artifact, not for
90+
// retrieving dependencies.
8991
}
90-
}
92+
}

gradle.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/use
6-
minecraft_version=1.16.5
7-
yarn_mappings=1.16.5+build.9
6+
minecraft_version=1.17
7+
yarn_mappings=1.17+build.12
88
loader_version=0.11.3
99

1010
# Mod Properties
@@ -15,7 +15,7 @@ archives_base_name=resolution-control-plus
1515

1616
# Dependencies
1717
# https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api/
18-
fabric_version=0.34.6+1.16
19-
20-
developer_mode_version=1.0.15
21-
mod_menu_version=1.16.9
18+
fabric_version=0.35.2+1.17
19+
#developer_mode_version=1.0.15
20+
mod_menu_version=2.0.2
21+
smoothboot_version=1.16.5-1.6.0

gradle/wrapper/gradle-wrapper.jar

2.96 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 33 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 24 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
pluginManagement {
22
repositories {
3-
jcenter()
43
maven {
54
name = 'Fabric'
65
url = 'https://maven.fabricmc.net/'

src/main/java/io/github/ultimateboomer/resolutioncontrol/ResolutionControlMod.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
import net.fabricmc.loader.api.FabricLoader;
1111
import net.minecraft.client.MinecraftClient;
1212
import net.minecraft.client.gl.Framebuffer;
13-
import net.minecraft.client.options.KeyBinding;
13+
import net.minecraft.client.gl.WindowFramebuffer;
14+
import net.minecraft.client.option.KeyBinding;
1415
import net.minecraft.client.util.InputUtil;
15-
import net.minecraft.client.util.ScreenshotUtils;
16+
import net.minecraft.client.util.ScreenshotRecorder;
1617
import net.minecraft.client.util.Window;
1718
import net.minecraft.text.TranslatableText;
1819
import net.minecraft.util.Identifier;
@@ -126,7 +127,7 @@ && getWindow().getX() != -32000) {
126127
}
127128

128129
private void saveScreenshot(Framebuffer fb) {
129-
ScreenshotUtils.saveScreenshot(client.runDirectory,
130+
ScreenshotRecorder.saveScreenshot(client.runDirectory,
130131
RCUtil.getScreenshotFilename(client.runDirectory).toString(),
131132
fb.textureWidth, fb.textureHeight, fb,
132133
text -> client.player.sendMessage(text, false));
@@ -135,16 +136,14 @@ private void saveScreenshot(Framebuffer fb) {
135136
public void setShouldScale(boolean shouldScale) {
136137
if (shouldScale == this.shouldScale) return;
137138

138-
if (getScaleFactor() == 1) return;
139+
// if (getScaleFactor() == 1) return;
139140

140141
Window window = getWindow();
141142
if (framebuffer == null) {
142143
this.shouldScale = true; // so we get the right dimensions
143-
framebuffer = new Framebuffer(
144+
framebuffer = new WindowFramebuffer(
144145
window.getFramebufferWidth(),
145-
window.getFramebufferHeight(),
146-
true,
147-
MinecraftClient.IS_SYSTEM_MAC
146+
window.getFramebufferHeight()
148147
);
149148
calculateSize();
150149
}
@@ -226,9 +225,9 @@ public Framebuffer getFramebuffer() {
226225
public void initScreenshotFramebuffer() {
227226
if (Objects.nonNull(screenshotFrameBuffer)) screenshotFrameBuffer.delete();
228227

229-
screenshotFrameBuffer = new Framebuffer(
230-
getScreenshotWidth(), getScreenshotHeight(),
231-
true, MinecraftClient.IS_SYSTEM_MAC);
228+
screenshotFrameBuffer = new WindowFramebuffer(
229+
getScreenshotWidth(), getScreenshotHeight()
230+
);
232231
}
233232

234233
public float getScaleFactor() {

0 commit comments

Comments
 (0)