Fixed certus worldgen

This commit is contained in:
Cisien 2014-10-18 20:29:02 -07:00
parent e12688516d
commit 9bb0722495
3 changed files with 36 additions and 9 deletions

@ -1 +1 @@
Subproject commit 41ffe3a5caf12e8d80b7f629b788fe3c98e0279f Subproject commit bbe2ad8e709a366faf34e6efac9aef37cb3d8013

View file

@ -724,10 +724,17 @@ public class Registration
{ {
AEApi.instance().registries().worldgen().disableWorldGenForProviderID( type, StorageWorldProvider.class ); AEApi.instance().registries().worldgen().disableWorldGenForProviderID( type, StorageWorldProvider.class );
//nether
AEApi.instance().registries().worldgen().disableWorldGenForDimension( type, -1 );
//end
AEApi.instance().registries().worldgen().disableWorldGenForDimension( type, 1 );
}
//whitelist from config
for(int dimension : AEConfig.instance.meteoriteDimensionWhitelist) for(int dimension : AEConfig.instance.meteoriteDimensionWhitelist)
{ {
AEApi.instance().registries().worldgen().enableWorldGenForDimension( type, dimension ); AEApi.instance().registries().worldgen().enableWorldGenForDimension( WorldGenType.Meteorites, dimension );
}
} }
/** /**

View file

@ -13,6 +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>(); final HashSet<Integer> enabledDimensions = new HashSet<Integer>();
} }
@ -41,15 +42,23 @@ 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() ) boolean isBadProvider = types[type.ordinal()].badProviders.contains( w.provider.getClass() );
&& types[type.ordinal()].enabledDimensions.contains( w.provider.dimensionId ) ) boolean isBadDimension = types[type.ordinal()].badDimensions.contains( w.provider.dimensionId );
boolean isGoodDimension = types[type.ordinal()].enabledDimensions.contains( w.provider.dimensionId );
if ( isBadProvider || isBadDimension )
{ {
return true; return false;
} }
if ( !isGoodDimension && type == WorldGenType.Meteorites)
{
return false; return false;
} }
return true;
}
@Override @Override
public void disableWorldGenForProviderID(WorldGenType type, Class<? extends WorldProvider> provider) public void disableWorldGenForProviderID(WorldGenType type, Class<? extends WorldProvider> provider)
{ {
@ -62,6 +71,17 @@ public class WorldGenRegistry implements IWorldGen
types[type.ordinal()].badProviders.add( provider ); types[type.ordinal()].badProviders.add( provider );
} }
@Override
public void disableWorldGenForDimension(WorldGenType type, int dimensionID)
{
if ( type == null )
{
throw new IllegalArgumentException( "Bad Type Passed" );
}
types[type.ordinal()].badDimensions.add( dimensionID );
}
@Override @Override
public void enableWorldGenForDimension(WorldGenType type, int dimensionID) public void enableWorldGenForDimension(WorldGenType type, int dimensionID)
{ {