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


Java SmallFireball类代码示例

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


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

示例1: onMonsterDamage

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onMonsterDamage(EntityDamageEvent event)
{		
	if (event instanceof EntityDamageByEntityEvent)
	{
		EntityDamageByEntityEvent entityDamageByEntityEvent = (EntityDamageByEntityEvent) event;
	
		//logger.info(entityDamageByEntityEvent.getDamager());
		if(entityDamageByEntityEvent.getDamager() instanceof Fireball) 
		{
			Fireball fb = (Fireball) entityDamageByEntityEvent.getDamager();
			
			if (fb.getShooter() instanceof Player)
			{
				if (fb instanceof SmallFireball)
				{
					entityDamageByEntityEvent.setDamage(entityDamageByEntityEvent.getDamage() * 3);
				}
				else // Big fireball
				{
					entityDamageByEntityEvent.setDamage(entityDamageByEntityEvent.getDamage() * 5);
				}
			}
		}
	}
}
 
开发者ID:Allov,项目名称:world-of-icerealm,代码行数:27,代码来源:FireDamageModifier.java

示例2: onInteract

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
@Override
public void onInteract(PlayerInteractEvent event) {
	event.setCancelled(true);
	Player player = event.getPlayer();
	User user = Zephyrus.getUser(player);
	Block block = (Block) user.getTarget(this).getTarget();
	int delay = user.getDelay(getInternalName());
	if (delay > 0) {
		Language.sendError("item.delay", player,
				"[SECONDS]", delay + "");
		return;
	}
	if (Zephyrus.getHookManager().canBuild(player, block)) {
		if (getLevel(player.getItemInHand().getItemMeta().getLore()) > 5) {
			player.launchProjectile(Fireball.class);
		} else {
			player.launchProjectile(SmallFireball.class);
		}
		user.setDelay(getName(), levelToDelay(getLevel(player.getItemInHand().getItemMeta().getLore())));
		return;
	}
	Language.sendError("item.rodoffire.failure", player);
}
 
开发者ID:mcardy,项目名称:Zephyrus-II,代码行数:24,代码来源:RodOfFire.java

示例3: rightClick

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
@Override
public void rightClick(Player player) {
    long cooldown;
    RPGValue value = RPGValue.get(player, item, "tnt.fireball");
    if (value == null) {
        cooldown = System.currentTimeMillis() / 50;
        value = new RPGValue(player, item, "tnt.fireball", cooldown);
    } else {
        cooldown = value.asLong();
    }
    if (cooldown <= System.currentTimeMillis() / 50) {
        value.set(System.currentTimeMillis() / 50 + cooldownTime);
        player.playSound(player.getLocation(), Sound.GHAST_FIREBALL, 1.0f, 1.0f);
        player.launchProjectile(SmallFireball.class);
    } else {
        player.sendMessage(ChatColor.AQUA + String.format(Locale.get("message.cooldown", Locale.getPlayerLocale(player)), ((double) (cooldown - System.currentTimeMillis() / 50)) / 20d));
    }
}
 
开发者ID:Thinkofname,项目名称:RPG-Items,代码行数:19,代码来源:PowerFireball.java

示例4: rightClick

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
@Override
public void rightClick(Player player) {
    long cooldown;
    if (item.getHasPermission() == true && player.hasPermission(item.getPermission()) == false){
    }else{
    RPGValue value = RPGValue.get(player, item, "tnt.fireball");
    if (value == null) {
        cooldown = System.currentTimeMillis() / 50;
        value = new RPGValue(player, item, "tnt.fireball", cooldown);
    } else {
        cooldown = value.asLong();
    }
    if (cooldown <= System.currentTimeMillis() / 50) {
        value.set(System.currentTimeMillis() / 50 + cooldownTime);
        player.playSound(player.getLocation(), Sound.GHAST_FIREBALL, 1.0f, 1.0f);
        player.launchProjectile(SmallFireball.class);
    } else {
        player.sendMessage(ChatColor.AQUA + String.format(Locale.get("message.cooldown", Locale.getPlayerLocale(player)), ((double) (cooldown - System.currentTimeMillis() / 50)) / 20d));
    }
    }
}
 
开发者ID:TheCreeperOfRedstone,项目名称:RPG-Items-2,代码行数:22,代码来源:PowerFireball.java

示例5: cast

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
@Override
public boolean cast(Player p, PlayerDataRPG pd, int level) {
    SmallFireball fireball = (SmallFireball) p.launchProjectile(SmallFireball.class);
    fireball.setIsIncendiary(false);
    fireball.setShooter(p);
    int damage = pd.getDamage(true);
    damage *= functions[0].applyAsDouble(level) / 100.0;
    fireball.setMetadata(RMetadata.META_DAMAGE, new FixedMetadataValue(Spell.plugin, damage));
    Spell.notify(p, "You shoot off a fireball.");
    return true;
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:12,代码来源:Fireball.java

示例6: executeMagic

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
public void executeMagic(Player player)
{
	SmallFireball fb = player.launchProjectile(SmallFireball.class);
	fb.setIsIncendiary(true);
	fb.setBounce(false);
	fb.setShooter(player);
	//fb.setVelocity(new Vector(1.0, 0, 0));
	//fb.setDirection(p.getVelocity().add(p.getLocation().toVector().subtract(this.b.getEntity().getLocation().toVector()).normalize().multiply(Integer.MAX_VALUE)));
}
 
开发者ID:Allov,项目名称:world-of-icerealm,代码行数:10,代码来源:FireballMagic.java

示例7: smallFireballHit

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
public static void smallFireballHit(SmallFireball fb)
{
	Location loc = fb.getLocation();
	World world = loc.getWorld();
	showCracks(loc, 1);
	world.playEffect(loc, Effect.MOBSPAWNER_FLAMES, 0);
}
 
开发者ID:Limeth,项目名称:Breakpoint,代码行数:8,代码来源:AbilityManager.java

示例8: launchProjectile

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile) {
    net.minecraft.world.World world = ((CraftWorld) getWorld()).getHandle();
    net.minecraft.entity.Entity launch = null;

    if (Snowball.class.isAssignableFrom(projectile)) {
        launch = new net.minecraft.entity.projectile.EntitySnowball(world, getHandle());
    } else if (Egg.class.isAssignableFrom(projectile)) {
        launch = new net.minecraft.entity.projectile.EntityEgg(world, getHandle());
    } else if (EnderPearl.class.isAssignableFrom(projectile)) {
        launch = new net.minecraft.entity.item.EntityEnderPearl(world, getHandle());
    } else if (Arrow.class.isAssignableFrom(projectile)) {
        launch = new net.minecraft.entity.projectile.EntityArrow(world, getHandle(), 1);
    } else if (Fireball.class.isAssignableFrom(projectile)) {
        Location location = getEyeLocation();
        Vector direction = location.getDirection().multiply(10);

        if (SmallFireball.class.isAssignableFrom(projectile)) {
            launch = new net.minecraft.entity.projectile.EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
        } else if (WitherSkull.class.isAssignableFrom(projectile)) {
            launch = new net.minecraft.entity.projectile.EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
        } else {
            launch = new net.minecraft.entity.projectile.EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
        }

        launch.func_70012_b(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
    }

    Validate.notNull(launch, "Projectile not supported");

    world.func_72838_d(launch);
    return (T) launch.getBukkitEntity();
}
 
开发者ID:agaricusb,项目名称:MCPBukkit,代码行数:34,代码来源:CraftLivingEntity.java

示例9: run

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public boolean run(Player player, String[] args, int power) {
	BlockBreakEvent e = new BlockBreakEvent(player.getTargetBlock(null, 1000), player);
	Bukkit.getPluginManager().callEvent(e);
	if (e.isCancelled()) {
		return false;
	}
	player.launchProjectile(SmallFireball.class);
	return true;
}
 
开发者ID:mcardy,项目名称:Zephyrus,代码行数:12,代码来源:Fireball.java

示例10: launchProjectile

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
    net.minecraft.world.World world = ((CraftWorld) getWorld()).getHandle();
    net.minecraft.entity.Entity launch = null;

    if (Snowball.class.isAssignableFrom(projectile)) {
        launch = new net.minecraft.entity.projectile.EntitySnowball(world, getHandle());
    } else if (Egg.class.isAssignableFrom(projectile)) {
        launch = new net.minecraft.entity.projectile.EntityEgg(world, getHandle());
    } else if (EnderPearl.class.isAssignableFrom(projectile)) {
        launch = new net.minecraft.entity.item.EntityEnderPearl(world, getHandle());
    } else if (Arrow.class.isAssignableFrom(projectile)) {
        launch = new net.minecraft.entity.projectile.EntityArrow(world, getHandle(), 1);
    } else if (ThrownPotion.class.isAssignableFrom(projectile)) {
        launch = new net.minecraft.entity.projectile.EntityPotion(world, getHandle(), CraftItemStack.asNMSCopy(new ItemStack(Material.POTION, 1)));
    } else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
        launch = new net.minecraft.entity.item.EntityExpBottle(world, getHandle());
    } else if (Fish.class.isAssignableFrom(projectile) && getHandle() instanceof net.minecraft.entity.player.EntityPlayer) {
        launch = new net.minecraft.entity.projectile.EntityFishHook(world, (net.minecraft.entity.player.EntityPlayer) getHandle());
    } else if (Fireball.class.isAssignableFrom(projectile)) {
        Location location = getEyeLocation();
        Vector direction = location.getDirection().multiply(10);

        if (SmallFireball.class.isAssignableFrom(projectile)) {
            launch = new net.minecraft.entity.projectile.EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
        } else if (WitherSkull.class.isAssignableFrom(projectile)) {
            launch = new net.minecraft.entity.projectile.EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
        } else {
            launch = new net.minecraft.entity.projectile.EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
        }

        ((net.minecraft.entity.projectile.EntityFireball) launch).projectileSource = this;
        launch.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
    }

    Validate.notNull(launch, "Projectile not supported");

    if (velocity != null) {
        ((T) launch.getBukkitEntity()).setVelocity(velocity);
    }

    world.spawnEntityInWorld(launch);
    return (T) launch.getBukkitEntity();
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:45,代码来源:CraftLivingEntity.java

示例11: gunBulletHitGroundEvent

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
/**
 * It hit the ground maybe!
 * 
 * @param event the impact event, we ignore any that aren't just blockhits
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void gunBulletHitGroundEvent(ProjectileHitEvent event) {
	if (!EntityType.SMALL_FIREBALL.equals(event.getEntityType()))
		return;
	if (event.getHitBlock() == null)
		return;

	SmallFireball bullet = (SmallFireball) event.getEntity();
	if (!bullet.getName().equals(this.tag))
		return;

	Location end = event.getHitBlock().getLocation().clone().add(0.5, 0.5, 0.5);
	World world = end.getWorld();

	// make a new sound where it hits.
	world.playSound(end, Sound.ENTITY_FIREWORK_BLAST, 1.0f, 1.5f);
	
	// make a splash
	world.spawnParticle(Particle.BLOCK_DUST, end.clone().add( 0.5, 0.0, 0.0), 5);
	world.spawnParticle(Particle.BLOCK_DUST, end.clone().add(-0.5, 0.0, 0.0), 5);
	world.spawnParticle(Particle.BLOCK_DUST, end.clone().add( 0.0, 0.5, 0.0), 5);
	world.spawnParticle(Particle.BLOCK_DUST, end.clone().add( 0.0,-0.5, 0.0), 5);
	world.spawnParticle(Particle.BLOCK_DUST, end.clone().add( 0.0, 0.0, 0.5), 5);
	world.spawnParticle(Particle.BLOCK_DUST, end.clone().add( 0.0, 0.0,-0.5), 5);

	Entity hit = event.getEntity();
	if (hit == null) {
		Location start = travelPaths.remove(bullet.getUniqueId());

		if (start != null) {
			double distance = end.distance(start);

			Vector vector = end.subtract(start).toVector();
			vector = vector.multiply(1.0d / distance);
			for (int i = 0; i < distance; i++) {
				world.spawnParticle(Particle.FLAME, start.add(vector), 5);
			}
		}

		bullet.remove();
		return;
	}
}
 
开发者ID:ProgrammerDan,项目名称:AddGun,代码行数:49,代码来源:RailGun.java

示例12: onCast

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
@Override
public CastResult onCast(User user, int power, String[] args) {
	user.getPlayer().launchProjectile(SmallFireball.class);
	return CastResult.SUCCESS;
}
 
开发者ID:mcardy,项目名称:Zephyrus-II,代码行数:6,代码来源:FirechargeSpell.java

示例13: effect

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
@Override
public void effect(Event e, ItemStack item, int level) {
    EntityShootBowEvent event = (EntityShootBowEvent) e;
    event.setCancelled(true);
    event.getEntity().launchProjectile(SmallFireball.class);
}
 
开发者ID:Taiterio,项目名称:ce,代码行数:7,代码来源:Blaze.java

示例14: use

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
@Override
public boolean use(Player player) {
    SmallFireball fireball = player.launchProjectile(SmallFireball.class);
    fireball.setMetadata("isFireBreath", new FixedMetadataValue(plugin, true));
    return true;
}
 
开发者ID:WaywardRealms,项目名称:Wayward,代码行数:7,代码来源:FireBreathSpell.java

示例15: run

import org.bukkit.entity.SmallFireball; //导入依赖的package包/类
@Override
public boolean run(Player player, ConfigurationSection config) {
    player.launchProjectile(SmallFireball.class);
	return true; 
}
 
开发者ID:EvilKanoa,项目名称:RodsTwo,代码行数:6,代码来源:Fire.java


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