Updated Classic4J to 2.0.0

This commit is contained in:
FlorianMichael 2023-10-08 00:22:29 +02:00
parent c3b079a055
commit 966936283d
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
4 changed files with 13 additions and 15 deletions

View File

@ -15,7 +15,7 @@ archives_base_name=viafabricplus
# base lib
raknet_transport_version=1.0.0.CR1-SNAPSHOT
classic4j_version=1.2.1
classic4j_version=2.0.1-SNAPSHOT
# viaversion (and required) libs
viaversion_version=4.9.0-23w40a-SNAPSHOT

View File

@ -18,7 +18,7 @@
package de.florianmichael.viafabricplus.protocolhack.provider.vialegacy;
import com.viaversion.viaversion.api.connection.UserConnection;
import de.florianmichael.classic4j.JSPBetaCraftHandler;
import de.florianmichael.classic4j.BetaCraftHandler;
import de.florianmichael.viafabricplus.integration.Classic4JImpl;
import de.florianmichael.viafabricplus.base.settings.groups.AuthenticationSettings;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicMPPassProvider;
@ -34,7 +34,7 @@ public class ViaFabricPlusClassicMPPassProvider extends ClassicMPPassProvider {
if (AuthenticationSettings.INSTANCE.useBetaCraftAuthentication.getValue()) {
final HandshakeStorage handshakeStorage = user.get(HandshakeStorage.class);
return JSPBetaCraftHandler.requestMPPass(user.getProtocolInfo().getUsername(), handshakeStorage.getHostname(), handshakeStorage.getPort(), Classic4JImpl.JOIN_SERVER_CALL);
return BetaCraftHandler.requestMPPass(user.getProtocolInfo().getUsername(), handshakeStorage.getHostname(), handshakeStorage.getPort(), Classic4JImpl.JOIN_SERVER_CALL);
} else {
return super.getMpPass(user);
}

View File

@ -74,7 +74,7 @@ public class ProtocolSelectionScreen extends VFPScreen {
if (BetaCraftScreen.SERVER_LIST == null) {
betaCraftButton = button;
BetaCraftHandler.requestServerList(serverList -> {
BetaCraftHandler.requestV1ServerList(serverList -> {
BetaCraftScreen.SERVER_LIST = serverList;
BetaCraftScreen.INSTANCE.open(this);

View File

@ -17,11 +17,9 @@
*/
package de.florianmichael.viafabricplus.screen.thirdparty;
import de.florianmichael.classic4j.model.betacraft.BCServerInfo;
import de.florianmichael.classic4j.model.betacraft.BCServerInfoSpec;
import de.florianmichael.classic4j.model.betacraft.BCServerList;
import de.florianmichael.classic4j.model.betacraft.BCVersion;
import de.florianmichael.viafabricplus.definition.ClientsideFixes;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import de.florianmichael.classic4j.model.betacraft.BCVersionCategory;
import de.florianmichael.viafabricplus.base.screen.MappedSlotEntry;
import de.florianmichael.viafabricplus.base.screen.VFPScreen;
import de.florianmichael.viafabricplus.screen.settings.settingrenderer.meta.TitleRenderer;
@ -72,11 +70,11 @@ public class BetaCraftScreen extends VFPScreen {
super(minecraftClient, width, height, top, bottom, entryHeight);
if (SERVER_LIST == null) return;
for (BCVersion value : BCVersion.values()) {
final List<BCServerInfo> servers = SERVER_LIST.serversOfVersion(value);
for (BCVersionCategory value : BCVersionCategory.values()) {
final List<BCServerInfoSpec> servers = SERVER_LIST.serversOfVersionCategory(value);
if (servers.isEmpty()) continue;
addEntry(new TitleRenderer(Text.literal(value.name())));
for (BCServerInfo server : servers) {
for (BCServerInfoSpec server : servers) {
addEntry(new ServerSlot(server));
}
}
@ -94,9 +92,9 @@ public class BetaCraftScreen extends VFPScreen {
}
public static class ServerSlot extends MappedSlotEntry {
private final BCServerInfo server;
private final BCServerInfoSpec server;
public ServerSlot(BCServerInfo server) {
public ServerSlot(BCServerInfoSpec server) {
this.server = server;
}
@ -107,7 +105,7 @@ public class BetaCraftScreen extends VFPScreen {
@Override
public void mappedMouseClicked(double mouseX, double mouseY, int button) {
final ServerAddress serverAddress = ServerAddress.parse(server.host() + ":" + server.port());
final ServerAddress serverAddress = ServerAddress.parse(server.socketAddress());
final ServerInfo entry = new ServerInfo(server.name(), serverAddress.getAddress(), ServerInfo.ServerType.OTHER);
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry, false);
@ -117,7 +115,7 @@ public class BetaCraftScreen extends VFPScreen {
@Override
public void mappedRender(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
context.drawCenteredTextWithShadow(textRenderer, server.name() + Formatting.DARK_GRAY + " [" + server.gameVersion() + "]", entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
context.drawCenteredTextWithShadow(textRenderer, server.name() + Formatting.DARK_GRAY + " [" + server.connectVersion() + "]", entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
if (server.onlineMode()) {
context.drawTextWithShadow(textRenderer, Text.translatable("misc.viafabricplus.online").formatted(Formatting.GREEN), 1, 1, -1);