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

    Résolu Mobs montable qui avance pas

    1.7.x
    1.7.2
    6
    11
    2090
    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.
    • darkvince37
      darkvince37 dernière édition par

      Bonjour,

      Voilà, j’ai créer une monture montable mais quand on avance avec on a l’impression d’avancé en beugant.

      Le code est un melange de plusieurs code que j’ai trouver est je suis arrivé a sa

      La class de l’entity:

      package fr.darkvince.facrpg;
      
      import java.io.DataInputStream;
      import java.io.DataOutput;
      import java.io.IOException;
      import java.util.Iterator;
      import java.util.List;
      
      import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
      import cpw.mods.fml.relauncher.Side;
      import cpw.mods.fml.relauncher.SideOnly;
      import io.netty.buffer.ByteBuf;
      import io.netty.buffer.ByteBufInputStream;
      import io.netty.buffer.ByteBufOutputStream;
      import net.minecraft.block.Block;
      import net.minecraft.block.material.Material;
      import net.minecraft.command.IEntitySelector;
      import net.minecraft.entity.Entity;
      import net.minecraft.entity.EntityAgeable;
      import net.minecraft.entity.EntityLivingBase;
      import net.minecraft.entity.IEntityLivingData;
      import net.minecraft.entity.SharedMonsterAttributes;
      import net.minecraft.entity.ai.EntityAIFollowParent;
      import net.minecraft.entity.ai.EntityAILookIdle;
      import net.minecraft.entity.ai.EntityAIMate;
      import net.minecraft.entity.ai.EntityAIPanic;
      import net.minecraft.entity.ai.EntityAIRunAroundLikeCrazy;
      import net.minecraft.entity.ai.EntityAISwimming;
      import net.minecraft.entity.ai.EntityAIWander;
      import net.minecraft.entity.ai.EntityAIWatchClosest;
      import net.minecraft.entity.ai.attributes.IAttribute;
      import net.minecraft.entity.ai.attributes.IAttributeInstance;
      import net.minecraft.entity.ai.attributes.RangedAttribute;
      import net.minecraft.entity.passive.EntityAnimal;
      import net.minecraft.entity.passive.EntityHorse;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.init.Blocks;
      import net.minecraft.init.Items;
      import net.minecraft.inventory.AnimalChest;
      import net.minecraft.inventory.IInvBasic;
      import net.minecraft.inventory.IInventory;
      import net.minecraft.inventory.InventoryBasic;
      import net.minecraft.item.Item;
      import net.minecraft.item.ItemStack;
      import net.minecraft.nbt.CompressedStreamTools;
      import net.minecraft.nbt.NBTTagCompound;
      import net.minecraft.nbt.NBTTagList;
      import net.minecraft.pathfinding.PathEntity;
      import net.minecraft.potion.Potion;
      import net.minecraft.util.DamageSource;
      import net.minecraft.util.MathHelper;
      import net.minecraft.util.StatCollector;
      import net.minecraft.world.World;
      
      public class EntityDragonDindeSauvage extends EntityAnimal
      {
      
          private float prevRearingAmount;
         public int mobSizeGen;
      
      public EntityDragonDindeSauvage(World world)
      {
      super(world);
      mobSizeGen = 0 ;
      this.setSize(0.9F, 1.5F);
      
      }
      
      public EntityDragonDindeSauvage(World world, double d, double d1, double d2)
      {
        this(world);
        setPosition(d, d1, d2);
      }
      
      public void applyEntityAttributes()
      {
      super.applyEntityAttributes();
      
      this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.66D);
      
      }
      
      @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);
         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*50.0F;
             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;
      }
      
      }
      
      1 réponse Dernière réponse Répondre Citer 0
      • Folgansky
        Folgansky Correcteurs dernière édition par

        protected boolean isMovementCeased()
        {
        return stationary;
        }
        

        Mouvement stationnaire, y’a un rapport?

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

          @‘Toutoune1008’:

          
          1.  protected boolean isMovementCeased()
          2.  {
          3.  return stationary;
          4.  }
          
          

          Mouvement stationnaire, y’a un rapport?

          MDR xD

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

            @‘Toutoune1008’:

            protected boolean isMovementCeased()
            {
               return stationary;
            }
            

            Mouvement stationnaire, y’a un rapport?

            Aucun rapport avec ou sans le mobs avance en beugant

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

              Personne ne c’est pourquoi ?

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

                Sait* et je te conseille de recréer une entité de base et de rajouter petit à petit tes plus pour voir d’où vient le problème 😉

                >! Développeur de Altis-Life (Arma III) sur Minecraft !
                >! Site web     : https://lemnoslife.com
                TeamSpeak : ts.lemnoslife.com

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

                  @‘Benjamin Loison’:

                  Sait* et je te conseille de recréer une entité de base et de rajouter petit à petit tes plus pour voir d’où vient le problème 😉

                  J’ai essayé sa a fait pareil j’ai meme essayé de passer directement pas EntityHorse sa fait pareil

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

                    Apparemment pour que le joueur contrôle une entité, il faut ajouter l’IA EntityAIControlledByPlayer(instanceDeLEntite, vitesseMax)

                    Site web contenant mes scripts : http://SCAREXgaming.github.io

                    Pas de demandes de support par MP ni par skype SVP.
                    Je n'accepte sur skype que l…

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

                      @‘SCAREX’:

                      Apparemment pour que le joueur contrôle une entité, il faut ajouter l’IA EntityAIControlledByPlayer(instanceDeLEntite, vitesseMax)

                      this.tasks.addTask(1, new EntityAIControlledByPlayer(this, 5.0F)); voilà se que j’ai ajouté dans mon constructor si c’est sa sa marche pas

                      Mais le truc c’est que je monte dessus je peut avancer mais c’est comme si qu’on se téléporte un peu en beugant

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

                        Non c’est la fonction moveEntityWithHeading de entity horse, que tu as mis, qui gère le mouvement et la rotation de l’entité en fonction de celle qui la monte. Donc il faut voir ce qui marche pas dedans.

                        Envoyé de mon RAINBOW LITE 4G en utilisant Tapatalk

                        Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                        AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                        Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                        Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                          @‘AymericRed’:

                          Non c’est la fonction moveEntityWithHeading de entity horse, que tu as mis, qui gère le mouvement et la rotation de l’entité en fonction de celle qui la monte. Donc il faut voir ce qui marche pas dedans.

                          Envoyé de mon RAINBOW LITE 4G en utilisant Tapatalk

                          Merci j’ai refait a zéro moveEntityWithHeading est j’ai pu corrigé le beug

                          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