Java Code Examples for net.minecraft.world.World.getSeed()

The following are Jave code examples for showing how to use getSeed() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: modName   File: BiomeProviderATG.java   Source Code and License Vote up 6 votes
public BiomeProviderATG(World world)
{
    this.world = world;
    this.settings = WorldSettings.loadWorldSettings(world).biomeSettings;

    this.noise = new CoreNoise(world.getSeed());

    this.fuzz = new Random();
    this.biomeCache = new BiomeCache(this);
    this.biomesToSpawnIn = Lists.newArrayList(allowedBiomes);

    this.biomeRegistry = new BiomeRegistry();
    this.biomeRegistry.populate(this.settings);

    // TODO: Set things based on the world settings
}
 
Example 2
Project: CustomWorldGen   File: GameRegistry.java   Source Code and License Vote up 6 votes
/**
 * Callback hook for world gen - if your mod wishes to add extra mod related generation to the world
 * call this
 *
 * @param chunkX         Chunk X coordinate
 * @param chunkZ         Chunk Z coordinate
 * @param world          World we're generating into
 * @param chunkGenerator The chunk generator
 * @param chunkProvider  The chunk provider
 */
public static void generateWorld(int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    if (sortedGeneratorList == null)
    {
        computeSortedGeneratorList();
    }
    long worldSeed = world.getSeed();
    Random fmlRandom = new Random(worldSeed);
    long xSeed = fmlRandom.nextLong() >> 2 + 1L;
    long zSeed = fmlRandom.nextLong() >> 2 + 1L;
    long chunkSeed = (xSeed * chunkX + zSeed * chunkZ) ^ worldSeed;

    for (IWorldGenerator generator : sortedGeneratorList)
    {
        fmlRandom.setSeed(chunkSeed);
        generator.generate(fmlRandom, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
    }
}
 
Example 3
Project: ExPetrum   File: GenerationHelper.java   Source Code and License Vote up 6 votes
public static EnumRockClass getStoneTypeAt(World w, BlockPos at)
{
	if (lastRememberedSeed != w.getSeed())
	{
		rand.setSeed(w.getSeed());
		offsetStone = new Vec3i(rand.nextInt(300000) - rand.nextInt(300000), 0, rand.nextInt(300000) - rand.nextInt(300000));
		offsetDirt = new Vec3i(rand.nextInt(300000) - rand.nextInt(300000), 0, rand.nextInt(300000) - rand.nextInt(300000));
	}
	
	BlockPos actual = at.add(offsetStone);
	
	try
	{
		FeatureProvider provider = ((BiomeProviderExP)w.getBiomeProvider()).featureProvider;
		return EnumRockClass.values()[Math.abs(provider.getByte(actual, provider.cacheRocks)) % 16];
	}
	catch (Exception ex)
	{
		ex.printStackTrace();
		return EnumRockClass.ANDESITE;
	}
}
 
Example 4
Project: ExPetrum   File: GenerationHelper.java   Source Code and License Vote up 6 votes
public static EnumDirtClass getDirtTypeAt(World w, BlockPos at)
{
	if (lastRememberedSeed != w.getSeed())
	{
		rand.setSeed(w.getSeed());
		offsetStone = new Vec3i(rand.nextInt(300000) - rand.nextInt(300000), 0, rand.nextInt(300000) - rand.nextInt(300000));
		offsetDirt = new Vec3i(rand.nextInt(300000) - rand.nextInt(300000), 0, rand.nextInt(300000) - rand.nextInt(300000));
	}
	
	BlockPos actual = at.add(offsetDirt);
	
	try
	{
		FeatureProvider provider = ((BiomeProviderExP)w.getBiomeProvider()).featureProvider;
		return EnumDirtClass.values()[Math.abs(provider.getByte(actual, provider.cacheSoil)) % 16];
	}
	catch (Exception ex)
	{
		ex.printStackTrace();
		return EnumDirtClass.ACRISOL;
	}
}
 
Example 5
Project: Randores2   File: RandoresWorldData.java   Source Code and License Vote up 5 votes
private static long genSeed(World world) {
    Random prng = new Random(world.getSeed());
    long seed = prng.nextLong();
    while (seed == 0) {
        seed = prng.nextLong();
    }
    return seed;
}
 
Example 6
Project: modName   File: ChunkProviderBasic.java   Source Code and License Vote up 5 votes
public ChunkProviderBasic(World world) {
    this.world = world;
    this.random = new Random(world.getSeed());
    this.structuresEnabled = this.world.getWorldInfo().isMapFeaturesEnabled();

    this.surfaceNoise = new NoiseGeneratorPerlin(this.random, 4);

    this.initFeatures();
}
 
Example 7
Project: OpenSensors   File: ItemWorldSensor.java   Source Code and License Vote up 5 votes
@Override
@Callback
public Object[] get(Context context, Arguments args, World worldIn, TileEntitySensor teIn) {
	if (args.checkString(0).equalsIgnoreCase("biome")) {
		return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).biomeName };
	} else if (args.checkString(0).equalsIgnoreCase("lightlevel")) {
		return new Object[] { worldIn.getBlockLightValue((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.yCoord + rangeLimit(rangeLimit(args.optInteger(1, 0)))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))) };
	} else if (args.checkString(0).equalsIgnoreCase("raining")) {
		return new Object[] { worldIn.isRaining() };
	} else if (args.checkString(0).equalsIgnoreCase("thundering")) {
		return new Object[] { worldIn.isThundering() };
	} else if (args.checkString(0).equalsIgnoreCase("daytime")) {
		return new Object[] { worldIn.isDaytime() };
	} else if (args.checkString(0).equalsIgnoreCase("moonphase")) {
		return new Object[] { worldIn.getCurrentMoonPhaseFactor() };
	} else if (args.checkString(0).equalsIgnoreCase("celestialangle")) {
		return new Object[] { worldIn.getCelestialAngle(1.0F)};
	} else if (args.checkString(0).equalsIgnoreCase("dimension")) {
		return new Object[] { worldIn.getWorldInfo().getVanillaDimension()};
	} else if (args.checkString(0).equalsIgnoreCase("temperature") || args.checkString(0).equalsIgnoreCase("temp")) {
		return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).temperature};
	} else if (args.checkString(0).equalsIgnoreCase("highhumidity")) {
		return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).isHighHumidity()};
	} else if (args.checkString(0).equalsIgnoreCase("humidity")) {
		return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).rainfall};
	} else if (args.checkString(0).equalsIgnoreCase("worldseed")) {
		return new Object[] { worldIn.getSeed()};
	}
	return new Object[] { "No method passed, or not found" };
}
 
Example 8
Project: Firma   File: FirmaWorld.java   Source Code and License Vote up 4 votes
@Override
public BiomeProvider getBiomeProvider(World world) {
	return new FirmaBiomeProvider(world.getSeed(), this, world.getWorldInfo().getGeneratorOptions());
}
 
Example 9
Project: harshencastle   File: VolatileChunkProvider.java   Source Code and License Vote up 4 votes
public VolatileChunkProvider(World worldIn) {
	worldObj = worldIn;
	chunkGenerator = new PontusChunkProvider(worldIn, worldIn.getSeed());
}
 
Example 10
Project: DecompiledMinecraft   File: WorldChunkManager.java   Source Code and License Vote up 4 votes
public WorldChunkManager(World worldIn)
{
    this(worldIn.getSeed(), worldIn.getWorldInfo().getTerrainType(), worldIn.getWorldInfo().getGeneratorOptions());
}
 
Example 11
Project: DecompiledMinecraft   File: WorldChunkManager.java   Source Code and License Vote up 4 votes
public WorldChunkManager(World worldIn)
{
    this(worldIn.getSeed(), worldIn.getWorldInfo().getTerrainType(), worldIn.getWorldInfo().getGeneratorOptions());
}
 
Example 12
Project: BaseClient   File: WorldChunkManager.java   Source Code and License Vote up 4 votes
public WorldChunkManager(World worldIn)
{
    this(worldIn.getSeed(), worldIn.getWorldInfo().getTerrainType(), worldIn.getWorldInfo().getGeneratorOptions());
}
 
Example 13
Project: BaseClient   File: WorldChunkManager.java   Source Code and License Vote up 4 votes
public WorldChunkManager(World worldIn)
{
    this(worldIn.getSeed(), worldIn.getWorldInfo().getTerrainType(), worldIn.getWorldInfo().getGeneratorOptions());
}
 
Example 14
Project: Backmemed   File: BiomeEndDecorator.java   Source Code and License Vote up 4 votes
public static WorldGenSpikes.EndSpike[] getSpikesForWorld(World p_185426_0_)
{
    Random random = new Random(p_185426_0_.getSeed());
    long i = random.nextLong() & 65535L;
    return (WorldGenSpikes.EndSpike[])SPIKE_CACHE.getUnchecked(Long.valueOf(i));
}
 
Example 15
Project: CustomWorldGen   File: BiomeEndDecorator.java   Source Code and License Vote up 4 votes
public static WorldGenSpikes.EndSpike[] getSpikesForWorld(World p_185426_0_)
{
    Random random = new Random(p_185426_0_.getSeed());
    long i = random.nextLong() & 65535L;
    return (WorldGenSpikes.EndSpike[])SPIKE_CACHE.getUnchecked(Long.valueOf(i));
}