diff --git a/examplemods/servermod.js b/examplemods/servermod.js index f257a70..086aecb 100644 --- a/examplemods/servermod.js +++ b/examplemods/servermod.js @@ -1,5 +1,5 @@ (function servermod() { - ModAPI.meta.title("Server Manager Mod Thingy"); + ModAPI.meta.title("Server Manager"); ModAPI.meta.version("a0"); ModAPI.meta.description("_"); ModAPI.meta.credits("ZXMushroom63 & radmanplays"); @@ -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