Skip to content

Commit 194b9d5

Browse files
authored
feat: Update to 26.1 (snapshot 1) (#320)
* chore: update used action versions and update java version * chore: switch to lazy regex * feat: switch to moddevgradle and update gradle to mc 26.1 and java 25 * fix: classtweaker path * feat: update to 26.1 api * chore: project-wide auto code cleanup
1 parent 4f40ee0 commit 194b9d5

35 files changed

Lines changed: 160 additions & 280 deletions

‎.github/workflows/build_and_publish.yaml‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,37 @@ jobs:
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@v4
17-
- name: Set up OpenJDK 21
18-
uses: actions/setup-java@v4
17+
- name: Set up OpenJDK 25
18+
uses: actions/setup-java@v5
1919
with:
20-
java-version: 21
20+
java-version: 25
2121
distribution: temurin
2222
- name: Get release type from github tag
2323
id: get_release_type
24-
uses: actions/github-script@v7
24+
uses: actions/github-script@v8
2525
with:
2626
github-token: ${{ secrets.RELEASE_NOTES_TOKEN }}
2727
result-encoding: string
2828
script: |
29-
return '${{ github.ref }}'.match(/refs\/tags\/(.*)\/v((.*)-(.*))/)[1];
29+
return '${{ github.ref }}'.match(/refs\/tags\/(.*)\/v((.*?)-(.*))/)[1];
3030
- name: Get file version from tag
3131
id: get_version
32-
uses: actions/github-script@v7
32+
uses: actions/github-script@v8
3333
with:
3434
github-token: ${{ secrets.RELEASE_NOTES_TOKEN }}
3535
result-encoding: string
3636
script: |
37-
return '${{ github.ref }}'.match(/refs\/tags\/(.*)\/v((.*)-(.*))/)[4];
37+
return '${{ github.ref }}'.match(/refs\/tags\/(.*)\/v((.*?)-(.*))/)[4];
3838
- name: Get main mc version from tag
3939
id: get_mc_version
40-
uses: actions/github-script@v7
40+
uses: actions/github-script@v8
4141
with:
4242
github-token: ${{ secrets.RELEASE_NOTES_TOKEN }}
4343
result-encoding: string
4444
script: |
45-
return '${{ github.ref }}'.match(/refs\/tags\/(.*)\/v((.*)-(.*))/)[3];
45+
return '${{ github.ref }}'.match(/refs\/tags\/(.*)\/v((.*?)-(.*))/)[3];
4646
- name: Setup Gradle
47-
uses: gradle/actions/setup-gradle@v4
47+
uses: gradle/actions/setup-gradle@v5
4848
with:
4949
gradle-home-cache-cleanup: true
5050
- name: Build
@@ -110,7 +110,7 @@ jobs:
110110
uses: stefanzweifel/git-auto-commit-action@v5
111111
if: ${{ steps.get_release_type.outputs.result != 'test' }}
112112
with:
113-
branch: version/1.21.11
113+
branch: version/${{ steps.get_mc_version.outputs.result }}
114114
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
115115
file_pattern: CHANGELOG.md
116116
- name: Upload Neo Version to Mod Platforms

‎build.gradle‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
plugins {
2-
id 'fabric-loom' version "${loom_version}" apply(false)
2+
id 'net.fabricmc.fabric-loom' version "${loom_version}" apply(false)
33
}
44

55
subprojects {
66
apply plugin: 'java'
77

8-
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
8+
java.toolchain.languageVersion = JavaLanguageVersion.of(25)
99
java.withSourcesJar()
1010
// java.withJavadocJar()
1111

‎common/build.gradle‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
id 'idea'
33
id 'java'
44
id 'maven-publish'
5-
id 'fabric-loom' version "${loom_version}"
5+
id 'net.fabricmc.fabric-loom' version "${loom_version}"
66
}
77

88

@@ -16,7 +16,7 @@ base {
1616
}
1717

1818
loom {
19-
accessWidenerPath = file("src/main/resources/modonomicon.accesswidener")
19+
accessWidenerPath = file("src/main/resources/modonomicon.classtweaker")
2020
mixin {
2121
useLegacyMixinAp = false
2222
}
@@ -32,10 +32,6 @@ sourceSets {
3232

3333
dependencies {
3434
minecraft "com.mojang:minecraft:${minecraft_version}"
35-
mappings loom.layered() {
36-
officialMojangMappings()
37-
parchment("org.parchmentmc.data:parchment-${loom_mapping_version}@zip")
38-
}
3935

4036
compileOnly group: 'org.spongepowered', name: 'mixin', version: "${mixin_version}"
4137
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: "${jsr305_version}"

‎common/src/main/java/com/klikli_dev/modonomicon/api/events/EventPriority.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ public enum EventPriority {
99
HIGH,
1010
NORMAL,
1111
LOW,
12-
LOWEST;
12+
LOWEST
1313
}

‎common/src/main/java/com/klikli_dev/modonomicon/api/multiblock/Multiblock.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,18 @@ interface SimulateResult {
137137
/**
138138
* Final world position this block will be matched or placed at
139139
*/
140-
BlockPos getWorldPosition();
140+
BlockPos worldPosition();
141141

142142
/**
143143
* The matcher used at this position
144144
*/
145-
StateMatcher getStateMatcher();
145+
StateMatcher stateMatcher();
146146

147147
/**
148148
* The character used to express the state matcher, if this is a dense multiblock.
149149
*/
150150
@Nullable
151-
Character getCharacter();
151+
Character character();
152152

153153
/**
154154
* @return Whether the multiblock is fulfilled at this position

‎common/src/main/java/com/klikli_dev/modonomicon/book/Book.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public void prerenderMarkdown(BookTextRenderer textRenderer) {
332332
}
333333

334334
public void addMacro(String key, String value) {
335-
textMacros.put(key, value);
335+
this.textMacros.put(key, value);
336336
}
337337

338338
public void toNetwork(RegistryFriendlyByteBuf buffer) {
@@ -406,7 +406,7 @@ public Identifier getId() {
406406
}
407407

408408
public Map<String, String> textMacros() {
409-
return textMacros;
409+
return this.textMacros;
410410
}
411411

412412
public void addCategory(BookCategory category) {

‎common/src/main/java/com/klikli_dev/modonomicon/book/BookFrameOverlay.java‎

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
* Allows configuring the rendering of a book frame overlay.
1818
* These frame overlays are rendered at the center of each frame side and allow to add non-repeating elements.
1919
*/
20-
public class BookFrameOverlay {
20+
public record BookFrameOverlay(Identifier texture, int textureWidth, int textureHeight, int frameWidth, int frameHeight,
21+
int frameXOffset, int frameYOffset) {
2122

2223
public static final Codec<BookFrameOverlay> CODEC = RecordCodecBuilder.create((builder) -> {
2324
return builder.group(
@@ -44,23 +45,6 @@ public class BookFrameOverlay {
4445
})
4546
).apply(builder, BookFrameOverlay::new);
4647
});
47-
private final int textureHeight;
48-
private final int textureWidth;
49-
private final int frameWidth;
50-
private final int frameHeight;
51-
private final int frameXOffset;
52-
private final int frameYOffset;
53-
private final Identifier texture;
54-
55-
public BookFrameOverlay(Identifier texture, int textureWidth, int textureHeight, int frameWidth, int frameHeight, int frameXOffset, int frameYOffset) {
56-
this.texture = texture;
57-
this.textureWidth = textureWidth;
58-
this.textureHeight = textureHeight;
59-
this.frameWidth = frameWidth;
60-
this.frameHeight = frameHeight;
61-
this.frameXOffset = frameXOffset;
62-
this.frameYOffset = frameYOffset;
63-
}
6448

6549
public static BookFrameOverlay fromJson(JsonObject json) {
6650
return BookFrameOverlay.CODEC.parse(JsonOps.INSTANCE, json).getOrThrow();
@@ -89,32 +73,4 @@ public int getFrameX(int startX) {
8973
public int getFrameY(int startY) {
9074
return startY - this.frameHeight / 2 + this.frameYOffset;
9175
}
92-
93-
public Identifier getTexture() {
94-
return this.texture;
95-
}
96-
97-
public int getTextureHeight() {
98-
return this.textureHeight;
99-
}
100-
101-
public int getTextureWidth() {
102-
return this.textureWidth;
103-
}
104-
105-
public int getFrameWidth() {
106-
return this.frameWidth;
107-
}
108-
109-
public int getFrameHeight() {
110-
return this.frameHeight;
111-
}
112-
113-
public int getFrameXOffset() {
114-
return this.frameXOffset;
115-
}
116-
117-
public int getFrameYOffset() {
118-
return this.frameYOffset;
119-
}
12076
}

‎common/src/main/java/com/klikli_dev/modonomicon/book/BookIcon.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class BookIcon {
3030
* A custom codec that still uses the "item" field instead of "id" for backwards comp,
3131
*/
3232
public static final Codec<ItemStack> CUSTOM_ITEM_STACK_CODEC = RecordCodecBuilder.create((builder) -> builder.group(
33-
Item.CODEC.fieldOf("item").forGetter(ItemStack::getItemHolder),
33+
Item.CODEC.fieldOf("item").forGetter(ItemStack::typeHolder),
3434
Codec.INT.optionalFieldOf("count", 1).forGetter(ItemStack::getCount),
3535
DataComponentPatch.CODEC.optionalFieldOf("components", DataComponentPatch.EMPTY).forGetter(ItemStack::getComponentsPatch)
3636
).apply(builder, ItemStack::new));

‎common/src/main/java/com/klikli_dev/modonomicon/book/page/BookSpotlightPage.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class BookSpotlightPage extends BookPage {
4343
*/
4444
public static final Codec<ItemStack> CUSTOM_ITEM_STACK_CODEC = Codec.lazyInitialized(
4545
() -> RecordCodecBuilder.create((builder) -> builder.group(
46-
Item.CODEC.fieldOf("item").forGetter(ItemStack::getItemHolder),
46+
Item.CODEC.fieldOf("item").forGetter(ItemStack::typeHolder),
4747
ExtraCodecs.intRange(1, 99).fieldOf("count").orElse(1).forGetter(ItemStack::getCount),
4848
DataComponentPatch.CODEC.optionalFieldOf("components", DataComponentPatch.EMPTY).forGetter(ItemStack::getComponentsPatch)
4949
).apply(builder, ItemStack::new))

‎common/src/main/java/com/klikli_dev/modonomicon/client/gui/book/entry/ContentRenderingScreen.java‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,17 @@ default void renderComponentHoverEffect(GuiGraphics guiGraphics, @Nullable Style
136136
//TODO: we had a +1000 z translate here
137137
var newStyle = style;
138138
if (style != null && style.getHoverEvent() != null) {
139-
if (style.getHoverEvent().action() == HoverEvent.Action.SHOW_TEXT && style.getHoverEvent() instanceof HoverEvent.ShowText showText) {
139+
if (style.getHoverEvent().action() == HoverEvent.Action.SHOW_TEXT && style.getHoverEvent() instanceof HoverEvent.ShowText(
140+
Component oldComponent
141+
)) {
140142
var clickEvent = style.getClickEvent();
141143
if (clickEvent != null) {
142-
if (clickEvent.action() == ClickEvent.Action.OPEN_FILE && clickEvent instanceof ClickEvent.OpenFile openFile) {
144+
if (clickEvent.action() == ClickEvent.Action.OPEN_FILE && clickEvent instanceof ClickEvent.OpenFile(
145+
String path
146+
)) {
143147
//handle book links -> check if locked
144-
if (BookLink.isBookLink(openFile.path())) {
145-
var link = BookLink.from(this.getBook(), openFile.path());
148+
if (BookLink.isBookLink(path)) {
149+
var link = BookLink.from(this.getBook(), path);
146150
var book = BookDataManager.get().getBook(link.bookId);
147151
if (link.entryId != null) {
148152
var entry = book.getEntry(link.entryId);
@@ -156,7 +160,6 @@ default void renderComponentHoverEffect(GuiGraphics guiGraphics, @Nullable Style
156160
//handleComponentClicked will prevent the actual click
157161

158162
if (!BookUnlockStateManager.get().isUnlockedFor(Minecraft.getInstance().player, entry)) {
159-
var oldComponent = showText.value();
160163

161164
var newComponent = Component.translatable(
162165
ModonomiconConstants.I18n.Gui.HOVER_BOOK_LINK_LOCKED,
@@ -175,7 +178,6 @@ default void renderComponentHoverEffect(GuiGraphics guiGraphics, @Nullable Style
175178

176179
newStyle = style.withHoverEvent(new HoverEvent.ShowText(newComponent));
177180
} else if (page != null && !BookUnlockStateManager.get().isUnlockedFor(Minecraft.getInstance().player, entry.getPages().get(page))) {
178-
var oldComponent = showText.value();
179181

180182
var newComponent = Component.translatable(
181183
ModonomiconConstants.I18n.Gui.HOVER_BOOK_LINK_LOCKED,
@@ -200,15 +202,15 @@ default void renderComponentHoverEffect(GuiGraphics guiGraphics, @Nullable Style
200202
}
201203
}
202204

203-
if (clickEvent.action() == ClickEvent.Action.RUN_COMMAND && clickEvent instanceof ClickEvent.RunCommand runCommand) {
204-
if (CommandLink.isCommandLink(runCommand.command())) {
205-
var link = CommandLink.from(this.getBook(), runCommand.command());
205+
if (clickEvent.action() == ClickEvent.Action.RUN_COMMAND && clickEvent instanceof ClickEvent.RunCommand(
206+
String command1
207+
)) {
208+
if (CommandLink.isCommandLink(command1)) {
209+
var link = CommandLink.from(this.getBook(), command1);
206210
var book = BookDataManager.get().getBook(link.bookId);
207211
if (link.commandId != null) {
208212
var command = book.getCommand(link.commandId);
209213

210-
var oldComponent = showText.value();
211-
212214
if (!BookUnlockStateManager.get().canRunFor(Minecraft.getInstance().player, command)) {
213215
var hoverComponent = Component.translatable(ModonomiconConstants.I18n.Gui.HOVER_COMMAND_LINK_UNAVAILABLE).withStyle(ChatFormatting.RED);
214216
newStyle = style.withHoverEvent(new HoverEvent.ShowText(hoverComponent));

0 commit comments

Comments
 (0)