From 5fa44cb0dff3f49e96aab2f11348def991585e14 Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Thu, 12 Sep 2019 14:14:48 +0200 Subject: [PATCH] 19w37a --- build.gradle.kts | 12 ++++++------ .../viafabric/commands/NMSCommandSender.java | 6 +++--- .../mixin/client/MixinMultiplayerScreen.java | 18 +++++++++--------- .../viafabric/platform/VRPlatform.java | 12 ++++++------ .../viafabric/platform/VRViaConfig.java | 5 +++++ 5 files changed, 29 insertions(+), 24 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 6cecbd4..15e8973 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -46,16 +46,16 @@ tasks.named("processResources") { dependencies { // transitive = false because Guava is conflicting on runClient - compile("us.myles:viaversion:2.1.4-SNAPSHOT") { isTransitive = false } - include("us.myles:viaversion:2.1.4-SNAPSHOT") + compile("us.myles:viaversion:2.1.4-19w37a") { isTransitive = false } + include("us.myles:viaversion:2.1.4-19w37a") compileOnly("com.google.code.findbugs:jsr305:3.0.2") - minecraft("com.mojang:minecraft:1.14.2") - mappings("net.fabricmc:yarn:1.14.2+build.1") - modCompile("net.fabricmc:fabric-loader:0.4.8+build.154") + minecraft("com.mojang:minecraft:19w37a") + mappings("net.fabricmc:yarn:19w37a+build.1") + modCompile("net.fabricmc:fabric-loader:0.6.1+build.165") - modCompile("net.fabricmc.fabric-api:fabric-api:0.3.0+build.170") + modCompile("net.fabricmc.fabric-api:fabric-api:0.3.2+build.227-1.15") modCompile("io.github.cottonmc:cotton-client-commands:0.4.2+1.14.3-SNAPSHOT") include("io.github.cottonmc:cotton-client-commands:0.4.2+1.14.3-SNAPSHOT") diff --git a/src/main/java/com/github/creeper123123321/viafabric/commands/NMSCommandSender.java b/src/main/java/com/github/creeper123123321/viafabric/commands/NMSCommandSender.java index 0bbc87e..475743b 100644 --- a/src/main/java/com/github/creeper123123321/viafabric/commands/NMSCommandSender.java +++ b/src/main/java/com/github/creeper123123321/viafabric/commands/NMSCommandSender.java @@ -29,9 +29,9 @@ import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientCommandSource; import net.minecraft.entity.Entity; -import net.minecraft.network.chat.TextComponent; import net.minecraft.server.command.CommandSource; import net.minecraft.server.command.ServerCommandSource; +import net.minecraft.text.Text; import us.myles.ViaVersion.api.command.ViaCommandSender; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter; @@ -53,10 +53,10 @@ public class NMSCommandSender implements ViaCommandSender { @Override public void sendMessage(String s) { if (source instanceof ServerCommandSource) { - ((ServerCommandSource) source).sendFeedback(TextComponent.Serializer.fromJsonString(ChatRewriter.legacyTextToJson(s)), false); + ((ServerCommandSource) source).sendFeedback(Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s)), false); } else if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT && source instanceof ClientCommandSource) { MinecraftClient.getInstance().player - .sendMessage(TextComponent.Serializer.fromJsonString(ChatRewriter.legacyTextToJson(s))); + .sendMessage(Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s))); } } diff --git a/src/main/java/com/github/creeper123123321/viafabric/mixin/client/MixinMultiplayerScreen.java b/src/main/java/com/github/creeper123123321/viafabric/mixin/client/MixinMultiplayerScreen.java index 5fed0bc..a4c0fe9 100644 --- a/src/main/java/com/github/creeper123123321/viafabric/mixin/client/MixinMultiplayerScreen.java +++ b/src/main/java/com/github/creeper123123321/viafabric/mixin/client/MixinMultiplayerScreen.java @@ -32,11 +32,11 @@ import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.gui.widget.RecipeBookButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; +import net.minecraft.client.gui.widget.TexturedButtonWidget; import net.minecraft.client.resource.language.I18n; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.text.Text; +import net.minecraft.text.TranslatableText; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; @@ -65,15 +65,15 @@ public abstract class MixinMultiplayerScreen extends Screen { @Unique private boolean supportedProtocol; - protected MixinMultiplayerScreen(TextComponent textComponent_1, UnsupportedOperationException e) { - super(textComponent_1); + protected MixinMultiplayerScreen(Text title, UnsupportedOperationException e) { + super(title); throw e; } @Inject(method = "init", at = @At("TAIL"), remap = false) private void onInit(CallbackInfo ci) { protocolVersion = new TextFieldWidget(font, this.width / 2 + 88, 13, 65, 15, I18n.translate("gui.protocol_version_field.name")); - protocolVersion.method_1890(new VersionFormatFilter()); + protocolVersion.setTextPredicate(new VersionFormatFilter()); protocolVersion.setChangedListener((text) -> { protocolVersion.setSuggestion(null); int newVersion = ((VRVersionProvider) Via.getManager().getProviders().get(VersionProvider.class)).clientSideModeVersion; @@ -110,7 +110,7 @@ public abstract class MixinMultiplayerScreen extends Screen { : Integer.toString(clientSideVersion)); this.children.add(protocolVersion); - enableClientSideViaVersion = new RecipeBookButtonWidget(this.width / 2 + 113, 10, + enableClientSideViaVersion = new TexturedButtonWidget(this.width / 2 + 113, 10, 40, 20, // Size 0, 0, // Start pos of texture 20, // v Hover offset @@ -129,8 +129,8 @@ public abstract class MixinMultiplayerScreen extends Screen { } } }, - new TranslatableComponent("gui.enable_client_side.question"), - new TranslatableComponent("gui.enable_client_side.warning"), + new TranslatableText("gui.enable_client_side.question"), + new TranslatableText("gui.enable_client_side.warning"), I18n.translate("gui.enable_client_side.enable"), I18n.translate("gui.cancel") )), diff --git a/src/main/java/com/github/creeper123123321/viafabric/platform/VRPlatform.java b/src/main/java/com/github/creeper123123321/viafabric/platform/VRPlatform.java index d1ca005..63fb755 100644 --- a/src/main/java/com/github/creeper123123321/viafabric/platform/VRPlatform.java +++ b/src/main/java/com/github/creeper123123321/viafabric/platform/VRPlatform.java @@ -38,11 +38,11 @@ import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.packet.ChatMessageS2CPacket; import net.minecraft.client.network.packet.DisconnectS2CPacket; import net.minecraft.entity.Entity; +import net.minecraft.network.MessageType; import net.minecraft.network.OffThreadException; -import net.minecraft.network.chat.ChatMessageType; -import net.minecraft.network.chat.TextComponent; import net.minecraft.server.MinecraftServer; import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.text.Text; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.ViaAPI; import us.myles.ViaVersion.api.ViaVersionConfig; @@ -205,7 +205,7 @@ public class VRPlatform implements ViaPlatform { if (server == null) return; ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid); if (player == null) return; - player.sendChatMessage(TextComponent.Serializer.fromJsonString(ChatRewriter.legacyTextToJson(s)), ChatMessageType.SYSTEM); + player.sendChatMessage(Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s)), MessageType.SYSTEM); }); } } @@ -216,7 +216,7 @@ public class VRPlatform implements ViaPlatform { if (handler != null) { try { handler.onChatMessage(new ChatMessageS2CPacket( - TextComponent.Serializer.fromJsonString(ChatRewriter.legacyTextToJson(s)) + Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s)) )); } catch (OffThreadException ignored) { } @@ -233,7 +233,7 @@ public class VRPlatform implements ViaPlatform { if (server != null && server.isOnThread()) { ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid); if (player == null) return false; - player.networkHandler.disconnect(TextComponent.Serializer.fromJsonString(ChatRewriter.legacyTextToJson(s))); + player.networkHandler.disconnect(Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s))); } } return false; @@ -245,7 +245,7 @@ public class VRPlatform implements ViaPlatform { if (handler != null) { try { handler.onDisconnect(new DisconnectS2CPacket( - TextComponent.Serializer.fromJsonString(ChatRewriter.legacyTextToJson(msg)) + Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(msg)) )); } catch (OffThreadException ignored) { } diff --git a/src/main/java/com/github/creeper123123321/viafabric/platform/VRViaConfig.java b/src/main/java/com/github/creeper123123321/viafabric/platform/VRViaConfig.java index d77cb32..c5a444a 100644 --- a/src/main/java/com/github/creeper123123321/viafabric/platform/VRViaConfig.java +++ b/src/main/java/com/github/creeper123123321/viafabric/platform/VRViaConfig.java @@ -296,4 +296,9 @@ public class VRViaConfig extends Config implements ViaVersionConfig { public boolean is1_14HitboxFix() { return false; } + + @Override + public boolean is1_15InstantRespawn() { + return this.getBoolean("use-1_15-instant-respawn", false); + } } \ No newline at end of file