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


Java EntityType.WITHER屬性代碼示例

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


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

示例1: WitherChangeBlocks

/**
 * Withers change blocks to air after they are hit (don't know why)
 * This prevents this when the wither has been spawned by a visitor
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void WitherChangeBlocks(EntityChangeBlockEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    // Only cover withers in the island world
    if (e.getEntityType() != EntityType.WITHER || !Util.inWorld(e.getEntity()) ) {
        return;
    }
    if (mobSpawnInfo.containsKey(e.getEntity())) {
        // We know about this wither
        if (DEBUG) {
            plugin.getLogger().info("DEBUG: We know about this wither");
        }
        if (!mobSpawnInfo.get(e.getEntity()).inIslandSpace(e.getEntity().getLocation())) {
            // Cancel the block changes
            if (DEBUG) {
                plugin.getLogger().info("DEBUG: cancelled wither block change");
            }
            e.setCancelled(true);
        }
    }
}
 
開發者ID:tastybento,項目名稱:bskyblock,代碼行數:28,代碼來源:FlyingMobEvents.java

示例2: onCreatureSpawn

@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent e)
{
    if (e.getEntityType() != EntityType.PLAYER && e.getEntityType() != EntityType.WITHER)
    {
        if (MWAPI.getConfig().stopEntitySpawn())
        {
            e.setCancelled(true);
        }
    }
}
 
開發者ID:WoutDev,項目名稱:Mega-Walls,代碼行數:11,代碼來源:CreatureSpawnListener.java

示例3: getType

public EntityType getType() {
    return EntityType.WITHER;
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:3,代碼來源:CraftWither.java

示例4: WitherExplode

/**
 * Deal with pre-explosions
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void WitherExplode(ExplosionPrimeEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    // Only cover withers in the island world
    if (!Util.inWorld(e.getEntity()) || e.getEntity() == null) {
        return;
    }
    // The wither or wither skulls can both blow up
    if (e.getEntityType() == EntityType.WITHER) {
        //plugin.getLogger().info("DEBUG: Wither");
        // Check the location
        if (mobSpawnInfo.containsKey(e.getEntity())) {
            // We know about this wither
            if (DEBUG) {
                plugin.getLogger().info("DEBUG: We know about this wither");
            }
            if (!mobSpawnInfo.get(e.getEntity()).inIslandSpace(e.getEntity().getLocation())) {
                // Cancel the explosion
                if (DEBUG) {
                    plugin.getLogger().info("DEBUG: cancelling wither pre-explosion");
                }
                e.setCancelled(true);
            }
        }
        // Testing only e.setCancelled(true);
    }
    if (e.getEntityType() == EntityType.WITHER_SKULL) {
        //plugin.getLogger().info("DEBUG: Wither skull");
        // Get shooter
        Projectile projectile = (Projectile)e.getEntity();
        if (projectile.getShooter() instanceof Wither) {
            //plugin.getLogger().info("DEBUG: shooter is wither");
            Wither wither = (Wither)projectile.getShooter();
            // Check the location
            if (mobSpawnInfo.containsKey(wither)) {
                // We know about this wither
                if (DEBUG) {
                    plugin.getLogger().info("DEBUG: We know about this wither");
                }
                if (!mobSpawnInfo.get(wither).inIslandSpace(e.getEntity().getLocation())) {
                    // Cancel the explosion
                    if (DEBUG) {
                        plugin.getLogger().info("DEBUG: cancel wither skull explosion");
                    }
                    e.setCancelled(true);
                }
            }
        }
    }
}
 
開發者ID:tastybento,項目名稱:bskyblock,代碼行數:55,代碼來源:FlyingMobEvents.java


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