DBLouis Posted October 11, 2016 Posted October 11, 2016 Hi, world.isRemote should be set to false in a single player game, right ? Because I'm having an issue here : @SubscribeEvent public void onWorldLoad(WorldEvent.Load event) { World world = event.getWorld(); if (world.isRemote) { // Executed even in single player } } Is it normal ? Quote
larsgerrits Posted October 11, 2016 Posted October 11, 2016 Client side != Singleplayer! In singleplayer there is still a server running, only accessible for you unless you open to LAN. World#isRemote is true on the client side (rendering side), and false on the server side (logical side). Quote Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
Choonster Posted October 11, 2016 Posted October 11, 2016 Forge's documentation explains sides in more detail here. Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
DBLouis Posted October 11, 2016 Author Posted October 11, 2016 Then how can I test if the world is not local. Quote
Choonster Posted October 11, 2016 Posted October 11, 2016 On 10/11/2016 at 12:22 PM, Spooky4672 said: Then how can I test if the world is not local. What exactly do you mean by that? Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
DBLouis Posted October 11, 2016 Author Posted October 11, 2016 I think I found what I want : Minecraft.getMinecraft().isSingleplayer() With that I can now if this is a single player game. Quote
larsgerrits Posted October 11, 2016 Posted October 11, 2016 You can only use that on the client side, as the Minecraft class is client-side only. Quote Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
DBLouis Posted October 11, 2016 Author Posted October 11, 2016 Yeah, but that's the point. I wanna know, on the client, if this is a single or multiplayer game. Quote
DBLouis Posted October 11, 2016 Author Posted October 11, 2016 On 10/11/2016 at 7:14 PM, diesieben07 said: Why? This sounds like a terrible idea to me. Without context obviously ... I synchronize settings between dedicated server and clients, hence the 'not singleplayer' test. Quote
DBLouis Posted October 11, 2016 Author Posted October 11, 2016 This is different. Some blocks can be deactivated from the config file. If they are, so are the associated recipes. If a dedicated server deactivate blocks, the connected client should also deactivate them, because if not, the recipes will still show, but the result cannot be obtain. This is ugly. There might be other issues I'm not thinking about, but with this, the client is always configured the same way as a dedicated server, except for client only settings but there is only one for now. Quote
DBLouis Posted October 11, 2016 Author Posted October 11, 2016 It's tricky simply because there is no clean way to intercept that the integrated server has been opened to LAN. I searched for a few minutes and saw nothing: The IntegratedServer#shareToLAN method is called from the button or the command, but I didn't see any way to "register a listener" or something like that. Like you said, it's simpler to always send it. The client can just ignore it. Quote
Recommended Posts
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.