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


Java Entity.setFireTicks方法代码示例

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


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

示例1: onProjectileHit

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@EventHandler
public void onProjectileHit(ProjectileHitEvent e) throws Exception {
	if (fireballList.contains(e.getEntity().getUniqueId())) {
		Location fireballHitLocation = e.getEntity().getLocation();
		if(!KingdomFactionsPlugin.getInstance().getDataManager().getBoolean("Test.enabled")) {
		fireballHitLocation.getWorld().createExplosion(fireballHitLocation.getX(), fireballHitLocation.getY(),
				fireballHitLocation.getZ(), 4, true, true);
		} else {
			fireballHitLocation.getWorld().createExplosion(fireballHitLocation.getX(), fireballHitLocation.getY(),
					fireballHitLocation.getZ(), 4, true, false);
		}

		FireworkEffect.Type type = FireworkEffect.Type.BALL_LARGE;
		Color c1 = Color.ORANGE;
		Color c2 = Color.RED;

		FireworkEffect effect = FireworkEffect.builder().flicker(true).withColor(c1).withFade(c2).with(type)
				.trail(true).build();

		FireworkEffectPlayer fireworkPlayer = new FireworkEffectPlayer();

		fireworkPlayer.playFirework(fireballHitLocation.getWorld(), fireballHitLocation, effect);
		for (Entity ent : Utils.getInstance().getNearbyEntities(fireballHitLocation, 5)) {
			if ((ent instanceof LivingEntity)) {
				ent.setFireTicks(ent.getFireTicks() + 60);
			}
		}
		fireballList.remove(e.getEntity().getUniqueId());
	}
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:31,代码来源:Comet.java

示例2: changeBowProjectile

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void changeBowProjectile(EntityShootBowEvent event) {
    Plugin plugin = this.getMatch().getPlugin();
    Entity newProjectile;

    if(this.projectile == Arrow.class && event.getProjectile() instanceof Arrow) {
        // Don't change the projectile if it's an Arrow and the custom entity type is also Arrow
        newProjectile = event.getProjectile();
    } else {
        // Replace the projectile
        World world = event.getEntity().getWorld();
        Projectile oldEntity = (Projectile) event.getProjectile();

        if(Projectile.class.isAssignableFrom(projectile)) {
            // Ender Pearls need to be soawned this way, otherwise they will hit the shooter sometimes
            newProjectile = event.getEntity().launchProjectile(projectile.asSubclass(Projectile.class), oldEntity.getVelocity());
        } else {
            newProjectile = world.spawn(oldEntity.getLocation(), projectile);
            newProjectile.setVelocity(oldEntity.getVelocity());
        }

        event.setProjectile(newProjectile);

        // Copy some things from the old projectile
        newProjectile.setFallDistance(oldEntity.getFallDistance());
        newProjectile.setFireTicks(oldEntity.getFireTicks());

        if(newProjectile instanceof Projectile) {
            ((Projectile) newProjectile).setShooter(oldEntity.getShooter());
            ((Projectile) newProjectile).setBounce(oldEntity.doesBounce());
        }

        // Save some special properties of Arrows
        if(oldEntity instanceof Arrow) {
            Arrow arrow = (Arrow) oldEntity;
            newProjectile.setMetadata("critical", new FixedMetadataValue(plugin, arrow.isCritical()));
            newProjectile.setMetadata("knockback", new FixedMetadataValue(plugin, arrow.getKnockbackStrength()));
            newProjectile.setMetadata("damage", new FixedMetadataValue(plugin, arrow.getDamage()));
        }
    }

    // Tag the projectile as custom
    newProjectile.setMetadata("customProjectile", new FixedMetadataValue(plugin, true));

    getMatch().callEvent(new EntityLaunchEvent(newProjectile, event.getEntity()));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:47,代码来源:ModifyBowProjectileMatchModule.java


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