本文整理汇总了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());
}
}
示例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()));
}