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

    Solved Interaction avec une laisse

    1.7.x
    1.7.2
    3
    7
    1441
    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.
    • D
      DrakeRoxas last edited by

      Bonjour !

      J’ai une entity et j’aimerais pouvoir l’attaché aux autres entity.
      Exemple : on prend un cheval, on lui met une laisse, et on met l’autre bout de la laisse sur mon entity.
      Voilà, si quelqu’un a la solution, ça m’aiderais bien ^^’

      1 Reply Last reply Reply Quote 0
      • Ama
        Ama last edited by

        Essaye de voir dans les code de la barrière ;D

        Si je t'ai filé un coup de main n'oublie pas le + / -
        Par contre évite les demandes d'aides en MP, tu sera sympa'

        La JavaDoc c'est comme le PQ, ça sert à ce démerder tous seul. -Victor Hugo- 2017

        Une superbe API pour animer vos super modèles CraftStudio dans Minecraft !

        1 Reply Last reply Reply Quote 0
        • D
          DrakeRoxas last edited by

          Je t’avoue que ça m’aide pas des masses ^^’

          J’ai fait ça :

          if (!this.worldObj.isRemote)
          {
          if(!ItemLead.func_150909_a(par1EntityPlayer, this.worldObj, this.chunkCoordX, this.chunkCoordY, this.chunkCoordZ)) // Fonction tirée des fences
          {
          par1EntityPlayer.mountEntity(this);
          }
          }
          

          mais je me retrouve à monter mon entity au lieu d’y attacher les poneys 😞

          1 Reply Last reply Reply Quote 0
          • Gugu
            Gugu last edited by

            Bah, normal … j’veux dire … Tu dis juste au player de monter l’entité ciblée ._.

            Cherche comment la laisse s’attache lors du premier click droit

            "If you have a comprehensive explanation for everything then it decreases uncertainty and anxiety and reduces your cognitive load. And if you can use that simplifying algorithm to put yourself on the side of moral virtue then you’re constantly a good person with a minimum of effort."
            ― Jordan B. Peterson

            1 Reply Last reply Reply Quote 0
            • D
              DrakeRoxas last edited by

              Pour attacher elle renvois cette fonction (pas les mêmes noms d’arguments mais c’est ça):

              ItemLead.func_150909_a(EntityPlayer, worldObj, X, Y, Z)
              

              Si ça renvois true c’est que ça attache (d’où le !Itemlead.func dans mon code)

              1 Reply Last reply Reply Quote 0
              • Gugu
                Gugu last edited by

                Mais, pourquoi tu veux faire en sorte que si y’a pas de laisse, tu monte ton entité ?

                "If you have a comprehensive explanation for everything then it decreases uncertainty and anxiety and reduces your cognitive load. And if you can use that simplifying algorithm to put yourself on the side of moral virtue then you’re constantly a good person with a minimum of effort."
                ― Jordan B. Peterson

                1 Reply Last reply Reply Quote 0
                • D
                  DrakeRoxas last edited by

                  Disons que c’est juste un détail qui change pas le problème ^^’
                  En fait j’avais pas vu que les position XYZ étaient posX, posY et posZ. Mais ça me créais un nœud dans le vide, donc j’ai recopié la fonction qui créer le nœud et j’ai remplacé la création du nœud par mon entity et ça marche ^^ pour ça que ça interesserais :

                  /**
                  * First layer of player interaction
                  */
                  public boolean interactFirst(EntityPlayer par1EntityPlayer)
                  {
                  if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != par1EntityPlayer)
                  {
                  return true;
                  }
                  else
                  {
                  if (!this.worldObj.isRemote)
                  {
                  if(!leash(par1EntityPlayer))
                  {
                  par1EntityPlayer.mountEntity(this);
                  }
                  }
                  
                  return true;
                  }
                  }
                  
                  protected boolean leash(EntityPlayer p_150909_0_)
                  {
                  World p_150909_1_ = this.worldObj;
                  int p_150909_2_ = (int)this.posX;
                  int p_150909_3_ = (int)this.posY;
                  int p_150909_4_ = (int)this.posZ;
                  
                  EntityLeashKnot entityleashknot = EntityLeashKnot.getKnotForBlock(p_150909_1_, p_150909_2_, p_150909_3_, p_150909_4_);
                  boolean flag = false;
                  double d0 = 7.0D;
                  List list = p_150909_1_.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getAABBPool().getAABB((double)p_150909_2_ - d0, (double)p_150909_3_ - d0, (double)p_150909_4_ - d0, (double)p_150909_2_ + d0, (double)p_150909_3_ + d0, (double)p_150909_4_ + d0));
                  
                  if (list != null)
                  {
                  Iterator iterator = list.iterator();
                  
                  while (iterator.hasNext())
                  {
                  EntityLiving entityliving = (EntityLiving)iterator.next();
                  
                  if (entityliving.getLeashed() && entityliving.getLeashedToEntity() == p_150909_0_)
                  {
                  entityliving.setLeashedToEntity(this, true);
                  flag = true;
                  }
                  }
                  }
                  
                  return flag;
                  }
                  
                  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