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

    Solved Récupérer un item à metadata dans une liste

    1.7.x
    1.7.10
    2
    3
    514
    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.
    • Folgansky
      Folgansky Correcteurs last edited by

      Salut les gens, j’aimerais ajouter des loots à un mob et gérer les probas, en cherchant un peu sur le forum j’ai trouvé des infos utiles.

      Mon soucis étant:

      :::

      public class EntityMobGangster extends EntityMob
      {
      private static final ItemStack defaultHeldItem;
      
      public EntityMobGangster(World world)
      {
      super(world);
      }
      
      public static Item[] randItems = new Item[]
      {
      ModPg2.itemMetadata, ModPg2.itemRandomMunition, ModPg2.itemRandomMunition
      };
      
      public ItemStack getHeldItem()
          {
              return defaultHeldItem;
          }
      
      public void applyEntityAttributes()
      {
      super.applyEntityAttributes();
      this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20D);
      this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6D);
      this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(0.5D);
      this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
      }
      
          protected int getExperiencePoints(EntityPlayer player)
          {
                  return this.experienceValue = 0;
          }
      
      protected void dropFewItems(boolean boo, int i)
          {
              Item randItem = randItems[this.worldObj.rand.nextInt(randItems.length)];
      
              if (this.getDropItem() != null)
              {
                  int j = this.rand.nextInt(3);
      
                  if (i > 0)
                  {
                      j += this.rand.nextInt(i + 1);
                  }
      
                  for (int k = 0; k < j; ++k)
                  {
                      this.dropItem(randItem, 1);
                  }
              }
          }
      
      static 
          {
              defaultHeldItem = new ItemStack(ModPg2.itemBaseball2, 1);
          }
      }
      

      :::

      J’aimerais pouvoir mettre l’item “ModPg2.itemMetadata” mais de divers metadata dans ma liste, chose que je ne sais pas faire.

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

        Faut faire un tableau d’item stack.

        1 Reply Last reply Reply Quote 0
        • Folgansky
          Folgansky Correcteurs last edited by

          D’acc.

          MonMod.MonItem devient quoi en ItemStack?

          Edit: Ok apparement c’est new ItemStack(MonMod.MonItem,quantité, metadata)

          Il faut passer par un event du coup, note à ceux qui passeront par là à ce sujet.

          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