Add config option to whitelist dimensions for meteorite gen

This commit is contained in:
Cisien 2014-10-18 17:32:51 -07:00
parent c82de5db8f
commit 0cfa6b306a
4 changed files with 19 additions and 12 deletions

@ -1 +1 @@
Subproject commit 74e4e50c76e812cc227bea020f3c8646eacfedb1
Subproject commit 41ffe3a5caf12e8d80b7f629b788fe3c98e0279f

View file

@ -131,6 +131,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
public double meteoriteClusterChance = 0.1;
public double meteoriteSpawnChance = 0.3;
public int[] meteoriteDimensionWhitelist = new int[] { 0 };
public int craftingCalculationTimePerTick = 5;
@ -237,6 +238,8 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
minMeteoriteDistance = get( "worldGen", "minMeteoriteDistance", minMeteoriteDistance ).getInt( minMeteoriteDistance );
meteoriteClusterChance = get( "worldGen", "meteoriteClusterChance", meteoriteClusterChance ).getDouble( meteoriteClusterChance );
meteoriteSpawnChance = get( "worldGen", "meteoriteSpawnChance", meteoriteSpawnChance ).getDouble( meteoriteSpawnChance );
meteoriteDimensionWhitelist = get ("worldGen", "meteoriteDimensionWhitelist", meteoriteDimensionWhitelist).getIntList();
quartzOresPerCluster = get( "worldGen", "quartzOresPerCluster", quartzOresPerCluster ).getInt( quartzOresPerCluster );
quartzOresClusterAmount = get( "worldGen", "quartzOresClusterAmount", quartzOresClusterAmount ).getInt( quartzOresClusterAmount );

View file

@ -678,7 +678,9 @@ public class Registration
GameRegistry.registerWorldGenerator( new QuartzWorldGen(), 0 );
if ( AEConfig.instance.isFeatureEnabled( AEFeature.MeteoriteWorldGen ) )
{
GameRegistry.registerWorldGenerator( new MeteoriteWorldGen(), 0 );
}
IMovableRegistry mr = AEApi.instance().registries().movable();
@ -722,11 +724,10 @@ public class Registration
{
AEApi.instance().registries().worldgen().disableWorldGenForProviderID( type, StorageWorldProvider.class );
// end
AEApi.instance().registries().worldgen().disableWorldGenForDimension( type, 1 );
// nether
AEApi.instance().registries().worldgen().disableWorldGenForDimension( type, -1 );
for(int dimension : AEConfig.instance.meteoriteDimensionWhitelist)
{
AEApi.instance().registries().worldgen().enableWorldGenForDimension( type, dimension );
}
}
/**

View file

@ -13,7 +13,7 @@ public class WorldGenRegistry implements IWorldGen
{
final HashSet<Class<? extends WorldProvider>> badProviders = new HashSet<Class<? extends WorldProvider>>();
final HashSet<Integer> badDimensions = new HashSet<Integer>();
final HashSet<Integer> enabledDimensions = new HashSet<Integer>();
}
@ -41,12 +41,15 @@ public class WorldGenRegistry implements IWorldGen
if ( w == null )
throw new IllegalArgumentException( "Bad Provider Passed" );
if ( types[type.ordinal()].badProviders.contains( w.provider.getClass() ) || types[type.ordinal()].badDimensions.contains( w.provider.dimensionId ) )
return false;
if ( !types[type.ordinal()].badProviders.contains( w.provider.getClass() )
&& types[type.ordinal()].enabledDimensions.contains( w.provider.dimensionId ) )
{
return true;
}
return false;
}
@Override
public void disableWorldGenForProviderID(WorldGenType type, Class<? extends WorldProvider> provider)
{
@ -60,12 +63,12 @@ public class WorldGenRegistry implements IWorldGen
}
@Override
public void disableWorldGenForDimension(WorldGenType type, int dimensionID)
public void enableWorldGenForDimension(WorldGenType type, int dimensionID)
{
if ( type == null )
throw new IllegalArgumentException( "Bad Type Passed" );
types[type.ordinal()].badDimensions.add( dimensionID );
types[type.ordinal()].enabledDimensions.add( dimensionID );
}
}