Java 类org.bukkit.entity.Spider 实例源码

项目:BendingExp    文件:DeathByBendingListener.java   
@EventHandler
public void onEntityBendingDeath(EntityBendingDeathEvent event) {
    Entity v = event.getVictim();
    Element e = CoreAbility.getAbility(event.getAbility()).getElement();
    int xp;

    if(v == null || e == null)
        return;

    if(v instanceof Player) {
        xp = 25 + (int)(Math.random() * ((35 - 25) + 1));
    }
    else if(v instanceof Zombie || v instanceof Creeper || v instanceof Witch || v instanceof Skeleton || v instanceof Guardian || v instanceof Spider) {
        xp = 13 + (int)(Math.random() * ((22 - 13) + 1));
    }
    else {
        xp = 3 + (int)(Math.random() * ((8 - 3) + 1));
    }
    BendingExp.addExp(event.getAttacker(), e, xp);
}
项目:UberHardcore    文件:SpiderDeathHandler.java   
@EventHandler
public void on(EntityDeathEvent event) {
    if (!(event.getEntity() instanceof Spider)) return;

    Entity entity = ((CraftEntity) event.getEntity()).getHandle();

    // spawn 5 random webs
    for (int i = 0; i < 5; i++) {
        spawnRandomWeb(entity);
    }

    // spawn 30 random particle effects
    for (int i = 0; i < 30; i++) {
        spawnRandomRedstoneParticle(entity);
    }
}
项目:UberHardcore    文件:SpiderDeathHandler.java   
@EventHandler
public void on(EntityDeathEvent event) {
    if (!(event.getEntity() instanceof Spider)) return;

    Entity entity = ((CraftEntity) event.getEntity()).getHandle();

    // spawn 5 random webs
    for (int i = 0; i < 5; i++) {
        spawnRandomWeb(entity);
    }

    // spawn 30 random particle effects
    for (int i = 0; i < 30; i++) {
        spawnRandomRedstoneParticle(entity);
    }
}
项目:UberHardcore    文件:SpiderDeathHandler.java   
@EventHandler
public void on(EntityDeathEvent event) {
    if (!(event.getEntity() instanceof Spider)) return;

    Entity entity = ((CraftEntity) event.getEntity()).getHandle();

    // spawn 5 random webs
    for (int i = 0; i < 5; i++) {
        spawnRandomWeb(entity);
    }

    // spawn 30 random particle effects
    for (int i = 0; i < 30; i++) {
        spawnRandomRedstoneParticle(entity);
    }
}
项目: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;
    }
项目:CanaryBukkit    文件:CanarySpider.java   
public CanarySpider(net.canarymod.api.entity.living.monster.Spider entity) {
    super(entity);
}
项目:PopulationDensity    文件:EntityEventHandler.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntitySpawn(CreatureSpawnEvent event) {
    //do nothing for non-natural spawns
    if (event.getSpawnReason() != SpawnReason.NATURAL)
        return;

    if (ConfigData.managedWorld == null || event.getLocation().getWorld() != ConfigData.managedWorld)
        return;

    //when an animal naturally spawns, grow grass around it
    Entity entity = event.getEntity();
    if (entity instanceof Animals && ConfigData.regrowGrass)
        this.regrow(entity.getLocation().getBlock(), 4);

    //when a monster spawns, sometimes spawn animals too
    if (entity instanceof Monster && ConfigData.respawnAnimals) {
        //only do this if the spawn is in the newest region
        if (!Region.getOpenRegion().equals(Region.fromLocation(entity.getLocation())))
            return;

        //if it's on grass, there's a 1/100 chance it will also spawn a group of animals
        Block underBlock = event.getLocation().getBlock().getRelative(BlockFace.DOWN);
        if (underBlock.getType() == Material.GRASS && --this.respawnAnimalCounter == 0) {
            this.respawnAnimalCounter = 100;

            //check the chunk for other animals
            Chunk chunk = entity.getLocation().getChunk();
            Entity[] entities = chunk.getEntities();
            for (int i = 0; i < entities.length; i++) {
                if (entity instanceof Animals)
                    return;
            }

            EntityType animalType = null;

            //decide what to spawn based on the type of monster
            if (entity instanceof Creeper)
                animalType = EntityType.COW;
            else if (entity instanceof Zombie)
                animalType = EntityType.CHICKEN;
            else if (entity instanceof Spider)
                animalType = EntityType.PIG;
            else if (entity instanceof Enderman)
                animalType = EntityType.SHEEP;

            //spawn an animal at the entity's location and regrow some grass
            if (animalType != null) {
                entity.getWorld().spawnEntity(entity.getLocation(), animalType);
                entity.getWorld().spawnEntity(entity.getLocation(), animalType);
                this.regrow(entity.getLocation().getBlock(), 4);
            }
        }
    }
}
项目:PvPTeleport    文件:WorldCommand.java   
/** Checks that player is not trying to combatlog/is allowed to teleport
 * Returns an error message to be displayed if the player is not allowed
 * to teleport
 * Returns null if the player is allowed to teleport
 */
private static String teleportCheck(Player player) {

    Location pLoc = player.getLocation();

    World world = player.getWorld();

    /* Check if there are any players within 50 blocks */
    for (Player p : world.getPlayers()) {

        if (!p.equals(player)
                && p.getLocation().distance(pLoc) < 50
                && player.canSee(p)
                && !p.isDead()) {
            return ChatColor.RED + "You cannot use this command while within 50 blocks of any other players.";
        }

    }

    /* Check if there are any hostile mobs within 5 blocks */
    for (Entity entity : world.getEntitiesByClasses(
                Blaze.class,
                CaveSpider.class,
                Creeper.class,
                Enderman.class,
                Ghast.class,
                MagmaCube.class,
                PigZombie.class,
                Skeleton.class,
                Silverfish.class,
                Slime.class,
                Spider.class,
                Witch.class,
                Zombie.class)) {

        if (entity.getLocation().distance(pLoc) < 5) {
            return ChatColor.RED + "You cannot use this command while within 5 blocks of any hostile mobs.";
        }

    }

    /* Check if the player is falling */
    if (player.getVelocity().getY() < -0.079
            || player.getVelocity().getY() > 0.08) {
        return ChatColor.RED + "You cannot use this command while falling.";
    }

    /* Check if the player is burning */
    if (player.getFireTicks() > 0
            && !player.hasPotionEffect(
                PotionEffectType.FIRE_RESISTANCE)) {
        return ChatColor.RED + "You cannot use this command while on fire.";
    }

    /* Default to allow teleport */
    return null;

}
项目:EndHQ-Libraries    文件:RemoteSpider.java   
public RemoteSpider(int inID, RemoteSpiderEntity inEntity, EntityManager inManager)
{
    super(inID, RemoteEntityType.Spider, inManager);
    this.m_entity = inEntity;
}