diff --git a/core/src/main/java/com/rtm516/mcxboxbroadcast/core/ExpandedSessionInfo.java b/core/src/main/java/com/rtm516/mcxboxbroadcast/core/ExpandedSessionInfo.java index 9788805..bcb6c58 100644 --- a/core/src/main/java/com/rtm516/mcxboxbroadcast/core/ExpandedSessionInfo.java +++ b/core/src/main/java/com/rtm516/mcxboxbroadcast/core/ExpandedSessionInfo.java @@ -1,5 +1,6 @@ package com.rtm516.mcxboxbroadcast.core; +import java.math.BigInteger; import java.util.Random; import java.util.UUID; @@ -12,7 +13,7 @@ public class ExpandedSessionInfo extends SessionInfo { private String sessionId; private String handleId; - private long webrtcNetworkId; + private BigInteger netherNetId; private String deviceId; ExpandedSessionInfo(String connectionId, String xuid, SessionInfo sessionInfo) { @@ -21,7 +22,7 @@ public class ExpandedSessionInfo extends SessionInfo { this.rakNetGUID = ""; this.sessionId = UUID.randomUUID().toString(); - this.webrtcNetworkId = Math.abs(RANDOM.nextLong()); + this.netherNetId = BigInteger.valueOf(Math.abs(RANDOM.nextLong())); this.deviceId = UUID.randomUUID().toString(); setHostName(sessionInfo.getHostName()); @@ -77,8 +78,8 @@ public void setSessionId(String sessionId) { this.sessionId = sessionId; } - public long getWebrtcNetworkId() { - return webrtcNetworkId; + public BigInteger getNetherNetId() { + return netherNetId; } public String getDeviceId() { diff --git a/core/src/main/java/com/rtm516/mcxboxbroadcast/core/SessionManagerCore.java b/core/src/main/java/com/rtm516/mcxboxbroadcast/core/SessionManagerCore.java index 07153b3..27a668f 100644 --- a/core/src/main/java/com/rtm516/mcxboxbroadcast/core/SessionManagerCore.java +++ b/core/src/main/java/com/rtm516/mcxboxbroadcast/core/SessionManagerCore.java @@ -376,7 +376,7 @@ protected String setupSession() { HttpRequest request = HttpRequest.newBuilder(Constants.START_SESSION) .header("Content-Type", "application/json") - .POST(HttpRequest.BodyPublishers.ofString(SessionStartBody.create(sessionInfo, playfabTicket))) + .POST(HttpRequest.BodyPublishers.ofString(SessionStartBody.create(sessionInfo.getDeviceId(), playfabTicket))) .build(); HttpResponse response; diff --git a/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/auth/SessionStartBody.java b/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/auth/SessionStartBody.java index 7ec5b18..63e548f 100644 --- a/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/auth/SessionStartBody.java +++ b/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/auth/SessionStartBody.java @@ -5,13 +5,13 @@ import java.util.HashMap; public final class SessionStartBody { - public static String create(ExpandedSessionInfo info, String playfabSessionTicket) { + public static String create(String deviceId, String playfabSessionTicket) { return Constants.GSON_NULLS.toJson(new HashMap<>() {{ put("device", new HashMap<>() {{ put("applicationType", "MinecraftPE"); put("capabilities", new String[0]); // it's RayTracing for me put("gameVersion", "1.21.20"); - put("id", info.getDeviceId()); + put("id", deviceId); put("memory", "8589934592"); // exactly 8GiB put("platform", "Windows10"); // idk if it matters but the auth was with Android put("playFabTitleId", "20CA2"); diff --git a/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/session/Connection.java b/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/session/Connection.java index 7016c0e..8250d37 100644 --- a/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/session/Connection.java +++ b/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/session/Connection.java @@ -2,14 +2,15 @@ import com.rtm516.mcxboxbroadcast.core.Constants; +import java.math.BigInteger; + public record Connection( int ConnectionType, String HostIpAddress, int HostPort, - long NetherNetId, - long WebRTCNetworkId + BigInteger NetherNetId ) { - public Connection(long webrtcNetworkId) { - this(Constants.ConnectionTypeWebRTC, "", 0, webrtcNetworkId, webrtcNetworkId); + public Connection(BigInteger netherNetId) { + this(Constants.ConnectionTypeWebRTC, "", 0, netherNetId); } } diff --git a/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/session/CreateSessionRequest.java b/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/session/CreateSessionRequest.java index 3e0dfa3..a212fec 100644 --- a/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/session/CreateSessionRequest.java +++ b/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/session/CreateSessionRequest.java @@ -17,14 +17,13 @@ public CreateSessionRequest(ExpandedSessionInfo sessionInfo) { sessionInfo.getMaxPlayers(), sessionInfo.getPlayers(), true, - Collections.singletonList(new Connection(sessionInfo.getWebrtcNetworkId())), + Collections.singletonList(new Connection(sessionInfo.getNetherNetId())), 0, 2, "level", sessionInfo.getHostName(), sessionInfo.getXuid(), "", - sessionInfo.getWebrtcNetworkId(), sessionInfo.getWorldName(), "Survival", sessionInfo.getProtocol(), diff --git a/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/session/SessionCustomProperties.java b/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/session/SessionCustomProperties.java index 5485b5c..9375cb0 100644 --- a/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/session/SessionCustomProperties.java +++ b/core/src/main/java/com/rtm516/mcxboxbroadcast/core/models/session/SessionCustomProperties.java @@ -17,7 +17,6 @@ public record SessionCustomProperties( String hostName, String ownerId, String rakNetGUID, - long WebRTCNetworkId, String worldName, String worldType, int protocol, diff --git a/core/src/main/java/com/rtm516/mcxboxbroadcast/core/webrtc/RtcWebsocketClient.java b/core/src/main/java/com/rtm516/mcxboxbroadcast/core/webrtc/RtcWebsocketClient.java index 14f2757..832a5a2 100644 --- a/core/src/main/java/com/rtm516/mcxboxbroadcast/core/webrtc/RtcWebsocketClient.java +++ b/core/src/main/java/com/rtm516/mcxboxbroadcast/core/webrtc/RtcWebsocketClient.java @@ -55,7 +55,7 @@ public class RtcWebsocketClient extends WebSocketClient { * @param scheduledExecutorService The executor service to use for scheduling tasks */ public RtcWebsocketClient(String authenticationToken, ExpandedSessionInfo sessionInfo, Logger logger, ScheduledExecutorService scheduledExecutorService) { - super(URI.create(Constants.RTC_WEBSOCKET_FORMAT.formatted(sessionInfo.getWebrtcNetworkId()))); + super(URI.create(Constants.RTC_WEBSOCKET_FORMAT.formatted(sessionInfo.getNetherNetId()))); addHeader("Authorization", authenticationToken); // both seem random addHeader("Session-Id", UUID.randomUUID().toString());