Merge pull request #324 from Cisien/whitelist
Add config option to whitelist dimensions for meteorite gen
This commit is contained in:
commit
ff77462ebb
4 changed files with 40 additions and 6 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit d46140c55da19643cd3242591be3b16e45a8297e
|
Subproject commit bbe2ad8e709a366faf34e6efac9aef37cb3d8013
|
|
@ -131,6 +131,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
|
||||||
|
|
||||||
public double meteoriteClusterChance = 0.1;
|
public double meteoriteClusterChance = 0.1;
|
||||||
public double meteoriteSpawnChance = 0.3;
|
public double meteoriteSpawnChance = 0.3;
|
||||||
|
public int[] meteoriteDimensionWhitelist = new int[] { 0 };
|
||||||
|
|
||||||
public int craftingCalculationTimePerTick = 5;
|
public int craftingCalculationTimePerTick = 5;
|
||||||
|
|
||||||
|
@ -237,6 +238,8 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
|
||||||
minMeteoriteDistance = get( "worldGen", "minMeteoriteDistance", minMeteoriteDistance ).getInt( minMeteoriteDistance );
|
minMeteoriteDistance = get( "worldGen", "minMeteoriteDistance", minMeteoriteDistance ).getInt( minMeteoriteDistance );
|
||||||
meteoriteClusterChance = get( "worldGen", "meteoriteClusterChance", meteoriteClusterChance ).getDouble( meteoriteClusterChance );
|
meteoriteClusterChance = get( "worldGen", "meteoriteClusterChance", meteoriteClusterChance ).getDouble( meteoriteClusterChance );
|
||||||
meteoriteSpawnChance = get( "worldGen", "meteoriteSpawnChance", meteoriteSpawnChance ).getDouble( meteoriteSpawnChance );
|
meteoriteSpawnChance = get( "worldGen", "meteoriteSpawnChance", meteoriteSpawnChance ).getDouble( meteoriteSpawnChance );
|
||||||
|
meteoriteDimensionWhitelist = get ("worldGen", "meteoriteDimensionWhitelist", meteoriteDimensionWhitelist).getIntList();
|
||||||
|
|
||||||
quartzOresPerCluster = get( "worldGen", "quartzOresPerCluster", quartzOresPerCluster ).getInt( quartzOresPerCluster );
|
quartzOresPerCluster = get( "worldGen", "quartzOresPerCluster", quartzOresPerCluster ).getInt( quartzOresPerCluster );
|
||||||
quartzOresClusterAmount = get( "worldGen", "quartzOresClusterAmount", quartzOresClusterAmount ).getInt( quartzOresClusterAmount );
|
quartzOresClusterAmount = get( "worldGen", "quartzOresClusterAmount", quartzOresClusterAmount ).getInt( quartzOresClusterAmount );
|
||||||
|
|
||||||
|
|
|
@ -678,7 +678,9 @@ public class Registration
|
||||||
GameRegistry.registerWorldGenerator( new QuartzWorldGen(), 0 );
|
GameRegistry.registerWorldGenerator( new QuartzWorldGen(), 0 );
|
||||||
|
|
||||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.MeteoriteWorldGen ) )
|
if ( AEConfig.instance.isFeatureEnabled( AEFeature.MeteoriteWorldGen ) )
|
||||||
|
{
|
||||||
GameRegistry.registerWorldGenerator( new MeteoriteWorldGen(), 0 );
|
GameRegistry.registerWorldGenerator( new MeteoriteWorldGen(), 0 );
|
||||||
|
}
|
||||||
|
|
||||||
IMovableRegistry mr = AEApi.instance().registries().movable();
|
IMovableRegistry mr = AEApi.instance().registries().movable();
|
||||||
|
|
||||||
|
@ -722,11 +724,17 @@ public class Registration
|
||||||
{
|
{
|
||||||
AEApi.instance().registries().worldgen().disableWorldGenForProviderID( type, StorageWorldProvider.class );
|
AEApi.instance().registries().worldgen().disableWorldGenForProviderID( type, StorageWorldProvider.class );
|
||||||
|
|
||||||
// end
|
//nether
|
||||||
AEApi.instance().registries().worldgen().disableWorldGenForDimension( type, 1 );
|
|
||||||
|
|
||||||
// nether
|
|
||||||
AEApi.instance().registries().worldgen().disableWorldGenForDimension( type, -1 );
|
AEApi.instance().registries().worldgen().disableWorldGenForDimension( type, -1 );
|
||||||
|
|
||||||
|
//end
|
||||||
|
AEApi.instance().registries().worldgen().disableWorldGenForDimension( type, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
//whitelist from config
|
||||||
|
for(int dimension : AEConfig.instance.meteoriteDimensionWhitelist)
|
||||||
|
{
|
||||||
|
AEApi.instance().registries().worldgen().enableWorldGenForDimension( WorldGenType.Meteorites, dimension );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,6 +14,7 @@ public class WorldGenRegistry implements IWorldGen
|
||||||
|
|
||||||
final HashSet<Class<? extends WorldProvider>> badProviders = new HashSet<Class<? extends WorldProvider>>();
|
final HashSet<Class<? extends WorldProvider>> badProviders = new HashSet<Class<? extends WorldProvider>>();
|
||||||
final HashSet<Integer> badDimensions = new HashSet<Integer>();
|
final HashSet<Integer> badDimensions = new HashSet<Integer>();
|
||||||
|
final HashSet<Integer> enabledDimensions = new HashSet<Integer>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,8 +42,19 @@ public class WorldGenRegistry implements IWorldGen
|
||||||
if ( w == null )
|
if ( w == null )
|
||||||
throw new IllegalArgumentException( "Bad Provider Passed" );
|
throw new IllegalArgumentException( "Bad Provider Passed" );
|
||||||
|
|
||||||
if ( types[type.ordinal()].badProviders.contains( w.provider.getClass() ) || types[type.ordinal()].badDimensions.contains( w.provider.dimensionId ) )
|
boolean isBadProvider = types[type.ordinal()].badProviders.contains( w.provider.getClass() );
|
||||||
|
boolean isBadDimension = types[type.ordinal()].badDimensions.contains( w.provider.dimensionId );
|
||||||
|
boolean isGoodDimension = types[type.ordinal()].enabledDimensions.contains( w.provider.dimensionId );
|
||||||
|
|
||||||
|
if ( isBadProvider || isBadDimension )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !isGoodDimension && type == WorldGenType.Meteorites)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -63,9 +75,20 @@ public class WorldGenRegistry implements IWorldGen
|
||||||
public void disableWorldGenForDimension(WorldGenType type, int dimensionID)
|
public void disableWorldGenForDimension(WorldGenType type, int dimensionID)
|
||||||
{
|
{
|
||||||
if ( type == null )
|
if ( type == null )
|
||||||
|
{
|
||||||
throw new IllegalArgumentException( "Bad Type Passed" );
|
throw new IllegalArgumentException( "Bad Type Passed" );
|
||||||
|
}
|
||||||
|
|
||||||
types[type.ordinal()].badDimensions.add( dimensionID );
|
types[type.ordinal()].badDimensions.add( dimensionID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enableWorldGenForDimension(WorldGenType type, int dimensionID)
|
||||||
|
{
|
||||||
|
if ( type == null )
|
||||||
|
throw new IllegalArgumentException( "Bad Type Passed" );
|
||||||
|
|
||||||
|
types[type.ordinal()].enabledDimensions.add( dimensionID );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue