Basic reformat, hit once, hope never again
This commit is contained in:
@@ -43,14 +43,14 @@ import appeng.api.definitions.IMaterials;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.worldgen.meteorite.Fallout;
|
||||
import appeng.worldgen.meteorite.FalloutCopy;
|
||||
import appeng.worldgen.meteorite.FalloutSand;
|
||||
import appeng.worldgen.meteorite.FalloutSnow;
|
||||
import appeng.worldgen.meteorite.IMeteoriteWorld;
|
||||
import appeng.worldgen.meteorite.MeteoriteBlockPutter;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public final class MeteoritePlacer
|
||||
@@ -91,7 +91,7 @@ public final class MeteoritePlacer
|
||||
this.validSpawn.add( Blocks.ice );
|
||||
this.validSpawn.add( Blocks.snow );
|
||||
|
||||
for ( Block skyStoneBlock : this.skyStoneDefinition.maybeBlock().asSet() )
|
||||
for( Block skyStoneBlock : this.skyStoneDefinition.maybeBlock().asSet() )
|
||||
{
|
||||
this.invalidSpawn.add( skyStoneBlock );
|
||||
}
|
||||
@@ -123,23 +123,23 @@ public final class MeteoritePlacer
|
||||
|
||||
Block blk = Block.getBlockById( this.settings.getInteger( "blk" ) );
|
||||
|
||||
if ( blk == Blocks.sand )
|
||||
if( blk == Blocks.sand )
|
||||
this.type = new FalloutSand( w, x, y, z, this.putter, this.skyStoneDefinition );
|
||||
else if ( blk == Blocks.hardened_clay )
|
||||
else if( blk == Blocks.hardened_clay )
|
||||
this.type = new FalloutCopy( w, x, y, z, this.putter, this.skyStoneDefinition );
|
||||
else if ( blk == Blocks.ice || blk == Blocks.snow )
|
||||
else if( blk == Blocks.ice || blk == Blocks.snow )
|
||||
this.type = new FalloutSnow( w, x, y, z, this.putter, this.skyStoneDefinition );
|
||||
|
||||
int skyMode = this.settings.getInteger( "skyMode" );
|
||||
|
||||
// creator
|
||||
if ( skyMode > 10 )
|
||||
if( skyMode > 10 )
|
||||
this.placeCrater( w, x, y, z );
|
||||
|
||||
this.placeMeteorite( w, x, y, z );
|
||||
|
||||
// collapse blocks...
|
||||
if ( skyMode > 3 )
|
||||
if( skyMode > 3 )
|
||||
this.decay( w, x, y, z );
|
||||
|
||||
w.done();
|
||||
@@ -156,12 +156,12 @@ public final class MeteoritePlacer
|
||||
int minZ = w.minZ( z - 200 );
|
||||
int maxZ = w.maxZ( z + 200 );
|
||||
|
||||
for ( int j = y - 5; j < maxY; j++ )
|
||||
for( int j = y - 5; j < maxY; j++ )
|
||||
{
|
||||
boolean changed = false;
|
||||
|
||||
for ( int i = minX; i < maxX; i++ )
|
||||
for ( int k = minZ; k < maxZ; k++ )
|
||||
for( int i = minX; i < maxX; i++ )
|
||||
for( int k = minZ; k < maxZ; k++ )
|
||||
{
|
||||
double dx = i - x;
|
||||
double dz = k - z;
|
||||
@@ -169,11 +169,11 @@ public final class MeteoritePlacer
|
||||
|
||||
double distanceFrom = dx * dx + dz * dz;
|
||||
|
||||
if ( j > h + distanceFrom * 0.02 )
|
||||
if( j > h + distanceFrom * 0.02 )
|
||||
{
|
||||
if ( lava && j < y && w.getBlock( x, y - 1, z ).isBlockSolid( w.getWorld(), i, j, k, 0 ) )
|
||||
if( lava && j < y && w.getBlock( x, y - 1, z ).isBlockSolid( w.getWorld(), i, j, k, 0 ) )
|
||||
{
|
||||
if ( j > h + distanceFrom * 0.02 )
|
||||
if( j > h + distanceFrom * 0.02 )
|
||||
this.putter.put( w, i, j, k, Blocks.lava );
|
||||
}
|
||||
else
|
||||
@@ -182,7 +182,7 @@ public final class MeteoritePlacer
|
||||
}
|
||||
}
|
||||
|
||||
for ( Object o : w.getWorld().getEntitiesWithinAABB( EntityItem.class, AxisAlignedBB.getBoundingBox( w.minX( x - 30 ), y - 5, w.minZ( z - 30 ), w.maxX( x + 30 ), y + 30, w.maxZ( z + 30 ) ) ) )
|
||||
for( Object o : w.getWorld().getEntitiesWithinAABB( EntityItem.class, AxisAlignedBB.getBoundingBox( w.minX( x - 30 ), y - 5, w.minZ( z - 30 ), w.maxX( x + 30 ), y + 30, w.maxZ( z + 30 ) ) ) )
|
||||
{
|
||||
Entity e = (Entity) o;
|
||||
e.setDead();
|
||||
@@ -197,41 +197,41 @@ public final class MeteoritePlacer
|
||||
int meteorZHeight = w.maxZ( z + 8 );
|
||||
|
||||
// spawn meteor
|
||||
for ( int i = meteorXLength; i < meteorXHeight; i++ )
|
||||
for ( int j = y - 8; j < y + 8; j++ )
|
||||
for ( int k = meteorZLength; k < meteorZHeight; k++ )
|
||||
for( int i = meteorXLength; i < meteorXHeight; i++ )
|
||||
for( int j = y - 8; j < y + 8; j++ )
|
||||
for( int k = meteorZLength; k < meteorZHeight; k++ )
|
||||
{
|
||||
double dx = i - x;
|
||||
double dy = j - y;
|
||||
double dz = k - z;
|
||||
|
||||
if ( dx * dx * 0.7 + dy * dy * ( j > y ? 1.4 : 0.8 ) + dz * dz * 0.7 < this.squaredMeteoriteSize )
|
||||
if( dx * dx * 0.7 + dy * dy * ( j > y ? 1.4 : 0.8 ) + dz * dz * 0.7 < this.squaredMeteoriteSize )
|
||||
{
|
||||
for ( Block skyStoneBlock : this.skyStoneDefinition.maybeBlock().asSet() )
|
||||
for( Block skyStoneBlock : this.skyStoneDefinition.maybeBlock().asSet() )
|
||||
{
|
||||
this.putter.put( w, i, j, k, skyStoneBlock );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.SpawnPressesInMeteorites ) )
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.SpawnPressesInMeteorites ) )
|
||||
{
|
||||
for ( Block skyChestBlock : this.skyChestDefinition.maybeBlock().asSet() )
|
||||
for( Block skyChestBlock : this.skyChestDefinition.maybeBlock().asSet() )
|
||||
{
|
||||
this.putter.put( w, x, y, z, skyChestBlock );
|
||||
}
|
||||
|
||||
TileEntity te = w.getTileEntity( x, y, z );
|
||||
if ( te instanceof IInventory )
|
||||
if( te instanceof IInventory )
|
||||
{
|
||||
InventoryAdaptor ap = InventoryAdaptor.getAdaptor( te, ForgeDirection.UP );
|
||||
|
||||
int primary = Math.max( 1, (int) ( Math.random() * 4 ) );
|
||||
|
||||
if ( primary > 3 ) // in case math breaks...
|
||||
if( primary > 3 ) // in case math breaks...
|
||||
primary = 3;
|
||||
|
||||
for ( int zz = 0; zz < primary; zz++ )
|
||||
for( int zz = 0; zz < primary; zz++ )
|
||||
{
|
||||
int r = 0;
|
||||
boolean duplicate = false;
|
||||
@@ -240,7 +240,7 @@ public final class MeteoritePlacer
|
||||
{
|
||||
duplicate = false;
|
||||
|
||||
if ( Math.random() > PRESSES_SPAWN_CHANCE )
|
||||
if( Math.random() > PRESSES_SPAWN_CHANCE )
|
||||
r = WorldSettings.getInstance().getNextOrderedValue( "presses" );
|
||||
else
|
||||
r = (int) ( Math.random() * 1000 );
|
||||
@@ -248,28 +248,28 @@ public final class MeteoritePlacer
|
||||
ItemStack toAdd = null;
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
|
||||
switch ( r % 4 )
|
||||
switch( r % 4 )
|
||||
{
|
||||
case 0:
|
||||
for ( ItemStack calc : materials.calcProcessorPress().maybeStack( 1 ).asSet() )
|
||||
for( ItemStack calc : materials.calcProcessorPress().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
toAdd = calc;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
for ( ItemStack calc : materials.engProcessorPress().maybeStack( 1 ).asSet() )
|
||||
for( ItemStack calc : materials.engProcessorPress().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
toAdd = calc;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for ( ItemStack calc : materials.logicProcessorPress().maybeStack( 1 ).asSet() )
|
||||
for( ItemStack calc : materials.logicProcessorPress().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
toAdd = calc;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
for ( ItemStack calc : materials.siliconPress().maybeStack( 1 ).asSet() )
|
||||
for( ItemStack calc : materials.siliconPress().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
toAdd = calc;
|
||||
}
|
||||
@@ -277,25 +277,25 @@ public final class MeteoritePlacer
|
||||
default:
|
||||
}
|
||||
|
||||
if ( toAdd != null )
|
||||
if( toAdd != null )
|
||||
{
|
||||
if ( ap.simulateRemove( 1, toAdd, null ) == null )
|
||||
if( ap.simulateRemove( 1, toAdd, null ) == null )
|
||||
ap.addItems( toAdd );
|
||||
else
|
||||
duplicate = true;
|
||||
}
|
||||
}
|
||||
while ( duplicate );
|
||||
while( duplicate );
|
||||
}
|
||||
|
||||
int secondary = Math.max( 1, (int) ( Math.random() * 3 ) );
|
||||
for ( int zz = 0; zz < secondary; zz++ )
|
||||
for( int zz = 0; zz < secondary; zz++ )
|
||||
{
|
||||
switch ( (int) ( Math.random() * 1000 ) % 3 )
|
||||
switch( (int) ( Math.random() * 1000 ) % 3 )
|
||||
{
|
||||
case 0:
|
||||
final int amount = (int) ( ( Math.random() * SKYSTONE_SPAWN_LIMIT ) + 1 );
|
||||
for ( ItemStack skyStoneStack : this.skyStoneDefinition.maybeStack( amount ).asSet() )
|
||||
for( ItemStack skyStoneStack : this.skyStoneDefinition.maybeStack( amount ).asSet() )
|
||||
{
|
||||
ap.addItems( skyStoneStack );
|
||||
}
|
||||
@@ -314,7 +314,7 @@ public final class MeteoritePlacer
|
||||
possibles.add( new ItemStack( net.minecraft.init.Items.gold_nugget ) );
|
||||
|
||||
ItemStack nugget = Platform.pickRandom( possibles );
|
||||
if ( nugget != null )
|
||||
if( nugget != null )
|
||||
{
|
||||
nugget = nugget.copy();
|
||||
nugget.stackSize = (int) ( Math.random() * 12 ) + 1;
|
||||
@@ -336,27 +336,27 @@ public final class MeteoritePlacer
|
||||
int meteorZLength = w.minZ( z - 30 );
|
||||
int meteorZHeight = w.maxZ( z + 30 );
|
||||
|
||||
for ( int i = meteorXLength; i < meteorXHeight; i++ )
|
||||
for ( int k = meteorZLength; k < meteorZHeight; k++ )
|
||||
for ( int j = y - 9; j < y + 30; j++ )
|
||||
for( int i = meteorXLength; i < meteorXHeight; i++ )
|
||||
for( int k = meteorZLength; k < meteorZHeight; k++ )
|
||||
for( int j = y - 9; j < y + 30; j++ )
|
||||
{
|
||||
Block blk = w.getBlock( i, j, k );
|
||||
if ( blk == Blocks.lava )
|
||||
if( blk == Blocks.lava )
|
||||
continue;
|
||||
|
||||
if ( blk.isReplaceable( w.getWorld(), i, j, k ) )
|
||||
if( blk.isReplaceable( w.getWorld(), i, j, k ) )
|
||||
{
|
||||
blk = Platform.AIR;
|
||||
Block blk_b = w.getBlock( i, j + 1, k );
|
||||
|
||||
if ( blk_b != blk )
|
||||
if( blk_b != blk )
|
||||
{
|
||||
int meta_b = w.getBlockMetadata( i, j + 1, k );
|
||||
|
||||
w.setBlock( i, j, k, blk_b, meta_b, 3 );
|
||||
w.setBlock( i, j + 1, k, blk );
|
||||
}
|
||||
else if ( randomShit < 100 * this.crater )
|
||||
else if( randomShit < 100 * this.crater )
|
||||
{
|
||||
double dx = i - x;
|
||||
double dy = j - y;
|
||||
@@ -364,12 +364,12 @@ public final class MeteoritePlacer
|
||||
double dist = dx * dx + dy * dy + dz * dz;
|
||||
|
||||
Block xf = w.getBlock( i, j - 1, k );
|
||||
if ( !xf.isReplaceable( w.getWorld(), i, j - 1, k ) )
|
||||
if( !xf.isReplaceable( w.getWorld(), i, j - 1, k ) )
|
||||
{
|
||||
double extraRange = Math.random() * 0.6;
|
||||
double height = this.crater * ( extraRange + 0.2 ) - Math.abs( dist - this.crater * 1.7 );
|
||||
|
||||
if ( xf != blk && height > 0 && Math.random() > 0.6 )
|
||||
if( xf != blk && height > 0 && Math.random() > 0.6 )
|
||||
{
|
||||
randomShit++;
|
||||
this.type.getRandomFall( w, i, j, k );
|
||||
@@ -381,15 +381,15 @@ public final class MeteoritePlacer
|
||||
{
|
||||
// decay.
|
||||
Block blk_b = w.getBlock( i, j + 1, k );
|
||||
if ( blk_b == Platform.AIR )
|
||||
if( blk_b == Platform.AIR )
|
||||
{
|
||||
if ( Math.random() > 0.4 )
|
||||
if( Math.random() > 0.4 )
|
||||
{
|
||||
double dx = i - x;
|
||||
double dy = j - y;
|
||||
double dz = k - z;
|
||||
|
||||
if ( dx * dx + dy * dy + dz * dz < this.crater * 1.6 )
|
||||
if( dx * dx + dy * dy + dz * dz < this.crater * 1.6 )
|
||||
{
|
||||
this.type.getRandomInset( w, i, j, k );
|
||||
}
|
||||
@@ -411,11 +411,11 @@ public final class MeteoritePlacer
|
||||
{
|
||||
int validBlocks = 0;
|
||||
|
||||
if ( !w.hasNoSky() )
|
||||
if( !w.hasNoSky() )
|
||||
return false;
|
||||
|
||||
Block blk = w.getBlock( x, y, z );
|
||||
if ( !this.validSpawn.contains( blk ) )
|
||||
if( !this.validSpawn.contains( blk ) )
|
||||
return false; // must spawn on a valid block..
|
||||
|
||||
this.settings = new NBTTagCompound();
|
||||
@@ -431,68 +431,68 @@ public final class MeteoritePlacer
|
||||
|
||||
this.settings.setBoolean( "lava", Math.random() > 0.9 );
|
||||
|
||||
if ( blk == Blocks.sand )
|
||||
if( blk == Blocks.sand )
|
||||
this.type = new FalloutSand( w, x, y, z, this.putter, this.skyStoneDefinition );
|
||||
else if ( blk == Blocks.hardened_clay )
|
||||
else if( blk == Blocks.hardened_clay )
|
||||
this.type = new FalloutCopy( w, x, y, z, this.putter, this.skyStoneDefinition );
|
||||
else if ( blk == Blocks.ice || blk == Blocks.snow )
|
||||
else if( blk == Blocks.ice || blk == Blocks.snow )
|
||||
this.type = new FalloutSnow( w, x, y, z, this.putter, this.skyStoneDefinition );
|
||||
|
||||
int realValidBlocks = 0;
|
||||
|
||||
for ( int i = x - 6; i < x + 6; i++ )
|
||||
for ( int j = y - 6; j < y + 6; j++ )
|
||||
for ( int k = z - 6; k < z + 6; k++ )
|
||||
for( int i = x - 6; i < x + 6; i++ )
|
||||
for( int j = y - 6; j < y + 6; j++ )
|
||||
for( int k = z - 6; k < z + 6; k++ )
|
||||
{
|
||||
blk = w.getBlock( i, j, k );
|
||||
if ( this.validSpawn.contains( blk ) )
|
||||
if( this.validSpawn.contains( blk ) )
|
||||
realValidBlocks++;
|
||||
}
|
||||
|
||||
for ( int i = x - 15; i < x + 15; i++ )
|
||||
for ( int j = y - 15; j < y + 15; j++ )
|
||||
for ( int k = z - 15; k < z + 15; k++ )
|
||||
for( int i = x - 15; i < x + 15; i++ )
|
||||
for( int j = y - 15; j < y + 15; j++ )
|
||||
for( int k = z - 15; k < z + 15; k++ )
|
||||
{
|
||||
blk = w.getBlock( i, j, k );
|
||||
if ( this.invalidSpawn.contains( blk ) )
|
||||
if( this.invalidSpawn.contains( blk ) )
|
||||
return false;
|
||||
if ( this.validSpawn.contains( blk ) )
|
||||
if( this.validSpawn.contains( blk ) )
|
||||
validBlocks++;
|
||||
}
|
||||
|
||||
int minBLocks = 200;
|
||||
if ( validBlocks > minBLocks && realValidBlocks > 80 )
|
||||
if( validBlocks > minBLocks && realValidBlocks > 80 )
|
||||
{
|
||||
// we can spawn here!
|
||||
|
||||
int skyMode = 0;
|
||||
|
||||
for ( int i = x - 15; i < x + 15; i++ )
|
||||
for ( int j = y - 15; j < y + 11; j++ )
|
||||
for ( int k = z - 15; k < z + 15; k++ )
|
||||
for( int i = x - 15; i < x + 15; i++ )
|
||||
for( int j = y - 15; j < y + 11; j++ )
|
||||
for( int k = z - 15; k < z + 15; k++ )
|
||||
{
|
||||
if ( w.canBlockSeeTheSky( i, j, k ) )
|
||||
if( w.canBlockSeeTheSky( i, j, k ) )
|
||||
skyMode++;
|
||||
}
|
||||
|
||||
boolean solid = true;
|
||||
for ( int j = y - 15; j < y - 1; j++ )
|
||||
for( int j = y - 15; j < y - 1; j++ )
|
||||
{
|
||||
if ( w.getBlock( x, j, z ) == Platform.AIR )
|
||||
if( w.getBlock( x, j, z ) == Platform.AIR )
|
||||
solid = false;
|
||||
}
|
||||
|
||||
if ( !solid )
|
||||
if( !solid )
|
||||
skyMode = 0;
|
||||
|
||||
// creator
|
||||
if ( skyMode > 10 )
|
||||
if( skyMode > 10 )
|
||||
this.placeCrater( w, x, y, z );
|
||||
|
||||
this.placeMeteorite( w, x, y, z );
|
||||
|
||||
// collapse blocks...
|
||||
if ( skyMode > 3 )
|
||||
if( skyMode > 3 )
|
||||
this.decay( w, x, y, z );
|
||||
|
||||
this.settings.setInteger( "skyMode", skyMode );
|
||||
|
||||
@@ -37,18 +37,19 @@ import appeng.hooks.TickHandler;
|
||||
import appeng.util.Platform;
|
||||
import appeng.worldgen.meteorite.ChunkOnly;
|
||||
|
||||
|
||||
final public class MeteoriteWorldGen implements IWorldGenerator
|
||||
{
|
||||
@Override
|
||||
public void generate(Random r, int chunkX, int chunkZ, World w, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
|
||||
public void generate( Random r, int chunkX, int chunkZ, World w, IChunkProvider chunkGenerator, IChunkProvider chunkProvider )
|
||||
{
|
||||
if ( WorldGenRegistry.INSTANCE.isWorldGenEnabled( WorldGenType.Meteorites, w ) )
|
||||
if( WorldGenRegistry.INSTANCE.isWorldGenEnabled( WorldGenType.Meteorites, w ) )
|
||||
{
|
||||
// add new meteorites?
|
||||
if ( r.nextFloat() < AEConfig.instance.meteoriteSpawnChance )
|
||||
if( r.nextFloat() < AEConfig.instance.meteoriteSpawnChance )
|
||||
{
|
||||
int x = r.nextInt( 16 ) + (chunkX << 4);
|
||||
int z = r.nextInt( 16 ) + (chunkZ << 4);
|
||||
int x = r.nextInt( 16 ) + ( chunkX << 4 );
|
||||
int z = r.nextInt( 16 ) + ( chunkZ << 4 );
|
||||
|
||||
int depth = 180 + r.nextInt( 20 );
|
||||
TickHandler.INSTANCE.addCallable( w, new MeteoriteSpawn( x, depth, z, w ) );
|
||||
@@ -60,6 +61,49 @@ final public class MeteoriteWorldGen implements IWorldGenerator
|
||||
WorldSettings.getInstance().getCompass().updateArea( w, chunkX, chunkZ );
|
||||
}
|
||||
|
||||
private boolean tryMeteorite( World w, int depth, int x, int z )
|
||||
{
|
||||
for( int tries = 0; tries < 20; tries++ )
|
||||
{
|
||||
MeteoritePlacer mp = new MeteoritePlacer();
|
||||
|
||||
if( mp.spawnMeteorite( new ChunkOnly( w, x >> 4, z >> 4 ), x, depth, z ) )
|
||||
{
|
||||
int px = x >> 4;
|
||||
int pz = z >> 4;
|
||||
|
||||
for( int cx = px - 6; cx < px + 6; cx++ )
|
||||
for( int cz = pz - 6; cz < pz + 6; cz++ )
|
||||
{
|
||||
if( w.getChunkProvider().chunkExists( cx, cz ) )
|
||||
{
|
||||
if( px == cx && pz == cz )
|
||||
continue;
|
||||
|
||||
if( WorldSettings.getInstance().hasGenerated( w.provider.dimensionId, cx, cz ) )
|
||||
{
|
||||
MeteoritePlacer mp2 = new MeteoritePlacer();
|
||||
mp2.spawnMeteorite( new ChunkOnly( w, cx, cz ), mp.getSettings() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
depth -= 15;
|
||||
if( depth < 40 )
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private Collection<NBTTagCompound> getNearByMeteorites( World w, int chunkX, int chunkZ )
|
||||
{
|
||||
return WorldSettings.getInstance().getNearByMeteorites( w.provider.dimensionId, chunkX, chunkZ );
|
||||
}
|
||||
|
||||
class MeteoriteSpawn implements Callable
|
||||
{
|
||||
|
||||
@@ -68,7 +112,8 @@ final public class MeteoriteWorldGen implements IWorldGenerator
|
||||
final World w;
|
||||
final int depth;
|
||||
|
||||
public MeteoriteSpawn(int x, int depth, int z, World w) {
|
||||
public MeteoriteSpawn( int x, int depth, int z, World w )
|
||||
{
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
@@ -84,7 +129,7 @@ final public class MeteoriteWorldGen implements IWorldGenerator
|
||||
double minSqDist = Double.MAX_VALUE;
|
||||
|
||||
// near by meteorites!
|
||||
for (NBTTagCompound data : MeteoriteWorldGen.this.getNearByMeteorites( this.w, chunkX, chunkZ ))
|
||||
for( NBTTagCompound data : MeteoriteWorldGen.this.getNearByMeteorites( this.w, chunkX, chunkZ ) )
|
||||
{
|
||||
MeteoritePlacer mp = new MeteoritePlacer();
|
||||
mp.spawnMeteorite( new ChunkOnly( this.w, chunkX, chunkZ ), data );
|
||||
@@ -92,9 +137,9 @@ final public class MeteoriteWorldGen implements IWorldGenerator
|
||||
minSqDist = Math.min( minSqDist, mp.getSqDistance( this.x, this.z ) );
|
||||
}
|
||||
|
||||
boolean isCluster = (minSqDist < 30 * 30) && Platform.getRandomFloat() < AEConfig.instance.meteoriteClusterChance;
|
||||
boolean isCluster = ( minSqDist < 30 * 30 ) && Platform.getRandomFloat() < AEConfig.instance.meteoriteClusterChance;
|
||||
|
||||
if ( minSqDist > AEConfig.instance.minMeteoriteDistanceSq || isCluster )
|
||||
if( minSqDist > AEConfig.instance.minMeteoriteDistanceSq || isCluster )
|
||||
MeteoriteWorldGen.this.tryMeteorite( this.w, this.depth, this.x, this.z );
|
||||
|
||||
WorldSettings.getInstance().setGenerated( this.w.provider.dimensionId, chunkX, chunkZ );
|
||||
@@ -103,48 +148,4 @@ final public class MeteoriteWorldGen implements IWorldGenerator
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean tryMeteorite(World w, int depth, int x, int z)
|
||||
{
|
||||
for (int tries = 0; tries < 20; tries++)
|
||||
{
|
||||
MeteoritePlacer mp = new MeteoritePlacer();
|
||||
|
||||
if ( mp.spawnMeteorite( new ChunkOnly( w, x >> 4, z >> 4 ), x, depth, z ) )
|
||||
{
|
||||
int px = x >> 4;
|
||||
int pz = z >> 4;
|
||||
|
||||
for (int cx = px - 6; cx < px + 6; cx++)
|
||||
for (int cz = pz - 6; cz < pz + 6; cz++)
|
||||
{
|
||||
if ( w.getChunkProvider().chunkExists( cx, cz ) )
|
||||
{
|
||||
if ( px == cx && pz == cz )
|
||||
continue;
|
||||
|
||||
if ( WorldSettings.getInstance().hasGenerated( w.provider.dimensionId, cx, cz ) )
|
||||
{
|
||||
MeteoritePlacer mp2 = new MeteoritePlacer();
|
||||
mp2.spawnMeteorite( new ChunkOnly( w, cx, cz ), mp.getSettings() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
depth -= 15;
|
||||
if ( depth < 40 )
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private Collection<NBTTagCompound> getNearByMeteorites(World w, int chunkX, int chunkZ)
|
||||
{
|
||||
return WorldSettings.getInstance().getNearByMeteorites( w.provider.dimensionId, chunkX, chunkZ );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,25 +60,25 @@ final public class QuartzWorldGen implements IWorldGenerator
|
||||
{
|
||||
int seaLevel = w.provider.getAverageGroundLevel() + 1;
|
||||
|
||||
if ( seaLevel < 20 )
|
||||
if( seaLevel < 20 )
|
||||
{
|
||||
int x = ( chunkX << 4 ) + 8;
|
||||
int z = ( chunkZ << 4 ) + 8;
|
||||
seaLevel = w.getHeightValue( x, z );
|
||||
}
|
||||
|
||||
if ( this.oreNormal == null || this.oreCharged == null )
|
||||
if( this.oreNormal == null || this.oreCharged == null )
|
||||
return;
|
||||
|
||||
double oreDepthMultiplier = AEConfig.instance.quartzOresClusterAmount * seaLevel / 64;
|
||||
int scale = (int) Math.round( r.nextGaussian() * Math.sqrt( oreDepthMultiplier ) + oreDepthMultiplier );
|
||||
|
||||
for ( int x = 0; x < ( r.nextBoolean() ? scale * 2 : scale ) / 2; ++x )
|
||||
for( int x = 0; x < ( r.nextBoolean() ? scale * 2 : scale ) / 2; ++x )
|
||||
{
|
||||
boolean isCharged = r.nextFloat() > AEConfig.instance.spawnChargedChance;
|
||||
WorldGenMinable whichOre = isCharged ? this.oreCharged : this.oreNormal;
|
||||
|
||||
if ( WorldGenRegistry.INSTANCE.isWorldGenEnabled( isCharged ? WorldGenType.ChargedCertusQuartz : WorldGenType.CertusQuartz, w ) )
|
||||
if( WorldGenRegistry.INSTANCE.isWorldGenEnabled( isCharged ? WorldGenType.ChargedCertusQuartz : WorldGenType.CertusQuartz, w ) )
|
||||
{
|
||||
int cx = chunkX * 16 + r.nextInt( 22 );
|
||||
int cy = r.nextInt( 40 * seaLevel / 64 ) + r.nextInt( 22 * seaLevel / 64 ) + 12 * seaLevel / 64;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ChunkOnly extends StandardWorld
|
||||
@Override
|
||||
public int getBlockMetadata( int x, int y, int z )
|
||||
{
|
||||
if ( this.range( x, y, z ) )
|
||||
if( this.range( x, y, z ) )
|
||||
return this.target.getBlockMetadata( x & 0xF, y, z & 0xF );
|
||||
return 0;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class ChunkOnly extends StandardWorld
|
||||
@Override
|
||||
public Block getBlock( int x, int y, int z )
|
||||
{
|
||||
if ( this.range( x, y, z ) )
|
||||
if( this.range( x, y, z ) )
|
||||
return this.target.getBlock( x & 0xF, y, z & 0xF );
|
||||
return Platform.AIR;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class ChunkOnly extends StandardWorld
|
||||
@Override
|
||||
public void setBlock( int x, int y, int z, Block blk )
|
||||
{
|
||||
if ( this.range( x, y, z ) )
|
||||
if( this.range( x, y, z ) )
|
||||
{
|
||||
this.verticalBits |= 1 << ( y >> 4 );
|
||||
this.w.setBlock( x, y, z, blk, 0, 1 );
|
||||
@@ -76,7 +76,7 @@ public class ChunkOnly extends StandardWorld
|
||||
@Override
|
||||
public void setBlock( int x, int y, int z, Block blk, int metadata, int flags )
|
||||
{
|
||||
if ( this.range( x, y, z ) )
|
||||
if( this.range( x, y, z ) )
|
||||
{
|
||||
this.verticalBits |= 1 << ( y >> 4 );
|
||||
this.w.setBlock( x, y, z, blk, metadata, flags & ( ~2 ) );
|
||||
@@ -86,7 +86,7 @@ public class ChunkOnly extends StandardWorld
|
||||
@Override
|
||||
public void done()
|
||||
{
|
||||
if ( this.verticalBits != 0 )
|
||||
if( this.verticalBits != 0 )
|
||||
Platform.sendChunk( this.target, this.verticalBits );
|
||||
}
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ public class Fallout
|
||||
public void getRandomFall( IMeteoriteWorld w, int x, int y, int z )
|
||||
{
|
||||
double a = Math.random();
|
||||
if ( a > 0.9 )
|
||||
if( a > 0.9 )
|
||||
this.putter.put( w, x, y, z, Blocks.stone );
|
||||
else if ( a > 0.8 )
|
||||
else if( a > 0.8 )
|
||||
this.putter.put( w, x, y, z, Blocks.cobblestone );
|
||||
else if ( a > 0.7 )
|
||||
else if( a > 0.7 )
|
||||
this.putter.put( w, x, y, z, Blocks.dirt );
|
||||
else
|
||||
this.putter.put( w, x, y, z, Blocks.gravel );
|
||||
@@ -40,20 +40,20 @@ public class Fallout
|
||||
public void getRandomInset( IMeteoriteWorld w, int x, int y, int z )
|
||||
{
|
||||
double a = Math.random();
|
||||
if ( a > 0.9 )
|
||||
if( a > 0.9 )
|
||||
this.putter.put( w, x, y, z, Blocks.cobblestone );
|
||||
else if ( a > 0.8 )
|
||||
else if( a > 0.8 )
|
||||
this.putter.put( w, x, y, z, Blocks.stone );
|
||||
else if ( a > 0.7 )
|
||||
else if( a > 0.7 )
|
||||
this.putter.put( w, x, y, z, Blocks.grass );
|
||||
else if ( a > 0.6 )
|
||||
else if( a > 0.6 )
|
||||
{
|
||||
for ( Block skyStoneBlock : this.skyStoneDefinition.maybeBlock().asSet() )
|
||||
for( Block skyStoneBlock : this.skyStoneDefinition.maybeBlock().asSet() )
|
||||
{
|
||||
this.putter.put( w, x, y, z, skyStoneBlock );
|
||||
}
|
||||
}
|
||||
else if ( a > 0.5 )
|
||||
else if( a > 0.5 )
|
||||
this.putter.put( w, x, y, z, Blocks.gravel );
|
||||
else
|
||||
this.putter.put( w, x, y, z, Platform.AIR );
|
||||
|
||||
@@ -29,7 +29,7 @@ public class FalloutCopy extends Fallout
|
||||
public void getRandomFall( IMeteoriteWorld w, int x, int y, int z )
|
||||
{
|
||||
double a = Math.random();
|
||||
if ( a > SPECIFIED_BLOCK_THRESHOLD )
|
||||
if( a > SPECIFIED_BLOCK_THRESHOLD )
|
||||
{
|
||||
this.putter.put( w, x, y, z, this.block, this.meta );
|
||||
}
|
||||
@@ -48,11 +48,11 @@ public class FalloutCopy extends Fallout
|
||||
public void getRandomInset( IMeteoriteWorld w, int x, int y, int z )
|
||||
{
|
||||
double a = Math.random();
|
||||
if ( a > SPECIFIED_BLOCK_THRESHOLD )
|
||||
if( a > SPECIFIED_BLOCK_THRESHOLD )
|
||||
{
|
||||
this.putter.put( w, x, y, z, this.block, this.meta );
|
||||
}
|
||||
else if ( a > AIR_BLOCK_THRESHOLD )
|
||||
else if( a > AIR_BLOCK_THRESHOLD )
|
||||
{
|
||||
this.putter.put( w, x, y, z, Platform.AIR );
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class FalloutSand extends FalloutCopy
|
||||
@Override
|
||||
public void getOther( IMeteoriteWorld w, int x, int y, int z, double a )
|
||||
{
|
||||
if ( a > GLASS_THRESHOLD )
|
||||
if( a > GLASS_THRESHOLD )
|
||||
this.putter.put( w, x, y, z, Blocks.glass );
|
||||
}
|
||||
}
|
||||
@@ -27,11 +27,11 @@ public class FalloutSnow extends FalloutCopy
|
||||
@Override
|
||||
public void getOther( IMeteoriteWorld w, int x, int y, int z, double a )
|
||||
{
|
||||
if ( a > SNOW_THRESHOLD )
|
||||
if( a > SNOW_THRESHOLD )
|
||||
{
|
||||
this.putter.put( w, x, y, z, Blocks.snow );
|
||||
}
|
||||
else if ( a > ICE_THRESHOLD )
|
||||
else if( a > ICE_THRESHOLD )
|
||||
{
|
||||
this.putter.put( w, x, y, z, Blocks.ice );
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public class MeteoriteBlockPutter
|
||||
{
|
||||
Block original = w.getBlock( i, j, k );
|
||||
|
||||
if ( original == Blocks.bedrock || original == blk )
|
||||
if( original == Blocks.bedrock || original == blk )
|
||||
return false;
|
||||
|
||||
w.setBlock( i, j, k, blk );
|
||||
@@ -20,7 +20,7 @@ public class MeteoriteBlockPutter
|
||||
|
||||
public void put( IMeteoriteWorld w, int i, int j, int k, Block blk, int meta )
|
||||
{
|
||||
if ( w.getBlock( i, j, k ) == Blocks.bedrock )
|
||||
if( w.getBlock( i, j, k ) == Blocks.bedrock )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class StandardWorld implements IMeteoriteWorld
|
||||
@Override
|
||||
public int getBlockMetadata( int x, int y, int z )
|
||||
{
|
||||
if ( this.range( x, y, z ) )
|
||||
if( this.range( x, y, z ) )
|
||||
return this.w.getBlockMetadata( x, y, z );
|
||||
return 0;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class StandardWorld implements IMeteoriteWorld
|
||||
@Override
|
||||
public Block getBlock( int x, int y, int z )
|
||||
{
|
||||
if ( this.range( x, y, z ) )
|
||||
if( this.range( x, y, z ) )
|
||||
return this.w.getBlock( x, y, z );
|
||||
return Platform.AIR;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class StandardWorld implements IMeteoriteWorld
|
||||
@Override
|
||||
public boolean canBlockSeeTheSky( int x, int y, int z )
|
||||
{
|
||||
if ( this.range( x, y, z ) )
|
||||
if( this.range( x, y, z ) )
|
||||
return this.w.canBlockSeeTheSky( x, y, z );
|
||||
return false;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class StandardWorld implements IMeteoriteWorld
|
||||
@Override
|
||||
public TileEntity getTileEntity( int x, int y, int z )
|
||||
{
|
||||
if ( this.range( x, y, z ) )
|
||||
if( this.range( x, y, z ) )
|
||||
return this.w.getTileEntity( x, y, z );
|
||||
return null;
|
||||
}
|
||||
@@ -89,14 +89,14 @@ public class StandardWorld implements IMeteoriteWorld
|
||||
@Override
|
||||
public void setBlock( int x, int y, int z, Block blk )
|
||||
{
|
||||
if ( this.range( x, y, z ) )
|
||||
if( this.range( x, y, z ) )
|
||||
this.w.setBlock( x, y, z, blk );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock( int x, int y, int z, Block blk, int metadata, int flags )
|
||||
{
|
||||
if ( this.range( x, y, z ) )
|
||||
if( this.range( x, y, z ) )
|
||||
this.w.setBlock( x, y, z, blk, metadata, flags );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user