diff options
Diffstat (limited to 'src/Java/gtPlusPlus/australia/world/AustraliaWorldChunkManager.java')
-rw-r--r-- | src/Java/gtPlusPlus/australia/world/AustraliaWorldChunkManager.java | 257 |
1 files changed, 0 insertions, 257 deletions
diff --git a/src/Java/gtPlusPlus/australia/world/AustraliaWorldChunkManager.java b/src/Java/gtPlusPlus/australia/world/AustraliaWorldChunkManager.java deleted file mode 100644 index f0bd35a8b9..0000000000 --- a/src/Java/gtPlusPlus/australia/world/AustraliaWorldChunkManager.java +++ /dev/null @@ -1,257 +0,0 @@ -package gtPlusPlus.australia.world; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.crash.CrashReport; -import net.minecraft.crash.CrashReportCategory; -import net.minecraft.util.ReportedException; -import net.minecraft.world.ChunkPosition; -import net.minecraft.world.World; -import net.minecraft.world.WorldType; -import net.minecraft.world.biome.BiomeCache; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.biome.WorldChunkManager; -import net.minecraft.world.gen.layer.GenLayer; -import net.minecraft.world.gen.layer.IntCache; -import gtPlusPlus.australia.biome.GenLayerAustralia; - -public class AustraliaWorldChunkManager extends WorldChunkManager { - - private GenLayer genBiomes; - /** A GenLayer containing the indices into BiomeGenBase.biomeList[] */ - private GenLayer biomeIndexLayer; - /** The BiomeCache object for this world. */ - private BiomeCache biomeCache; - /** A list of biomes that the player can spawn in. */ - private List<BiomeGenBase> biomesToSpawnIn; - - @SuppressWarnings({ "rawtypes" }) - public AustraliaWorldChunkManager() { - this.biomeCache = new BiomeCache(this); - this.biomesToSpawnIn = new ArrayList(); - this.biomesToSpawnIn.addAll(allowedBiomes); // TODO - } - - public AustraliaWorldChunkManager(long seed, WorldType worldType) { - this(); - // i changed this to my GenLayerDarkWorld - GenLayer[] agenlayer = GenLayerAustralia.makeTheWorld(seed, worldType); - - agenlayer = getModdedBiomeGenerators(worldType, seed, agenlayer); - this.genBiomes = agenlayer[0]; - this.biomeIndexLayer = agenlayer[1]; - - - - } - - public AustraliaWorldChunkManager(World world) { - this(world.getSeed(), world.getWorldInfo().getTerrainType()); - - } - - /** - * Gets the list of valid biomes for the player to spawn in. - */ - @Override - public List<BiomeGenBase> getBiomesToSpawnIn() { - return this.biomesToSpawnIn; - } - - /** - * Returns a list of rainfall values for the specified blocks. Args: - * listToReuse, x, z, width, length. - */ - @Override - public float[] getRainfall(float[] listToReuse, int x, int z, int width, int length) { - IntCache.resetIntCache(); - - if ((listToReuse == null) || (listToReuse.length < width * length)) { - listToReuse = new float[width * length]; - } - int[] aint = this.biomeIndexLayer.getInts(x, z, width, length); - for (int i1 = 0; i1 < width * length; i1++) { - try - { - float f = BiomeGenBase.getBiome(aint[i1]).getIntRainfall() / 65536.0F; - if (f > 1.0F) { - f = 1.0F; - } - listToReuse[i1] = f; - } - catch (Throwable throwable) - { - CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id"); - CrashReportCategory crashreportcategory = crashreport.makeCategory("DownfallBlock"); - crashreportcategory.addCrashSection("biome id", Integer.valueOf(i1)); - crashreportcategory.addCrashSection("downfalls[] size", Integer.valueOf(listToReuse.length)); - crashreportcategory.addCrashSection("x", Integer.valueOf(x)); - crashreportcategory.addCrashSection("z", Integer.valueOf(z)); - crashreportcategory.addCrashSection("w", Integer.valueOf(width)); - crashreportcategory.addCrashSection("h", Integer.valueOf(length)); - throw new ReportedException(crashreport); - } - } - return listToReuse; - } - - /** - * Return an adjusted version of a given temperature based on the y - * height - */ - @Override - @SideOnly(Side.CLIENT) - public float getTemperatureAtHeight(float par1, int par2) { - return par1; - } - - /** - * Returns an array of biomes for the location input. - */ - @Override - public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) { - IntCache.resetIntCache(); - - if ((par1ArrayOfBiomeGenBase == null) || (par1ArrayOfBiomeGenBase.length < par4 * par5)) { - par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; - } - int[] aint = this.genBiomes.getInts(par2, par3, par4, par5); - try - { - for (int i = 0; i < par4 * par5; i++) { - par1ArrayOfBiomeGenBase[i] = BiomeGenBase.getBiome(aint[i]); - } - return par1ArrayOfBiomeGenBase; - } - catch (Throwable throwable) - { - CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id"); - CrashReportCategory crashreportcategory = crashreport.makeCategory("RawBiomeBlock"); - crashreportcategory.addCrashSection("biomes[] size", Integer.valueOf(par1ArrayOfBiomeGenBase.length)); - crashreportcategory.addCrashSection("x", Integer.valueOf(par2)); - crashreportcategory.addCrashSection("z", Integer.valueOf(par3)); - crashreportcategory.addCrashSection("w", Integer.valueOf(par4)); - crashreportcategory.addCrashSection("h", Integer.valueOf(par5)); - throw new ReportedException(crashreport); - } - - } - - /** - * Returns biomes to use for the blocks and loads the other data like - * temperature and humidity onto the WorldChunkManager Args: - * oldBiomeList, x, z, width, depth - */ - @Override - public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] oldBiomeList, int x, int z, int width, int depth) { - return this.getBiomeGenAt(oldBiomeList, x, z, width, depth, true); - } - - /** - * Return a list of biomes for the specified blocks. Args: listToReuse, - * x, y, width, length, cacheFlag (if false, don't check biomeCache to - * avoid infinite loop in BiomeCacheBlock) - */ - @Override - public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int x, int y, int width, int length, boolean cacheFlag) { - IntCache.resetIntCache(); - if ((listToReuse == null) || (listToReuse.length < width * length)) { - listToReuse = new BiomeGenBase[width * length]; - } - if ((cacheFlag) && (width == 16) && (length == 16) && ((x & 0xF) == 0) && ((y & 0xF) == 0)) - { - BiomeGenBase[] abiomegenbase1 = this.biomeCache.getCachedBiomes(x, y); - System.arraycopy(abiomegenbase1, 0, listToReuse, 0, width * length); - return listToReuse; - } - int[] aint = this.biomeIndexLayer.getInts(x, y, width, length); - for (int i = 0; i < width * length; i++) { - listToReuse[i] = BiomeGenBase.getBiome(aint[i]); - } - return listToReuse; - } - - /** - * checks given Chunk's Biomes against List of allowed ones - */ - @Override - @SuppressWarnings("rawtypes") - public boolean areBiomesViable(int x, int y, int z, List par4List) { - IntCache.resetIntCache(); - int l = x - z >> 2; - int i1 = y - z >> 2; - int j1 = x + z >> 2; - int k1 = y + z >> 2; - int l1 = j1 - l + 1; - int i2 = k1 - i1 + 1; - int[] aint = this.genBiomes.getInts(l, i1, l1, i2); - try - { - for (int j2 = 0; j2 < l1 * i2; j2++) - { - BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[j2]); - if (!par4List.contains(biomegenbase)) { - return false; - } - } - return true; - } - catch (Throwable throwable) - { - CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id"); - CrashReportCategory crashreportcategory = crashreport.makeCategory("Layer"); - crashreportcategory.addCrashSection("Layer", this.genBiomes.toString()); - crashreportcategory.addCrashSection("x", Integer.valueOf(x)); - crashreportcategory.addCrashSection("z", Integer.valueOf(y)); - crashreportcategory.addCrashSection("radius", Integer.valueOf(z)); - crashreportcategory.addCrashSection("allowed", par4List); - throw new ReportedException(crashreport); - } - } - - /** - * Finds a valid position within a range, that is in one of the listed - * biomes. Searches {par1,par2} +-par3 blocks. Strongly favors positive - * y positions. - */ - @Override - @SuppressWarnings("rawtypes") - public ChunkPosition findBiomePosition(int p_150795_1_, int p_150795_2_, int p_150795_3_, List p_150795_4_, Random p_150795_5_) { - IntCache.resetIntCache(); - int l = p_150795_1_ - p_150795_3_ >> 2; - int i1 = p_150795_2_ - p_150795_3_ >> 2; - int j1 = p_150795_1_ + p_150795_3_ >> 2; - int k1 = p_150795_2_ + p_150795_3_ >> 2; - int l1 = j1 - l + 1; - int i2 = k1 - i1 + 1; - int[] aint = this.genBiomes.getInts(l, i1, l1, i2); - ChunkPosition chunkposition = null; - int j2 = 0; - for (int k2 = 0; k2 < l1 * i2; k2++) - { - int l2 = l + k2 % l1 << 2; - int i3 = i1 + k2 / l1 << 2; - BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[k2]); - if ((p_150795_4_.contains(biomegenbase)) && ((chunkposition == null) || (p_150795_5_.nextInt(j2 + 1) == 0))) - { - chunkposition = new ChunkPosition(l2, 0, i3); - j2++; - } - } - return chunkposition; - } - - /** - * Calls the WorldChunkManager's biomeCache.cleanupCache() - */ - @Override - public void cleanupCache() { - this.biomeCache.cleanupCache(); - } - -}
\ No newline at end of file |