private static float[] getTemperatures(WorldChunkManager chunkmanager, int chunkX, int chunkZ) { BiomeBase[] biomes = chunkmanager.getBiomes(null, chunkX, chunkZ, 16, 16); float[] temps = new float[biomes.length]; for (int i = 0; i < biomes.length; i++) { float temp = biomes[i].temperature; // Vanilla of olde: ((int) biomes[i].temperature * 65536.0F) / 65536.0F if (temp > 1F) { temp = 1F; } temps[i] = temp; } return temps; }
public static ChunkSnapshot getEmptyChunkSnapshot(int x, int z, CraftWorld world, boolean includeBiome, boolean includeBiomeTempRain) { BiomeBase[] biome = null; double[] biomeTemp = null; double[] biomeRain = null; if (includeBiome || includeBiomeTempRain) { WorldChunkManager wcm = world.getHandle().getWorldChunkManager(); if (includeBiome) { biome = new BiomeBase[256]; for (int i = 0; i < 256; i++) { biome[i] = world.getHandle().getBiome((x << 4) + (i & 0xF), (z << 4) + (i >> 4)); } } if (includeBiomeTempRain) { biomeTemp = new double[256]; biomeRain = new double[256]; float[] dat = getTemperatures(wcm, x << 4, z << 4); for (int i = 0; i < 256; i++) { biomeTemp[i] = dat[i]; } dat = wcm.getWetness(null, x << 4, z << 4, 16, 16); for (int i = 0; i < 256; i++) { biomeRain[i] = dat[i]; } } } /* Fill with empty data */ int hSection = world.getMaxHeight() >> 4; short[][] blockIDs = new short[hSection][]; byte[][] skyLight = new byte[hSection][]; byte[][] emitLight = new byte[hSection][]; byte[][] blockData = new byte[hSection][]; boolean[] empty = new boolean[hSection]; for (int i = 0; i < hSection; i++) { blockIDs[i] = emptyBlockIDs; skyLight[i] = emptySkyLight; emitLight[i] = emptyData; blockData[i] = emptyData; empty[i] = true; } return new CraftChunkSnapshot(x, z, world.getName(), world.getFullTime(), blockIDs, blockData, skyLight, emitLight, empty, new int[256], biome, biomeTemp, biomeRain); }
public static ChunkSnapshot getEmptyChunkSnapshot(int x, int z, CraftWorld world, boolean includeBiome, boolean includeBiomeTempRain) { BiomeBase[] biome = null; double[] biomeTemp = null; double[] biomeRain = null; if (includeBiome || includeBiomeTempRain) { WorldChunkManager wcm = world.getHandle().getWorldChunkManager(); if (includeBiome) { biome = new BiomeBase[256]; for (int i = 0; i < 256; i++) { biome[i] = world.getHandle().getBiome((x << 4) + (i & 0xF), (z << 4) + (i >> 4)); } } if (includeBiomeTempRain) { biomeTemp = new double[256]; biomeRain = new double[256]; float[] dat = wcm.getTemperatures(null, x << 4, z << 4, 16, 16); for (int i = 0; i < 256; i++) { biomeTemp[i] = dat[i]; } dat = wcm.getWetness(null, x << 4, z << 4, 16, 16); for (int i = 0; i < 256; i++) { biomeRain[i] = dat[i]; } } } /* Fill with empty data */ int hSection = world.getMaxHeight() >> 4; short[][] blockIDs = new short[hSection][]; byte[][] skyLight = new byte[hSection][]; byte[][] emitLight = new byte[hSection][]; byte[][] blockData = new byte[hSection][]; boolean[] empty = new boolean[hSection]; for (int i = 0; i < hSection; i++) { blockIDs[i] = emptyBlockIDs; skyLight[i] = emptySkyLight; emitLight[i] = emptyData; blockData[i] = emptyData; empty[i] = true; } return new CraftChunkSnapshot(x, z, world.getName(), world.getFullTime(), blockIDs, blockData, skyLight, emitLight, empty, new int[256], biome, biomeTemp, biomeRain); }