Posted April 5, 20187 yr I'm working on GUI to play pong and I want to add multiplayer to it. I don't want the multiplayer menu to show up when the player is in singleplayer. I have mc.getMinecraft().isSingleplayer() called in the GUI's constructor to check if the player is playing singleplayer or not, but I'm having an issue. This works perfectly fine with dedicated servers, but when playing LAN, players who join isSingleplayer() is false, but true for the host. Is there any other way to fix this? (Or maybe a different way to check if on a server?) Edited April 5, 20187 yr by SuperHB solved MobDrops http://www.planetminecraft.com/mod/125-mobdrops/
April 5, 20187 yr Author 1 minute ago, diesieben07 said: Here is a simple condition to check if you are on a server: true. In all seriousness: Please clarify, Minecraft is always using a server. I meant if the player is in singleplayer or multiplayer. mc.getMinecraft().isSingleplayer() is false when I connect to a dedicated server or when I join a LAN server, but true if I host one. I thought once I turned on LAN to host, mc.getMinecraft().isSingleplayer() would become false, but it stays true, even if a player joins. Basically, when I host a LAN, I need someway to tell the GUI that the player is no longer playing singleplayer MobDrops http://www.planetminecraft.com/mod/125-mobdrops/
April 5, 20187 yr Author 5 minutes ago, diesieben07 said: So you want to check if more than one player is playing? On the client: NetHandlerPlayClient::getPlayerInfoMap().size() > 1 On the server: PlayerList::getPlayers().size() > 1 That works. Thanks MobDrops http://www.planetminecraft.com/mod/125-mobdrops/
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.