Example #1
0
  @Override
  public void onAttached() {
    super.onAttached();
    getOwner()
        .getNetwork()
        .setEntityProtocol(
            VanillaPlugin.VANILLA_PROTOCOL_ID, new CreatureProtocol(CreatureType.WITCH));
    EntityDrops dropComponent = getOwner().add(EntityDrops.class);
    Random random = getRandom();
    dropComponent.addDrop(new ItemStack(VanillaMaterials.GLASS_BOTTLE, random.nextInt(6)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.GLOWSTONE_DUST, random.nextInt(6)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.GUNPOWDER, random.nextInt(6)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.REDSTONE_DUST, random.nextInt(6)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.SPIDER_EYE, random.nextInt(6)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.STICK, random.nextInt(6)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.SUGAR, random.nextInt(6)));
    dropComponent.addXpDrop((short) 5);
    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(26);
    }

    /*
     * TODO:
     *
     * The witch mob uses splash potions of poison, weakness, damage, and slowness to fight the player.
     * The current order of potions thrown is; slowness, poison, they will then proceed to throw potions of
     * harming until the player is no longer poisoned which they will rectify by throwing another splash
     * potion of poison and will continue to do this. The splash potion of harming will occasionally be
     * substituted by potions of slowness. These potions will affect other mobs - not just the player.
     */
  }
Example #2
0
 @Override
 public void onAttached() {
   super.onAttached();
   getOwner()
       .getNetwork()
       .setEntityProtocol(
           VanillaPlugin.VANILLA_PROTOCOL_ID, new CreatureProtocol(CreatureType.BAT));
   if (getAttachedCount() == 1) {
     getOwner().add(HealthComponent.class).setSpawnHealth(6);
   }
 }
Example #3
0
  @Override
  public void onAttached() {
    super.onAttached();
    getOwner()
        .getNetwork()
        .setEntityProtocol(VanillaPlugin.VANILLA_PROTOCOL_ID, new SpiderEntityProtocol());
    DropComponent dropComponent = getOwner().add(DropComponent.class);
    Random random = getRandom();
    dropComponent.addDrop(new ItemStack(VanillaMaterials.STRING, random.nextInt(2)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.SPIDER_EYE, random.nextInt(1)));
    if (getAttachedCount() == 1) {
      getOwner().add(HealthComponent.class).setSpawnHealth(16);
    }

    DamageComponent damage = getOwner().add(DamageComponent.class);
    damage.getDamageLevel(Difficulty.EASY).setAmount(2);
    damage.getDamageLevel(Difficulty.NORMAL).setAmount(2);
    damage.getDamageLevel(Difficulty.HARD).setAmount(3);
    damage
        .getDamageLevel(Difficulty.HARDCORE)
        .setAmount(damage.getDamageLevel(Difficulty.HARD).getAmount());
  }