Update servermod.js

This commit is contained in:
radmanplays 2024-10-17 13:36:53 +03:30 committed by GitHub
parent e89e0044a9
commit ea2db9d667
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,6 +44,7 @@
function worldUpdate() {
if (ModAPI.mc && ModAPI.mc.theWorld) {
showgui();
openSharedWorld()
} else {
hidegui();
}
@ -67,6 +68,22 @@
}
function openSharedWorld(){
if(ModAPI.mc.theWorld && !ModAPI.hooks.methods.nlevsl_LANServerController_isLANOpen()){
ModAPI.hooks.methods.nlevi_PlatformWebRTC_startRTCLANServer();
var worldName = ModAPI.mc.thePlayer.getName() + "'s World";
var ls = ModAPI.mc.loadingScreen;
var code = ModAPI.hooks.methods.nlevsl_LANServerController_shareToLAN(ls.resetProgressAndMessage, worldName, false)
if (code != null) {
ModAPI.hooks.methods.nlevs_SingleplayerServerController_configureLAN(ModAPI.mc.playerController.getCurrentGameType(), false);
alert("code: " + code +" relay: " + ModAPI.hooks.methods.nlevsl_LANServerController_getCurrentURI())
}
} else {
return;
}
}
/*
NETWORKING OPCODES
chat - bidirectional, send chat to server/client