类org.bukkit.block.Biome源码实例Demo

下面列出了怎么用org.bukkit.block.Biome的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: IridiumSkyblock   文件: SkyblockGenerator.java
@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;
}
 
源代码2 项目: Slimefun4   文件: TestResourceRegistration.java
@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));
}
 
源代码3 项目: civcraft   文件: Yobo.java
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);
}
 
源代码4 项目: UhcCore   文件: BiomeTypePopulator.java
@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);
                    }
                }
            }
        }
    }
}
 
源代码5 项目: UhcCore   文件: BiomeTypePopulator.java
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;
}
 
源代码6 项目: WildernessTp   文件: Checks.java
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;
    }
}
 
源代码7 项目: askyblock   文件: Island.java
/**
 * @return the biome
 */
public Biome getBiome() {
    if (biome == null) {
        biome = center.getBlock().getBiome();
    }
    return biome;
}
 
源代码8 项目: SkyWarsReloaded   文件: NMSHandler.java
@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;
		}
	};
}
 
源代码9 项目: SkyWarsReloaded   文件: NMSHandler.java
@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;
		}
	};
}
 
源代码10 项目: FastAsyncWorldedit   文件: BukkitWorld.java
@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;
    }
}
 
源代码11 项目: Kettle   文件: CraftWorld.java
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
        }
    }
}
 
源代码12 项目: SkyWarsReloaded   文件: NMSHandler.java
@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;
		}
	};
}
 
源代码13 项目: Skript   文件: BiomeMappings.java
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();
}
 
源代码14 项目: Slimefun4   文件: SaltResource.java
@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;
    }
}
 
源代码15 项目: Skript   文件: ExprBiome.java
@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());
		}
	});
}
 
源代码16 项目: Skript   文件: ExprBiome.java
@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
	if (mode == ChangeMode.SET)
		return new Class[] {Biome.class};
	return super.acceptChange(mode);
}
 
源代码17 项目: GiantTrees   文件: TreePopulator.java
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);
}
 
@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;
}
 
源代码19 项目: uSkyBlock   文件: ChunkRegenerator.java
DefaultBiomeGrid(Environment env) {
    switch (env) {
        case THE_END:
            defaultBiome = Biome.THE_END;
            break;
        case NETHER:
            defaultBiome = Biome.NETHER;
            break;
        default:
            defaultBiome = Biome.OCEAN;
            break;
    }
}
 
源代码20 项目: WildernessTp   文件: Wild.java
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());
}
 
源代码21 项目: Slimefun4   文件: TestResourceRegistration.java
@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);
}
 
源代码22 项目: WildernessTp   文件: Checks.java
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;
}
 
源代码23 项目: Slimefun4   文件: GEOResourceGenerationEvent.java
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;
}
 
源代码24 项目: askyblock   文件: ASkyBlockAPI.java
/**
 * 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;
}
 
源代码25 项目: Thermos   文件: CraftWorld.java
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;
        }
    }
}
 
源代码26 项目: Slimefun4   文件: UraniumResource.java
@Override
public int getDefaultSupply(Environment envionment, Biome biome) {
    if (envionment == Environment.NORMAL) {
        return 5;
    }

    return 0;
}
 
源代码27 项目: Thermos   文件: CraftBlock.java
public static Biome biomeBaseToBiome(BiomeGenBase base) {
    if (base == null) {
        return null;
    }

    return BIOME_MAPPING[base.biomeID];
}
 
源代码28 项目: civcraft   文件: CommonCustomMob.java
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);
}
 
源代码29 项目: askyblock   文件: BiomeItem.java
/**
 * @return the biome
 */
public Biome getBiome() {
    return biome;
}
 
源代码30 项目: ProtocolSupport   文件: BiomeRemapper.java
protected void register(Biome from, Biome to, ProtocolVersion... versions) {
	for (ProtocolVersion version : versions) {
		getTable(version).setRemap(MaterialAPI.getBiomeNetworkId(from), MaterialAPI.getBiomeNetworkId(to));
	}
}
 
 类所在包
 同包方法