Java Code Examples for net.minecraft.world.WorldServer#getSeed()

The following examples show how to use net.minecraft.world.WorldServer#getSeed() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DebugCommand.java    From TFC2 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] params)
{
	EntityPlayerMP player;
	try {
		player = getCommandSenderAsPlayer(sender);
	} catch (PlayerNotFoundException e) {
		return;
	}
	WorldServer world = server.worldServerForDimension(player.getEntityWorld().provider.getDimension());

	if(params.length == 1 && params[0].equalsIgnoreCase("report"))
	{
		int xM =player.getPosition().getX() >> 12;
		int zM =player.getPosition().getZ() >> 12;
		String out = "World Seed: [" + world.getSeed() + "] | IslandMap: [" +xM + "," + zM + "] | PlayerPos: [" + player.getPosition().toString() + "]";
		StringSelection selection = new StringSelection(out);
		Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
		if(clipboard != null)
			clipboard.setContents(selection, selection);

	}
}
 
Example 2
Source File: WorldRetrogen.java    From simpleretrogen with GNU General Public License v3.0 5 votes vote down vote up
private void runRetrogen(WorldServer world, ChunkPos chunkCoords, String retroClass)
{
    long worldSeed = world.getSeed();
    Random fmlRandom = new Random(worldSeed);
    long xSeed = fmlRandom.nextLong() >> 2 + 1L;
    long zSeed = fmlRandom.nextLong() >> 2 + 1L;
    long chunkSeed = (xSeed * chunkCoords.chunkXPos + zSeed * chunkCoords.chunkZPos) ^ worldSeed;

    fmlRandom.setSeed(chunkSeed);
    ChunkProviderServer providerServer = world.getChunkProvider();
    IChunkGenerator generator = ObfuscationReflectionHelper.getPrivateValue(ChunkProviderServer.class, providerServer, "field_186029_c", "chunkGenerator");
    delegates.get(retroClass).delegate.generate(fmlRandom, chunkCoords.chunkXPos, chunkCoords.chunkZPos, world, generator, providerServer);
    FMLLog.fine("Retrogenerated chunk for %s", retroClass);
    completeRetrogen(chunkCoords, world, retroClass);
}
 
Example 3
Source File: TeleporterMagicLand.java    From mobycraft with Apache License 2.0 4 votes vote down vote up
public TeleporterMagicLand(WorldServer worldserver) {
	super(worldserver);
	this.worldServerInstance = worldserver;
	this.random = new Random(worldserver.getSeed());

}