Skip to content

Commit 70de007

Browse files
authored
1.21.4 porting (#802)
* WIP * Better FIXME note. * port to rc.2 * port to rc.3 - Port to 1.21.4
1 parent 63c4a74 commit 70de007

11 files changed

Lines changed: 79 additions & 57 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom' version '1.7-SNAPSHOT'
2+
id 'fabric-loom' version '1.8-SNAPSHOT'
33
}
44

55
apply from: 'https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.7/ferry.gradle'

gradle.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ org.gradle.jvmargs=-Xmx1G
33
maven_group=com.terraformersmc
44
archive_name=modmenu
55

6-
minecraft_version=1.21.3
7-
yarn_mappings=1.21.3+build.2
6+
minecraft_version=1.21.4-rc3
7+
yarn_mappings=1.21.4-rc3+build.3
88
loader_version=0.16.9
9-
fabric_version=0.107.0+1.21.3
10-
text_placeholder_api_version=2.5.0+1.21.2
9+
fabric_version=0.110.3+1.21.4
10+
text_placeholder_api_version=2.5.1+1.21.3
1111
quilt_loader_version=0.26.4
1212

1313
# Project Metadata
@@ -21,14 +21,14 @@ default_release_type=stable
2121
# Modrinth Metadata
2222
modrinth_slug=modmenu
2323
modrinth_id=mOgUt4GM
24-
modrinth_game_versions=1.21.2-pre1, 1.21.2-pre2, 1.21.2-pre3, 1.21.2-pre4, 1.21.2-pre5, 1.21.2-rc1, 1.21.2-rc1, 1.21.2, 1.21.3
24+
modrinth_game_versions=1.21.4-rc3, 1.21.4
2525
modrinth_mod_loaders=fabric, quilt
2626
modrinth_required_dependencies=fabric-api, placeholder-api
2727

2828
# CurseForge Metadata
2929
curseforge_slug=modmenu
3030
curseforge_id=308702
31-
curseforge_game_versions=1.21.2, 1.21.3, Fabric, Quilt
31+
curseforge_game_versions=1.21.4, Fabric, Quilt
3232
curseforge_required_dependencies=fabric-api, text-placeholder-api
3333
curseforge_optional_dependencies=
3434

gradle/wrapper/gradle-wrapper.jar

-16 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

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

gradlew.bat

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

src/main/java/com/terraformersmc/modmenu/gui/ModsScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ private boolean updateFiltersX(boolean onInit) {
576576
}
577577

578578
@Override
579-
public void filesDragged(List<Path> paths) {
579+
public void onFilesDropped(List<Path> paths) {
580580
Path modsDirectory = FabricLoader.getInstance().getGameDir().resolve("mods");
581581

582582
// Filter out none mods

src/main/java/com/terraformersmc/modmenu/gui/widget/DescriptionListWidget.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void renderList(DrawContext DrawContext, int mouseX, int mouseY, float de
9393
if (selectedEntry != lastSelected) {
9494
lastSelected = selectedEntry;
9595
clearEntries();
96-
setScrollAmount(-Double.MAX_VALUE);
96+
setScrollY(-Double.MAX_VALUE);
9797
if (lastSelected != null) {
9898
DescriptionEntry emptyEntry = new DescriptionEntry(OrderedText.EMPTY);
9999
int wrapWidth = getRowWidth() - 5;
@@ -342,11 +342,11 @@ public void renderScrollBar(BufferBuilder bufferBuilder, Tessellator tessellator
342342
BuiltBuffer builtBuffer;
343343
int scrollbarStartX = this.getScrollbarX();
344344
int scrollbarEndX = scrollbarStartX + 6;
345-
int maxScroll = this.getMaxScroll();
345+
int maxScroll = this.getMaxScrollY();
346346
if (maxScroll > 0) {
347-
int p = (int) ((float) ((this.getBottom() - this.getY()) * (this.getBottom() - this.getY())) / (float) this.getMaxPosition());
347+
int p = (int) ((float) ((this.getBottom() - this.getY()) * (this.getBottom() - this.getY())) / (float) this.getContentsHeightWithPadding());
348348
p = MathHelper.clamp(p, 32, this.getBottom() - this.getY() - 8);
349-
int q = (int) this.getScrollAmount() * (this.getBottom() - this.getY() - p) / maxScroll + this.getY();
349+
int q = (int) this.getScrollY() * (this.getBottom() - this.getY() - p) / maxScroll + this.getY();
350350
if (q < this.getY()) {
351351
q = this.getY();
352352
}

src/main/java/com/terraformersmc/modmenu/gui/widget/ModListWidget.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class ModListWidget extends AlwaysSelectedEntryListWidget<ModListEntry> i
3030
private List<Mod> mods = null;
3131
private final Set<Mod> addedMods = new HashSet<>();
3232
private String selectedModId = null;
33-
private boolean scrolling;
33+
//private boolean scrolling;
3434
private final FabricIconHandler iconHandler = new FabricIconHandler();
3535

3636
public ModListWidget(
@@ -50,15 +50,15 @@ public ModListWidget(
5050
}
5151

5252
@Override
53-
public void setScrollAmount(double amount) {
54-
super.setScrollAmount(amount);
55-
int denominator = Math.max(0, this.getMaxPosition() - (this.getBottom() - this.getY() - 4));
53+
public void setScrollY(double amount) {
54+
super.setScrollY(amount);
55+
int denominator = Math.max(0, this.getContentsHeightWithPadding() - (this.getBottom() - this.getY() - 4));
5656
if (denominator <= 0) {
5757
parent.updateScrollPercent(0);
5858
} else {
59-
parent.updateScrollPercent(getScrollAmount() / Math.max(
59+
parent.updateScrollPercent(getScrollY() / Math.max(
6060
0,
61-
this.getMaxPosition() - (this.getBottom() - this.getY() - 4)
61+
this.getContentsHeightWithPadding() - (this.getBottom() - this.getY() - 4)
6262
));
6363
}
6464
}
@@ -202,8 +202,8 @@ private void filter(String searchTerm, boolean refresh, boolean search) {
202202
}
203203
}
204204

205-
if (getScrollAmount() > Math.max(0, this.getMaxPosition() - (this.getBottom() - this.getY() - 4))) {
206-
setScrollAmount(Math.max(0, this.getMaxPosition() - (this.getBottom() - this.getY() - 4)));
205+
if (getScrollY() > Math.max(0, this.getContentsHeightWithPadding() - (this.getBottom() - this.getY() - 4))) {
206+
setScrollY(Math.max(0, this.getContentsHeightWithPadding() - (this.getBottom() - this.getY() - 4)));
207207
}
208208
}
209209

@@ -278,6 +278,8 @@ public void ensureVisible(ModListEntry entry) {
278278
super.ensureVisible(entry);
279279
}
280280

281+
// FIXME --> Was removed from super class (updateScrollingState / mouseClicked)
282+
/*
281283
@Override
282284
protected void updateScrollingState(double double_1, double double_2, int int_1) {
283285
super.updateScrollingState(double_1, double_2, int_1);
@@ -298,14 +300,15 @@ public boolean mouseClicked(double double_1, double double_2, int int_1) {
298300
return true;
299301
}
300302
} else if (int_1 == 0 && this.clickedHeader((int) (double_1 - (double) (this.getX() + this.width / 2 - this.getRowWidth() / 2)),
301-
(int) (double_2 - (double) this.getY()) + (int) this.getScrollAmount() - 4
303+
(int) (double_2 - (double) this.getY()) + (int) this.getScrollY() - 4
302304
)) {
303305
return true;
304306
}
305307
306308
return this.scrolling;
307309
}
308310
}
311+
*/
309312

310313
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
311314
if (keyCode == GLFW.GLFW_KEY_UP || keyCode == GLFW.GLFW_KEY_DOWN) {
@@ -318,7 +321,7 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
318321
}
319322

320323
public final ModListEntry getEntryAtPos(double x, double y) {
321-
int int_5 = MathHelper.floor(y - (double) this.getY()) - this.headerHeight + (int) this.getScrollAmount() - 4;
324+
int int_5 = MathHelper.floor(y - (double) this.getY()) - this.headerHeight + (int) this.getScrollY() - 4;
322325
int index = int_5 / this.itemHeight;
323326
return x < (double) this.getScrollbarX() && x >= (double) getRowLeft() && x <= (double) (getRowLeft() + getRowWidth()) && index >= 0 && int_5 >= 0 && index < this.getEntryCount() ?
324327
this.children().get(index) :
@@ -332,7 +335,7 @@ protected int getScrollbarX() {
332335

333336
@Override
334337
public int getRowWidth() {
335-
return this.width - (Math.max(0, this.getMaxPosition() - (this.getBottom() - this.getY() - 4)) > 0 ? 18 : 12);
338+
return this.width - (Math.max(0, this.getContentsHeightWithPadding() - (this.getBottom() - this.getY() - 4)) > 0 ? 18 : 12);
336339
}
337340

338341
@Override
@@ -353,8 +356,8 @@ public ModsScreen getParent() {
353356
}
354357

355358
@Override
356-
protected int getMaxPosition() {
357-
return super.getMaxPosition() + 4;
359+
protected int getContentsHeightWithPadding() {
360+
return super.getContentsHeightWithPadding() + 4;
358361
}
359362

360363
public int getDisplayedCountFor(Set<String> set) {

src/main/java/com/terraformersmc/modmenu/util/EnumToLowerCaseJsonConverter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public JsonElement serialize(final Enum<?> src, final Type typeOfSrc, final Json
1717
return new JsonPrimitive(src.name().toLowerCase());
1818
}
1919

20+
@SuppressWarnings("unchecked")
2021
@Override
2122
public Enum<?> deserialize(
2223
final JsonElement json,

0 commit comments

Comments
 (0)