@@ -63,11 +63,6 @@ export class HillyGenerator implements IGenerator {
63
63
return makeNoise3D ( this . seedGenerator ( ) * Number . MAX_SAFE_INTEGER ) ;
64
64
}
65
65
66
- // This is soooo much faster than using Math.round in here
67
- private fastRound ( num :number ) {
68
- return num >= 0.5 ? ( num | 0 ) + 1 : num | 0 ;
69
- }
70
-
71
66
public generate ( chunk :Chunk ) {
72
67
const treeRNG = mulberry32 ( this . seed + chunk . x + chunk . z ) ;
73
68
const sugarcaneRNG = mulberry32 ( this . seed + chunk . x + chunk . z ) ;
@@ -78,7 +73,7 @@ export class HillyGenerator implements IGenerator {
78
73
for ( let x = 0 ; x < 16 ; x ++ ) {
79
74
for ( let z = 0 ; z < 16 ; z ++ ) {
80
75
const oceanValue = this . oceanGenerator ( ( chunk . x * 16 + x ) / 128 , ( chunk . z * 16 + z ) / 128 ) * 100 ;
81
- orgColY = colWaterY = colY = 60 + this . fastRound ( (
76
+ orgColY = colWaterY = colY = 60 + Math . round ( (
82
77
this . generator ( ( chunk . x * 16 + x ) / 16 , ( chunk . z * 16 + z ) / 16 ) * 16 +
83
78
this . generator1 ( ( chunk . z * 16 + z ) / 16 , ( chunk . x * 16 + x ) / 16 ) * 16 +
84
79
this . generator2 ( ( chunk . x * 16 + x ) / 8 , ( chunk . z * 16 + z ) / 8 ) * 8 +
@@ -167,15 +162,15 @@ export class HillyGenerator implements IGenerator {
167
162
}
168
163
169
164
if (
165
+ sugarcaneRNG ( ) > 0.992 &&
170
166
chunk . getBlockId ( x , orgColY + 1 , z ) !== Block . waterStill . blockId &&
171
- chunk . getBlockId ( x , orgColY , z ) === Block . sand . blockId &&
167
+ chunk . getBlockId ( x , orgColY , z ) === Block . grass . blockId &&
172
168
( ( ( x - 1 ) < 0 ? false : chunk . getBlockId ( x - 1 , orgColY , z ) === Block . waterStill . blockId ) ||
173
169
( ( x + 1 ) > 15 ? false : chunk . getBlockId ( x + 1 , orgColY , z ) === Block . waterStill . blockId ) ||
174
170
( ( z - 1 ) < 0 ? false : chunk . getBlockId ( x , orgColY , z - 1 ) === Block . waterStill . blockId ) ||
175
- ( ( z + 1 ) > 15 ? false : chunk . getBlockId ( x , orgColY , z + 1 ) === Block . waterStill . blockId ) ) &&
176
- sugarcaneRNG ( ) > 0.695
171
+ ( ( z + 1 ) > 15 ? false : chunk . getBlockId ( x , orgColY , z + 1 ) === Block . waterStill . blockId ) )
177
172
) {
178
- let sugarcaneYHeight = 1 + Math . floor ( sugarcaneRNG ( ) * 2.9 ) ;
173
+ let sugarcaneYHeight = 2 + Math . round ( sugarcaneRNG ( ) * 2.5 ) ;
179
174
while ( sugarcaneYHeight > 0 ) {
180
175
chunk . setBlock ( Block . sugarcane . blockId , x , orgColY + sugarcaneYHeight , z ) ;
181
176
sugarcaneYHeight -- ;
@@ -186,7 +181,7 @@ export class HillyGenerator implements IGenerator {
186
181
if ( chunk . getBlockId ( x , orgColY + 1 , z ) !== Block . waterStill . blockId && chunk . getBlockId ( x , orgColY , z ) === Block . grass . blockId && treeRNG ( ) > 0.995 ) {
187
182
const treeType = treeRNG ( ) >= 0.5 ;
188
183
chunk . setBlock ( Block . dirt . blockId , x , orgColY , z ) ;
189
- let tYT = 0 , tY = tYT = orgColY + 4 + this . fastRound ( treeRNG ( ) - 0.2 ) , tLY = 0 ;
184
+ let tYT = 0 , tY = tYT = orgColY + 4 + Math . round ( treeRNG ( ) - 0.2 ) , tLY = 0 ;
190
185
while ( tY > orgColY ) {
191
186
chunk . setBlockWithMetadata ( Block . wood . blockId , treeType ? 2 : 0 , x , tY , z ) ;
192
187
if ( tLY !== 0 && tLY < 3 ) {
0 commit comments