mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-09 01:06:21 +00:00
build ore addon
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package com.dfsek.terra.api.util;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockType;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public interface MaterialSet extends Set<BlockType> {
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.dfsek.terra.api.util;
|
||||
|
||||
import com.dfsek.terra.api.world.Chunk;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public final class PopulationUtil {
|
||||
public static Random getRandom(Chunk c) {
|
||||
return getRandom(c, 0);
|
||||
}
|
||||
|
||||
public static Random getRandom(Chunk c, long salt) {
|
||||
return new Random(getCarverChunkSeed(c.getX(), c.getZ(), c.getWorld().getSeed() + salt));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the carver seed for a chunk.
|
||||
*
|
||||
* @param chunkX Chunk's X coordinate
|
||||
* @param chunkZ Chunk's Z coordinate
|
||||
* @param seed World seed
|
||||
* @return long - The carver seed.
|
||||
*/
|
||||
public static long getCarverChunkSeed(int chunkX, int chunkZ, long seed) {
|
||||
Random r = new Random(seed);
|
||||
return chunkX * r.nextLong() ^ chunkZ * r.nextLong() ^ seed;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user