From 16929d5e2edea0a242015cc36403ddaabfe0ad83 Mon Sep 17 00:00:00 2001 From: creeper123123321 Date: Sat, 30 Mar 2019 17:47:01 -0300 Subject: [PATCH] 19w13b - Rebuild this when ViaBackwards#103 and ViaRewind#109 are merged --- build.gradle.kts | 12 +++++------ .../mixin/client/MixinMultiplayerScreen.java | 21 +++++++------------ .../Protocol1_8TO1_7_6_10.java | 14 +------------ 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7f37e7d..e33530f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -31,7 +31,7 @@ repositories { } -tasks.getByName("processResources").apply { +tasks.named("processResources") { filter("tokens" to mapOf( "version" to project.property("version"), "description" to project.property("description") @@ -43,17 +43,17 @@ configurations.getByName("compile").extendsFrom(shade) dependencies { // transitive = false, viabackwards-core because Guava is conflicting on runClient - shade("us.myles:viaversion:2.0.0-19w12b") { isTransitive = false } + shade("us.myles:viaversion:2.0.0-19w13b") { isTransitive = false } shade("de.gerrygames:viarewind-core:1.4.0") { isTransitive = false } - shade("nl.matsv:viabackwards-core:3.0.0-19w11b") { isTransitive = false } + shade("nl.matsv:viabackwards-core:3.0.0-19w13b") { isTransitive = false } compileOnly("com.google.code.findbugs:jsr305:3.0.2") - minecraft("com.mojang:minecraft:19w12b") - mappings("net.fabricmc:yarn:19w12b.3") + minecraft("com.mojang:minecraft:19w13b") + mappings("net.fabricmc:yarn:19w13b.2") modCompile("net.fabricmc:fabric-loader:0.3.7.109") - modCompile("net.fabricmc:fabric:0.2.5.114") + modCompile("net.fabricmc:fabric:0.2.6.117") } tasks.named("jar") { 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 402d552..2bea602 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 @@ -63,9 +63,9 @@ public abstract class MixinMultiplayerScreen extends Screen { throw e; } - @Inject(method = "method_2540", at = @At("TAIL")) - private void onInitWidgets(CallbackInfo ci) { - protocolVersion = new TextFieldWidget(fontRenderer, this.screenWidth / 2 + 88, 13, 65, 15); + @Inject(method = "init", at = @At("TAIL")) + private void onInit(CallbackInfo ci) { + protocolVersion = new TextFieldWidget(font, this.width / 2 + 88, 13, 65, 15); protocolVersion.method_1890(new VersionFormatFilter()); protocolVersion.setChangedListener((text) -> { protocolVersion.setSuggestion(null); @@ -101,9 +101,9 @@ public abstract class MixinMultiplayerScreen extends Screen { protocolVersion.setText(ProtocolVersion.isRegistered(clientSideVersion) ? ProtocolVersion.getProtocol(clientSideVersion).getName() : Integer.toString(clientSideVersion)); - this.listeners.add(protocolVersion); + this.children.add(protocolVersion); - enableClientSideViaVersion = new ButtonWidget(this.screenWidth / 2 + 48, 13, 105, 15, + enableClientSideViaVersion = new ButtonWidget(this.width / 2 + 48, 13, 105, 15, I18n.translate("gui.enable_client_side_button"), button -> MinecraftClient.getInstance().openScreen(new YesNoScreen( (answer, id) -> { @@ -129,18 +129,13 @@ public abstract class MixinMultiplayerScreen extends Screen { addButton(enableClientSideViaVersion); } - @Inject(method = "render", - at = { - @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Screen;render(IIF)V"), - @At(value = "INVOKE", target = "Lnet/minecraft/class_437;render(IIF)V") // Generated refmap doesn't have it - }, - remap = false) + @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Screen;render(IIF)V")) private void onRender(int int_1, int int_2, float float_1, CallbackInfo ci) { protocolVersion.render(int_1, int_2, float_1); } - @Inject(method = "update", at = @At("TAIL")) - private void onUpdate(CallbackInfo ci) { + @Inject(method = "tick", at = @At("TAIL")) + private void onTick(CallbackInfo ci) { protocolVersion.tick(); } diff --git a/src/main/java/com/github/creeper123123321/viafabric/protocol/protocol1_8to1_7_6_10/Protocol1_8TO1_7_6_10.java b/src/main/java/com/github/creeper123123321/viafabric/protocol/protocol1_8to1_7_6_10/Protocol1_8TO1_7_6_10.java index a512daa..62c665e 100644 --- a/src/main/java/com/github/creeper123123321/viafabric/protocol/protocol1_8to1_7_6_10/Protocol1_8TO1_7_6_10.java +++ b/src/main/java/com/github/creeper123123321/viafabric/protocol/protocol1_8to1_7_6_10/Protocol1_8TO1_7_6_10.java @@ -1575,19 +1575,7 @@ public class Protocol1_8TO1_7_6_10 extends Protocol { packetWrapper.writeToBuffer(newPacketBuf); PacketWrapper newWrapper = new PacketWrapper(0x17, newPacketBuf, packetWrapper.user()); newWrapper.passthrough(Type.STRING); - final int[] length = new int[1]; - newWrapper.read(new Type(Void.class) { - @Override - public Void read(ByteBuf byteBuf) { - length[0] = byteBuf.readableBytes(); - return null; - } - - @Override - public void write(ByteBuf byteBuf, Void aVoid) { - } - }); - newWrapper.write(Type.SHORT, (short) length[0]); + newWrapper.write(Type.SHORT, (short) newPacketBuf.readableBytes()); newWrapper.sendToServer(Protocol1_8TO1_7_6_10.class, true, true); } });