Beispiel #1
0
  public float a(PathPoint pathpoint) {
    float f = (float) (pathpoint.a - this.a);
    float f1 = (float) (pathpoint.b - this.b);
    float f2 = (float) (pathpoint.c - this.c);

    return MathHelper.c(f * f + f1 * f1 + f2 * f2);
  }
  protected void a(Entity entity, float f) {
    if (this.attackTicks <= 0
        && f < 2.0F
        && entity.boundingBox.e > this.boundingBox.b
        && entity.boundingBox.b < this.boundingBox.e) {
      this.attackTicks = 20;
      this.a(entity);
    } else if (f < 30.0F) {
      double d0 = entity.locX - this.locX;
      double d1 =
          entity.boundingBox.b
              + (double) (entity.length / 2.0F)
              - (this.locY + (double) (this.length / 2.0F));
      double d2 = entity.locZ - this.locZ;

      if (this.attackTicks == 0) {
        ++this.g;
        if (this.g == 1) {
          this.attackTicks = 60;
          this.a(true);
        } else if (this.g <= 4) {
          this.attackTicks = 6;
        } else {
          this.attackTicks = 100;
          this.g = 0;
          this.a(false);
        }

        if (this.g > 1) {
          float f1 = MathHelper.c(f) * 0.5F;

          this.world.a(
              (EntityHuman) null, 1009, (int) this.locX, (int) this.locY, (int) this.locZ, 0);

          for (int i = 0; i < 1; ++i) {
            EntitySmallFireball entitysmallfireball =
                new EntitySmallFireball(
                    this.world,
                    this,
                    d0 + this.random.nextGaussian() * (double) f1,
                    d1,
                    d2 + this.random.nextGaussian() * (double) f1);

            entitysmallfireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D;
            this.world.addEntity(entitysmallfireball);
          }
        }
      }

      this.yaw = (float) (Math.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
      this.e = true;
    }
  }
Beispiel #3
0
 public float a(PathPoint paramPathPoint) {
   float f1 = paramPathPoint.a - this.a;
   float f2 = paramPathPoint.b - this.b;
   float f3 = paramPathPoint.c - this.c;
   return MathHelper.c(f1 * f1 + f2 * f2 + f3 * f3);
 }
  private void t(int k) {
    if (bu != null) bA = MathHelper.c(bu.size()) * 0.2F;
    else bA = 0.0F;
    MerchantRecipeList merchantrecipelist = new MerchantRecipeList();
    switch (getProfession()) {
      case 0: // '\0'
        a(merchantrecipelist, Items.WHEAT, random, p(0.9F));
        a(merchantrecipelist, Item.getItemOf(Blocks.WOOL), random, p(0.5F));
        a(merchantrecipelist, Items.RAW_CHICKEN, random, p(0.5F));
        a(merchantrecipelist, Items.COOKED_FISH, random, p(0.4F));
        b(merchantrecipelist, Items.BREAD, random, p(0.9F));
        b(merchantrecipelist, Items.MELON, random, p(0.3F));
        b(merchantrecipelist, Items.APPLE, random, p(0.3F));
        b(merchantrecipelist, Items.COOKIE, random, p(0.3F));
        b(merchantrecipelist, Items.SHEARS, random, p(0.3F));
        b(merchantrecipelist, Items.FLINT_AND_STEEL, random, p(0.3F));
        b(merchantrecipelist, Items.COOKED_CHICKEN, random, p(0.3F));
        b(merchantrecipelist, Items.ARROW, random, p(0.5F));
        if (random.nextFloat() < p(0.5F))
          merchantrecipelist.add(
              new MerchantRecipe(
                  new ItemStack(Blocks.GRAVEL, 10),
                  new ItemStack(Items.EMERALD),
                  new ItemStack(Items.FLINT, 4 + random.nextInt(2), 0)));
        break;

      case 4: // '\004'
        a(merchantrecipelist, Items.COAL, random, p(0.7F));
        a(merchantrecipelist, Items.PORK, random, p(0.5F));
        a(merchantrecipelist, Items.RAW_BEEF, random, p(0.5F));
        b(merchantrecipelist, Items.SADDLE, random, p(0.1F));
        b(merchantrecipelist, Items.LEATHER_CHESTPLATE, random, p(0.3F));
        b(merchantrecipelist, Items.LEATHER_BOOTS, random, p(0.3F));
        b(merchantrecipelist, Items.LEATHER_HELMET, random, p(0.3F));
        b(merchantrecipelist, Items.LEATHER_LEGGINGS, random, p(0.3F));
        b(merchantrecipelist, Items.GRILLED_PORK, random, p(0.3F));
        b(merchantrecipelist, Items.COOKED_BEEF, random, p(0.3F));
        break;

      case 3: // '\003'
        a(merchantrecipelist, Items.COAL, random, p(0.7F));
        a(merchantrecipelist, Items.IRON_INGOT, random, p(0.5F));
        a(merchantrecipelist, Items.GOLD_INGOT, random, p(0.5F));
        a(merchantrecipelist, Items.DIAMOND, random, p(0.5F));
        b(merchantrecipelist, Items.IRON_SWORD, random, p(0.5F));
        b(merchantrecipelist, Items.DIAMOND_SWORD, random, p(0.5F));
        b(merchantrecipelist, Items.IRON_AXE, random, p(0.3F));
        b(merchantrecipelist, Items.DIAMOND_AXE, random, p(0.3F));
        b(merchantrecipelist, Items.IRON_PICKAXE, random, p(0.5F));
        b(merchantrecipelist, Items.DIAMOND_PICKAXE, random, p(0.5F));
        b(merchantrecipelist, Items.IRON_SPADE, random, p(0.2F));
        b(merchantrecipelist, Items.DIAMOND_SPADE, random, p(0.2F));
        b(merchantrecipelist, Items.IRON_HOE, random, p(0.2F));
        b(merchantrecipelist, Items.DIAMOND_HOE, random, p(0.2F));
        b(merchantrecipelist, Items.IRON_BOOTS, random, p(0.2F));
        b(merchantrecipelist, Items.DIAMOND_BOOTS, random, p(0.2F));
        b(merchantrecipelist, Items.IRON_HELMET, random, p(0.2F));
        b(merchantrecipelist, Items.DIAMOND_HELMET, random, p(0.2F));
        b(merchantrecipelist, Items.IRON_CHESTPLATE, random, p(0.2F));
        b(merchantrecipelist, Items.DIAMOND_CHESTPLATE, random, p(0.2F));
        b(merchantrecipelist, Items.IRON_LEGGINGS, random, p(0.2F));
        b(merchantrecipelist, Items.DIAMOND_LEGGINGS, random, p(0.2F));
        b(merchantrecipelist, Items.CHAINMAIL_BOOTS, random, p(0.1F));
        b(merchantrecipelist, Items.CHAINMAIL_HELMET, random, p(0.1F));
        b(merchantrecipelist, Items.CHAINMAIL_CHESTPLATE, random, p(0.1F));
        b(merchantrecipelist, Items.CHAINMAIL_LEGGINGS, random, p(0.1F));
        break;

      case 1: // '\001'
        a(merchantrecipelist, Items.PAPER, random, p(0.8F));
        a(merchantrecipelist, Items.BOOK, random, p(0.8F));
        a(merchantrecipelist, Items.WRITTEN_BOOK, random, p(0.3F));
        b(merchantrecipelist, Item.getItemOf(Blocks.BOOKSHELF), random, p(0.8F));
        b(merchantrecipelist, Item.getItemOf(Blocks.GLASS), random, p(0.2F));
        b(merchantrecipelist, Items.COMPASS, random, p(0.2F));
        b(merchantrecipelist, Items.WATCH, random, p(0.2F));
        if (random.nextFloat() < p(0.07F)) {
          Enchantment enchantment = Enchantment.c[random.nextInt(Enchantment.c.length)];
          int i1 =
              MathHelper.nextInt(random, enchantment.getStartLevel(), enchantment.getMaxLevel());
          ItemStack itemstack = Items.ENCHANTED_BOOK.a(new EnchantmentInstance(enchantment, i1));
          int k1 = 2 + random.nextInt(5 + i1 * 10) + 3 * i1;
          merchantrecipelist.add(
              new MerchantRecipe(
                  new ItemStack(Items.BOOK), new ItemStack(Items.EMERALD, k1), itemstack));
        }
        break;

      case 2: // '\002'
        b(merchantrecipelist, Items.EYE_OF_ENDER, random, p(0.3F));
        b(merchantrecipelist, Items.EXP_BOTTLE, random, p(0.2F));
        b(merchantrecipelist, Items.REDSTONE, random, p(0.4F));
        b(merchantrecipelist, Item.getItemOf(Blocks.GLOWSTONE), random, p(0.3F));
        Item aitem[] = {
          Items.IRON_SWORD,
          Items.DIAMOND_SWORD,
          Items.IRON_CHESTPLATE,
          Items.DIAMOND_CHESTPLATE,
          Items.IRON_AXE,
          Items.DIAMOND_AXE,
          Items.IRON_PICKAXE,
          Items.DIAMOND_PICKAXE
        };
        Item aitem1[] = aitem;
        int j1 = aitem1.length;
        for (int l1 = 0; l1 < j1; l1++) {
          Item item = aitem1[l1];
          if (random.nextFloat() < p(0.05F))
            merchantrecipelist.add(
                new MerchantRecipe(
                    new ItemStack(item, 1, 0),
                    new ItemStack(Items.EMERALD, 2 + random.nextInt(3), 0),
                    EnchantmentManager.a(
                        random, new ItemStack(item, 1, 0), 5 + random.nextInt(15))));
        }

        break;
    }
    if (merchantrecipelist.isEmpty()) a(merchantrecipelist, Items.GOLD_INGOT, random, 1.0F);
    Collections.shuffle(merchantrecipelist);
    if (bu == null) bu = new MerchantRecipeList();
    for (int l = 0; l < k && l < merchantrecipelist.size(); l++)
      bu.a((MerchantRecipe) merchantrecipelist.get(l));
  }