Skip to content

Commit d711c0a

Browse files
committed
Update to 1.20.2
1 parent d282a24 commit d711c0a

9 files changed

Lines changed: 65 additions & 85 deletions

File tree

build.gradle

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
plugins {
2-
id "fabric-loom" version "0.12-SNAPSHOT"
3-
id "maven-publish"
2+
id "fabric-loom" version "1.4-SNAPSHOT"
43
}
54

65
version = project.mod_version
76
group = project.maven_group
87

9-
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
10-
118
repositories {
129
maven {
1310
name "Shedaniel"
@@ -24,10 +21,10 @@ dependencies {
2421
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
2522
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
2623

27-
modApi("me.shedaniel.cloth:cloth-config-fabric:7.0.72") { exclude group: "net.fabricmc.fabric-api" }
28-
include "me.shedaniel.cloth:cloth-config-fabric:7.0.72"
24+
modApi("me.shedaniel.cloth:cloth-config-fabric:12.0.109") { exclude group: "net.fabricmc.fabric-api" }
25+
include "me.shedaniel.cloth:cloth-config-fabric:12.0.109"
2926

30-
modApi "com.terraformersmc:modmenu:4.0.0"
27+
modApi "com.terraformersmc:modmenu:8.0.0-beta.2"
3128
}
3229

3330
loom {
@@ -36,39 +33,25 @@ loom {
3633

3734
processResources {
3835
inputs.property "version", project.version
39-
filteringCharset "UTF-8"
4036

4137
filesMatching("fabric.mod.json") {
4238
expand "version": project.version
4339
}
4440
}
4541

46-
def targetJavaVersion = 17
4742
tasks.withType(JavaCompile).configureEach {
48-
// ensure that the encoding is set to UTF-8, no matter what the system default is
49-
// this fixes some edge cases with special characters not displaying correctly
50-
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
51-
// If Javadoc is generated, this must be specified in that task too.
52-
it.options.encoding = "UTF-8"
53-
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
54-
it.options.release = targetJavaVersion
55-
}
43+
it.options.release.set(17)
5644
}
5745

5846
java {
59-
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
60-
if (JavaVersion.current() < javaVersion) {
61-
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
62-
}
63-
archivesBaseName = project.archives_base_name
64-
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
65-
// if it is present.
66-
// If you remove this line, sources will not be generated.
6747
withSourcesJar()
48+
49+
sourceCompatibility = JavaVersion.VERSION_17
50+
targetCompatibility = JavaVersion.VERSION_17
6851
}
6952

7053
jar {
7154
from("LICENSE") {
72-
rename { "${it}_${project.archivesBaseName}" }
55+
rename { "${it}_${project.base.archivesName.get()}"}
7356
}
7457
}

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
5-
minecraft_version=1.19
6-
yarn_mappings=1.19+build.4
7-
loader_version=0.14.8
5+
minecraft_version=1.20.2
6+
yarn_mappings=1.20.2+build.4
7+
loader_version=0.14.23
88

99
# Mod Properties
1010
mod_version=0.1.0
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-7.3.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/java/meteordevelopment/voyager/mixin/CommandSuggestorMixin.java renamed to src/main/java/meteordevelopment/voyager/mixin/ChatInputSuggestorMixin.java

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
package meteordevelopment.voyager.mixin;
22

3-
import com.mojang.brigadier.CommandDispatcher;
43
import com.mojang.brigadier.ParseResults;
54
import com.mojang.brigadier.StringReader;
65
import com.mojang.brigadier.suggestion.Suggestions;
76
import meteordevelopment.voyager.Voyager;
87
import meteordevelopment.voyager.commands.Commands;
9-
import net.minecraft.client.gui.screen.CommandSuggestor;
8+
import net.minecraft.client.gui.screen.ChatInputSuggestor;
109
import net.minecraft.client.gui.widget.TextFieldWidget;
1110
import net.minecraft.command.CommandSource;
12-
import org.jetbrains.annotations.Nullable;
1311
import org.spongepowered.asm.mixin.Final;
1412
import org.spongepowered.asm.mixin.Mixin;
1513
import org.spongepowered.asm.mixin.Shadow;
@@ -20,43 +18,43 @@
2018

2119
import java.util.concurrent.CompletableFuture;
2220

23-
@Mixin(CommandSuggestor.class)
24-
public abstract class CommandSuggestorMixin {
25-
@Shadow private @Nullable ParseResults<CommandSource> parse;
26-
21+
@Mixin(ChatInputSuggestor.class)
22+
public abstract class ChatInputSuggestorMixin {
23+
@Shadow private ParseResults<CommandSource> parse;
2724
@Shadow @Final TextFieldWidget textField;
28-
29-
@Shadow @Nullable CommandSuggestor.@Nullable SuggestionWindow window;
30-
3125
@Shadow boolean completingSuggestions;
26+
@Shadow private CompletableFuture<Suggestions> pendingSuggestions;
27+
@Shadow private ChatInputSuggestor.SuggestionWindow window;
3228

33-
@Shadow private @Nullable CompletableFuture<Suggestions> pendingSuggestions;
34-
35-
@Shadow protected abstract void show();
29+
@Shadow
30+
protected abstract void showCommandSuggestions();
3631

37-
@Inject(method = "refresh", at = @At(value = "INVOKE", target = "Lcom/mojang/brigadier/StringReader;canRead()Z"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
38-
private void onRefresh(CallbackInfo info, String string, StringReader reader) {
32+
@Inject(method = "refresh",
33+
at = @At(value = "INVOKE", target = "Lcom/mojang/brigadier/StringReader;canRead()Z", remap = false),
34+
cancellable = true,
35+
locals = LocalCapture.CAPTURE_FAILHARD)
36+
public void onRefresh(CallbackInfo ci, String string, StringReader reader) {
3937
String prefix = Voyager.INSTANCE.getSettings().prefix.get();
38+
int length = prefix.length();
4039

41-
if (reader.canRead(prefix.length()) && reader.getString().startsWith(prefix, reader.getCursor())) {
42-
reader.setCursor(reader.getCursor() + prefix.length());
40+
if (reader.canRead(length) && reader.getString().startsWith(prefix, reader.getCursor())) {
41+
reader.setCursor(reader.getCursor() + length);
4342

44-
CommandDispatcher<CommandSource> commandDispatcher = Commands.DISPATCHER;
4543
if (this.parse == null) {
46-
this.parse = commandDispatcher.parse(reader, Commands.COMMAND_SOURCE);
44+
this.parse = Commands.DISPATCHER.parse(reader, Commands.COMMAND_SOURCE);
4745
}
4846

4947
int cursor = textField.getCursor();
5048
if (cursor >= 1 && (this.window == null || !this.completingSuggestions)) {
51-
this.pendingSuggestions = commandDispatcher.getCompletionSuggestions(this.parse, cursor);
49+
this.pendingSuggestions = Commands.DISPATCHER.getCompletionSuggestions(this.parse, cursor);
5250
this.pendingSuggestions.thenRun(() -> {
5351
if (this.pendingSuggestions.isDone()) {
54-
this.show();
52+
this.showCommandSuggestions();
5553
}
5654
});
5755
}
5856

59-
info.cancel();
57+
ci.cancel();
6058
}
6159
}
6260
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package meteordevelopment.voyager.mixin;
2+
3+
import meteordevelopment.voyager.Voyager;
4+
import meteordevelopment.voyager.commands.Commands;
5+
import net.minecraft.client.network.ClientPlayNetworkHandler;
6+
import org.spongepowered.asm.mixin.Mixin;
7+
import org.spongepowered.asm.mixin.injection.At;
8+
import org.spongepowered.asm.mixin.injection.Inject;
9+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
10+
11+
@Mixin(ClientPlayNetworkHandler.class)
12+
public class ClientPlayNetworkHandlerMixin {
13+
@Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true)
14+
private void onSendChatMessage(String content, CallbackInfo info) {
15+
String prefix = Voyager.INSTANCE.getSettings().prefix.get();
16+
17+
if (content.startsWith(prefix)) {
18+
Commands.dispatch(content.substring(prefix.length()));
19+
info.cancel();
20+
}
21+
}
22+
}

src/main/java/meteordevelopment/voyager/mixin/ClientPlayerEntityMixin.java

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/main/java/meteordevelopment/voyager/utils/Renderer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import com.mojang.blaze3d.systems.RenderSystem;
44
import net.minecraft.client.render.*;
55
import net.minecraft.client.util.math.MatrixStack;
6-
import net.minecraft.util.math.Matrix4f;
76
import net.minecraft.util.math.Vec3d;
7+
import org.joml.Matrix4f;
88
import org.lwjgl.opengl.GL11;
99

1010
import static meteordevelopment.voyager.Voyager.mc;
@@ -72,16 +72,16 @@ public void line(double x1, double y1, double z1, double x2, double y2, double z
7272
}
7373

7474
public void end() {
75-
RenderSystem.setShader(GameRenderer::getPositionColorShader);
75+
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
7676
RenderSystem.enableBlend();
7777
RenderSystem.defaultBlendFunc();
7878
GL11.glEnable(GL11.GL_LINE_SMOOTH);
7979

8080
if (depthTest) RenderSystem.enableDepthTest();
8181
else RenderSystem.disableDepthTest();
8282

83-
BufferRenderer.drawWithShader(lines.end());
84-
if (!linesOnly) BufferRenderer.drawWithShader(triangles.end());
83+
BufferRenderer.drawWithGlobalProgram(lines.end());
84+
if (!linesOnly) BufferRenderer.drawWithGlobalProgram(triangles.end());
8585

8686
RenderSystem.enableDepthTest();
8787
GL11.glDisable(GL11.GL_LINE_SMOOTH);

src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
"accessWidener": "voyager.accesswidener",
2323
"depends": {
2424
"fabricloader": ">=0.14",
25-
"minecraft": ">=1.19"
25+
"minecraft": ">=1.20.2"
2626
}
2727
}

src/main/resources/voyager.mixins.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"package": "meteordevelopment.voyager.mixin",
55
"compatibilityLevel": "JAVA_16",
66
"client": [
7-
"KeyboardMixin",
8-
"LivingEntityMixin",
97
"CameraMixin",
8+
"ClientPlayNetworkHandlerMixin",
9+
"ChatInputSuggestorMixin",
1010
"EntityMixin",
1111
"GameRendererMixin",
12-
"MinecraftClientMixin",
13-
"CommandSuggestorMixin",
14-
"ClientPlayerEntityMixin"
12+
"KeyboardMixin",
13+
"LivingEntityMixin",
14+
"MinecraftClientMixin"
1515
],
1616
"injectors": {
1717
"defaultRequire": 1

0 commit comments

Comments
 (0)