Package net.minecraft.enchantment

Examples of net.minecraft.enchantment.EnchantmentData


        addAspectLoot(Aspect.MIND, new ItemStack(Items.paper, 64), 15);
        addAspectLoot(Aspect.MIND, new ItemStack(Items.book, 32), 10);
        addAspectLoot(Aspect.MIND, new ItemStack(Blocks.bookshelf, 16), 5);
        for (Enchantment enchant : Enchantment.enchantmentsBookList) {
            addAspectLoot(Aspect.MIND, Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(enchant, 1)), 1);
        }

        addAspectLoot(Aspect.FLESH, new ItemStack(ConfigItems.itemResource, 16, 5), 4);
        addAspectLoot(Aspect.FLESH, new ItemStack(ConfigItems.itemResource, 16, 5), 1);
View Full Code Here


        Enchantment ench = Enchantment.enchantmentsList[id.intValue()];
        if(ench != null && ench.getName() != null) {

          for (EnchanterRecipe recipe : recipes) {
            if(recipe.isValid() && recipe.getEnchantment().getName().equals(ench.getName())) {
              EnchantmentData enchantment = new EnchantmentData(recipe.getEnchantment(), 1);
              ItemStack output = new ItemStack(Items.enchanted_book);
              Items.enchanted_book.addEnchantment(output, enchantment);
              EnchanterRecipeNEI rec = new EnchanterRecipeNEI(recipe, output, enchantment);
              arecipes.add(rec);
            }
View Full Code Here

  public void loadCraftingRecipes(String outputId, Object... results) {
    if(outputId.equals("EIOEnchanter") && getClass() == EnchanterRecipeHandler.class) {
      List<EnchanterRecipe> recipes = EnchanterRecipeManager.getInstance().getRecipes();
      for (EnchanterRecipe recipe : recipes) {
        if(recipe.isValid()) {
          EnchantmentData enchantment = new EnchantmentData(recipe.getEnchantment(), 1);
          ItemStack output = new ItemStack(Items.enchanted_book);
          Items.enchanted_book.addEnchantment(output, enchantment);
          EnchanterRecipeNEI rec = new EnchanterRecipeNEI(recipe, output, enchantment);
          arecipes.add(rec);
        }
View Full Code Here

  @Override
  public void loadUsageRecipes(ItemStack ingredient) {
    List<EnchanterRecipe> recipes = EnchanterRecipeManager.getInstance().getRecipes();
    for (EnchanterRecipe recipe : recipes) {
      if(recipe.isValid()) {
        EnchantmentData enchantment = new EnchantmentData(recipe.getEnchantment(), 1);
        ItemStack output = new ItemStack(Items.enchanted_book);
        Items.enchanted_book.addEnchantment(output, enchantment);
        EnchanterRecipeNEI rec = new EnchanterRecipeNEI(recipe, output, enchantment);
        if(rec.contains(rec.input, ingredient)) {
          rec.setIngredientPermutation(rec.input, ingredient);
View Full Code Here

  public EnchantmentData getCurrentEnchantmentData() {
    EnchanterRecipe rec = getCurrentEnchantmentRecipe();
    if(rec == null || inv[1] == null) {
      return null;
    }
    return new EnchantmentData(rec.getEnchantment(), Math.min(inv[1].stackSize, rec.getEnchantment().getMaxLevel()));
  }
View Full Code Here

      public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
        if(!player.capabilities.isCreativeMode) {
          player.addExperienceLevel(-enchanter.getCurrentEnchantmentCost());
        }
        EnchantmentData enchData = enchanter.getCurrentEnchantmentData();
        ItemStack curStack = enchanter.getStackInSlot(1);
        if(enchData == null || curStack == null || enchData.enchantmentLevel >= curStack.stackSize) {
          enchanter.setInventorySlotContents(1, (ItemStack) null);
        } else {
          curStack = curStack.copy();
View Full Code Here

    return player.experienceLevel >= enchanter.getCurrentEnchantmentCost();
  }

  private void updateOutput() {
    ItemStack output = null;
    EnchantmentData enchantment = enchanter.getCurrentEnchantmentData();
    if(enchantment != null) {
      output = new ItemStack(Items.enchanted_book);
      Items.enchanted_book.addEnchantment(output, enchantment);
    }
    enchanter.setOutput(output);
View Full Code Here

      List<EnchantmentData> enchantmentList = null;
      Map<Integer, EnchantmentData> enchantmentMap = mapEnchantmentData(targetEnchantability, stack);
     
      if(enchantmentMap != null && !enchantmentMap.isEmpty())
      {
        EnchantmentData enchData = (EnchantmentData)WeightedRandom.getRandomItem(rand, enchantmentMap.values());
       
        if(enchData != null)
        {
          enchantmentList = new ArrayList<EnchantmentData>();
          enchantmentList.add(enchData);
         
          for(int i = targetEnchantability; rand.nextInt(50) <= i; i >>= 1)
          {
            for(Integer enchIndex : enchantmentMap.keySet())
            {
              boolean validWithPreviousEnchants = true;
              for(EnchantmentData newEnchantment : enchantmentList)
              {
                if (newEnchantment.enchantmentobj.canApplyTogether(Enchantment.enchantmentsList[enchIndex]))
                {
                  continue;
                }
               
                validWithPreviousEnchants = false;
              }
              if(!validWithPreviousEnchants)
              {
                enchantmentMap.remove(enchIndex);
              }
             
              break;
            }
           
            if(!enchantmentMap.isEmpty())
            {
              EnchantmentData randomEnchant = (EnchantmentData)WeightedRandom.getRandomItem(rand, enchantmentMap.values());
              enchantmentList.add(randomEnchant);
            }
          }
        }
      }
View Full Code Here

            if(enchantmentMap == null)
            {
              enchantmentMap = new HashMap<Integer, EnchantmentData>();
            }
           
            enchantmentMap.put(Integer.valueOf(enchantment.effectId), new EnchantmentData(enchantment, enchLevel));
          }
        }
      }
    }
   
View Full Code Here

    if (hasCardboardItem)
      sampleInputs.add(input);
  }
  private ItemStack makeEnchantedBook(Enchantment ench, int level) {
    ItemStack book = new ItemStack(Items.enchanted_book);
    ((ItemEnchantedBook)book.getItem()).addEnchantment(book, new EnchantmentData(ench, level));
    return book;
  }
View Full Code Here

TOP

Related Classes of net.minecraft.enchantment.EnchantmentData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.