Skip to content

Commit 4155005

Browse files
committed
Fix Lucene startup error log about the incubating JDK vector feature.
(cherry picked from commit ce8879a)
1 parent 8945b65 commit 4155005

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package guideme.internal.hooks.mixins;
2+
3+
import org.spongepowered.asm.mixin.Mixin;
4+
import org.spongepowered.asm.mixin.injection.At;
5+
import org.spongepowered.asm.mixin.injection.Inject;
6+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
7+
8+
/**
9+
* This mixin forces Lucene not to rely on the incubating Vector module, which currently causes it to print a startup
10+
* error to console, and, when someone *does* enable the incubating module, crashes due to us not shipping the
11+
* corresponding provider.
12+
*/
13+
@Mixin(targets = "guideme.internal.shaded.lucene.internal.vectorization.VectorizationProvider", remap = false)
14+
public class LuceneVectorizationMixin {
15+
@Inject(method = "getUpperJavaFeatureVersion", cancellable = true, at = @At("TAIL"))
16+
private static void getUpperJavaFeatureVersion(CallbackInfoReturnable<Integer> ci) {
17+
ci.setReturnValue(17);
18+
}
19+
}

src/main/neoforge.mods.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ logoFile = "logo.png"
44
authors = "shartte"
55
license = "See GitHub repository for details"
66

7+
[[mixins]]
8+
config="guideme.optional.mixins.json"
9+
710
[[mods]]
811
modId = "guideme"
912
version = "${version}"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"required": false,
3+
"minVersion": "0.8.3",
4+
"package": "guideme.internal.hooks.mixins",
5+
"compatibilityLevel": "JAVA_11",
6+
"client": [
7+
"LuceneVectorizationMixin"
8+
],
9+
"server": [],
10+
"injectors": {
11+
"defaultRequire": 0
12+
}
13+
}

0 commit comments

Comments
 (0)