Skip to content

Commit 7277e37

Browse files
committed
Updated to 1.17
Fixed incorrect issues URL.
1 parent dc6daa8 commit 7277e37

7 files changed

Lines changed: 71 additions & 62 deletions

File tree

build.gradle

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
plugins {
2-
id 'fabric-loom' version '0.6-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 + "+mc" + project.minecraft_version
@@ -16,7 +16,8 @@ minecraft {
1616
dependencies {
1717
repositories {
1818
maven {
19-
url = "https://maven.fabricmc.net/io/github/prospector/modmenu/"
19+
name = 'Terraformers'
20+
url = 'https://maven.terraformersmc.com/releases/'
2021
}
2122
}
2223

@@ -25,27 +26,25 @@ dependencies {
2526
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
2627
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
2728

28-
modCompileOnly "io.github.prospector:modmenu:${project.modmenu_version}"
29+
modImplementation("com.terraformersmc:modmenu:${project.modmenu_version}") {
30+
transitive = false
31+
}
2932
}
3033

3134
processResources {
3235
inputs.property "version", project.version
3336

34-
from(sourceSets.main.resources.srcDirs) {
35-
include "fabric.mod.json"
37+
filesMatching("fabric.mod.json") {
3638
expand "version": project.version
3739
}
38-
39-
from(sourceSets.main.resources.srcDirs) {
40-
exclude "fabric.mod.json"
41-
}
4240
}
4341

4442
// ensure that the encoding is set to UTF-8, no matter what the system default is
4543
// this fixes some edge cases with special characters not displaying correctly
4644
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
47-
tasks.withType(JavaCompile) {
48-
options.encoding = "UTF-8"
45+
tasks.withType(JavaCompile).configureEach {
46+
it.options.encoding = "UTF-8"
47+
it.options.release = 16
4948
}
5049

5150
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task

gradle.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
org.gradle.jvmargs = -Xmx1G
22

33
#Fabric properties
4-
minecraft_version = 1.16.5
5-
yarn_mappings = 1.16.5+build.4
6-
loader_version = 0.11.1
4+
minecraft_version = 1.17
5+
yarn_mappings = 1.17+build.5
6+
loader_version = 0.11.3
77

88
#Mod properties
9-
mod_version = 1.0.0
9+
mod_version = 1.0.1
1010
maven_group = com.turtlearmymc.panoramatweaker
1111
archives_base_name = panorama_tweaker
1212

1313
#Dependencies
14-
modmenu_version = 1.14.9+build.14
14+
modmenu_version = 2.0.0-beta.7
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-6.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

src/main/java/com/turtlearmymc/panoramatweaker/ConfigScreen.java

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
import net.fabricmc.api.EnvType;
88
import net.fabricmc.api.Environment;
99
import net.minecraft.client.font.TextRenderer;
10-
import net.minecraft.client.gui.AbstractParentElement;
1110
import net.minecraft.client.gui.Drawable;
1211
import net.minecraft.client.gui.Element;
1312
import net.minecraft.client.gui.RotatingCubeMapRenderer;
1413
import net.minecraft.client.gui.screen.Screen;
1514
import net.minecraft.client.gui.screen.TitleScreen;
16-
import net.minecraft.client.gui.widget.AbstractButtonWidget;
1715
import net.minecraft.client.gui.widget.ButtonWidget;
16+
import net.minecraft.client.gui.widget.ClickableWidget;
1817
import net.minecraft.client.gui.widget.SliderWidget;
1918
import net.minecraft.client.gui.widget.TextFieldWidget;
2019
import net.minecraft.client.util.math.MatrixStack;
@@ -40,12 +39,12 @@ protected ConfigScreen(Screen parent) {
4039
protected void init() {
4140
final int y_padding = 28;
4241

43-
this.addButton(new ButtonWidget(this.width / 2 - 154, this.height - y_padding, 150, 20,
42+
this.addDrawableChild(new ButtonWidget(this.width / 2 - 154, this.height - y_padding, 150, 20,
4443
new TranslatableText("gui.cancel"), (button) -> {
4544
this.restoreConfig();
4645
client.openScreen(parent);
4746
}));
48-
this.addButton(new ButtonWidget(this.width / 2 + 4, this.height - y_padding, 150, 20,
47+
this.addDrawableChild(new ButtonWidget(this.width / 2 + 4, this.height - y_padding, 150, 20,
4948
new TranslatableText("gui.done"), (button) -> {
5049
this.saveConfig();
5150
client.openScreen(parent);
@@ -57,44 +56,57 @@ protected void init() {
5756
int x = (this.width / 2) - 154;
5857
int y = ((this.height - widgetPadding) * 0) / widgetCount + y_padding;
5958

60-
this.children
61-
.addAll((new OptionWidget(this.textRenderer, new TranslatableText("panorama_tweaker.rotationSpeed"), x,
62-
y, 308, 20, Config.DEFAULT_ROTATION_SPEED, PanoramaTweaker.config.rotationSpeed, -10, 10,
63-
val -> PanoramaTweaker.config.rotationSpeed = val)).children());
59+
for (ClickableWidget child : (new OptionWidget(this.textRenderer,
60+
new TranslatableText("panorama_tweaker.rotationSpeed"), x, y, 308, 20, Config.DEFAULT_ROTATION_SPEED,
61+
PanoramaTweaker.config.rotationSpeed, -10, 10, val -> PanoramaTweaker.config.rotationSpeed = val))
62+
.children()) {
63+
this.addDrawableChild(child);
64+
}
6465

6566
y = ((this.height - widgetPadding) * 1) / widgetCount + y_padding;
66-
this.children.addAll((new OptionWidget(this.textRenderer,
67+
for (ClickableWidget child : ((new OptionWidget(this.textRenderer,
6768
new TranslatableText("panorama_tweaker.startingHorizontalAngle"), x, y, 308, 20,
6869
Config.DEFAULT_STARTING_HORIZONTAL_ANGLE, PanoramaTweaker.config.startingHorizontalAngle, -180, 180,
69-
val -> PanoramaTweaker.config.startingHorizontalAngle = val)).children());
70+
val -> PanoramaTweaker.config.startingHorizontalAngle = val)).children())) {
71+
this.addDrawableChild(child);
72+
}
7073

7174
y = ((this.height - widgetPadding) * 2) / widgetCount + y_padding;
72-
this.children
73-
.addAll((new OptionWidget(this.textRenderer, new TranslatableText("panorama_tweaker.verticalAngle"), x,
74-
y, 308, 20, Config.DEFAULT_VERTICAL_ANGLE, PanoramaTweaker.config.verticalAngle, -90, 90,
75-
val -> PanoramaTweaker.config.verticalAngle = val)).children());
75+
for (ClickableWidget child : ((new OptionWidget(this.textRenderer,
76+
new TranslatableText("panorama_tweaker.verticalAngle"), x, y, 308, 20, Config.DEFAULT_VERTICAL_ANGLE,
77+
PanoramaTweaker.config.verticalAngle, -90, 90, val -> PanoramaTweaker.config.verticalAngle = val))
78+
.children())) {
79+
this.addDrawableChild(child);
80+
}
7681

7782
y = ((this.height - widgetPadding) * 3) / widgetCount + y_padding;
78-
this.children.addAll((new OptionWidget(this.textRenderer, new TranslatableText("panorama_tweaker.swayAngle"), x,
79-
y, 308, 20, Config.DEFAULT_SWAY_ANGLE, PanoramaTweaker.config.swayAngle, -90, 90,
80-
val -> PanoramaTweaker.config.swayAngle = val)).children());
83+
for (ClickableWidget child : ((new OptionWidget(this.textRenderer,
84+
new TranslatableText("panorama_tweaker.swayAngle"), x, y, 308, 20, Config.DEFAULT_SWAY_ANGLE,
85+
PanoramaTweaker.config.swayAngle, -90, 90, val -> PanoramaTweaker.config.swayAngle = val))
86+
.children())) {
87+
this.addDrawableChild(child);
88+
}
8189

8290
y = ((this.height - widgetPadding) * 4) / widgetCount + y_padding;
83-
this.children.addAll((new OptionWidget(this.textRenderer, new TranslatableText("panorama_tweaker.swaySpeed"), x,
84-
y, 308, 20, Config.DEFAULT_SWAY_SPEED, PanoramaTweaker.config.swaySpeed, 0, 10,
85-
val -> PanoramaTweaker.config.swaySpeed = val)).children());
91+
for (ClickableWidget child : ((new OptionWidget(this.textRenderer,
92+
new TranslatableText("panorama_tweaker.swaySpeed"), x, y, 308, 20, Config.DEFAULT_SWAY_SPEED,
93+
PanoramaTweaker.config.swaySpeed, 0, 10, val -> PanoramaTweaker.config.swaySpeed = val)).children())) {
94+
this.addDrawableChild(child);
95+
}
8696

8797
y = ((this.height - widgetPadding) * 5) / widgetCount + y_padding;
88-
this.children.addAll(
89-
(new OptionWidget(this.textRenderer, new TranslatableText("panorama_tweaker.initialSwayProgress"), x, y,
90-
308, 20, Config.DEFAULT_INITIAL_SWAY_PROGRESS, PanoramaTweaker.config.initialSwayProgress, -1,
91-
1, val -> PanoramaTweaker.config.initialSwayProgress = val)).children());
98+
for (ClickableWidget child : ((new OptionWidget(this.textRenderer,
99+
new TranslatableText("panorama_tweaker.initialSwayProgress"), x, y, 308, 20,
100+
Config.DEFAULT_INITIAL_SWAY_PROGRESS, PanoramaTweaker.config.initialSwayProgress, -1, 1,
101+
val -> PanoramaTweaker.config.initialSwayProgress = val)).children())) {
102+
this.addDrawableChild(child);
103+
}
92104
}
93105

94106
@Override
95107
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
96108
this.backgroundRenderer.render(delta, MathHelper.clamp(1, 0.0F, 1.0F));
97-
for (Element child : this.children) {
109+
for (Element child : this.children()) {
98110
if (child instanceof Drawable) {
99111
((Drawable) child).render(matrices, mouseX, mouseY, delta);
100112
}
@@ -103,10 +115,10 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
103115

104116
@Override
105117
public boolean mouseClicked(double mouseX, double mouseY, int button) {
106-
for (Element child : this.children) {
107-
if (child instanceof AbstractButtonWidget) {
108-
if (((AbstractButtonWidget) child).isFocused()) {
109-
((AbstractButtonWidget) child).changeFocus(false);
118+
for (Element child : this.children()) {
119+
if (child instanceof ClickableWidget) {
120+
if (((ClickableWidget) child).isFocused()) {
121+
((ClickableWidget) child).changeFocus(false);
110122
}
111123
}
112124
}
@@ -121,10 +133,10 @@ protected void saveConfig() {
121133
PanoramaTweaker.config.save();
122134
}
123135

124-
protected class OptionWidget extends AbstractParentElement {
136+
protected class OptionWidget {
125137
private final double defaultVal;
126138

127-
private final List<AbstractButtonWidget> children;
139+
private final List<ClickableWidget> children;
128140
private final OptionSlider slider;
129141
private final TextFieldWidget textField;
130142
private final ButtonWidget resetButton;
@@ -158,12 +170,11 @@ public OptionWidget(TextRenderer font, TranslatableText text, int x, int y, int
158170
this.textField.setUneditableColor(0xFF0000);
159171
}
160172
});
161-
this.setFocused(this.textField);
162173
this.resetButton = new ButtonWidget(x + width - 50, y, 50, height, new TranslatableText("controls.reset"),
163174
(buttonWidget) -> {
164175
this.resetToDefault();
165176
});
166-
this.children = new ArrayList<AbstractButtonWidget>();
177+
this.children = new ArrayList<ClickableWidget>();
167178
this.children.add(this.slider);
168179
this.children.add(this.textField);
169180
this.children.add(this.resetButton);
@@ -193,8 +204,7 @@ protected boolean isDefault() {
193204
return this.value == this.defaultVal;
194205
}
195206

196-
@Override
197-
public List<? extends Element> children() {
207+
public List<ClickableWidget> children() {
198208
return this.children;
199209
}
200210

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
package com.turtlearmymc.panoramatweaker;
22

3-
import java.util.function.Function;
4-
5-
import io.github.prospector.modmenu.api.ModMenuApi;
6-
import net.minecraft.client.gui.screen.Screen;
3+
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
4+
import com.terraformersmc.modmenu.api.ModMenuApi;
75

86
public class ModMenuApiImpl implements ModMenuApi {
9-
@Override
10-
public Function<Screen, ? extends Screen> getConfigScreenFactory() {
7+
public ConfigScreenFactory<?> getModConfigScreenFactory() {
118
return ConfigScreen::new;
129
}
1310
}

src/main/resources/fabric.mod.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"contact": {
1212
"homepage": "https://www.curseforge.com/minecraft/mc-mods/panorama-tweaker",
1313
"sources": "https://github.com/TurtleArmyMc/Panorama-Tweaker",
14-
"issues": "https://github.com/shedaniel/Panorama-Tweaker/issues"
14+
"issues": "https://github.com/TurtleArmyMc/Panorama-Tweaker/issues"
1515
},
1616
"license": "LGPL-3.0",
1717
"icon": "assets/panorama_tweaker/icon.png",
@@ -30,6 +30,9 @@
3030
"depends": {
3131
"fabricloader": ">=0.11.1"
3232
},
33+
"recommends": {
34+
"modmenu": ">=2.0.0-beta7"
35+
},
3336
"custom": {
3437
"modmenu:clientsideOnly": true
3538
}

src/main/resources/panorama_tweaker.mixins.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"required": true,
33
"package": "com.turtlearmymc.panoramatweaker.mixin",
4-
"compatibilityLevel": "JAVA_8",
4+
"compatibilityLevel": "JAVA_16",
55
"mixins": [],
66
"client": [
77
"RotatingCubeMapRendererMixin"

0 commit comments

Comments
 (0)