當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityEffect類代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:tenjavacontest,項目名稱:geNAZt,代碼行數:19,代碼來源:EntityManager.java

示例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);
    }
}
 
開發者ID:janie177,項目名稱:MausWasHere,代碼行數:17,代碼來源:EntityListener.java

示例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.");
	}
}
 
開發者ID:DevotedMC,項目名稱:ExilePearl,代碼行數:14,代碼來源:PearlBoundaryTask.java

示例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;
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:8,代碼來源:EffEntityEffect.java

示例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();
}
 
開發者ID:glen3b,項目名稱:BukkitLib,代碼行數:19,代碼來源:Utilities.java

示例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);
  }
}
 
開發者ID:EasyMFnE,項目名稱:DeadHorses,代碼行數:13,代碼來源:PlayerListener.java

示例7: playEffect

import org.bukkit.EntityEffect; //導入依賴的package包/類
@Override
public void playEffect(EntityEffect type)
{
	// TODO Auto-generated method stub
	throw new UnimplementedOperationException();
}
 
開發者ID:seeseemelk,項目名稱:MockBukkit,代碼行數:7,代碼來源:PlayerMock.java

示例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);
}
 
開發者ID:DenAbr,項目名稱:GlowNPC,代碼行數:51,代碼來源:GlowNPC.java

示例9: Type

import org.bukkit.EntityEffect; //導入依賴的package包/類
private Type(final EntityEffect effect) {
	this.effect = effect;
}
 
開發者ID:nfell2009,項目名稱:Skript,代碼行數:4,代碼來源:VisualEffect.java

示例10: isEntityEffect

import org.bukkit.EntityEffect; //導入依賴的package包/類
public boolean isEntityEffect() {
	return type.effect instanceof EntityEffect;
}
 
開發者ID:nfell2009,項目名稱:Skript,代碼行數:4,代碼來源:VisualEffect.java

示例11: playEffect

import org.bukkit.EntityEffect; //導入依賴的package包/類
public void playEffect(EntityEffect type) {
    this.getHandle().worldObj.setEntityState(getHandle(), type.getData());
}
 
開發者ID:CyberdyneCC,項目名稱:ThermosRebased,代碼行數:4,代碼來源:CraftEntity.java

示例12: playEffect

import org.bukkit.EntityEffect; //導入依賴的package包/類
@Override
public void playEffect(EntityEffect type) {
	throw Pokkit.unsupported();

}
 
開發者ID:rutgerkok,項目名稱:Pokkit,代碼行數:6,代碼來源:PokkitFakeEntity.java

示例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
}
 
開發者ID:rutgerkok,項目名稱:Pokkit,代碼行數:6,代碼來源:PokkitEntity.java

示例14: playEffect

import org.bukkit.EntityEffect; //導入依賴的package包/類
public void playEffect(EntityEffect type) {
    throw new NotImplementedException("playEffect(EntityEffect)");
}
 
開發者ID:CanaryBukkitTeam,項目名稱:CanaryBukkit,代碼行數:4,代碼來源:CanaryEntity.java

示例15: playEffect

import org.bukkit.EntityEffect; //導入依賴的package包/類
public void playEffect(EntityEffect type) {
    this.getHandle().world.broadcastEntityEffect(getHandle(), type.getData());
}
 
開發者ID:OvercastNetwork,項目名稱:CraftBukkit,代碼行數:4,代碼來源:CraftEntity.java


注:本文中的org.bukkit.EntityEffect類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。