Replaced all tabs with spaces
This commit is contained in:
parent
be3df43779
commit
78f2560f3e
|
@ -13,29 +13,29 @@ import net.minecraft.world.biome.BiomeGenBase;
|
|||
|
||||
public class BOPBiome extends BiomeGenBase implements IExtendedBiome
|
||||
{
|
||||
private GenerationManager generationManager = new GenerationManager();
|
||||
|
||||
public BOPBiome()
|
||||
{
|
||||
super(-1, false);
|
||||
|
||||
this.theBiomeDecorator.treesPerChunk = -999;
|
||||
this.theBiomeDecorator.flowersPerChunk = -999;
|
||||
this.theBiomeDecorator.grassPerChunk = -999;
|
||||
this.theBiomeDecorator.sandPerChunk = -999;
|
||||
this.theBiomeDecorator.sandPerChunk2 = -999;
|
||||
this.theBiomeDecorator.clayPerChunk = -999;
|
||||
}
|
||||
private GenerationManager generationManager = new GenerationManager();
|
||||
|
||||
@Override
|
||||
public BiomeOwner getBiomeOwner()
|
||||
{
|
||||
return BiomeOwner.BIOMESOPLENTY;
|
||||
}
|
||||
public BOPBiome()
|
||||
{
|
||||
super(-1, false);
|
||||
|
||||
@Override
|
||||
public GenerationManager getGenerationManager()
|
||||
{
|
||||
return this.generationManager;
|
||||
}
|
||||
this.theBiomeDecorator.treesPerChunk = -999;
|
||||
this.theBiomeDecorator.flowersPerChunk = -999;
|
||||
this.theBiomeDecorator.grassPerChunk = -999;
|
||||
this.theBiomeDecorator.sandPerChunk = -999;
|
||||
this.theBiomeDecorator.sandPerChunk2 = -999;
|
||||
this.theBiomeDecorator.clayPerChunk = -999;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeOwner getBiomeOwner()
|
||||
{
|
||||
return BiomeOwner.BIOMESOPLENTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenerationManager getGenerationManager()
|
||||
{
|
||||
return this.generationManager;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,5 +12,5 @@ import net.minecraft.world.biome.BiomeGenBase;
|
|||
|
||||
public class BOPBiomes
|
||||
{
|
||||
public static BiomeGenBase alps;
|
||||
public static BiomeGenBase alps;
|
||||
}
|
||||
|
|
|
@ -20,85 +20,85 @@ import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate;
|
|||
|
||||
public class ExtendedBiomeRegistry
|
||||
{
|
||||
private static Map<BiomeGenBase, BiomeExtension> externalExtensions = new HashMap();
|
||||
|
||||
public static boolean isRegistered(BiomeGenBase biome)
|
||||
{
|
||||
return biome.biomeID != -1;
|
||||
}
|
||||
|
||||
public static BiomeExtension createExtension(BiomeGenBase biome)
|
||||
{
|
||||
return externalExtensions.put(biome, new BiomeExtension(biome));
|
||||
}
|
||||
|
||||
public static IExtendedBiome getExtension(BiomeGenBase biome)
|
||||
{
|
||||
if (biome instanceof IExtendedBiome)
|
||||
{
|
||||
return (IExtendedBiome)biome;
|
||||
}
|
||||
else if (externalExtensions.containsKey(biome))
|
||||
{
|
||||
return externalExtensions.get(biome);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class BiomeExtension implements IExtendedBiome
|
||||
{
|
||||
public BiomeGenBase biome;
|
||||
private GenerationManager generationManager = new GenerationManager();
|
||||
|
||||
private BiomeExtension(BiomeGenBase biome)
|
||||
{
|
||||
this.biome = biome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeOwner getBiomeOwner()
|
||||
{
|
||||
return BiomeOwner.OTHER;
|
||||
}
|
||||
private static Map<BiomeGenBase, BiomeExtension> externalExtensions = new HashMap();
|
||||
|
||||
@Override
|
||||
public GenerationManager getGenerationManager()
|
||||
{
|
||||
return this.generationManager;
|
||||
}
|
||||
}
|
||||
|
||||
public static class GenerationManager
|
||||
{
|
||||
private Map<String, IGenerator<?>> generatorMap = new HashMap();
|
||||
//TODO: Come up with a better sequencing system
|
||||
private Map<String, Decorate.EventType> generatorSequenceMap = new HashMap();;
|
||||
|
||||
public void addGenerator(String key, IGenerator<?> generator, Decorate.EventType nextFeature)
|
||||
{
|
||||
this.generatorMap.put(key, generator);
|
||||
this.generatorSequenceMap.put(key, nextFeature);
|
||||
}
|
||||
|
||||
public void addGenerator(String key, IGenerator<?> generator)
|
||||
{
|
||||
this.addGenerator(key, generator, Decorate.EventType.CUSTOM);
|
||||
}
|
||||
public static boolean isRegistered(BiomeGenBase biome)
|
||||
{
|
||||
return biome.biomeID != -1;
|
||||
}
|
||||
|
||||
public void configureGenerators(Map<String, IGenerator<?>> generatorMap)
|
||||
{
|
||||
this.generatorMap.putAll(generatorMap);
|
||||
}
|
||||
public static BiomeExtension createExtension(BiomeGenBase biome)
|
||||
{
|
||||
return externalExtensions.put(biome, new BiomeExtension(biome));
|
||||
}
|
||||
|
||||
public Map<String, IGenerator<?>> getGeneratorMap()
|
||||
{
|
||||
return Collections.unmodifiableMap(this.generatorMap);
|
||||
}
|
||||
|
||||
public Decorate.EventType getGeneratorStage(String key)
|
||||
{
|
||||
return generatorSequenceMap.get(key);
|
||||
}
|
||||
}
|
||||
public static IExtendedBiome getExtension(BiomeGenBase biome)
|
||||
{
|
||||
if (biome instanceof IExtendedBiome)
|
||||
{
|
||||
return (IExtendedBiome)biome;
|
||||
}
|
||||
else if (externalExtensions.containsKey(biome))
|
||||
{
|
||||
return externalExtensions.get(biome);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class BiomeExtension implements IExtendedBiome
|
||||
{
|
||||
public BiomeGenBase biome;
|
||||
private GenerationManager generationManager = new GenerationManager();
|
||||
|
||||
private BiomeExtension(BiomeGenBase biome)
|
||||
{
|
||||
this.biome = biome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeOwner getBiomeOwner()
|
||||
{
|
||||
return BiomeOwner.OTHER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenerationManager getGenerationManager()
|
||||
{
|
||||
return this.generationManager;
|
||||
}
|
||||
}
|
||||
|
||||
public static class GenerationManager
|
||||
{
|
||||
private Map<String, IGenerator<?>> generatorMap = new HashMap();
|
||||
//TODO: Come up with a better sequencing system
|
||||
private Map<String, Decorate.EventType> generatorSequenceMap = new HashMap();;
|
||||
|
||||
public void addGenerator(String key, IGenerator<?> generator, Decorate.EventType nextFeature)
|
||||
{
|
||||
this.generatorMap.put(key, generator);
|
||||
this.generatorSequenceMap.put(key, nextFeature);
|
||||
}
|
||||
|
||||
public void addGenerator(String key, IGenerator<?> generator)
|
||||
{
|
||||
this.addGenerator(key, generator, Decorate.EventType.CUSTOM);
|
||||
}
|
||||
|
||||
public void configureGenerators(Map<String, IGenerator<?>> generatorMap)
|
||||
{
|
||||
this.generatorMap.putAll(generatorMap);
|
||||
}
|
||||
|
||||
public Map<String, IGenerator<?>> getGeneratorMap()
|
||||
{
|
||||
return Collections.unmodifiableMap(this.generatorMap);
|
||||
}
|
||||
|
||||
public Decorate.EventType getGeneratorStage(String key)
|
||||
{
|
||||
return generatorSequenceMap.get(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,16 +13,16 @@ import biomesoplenty.api.biome.BOPBiome;
|
|||
|
||||
public class BiomeGenAlps extends BOPBiome
|
||||
{
|
||||
private static final Height biomeHeight = new Height(8.0F, 0.025F);
|
||||
|
||||
public BiomeGenAlps()
|
||||
{
|
||||
this.setHeight(biomeHeight);
|
||||
private static final Height biomeHeight = new Height(8.0F, 0.025F);
|
||||
|
||||
public BiomeGenAlps()
|
||||
{
|
||||
this.setHeight(biomeHeight);
|
||||
this.setColor(13421772);
|
||||
this.setEnableSnow();
|
||||
this.setTemperatureRainfall(0.0F, 0.5F);
|
||||
|
||||
this.topBlock = Blocks.snow.getDefaultState();
|
||||
this.fillerBlock = Blocks.snow.getDefaultState();
|
||||
}
|
||||
|
||||
this.topBlock = Blocks.snow.getDefaultState();
|
||||
this.fillerBlock = Blocks.snow.getDefaultState();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,16 +80,16 @@ public class BiomeConfigurationHandler
|
|||
|
||||
public static void translateVanillaValues(BiomeGenBase biome)
|
||||
{
|
||||
/*IExtendedBiome extendedBiome = ExtendedBiomeRegistry.getExtension(biome);
|
||||
/*IExtendedBiome extendedBiome = ExtendedBiomeRegistry.getExtension(biome);
|
||||
GenerationManager generationManager = extendedBiome.getGenerationManager();
|
||||
|
||||
|
||||
if (extendedBiome.getBiomeOwner() == BiomeOwner.OTHER)
|
||||
{
|
||||
if (biome.theBiomeDecorator.cactiPerChunk > 0)
|
||||
{
|
||||
WorldGenCactus cactusGen = new WorldGenCactus();
|
||||
IExtendedCactusGen extendedCactusGen = (IExtendedCactusGen) cactusGen;
|
||||
|
||||
|
||||
extendedCactusGen.setCactiPerChunk(biome.theBiomeDecorator.cactiPerChunk);
|
||||
generationManager.addGenerator("cactus", extendedCactusGen, Decorate.EventType.CACTUS);
|
||||
biome.theBiomeDecorator.cactiPerChunk = 0;
|
||||
|
@ -99,42 +99,42 @@ public class BiomeConfigurationHandler
|
|||
|
||||
private static void configureBiomeWithJson(BiomeGenBase biome, JsonBiome jsonBiome)
|
||||
{
|
||||
IExtendedBiome extendedBiome = ExtendedBiomeRegistry.getExtension(biome);
|
||||
IExtendedBiome extendedBiome = ExtendedBiomeRegistry.getExtension(biome);
|
||||
|
||||
if (extendedBiome != null)
|
||||
{
|
||||
GenerationManager generationManager = extendedBiome.getGenerationManager();
|
||||
if (extendedBiome != null)
|
||||
{
|
||||
GenerationManager generationManager = extendedBiome.getGenerationManager();
|
||||
|
||||
if (extendedBiome.getBiomeOwner() == BiomeOwner.BIOMESOPLENTY)
|
||||
{
|
||||
if (jsonBiome.biomeId != -1)
|
||||
{
|
||||
biome.biomeID = jsonBiome.biomeId;
|
||||
BiomeGenBase.getBiomeGenArray()[jsonBiome.biomeId] = biome;
|
||||
}
|
||||
else
|
||||
{
|
||||
biome.biomeID = -1;
|
||||
}
|
||||
}
|
||||
if (extendedBiome.getBiomeOwner() == BiomeOwner.BIOMESOPLENTY)
|
||||
{
|
||||
if (jsonBiome.biomeId != -1)
|
||||
{
|
||||
biome.biomeID = jsonBiome.biomeId;
|
||||
BiomeGenBase.getBiomeGenArray()[jsonBiome.biomeId] = biome;
|
||||
}
|
||||
else
|
||||
{
|
||||
biome.biomeID = -1;
|
||||
}
|
||||
}
|
||||
|
||||
biome.biomeName = jsonBiome.biomeName;
|
||||
biome.topBlock = jsonBiome.topBlock;
|
||||
biome.fillerBlock = jsonBiome.fillerBlock;
|
||||
biome.setHeight(new BiomeGenBase.Height(jsonBiome.rootHeight, jsonBiome.rootVariation));
|
||||
biome.temperature = jsonBiome.temperature;
|
||||
biome.rainfall = jsonBiome.rainfall;
|
||||
// TODO: Reflect and modify enableRain and enableSnow
|
||||
biome.color = jsonBiome.color;
|
||||
biome.waterColorMultiplier = jsonBiome.waterColorMultiplier;
|
||||
JsonEntitySpawn.addBiomeEntitySpawns(biome, jsonBiome);
|
||||
biome.biomeName = jsonBiome.biomeName;
|
||||
biome.topBlock = jsonBiome.topBlock;
|
||||
biome.fillerBlock = jsonBiome.fillerBlock;
|
||||
biome.setHeight(new BiomeGenBase.Height(jsonBiome.rootHeight, jsonBiome.rootVariation));
|
||||
biome.temperature = jsonBiome.temperature;
|
||||
biome.rainfall = jsonBiome.rainfall;
|
||||
// TODO: Reflect and modify enableRain and enableSnow
|
||||
biome.color = jsonBiome.color;
|
||||
biome.waterColorMultiplier = jsonBiome.waterColorMultiplier;
|
||||
JsonEntitySpawn.addBiomeEntitySpawns(biome, jsonBiome);
|
||||
|
||||
generationManager.configureGenerators(jsonBiome.decoration);
|
||||
}
|
||||
generationManager.configureGenerators(jsonBiome.decoration);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Map<BiomeGenBase, String> getConfigFileMap()
|
||||
{
|
||||
return BiomeConfigurationHandler.configFileMap;
|
||||
return BiomeConfigurationHandler.configFileMap;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,28 +15,28 @@ import net.minecraftforge.common.config.Configuration;
|
|||
|
||||
public class MiscConfigurationHandler
|
||||
{
|
||||
public static Configuration config;
|
||||
|
||||
public static boolean useBoPWorldTypeDefault;
|
||||
|
||||
public static Configuration config;
|
||||
|
||||
public static boolean useBoPWorldTypeDefault;
|
||||
|
||||
public static void init(File configFile)
|
||||
{
|
||||
config = new Configuration(configFile);
|
||||
config = new Configuration(configFile);
|
||||
|
||||
try
|
||||
{
|
||||
config.load();
|
||||
|
||||
//TODO: Make this default to true once all biomes have been implemented
|
||||
useBoPWorldTypeDefault = config.getBoolean("Default to BoP World Type", "GUI Settings", false, "Use the Biomes O' Plenty World Type by default when selecting a world.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
BiomesOPlenty.logger.error("Biomes O' Plenty has encountered a problem loading misc.cfg", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (config.hasChanged()) config.save();
|
||||
}
|
||||
try
|
||||
{
|
||||
config.load();
|
||||
|
||||
//TODO: Make this default to true once all biomes have been implemented
|
||||
useBoPWorldTypeDefault = config.getBoolean("Default to BoP World Type", "GUI Settings", false, "Use the Biomes O' Plenty World Type by default when selecting a world.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
BiomesOPlenty.logger.error("Biomes O' Plenty has encountered a problem loading misc.cfg", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (config.hasChanged()) config.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,21 +29,21 @@ public class DecorateBiomeEventHandler
|
|||
BlockPos pos = event.pos.add(16, 0, 16);
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(pos);
|
||||
IExtendedBiome extendedBiome = ExtendedBiomeRegistry.getExtension(biome);
|
||||
|
||||
|
||||
if (extendedBiome != null)
|
||||
{
|
||||
GenerationManager generationManager = extendedBiome.getGenerationManager();
|
||||
GenerationManager generationManager = extendedBiome.getGenerationManager();
|
||||
|
||||
for (Entry<String, IGenerator<?>> entry : generationManager.getGeneratorMap().entrySet())
|
||||
{
|
||||
String key = entry.getKey();
|
||||
IGenerator<?> generator = entry.getValue();
|
||||
for (Entry<String, IGenerator<?>> entry : generationManager.getGeneratorMap().entrySet())
|
||||
{
|
||||
String key = entry.getKey();
|
||||
IGenerator<?> generator = entry.getValue();
|
||||
|
||||
if (generationManager.getGeneratorStage(key) == event.type)
|
||||
{
|
||||
generator.generate(world, event.rand, event.pos);
|
||||
}
|
||||
}
|
||||
if (generationManager.getGeneratorStage(key) == event.type)
|
||||
{
|
||||
generator.generate(world, event.rand, event.pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,27 +21,27 @@ import biomesoplenty.common.world.WorldTypeBOP;
|
|||
public class ModBiomes
|
||||
{
|
||||
public static WorldTypeBOP worldTypeBOP;
|
||||
|
||||
|
||||
private static int nextBiomeId = 40;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
worldTypeBOP = new WorldTypeBOP();
|
||||
|
||||
|
||||
registerBiomes();
|
||||
registerExternalBiomes();
|
||||
}
|
||||
|
||||
|
||||
private static void registerBiomes()
|
||||
{
|
||||
alps = registerBiome(new BiomeGenAlps().setBiomeName("Alps"), "alps");
|
||||
|
||||
BiomeManager.addBiome(BiomeType.DESERT, new BiomeEntry(alps, 100));
|
||||
BiomeManager.addBiome(BiomeType.WARM, new BiomeEntry(alps, 100));
|
||||
BiomeManager.addBiome(BiomeType.COOL, new BiomeEntry(alps, 100));
|
||||
BiomeManager.addBiome(BiomeType.ICY, new BiomeEntry(alps, 100));
|
||||
alps = registerBiome(new BiomeGenAlps().setBiomeName("Alps"), "alps");
|
||||
|
||||
BiomeManager.addBiome(BiomeType.DESERT, new BiomeEntry(alps, 100));
|
||||
BiomeManager.addBiome(BiomeType.WARM, new BiomeEntry(alps, 100));
|
||||
BiomeManager.addBiome(BiomeType.COOL, new BiomeEntry(alps, 100));
|
||||
BiomeManager.addBiome(BiomeType.ICY, new BiomeEntry(alps, 100));
|
||||
}
|
||||
|
||||
|
||||
private static void registerExternalBiomes()
|
||||
{
|
||||
registerExternalBiome(BiomeGenBase.ocean, "ocean");
|
||||
|
@ -85,38 +85,38 @@ public class ModBiomes
|
|||
registerExternalBiome(BiomeGenBase.mesaPlateau_F, "mesa_plateau_f");
|
||||
registerExternalBiome(BiomeGenBase.mesaPlateau, "mesa_plateau");
|
||||
}
|
||||
|
||||
|
||||
private static BiomeGenBase registerBiome(BiomeGenBase biome, String id)
|
||||
{
|
||||
biome.biomeID = getNextFreeBiomeId();
|
||||
biome.biomeID = getNextFreeBiomeId();
|
||||
BiomeConfigurationHandler.getConfigFileMap().put(biome, id);
|
||||
|
||||
|
||||
return biome;
|
||||
}
|
||||
|
||||
|
||||
private static void registerExternalBiome(BiomeGenBase biome, String id)
|
||||
{
|
||||
ExtendedBiomeRegistry.createExtension(biome);
|
||||
ExtendedBiomeRegistry.createExtension(biome);
|
||||
BiomeConfigurationHandler.translateVanillaValues(biome);
|
||||
BiomeConfigurationHandler.getConfigFileMap().put(biome, id);
|
||||
}
|
||||
|
||||
|
||||
public static int getNextFreeBiomeId()
|
||||
{
|
||||
for (int i = nextBiomeId; i < 256; i++)
|
||||
{
|
||||
if (BiomeGenBase.getBiomeGenArray()[i] != null)
|
||||
{
|
||||
if (i == 255) throw new IllegalArgumentException("There are no more biome ids avaliable!");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
nextBiomeId = i + 1;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
for (int i = nextBiomeId; i < 256; i++)
|
||||
{
|
||||
if (BiomeGenBase.getBiomeGenArray()[i] != null)
|
||||
{
|
||||
if (i == 255) throw new IllegalArgumentException("There are no more biome ids avaliable!");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
nextBiomeId = i + 1;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@ public class ModConfiguration
|
|||
{
|
||||
public static void init(File configDirectory)
|
||||
{
|
||||
MiscConfigurationHandler.init(new File(configDirectory, "misc.cfg"));
|
||||
MiscConfigurationHandler.init(new File(configDirectory, "misc.cfg"));
|
||||
}
|
||||
|
||||
|
||||
public static void initEnd(File configDirectory)
|
||||
{
|
||||
BiomeConfigurationHandler.init(new File(configDirectory, "biomes"));
|
||||
|
|
|
@ -57,20 +57,20 @@ public class JsonEntitySpawn
|
|||
|
||||
for (JsonEntitySpawn entitySpawn : jsonBiome.entities)
|
||||
{
|
||||
if (entitySpawn != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
EnumCreatureType creatureType = EnumCreatureType.valueOf(entitySpawn.entityType.toUpperCase());
|
||||
Class entityClass = Class.forName(entitySpawn.entityClass);
|
||||
if (entitySpawn != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
EnumCreatureType creatureType = EnumCreatureType.valueOf(entitySpawn.entityType.toUpperCase());
|
||||
Class entityClass = Class.forName(entitySpawn.entityClass);
|
||||
|
||||
biome.getSpawnableList(creatureType).add(new BiomeGenBase.SpawnListEntry(entityClass, entitySpawn.weight, entitySpawn.minGroupCount, entitySpawn.maxGroupCount));
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
biome.getSpawnableList(creatureType).add(new BiomeGenBase.SpawnListEntry(entityClass, entitySpawn.weight, entitySpawn.minGroupCount, entitySpawn.maxGroupCount));
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue