• S'inscrire
    • Se connecter
    • Recherche
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes

    Résolu Vitesse EntityAnimal montable

    1.7.x
    1.7.10
    3
    8
    2047
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • Kujaroth
      Kujaroth dernière édition par

      salut !

      j’aimerais savoir comment modifier la vitesse de mon entity quand je suis dessus, mais impossible, je n’y arrive pas…

      ​
      
          package com.google.dofuspet.common;
      
              import net.minecraft.entity.Entity;
      import net.minecraft.entity.EntityAgeable;
      import net.minecraft.entity.EntityLivingBase;
      import net.minecraft.entity.SharedMonsterAttributes;
      import net.minecraft.entity.passive.EntityAnimal;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.util.MathHelper;
      import net.minecraft.world.World;
      
      public class EntityMobDindeApprivoise extends EntityAnimal
      {
      
           private float prevRearingAmount;
          public int mobSizeGen;
      
      public EntityMobDindeApprivoise(World world)
      {
      super(world);
      mobSizeGen = 0 ;//(int) Math.round(Math.random()*5);
      //this.setCustomNameTag("test");
      this.setSize(1.5F, 2.0F);
      
      }
      
      public void applyEntityAttributes()
      {
      super.applyEntityAttributes();
      
      this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(15D);
      
      }
      
      @Override
      public EntityAgeable createChild(EntityAgeable p_90011_1_) {
          // TODO Auto-generated method stub
          return null;
      }
      
      public boolean interact(EntityPlayer par1EntityPlayer)
      {
      
          par1EntityPlayer.rotationYaw = this.rotationYaw;
          par1EntityPlayer.rotationPitch = this.rotationPitch;
          par1EntityPlayer.mountEntity(this);
          System.out.println("Monté");
          return super.interact(par1EntityPlayer);
      }
      
      public boolean stationary;
      
      protected boolean isMovementCeased()
      {
      return stationary;
      }
      
      public void updateRiderPosition()
      {
         super.updateRiderPosition();
      
          if (this.prevRearingAmount > 0.0F)
         {
             float var1 = MathHelper.sin(this.renderYawOffset * (float)Math.PI / 180.0F);
             float var2 = MathHelper.cos(this.renderYawOffset * (float)Math.PI / 180.0F);
             float var3 = 0.7F * this.prevRearingAmount;
             float var4 = 0.15F * this.prevRearingAmount;
      
             this.riddenByEntity.setPosition(this.posX + (double)(var3 * var1), this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset() + (double)var4, this.posZ - (double)(var3 * var2));
      
              if (this.riddenByEntity instanceof EntityLivingBase)
      
             {
                 ((EntityLivingBase)this.riddenByEntity).renderYawOffset = this.renderYawOffset;
             }
      }
      
      }
      
      ////////////////////
      public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_)
      {
          if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityLivingBase)
          {
              this.prevRotationYaw = this.rotationYaw = this.riddenByEntity.rotationYaw;
              this.rotationPitch = this.riddenByEntity.rotationPitch * 0.5F;
              this.setRotation(this.rotationYaw, this.rotationPitch);
              this.rotationYawHead = this.renderYawOffset = this.rotationYaw;
              p_70612_1_ = ((EntityLivingBase)this.riddenByEntity).moveStrafing *0.5F; //0.5F;
              p_70612_2_ = ((EntityLivingBase)this.riddenByEntity).moveForward;
      ;
      
              this.stepHeight = 1.0F;
              this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F;
      
              if (!this.worldObj.isRemote)
              {
                  this.setAIMoveSpeed((float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue());
                  super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
      
              }
      
              if (this.onGround)
              {
                 // this.jumpPower = 0.0F;
                 // this.setHorseJumping(false);
              }
      
              this.prevLimbSwingAmount = this.limbSwingAmount;
              double d1 = this.posX - this.prevPosX;
              double d0 = this.posZ - this.prevPosZ;
              float f4 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F;
      
              if (f4 > 1.0F)
              {
                  f4 = 1.0F;
              }
      
              this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F;
              this.limbSwing += this.limbSwingAmount;
          }
          else
          {
              this.stepHeight = 0.5F;
              this.jumpMovementFactor = 0.02F;
              super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
          }
      
      }
      ///////////////////////////////////////
      public double getMountedYOffset()
      {
      return 1.65D;
      }
      
      }
      

      Merci

      >! Bonjour/Bonsoir,
      >! Vous désirez un Modèle ou une Texture pour votre Mod ? Vous pouvez faire un…

      1 réponse Dernière réponse Répondre Citer 0
      • robin4002
        robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par

        ligne 102 il y a un point virgule en trop. Et juste au dessus tu as les variables à augmenter.

        1 réponse Dernière réponse Répondre Citer 0
        • Kujaroth
          Kujaroth dernière édition par

          Merci, j’ai enlever le point virgule, quand au variable, si tu parle de

          ​ p_70612_1_ = ((EntityLivingBase)this.riddenByEntity).moveStrafing*50.0F; //0.5F;
          p_70612_2_ = ((EntityLivingBase)this.riddenByEntity).moveForward;
          

          rien ne change :s marche toujours a 2 a l’heure…

          >! Bonjour/Bonsoir,
          >! Vous désirez un Modèle ou une Texture pour votre Mod ? Vous pouvez faire un…

          1 réponse Dernière réponse Répondre Citer 0
          • robin4002
            robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par

            En même temps tu a augmenter la vitesse quand il court, pas la vitesse de base … Augmente moveForward

            1 réponse Dernière réponse Répondre Citer 0
            • Kujaroth
              Kujaroth dernière édition par

              ​
              
              
              1. p_70612_1_ = ((EntityLivingBase)this.riddenByEntity).moveStrafing*100.0F; //0.5F;
              2. p_70612_2_ = ((EntityLivingBase)this.riddenByEntity).moveForward*50.0F;

              toujours aucun changement, j’avais déjà toucher a ses deux valeurs avant pour tester.

              >! Bonjour/Bonsoir,
              >! Vous désirez un Modèle ou une Texture pour votre Mod ? Vous pouvez faire un…

              1 réponse Dernière réponse Répondre Citer 0
              • elias54
                elias54 Administrateurs dernière édition par

                Regarde sur les sources du Schaza de fake ores 😉 (branche 1.8, rien n’a été commit encore)

                Mon site | GitHub

                1 réponse Dernière réponse Répondre Citer 1
                • Kujaroth
                  Kujaroth dernière édition par

                  Merci elias54, j’ai regardé en reprenant certain boue de code. La vitesse est trop grande du coup ^^’

                  Quoi que je fasse, dans le :

                  ​public void ​moveEntityWithHeading(float par1, float par2)
                  

                  quand je fait un :

                  ​System.out.println("moveForward : "+par1);
                  
                  System.out.println("moveStrafing : "+par2);
                  

                  la valeur reste la même, c’est a dire 0.98.

                  Pourtant, j’ai changé ses valeurs dans le :

                  ​public void updateEntityActionState()
                  
                  ​moveStrafing = (entityplayer.moveStrafing / f) * 2.75F;
                  
                  moveForward = (entityplayer.moveForward / f) * 3.75F;
                  

                  Rien a faire…

                  Et d’après ce que j’ai vue, l’un influe sur les déplacements bas/haut et l’autre sur gauche/droite, c’est ça ?

                  Cordialement.

                  >! Bonjour/Bonsoir,
                  >! Vous désirez un Modèle ou une Texture pour votre Mod ? Vous pouvez faire un…

                  1 réponse Dernière réponse Répondre Citer 0
                  • Kujaroth
                    Kujaroth dernière édition par

                    Merci de votre aide ! 😃

                    >! Bonjour/Bonsoir,
                    >! Vous désirez un Modèle ou une Texture pour votre Mod ? Vous pouvez faire un…

                    1 réponse Dernière réponse Répondre Citer 0
                    • 1 / 1
                    • Premier message
                      Dernier message
                    Design by Woryk
                    Contact / Mentions Légales

                    MINECRAFT FORGE FRANCE © 2018

                    Powered by NodeBB