本文整理匯總了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);
}
}
}
示例2: onCreatureSpawn
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent e)
{
if (e.getEntityType() != EntityType.PLAYER && e.getEntityType() != EntityType.WITHER)
{
if (MWAPI.getConfig().stopEntitySpawn())
{
e.setCancelled(true);
}
}
}
示例3: getType
public EntityType getType() {
return EntityType.WITHER;
}
示例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);
}
}
}
}
}