forked from Lunatrius/Schematica
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from mist475/master
Save Schematic Location
- Loading branch information
Showing
11 changed files
with
262 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/github/lunatrius/schematica/client/util/WorldServerName.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.github.lunatrius.schematica.client.util; | ||
|
||
import cpw.mods.fml.common.FMLCommonHandler; | ||
import net.minecraft.client.Minecraft; | ||
|
||
public class WorldServerName { | ||
/** | ||
* Gets the world name if in singleplayer, or the name in server list when in multiplayer | ||
* @param mc {@link Minecraft} | ||
* @return {@link String} world name or server name | ||
*/ | ||
public static String worldServerName(Minecraft mc) { | ||
String WorldOrServerName; | ||
if (mc.isSingleplayer()) { | ||
WorldOrServerName = FMLCommonHandler.instance().getMinecraftServerInstance().getWorldName(); | ||
} else { | ||
//Gets the server data, only works if you're playing on a server. if you're using direct connect the name will be "Minecraft Server". Crashes if singleplayer | ||
WorldOrServerName = mc.func_147104_D().serverName; | ||
} | ||
return WorldOrServerName; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.