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 Biome biomeBaseToBiome(BiomeBase base) { if (base == null) { return null; } return BIOME_MAPPING[base.id]; }
CraftChunkSnapshot(int x, int z, String wname, long wtime, short[][] sectionBlockIDs, byte[][] sectionBlockData, byte[][] sectionSkyLights, byte[][] sectionEmitLights, boolean[] sectionEmpty, int[] hmap, BiomeBase[] biome, double[] biomeTemp, double[] biomeRain) { this.x = x; this.z = z; this.worldname = wname; this.captureFulltime = wtime; this.blockids = sectionBlockIDs; this.blockdata = sectionBlockData; this.skylight = sectionSkyLights; this.emitlight = sectionEmitLights; this.empty = sectionEmpty; this.hmap = hmap; this.biome = biome; this.biomeTemp = biomeTemp; this.biomeRain = biomeRain; }
public List<?> getMobsFor(EnumCreatureType type, int x, int y, int z) { BiomeBase biomebase = world.getBiome(x, z); return biomebase == null ? null : biomebase.getMobs(type); }
public static BiomeBase biomeToBiomeBase(Biome bio) { if (bio == null) { return null; } return BIOMEBASE_MAPPING[bio.ordinal()]; }
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); }
@Test public void testMinecraftToBukkit() { for (BiomeBase biome : BiomeBase.REGISTRY_ID) { Assert.assertNotNull("No Bukkit mapping for " + biome, CraftBlock.biomeBaseToBiome(biome)); } }