This commit is contained in:
creeper123123321 2020-04-14 12:39:09 -03:00
parent 356a75f8a8
commit a3b080d49a
5 changed files with 16 additions and 16 deletions

View File

@ -13,7 +13,7 @@ version = "0.2.1-SNAPSHOT+" + try {
gitVersion() gitVersion()
} catch (e: Exception) { } catch (e: Exception) {
"unknown" "unknown"
} + "+1.14-1.15" } + "+1.16"
extra.set("archivesBaseName", "ViaFabric") extra.set("archivesBaseName", "ViaFabric")
description = "Client-side and server-side ViaVersion implementation for Fabric" description = "Client-side and server-side ViaVersion implementation for Fabric"
@ -49,13 +49,13 @@ dependencies {
// transitive = false because Guava is conflicting on runClient // transitive = false because Guava is conflicting on runClient
implementation("us.myles:viaversion:3.0.0-SNAPSHOT") { isTransitive = false } implementation("us.myles:viaversion:3.0.0-SNAPSHOT") { isTransitive = false }
// Use 1.14.4 release, probably intermediary will make it work on snapshots // Use 1.16 snapshot, probably intermediary will make it work on further versions
// https://modmuss50.me/fabric.html?&version=1.14.4 // https://modmuss50.me/fabric.html?&version=20w15a
minecraft("com.mojang:minecraft:1.14.4") minecraft("com.mojang:minecraft:20w15a")
mappings("net.fabricmc:yarn:1.14.4+build.16:v2") mappings("net.fabricmc:yarn:20w15a+build.7:v2")
modImplementation("net.fabricmc:fabric-loader:0.8.2+build.194") modImplementation("net.fabricmc:fabric-loader:0.8.2+build.194")
modImplementation("net.fabricmc.fabric-api:fabric-api:0.4.3+build.247-1.14") modImplementation("net.fabricmc.fabric-api:fabric-api:0.5.10+build.320-1.16")
modImplementation("io.github.cottonmc:cotton-client-commands:1.0.0+1.15.2") modImplementation("io.github.cottonmc:cotton-client-commands:1.0.0+1.15.2")
include("io.github.cottonmc:cotton-client-commands:1.0.0+1.15.2") include("io.github.cottonmc:cotton-client-commands:1.0.0+1.15.2")

View File

@ -56,7 +56,7 @@ public class NMSCommandSender implements ViaCommandSender {
((ServerCommandSource) source).sendFeedback(Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s)), false); ((ServerCommandSource) source).sendFeedback(Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s)), false);
} else if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT && source instanceof ClientCommandSource) { } else if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT && source instanceof ClientCommandSource) {
MinecraftClient.getInstance().player MinecraftClient.getInstance().player
.sendMessage(Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s))); .sendSystemMessage(Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s)));
} }
} }

View File

@ -69,9 +69,9 @@ public abstract class MixinMultiplayerScreen extends Screen {
throw e; throw e;
} }
@Inject(method = "init", at = @At("TAIL"), remap = false) @Inject(method = "init", at = @At("TAIL"))
private void onInit(CallbackInfo ci) { private void onInit(CallbackInfo ci) {
protocolVersion = new TextFieldWidget(font, this.width / 2 + 88, 13, 65, 15, I18n.translate("gui.protocol_version_field.name")); protocolVersion = new TextFieldWidget(this.textRenderer, this.width / 2 + 88, 13, 65, 15, I18n.translate("gui.protocol_version_field.name"));
protocolVersion.setTextPredicate(new VersionFormatFilter()); protocolVersion.setTextPredicate(new VersionFormatFilter());
protocolVersion.setChangedListener((text) -> { protocolVersion.setChangedListener((text) -> {
protocolVersion.setSuggestion(null); protocolVersion.setSuggestion(null);
@ -145,13 +145,13 @@ public abstract class MixinMultiplayerScreen extends Screen {
@Inject(method = "render", at = { @Inject(method = "render", at = {
@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Screen;render(IIF)V"), @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Screen;render(IIF)V"),
@At(value = "INVOKE", target = "Lnet/minecraft/class_437;render(IIF)V") // todo check if refmap was fixed @At(value = "INVOKE", target = "Lnet/minecraft/class_437;method_25394(IIF)V") // refmap bug
}, remap = false) })
private void onRender(int int_1, int int_2, float float_1, CallbackInfo ci) { private void onRender(int int_1, int int_2, float float_1, CallbackInfo ci) {
protocolVersion.render(int_1, int_2, float_1); protocolVersion.render(int_1, int_2, float_1);
} }
@Inject(method = "tick", at = @At("TAIL"), remap = false) @Inject(method = "tick", at = @At("TAIL"))
private void onTick(CallbackInfo ci) { private void onTick(CallbackInfo ci) {
protocolVersion.tick(); protocolVersion.tick();
} }

View File

@ -37,8 +37,8 @@ import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.network.MessageType; import net.minecraft.network.MessageType;
import net.minecraft.network.OffThreadException; import net.minecraft.network.OffThreadException;
import net.minecraft.network.packet.s2c.play.ChatMessageS2CPacket;
import net.minecraft.network.packet.s2c.play.DisconnectS2CPacket; import net.minecraft.network.packet.s2c.play.DisconnectS2CPacket;
import net.minecraft.network.packet.s2c.play.GameMessageS2CPacket;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text; import net.minecraft.text.Text;
@ -209,7 +209,7 @@ public class VRPlatform implements ViaPlatform {
if (server == null) return; if (server == null) return;
ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid); ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid);
if (player == null) return; if (player == null) return;
player.sendChatMessage(Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s)), MessageType.SYSTEM); player.sendMessage(Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s)), MessageType.SYSTEM);
}); });
} }
} }
@ -219,7 +219,7 @@ public class VRPlatform implements ViaPlatform {
ClientPlayNetworkHandler handler = MinecraftClient.getInstance().getNetworkHandler(); ClientPlayNetworkHandler handler = MinecraftClient.getInstance().getNetworkHandler();
if (handler != null) { if (handler != null) {
try { try {
handler.onChatMessage(new ChatMessageS2CPacket( handler.onGameMessage(new GameMessageS2CPacket(
Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s)) Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s))
)); ));
} catch (OffThreadException ignored) { } catch (OffThreadException ignored) {

View File

@ -28,7 +28,7 @@
"fabric-resource-loader-v0": "*", "fabric-resource-loader-v0": "*",
"fabric-commands-v0": "*", "fabric-commands-v0": "*",
"viaversion": ">=3.0.0-SNAPSHOT", "viaversion": ">=3.0.0-SNAPSHOT",
"minecraft": "<1.16" "minecraft": ">1.15.2"
}, },
"recommends": { "recommends": {
"cotton-client-commands": "*" "cotton-client-commands": "*"