コード例 #1
0
ファイル: ajc.java プロジェクト: BeYkeRYkt/MinecraftServerDec
 public boolean a(ItemStack var1) {
   return var1 == null
       ? false
       : (var1.getItem() instanceof ItemArmor
           ? ((ItemArmor) var1.getItem()).b == this.a
           : (var1.getItem() != Item.getItemOf(Blocks.PUMPKIN) && var1.getItem() != Items.SKULL
               ? false
               : this.a == 0));
 }
コード例 #2
0
  public static int fuelTime(ItemStack itemstack) {
    if (itemstack == null) {
      return 0;
    } else {
      Item item = itemstack.getItem();

      if (item instanceof ItemBlock && Block.a(item) != Blocks.AIR) {
        Block block = Block.a(item);

        if (block == Blocks.WOOD_STEP) {
          return 150;
        }

        if (block.getMaterial() == Material.WOOD) {
          return 300;
        }

        if (block == Blocks.COAL_BLOCK) {
          return 16000;
        }
      }

      return item instanceof ItemTool && ((ItemTool) item).j().equals("WOOD")
          ? 200
          : (item instanceof ItemSword && ((ItemSword) item).j().equals("WOOD")
              ? 200
              : (item instanceof ItemHoe && ((ItemHoe) item).i().equals("WOOD")
                  ? 200
                  : (item == Items.STICK
                      ? 100
                      : (item == Items.COAL
                          ? 1600
                          : (item == Items.LAVA_BUCKET
                              ? 20000
                              : (item == Item.getItemOf(Blocks.SAPLING)
                                  ? 100
                                  : (item == Items.BLAZE_ROD ? 2400 : 0)))))));
    }
  }
コード例 #3
0
ファイル: EntityMyIronGolem.java プロジェクト: jjm223/MyPet
  public boolean handlePlayerInteraction(EntityHuman entityhuman) {
    if (super.handlePlayerInteraction(entityhuman)) {
      return true;
    }

    ItemStack itemStack = entityhuman.inventory.getItemInHand();

    if (getOwner().equals(entityhuman) && itemStack != null && canUseItem()) {
      if (itemStack.getItem() == Item.getItemOf(Blocks.RED_FLOWER)
          && !getMyPet().hasFlower()
          && getOwner().getPlayer().isSneaking()) {
        getMyPet().setFlower(CraftItemStack.asBukkitCopy(itemStack));
        if (!entityhuman.abilities.canInstantlyBuild) {
          if (--itemStack.count <= 0) {
            entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, null);
          }
        }
        return true;
      } else if (itemStack.getItem() == Items.SHEARS
          && getMyPet().hasFlower()
          && getOwner().getPlayer().isSneaking()) {
        EntityItem entityitem = this.a(CraftItemStack.asNMSCopy(getMyPet().getFlower()), 1.0F);
        entityitem.motY += (double) (this.random.nextFloat() * 0.05F);
        entityitem.motX += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
        entityitem.motZ += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);

        makeSound("mob.sheep.shear", 1.0F, 1.0F);
        getMyPet().setFlower(null);
        if (!entityhuman.abilities.canInstantlyBuild) {
          itemStack.damage(1, entityhuman);
        }

        return true;
      }
    }
    return false;
  }
コード例 #4
0
 protected ItemStack i(IBlockState var1) {
   return new ItemStack(Item.getItemOf((Block) this), 1, 0);
 }
コード例 #5
0
 static {
   bB = new HashMap();
   bC = new HashMap();
   bB.put(Items.COAL, new Tuple(Integer.valueOf(16), Integer.valueOf(24)));
   bB.put(Items.IRON_INGOT, new Tuple(Integer.valueOf(8), Integer.valueOf(10)));
   bB.put(Items.GOLD_INGOT, new Tuple(Integer.valueOf(8), Integer.valueOf(10)));
   bB.put(Items.DIAMOND, new Tuple(Integer.valueOf(4), Integer.valueOf(6)));
   bB.put(Items.PAPER, new Tuple(Integer.valueOf(24), Integer.valueOf(36)));
   bB.put(Items.BOOK, new Tuple(Integer.valueOf(11), Integer.valueOf(13)));
   bB.put(Items.WRITTEN_BOOK, new Tuple(Integer.valueOf(1), Integer.valueOf(1)));
   bB.put(Items.ENDER_PEARL, new Tuple(Integer.valueOf(3), Integer.valueOf(4)));
   bB.put(Items.EYE_OF_ENDER, new Tuple(Integer.valueOf(2), Integer.valueOf(3)));
   bB.put(Items.PORK, new Tuple(Integer.valueOf(14), Integer.valueOf(18)));
   bB.put(Items.RAW_BEEF, new Tuple(Integer.valueOf(14), Integer.valueOf(18)));
   bB.put(Items.RAW_CHICKEN, new Tuple(Integer.valueOf(14), Integer.valueOf(18)));
   bB.put(Items.COOKED_FISH, new Tuple(Integer.valueOf(9), Integer.valueOf(13)));
   bB.put(Items.SEEDS, new Tuple(Integer.valueOf(34), Integer.valueOf(48)));
   bB.put(Items.MELON_SEEDS, new Tuple(Integer.valueOf(30), Integer.valueOf(38)));
   bB.put(Items.PUMPKIN_SEEDS, new Tuple(Integer.valueOf(30), Integer.valueOf(38)));
   bB.put(Items.WHEAT, new Tuple(Integer.valueOf(18), Integer.valueOf(22)));
   bB.put(Item.getItemOf(Blocks.WOOL), new Tuple(Integer.valueOf(14), Integer.valueOf(22)));
   bB.put(Items.ROTTEN_FLESH, new Tuple(Integer.valueOf(36), Integer.valueOf(64)));
   bC.put(Items.FLINT_AND_STEEL, new Tuple(Integer.valueOf(3), Integer.valueOf(4)));
   bC.put(Items.SHEARS, new Tuple(Integer.valueOf(3), Integer.valueOf(4)));
   bC.put(Items.IRON_SWORD, new Tuple(Integer.valueOf(7), Integer.valueOf(11)));
   bC.put(Items.DIAMOND_SWORD, new Tuple(Integer.valueOf(12), Integer.valueOf(14)));
   bC.put(Items.IRON_AXE, new Tuple(Integer.valueOf(6), Integer.valueOf(8)));
   bC.put(Items.DIAMOND_AXE, new Tuple(Integer.valueOf(9), Integer.valueOf(12)));
   bC.put(Items.IRON_PICKAXE, new Tuple(Integer.valueOf(7), Integer.valueOf(9)));
   bC.put(Items.DIAMOND_PICKAXE, new Tuple(Integer.valueOf(10), Integer.valueOf(12)));
   bC.put(Items.IRON_SPADE, new Tuple(Integer.valueOf(4), Integer.valueOf(6)));
   bC.put(Items.DIAMOND_SPADE, new Tuple(Integer.valueOf(7), Integer.valueOf(8)));
   bC.put(Items.IRON_HOE, new Tuple(Integer.valueOf(4), Integer.valueOf(6)));
   bC.put(Items.DIAMOND_HOE, new Tuple(Integer.valueOf(7), Integer.valueOf(8)));
   bC.put(Items.IRON_BOOTS, new Tuple(Integer.valueOf(4), Integer.valueOf(6)));
   bC.put(Items.DIAMOND_BOOTS, new Tuple(Integer.valueOf(7), Integer.valueOf(8)));
   bC.put(Items.IRON_HELMET, new Tuple(Integer.valueOf(4), Integer.valueOf(6)));
   bC.put(Items.DIAMOND_HELMET, new Tuple(Integer.valueOf(7), Integer.valueOf(8)));
   bC.put(Items.IRON_CHESTPLATE, new Tuple(Integer.valueOf(10), Integer.valueOf(14)));
   bC.put(Items.DIAMOND_CHESTPLATE, new Tuple(Integer.valueOf(16), Integer.valueOf(19)));
   bC.put(Items.IRON_LEGGINGS, new Tuple(Integer.valueOf(8), Integer.valueOf(10)));
   bC.put(Items.DIAMOND_LEGGINGS, new Tuple(Integer.valueOf(11), Integer.valueOf(14)));
   bC.put(Items.CHAINMAIL_BOOTS, new Tuple(Integer.valueOf(5), Integer.valueOf(7)));
   bC.put(Items.CHAINMAIL_HELMET, new Tuple(Integer.valueOf(5), Integer.valueOf(7)));
   bC.put(Items.CHAINMAIL_CHESTPLATE, new Tuple(Integer.valueOf(11), Integer.valueOf(15)));
   bC.put(Items.CHAINMAIL_LEGGINGS, new Tuple(Integer.valueOf(9), Integer.valueOf(11)));
   bC.put(Items.BREAD, new Tuple(Integer.valueOf(-4), Integer.valueOf(-2)));
   bC.put(Items.MELON, new Tuple(Integer.valueOf(-8), Integer.valueOf(-4)));
   bC.put(Items.APPLE, new Tuple(Integer.valueOf(-8), Integer.valueOf(-4)));
   bC.put(Items.COOKIE, new Tuple(Integer.valueOf(-10), Integer.valueOf(-7)));
   bC.put(Item.getItemOf(Blocks.GLASS), new Tuple(Integer.valueOf(-5), Integer.valueOf(-3)));
   bC.put(Item.getItemOf(Blocks.BOOKSHELF), new Tuple(Integer.valueOf(3), Integer.valueOf(4)));
   bC.put(Items.LEATHER_CHESTPLATE, new Tuple(Integer.valueOf(4), Integer.valueOf(5)));
   bC.put(Items.LEATHER_BOOTS, new Tuple(Integer.valueOf(2), Integer.valueOf(4)));
   bC.put(Items.LEATHER_HELMET, new Tuple(Integer.valueOf(2), Integer.valueOf(4)));
   bC.put(Items.LEATHER_LEGGINGS, new Tuple(Integer.valueOf(2), Integer.valueOf(4)));
   bC.put(Items.SADDLE, new Tuple(Integer.valueOf(6), Integer.valueOf(8)));
   bC.put(Items.EXP_BOTTLE, new Tuple(Integer.valueOf(-4), Integer.valueOf(-1)));
   bC.put(Items.REDSTONE, new Tuple(Integer.valueOf(-4), Integer.valueOf(-1)));
   bC.put(Items.COMPASS, new Tuple(Integer.valueOf(10), Integer.valueOf(12)));
   bC.put(Items.WATCH, new Tuple(Integer.valueOf(10), Integer.valueOf(12)));
   bC.put(Item.getItemOf(Blocks.GLOWSTONE), new Tuple(Integer.valueOf(-3), Integer.valueOf(-1)));
   bC.put(Items.GRILLED_PORK, new Tuple(Integer.valueOf(-7), Integer.valueOf(-5)));
   bC.put(Items.COOKED_BEEF, new Tuple(Integer.valueOf(-7), Integer.valueOf(-5)));
   bC.put(Items.COOKED_CHICKEN, new Tuple(Integer.valueOf(-8), Integer.valueOf(-6)));
   bC.put(Items.EYE_OF_ENDER, new Tuple(Integer.valueOf(7), Integer.valueOf(11)));
   bC.put(Items.ARROW, new Tuple(Integer.valueOf(-12), Integer.valueOf(-8)));
 }
コード例 #6
0
  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));
  }