mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Merge branch 'master' into feature/1.20.5
This commit is contained in:
commit
efda13421f
12 changed files with 77 additions and 29 deletions
|
@ -128,7 +128,9 @@ public abstract class GeyserModBootstrap implements GeyserBootstrap {
|
|||
// We want to do this late in the server startup process to allow other mods
|
||||
// To do their job injecting, then connect into *that*
|
||||
this.geyserInjector = new GeyserModInjector(server, this.platform);
|
||||
this.geyserInjector.initializeLocalChannel(this);
|
||||
if (isServer()) {
|
||||
this.geyserInjector.initializeLocalChannel(this);
|
||||
}
|
||||
|
||||
// Start command building
|
||||
// Set just "geyser" as the help command
|
||||
|
@ -248,7 +250,19 @@ public abstract class GeyserModBootstrap implements GeyserBootstrap {
|
|||
|
||||
@Override
|
||||
public int getServerPort() {
|
||||
return ((GeyserServerPortGetter) server).geyser$getServerPort();
|
||||
if (isServer()) {
|
||||
return ((GeyserServerPortGetter) server).geyser$getServerPort();
|
||||
} else {
|
||||
// Set in the IntegratedServerMixin
|
||||
return geyserConfig.getRemote().port();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract boolean isServer();
|
||||
|
||||
@Override
|
||||
public @Nullable SocketAddress getSocketAddress() {
|
||||
return this.geyserInjector.getServerSocketAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -54,8 +54,10 @@ public class IntegratedServerMixin implements GeyserServerPortGetter {
|
|||
private void onOpenToLan(GameType gameType, boolean cheatsAllowed, int port, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (cir.getReturnValueZ()) {
|
||||
// If the LAN is opened, starts Geyser.
|
||||
GeyserModBootstrap.getInstance().setServer((MinecraftServer) (Object) this);
|
||||
GeyserModBootstrap.getInstance().onGeyserEnable();
|
||||
GeyserModBootstrap instance = GeyserModBootstrap.getInstance();
|
||||
instance.setServer((MinecraftServer) (Object) this);
|
||||
instance.getGeyserConfig().getRemote().setPort(port);
|
||||
instance.onGeyserEnable();
|
||||
// Ensure player locale has been loaded, in case it's different from Java system language
|
||||
GeyserLocale.loadGeyserLocale(this.minecraft.options.languageCode);
|
||||
// Give indication that Geyser is loaded
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue