本文整理匯總了Java中org.bukkit.EntityEffect類的典型用法代碼示例。如果您正苦於以下問題:Java EntityEffect類的具體用法?Java EntityEffect怎麽用?Java EntityEffect使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EntityEffect類屬於org.bukkit包,在下文中一共展示了EntityEffect類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: spawnMonster
import org.bukkit.EntityEffect; //導入依賴的package包/類
public void spawnMonster(Player player) {
Monster monster = TenJavaPlugin.getMonsterManager().getMonster(player);
LinkedHashMap configurationSection = TenJavaPlugin.getConfigManager().getExact(monster.evolution);
String entity = (String) configurationSection.get("entity");
if(entity.equals("Chicken")) {
final Entity chicken = player.getWorld().spawnEntity(player.getLocation().add(new Vector(0,1,0)), EntityType.CHICKEN);
monster.entityId = chicken.getEntityId();
playerEntityHashMap.put(player, chicken);
Bukkit.getScheduler().runTaskLater(TenJavaPlugin.getInstance(), new Runnable() {
@Override
public void run() {
chicken.playEffect(EntityEffect.WOLF_HEARTS);
}
}, 5*20);
}
}
示例2: onHit
import org.bukkit.EntityEffect; //導入依賴的package包/類
@EventHandler
public void onHit(EntityDamageByEntityEvent event) {
Entity damager = event.getDamager();
final Entity entity = event.getEntity();
if (damager instanceof Player && toggleData.containsKey(((Player) damager).getName().toLowerCase()) && toggleData.get(((Player) damager).getName().toLowerCase())) {
entity.getWorld().playSound(entity.getLocation(), Sound.CHICKEN_EGG_POP, 5F, 1F);
entity.playEffect(EntityEffect.WOLF_SMOKE);
Location location = entity.getLocation();
entity.getWorld().spigot().playEffect(location, Effect.HEART, 1, 1, 0.35F, 1.5F, 0.35F, 0.5F, 15, 5);
entity.getWorld().spigot().playEffect(location, Effect.FLAME, 1, 1, 0.5F, 2F, 0.5F, 0.5F, 15, 5);
entity.getWorld().spigot().playEffect(location, Effect.CLOUD, 1, 1, 1F, 2F, 1F, 0.5F, 30, 5);
entity.getWorld().spigot().playEffect(location, Effect.MAGIC_CRIT, 1, 1, 0.5F, 1F, 0.5F, 0.5F, 20, 5);
entity.getWorld().spigot().playEffect(location, Effect.PARTICLE_SMOKE, 1, 1, 0.5F, 1F, 0.5F, 0.5F, 40, 5);
event.setCancelled(true);
}
}
示例3: checkBastion
import org.bukkit.EntityEffect; //導入依賴的package包/類
/**
* Checks whether the exiled player is inside any bastion fields they don't have
* permission on and deals them damage if they are.
* @param player The player to check
*/
private void checkBastion(Player player) {
if (pearlApi.isPlayerInUnpermittedBastion(player) && player.getHealth() > 0) {
player.setHealth(Math.max(0, player.getHealth() - bastionDamage));
player.playSound(player.getLocation(), Sound.ENTITY_GENERIC_HURT, 1.0F, 1.0F);
player.playEffect(EntityEffect.HURT);
msg(player, "<b>You aren't allowed in this bastion field when exiled.");
}
}
示例4: init
import org.bukkit.EntityEffect; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] e, int matchedPattern, Kleenean isDelayed, ParseResult parser) {
entity = (Expression<Entity>) e[0];
effect = (Expression<EntityEffect>) e[1];
return true;
}
示例5: playHeartEffect
import org.bukkit.EntityEffect; //導入依賴的package包/類
/**
* Play heart particles at the given location.
* <p>
* <i>Implementation note:</i> This method accomplishes the desired behavior by spawning a wolf, playing the {@linkplain EntityEffect#WOLF_HEARTS wolf heart} effect, and removing the wolf.
* Event handlers at the highest priority level are registered that will uncancel the spawn of this wolf.
* </p>
* @param location The location at which to play the heart effect.
*/
public static void playHeartEffect(@Nonnull Location location){
Validate.notNull(location, "The location of the effect must not be null.");
Validate.notNull(location.getWorld(), "The location must not have a null world.");
_eventListener.getWolfSpawnLocSet().add(location);
Wolf o = location.getWorld().spawn(location, Wolf.class);
o.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, (int) Constants.TICKS_PER_MINUTE, 0));
o.playEffect(EntityEffect.WOLF_HEARTS);
o.remove();
}
示例6: playFeedEffects
import org.bukkit.EntityEffect; //導入依賴的package包/類
/**
* Play effects triggered by an eating horse.
*
* @param horse The horse
* @param happy Show hearts?
*/
private void playFeedEffects(Horse horse, boolean happy) {
horse.getWorld().playSound(horse.getLocation(), Sound.EAT, 1.0f, 0.75f);
if (happy) {
horse.playEffect(EntityEffect.WOLF_HEARTS);
}
}
示例7: playEffect
import org.bukkit.EntityEffect; //導入依賴的package包/類
@Override
public void playEffect(EntityEffect type)
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}
示例8: damage
import org.bukkit.EntityEffect; //導入依賴的package包/類
@Override
public void damage(double amount, Entity source, DamageCause cause) {
// fire resistance
if (cause != null && hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) {
switch (cause) {
case PROJECTILE:
if (!(source instanceof Fireball)) {
break;
}
case FIRE:
case FIRE_TICK:
case LAVA:
return;
}
}
// armor damage protection
// formula source:
// http://minecraft.gamepedia.com/Armor#Damage_Protection
double defensePoints = getAttributeManager().getPropertyValue(Key.KEY_ARMOR);
double toughness = getAttributeManager().getPropertyValue(Key.KEY_ARMOR_TOUGHNESS);
amount = amount * (1
- Math.min(20.0, Math.max(defensePoints / 5.0, defensePoints - amount / (2.0 + toughness / 4.0))) / 25);
// fire event
NPCDamageEvent event;
if (source == null) {
event = new NPCDamageEvent(this, cause, amount);
} else {
event = new NPCDamageByEntityEvent(this, cause, amount, source);
}
if (!event.callEvent()) {
return;
}
// apply damage
amount = event.getFinalDamage();
setLastDamage(amount);
setHealth(health - amount);
playEffect(EntityEffect.HURT);
// play sounds, handle death
if (health > 0) {
Sound hurtSound = getHurtSound();
if (hurtSound != null && !isSilent()) {
world.playSound(location, hurtSound, getSoundVolume(), getSoundPitch());
}
}
setLastDamager(source);
}
示例9: Type
import org.bukkit.EntityEffect; //導入依賴的package包/類
private Type(final EntityEffect effect) {
this.effect = effect;
}
示例10: isEntityEffect
import org.bukkit.EntityEffect; //導入依賴的package包/類
public boolean isEntityEffect() {
return type.effect instanceof EntityEffect;
}
示例11: playEffect
import org.bukkit.EntityEffect; //導入依賴的package包/類
public void playEffect(EntityEffect type) {
this.getHandle().worldObj.setEntityState(getHandle(), type.getData());
}
示例12: playEffect
import org.bukkit.EntityEffect; //導入依賴的package包/類
@Override
public void playEffect(EntityEffect type) {
throw Pokkit.unsupported();
}
示例13: playEffect
import org.bukkit.EntityEffect; //導入依賴的package包/類
@Override
public void playEffect(EntityEffect type) {
// Not supported yet. As effects are usually unimportant, it's not worth
// to crash a plugin over this, so let this method fail silently
}
示例14: playEffect
import org.bukkit.EntityEffect; //導入依賴的package包/類
public void playEffect(EntityEffect type) {
throw new NotImplementedException("playEffect(EntityEffect)");
}
示例15: playEffect
import org.bukkit.EntityEffect; //導入依賴的package包/類
public void playEffect(EntityEffect type) {
this.getHandle().world.broadcastEntityEffect(getHandle(), type.getData());
}