当前位置: 首页>>代码示例>>Java>>正文


Java MagmaCube类代码示例

本文整理汇总了Java中org.bukkit.entity.MagmaCube的典型用法代码示例。如果您正苦于以下问题:Java MagmaCube类的具体用法?Java MagmaCube怎么用?Java MagmaCube使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MagmaCube类属于org.bukkit.entity包,在下文中一共展示了MagmaCube类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: slimeCheck

import org.bukkit.entity.MagmaCube; //导入依赖的package包/类
void slimeCheck () {
	if (en.getType().name().equals("SLIME")) {
		if (((Slime)en).getSize() == config.getInt(path+".size"))
			checkPrelims();
	} else if (en.getType().toString().equals("MAGMA_CUBE")) {
		if (((MagmaCube)en).getSize() == config.getInt(path+".size"))
			checkPrelims();
	}
}
 
开发者ID:TheTrueColonel,项目名称:True-Custom-Drops,代码行数:10,代码来源:MobListener.java

示例2: effect

import org.bukkit.entity.MagmaCube; //导入依赖的package包/类
@Override
	public boolean effect(Event event, Player player) {
//		  List<String> lore = e.getBow().getItemMeta().getLore();
//		  if(!lore.contains(placeHolder)) {
//			  for(int i = descriptionSize; i != 0; i--)
//				  lore.remove(i);
//			  e.getProjectile().setMetadata("ce." + this.getOriginalName(), new FixedMetadataValue(main, writeType(lore)));
//			  player.setMetadata("ce.CanUnleashBeasts", null);
//		  } else
//			  e.getProjectile().setMetadata("ce." + this.getOriginalName(), null);
		  if(event instanceof EntityDamageByEntityEvent) {
		  EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event;
		  if(e.getDamager() != player)
			  return false;
		  Entity ent = e.getEntity();
		  Location loc = ent.getLocation();
		  World w = ent.getWorld();
			if(ent instanceof Silverfish || ent instanceof EnderDragon || ent instanceof Spider || ent instanceof Slime || ent instanceof Ghast || ent instanceof MagmaCube || ent instanceof CaveSpider || (ent instanceof Wolf && ((Wolf) ent).isAngry()) || ent instanceof PigZombie) {
					e.setDamage(e.getDamage()*DamageMultiplication);
					w.playEffect(loc, Effect.SMOKE, 50);
					w.playEffect(loc, Effect.MOBSPAWNER_FLAMES, 50);
					EffectManager.playSound(loc, "BLOCK_PISTON_RETRACT", 1.3f, 3f);
				return true;
			} else if (ent instanceof Player) {
				for(int i = 0; i < MaximumMobs; i++) {
					if(rand.nextInt(100) < MobAppearanceChance) {
						w.spawnEntity(loc, rand.nextInt(2) == 1 ? EntityType.SPIDER : EntityType.SLIME);
						w.playEffect(loc, Effect.MOBSPAWNER_FLAMES, 30);
						w.playEffect(loc, Effect.SMOKE, 30);
						EffectManager.playSound(loc, "BLOCK_ANVIL_BREAK", 0.3f, 0.1f);
					}
				}
			}
		}
		  return false;
	}
 
开发者ID:Taiterio,项目名称:ce,代码行数:37,代码来源:BeastmastersBow.java

示例3: CanaryMagmaCube

import org.bukkit.entity.MagmaCube; //导入依赖的package包/类
public CanaryMagmaCube(net.canarymod.api.entity.living.monster.MagmaCube entity) {
    super(entity);
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:4,代码来源:CanaryMagmaCube.java

示例4: teleportCheck

import org.bukkit.entity.MagmaCube; //导入依赖的package包/类
/** Checks that player is not trying to combatlog/is allowed to teleport
 * Returns an error message to be displayed if the player is not allowed
 * to teleport
 * Returns null if the player is allowed to teleport
 */
private static String teleportCheck(Player player) {

	Location pLoc = player.getLocation();

	World world = player.getWorld();

	/* Check if there are any players within 50 blocks */
	for (Player p : world.getPlayers()) {

		if (!p.equals(player)
				&& p.getLocation().distance(pLoc) < 50
				&& player.canSee(p)
				&& !p.isDead()) {
			return ChatColor.RED + "You cannot use this command while within 50 blocks of any other players.";
		}

	}

	/* Check if there are any hostile mobs within 5 blocks */
	for (Entity entity : world.getEntitiesByClasses(
				Blaze.class,
				CaveSpider.class,
				Creeper.class,
				Enderman.class,
				Ghast.class,
				MagmaCube.class,
				PigZombie.class,
				Skeleton.class,
				Silverfish.class,
				Slime.class,
				Spider.class,
				Witch.class,
				Zombie.class)) {

		if (entity.getLocation().distance(pLoc) < 5) {
			return ChatColor.RED + "You cannot use this command while within 5 blocks of any hostile mobs.";
		}

	}

	/* Check if the player is falling */
	if (player.getVelocity().getY() < -0.079
			|| player.getVelocity().getY() > 0.08) {
		return ChatColor.RED + "You cannot use this command while falling.";
	}

	/* Check if the player is burning */
	if (player.getFireTicks() > 0
			&& !player.hasPotionEffect(
				PotionEffectType.FIRE_RESISTANCE)) {
		return ChatColor.RED + "You cannot use this command while on fire.";
	}

	/* Default to allow teleport */
	return null;

}
 
开发者ID:C4K3,项目名称:PvPTeleport,代码行数:63,代码来源:WorldCommand.java


注:本文中的org.bukkit.entity.MagmaCube类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。