@@ -54,8 +54,6 @@ public void generate( ChunkPos pos, World world, IChunkGenerator chunkGenerator,
5454 int clusterSize = parameters .get (Constants .FormatBits .NODE_SIZE ).getAsInt ();
5555 int clusterCount = parameters .get (Constants .FormatBits .NODE_COUNT ).getAsInt ();
5656
57- if ( biomeMatch (world .getBiome ( new BlockPos ( blockX , 64 , blockZ ) ), biomes ) ) return ;
58-
5957 while ( tries > 0 ) {
6058 if ( this .random .nextInt (100 ) <= frequency ) {
6159 int xRand = random .nextInt (16 );
@@ -66,7 +64,7 @@ public void generate( ChunkPos pos, World world, IChunkGenerator chunkGenerator,
6664 int z = blockZ + zRand - (maxSpread / 2 );
6765 int [] params = new int [] { clusterSize , variance , clusterCount , maxSpread , minHeight , maxHeight };
6866
69- spawnCluster (ores , new BlockPos (x ,y ,z ), params , random , world , blockReplace );
67+ spawnCluster (ores , new BlockPos (x ,y ,z ), params , random , world , blockReplace , biomes );
7068 }
7169 tries --;
7270 }
@@ -91,7 +89,7 @@ private enum parms {
9189 SIZE , VARIANCE , CCOUNT , MAXSPREAD , MINHEIGHT , MAXHEIGHT
9290 }
9391
94- private void spawnCluster ( OreList ores , BlockPos blockPos , int [] params , Random random , World world , List <IBlockState > blockReplace ) {
92+ private void spawnCluster ( OreList ores , BlockPos blockPos , int [] params , Random random , World world , List <IBlockState > blockReplace , BiomeLocation biomes ) {
9593 int size = params [parms .SIZE .ordinal ()];
9694 int variance = params [parms .VARIANCE .ordinal ()];
9795 int clusterCount = params [parms .CCOUNT .ordinal ()];
@@ -103,7 +101,7 @@ private void spawnCluster(OreList ores, BlockPos blockPos, int[] params, Random
103101 r += random .nextInt (2 * variance ) - variance ;
104102 }
105103
106- spawnChunk (ores , world , blockPos , r , world .provider .getDimension (), blockReplace , random );
104+ spawnChunk (ores , world , blockPos , r , world .provider .getDimension (), blockReplace , random , biomes );
107105
108106 int count = random .nextInt (clusterCount - 1 ); // always at least the first, but vary inside that
109107 if ( variance > 0 ) {
@@ -124,14 +122,14 @@ private void spawnCluster(OreList ores, BlockPos blockPos, int[] params, Random
124122
125123 BlockPos p = blockPos .add ( xp , yp , zp );
126124
127- spawnChunk (ores , world , p , r , world .provider .getDimension (), blockReplace , random );
125+ spawnChunk (ores , world , p , r , world .provider .getDimension (), blockReplace , random , biomes );
128126
129127 count -= r ;
130128 }
131129 }
132130
133- private void spawnChunk ( OreList ores , World world , BlockPos blockPos , int quantity , int dimension , List <IBlockState > blockReplace ,
134- Random prng ) {
131+ private void spawnChunk ( OreList ores , World world , BlockPos blockPos , int quantity , int dimension , List <IBlockState > blockReplace ,
132+ Random prng , BiomeLocation biomes ) {
135133 int count = quantity ;
136134 int lutType = (quantity < 8 )?offsetIndexRef_small .length :offsetIndexRef .length ;
137135 int [] lut = (quantity < 8 )?offsetIndexRef_small :offsetIndexRef ;
@@ -146,7 +144,7 @@ private void spawnChunk(OreList ores, World world, BlockPos blockPos, int quanti
146144 int z = 0 ;
147145 while (count > 0 ){
148146 IBlockState oreBlock = ores .getRandomOre (prng ).getOre ();
149- if ( !spawn (oreBlock ,world ,blockPos .add (offs [scrambledLUT [--count ]]),dimension ,true ,blockReplace ) ) {
147+ if ( !spawn (oreBlock ,world ,blockPos .add (offs [scrambledLUT [--count ]]),dimension ,true ,blockReplace , biomes ) ) {
150148 count ++;
151149 z ++;
152150 } else {
@@ -161,30 +159,30 @@ private void spawnChunk(OreList ores, World world, BlockPos blockPos, int quanti
161159 return ;
162160 }
163161
164- doSpawnFill ( prng .nextBoolean (), world , blockPos , count , blockReplace , ores );
162+ doSpawnFill ( prng .nextBoolean (), world , blockPos , count , blockReplace , ores , biomes );
165163 }
166164
167- private void doSpawnFill ( boolean nextBoolean , World world , BlockPos blockPos , int quantity , List <IBlockState > blockReplace , OreList possibleOres ) {
165+ private void doSpawnFill ( boolean nextBoolean , World world , BlockPos blockPos , int quantity , List <IBlockState > blockReplace , OreList possibleOres , BiomeLocation biomes ) {
168166 double radius = Math .pow (quantity , 1.0 /3.0 ) * (3.0 / 4.0 / Math .PI ) + 2 ;
169167 int rSqr = (int )(radius * radius );
170168 if ( nextBoolean ) {
171- spawnMungeNE ( world , blockPos , rSqr , radius , blockReplace , quantity , possibleOres );
169+ spawnMungeNE ( world , blockPos , rSqr , radius , blockReplace , quantity , possibleOres , biomes );
172170 } else {
173- spawnMungeSW ( world , blockPos , rSqr , radius , blockReplace , quantity , possibleOres );
171+ spawnMungeSW ( world , blockPos , rSqr , radius , blockReplace , quantity , possibleOres , biomes );
174172 }
175173 }
176174
177175
178- private void spawnMungeSW ( World world , BlockPos blockPos , int rSqr , double radius ,
179- List <IBlockState > blockReplace , int count , OreList possibleOres ) {
176+ private void spawnMungeSW ( World world , BlockPos blockPos , int rSqr , double radius ,
177+ List <IBlockState > blockReplace , int count , OreList possibleOres , BiomeLocation biomes ) {
180178 Random prng = this .random ;
181179 int quantity = count ;
182180 for (int dy = (int )(-1 * radius ); dy < radius ; dy ++){
183181 for (int dx = (int )(radius ); dx >= (int )(-1 * radius ); dx --){
184182 for (int dz = (int )(radius ); dz >= (int )(-1 * radius ); dz --){
185183 if ((dx *dx + dy *dy + dz *dz ) <= rSqr ){
186184 IBlockState oreBlock = possibleOres .getRandomOre (prng ).getOre ();
187- spawn (oreBlock ,world ,blockPos .add (dx ,dy ,dz ),world .provider .getDimension (),true ,blockReplace );
185+ spawn (oreBlock ,world ,blockPos .add (dx ,dy ,dz ),world .provider .getDimension (),true ,blockReplace , biomes );
188186 quantity --;
189187 }
190188 if (quantity <= 0 ) {
@@ -196,16 +194,16 @@ private void spawnMungeSW(World world, BlockPos blockPos, int rSqr, double radiu
196194 }
197195
198196
199- private void spawnMungeNE ( World world , BlockPos blockPos , int rSqr , double radius ,
200- List <IBlockState > blockReplace , int count , OreList possibleOres ) {
197+ private void spawnMungeNE ( World world , BlockPos blockPos , int rSqr , double radius ,
198+ List <IBlockState > blockReplace , int count , OreList possibleOres , BiomeLocation biomes ) {
201199 Random prng = this .random ;
202200 int quantity = count ;
203201 for (int dy = (int )(-1 * radius ); dy < radius ; dy ++){
204202 for (int dz = (int )(-1 * radius ); dz < radius ; dz ++){
205203 for (int dx = (int )(-1 * radius ); dx < radius ; dx ++){
206204 if ((dx *dx + dy *dy + dz *dz ) <= rSqr ){
207205 IBlockState oreBlock = possibleOres .getRandomOre (prng ).getOre ();
208- spawn (oreBlock ,world ,blockPos .add (dx ,dy ,dz ),world .provider .getDimension (),true ,blockReplace );
206+ spawn (oreBlock ,world ,blockPos .add (dx ,dy ,dz ),world .provider .getDimension (),true ,blockReplace , biomes );
209207 quantity --;
210208 }
211209 if (quantity <= 0 ) {
0 commit comments