}
-u32 EmergeManager::getBlockSeed(v3s16 p)
-{
- return (u32)(params.seed & 0xFFFFFFFF) +
- p.Z * 38134234 +
- p.Y * 42123 +
- p.X * 23;
-}
-
-
void EmergeManager::getMapgenNames(std::list<const char *> &mgnames)
{
for (u32 i = 0; i != ARRLEN(reg_mapgens); i++)
VoxelArea(minp, maxp));
try { // takes about 90ms with -O1 on an e3-1230v2
m_server->getScriptIface()->environment_OnGenerated(
- minp, maxp, emerge->getBlockSeed(minp));
+ minp, maxp, mapgen->blockseed);
} catch(LuaError &e) {
m_server->setAsyncFatalError(e.what());
}
Biome *getBiomeAtPoint(v3s16 p);
int getGroundLevelAtPoint(v2s16 p);
bool isBlockUnderground(v3s16 blockpos);
- u32 getBlockSeed(v3s16 p);
};
#endif
}
+u32 Mapgen::getBlockSeed(v3s16 p, int seed)
+{
+ return (u32)seed +
+ p.Z * 38134234 +
+ p.Y * 42123 +
+ p.X * 23;
+}
+
+
+u32 Mapgen::getBlockSeed2(v3s16 p, int seed)
+{
+ return noise3d(p.X, p.Y, p.Z, seed);
+}
+
+
// Returns Y one under area minimum if not found
s16 Mapgen::findGroundLevelFull(v2s16 p2d)
{
u32 flags;
bool generating;
int id;
+
ManualMapVoxelManipulator *vm;
INodeDefManager *ndef;
+ u32 blockseed;
s16 *heightmap;
u8 *biomemap;
v3s16 csize;
Mapgen(int mapgenid, MapgenParams *params, EmergeManager *emerge);
virtual ~Mapgen();
+ static u32 getBlockSeed(v3s16 p, int seed);
+ static u32 getBlockSeed2(v3s16 p, int seed);
s16 findGroundLevelFull(v2s16 p2d);
s16 findGroundLevel(v2s16 p2d, s16 ymin, s16 ymax);
void updateHeightmap(v3s16 nmin, v3s16 nmax);
v3s16 node_min = blockpos_min*MAP_BLOCKSIZE;
v3s16 node_max = (blockpos_max+v3s16(1,1,1))*MAP_BLOCKSIZE-v3s16(1,1,1);
+ blockseed = getBlockSeed2(node_min, data->seed);
+
MapNode n_node(c_node);
for (s16 z = node_min.Z; z <= node_max.Z; z++)
full_node_max = (blockpos_max + 2) * MAP_BLOCKSIZE - v3s16(1, 1, 1);
// Create a block-specific seed
- blockseed = m_emerge->getBlockSeed(full_node_min); //////use getBlockSeed2()!
+ blockseed = getBlockSeed2(full_node_min, seed);
// Make some noise
calculateNoise();
int zstride;
u32 spflags;
- u32 blockseed;
v3s16 node_min;
v3s16 node_max;
v3s16 full_node_min;
int ystride;
u32 spflags;
- u32 blockseed;
v3s16 node_min;
v3s16 node_max;
v3s16 full_node_min;
full_node_min = (blockpos_min - 1) * MAP_BLOCKSIZE;
full_node_max = (blockpos_max + 2) * MAP_BLOCKSIZE - v3s16(1, 1, 1);
- blockseed = m_emerge->getBlockSeed(full_node_min); //////use getBlockSeed2()!
+ blockseed = getBlockSeed2(full_node_min, seed);
// Make some noise
calculateNoise();
int zstride;
u32 spflags;
- u32 blockseed;
v3s16 node_min;
v3s16 node_max;
v3s16 full_node_min;