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


Java Creeper.isPowered方法代碼示例

本文整理匯總了Java中org.bukkit.entity.Creeper.isPowered方法的典型用法代碼示例。如果您正苦於以下問題:Java Creeper.isPowered方法的具體用法?Java Creeper.isPowered怎麽用?Java Creeper.isPowered使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.entity.Creeper的用法示例。


在下文中一共展示了Creeper.isPowered方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: on

import org.bukkit.entity.Creeper; //導入方法依賴的package包/類
@EventHandler
public void on(EntityDeathEvent event) {
    if (!(event.getEntity() instanceof Creeper)) return;

    Creeper creeper = (Creeper) event.getEntity();

    // explode after 2 seconds ticks
    ExplosionTask task = new ExplosionTask(creeper.getLocation(), creeper.isPowered() ? 6 : 3, false);
    task.runTaskLater(plugin, 40);

    // set up some layered smoke effects
    for (int i = 0; i < 5; i++) {
        // increase the count over time
        ImpendingExplosionParticleTask smoke = new ImpendingExplosionParticleTask(creeper.getLocation(), 20 * (i+1));
        smoke.runTaskLater(plugin, 10 + (i * 10));
    }
}
 
開發者ID:Eluinhost,項目名稱:UberHardcore,代碼行數:18,代碼來源:CreeperDeathHandler.java

示例2: trigger

import org.bukkit.entity.Creeper; //導入方法依賴的package包/類
@Override
public void trigger(AlmightyNotchPlugin plugin, World world) {
    PluginManager pluginManager = Bukkit.getPluginManager();
    for (LivingEntity entity : world.getLivingEntities()) {
        if (entity.getType() == EntityType.CREEPER) {
            Creeper creeper = (Creeper) entity;

            float power = creeper.isPowered() ? 6.0F : 3.0F;
            ExplosionPrimeEvent event = new ExplosionPrimeEvent(creeper, power, false);
            pluginManager.callEvent(event);
            if (!event.isCancelled()) {
                creeper.damage(creeper.getHealth());
                world.createExplosion(creeper.getLocation(), power);
            }
        }
    }
    plugin.getMessenger().sendMessage(Bukkit.getServer(), getOccurMessage());
}
 
開發者ID:Amperial,項目名稱:AlmightyNotch,代碼行數:19,代碼來源:CreeperExplodeEvent.java

示例3: onCreeperDeath

import org.bukkit.entity.Creeper; //導入方法依賴的package包/類
/**
 * On creeper death, drop fireworks and heads with a configurable chance.
 */
@EventHandler(ignoreCancelled = true)
public void onCreeperDeath(EntityDeathEvent event) {
    if (!CONFIG.isAffectedWorld(event)) {
        return;
    }

    Entity entity = event.getEntity();
    if (entity.getType() == EntityType.CREEPER && entity.hasMetadata(SPECIAL_KEY)) {
        Creeper creeper = (Creeper) entity;

        // Require recent player damage on the creeper for special drops.
        Long damageTime = getPlayerDamageTime(entity);
        if (damageTime != null) {
            Location loc = creeper.getLocation();
            if (loc.getWorld().getFullTime() - damageTime < PLAYER_DAMAGE_TICKS) {
                if (Math.random() < CONFIG.FIREWORK_DROP_CHANCE) {
                    // Replace the default drops.
                    event.getDrops().clear();
                    final int amount = random(CONFIG.MIN_FIREWORK_DROPS, CONFIG.MAX_FIREWORK_DROPS);
                    for (int i = 0; i < amount; ++i) {
                        ItemStack firework = new ItemStack(Material.FIREWORK);
                        FireworkMeta meta = (FireworkMeta) firework.getItemMeta();
                        meta.setPower(random(0, 3));
                        meta.addEffect(randomFireworkFffect(false));
                        firework.setItemMeta(meta);
                        event.getDrops().add(firework);
                    }
                }

                // Powered creepers may drop a creeper skull in addition to
                // fireworks.
                if (creeper.isPowered() && Math.random() < CONFIG.CHARGED_CREEPER_SKULL_CHANCE) {
                    event.getDrops().add(new ItemStack(Material.SKULL_ITEM, 1, (short) 4));
                }
            }
        }
    }
}
 
開發者ID:NerdNu,項目名稱:Creepocalypse,代碼行數:42,代碼來源:Creepocalypse.java

示例4: getDamageTypeAmount

import org.bukkit.entity.Creeper; //導入方法依賴的package包/類
/**
 * Returns the amount of damage done to the material by an entity
 *
 * @param entity   the entity that is involved in damaging
 * @param material the name of the material to lookup
 * @param data
 * @return amount of damage done
 */
public int getDamageTypeAmount(Entity entity, String material, int data) {
    material = getMaterialName(material, data);
    if (durabilityMaterials.containsKey(material)) {
        EntityType eventTypeRep = entity.getType();
        switch (eventTypeRep) {
            case PRIMED_TNT:
                return durabilityMaterials.get(material).getTntDamage();
            case SNOWBALL:
                return 0;
            case CREEPER:
                Creeper creeper = (Creeper) entity;
                return creeper.isPowered() ? durabilityMaterials.get(material).getChargedCreeperDamage() : durabilityMaterials.get(material).getCreepersDamage();
            case WITHER:
            case WITHER_SKULL:
                return durabilityMaterials.get(material).getWithersDamage();
            case MINECART_TNT:
                return durabilityMaterials.get(material).getTntMinecartsDamage();
            case FIREBALL:
            case SMALL_FIREBALL:
            case GHAST:
                return durabilityMaterials.get(material).getGhastsDamage();
            case BAT:
                return durabilityMaterials.get(material).getNullDamage();
            default:
                break;
        }
    }
    return 1;
}
 
開發者ID:drtshock,項目名稱:ObsidianDestroyer,代碼行數:38,代碼來源:MaterialManager.java

示例5: init

import org.bukkit.entity.Creeper; //導入方法依賴的package包/類
@Override
protected boolean init(final @Nullable Class<? extends Creeper> c, final @Nullable Creeper e) {
	powered = e == null ? 0 : e.isPowered() ? 1 : -1;
	return true;
}
 
開發者ID:nfell2009,項目名稱:Skript,代碼行數:6,代碼來源:CreeperData.java

示例6: match

import org.bukkit.entity.Creeper; //導入方法依賴的package包/類
@Override
public boolean match(final Creeper entity) {
	return powered == 0 || entity.isPowered() == (powered == 1);
}
 
開發者ID:nfell2009,項目名稱:Skript,代碼行數:5,代碼來源:CreeperData.java


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