org.bukkit.block.Biome Java Examples
The following examples show how to use
org.bukkit.block.Biome.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Checks.java From WildernessTp with MIT License | 6 votes |
public double getSolidBlock(int x, int z, String w, Player p) { int y = 0; World world = Bukkit.getWorld(w); if (world.getBiome(x, z).equals(Biome.valueOf(nether))) { return getSolidBlockNether(x,z,p); } else { if(wild.getConfig().getBoolean("Worlds."+w+".InvertY",false)) return invertSearch(x,z,w); /*for (int i = world.getMaxHeight(); i >= 0; i--) { y = i; if (!world.getBlockAt(x, y, z).isEmpty()) { return y+ 4.5; } }*/ return Bukkit.getWorld(w).getHighestBlockAt(x,z).getRelative(BlockFace.DOWN).getY()+5; } }
Example #2
Source File: BiomeTypePopulator.java From UhcCore with GNU General Public License v3.0 | 6 votes |
private Biome getReplacementBiome(Biome biome){ switch (biome){ case OCEAN: case FROZEN_OCEAN: case WARM_OCEAN: case LUKEWARM_OCEAN: case COLD_OCEAN: return Biome.PLAINS; case DEEP_OCEAN: case DEEP_FROZEN_OCEAN: case DEEP_WARM_OCEAN: case DEEP_LUKEWARM_OCEAN: case DEEP_COLD_OCEAN: return Biome.FOREST; } return null; }
Example #3
Source File: BiomeTypePopulator.java From UhcCore with GNU General Public License v3.0 | 6 votes |
@Override public void populate(World world, Random random, Chunk chunk){ for (int x = 1; x < 15; x++) { for (int z = 1; z < 15; z++) { Block block = chunk.getBlock(x, 1, z); Biome replacementBiome = getReplacementBiome(block.getBiome()); if (UhcCore.getVersion() < 16){ if (replacementBiome != null) { block.setBiome(replacementBiome); } }else { for (int y = 0; y < 200; y++) { block = chunk.getBlock(x, y, z); if (replacementBiome != null) { block.setBiome(replacementBiome); } } } } } }
Example #4
Source File: Yobo.java From civcraft with GNU General Public License v2.0 | 6 votes |
public static void register() { setValidBiome(CustomMobType.YOBO, CustomMobLevel.LESSER, Biome.PLAINS); setValidBiome(CustomMobType.YOBO, CustomMobLevel.LESSER, Biome.FOREST); setValidBiome(CustomMobType.YOBO, CustomMobLevel.LESSER, Biome.BIRCH_FOREST); setValidBiome(CustomMobType.YOBO, CustomMobLevel.LESSER, Biome.BIRCH_FOREST_HILLS); setValidBiome(CustomMobType.YOBO, CustomMobLevel.GREATER, Biome.SUNFLOWER_PLAINS); setValidBiome(CustomMobType.YOBO, CustomMobLevel.GREATER, Biome.FLOWER_FOREST); setValidBiome(CustomMobType.YOBO, CustomMobLevel.GREATER, Biome.BIRCH_FOREST_HILLS_MOUNTAINS); setValidBiome(CustomMobType.YOBO, CustomMobLevel.GREATER, Biome.BIRCH_FOREST_MOUNTAINS); setValidBiome(CustomMobType.YOBO, CustomMobLevel.GREATER, Biome.FOREST_HILLS); setValidBiome(CustomMobType.YOBO, CustomMobLevel.ELITE, Biome.EXTREME_HILLS); setValidBiome(CustomMobType.YOBO, CustomMobLevel.ELITE, Biome.EXTREME_HILLS_PLUS); setValidBiome(CustomMobType.YOBO, CustomMobLevel.ELITE, Biome.ROOFED_FOREST); setValidBiome(CustomMobType.YOBO, CustomMobLevel.ELITE, Biome.ROOFED_FOREST_MOUNTAINS); setValidBiome(CustomMobType.YOBO, CustomMobLevel.BRUTAL, Biome.MEGA_SPRUCE_TAIGA_HILLS); setValidBiome(CustomMobType.YOBO, CustomMobLevel.BRUTAL, Biome.EXTREME_HILLS_MOUNTAINS); setValidBiome(CustomMobType.YOBO, CustomMobLevel.BRUTAL, Biome.EXTREME_HILLS_PLUS_MOUNTAINS); }
Example #5
Source File: TestResourceRegistration.java From Slimefun4 with GNU General Public License v3.0 | 6 votes |
@Test public void testOilResource() { NamespacedKey key = new NamespacedKey(plugin, "oil"); GEOResource resource = testResource(key, "Oil", SlimefunItems.OIL_BUCKET, false, 8); Assertions.assertEquals(0, resource.getDefaultSupply(Environment.NETHER, Biome.NETHER_WASTES)); Assertions.assertNotEquals(0, resource.getDefaultSupply(Environment.NORMAL, Biome.BEACH)); Assertions.assertTrue(resource.getDefaultSupply(Environment.NORMAL, Biome.DESERT) > 10); Assertions.assertTrue(resource.getDefaultSupply(Environment.NORMAL, Biome.MOUNTAINS) > 10); Assertions.assertTrue(resource.getDefaultSupply(Environment.NORMAL, Biome.ICE_SPIKES) > 10); Assertions.assertTrue(resource.getDefaultSupply(Environment.NORMAL, Biome.BADLANDS) > 10); Assertions.assertTrue(resource.getDefaultSupply(Environment.NORMAL, Biome.OCEAN) > 10); Assertions.assertTrue(resource.getDefaultSupply(Environment.NORMAL, Biome.SWAMP) > 10); Assertions.assertEquals(10, resource.getDefaultSupply(Environment.NORMAL, Biome.SUNFLOWER_PLAINS)); }
Example #6
Source File: SkyblockGenerator.java From IridiumSkyblock with GNU General Public License v2.0 | 6 votes |
@Override public ChunkData generateChunkData(World world, Random random, int cx, int cz, BiomeGrid biomeGrid) { final ChunkData chunkData = createChunkData(world); Biome biome; final Config config = IridiumSkyblock.getConfiguration(); final String worldName = world.getName(); if (worldName.equals(config.worldName)) biome = config.defaultBiome.parseBiome(); else if (worldName.equals(config.netherWorldName)) biome = config.defaultNetherBiome.parseBiome(); else return chunkData; for (int x = 0; x <= 15; x++) { for (int z = 0; z <= 15; z++) { biomeGrid.setBiome(x, z, biome); } } return chunkData; }
Example #7
Source File: ExprBiome.java From Skript with GNU General Public License v3.0 | 5 votes |
@Override @Nullable public Class<?>[] acceptChange(final ChangeMode mode) { if (mode == ChangeMode.SET) return new Class[] {Biome.class}; return super.acceptChange(mode); }
Example #8
Source File: Island.java From askyblock with GNU General Public License v2.0 | 5 votes |
/** * @return the biome */ public Biome getBiome() { if (biome == null) { biome = center.getBlock().getBiome(); } return biome; }
Example #9
Source File: TestResourceRegistration.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
@Test public void testSaltResource() { NamespacedKey key = new NamespacedKey(plugin, "salt"); GEOResource resource = testResource(key, "Salt", SlimefunItems.SALT, true, 18); Assertions.assertEquals(0, resource.getDefaultSupply(Environment.NETHER, Biome.NETHER_WASTES)); Assertions.assertEquals(0, resource.getDefaultSupply(Environment.THE_END, Biome.THE_END)); Assertions.assertNotEquals(0, resource.getDefaultSupply(Environment.NORMAL, Biome.MOUNTAINS)); Assertions.assertTrue(resource.getDefaultSupply(Environment.NORMAL, Biome.BEACH) > 10); Assertions.assertTrue(resource.getDefaultSupply(Environment.NORMAL, Biome.OCEAN) > 10); Assertions.assertTrue(resource.getDefaultSupply(Environment.NORMAL, Biome.SWAMP) > 10); }
Example #10
Source File: BukkitWorld.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public boolean setBiome(Vector2D position, BaseBiome biome) { BukkitImplAdapter adapter = BukkitQueue_0.getAdapter(); if (adapter != null) { Biome bukkitBiome = adapter.getBiome(biome.getId()); getWorld().setBiome(position.getBlockX(), position.getBlockZ(), bukkitBiome); return true; } else { return false; } }
Example #11
Source File: CraftWorld.java From Kettle with GNU General Public License v3.0 | 5 votes |
public void setBiome(int x, int z, Biome bio) { net.minecraft.world.biome.Biome bb = CraftBlock.biomeToBiomeBase(bio); if (this.world.isBlockLoaded(new BlockPos(x, 0, z))) { net.minecraft.world.chunk.Chunk chunk = this.world.getChunkFromBlockCoords(new BlockPos(x, 0, z)); if (chunk != null) { byte[] biomevals = chunk.getBiomeArray(); biomevals[((z & 0xF) << 4) | (x & 0xF)] = (byte) net.minecraft.world.biome.Biome.REGISTRY.getIDForObject(bb); chunk.markDirty(); // SPIGOT-2890 } } }
Example #12
Source File: Wild.java From WildernessTp with MIT License | 5 votes |
public List<Biome> getBlacklistedBiomes() { // Temporary fix. -- Should be enough though. return super.getConfig().getStringList("Blacklisted_Biomes").stream() .map(String::toUpperCase) .map(Biome::valueOf) .collect(Collectors.toList()); }
Example #13
Source File: BukkitChunk_All_ReadonlySnapshot.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public byte[] getBiomeArray() { if (!hasBiomes) return null; BukkitImplAdapter adapter = getParent().getAdapter(); byte[] biomes = new byte[256]; int index = 0; for (int z = 0; z < 16; z++) { for (int x = 0; x < 16; x++, index++) { Biome biome = snapshot.getBiome(x, z); biomes[index] = (byte) adapter.getBiomeId(biome); } } return biomes; }
Example #14
Source File: CommonCustomMob.java From civcraft with GNU General Public License v2.0 | 5 votes |
public static void setValidBiome(CustomMobType type, CustomMobLevel level, Biome biome) { LinkedList<TypeLevel> mobs = biomes.get(biome); if (mobs == null) { mobs = new LinkedList<TypeLevel>(); } mobs.add(new TypeLevel(type, level)); biomes.put(biome.name(), mobs); }
Example #15
Source File: Checks.java From WildernessTp with MIT License | 5 votes |
public boolean inNether(Location loc, Player target) { if (loc.getWorld().getBiome(loc.getBlockX(), loc.getBlockZ()) == Biome.valueOf(nether) || target.getWorld().getName().equals("DIM-1")) { inNether = true; } else { inNether = false; } return inNether; }
Example #16
Source File: GEOResourceGenerationEvent.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
public GEOResourceGenerationEvent(World world, Biome biome, int x, int z, GEOResource resource, int value) { this.world = world; this.biome = biome; this.resource = resource; this.x = x; this.z = z; this.value = value; }
Example #17
Source File: TreePopulator.java From GiantTrees with GNU General Public License v3.0 | 5 votes |
private boolean isAcceptableBiome(final Biome biome) { return (biome == Biome.FOREST) || (biome == Biome.BIRCH_FOREST) || (biome == Biome.SWAMP) || (biome == Biome.JUNGLE) || (biome == Biome.DARK_FOREST) || (biome == Biome.DARK_FOREST_HILLS) || (biome == Biome.MOUNTAINS) || (biome == Biome.TAIGA) || (biome == Biome.SAVANNA); }
Example #18
Source File: CraftBlock.java From Thermos with GNU General Public License v3.0 | 5 votes |
public static Biome biomeBaseToBiome(BiomeGenBase base) { if (base == null) { return null; } return BIOME_MAPPING[base.biomeID]; }
Example #19
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 5 votes |
@Override public ChunkGenerator getChunkGenerator() { return new ChunkGenerator() { @Override public final ChunkGenerator.ChunkData generateChunkData(final World world, final Random random, final int x, final int z, final ChunkGenerator.BiomeGrid chunkGererator) { final ChunkGenerator.ChunkData chunkData = this.createChunkData(world); for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { chunkGererator.setBiome(i, j, Biome.VOID); } } return chunkData; } }; }
Example #20
Source File: UraniumResource.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
@Override public int getDefaultSupply(Environment envionment, Biome biome) { if (envionment == Environment.NORMAL) { return 5; } return 0; }
Example #21
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 5 votes |
@Override public ChunkGenerator getChunkGenerator() { return new ChunkGenerator() { @Override public final ChunkGenerator.ChunkData generateChunkData(final World world, final Random random, final int x, final int z, final ChunkGenerator.BiomeGrid chunkGererator) { final ChunkGenerator.ChunkData chunkData = this.createChunkData(world); for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { chunkGererator.setBiome(i, j, Biome.VOID); } } return chunkData; } }; }
Example #22
Source File: CraftWorld.java From Thermos with GNU General Public License v3.0 | 5 votes |
public void setBiome(int x, int z, Biome bio) { net.minecraft.world.biome.BiomeGenBase bb = CraftBlock.biomeToBiomeBase(bio); if (this.world.blockExists(x, 0, z)) { net.minecraft.world.chunk.Chunk chunk = this.world.getChunkFromBlockCoords(x, z); if (chunk != null) { byte[] biomevals = chunk.getBiomeArray(); biomevals[((z & 0xF) << 4) | (x & 0xF)] = (byte)bb.biomeID; } } }
Example #23
Source File: ASkyBlockAPI.java From askyblock with GNU General Public License v2.0 | 5 votes |
/** * Sets all blocks in an island to a specified biome type * * @param islandLoc - island location * @param biomeType - biome type * @return true if the setting was successful */ public boolean setIslandBiome(Location islandLoc, Biome biomeType) { Island island = plugin.getGrid().getIslandAt(islandLoc); if (island != null) { new SetBiome(plugin, island, biomeType, null); return true; } return false; }
Example #24
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 5 votes |
@Override public ChunkGenerator getChunkGenerator() { return new ChunkGenerator() { @Override public final ChunkGenerator.ChunkData generateChunkData(final World world, final Random random, final int x, final int z, final ChunkGenerator.BiomeGrid chunkGererator) { final ChunkGenerator.ChunkData chunkData = this.createChunkData(world); for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { chunkGererator.setBiome(i, j, Biome.THE_VOID); } } return chunkData; } }; }
Example #25
Source File: ExprBiome.java From Skript with GNU General Public License v3.0 | 5 votes |
@Override protected Biome[] get(final Event e, final Location[] source) { return get(source, new Converter<Location, Biome>() { @SuppressWarnings("null") @Override public Biome convert(final Location l) { return l.getWorld().getBiome(l.getBlockX(), l.getBlockZ()); } }); }
Example #26
Source File: BiomeMappings.java From Skript with GNU General Public License v3.0 | 5 votes |
public static @Nullable Biome parse(final String name) { if (!mapFor19) return util.parse(name); To19Mapping mapping = BiomeHook.getUtil().parse(name); if (mapping == null) return util.parse(name); // Should not happen - incomplete maps are a mess to work with for programmer return mapping.getHandle(); }
Example #27
Source File: SaltResource.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
@Override public int getDefaultSupply(Environment environment, Biome biome) { if (environment != Environment.NORMAL) { return 0; } switch (biome) { case SNOWY_BEACH: case STONE_SHORE: case BEACH: case DESERT_LAKES: case RIVER: case ICE_SPIKES: case FROZEN_RIVER: return 40; case DEEP_OCEAN: case OCEAN: case COLD_OCEAN: case DEEP_COLD_OCEAN: case DEEP_FROZEN_OCEAN: case DEEP_LUKEWARM_OCEAN: case DEEP_WARM_OCEAN: case FROZEN_OCEAN: case LUKEWARM_OCEAN: case WARM_OCEAN: return 60; case SWAMP: case SWAMP_HILLS: return 20; default: return 6; } }
Example #28
Source File: ChunkRegenerator.java From uSkyBlock with GNU General Public License v3.0 | 5 votes |
DefaultBiomeGrid(Environment env) { switch (env) { case THE_END: defaultBiome = Biome.THE_END; break; case NETHER: defaultBiome = Biome.NETHER; break; default: defaultBiome = Biome.OCEAN; break; } }
Example #29
Source File: WildTpTab.java From WildernessTp with MIT License | 4 votes |
public WildTpTab(){ for(Biome biome : Biome.values()) biomes.add(biome.name()); }
Example #30
Source File: FaweAdapter_1_9.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
public int getBiomeId(Biome biome) { BiomeBase mcBiome = CraftBlock.biomeToBiomeBase(biome); return mcBiome != null ? BiomeBase.a(mcBiome) : 0; }