This commit is contained in:
Gerrygames 2019-09-12 14:14:48 +02:00
parent 5e826dd80b
commit 5fa44cb0df
5 changed files with 29 additions and 24 deletions

View File

@ -46,16 +46,16 @@ tasks.named<ProcessResources>("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")

View File

@ -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)));
}
}

View File

@ -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")
)),

View File

@ -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) {
}

View File

@ -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);
}
}