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

    Empêcher la disparition d'un model trop long à rendre

    Sans suite
    1.7.10
    2
    8
    1109
    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.
    • Deleted
      Deleted last edited by

      Bonjour tout le monde
      J’ai un model qui fait 12 blocks de long et sous certains angles de vue, on le voit subitement disparaître. Y’aurait-il quelque chose à ajouter dans mon entity, mon model ou mon render ? Si oui merci de donner une piste 😃
      Je n’ai par-conséquent aucun code à vous donner
      Merci d’avance 🙂

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

        Salut,
        Tu as changer la boite de collision ? car normalement ça s’adapte en fonction de cette dernière.

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

          Nop je ne l’ai pas fait, je m’en charge et j’édite 😉
          Ok super ça marche. J’aurai pu faire + de recherches…
          Mais je voudrai custom ma hitbox car pour le moment avec cette ligne 
          this.setSize(12.0F, 3.0F);
          J’obtiens ceci, ce qui est logique :

          Cependant j’aurai voulu comment avoir une hitbox qui se limite à mon mob, et juste à mon mob. Or le prob de cette méthode est qu’elle n’est que pour la longueur et la hauteur, pas pour la profondeur. Alors comment je fais ? Je dois recréer un autre système de hitbox ou existe-t-il une autre méthode qui m’aurait échappé ? Les dimensions de mon mob sont normalement : 
          Longueur : 3 blocks
          Hauteur : 3 Blocks
          Profondeur : 12 Blocks
          Merci encore 😃

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

            Regardes ce que fait setSize. Tu devais pouvoir l’adapter.

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

              Voici la méthode origine setSize

              
                  protected void setSize(float p_70105_1_, float p_70105_2_)
                  {
                      float f2;
              
                      if (p_70105_1_ != this.width || p_70105_2_ != this.height)
                      {
                          f2 = this.width;
                          this.width = p_70105_1_;
                          this.height = p_70105_2_;
                          this.boundingBox.maxX = this.boundingBox.minX + (double)this.width;
                          this.boundingBox.maxZ = this.boundingBox.minZ + (double)this.width;
                          this.boundingBox.maxY = this.boundingBox.minY + (double)this.height;
              
                          if (this.width > f2 && !this.firstUpdate && !this.worldObj.isRemote)
                          {
                              this.moveEntity((double)(f2 - this.width), 0.0D, (double)(f2 - this.width));
                          }
                      }
              
                      f2 = p_70105_1_ % 2.0F;
              
                      if ((double)f2 < 0.375D)
                      {
                          this.myEntitySize = Entity.EnumEntitySize.SIZE_1;
                      }
                      else if ((double)f2 < 0.75D)
                      {
                          this.myEntitySize = Entity.EnumEntitySize.SIZE_2;
                      }
                      else if ((double)f2 < 1.0D)
                      {
                          this.myEntitySize = Entity.EnumEntitySize.SIZE_3;
                      }
                      else if ((double)f2 < 1.375D)
                      {
                          this.myEntitySize = Entity.EnumEntitySize.SIZE_4;
                      }
                      else if ((double)f2 < 1.75D)
                      {
                          this.myEntitySize = Entity.EnumEntitySize.SIZE_5;
                      }
                      else
                      {
                          this.myEntitySize = Entity.EnumEntitySize.SIZE_6;
                      }
                  }
              
              

              Et voici ce que j’en ai fait

              
              protected void setSize(float p_70105_1_, float p_70105_2_, float p_70105_3_)
                  {
                      float f2;
              
                      if (p_70105_1_ != this.width || p_70105_2_ != this.height)
                      {
                          f2 = this.width;
                          this.width = p_70105_1_;
                          this.height = p_70105_2_;
                          this.boundingBox.maxX = this.boundingBox.minX + (double)this.width;
                          this.boundingBox.maxY = this.boundingBox.minY + (double)this.height;
                          this.boundingBox.maxZ = this.boundingBox.minZ + (double)p_70105_3_;
                          if (this.width > f2 && !this.worldObj.isRemote)
                          {
                              this.moveEntity((double)(f2 - this.width), 0.0D, (double)(f2 - this.width));
                          }
                      }
              
                      f2 = p_70105_1_ % 2.0F;
              
                      if ((double)f2 < 0.375D)
                      {
                          this.myEntitySize = Entity.EnumEntitySize.SIZE_1;
                      }
                      else if ((double)f2 < 0.75D)
                      {
                          this.myEntitySize = Entity.EnumEntitySize.SIZE_2;
                      }
                      else if ((double)f2 < 1.0D)
                      {
                          this.myEntitySize = Entity.EnumEntitySize.SIZE_3;
                      }
                      else if ((double)f2 < 1.375D)
                      {
                          this.myEntitySize = Entity.EnumEntitySize.SIZE_4;
                      }
                      else if ((double)f2 < 1.75D)
                      {
                          this.myEntitySize = Entity.EnumEntitySize.SIZE_5;
                      }
                      else
                      {
                          this.myEntitySize = Entity.EnumEntitySize.SIZE_6;
                      }
                  }
              
              

              J’ai tenté avec cette ligne là 
              this.setSize(12.0F, 3.0F, 1.0F);
              Mais le problème persiste et je n’y arrive pas

              Au passage je n’ai pas remis cette condition  (car elle est en private, j’ai donc tenté ça ObfuscationReflectionHelper.getPrivateValue(net.minecraft.entity.Entity.class, this, new String[] {“firstUpdate”, “field_70148_d”});, mais aucune idée de si ça marche ou pas :/) :
              !this.firstUpdate
              Mais je ne pense pas que ce soit la cause…
              Merci d’avance 😃

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

                Peut-être que c’est en rapport avec la variable width. Faudrait voir ou elle est utilisé.

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

                  J’ai beau faire toutes les opérations que je veux à cette ligne, voire même retirer la variable width, rien n’y fait la hitbox ne change pas.

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

                    Effectivement ! Tout tourne autour de la variable width. J’ai donc bidouillé un peu, si je modifie cette ligne :
                    this.width = p_70105_1_;
                    La hitbox sera modifié pour l’axe des X, j’avais donc tenté ça pour mon axe des Z mais marche pas
                    this.width = p_70105_1_ * 4F;
                    Pour info je l’avais placé de manière à ce que ma méthode ressemble à ça :

                    
                    @Override
                    protected void setSize(float p_70105_1_, float p_70105_2_)
                    {
                    float f2;
                    
                    if (p_70105_1_ != this.width || p_70105_2_ != this.height)
                    {
                    f2 = this.width;
                    this.width = p_70105_1_;
                    this.height = p_70105_2_;
                    this.boundingBox.maxX = this.boundingBox.minX + (double) this.width;
                    this.boundingBox.maxY = this.boundingBox.minY + (double) this.height;
                    this.width = p_70105_1_ * 4F;
                    this.boundingBox.maxZ = this.boundingBox.minZ + (double) this.width;
                    if (this.width > f2 && !this.worldObj.isRemote)
                    {
                    this.moveEntity((double) (f2 - this.width), 0.0D, (double) (f2 - this.width));
                    }
                    }
                    
                    f2 = p_70105_1_ % 2.0F;
                    
                    if ((double) f2 < 0.375D)
                    {
                    this.myEntitySize = Entity.EnumEntitySize.SIZE_1;
                    }
                    else if ((double) f2 < 0.75D)
                    {
                    this.myEntitySize = Entity.EnumEntitySize.SIZE_2;
                    }
                    else if ((double) f2 < 1.0D)
                    {
                    this.myEntitySize = Entity.EnumEntitySize.SIZE_3;
                    }
                    else if ((double) f2 < 1.375D)
                    {
                    this.myEntitySize = Entity.EnumEntitySize.SIZE_4;
                    }
                    else if ((double) f2 < 1.75D)
                    {
                    this.myEntitySize = Entity.EnumEntitySize.SIZE_5;
                    }
                    else
                    {
                    this.myEntitySize = Entity.EnumEntitySize.SIZE_6;
                    }
                    }
                    
                    

                    Si vous avez d’autres idées, je suis preneur. Mais je pense être près du but, la journée de demain sera sûrement  la bonne 😉

                    EDIT = Je pense avoir compris ce qui n’allait pas. La méthode est appelée deux fois car un message en fin de méthode apparaissait deux fois dans la console.
                    Mais du coup j’ai fait ça et ça ne marche toujours pas ???

                    
                    @Override
                    protected void setSize(float p_70105_1_, float p_70105_2_)
                    {
                    float f2;
                    if (p_70105_1_ != this.width || p_70105_2_ != this.height)
                    {
                    f2 = this.width;
                    this.width = p_70105_1_;
                    this.height = p_70105_2_;
                    this.boundingBox.maxX = this.boundingBox.minX + (double) this.width;
                    this.boundingBox.maxY = this.boundingBox.minY + (double) this.height;
                    this.width = p_70105_1_ * 4;
                    this.boundingBox.maxZ = this.boundingBox.minZ + (double) this.width;
                    this.width = p_70105_1_;
                    if (this.width > f2 && !this.worldObj.isRemote)
                    {
                    this.moveEntity((double) (f2 - this.width), 0.0D, (double) (f2 - this.width));
                    }
                    }
                    
                    f2 = p_70105_1_ % 2.0F;
                    
                    if ((double) f2 < 0.375D)
                    {
                    this.myEntitySize = Entity.EnumEntitySize.SIZE_1;
                    }
                    else if ((double) f2 < 0.75D)
                    {
                    this.myEntitySize = Entity.EnumEntitySize.SIZE_2;
                    }
                    else if ((double) f2 < 1.0D)
                    {
                    this.myEntitySize = Entity.EnumEntitySize.SIZE_3;
                    }
                    else if ((double) f2 < 1.375D)
                    {
                    this.myEntitySize = Entity.EnumEntitySize.SIZE_4;
                    }
                    else if ((double) f2 < 1.75D)
                    {
                    this.myEntitySize = Entity.EnumEntitySize.SIZE_5;
                    }
                    else
                    {
                    this.myEntitySize = Entity.EnumEntitySize.SIZE_6;
                    }
                    }
                    
                    
                    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