update deps, fix legacy fabric

This commit is contained in:
creeper123123321 2022-04-21 12:58:25 -03:00
parent b18697c15e
commit b0fb3c0399
10 changed files with 31 additions and 35 deletions

View File

@ -1,6 +1,7 @@
# rip my ram # rip my ram
# suppress inspection "UnusedProperty"
org.gradle.jvmargs=-Xms32M -Xmx4G org.gradle.jvmargs=-Xms32M -Xmx4G
loader_version=0.13.3 loader_version=0.13.3
viaver_version=4.3.0-22w12a-SNAPSHOT viaver_version=4.3.0-22w16b-SNAPSHOT
yaml_version=1.30 yaml_version=1.30

View File

@ -1,7 +1,7 @@
dependencies { dependencies {
minecraft("com.mojang:minecraft:1.18.2") minecraft("com.mojang:minecraft:1.18.2")
mappings("net.fabricmc:yarn:1.18.2+build.1:v2") mappings("net.fabricmc:yarn:1.18.2+build.3:v2")
modImplementation("net.fabricmc.fabric-api:fabric-api:0.47.8+1.18.2") modImplementation("net.fabricmc.fabric-api:fabric-api:0.51.1+1.18.2")
modImplementation("com.terraformersmc:modmenu:3.0.0") modImplementation("com.terraformersmc:modmenu:3.0.0")
} }

View File

@ -1,7 +1,7 @@
dependencies { dependencies {
minecraft("com.mojang:minecraft:22w11a") minecraft("com.mojang:minecraft:22w16b")
mappings("net.fabricmc:yarn:22w11a+build.2:v2") mappings("net.fabricmc:yarn:22w16b+build.3:v2")
modImplementation("net.fabricmc.fabric-api:fabric-api:0.49.2+1.19") modImplementation("net.fabricmc.fabric-api:fabric-api:0.51.2+1.19")
modImplementation("com.terraformersmc:modmenu:3.0.0") modImplementation("com.terraformersmc:modmenu:3.0.0")
} }

View File

@ -8,7 +8,7 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.TexturedButtonWidget; import net.minecraft.client.gui.widget.TexturedButtonWidget;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class ViaFabricClient implements ClientModInitializer { public class ViaFabricClient implements ClientModInitializer {
@ -28,7 +28,7 @@ public class ViaFabricClient implements ClientModInitializer {
new Identifier("viafabric:textures/gui/widgets.png"), new Identifier("viafabric:textures/gui/widgets.png"),
256, 256, // Texture size 256, 256, // Texture size
it -> MinecraftClient.getInstance().setScreen(new ViaConfigScreen(screen)), it -> MinecraftClient.getInstance().setScreen(new ViaConfigScreen(screen)),
new TranslatableText("gui.via_button")); Text.translatable("gui.via_button"));
if (ViaFabric.config.isHideButton()) enableClientSideViaVersion.visible = false; if (ViaFabric.config.isHideButton()) enableClientSideViaVersion.visible = false;
Screens.getButtons(screen).add(enableClientSideViaVersion); Screens.getButtons(screen).add(enableClientSideViaVersion);
}); });

View File

@ -12,7 +12,7 @@ import net.minecraft.client.gui.screen.ScreenTexts;
import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -23,7 +23,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
private TextFieldWidget protocolVersion; private TextFieldWidget protocolVersion;
public ViaConfigScreen(Screen parent) { public ViaConfigScreen(Screen parent) {
super(new TranslatableText(TITLE_TRANSLATE_ID)); super(Text.translatable(TITLE_TRANSLATE_ID));
this.parent = parent; this.parent = parent;
} }
@ -47,7 +47,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
this.width / 2 - 155 + entries % 2 * 160, this.width / 2 - 155 + entries % 2 * 160,
this.height / 6 + 24 * (entries >> 1), this.height / 6 + 24 * (entries >> 1),
150, 150,
20, new TranslatableText("gui.protocol_version_field.name")); 20, Text.translatable("gui.protocol_version_field.name"));
entries++; entries++;
protocolVersion.setTextPredicate(ProtocolUtils::isStartOfProtocolText); protocolVersion.setTextPredicate(ProtocolUtils::isStartOfProtocolText);
@ -105,10 +105,10 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
} }
MinecraftClient.getInstance().setScreen(this); MinecraftClient.getInstance().setScreen(this);
}, },
new TranslatableText("gui.enable_client_side.question"), Text.translatable("gui.enable_client_side.question"),
new TranslatableText("gui.enable_client_side.warning"), Text.translatable("gui.enable_client_side.warning"),
new TranslatableText("gui.enable_client_side.enable"), Text.translatable("gui.enable_client_side.enable"),
new TranslatableText("gui.cancel") Text.translatable("gui.cancel")
)); ));
} else { } else {
ViaFabric.config.setClientSideEnabled(false); ViaFabric.config.setClientSideEnabled(false);
@ -127,15 +127,15 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
this.client.setScreen(this.parent); this.client.setScreen(this.parent);
} }
private TranslatableText getClientSideText() { private Text getClientSideText() {
return ViaFabric.config.isClientSideEnabled() ? return ViaFabric.config.isClientSideEnabled() ?
new TranslatableText("gui.client_side.disable") Text.translatable("gui.client_side.disable")
: new TranslatableText("gui.client_side.enable"); : Text.translatable("gui.client_side.enable");
} }
private TranslatableText getHideViaButtonText() { private Text getHideViaButtonText() {
return ViaFabric.config.isHideButton() ? return ViaFabric.config.isHideButton() ?
new TranslatableText("gui.hide_via_button.disable") : new TranslatableText("gui.hide_via_button.enable"); Text.translatable("gui.hide_via_button.disable") : Text.translatable("gui.hide_via_button.enable");
} }
private void onHideViaButton(ButtonWidget widget) { private void onHideViaButton(ButtonWidget widget) {

View File

@ -8,7 +8,6 @@ import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget; import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget;
import net.minecraft.client.network.ServerInfo; import net.minecraft.client.network.ServerInfo;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@ -40,7 +39,7 @@ public class MixinServerEntry {
private void addServerVer(MultiplayerScreen multiplayerScreen, List<Text> tooltipText) { private void addServerVer(MultiplayerScreen multiplayerScreen, List<Text> tooltipText) {
ProtocolVersion proto = ProtocolVersion.getProtocol(((ViaServerInfo) this.server).getViaServerVer()); ProtocolVersion proto = ProtocolVersion.getProtocol(((ViaServerInfo) this.server).getViaServerVer());
List<Text> lines = new ArrayList<>(tooltipText); List<Text> lines = new ArrayList<>(tooltipText);
lines.add(new TranslatableText("gui.ping_version.translated", proto.getName())); lines.add(Text.translatable("gui.ping_version.translated", proto.getName()));
multiplayerScreen.setTooltip(lines); multiplayerScreen.setTooltip(lines);
} }
} }

View File

@ -18,7 +18,6 @@ import net.minecraft.network.packet.c2s.query.QueryRequestC2SPacket;
import net.minecraft.network.packet.s2c.query.QueryPongS2CPacket; import net.minecraft.network.packet.s2c.query.QueryPongS2CPacket;
import net.minecraft.network.packet.s2c.query.QueryResponseS2CPacket; import net.minecraft.network.packet.s2c.query.QueryResponseS2CPacket;
import net.minecraft.server.ServerMetadata; import net.minecraft.server.ServerMetadata;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
@ -79,17 +78,17 @@ public class ProtocolAutoDetector {
} else { } else {
future.completeExceptionally(new IllegalArgumentException("Null version in query response")); future.completeExceptionally(new IllegalArgumentException("Null version in query response"));
} }
clientConnection.disconnect(LiteralText.EMPTY); clientConnection.disconnect(Text.empty());
} }
@Override @Override
public void onPong(QueryPongS2CPacket packet) { public void onPong(QueryPongS2CPacket packet) {
clientConnection.disconnect(new LiteralText("Pong not requested!")); clientConnection.disconnect(Text.literal("Pong not requested!"));
} }
@Override @Override
public void onDisconnected(Text reason) { public void onDisconnected(Text reason) {
future.completeExceptionally(new IllegalStateException(reason.asString())); future.completeExceptionally(new IllegalStateException(reason.getString()));
} }
@Override @Override

View File

@ -2,9 +2,7 @@ dependencies {
minecraft("com.mojang:minecraft:1.8.9") minecraft("com.mojang:minecraft:1.8.9")
mappings("net.fabricmc:yarn:1.8.9+build.202112162000:v2") mappings("net.fabricmc:yarn:1.8.9+build.202112162000:v2")
modImplementation("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:1.2.2+1.8.9") { modImplementation("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:1.4.2+1.8.9")
exclude(module = "fabric-loader-1.8.9")
}
modImplementation("io.github.boogiemonster1o1:rewoven-modmenu:1.0.0+1.8.9") { modImplementation("io.github.boogiemonster1o1:rewoven-modmenu:1.0.0+1.8.9") {
isTransitive = false isTransitive = false
} }

View File

@ -62,7 +62,7 @@ public class ViaFabric implements ModInitializer {
FabricLoader.getInstance().getEntrypoints("viafabric:via_api_initialized", Runnable.class).forEach(Runnable::run); FabricLoader.getInstance().getEntrypoints("viafabric:via_api_initialized", Runnable.class).forEach(Runnable::run);
registerCommandsV0(); registerCommandsV1();
config = new VFConfig(FabricLoader.getInstance().getConfigDir().resolve("ViaFabric") config = new VFConfig(FabricLoader.getInstance().getConfigDir().resolve("ViaFabric")
.resolve("viafabric.yml").toFile()); .resolve("viafabric.yml").toFile());
@ -70,10 +70,9 @@ public class ViaFabric implements ModInitializer {
INIT_FUTURE.complete(null); INIT_FUTURE.complete(null);
} }
private void registerCommandsV0() { private void registerCommandsV1() {
try { try {
// todo fix this, legacy fabric mapping is broken CommandRegistry.INSTANCE.register(new NMSCommandImpl(Via.getManager().getCommandHandler()));
//CommandRegistry.INSTANCE.register(new NMSCommandImpl(Via.getManager().getCommandHandler()));
} catch (NoClassDefFoundError ignored2) { } catch (NoClassDefFoundError ignored2) {
JLOGGER.info("Couldn't register command as Fabric Commands isn't installed"); JLOGGER.info("Couldn't register command as Fabric Commands isn't installed");
} }

View File

@ -36,12 +36,12 @@
] ]
}, },
"depends": { "depends": {
"legacy-rewoven-resource-loader-v1": "*", "legacy-fabric-resource-loader-v1": "*",
"minecraft": "1.8.x", "minecraft": "1.8.x",
"viafabric": "*" "viafabric": "*"
}, },
"recommends": { "recommends": {
"fabric-command-api-v0": "*" "legacy-fabric-command-api-v1": "*"
}, },
"mixins": [ "mixins": [
"mixins.viafabric18.address.json", "mixins.viafabric18.address.json",