• Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Activer enchantement fortune

    Sans suite
    1.7.x
    2
    4
    1649
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Sebenf0rce last edited by

      Bonjour,
      J’ai crée mon minerai tout marche bien il drop un item quand on le casse mais l’enchantement fortune n’a pas d’effet sur celui-ci.
      Voici le code de mon bloc :

      
      package com.sebenf0rce;
      
      import java.util.Random;
      
      import net.minecraft.block.Block;
      import net.minecraft.block.material.Material;
      import net.minecraft.item.Item;
      
      public class mineraiAmethyste extends Block
      {
          protected mineraiAmethyste(Material material)
          {
              super(material);
          }
      
      public Item getItemDropped(int metadata, Random rand, int fortune) {
      
          if (metadata == 0) {
              return Main.Amethyste;
          }
          return null;
      
      }
      }
      
      

      Merci d’avance.

      1 Reply Last reply Reply Quote 0
      • robin4002
        robin4002 Moddeurs confirmés Rédacteurs Administrateurs last edited by

        public int quantityDropped(int meta, int fortune, Random rand)
            {
                if (fortune > 0 && Item.getItemFromBlock(this) != this.getItemDropped(meta, rand, fortune))
                {
                    int j = rand.nextInt(fortune + 2) - 1;
        
                    if (j < 0)
                    {
                        j = 0;
                    }
        
                    return this.quantityDropped(rand) * (j + 1);
                }
                else
                {
                    return this.quantityDropped(rand);
                }
            }
        
        1 Reply Last reply Reply Quote 0
        • S
          Sebenf0rce last edited by

          @‘robin4002’:

             public int quantityDropped(int meta, int fortune, Random rand)
              {
                  if (fortune > 0 && Item.getItemFromBlock(this) != this.getItemDropped(meta, rand, fortune))
                  {
                      int j = rand.nextInt(fortune + 2) - 1;
          
                      if (j < 0)
                      {
                          j = 0;
                      }
          
                      return this.quantityDropped(rand) * (j + 1);
                  }
                  else
                  {
                      return this.quantityDropped(rand);
                  }
              }
          

          Comment faire en sorte que ça drop un item en particulier ? Car la sa drop le bloc.

          1 Reply Last reply Reply Quote 0
          • robin4002
            robin4002 Moddeurs confirmés Rédacteurs Administrateurs last edited by

            Pas normal ça. La fonction getItemDropped que tu as mit est sensé faire dropper un autre item que le bloc lui même.
            Renvoie tout ton code.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Design by Woryk
            Contact / Mentions Légales

            MINECRAFT FORGE FRANCE © 2018

            Powered by NodeBB