Override for #getBiomesForGeneration, fixes #1070

This adds an override for `BiomeProvider#getBiomesForGeneration` to
`BiomeProviderBOPHell` that defaults to `Biomes.HELL` instead of
`Biomes.DEFAULT` (ocean) if a chunk's biome array contains -1.

Signed-off-by: srs-bsns <forfrdm@gmail.com>
This commit is contained in:
srs-bsns 2017-11-12 04:49:34 -05:00
parent 82f31e5da0
commit 7c2fc86c72
No known key found for this signature in database
GPG Key ID: 1C182C2CFA44C4AA
1 changed files with 40 additions and 0 deletions

View File

@ -8,13 +8,19 @@
package biomesoplenty.common.world;
import biomesoplenty.common.world.layer.*;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.init.Biomes;
import net.minecraft.util.ReportedException;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeProvider;
import net.minecraft.world.gen.layer.*;
public class BiomeProviderBOPHell extends BiomeProvider
{
public BiomeProviderBOPHell(long seed, WorldType worldType, String chunkProviderSettings)
{
super();
@ -32,6 +38,40 @@ public class BiomeProviderBOPHell extends BiomeProvider
this.biomeIndexLayer = genlayers[1];
}
@Override
public Biome[] getBiomesForGeneration(Biome[] biomes, int x, int z, int width, int height)
{
IntCache.resetIntCache();
if (biomes == null || biomes.length < width * height)
{
biomes = new Biome[width * height];
}
int[] aint = this.genBiomes.getInts(x, z, width, height);
try
{
for (int i = 0; i < width * height; ++i)
{
biomes[i] = Biome.getBiome(aint[i], Biomes.HELL);
}
return biomes;
}
catch (Throwable throwable)
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
CrashReportCategory crashreportcategory = crashreport.makeCategory("RawBiomeBlock");
crashreportcategory.addCrashSection("biomes[] size", biomes.length);
crashreportcategory.addCrashSection("x", x);
crashreportcategory.addCrashSection("z", z);
crashreportcategory.addCrashSection("w", width);
crashreportcategory.addCrashSection("h", height);
throw new ReportedException(crashreport);
}
}
public BiomeProviderBOPHell(World world)
{
this(world.getSeed(), world.getWorldInfo().getTerrainType(), world.getWorldInfo().getGeneratorOptions());