Skip to content

Commit cbdf058

Browse files
committed
Fix crash with old YACL
1 parent 0a55344 commit cbdf058

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ architectury {
1212
minecraft = libs.versions.minecraft.get()
1313
}
1414

15-
version = "3.0.0+1.19.4"
15+
version = "3.0.1+1.19.4"
1616

1717
val isBeta = "beta" in version.toString()
1818
val changelogText = rootProject.file("changelogs/${project.version}.md").takeIf { it.exists() }?.readText() ?: "No changelog provided."

changelogs/3.0.1+1.19.4.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fix an unavoidable crash

common/src/main/java/dev/isxander/yacl3/mixin/AbstractSelectionListMixin.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ public abstract class AbstractSelectionListMixin<E extends AbstractSelectionList
1818
* YACL modifies these children() method to filter out hidden entries, so we need to redirect the field access to the
1919
* method, so we don't get ArrayIndexOutOfBoundsException.
2020
*/
21-
@Redirect(method = "nextEntry(Lnet/minecraft/client/gui/navigation/ScreenDirection;Ljava/util/function/Predicate;Lnet/minecraft/client/gui/components/AbstractSelectionList$Entry;)Lnet/minecraft/client/gui/components/AbstractSelectionList$Entry;", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/components/AbstractSelectionList;children:Ljava/util/List;", opcode = Opcodes.GETFIELD))
21+
@Redirect(
22+
method = "nextEntry(Lnet/minecraft/client/gui/navigation/ScreenDirection;Ljava/util/function/Predicate;Lnet/minecraft/client/gui/components/AbstractSelectionList$Entry;)Lnet/minecraft/client/gui/components/AbstractSelectionList$Entry;",
23+
at = @At(
24+
value = "FIELD",
25+
target = "Lnet/minecraft/client/gui/components/AbstractSelectionList;children:Ljava/util/List;",
26+
opcode = Opcodes.GETFIELD
27+
),
28+
require = 0 // since 2.x also redirects this field access, we need to set this to 0 to prevent redirect conflict
29+
)
2230
private List<E> modifyChildrenCall(AbstractSelectionList<E> instance) {
2331
return children();
2432
}

0 commit comments

Comments
 (0)