MCPcopy Create free account
hub / github.com/cuberite/cuberite / ChooseOceanFloorPattern

Method ChooseOceanFloorPattern

src/Generating/DistortedHeightmap.cpp:911–933  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

909
910
911const cDistortedHeightmap::sBlockInfo * cDistortedHeightmap::ChooseOceanFloorPattern(int a_RelX, int a_RelZ)
912{
913 // Frequencies for the ocean floor selecting noise:
914 const NOISE_DATATYPE FrequencyX = 3;
915 const NOISE_DATATYPE FrequencyZ = 3;
916
917 // Select the ocean-floor pattern to use:
918 NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(m_CurChunkX * cChunkDef::Width + a_RelX)) / FrequencyX;
919 NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(m_CurChunkZ * cChunkDef::Width + a_RelZ)) / FrequencyZ;
920 NOISE_DATATYPE Val = m_OceanFloorSelect.CubicNoise2D(NoiseX, NoiseY);
921 if (Val < -0.95)
922 {
923 return patOFClay.Get();
924 }
925 else if (Val < 0)
926 {
927 return patOFSand.Get();
928 }
929 else
930 {
931 return patDirt.Get();
932 }
933}
934
935
936

Callers

nothing calls this directly

Calls 2

CubicNoise2DMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected