Added support for custom beaches for vanilla biomes

This commit is contained in:
Adubbz 2016-02-09 12:26:45 +11:00
parent cda6c12bba
commit ffc04154db
4 changed files with 23 additions and 3 deletions

View file

@ -363,6 +363,12 @@ public class BOPBiome extends BiomeGenBase implements IExtendedBiome
} }
} }
} }
@Override
public int getBeachId()
{
return this.beachBiomeId;
}
@Override @Override
public BiomeGenBase getBaseBiome() public BiomeGenBase getBaseBiome()

View file

@ -19,6 +19,8 @@ public class ExtendedBiomeWrapper implements IExtendedBiome
private GenerationManager generationManager = new GenerationManager(); private GenerationManager generationManager = new GenerationManager();
private Map<BOPClimates, Integer> weightMap = new HashMap<BOPClimates, Integer>(); private Map<BOPClimates, Integer> weightMap = new HashMap<BOPClimates, Integer>();
public int beachBiomeId = BiomeGenBase.beach.biomeID;
public ExtendedBiomeWrapper(BiomeGenBase biome) public ExtendedBiomeWrapper(BiomeGenBase biome)
{ {
this.biome = biome; this.biome = biome;
@ -33,6 +35,8 @@ public class ExtendedBiomeWrapper implements IExtendedBiome
@Override @Override
public void configure(IConfigObj conf) public void configure(IConfigObj conf)
{ {
this.beachBiomeId = conf.getInt("beachBiomeId", this.beachBiomeId);
// Allow generators to be configured // Allow generators to be configured
IConfigObj confGenerators = conf.getObject("generators"); IConfigObj confGenerators = conf.getObject("generators");
if (confGenerators != null) if (confGenerators != null)
@ -89,6 +93,12 @@ public class ExtendedBiomeWrapper implements IExtendedBiome
{ {
this.weightMap.clear(); this.weightMap.clear();
} }
@Override
public int getBeachId()
{
return this.beachBiomeId;
}
@Override @Override
public BiomeGenBase getBaseBiome() public BiomeGenBase getBaseBiome()

View file

@ -30,6 +30,8 @@ public interface IExtendedBiome
public void clearWeights(); public void clearWeights();
public void addWeight(BOPClimates climate, int weight); public void addWeight(BOPClimates climate, int weight);
public int getBeachId();
/**Get the base biome associated with this extension**/ /**Get the base biome associated with this extension**/
public BiomeGenBase getBaseBiome(); public BiomeGenBase getBaseBiome();
} }

View file

@ -10,6 +10,8 @@ package biomesoplenty.common.world.layer;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import biomesoplenty.api.biome.BOPBiome; import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.BOPBiomes;
import biomesoplenty.api.biome.IExtendedBiome;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.BiomeGenJungle; import net.minecraft.world.biome.BiomeGenJungle;
import net.minecraft.world.biome.BiomeGenMesa; import net.minecraft.world.biome.BiomeGenMesa;
@ -71,10 +73,10 @@ public class GenLayerShoreBOP extends BOPGenLayer
if (biomeId != BiomeGenBase.ocean.biomeID && biomeId != BiomeGenBase.deepOcean.biomeID && biomeId != BiomeGenBase.river.biomeID && biomeId != BiomeGenBase.swampland.biomeID) if (biomeId != BiomeGenBase.ocean.biomeID && biomeId != BiomeGenBase.deepOcean.biomeID && biomeId != BiomeGenBase.river.biomeID && biomeId != BiomeGenBase.swampland.biomeID)
{ {
//Generate custom beaches for our biomes //Generate custom beaches for our biomes
if (biome != null && biome instanceof BOPBiome) if (biome != null && BOPBiomes.REG_INSTANCE.getExtendedBiome(biome) != null)
{ {
BOPBiome bopBiome = (BOPBiome)biome; IExtendedBiome extBiome = BOPBiomes.REG_INSTANCE.getExtendedBiome(biome);
setBiomeWithAdjacent(biomeIds, out, x, z, areaWidth, biomeId, bopBiome.beachBiomeId, OCEANIC_PREDICATE); setBiomeWithAdjacent(biomeIds, out, x, z, areaWidth, biomeId, extBiome.getBeachId(), OCEANIC_PREDICATE);
} }
else else
{ {