当前位置: 首页>>代码示例>>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;未经允许,请勿转载。