Add config option to whitelist dimensions for meteorite gen
This commit is contained in:
parent
c82de5db8f
commit
0cfa6b306a
4 changed files with 19 additions and 12 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 74e4e50c76e812cc227bea020f3c8646eacfedb1
|
Subproject commit 41ffe3a5caf12e8d80b7f629b788fe3c98e0279f
|
|
@ -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,10 @@ public class Registration
|
||||||
{
|
{
|
||||||
AEApi.instance().registries().worldgen().disableWorldGenForProviderID( type, StorageWorldProvider.class );
|
AEApi.instance().registries().worldgen().disableWorldGenForProviderID( type, StorageWorldProvider.class );
|
||||||
|
|
||||||
// end
|
for(int dimension : AEConfig.instance.meteoriteDimensionWhitelist)
|
||||||
AEApi.instance().registries().worldgen().disableWorldGenForDimension( type, 1 );
|
{
|
||||||
|
AEApi.instance().registries().worldgen().enableWorldGenForDimension( type, dimension );
|
||||||
// nether
|
}
|
||||||
AEApi.instance().registries().worldgen().disableWorldGenForDimension( type, -1 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,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> enabledDimensions = new HashSet<Integer>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,10 +41,13 @@ 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 ) )
|
if ( !types[type.ordinal()].badProviders.contains( w.provider.getClass() )
|
||||||
return false;
|
&& types[type.ordinal()].enabledDimensions.contains( w.provider.dimensionId ) )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,12 +63,12 @@ public class WorldGenRegistry implements IWorldGen
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disableWorldGenForDimension(WorldGenType type, int dimensionID)
|
public void enableWorldGenForDimension(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()].enabledDimensions.add( dimensionID );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue