类org.bukkit.entity.Ghast源码实例Demo

下面列出了怎么用org.bukkit.entity.Ghast的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: uSkyBlock   文件: LimitLogic.java
public CreatureType getCreatureType(EntityType entityType) {
    if (Monster.class.isAssignableFrom(entityType.getEntityClass())
            || WaterMob.class.isAssignableFrom(entityType.getEntityClass())
            || Slime.class.isAssignableFrom(entityType.getEntityClass())
            || Ghast.class.isAssignableFrom(entityType.getEntityClass())
            ) {
        return CreatureType.MONSTER;
    } else if (Animals.class.isAssignableFrom(entityType.getEntityClass())) {
        return CreatureType.ANIMAL;
    } else if (Villager.class.isAssignableFrom(entityType.getEntityClass())) {
        return CreatureType.VILLAGER;
    } else if (Golem.class.isAssignableFrom(entityType.getEntityClass())) {
        return CreatureType.GOLEM;
    }
    return CreatureType.UNKNOWN;
}
 
源代码2 项目: uSkyBlock   文件: SpawnEvents.java
private void checkLimits(Cancellable event, EntityType entityType, Location location) {
    if (entityType == null) {
        return; // Only happens on "other-plugins", i.e. EchoPet
    }
    String islandName = WorldGuardHandler.getIslandNameAt(location);
    if (islandName == null) {
        event.setCancelled(true); // Only allow spawning on active islands...
        return;
    }
    if (entityType.getEntityClass().isAssignableFrom(Ghast.class) && location.getWorld().getEnvironment() != World.Environment.NETHER) {
        // Disallow ghasts for now...
        event.setCancelled(true);
        return;
    }
    us.talabrek.ultimateskyblock.api.IslandInfo islandInfo = plugin.getIslandInfo(islandName);
    if (islandInfo == null) {
        // Disallow spawns on inactive islands
        event.setCancelled(true);
        return;
    }
    if (!plugin.getLimitLogic().canSpawn(entityType, islandInfo)) {
        event.setCancelled(true);
    }
}
 
源代码3 项目: KTP   文件: UHPluginListener.java
@EventHandler
public void onEntityDeath(EntityDeathEvent ev) {
	if (ev.getEntity() instanceof Ghast) {
		Bukkit.getLogger().info("Modifying drops for Ghast");
		List<ItemStack> drops = new ArrayList<ItemStack>(ev.getDrops());
		ev.getDrops().clear();
		for (ItemStack i : drops) {
			if (i.getType() == Material.GHAST_TEAR) {
				Bukkit.getLogger().info("Added "+i.getAmount()+" ghast tear(s)");
				ev.getDrops().add(new ItemStack(Material.GOLD_INGOT,i.getAmount()));
			} else {
				Bukkit.getLogger().info("Added "+i.getAmount()+" "+i.getType().toString());
				ev.getDrops().add(i);
			}
		}
	}
}
 
源代码4 项目: uSkyBlock   文件: LimitLogic.java
public CreatureType getCreatureType(LivingEntity creature) {
    if (creature instanceof Monster
            || creature instanceof WaterMob
            || creature instanceof Slime
            || creature instanceof Ghast) {
        return CreatureType.MONSTER;
    } else if (creature instanceof Animals) {
        return CreatureType.ANIMAL;
    } else if (creature instanceof Villager) {
        return CreatureType.VILLAGER;
    } else if (creature instanceof Golem) {
        return CreatureType.GOLEM;
    }
    return CreatureType.UNKNOWN;
}
 
源代码5 项目: ce   文件: BeastmastersBow.java
@Override
	public boolean effect(Event event, Player player) {
//		  List<String> lore = e.getBow().getItemMeta().getLore();
//		  if(!lore.contains(placeHolder)) {
//			  for(int i = descriptionSize; i != 0; i--)
//				  lore.remove(i);
//			  e.getProjectile().setMetadata("ce." + this.getOriginalName(), new FixedMetadataValue(main, writeType(lore)));
//			  player.setMetadata("ce.CanUnleashBeasts", null);
//		  } else
//			  e.getProjectile().setMetadata("ce." + this.getOriginalName(), null);
		  if(event instanceof EntityDamageByEntityEvent) {
		  EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event;
		  if(e.getDamager() != player)
			  return false;
		  Entity ent = e.getEntity();
		  Location loc = ent.getLocation();
		  World w = ent.getWorld();
			if(ent instanceof Silverfish || ent instanceof EnderDragon || ent instanceof Spider || ent instanceof Slime || ent instanceof Ghast || ent instanceof MagmaCube || ent instanceof CaveSpider || (ent instanceof Wolf && ((Wolf) ent).isAngry()) || ent instanceof PigZombie) {
					e.setDamage(e.getDamage()*DamageMultiplication);
					w.playEffect(loc, Effect.SMOKE, 50);
					w.playEffect(loc, Effect.MOBSPAWNER_FLAMES, 50);
					EffectManager.playSound(loc, "BLOCK_PISTON_RETRACT", 1.3f, 3f);
				return true;
			} else if (ent instanceof Player) {
				for(int i = 0; i < MaximumMobs; i++) {
					if(rand.nextInt(100) < MobAppearanceChance) {
						w.spawnEntity(loc, rand.nextInt(2) == 1 ? EntityType.SPIDER : EntityType.SLIME);
						w.playEffect(loc, Effect.MOBSPAWNER_FLAMES, 30);
						w.playEffect(loc, Effect.SMOKE, 30);
						EffectManager.playSound(loc, "BLOCK_ANVIL_BREAK", 0.3f, 0.1f);
					}
				}
			}
		}
		  return false;
	}
 
 类所在包
 同包方法