MFF

    Minecraft Forge France
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    Monture apprivoisable par 1 personne

    Planifier Épinglé Verrouillé Déplacé Sans suite
    1.7.2
    75 Messages 4 Publieurs 15.2k Vues 1 Watching
    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.
    • Superloup10S Hors-ligne
      Superloup10 Modérateurs
      dernière édition par

      La méthode onSpawnWithEgg sert pour faire spawner une entité à l’aide de son œuf.
      L’IA EntityAIFollowOwner sert juste à indiquer à l’entité qu’elle doit suivre son maitre.

      Dans la classe EntityOcelot, si tu es sous Eclipse, fais CTRL+F et marque owner dans le champ recherche.
      Tu trouveras toutes les références à owner qui se trouve dans EntityOcelot.

      Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

      Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

        @‘Superloup10’:

        La méthode onSpawnWithEgg sert pour faire spawner une entité à l’aide de son œuf.
        L’IA EntityAIFollowOwner sert juste à indiquer à l’entité qu’elle doit suivre son maitre.

        Dans la classe EntityOcelot, si tu es sous Eclipse, fais CTRL+F et marque owner dans le champ recherche.
        Tu trouveras toutes les références à owner qui se trouve dans EntityOcelot.

        C’est se que j’ai fait j’ai eu que c’est methode

        1 réponse Dernière réponse Répondre Citer 0
        • Superloup10S Hors-ligne
          Superloup10 Modérateurs
          dernière édition par

          Autant pour moi, c’est la class EntityTameable qui a ce tag.

          Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

          Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

            @‘Superloup10’:

            Autant pour moi, c’est la class EntityTameable qui a ce tag.

            Y a beaucoup plus de chose

              public EntityLivingBase getOwner()
                {
                    try
                    {
                        UUID uuid = UUID.fromString(this.func_152113_b());
                        return uuid == null ? null : this.worldObj.func_152378_a(uuid);
                    }
                    catch (IllegalArgumentException illegalargumentexception)
                    {
                        return null;
                    }
                }
            
                public boolean func_152114_e(EntityLivingBase p_152114_1_)
                {
                    return p_152114_1_ == this.getOwner();
                }
            
                public Team getTeam()
                {
                    if (this.isTamed())
                    {
                        EntityLivingBase entitylivingbase = this.getOwner();
            
                        if (entitylivingbase != null)
                        {
                            return entitylivingbase.getTeam();
                        }
                    }
            
                    return super.getTeam();
                }
            
                public boolean isOnSameTeam(EntityLivingBase p_142014_1_)
                {
                    if (this.isTamed())
                    {
                        EntityLivingBase entitylivingbase1 = this.getOwner();
            
                        if (p_142014_1_ == entitylivingbase1)
                        {
                            return true;
                        }
            
                        if (entitylivingbase1 != null)
                        {
                            return entitylivingbase1.isOnSameTeam(p_142014_1_);
                        }
                    }
            
                    return super.isOnSameTeam(p_142014_1_);
                }
            
            1 réponse Dernière réponse Répondre Citer 0
            • Superloup10S Hors-ligne
              Superloup10 Modérateurs
              dernière édition par

              Ton entité ressemble à quoi pour l’instant?

              Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

              Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                @‘Superloup10’:

                Ton entité ressemble à quoi pour l’instant?

                package fr.darkvince.facrpg.monture;
                
                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.EntityAIControlledByPlayer;
                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 ;//(int) Math.round(Math.random()*5);
                //this.setCustomNameTag("test");
                this.setSize(0.9F, 1.5F);
                
                this.tasks.addTask(1, new EntityAIControlledByPlayer(this, 5.0F));
                
                }
                
                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*50000.0F; //0.5F;
                       p_70612_2_ = ((EntityLivingBase)this.riddenByEntity).moveForward*50000.0F;
                
                       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 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 * 5.0F;
                        p_70612_2_ = ((EntityLivingBase)this.riddenByEntity).moveForward;
                
                            this.isAirBorne = true;
                
                        }
                
                        this.stepHeight = 1.0F;
                
                        if (!this.worldObj.isRemote)
                        {
                            this.setAIMoveSpeed((float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue());
                            super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
                        }
                
                        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;
                    }
                
                public double getMountedYOffset() 
                {
                return 1.0D;
                }
                
                }
                
                1 réponse Dernière réponse Répondre Citer 0
                • Superloup10S Hors-ligne
                  Superloup10 Modérateurs
                  dernière édition par

                  À la place du EntityAnimal, mets EntityTameable, comme ça tu as accès au tag qui définit le propriétaire.

                  Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                  Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                    @‘Superloup10’:

                    À la place du EntityAnimal, mets EntityTameable, comme ça tu as accès au tag qui définit le propriétaire.

                    Dacc, donc la si je me debrouille bien avec tous se que j’ai je peut faire que la personne qui pose l’oeuf est le seul qui peut monter sur la monture

                    1 réponse Dernière réponse Répondre Citer 0
                    • Superloup10S Hors-ligne
                      Superloup10 Modérateurs
                      dernière édition par

                      Oui, au moment où tu fais spawner ton entité, tu fais un truc de se genre ```java
                      EntityName entityName = new EntityName(world);
                      entityName.setOwner(playerName);  // Le nom de la méthode peut différer d’une version de Minecraft à l’autre
                      world.spawnEntityInWorld(entityName); // Même chose que le commentaire précédent

                      Oublie pas de positionner correctement ton entité par rapport au joueur.

                      Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                      Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                        @‘Superloup10’:

                        Oui, au moment où tu fais spawner ton entité, tu fais un truc de se genre ```java
                        EntityName entityName = new EntityName(world);
                        entityName.setOwner(playerName);  // Le nom de la méthode peut différer d’une version de Minecraft à l’autre
                        world.spawnEntityInWorld(entityName); // Même chose que le commentaire précédent

                        Oublie pas de positionner correctement ton entité par rapport au joueur.
                        

                        Voilà se que j’ai fait

                        public IEntityLivingData onSpawnWithEgg(IEntityLivingData p_110161_1_)
                        {
                            p_110161_1_ = super.onSpawnWithEgg(p_110161_1_);
                        
                            if (this.worldObj.rand.nextInt(7) == 0)
                            {
                                for (int i = 0; i < 2; ++i)
                                {
                        
                                EntityPlayer playerName;
                                    EntityDragonDindeSauvage entityName = new EntityDragonDindeSauvage(this.worldObj);     
                                    entityName.setOwner(playerName);  // Le nom de la méthode peut différer d'une version de Minecraft à l'autre
                                    entityName.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 1.0F);
                                    this.worldObj.spawnEntityInWorld(entityName); // Même chose que le commentaire précédent
                        
                                }
                            }
                        
                            return p_110161_1_;
                        }
                        

                        Mais j’ai une erreur sur setOwner il me demande cast

                        1 réponse Dernière réponse Répondre Citer 0
                        • Superloup10S Hors-ligne
                          Superloup10 Modérateurs
                          dernière édition par

                          Déjà tu n’as pas l’instance du joueur, du coup, tu auras un NPE.
                          Ensuite, il te demande de cast en quoi?

                          Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                          Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                            @‘Superloup10’:

                            Déjà tu n’as pas l’instance du joueur, du coup, tu auras un NPE.
                            Ensuite, il te demande de cast en quoi?

                            De cast en EntityName mais sa remais l’erreur apres

                             EntityPlayer playerName = Minecraft.getMinecraft().thePlayer;
                            ``` comme sa c'est mieux ?
                            1 réponse Dernière réponse Répondre Citer 0
                            • Superloup10S Hors-ligne
                              Superloup10 Modérateurs
                              dernière édition par

                              En 1.7.10, il semble que tu doives faire ça :

                              public IEntityLivingData onSpawnWithEgg(IEntityLivingData p_110161_1_)
                              {
                              p_110161_1_ = super.onSpawnWithEgg(p_110161_1_);
                              
                              if (this.worldObj.rand.nextInt(7) == 0)
                              {
                              for (int i = 0; i < 2; ++i)
                              {
                              
                              EntityPlayer playerName;
                              EntityDragonDindeSauvage entityName = new EntityDragonDindeSauvage(this.worldObj);
                              entityName.setTamed(true); // Le nom de la méthode peut différer d'une version de Minecraft à l'autre
                              entityName.func_152115_b(playerName.getUniqueID().toString());
                              entityName.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 1.0F);
                              this.worldObj.spawnEntityInWorld(entityName); // Même chose que le commentaire précédent
                              
                              }
                              }
                              
                              return p_110161_1_;
                              }
                              

                              Tu as mis ce code dans quelle class?

                              Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                              Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                                Je les mis dans ma class Entity

                                J’ai juste changer sa

                                EntityPlayer playerName;
                                

                                par sa

                                EntityPlayer playerName = Minecraft.getMinecraft().thePlayer;
                                

                                car j’avais une erreur sur

                                entityName.func_152115_b(playerName.getUniqueID().toString());
                                
                                1 réponse Dernière réponse Répondre Citer 0
                                • Superloup10S Hors-ligne
                                  Superloup10 Modérateurs
                                  dernière édition par

                                  Du coup, ça fonctionne?

                                  Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                                  Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                                    @‘Superloup10’:

                                    Du coup, ça fonctionne?

                                    Quand je le mais sur le serveur

                                    ---- Minecraft Crash Report ----
                                    // Hey, that tickles! Hehehe!
                                    
                                    Time: 19/05/16 00:40
                                    Description: Exception in server tick loop
                                    
                                    java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP
                                    	at java.lang.Class.getDeclaredConstructors0(Native Method)
                                    	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
                                    	at java.lang.Class.getConstructor0(Class.java:3075)
                                    	at java.lang.Class.getConstructor(Class.java:1825)
                                    	at net.minecraft.entity.EntityList.func_75615_a(EntityList.java:160)
                                    	at net.minecraft.world.chunk.storage.AnvilChunkLoader.loadEntities(AnvilChunkLoader.java:476)
                                    	at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:43)
                                    	at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:14)
                                    	at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344)
                                    	at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302)
                                    	at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12)
                                    	at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:158)
                                    	at net.minecraft.world.gen.ChunkProviderServer.func_73158_c(ChunkProviderServer.java:131)
                                    	at net.minecraft.server.MinecraftServer.func_71222_d(MinecraftServer.java:470)
                                    	at net.minecraft.server.MinecraftServer.func_71247_a(MinecraftServer.java:418)
                                    	at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:309)
                                    	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:607)
                                    	at java.lang.Thread.run(Thread.java:745)
                                    Caused by: java.lang.ClassNotFoundException: net.minecraft.client.entity.EntityClientPlayerMP
                                    	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188)
                                    	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
                                    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
                                    	... 18 more
                                    Caused by: java.lang.NullPointerException
                                    	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:180)
                                    	... 20 more
                                    
                                    A detailed walkthrough of the error, its code path and all known details is as follows:
                                    ---------------------------------------------------------------------------------------
                                    
                                    -- System Details --
                                    Details:
                                    	Minecraft Version: 1.7.2
                                    	Operating System: Linux (amd64) version 3.5.0-47-generic
                                    	Java Version: 1.8.0_60, Oracle Corporation
                                    	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
                                    	Memory: 86966960 bytes (82 MB) / 259522560 bytes (247 MB) up to 10416029696 bytes (9933 MB)
                                    	JVM Flags: 23 total; -Xmx10000M -Xms256M -XX:MaxPermSize=256m -XX:PermSize=128m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxGCPauseMillis=50 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -XX:UseSSE=3 -XX:+UseLargePages -XX:+UseFastAccessorMethods -XX:+UseStringCache -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts
                                    	AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
                                    	IntCache: cache: 13, tcache: 0, allocated: 13, tallocated: 95
                                    	FML: MCP v9.03 FML v7.2.217.1147 Minecraft Forge 10.12.2.1147 5 mods loaded, 5 mods active
                                    	mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available
                                    	FML{7.2.217.1147} [Forge Mod Loader] (cauldron-1.7.2-1.1147.04.98-server.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available
                                    	Forge{10.12.2.1147} [Minecraft Forge] (cauldron-1.7.2-1.1147.04.98-server.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available
                                    	facrpg{1.0} [facrpg] (facrpg-1.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available
                                    	ModCustomMenu{1.0} [ModCustomMenu] (facrpg-1.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available
                                    	Profiler Position: N/A (disabled)
                                    	Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
                                    	Player Count: 0 / 100; []
                                    	Is Modded: Definitely; Server brand changed to 'cauldron,craftbukkit,mcpc,fml,forge'
                                    	Type: Dedicated Server (map_server.txt)
                                    
                                    1 réponse Dernière réponse Répondre Citer 0
                                    • Superloup10S Hors-ligne
                                      Superloup10 Modérateurs
                                      dernière édition par

                                      Pour le coup, je sais pourquoi ça crash, en revanche, je ne suis pas sur du fix, tu peux essayer de get le player depuis la list des joueurs, il te suffit de faire ```java
                                      world.playerEntities.get(id); // id = position du joueur dans la liste

                                      Sinon, tu as ```java
                                      world.getPlayerEntityByName("nom du joueur");
                                      

                                      Si le problème n’est toujours pas résolu, il faudra voir avec robin.

                                      Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                                      Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                                        world.playerEntities.get(id);

                                        Je c’est pas quoi faire du id j’ai jamais fait sa

                                        1 réponse Dernière réponse Répondre Citer 0
                                        • Superloup10S Hors-ligne
                                          Superloup10 Modérateurs
                                          dernière édition par

                                          Sert toi de la seconde méthode, la liste est utilisé dans cette méthode.

                                          Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                                          Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                                            Toujours le crash voilà ma class complete

                                            package fr.darkvince.facrpg.monture;
                                            
                                            import java.util.UUID;
                                            
                                            import net.minecraft.client.Minecraft;
                                            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.EntityAIControlledByPlayer;
                                            import net.minecraft.entity.passive.EntityTameable;
                                            import net.minecraft.entity.player.EntityPlayer;
                                            import net.minecraft.scoreboard.Team;
                                            import net.minecraft.util.MathHelper;
                                            import net.minecraft.world.World;
                                            
                                            public class EntityDragonDindeSauvage extends EntityTameable
                                            {
                                            
                                                private float prevRearingAmount;
                                               public int mobSizeGen;
                                            
                                            public EntityDragonDindeSauvage(World world)
                                            {
                                            super(world);
                                            mobSizeGen = 0 ;//(int) Math.round(Math.random()*5);
                                            //this.setCustomNameTag("test");
                                            this.setSize(0.9F, 1.5F);
                                            
                                            this.tasks.addTask(1, new EntityAIControlledByPlayer(this, 5.0F));
                                            
                                            }
                                            
                                            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*50000.0F; //0.5F;
                                                   p_70612_2_ = ((EntityLivingBase)this.riddenByEntity).moveForward*50000.0F;
                                            
                                                   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 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 * 5.0F;
                                                    p_70612_2_ = ((EntityLivingBase)this.riddenByEntity).moveForward;
                                            
                                                        this.isAirBorne = true;
                                            
                                                    }
                                            
                                                    this.stepHeight = 1.0F;
                                            
                                                    if (!this.worldObj.isRemote)
                                                    {
                                                        this.setAIMoveSpeed((float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue());
                                                        super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
                                                    }
                                            
                                                    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;
                                                }
                                            
                                            public IEntityLivingData onSpawnWithEgg(IEntityLivingData p_110161_1_)
                                            {
                                                p_110161_1_ = super.onSpawnWithEgg(p_110161_1_);
                                            
                                                if (this.worldObj.rand.nextInt(7) == 0)
                                                {
                                                    for (int i = 0; i < 2; ++i)
                                                    {
                                            
                                                    EntityPlayer playerName = Minecraft.getMinecraft().thePlayer;
                                                    worldObj.getPlayerEntityByName("darkvince_");
                                                        EntityDragonDindeSauvage entityName = new EntityDragonDindeSauvage(this.worldObj);     
                                                        entityName.setTamed(true);  // Le nom de la méthode peut différer d'une version de Minecraft à l'autre
                                                        entityName.func_152115_b(playerName.getUniqueID().toString());
                                                        entityName.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 1.0F);
                                                        this.worldObj.spawnEntityInWorld(entityName); // Même chose que le commentaire précédent
                                            
                                                    }
                                                }
                                            
                                                return p_110161_1_;
                                            }
                                            
                                            public double getMountedYOffset() 
                                            {
                                            return 1.0D;
                                            }
                                            
                                            }
                                            
                                            1 réponse Dernière réponse Répondre Citer 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 3 / 4
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB