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


Java LargeFireball类代码示例

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


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

示例1: notify

import org.bukkit.entity.LargeFireball; //导入依赖的package包/类
@Override
public void notify(Player player, Object extra) {
    Location eye = player.getEyeLocation();
    Vector direction = eye.getDirection().multiply(2);
    Block source = (Block) extra;
    Projectile projectile = player.getWorld().spawn(source.getRelative(BlockFace.UP).getLocation().setDirection(direction), LargeFireball.class);
    projectile.setShooter(player);
    projectile.setVelocity(direction);
    
    Inventory inv = player.getInventory();
    if (inv.contains(Material.TNT)) {
        int slot = inv.first(Material.TNT);
        ItemStack ammo = inv.getItem(slot);
        int amount = ammo.getAmount();
        if (amount > 1) {
            ammo.setAmount(amount - 1);
            inv.setItem(slot, ammo);
        } else {
            inv.setItem(slot, null);
        }
        
        projectile.setCustomName("recreator.structure.turret.tnt");
    }
    
    AzureAPI.playSound(player, Sound.ITEM_FIRECHARGE_USE, true);
}
 
开发者ID:Recraft,项目名称:Recreator,代码行数:27,代码来源:StructureTurret.java

示例2: onGhastShoot

import org.bukkit.entity.LargeFireball; //导入依赖的package包/类
@EventHandler
public void onGhastShoot(ProjectileLaunchEvent event) {
	if (event.getEntity() instanceof LargeFireball) {
		// ghast fireball
		LargeFireball frb = (LargeFireball) event.getEntity();
		if (frb.getShooter() instanceof Ghast) {
			Ghast g = (Ghast) frb.getShooter();
			DroneFighter f = getFighter(g);
			if (f == null) {
				g.remove();
				//System.out.println("f for ghast is null, removing!");
				event.setCancelled(true);
			} else {
				event.setCancelled(true);
				//System.out.println("Dud fire!");
			}
		}
	}
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:20,代码来源:SQSkywatch.java

示例3: Bullet

import org.bukkit.entity.LargeFireball; //导入依赖的package包/类
public Bullet(SwornGuns plugin, GunPlayer shooter, Gun shotFrom, Vector velocity)
{
	this.plugin = plugin;
	this.shotFrom = shotFrom;
	this.shooter = shooter;
	this.velocity = velocity;
	this.active = true;

	if (shotFrom.isThrowable())
	{
		ItemStack thrown = shotFrom.getMaterial().newItemStack(1);

		this.projectile = shooter.getPlayer().getWorld().dropItem(shooter.getPlayer().getEyeLocation(), thrown);
		this.id = projectile.getEntityId();

		((Item) projectile).setPickupDelay(9999999);
		this.startLocation = projectile.getLocation();
	}
	else
	{
		Class<? extends Projectile> mclass = Snowball.class;

		String check = shotFrom.getProjType().toLowerCase().replaceAll("_", "").replaceAll(" ", "");
		switch (check)
		{
			case "arrow":
				mclass = Arrow.class;
				break;
			case "egg":
				mclass = Egg.class;
				break;
			case "enderpearl":
				mclass = EnderPearl.class;
				break;
			case "fireball":
				mclass = Fireball.class;
				break;
			case "fish":
			case "fishhook":
				mclass = FishHook.class;
				break;
			case "largefireball":
				mclass = LargeFireball.class;
				break;
			case "smallfireball":
				mclass = SmallFireball.class;
				break;
			case "thrownexpbottle":
				mclass = ThrownExpBottle.class;
				break;
			case "thrownpotion":
				mclass = ThrownPotion.class;
				break;
			case "witherskull":
				mclass = WitherSkull.class;
				break;
			default:
				break;
		}

		this.projectile = shooter.getPlayer().launchProjectile(mclass);
		this.id = projectile.getEntityId();

		((Projectile) projectile).setShooter(shooter.getPlayer());
		this.startLocation = projectile.getLocation();
	}

	if (shotFrom.getReleaseTime() == -1)
	{
		this.releaseTime = 80 + (shotFrom.isThrowable() ? 0 : 1) * 400;
	}
	else
	{
		this.releaseTime = shotFrom.getReleaseTime();
	}
}
 
开发者ID:dmulloy2,项目名称:SwornGuns,代码行数:77,代码来源:Bullet.java


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