更新到1.17

This commit is contained in:
Xujiayao 2021-06-30 15:22:22 +08:00
parent 2f6d768821
commit 49db91f765
6 changed files with 20 additions and 15 deletions

1
TODO.txt Normal file
View file

@ -0,0 +1 @@
写Config文档

View file

@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.8.17'
id 'fabric-loom' version '0.9.9'
}
sourceCompatibility = JavaVersion.VERSION_16
@ -33,8 +33,9 @@ dependencies {
include "net.sf.trove4j:trove4j:+"
include "org.apache.commons:commons-collections4:+"
include "org.apache.httpcomponents:httpclient:+"
include "org.jetbrains:annotations:+"
include "org.slf4j:slf4j-api:+"
//include "org.slf4j:slf4j-api:+"
include "com.neovisionaries:nv-websocket-client:+"
include "com.fasterxml.jackson.core:jackson-annotations:+"
include "com.fasterxml.jackson.core:jackson-core:+"

View file

@ -2,13 +2,13 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.9
loader_version=0.11.3
minecraft_version=1.17
yarn_mappings=1.17+build.9
loader_version=0.11.6
# Mod Properties
mod_version=1.16-1.5.3
mod_version=1.17-1.6.0
maven_group=top.xujiayao
archives_base_name=MCDiscordChat
# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.35.0+1.16
fabric_version=0.36.0+1.17

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View file

@ -3,6 +3,7 @@ package top.xujiayao.mcdiscordchat.mixins;
import net.minecraft.network.MessageType;
import net.minecraft.network.Packet;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.filter.TextStream.Message;
import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
@ -43,11 +44,13 @@ public abstract class MixinServerPlayNetworkHandler {
@Shadow
protected abstract void executeCommand(String input);
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcastChatMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/MessageType;Ljava/util/UUID;)V"), method = "method_31286", cancellable = true)
private void onGameMessage(String string, CallbackInfo ci) {
String message = StringUtils.normalizeSpace(string);
Text text = new TranslatableText("chat.type.text", this.player.getDisplayName(), message);
Optional<Text> eventResult = ServerChatCallback.EVENT.invoker().onServerChat(this.player, message, text);
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcast(Lnet/minecraft/text/Text;Ljava/util/function/Function;Lnet/minecraft/network/MessageType;Ljava/util/UUID;)V"), method = "handleMessage", cancellable = true)
private void handleMessage(Message message, CallbackInfo ci) {
String string = message.getRaw();
String msg = StringUtils.normalizeSpace(string);
Text text = new TranslatableText("chat.type.text", this.player.getDisplayName(), msg);
Optional<Text> eventResult = ServerChatCallback.EVENT.invoker().onServerChat(this.player, msg, text);
if (eventResult.isPresent()) {
this.server.getPlayerManager().broadcastChatMessage(eventResult.get(), MessageType.CHAT, this.player.getUuid());
ci.cancel();

View file

@ -23,9 +23,9 @@
"mcdiscordchat.mixins.json"
],
"depends": {
"fabricloader": ">=0.11.3",
"fabricloader": ">=0.11.6",
"fabric": "*",
"minecraft": "1.16.x",
"minecraft": "1.17.x",
"java": ">=16"
}
}