本文整理匯總了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()));
}