MFF

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

    Créer un bateau

    Planifier Épinglé Verrouillé Déplacé Résolu 1.8.x
    1.8
    59 Messages 7 Publieurs 10.8k 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.
    • SCAREXS Hors-ligne
      SCAREX
      dernière édition par

      C’est quoi çà :

      public static void init(){
      motorized_boat = new Engine().setUnlocalizedName("motorized_boat").setCreativeTab(UsefulthingsMod.UTTab);
      }
      

      Pour ce qui est de ton entité, regarde le message au-dessus : fais du debug pour voir d’où vient le problème.

      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
      • EryahE Hors-ligne
        Eryah
        dernière édition par

        ah 2sec, j’ai vu une erreur assez grave faut que je la corrige avant que robin la voit et m’engeule 😞


        Etrange… Je rajoute la méthode onEntityUpdate, et la, tous fonctionne.
        Je peut rentrer dans le bateau et tout/
        Manque plus qu’a lui mettre sa texture ( actuellement, il a la texture du bateau par défaut ) et son model custom ( Son moteur )

        PS : Je ne passe pas le tuto en résolu, car si j’ai encore des problèmes sur par exemple, la vitesse…

        Membre fantôme
        Je développe maintenant un jeu sur UnrealEngine4


        Contact :…

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

          Je m’excuse du double-post, mais pareil pour un autre topic, si je modfie le message précedent, il aurait fallu attendre quelques années avant que quelqu’un me réponde.

          Bref, j’ai voulu apliquer mon model custom, mais il ne s’apllique pas

          ClientProxy

          ​RenderingRegistry.registerEntityRenderingHandler(MotorizedBoat.class, new RenderMotoBoat(Minecraft.getMinecraft().getRenderManager(), new ModelMotoBoat(), 0.3F));
          

          Render

          ​package eryah.usefulthings.client.render;
          
          import net.minecraft.client.Minecraft;
          import net.minecraft.client.model.ModelBoat;
          import net.minecraft.client.model.ModelChicken;
          import net.minecraft.client.renderer.entity.Render;
          import net.minecraft.client.renderer.entity.RenderBoat;
          import net.minecraft.client.renderer.entity.RenderManager;
          import net.minecraft.entity.Entity;
          import net.minecraft.entity.EntityLiving;
          import net.minecraft.entity.item.EntityBoat;
          import net.minecraft.util.ResourceLocation;
          import eryah.usefulthings.Reference;
          import eryah.usefulthings.client.models.ModelMotoBoat;
          import eryah.usefulthings.entity.item.MotorizedBoat;
          import eryah.usefulthings.entity.passive.GoldenEggChicken;
          
          public class RenderMotoBoat extends RenderBoat {
          
          public final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/entity/motoboat.png"); 
          
          public RenderMotoBoat(RenderManager renderManager, ModelMotoBoat model, float shadow)
          {
          super(Minecraft.getMinecraft().getRenderManager());
          }
          
          protected ResourceLocation getEntityTexture(MotorizedBoat living)
          {
          return this.getMobMotoBoatTexture((MotorizedBoat)living);
          }
          
          private ResourceLocation getMobMotoBoatTexture(MotorizedBoat motoBoat)
          {
          return texture;
          }
          
          @Override
          protected ResourceLocation getEntityTexture(Entity entity) {
          return this.getEntityTexture((MotorizedBoat)entity);
          }
          
          }
          
          

          Membre fantôme
          Je développe maintenant un jeu sur UnrealEngine4


          Contact :…

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

            Tu ne remarques pas que ton model donné en paramètre ne sert absolument à rien ? Et que tu n’appelles jamais la méthode render de ton model ?

            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
            • EryahE Hors-ligne
              Eryah
              dernière édition par

              J’ai regardé le tuto de robin, et d’après le tuto, il faut juste changer le model dans le client

              ​RenderingRegistry.registerEntityRenderingHandler(MotorizedBoat.class, new RenderMotoBoat(Minecraft.getMinecraft().getRenderManager(), new** ModelMotoBoat**(), 0.3F));
              

              Membre fantôme
              Je développe maintenant un jeu sur UnrealEngine4


              Contact :…

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

                Oui mais tu ne remarques pas que la méthode draw de ton model n’est jamais appelée ?

                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
                • EryahE Hors-ligne
                  Eryah
                  dernière édition par

                  Je reprend le topic.
                  Quelle méthode draw ?
                  J’ai regardé das la classe du render du bateau, sur internet, un peu partout.
                  Rien.
                  Pourrait-tu me donner un code ? j’ai passé trop de temps dessus déja 😞

                  De plus, le problème de model custom meservira pour mes armes à feu, pour les balles, et les douilles qui tomberont à terre lors du tir

                  Membre fantôme
                  Je développe maintenant un jeu sur UnrealEngine4


                  Contact :…

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

                    PPlz, je trouve pas la methode qui permet d’appliquer le model 😞
                    Render du MotorizedBoat

                    package eryah.usefulthings.client.render;
                    
                    import net.minecraft.client.Minecraft;
                    import net.minecraft.client.model.ModelBase;
                    import net.minecraft.client.renderer.entity.Render;
                    import net.minecraft.client.renderer.entity.RenderBoat;
                    import net.minecraft.client.renderer.entity.RenderManager;
                    import net.minecraft.entity.Entity;
                    import net.minecraft.util.ResourceLocation;
                    import net.minecraftforge.fml.relauncher.Side;
                    import net.minecraftforge.fml.relauncher.SideOnly;
                    import eryah.usefulthings.Reference;
                    import eryah.usefulthings.client.models.ModelMotoBoat;
                    import eryah.usefulthings.entity.item.MotorizedBoat;
                    
                    @SideOnly(Side.CLIENT)
                    public class RenderMotoBoat extends Render {
                    
                    public final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/entity/motoboat.png");
                    protected ModelBase modelMotoBoat = new ModelMotoBoat();
                    
                    public RenderMotoBoat(RenderManager renderManager, ModelMotoBoat model, float shadow)
                    {
                    super(Minecraft.getMinecraft().getRenderManager());
                    }
                    
                    protected ResourceLocation getEntityTexture(MotorizedBoat living)
                    {
                    return this.getMobMotoBoatTexture((MotorizedBoat)living);
                    }
                    
                    private ResourceLocation getMobMotoBoatTexture(MotorizedBoat motoBoat)
                    {
                    return texture;
                    }
                    
                    @Override
                    protected ResourceLocation getEntityTexture(Entity entity) {
                    return this.getEntityTexture((MotorizedBoat)entity);
                    }
                    
                    }
                    
                    

                    Membre fantôme
                    Je développe maintenant un jeu sur UnrealEngine4


                    Contact :…

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

                      J’ai trouvé sa si tu te débrouille en Anglais 😄
                      http://www.minecraftforge.net/forum/index.php?topic=27394.0
                      Kiss

                      Programmeur un peu trop ambicieux au vu des c'est capacité :D

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

                        C’est bon, merci SCAREX, je pense que mon model étais bugué, enfin pa sur, mais je l’ai passé sous ton model correcteur, et c’est bon.
                        Mais l’ancien model bug est toujours prsent, ce qui donne un rendu dégeu.
                        Y’aurai pas un moyen d’enlever le 2e model ?

                        Membre fantôme
                        Je développe maintenant un jeu sur UnrealEngine4


                        Contact :…

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

                          Envoi ton code.

                          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
                          • EryahE Hors-ligne
                            Eryah
                            dernière édition par

                            Déso, pas vu la notif de ta réponse ^^’
                            Code du render j’imagine ?

                            ​package eryah.usefulthings.client.render;
                            
                            import net.minecraft.client.Minecraft;
                            import net.minecraft.client.model.ModelBase;
                            import net.minecraft.client.renderer.GlStateManager;
                            import net.minecraft.client.renderer.entity.RenderBoat;
                            import net.minecraft.client.renderer.entity.RenderManager;
                            import net.minecraft.entity.Entity;
                            import net.minecraft.util.MathHelper;
                            import net.minecraft.util.ResourceLocation;
                            import net.minecraftforge.fml.relauncher.Side;
                            import net.minecraftforge.fml.relauncher.SideOnly;
                            import eryah.usefulthings.client.models.ModelMotoBoat;
                            import eryah.usefulthings.entity.item.MotorizedBoat;
                            
                            @SideOnly(Side.CLIENT)
                            public class RenderMotoBoat extends RenderBoat
                            {
                                private static final ResourceLocation boatTextures = new ResourceLocation("ut:textures/entity/motoboat.png");
                                /** instance of ModelBoat for rendering */
                                protected ModelBase modelBoat = new ModelMotoBoat();
                                private static final String __OBFID = "CL_00000981";
                            
                                public RenderMotoBoat(RenderManager render, ModelMotoBoat model, float shadow)
                                {
                                    super(Minecraft.getMinecraft().getRenderManager());
                                    this.shadowSize = 0.5F;
                                }
                            
                                public void doRender(MotorizedBoat entity, double p_180552_2_, double p_180552_4_, double p_180552_6_, float p_180552_8_, float p_180552_9_)
                                {
                                    GlStateManager.pushMatrix();
                                    GlStateManager.translate((float)p_180552_2_, (float)p_180552_4_ + 1.27F, (float)p_180552_6_);
                                    GlStateManager.rotate(90.0F - p_180552_8_, 0.0F, 1.0F, 0.0F);
                                    float f2 = (float)entity.getTimeSinceHit() - p_180552_9_;
                                    float f3 = entity.getDamageTaken() - p_180552_9_;
                            
                                    if (f3 < 0.0F)
                                    {
                                        f3 = 0.0F;
                                    }
                            
                                    if (f2 > 0.0F)
                                    {
                                        GlStateManager.rotate(MathHelper.sin(f2) * f2 * f3 / 10.0F * (float)entity.getForwardDirection(), 1.0F, 0.0F, 0.0F);
                                    }
                            
                                    float f4 = 0.75F;
                                    GlStateManager.scale(f4, f4, f4);
                                    GlStateManager.scale(1.0F / f4, 1.0F / f4, 1.0F / f4);
                                    this.bindEntityTexture(entity);
                                    GlStateManager.scale(-1.0F, -1.0F, 1.0F);
                                    this.modelBoat.render(entity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
                                    GlStateManager.popMatrix();
                                    super.doRender(entity, p_180552_2_, p_180552_4_, p_180552_6_, p_180552_8_, p_180552_9_);
                                }
                            
                                protected ResourceLocation getEntityTexture(MotorizedBoat p_180553_1_)
                                {
                                    return boatTextures;
                                }
                            
                                /**
                                 * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
                                 */
                                protected ResourceLocation getEntityTexture(Entity entity)
                                {
                                    return this.getEntityTexture((MotorizedBoat)entity);
                                }
                            
                                /**
                                 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
                                 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
                                 * (Render<t extends="" entity="">) and this method has signature public void func_76986_a(T entity, double d, double d1,
                                 * double d2, float f, float f1). But JAD is pre 1.5 so doe
                                 */
                                public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float partialTicks)
                                {
                                    this.doRender((MotorizedBoat)entity, x, y, z, p_76986_8_, partialTicks);
                                }
                            }
                            

                            Je suis aps idiot, je sais qu’il est extends RenderBoat, mais sans l’extends, le render est invisible</t>

                            Membre fantôme
                            Je développe maintenant un jeu sur UnrealEngine4


                            Contact :…

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

                              Retire le super.doRender

                              Modérateur sur MFF. 
                              Mon Github: http://github.com/jglrxavpok
                              Mon compte Steam si vous voulez jouer à CS:GO ou TF2 avec moi: https://steamcommunity.com/id/jglrxavpok/

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

                                En effet la ligne :
                                super.doRender(entity, p_180552_2_, p_180552_4_, p_180552_6_, p_180552_8_, p_180552_9_);
                                appelle la fonction doRender qui se trouve dans la classe RenderBoat, donc le rendu du bateau normal se fait en même temps que le tient.

                                Et retires la ligne :
                                private static final String __OBFID = “CL_00000981”;
                                Elle n’a rien à faire là.

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

                                  C’est bon 🙂
                                  Pour le bateau motorisé…
                                  J’ai toujours a faire le bateau renforcé, et le bateau en acier 😞
                                  Et pour les deux, il y a une fonctionalité qui bug.
                                  Le fait qu’ils ne se cassent pas au contact des blocs
                                  J’ai cru qu’il fallait juste retirer l’intérieur de la condition (!this.worldObj.isRemote && !this.isDead)

                                  if (this.isCollidedHorizontally && d9 > 0.2D)
                                             {
                                                 if (!this.worldObj.isRemote && !this.isDead)
                                                 {
                                                     this.setDead();
                                  
                                                     for (l = 0; l < 3; ++l)
                                                     {
                                                         this.dropItemWithOffset(Item.getItemFromBlock(Blocks.planks), 1, 0.0F);
                                                     }
                                  
                                                     for (l = 0; l < 2; ++l)
                                                     {
                                                         this.dropItemWithOffset(Items.stick, 1, 0.0F);
                                                     }
                                                 }
                                             }
                                  

                                  Mais non, le bateau se casse toujours.

                                  ReinforcedBoat

                                  package eryah.usefulthings.entity.item;
                                  
                                  import java.util.List;
                                  
                                  import net.minecraft.block.Block;
                                  import net.minecraft.block.material.Material;
                                  import net.minecraft.entity.Entity;
                                  import net.minecraft.entity.EntityLivingBase;
                                  import net.minecraft.entity.item.EntityBoat;
                                  import net.minecraft.entity.player.EntityPlayer;
                                  import net.minecraft.init.Blocks;
                                  import net.minecraft.nbt.NBTTagCompound;
                                  import net.minecraft.util.AxisAlignedBB;
                                  import net.minecraft.util.BlockPos;
                                  import net.minecraft.util.DamageSource;
                                  import net.minecraft.util.EntityDamageSourceIndirect;
                                  import net.minecraft.util.EnumParticleTypes;
                                  import net.minecraft.util.MathHelper;
                                  import net.minecraft.world.World;
                                  import net.minecraftforge.fml.relauncher.Side;
                                  import net.minecraftforge.fml.relauncher.SideOnly;
                                  import eryah.usefulthings.init.IReinforcedBoat;
                                  
                                  public class ReinforcedBoat extends EntityBoat
                                  {
                                     /** true if no player in boat */
                                     private boolean isBoatEmpty;
                                     private double speedMultiplier;
                                     private int boatPosRotationIncrements;
                                     private double boatX;
                                  
                                  private double boatY;
                                     private double boatZ;
                                     private double boatYaw;
                                     private double boatPitch;
                                     @SideOnly(Side.CLIENT)
                                     private double velocityX;
                                     @SideOnly(Side.CLIENT)
                                     private double velocityY;
                                     @SideOnly(Side.CLIENT)
                                     private double velocityZ;
                                  
                                     public ReinforcedBoat(World worldIn)
                                     {
                                         super(worldIn);
                                         this.isBoatEmpty = true;
                                         this.speedMultiplier = 0.05D;
                                         this.preventEntitySpawning = true;
                                         this.setSize(1.5F, 0.6F);
                                     }
                                  
                                  @Override
                                  public void onEntityUpdate() {
                                  
                                  super.onEntityUpdate();
                                  }
                                  
                                     /**
                                      * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
                                      * prevent them from trampling crops
                                      */
                                     protected boolean canTriggerWalking()
                                     {
                                         return false;
                                     }
                                  
                                     protected void entityInit()
                                     {
                                         this.dataWatcher.addObject(17, new Integer(0));
                                         this.dataWatcher.addObject(18, new Integer(1));
                                         this.dataWatcher.addObject(19, new Float(0.0F));
                                     }
                                  
                                     /**
                                      * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be
                                      * pushable on contact, like boats or minecarts.
                                      */
                                     public AxisAlignedBB getCollisionBox(Entity entityIn)
                                     {
                                         return entityIn.getEntityBoundingBox();
                                     }
                                  
                                     /**
                                      * returns the bounding box for this entity
                                      */
                                     public AxisAlignedBB getBoundingBox()
                                     {
                                         return this.getEntityBoundingBox();
                                     }
                                  
                                     /**
                                      * Returns true if this entity should push and be pushed by other entities when colliding.
                                      */
                                     public boolean canBePushed()
                                     {
                                         return true;
                                     }
                                  
                                     public ReinforcedBoat(World worldIn, double p_i1705_2_, double p_i1705_4_, double p_i1705_6_)
                                     {
                                         this(worldIn);
                                         this.setPosition(p_i1705_2_, p_i1705_4_, p_i1705_6_);
                                         this.motionX = 0.0D;
                                         this.motionY = 0.0D;
                                         this.motionZ = 0.0D;
                                         this.prevPosX = p_i1705_2_;
                                         this.prevPosY = p_i1705_4_;
                                         this.prevPosZ = p_i1705_6_;
                                     }
                                  
                                     /**
                                      * Returns the Y offset from the entity's position for any entity riding this one.
                                      */
                                     public double getMountedYOffset()
                                     {
                                         return (double)this.height * 0.0D - 0.30000001192092896D;
                                     }
                                  
                                     /**
                                      * Called when the entity is attacked.
                                      */
                                     public boolean attackEntityFrom(DamageSource source, float amount)
                                     {
                                         if (this.isEntityInvulnerable(source))
                                         {
                                             return false;
                                         }
                                         else if (!this.worldObj.isRemote && !this.isDead)
                                         {
                                             if (this.riddenByEntity != null && this.riddenByEntity == source.getEntity() && source instanceof EntityDamageSourceIndirect)
                                             {
                                                 return false;
                                             }
                                             else
                                             {
                                                 this.setForwardDirection(-this.getForwardDirection());
                                                 this.setTimeSinceHit(10);
                                                 this.setDamageTaken(this.getDamageTaken() + amount * 10.0F);
                                                 this.setBeenAttacked();
                                                 boolean flag = source.getEntity() instanceof EntityPlayer && ((EntityPlayer)source.getEntity()).capabilities.isCreativeMode;
                                  
                                                 if (flag || this.getDamageTaken() > 40.0F)
                                                 {
                                                     if (this.riddenByEntity != null)
                                                     {
                                                         this.riddenByEntity.mountEntity(this);
                                                     }
                                  
                                                     if (!flag)
                                                     {
                                                         this.dropItemWithOffset(IReinforcedBoat.reinforced_boat, 1, 0.0F);
                                                     }
                                  
                                                     this.setDead();
                                                 }
                                  
                                                 return true;
                                             }
                                         }
                                         else
                                         {
                                             return true;
                                         }
                                     }
                                  
                                     /**
                                      * Setups the entity to do the hurt animation. Only used by packets in multiplayer.
                                      */
                                     @SideOnly(Side.CLIENT)
                                     public void performHurtAnimation()
                                     {
                                         this.setForwardDirection(-this.getForwardDirection());
                                         this.setTimeSinceHit(10);
                                         this.setDamageTaken(this.getDamageTaken() * 11.0F);
                                     }
                                  
                                     /**
                                      * Returns true if other Entities should be prevented from moving through this Entity.
                                      */
                                     public boolean canBeCollidedWith()
                                     {
                                         return !this.isDead;
                                     }
                                  
                                     @SideOnly(Side.CLIENT)
                                     public void func_180426_a(double p_180426_1_, double p_180426_3_, double p_180426_5_, float p_180426_7_, float p_180426_8_, int p_180426_9_, boolean p_180426_10_)
                                     {
                                         if (p_180426_10_ && this.riddenByEntity != null)
                                         {
                                             this.prevPosX = this.posX = p_180426_1_;
                                             this.prevPosY = this.posY = p_180426_3_;
                                             this.prevPosZ = this.posZ = p_180426_5_;
                                             this.rotationYaw = p_180426_7_;
                                             this.rotationPitch = p_180426_8_;
                                             this.boatPosRotationIncrements = 0;
                                             this.setPosition(p_180426_1_, p_180426_3_, p_180426_5_);
                                             this.motionX = this.velocityX = 0.1D;
                                             this.motionY = this.velocityY = 0.0D;
                                             this.motionZ = this.velocityZ = 0.1D;
                                         }
                                         else
                                         {
                                             if (this.isBoatEmpty)
                                             {
                                                 this.boatPosRotationIncrements = p_180426_9_ + 5;
                                             }
                                             else
                                             {
                                                 double d3 = p_180426_1_ - this.posX;
                                                 double d4 = p_180426_3_ - this.posY;
                                                 double d5 = p_180426_5_ - this.posZ;
                                                 double d6 = d3 * d3 + d4 * d4 + d5 * d5;
                                  
                                                 if (d6 <= 1.0D)
                                                 {
                                                     return;
                                                 }
                                  
                                                 this.boatPosRotationIncrements = 3;
                                             }
                                  
                                             this.boatX = p_180426_1_;
                                             this.boatY = p_180426_3_;
                                             this.boatZ = p_180426_5_;
                                             this.boatYaw = (double)p_180426_7_;
                                             this.boatPitch = (double)p_180426_8_;
                                             this.motionX = this.velocityX;
                                             this.motionY = this.velocityY;
                                             this.motionZ = this.velocityZ;
                                         }
                                     }
                                  
                                     /**
                                      * Sets the velocity to the args. Args: x, y, z
                                      */
                                     @SideOnly(Side.CLIENT)
                                     public void setVelocity(double x, double y, double z)
                                     {
                                         this.velocityX = this.motionX = x;
                                         this.velocityY = this.motionY = y;
                                         this.velocityZ = this.motionZ = z;
                                     }
                                  
                                     /**
                                      * Called to update the entity's position/logic.
                                      */
                                     @Override
                                     public void onUpdate() {
                                         super.onUpdate();
                                  
                                         if (this.getTimeSinceHit() > 0)
                                             this.setTimeSinceHit(this.getTimeSinceHit() - 1);
                                  
                                         if (this.getDamageTaken() > 0.0F)
                                             this.setDamageTaken(this.getDamageTaken() - 1.0F);
                                  
                                         this.prevPosX = this.posX;
                                         this.prevPosY = this.posY;
                                         this.prevPosZ = this.posZ;
                                         byte b0 = 5;
                                         double d0 = 0.0D;
                                  
                                         for (int i = 0; i < b0; ++i) {
                                             double d1 = this.getEntityBoundingBox().minY + (this.getEntityBoundingBox().maxY - this.getEntityBoundingBox().minY) * (double)(i + 0) / (double)b0 - 0.125D;
                                             double d3 = this.getEntityBoundingBox().minY + (this.getEntityBoundingBox().maxY - this.getEntityBoundingBox().minY) * (double)(i + 1) / (double)b0 - 0.125D;
                                             AxisAlignedBB axisalignedbb = new AxisAlignedBB(this.getEntityBoundingBox().minX, d1, this.getEntityBoundingBox().minZ, this.getEntityBoundingBox().maxX, d3, this.getEntityBoundingBox().maxZ);
                                  
                                             if (this.worldObj.isAABBInMaterial(axisalignedbb, Material.water))
                                                 d0 += 1.0D / (double)b0;
                                         }
                                  
                                         double d9 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
                                         double d2;
                                         double d4;
                                         int j;
                                  
                                         if (d9 > 0.2975D) {
                                             d2 = Math.cos((double)this.rotationYaw * Math.PI / 180.0D);
                                             d4 = Math.sin((double)this.rotationYaw * Math.PI / 180.0D);
                                  
                                             for (j = 0; (double)j < 1.0D + d9 * 60.0D; ++j) {
                                                 double d5 = (double)(this.rand.nextFloat() * 2.0F - 1.0F);
                                                 double d6 = (double)(this.rand.nextInt(2) * 2 - 1) * 0.7D;
                                                 double d7;
                                                 double d8;
                                  
                                                 if (this.rand.nextBoolean()) {
                                                     d7 = this.posX - d2 * d5 * 0.8D + d4 * d6;
                                                     d8 = this.posZ - d4 * d5 * 0.8D - d2 * d6;
                                                     this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, d7, this.posY - 0.125D, d8, this.motionX, this.motionY, this.motionZ, new int[0]);
                                                 } else {
                                                     d7 = this.posX + d2 + d4 * d5 * 0.7D;
                                                     d8 = this.posZ + d4 - d2 * d5 * 0.7D;
                                                     this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, d7, this.posY - 0.125D, d8, this.motionX, this.motionY, this.motionZ, new int[0]);
                                                 }
                                             }
                                         }
                                  
                                         double d10;
                                         double d11;
                                  
                                         if (this.worldObj.isRemote && this.isBoatEmpty) {
                                             if (this.boatPosRotationIncrements > 0) {
                                                 d2 = this.posX + (this.boatX - this.posX) / (double)this.boatPosRotationIncrements;
                                                 d4 = this.posY + (this.boatY - this.posY) / (double)this.boatPosRotationIncrements;
                                                 d10 = this.posZ + (this.boatZ - this.posZ) / (double)this.boatPosRotationIncrements;
                                                 d11 = MathHelper.wrapAngleTo180_double(this.boatYaw - (double)this.rotationYaw);
                                                 this.rotationYaw = (float)((double)this.rotationYaw + d11 / (double)this.boatPosRotationIncrements);
                                                 this.rotationPitch = (float)((double)this.rotationPitch + (this.boatPitch - (double)this.rotationPitch) / (double)this.boatPosRotationIncrements);
                                                 –this.boatPosRotationIncrements;
                                                 this.setPosition(d2, d4, d10);
                                                 this.setRotation(this.rotationYaw, this.rotationPitch);
                                             } else {
                                                 d2 = this.posX + this.motionX;
                                                 d4 = this.posY + this.motionY;
                                                 d10 = this.posZ + this.motionZ;
                                                 this.setPosition(d2, d4, d10);
                                  
                                                 if (this.onGround) {
                                                     this.motionX *= 0.5D;
                                                     this.motionY *= 0.5D;
                                                     this.motionZ *= 0.5D;
                                                 }
                                  
                                                 this.motionX *= 0.9900000095367432D;
                                                 this.motionY *= 0.949999988079071D;
                                                 this.motionZ *= 0.9900000095367432D;
                                             }
                                         } else {
                                             if (d0 < 1.0D) {
                                                 d2 = d0 * 2.0D - 1.0D;
                                                 this.motionY += 0.03999999910593033D * d2;
                                             } else {
                                                 if (this.motionY < 0.0D)
                                                     this.motionY /= 2.0D;
                                  
                                                 this.motionY += 0.007000000216066837D;
                                             }
                                  
                                             if (this.riddenByEntity instanceof EntityLivingBase) {
                                                 EntityLivingBase entitylivingbase = (EntityLivingBase)this.riddenByEntity;
                                                 float f = this.riddenByEntity.rotationYaw + -entitylivingbase.moveStrafing * 90.0F;
                                                 this.motionX += -Math.sin((double)(f * (float)Math.PI / 180.0F)) * this.speedMultiplier * (double)entitylivingbase.moveForward * 0.05000000074505806D;
                                                 this.motionZ += Math.cos((double)(f * (float)Math.PI / 180.0F)) * this.speedMultiplier * (double)entitylivingbase.moveForward * 0.05000000074505806D;
                                             }
                                  
                                             d2 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
                                  
                                             if (d2 > 0.35D) {
                                                 d4 = 0.35D / d2;
                                                 this.motionX *= d4;
                                                 this.motionZ *= d4;
                                                 d2 = 0.35D;
                                             }
                                  
                                             if (d2 > d9 && this.speedMultiplier < 0.35D) {
                                                 this.speedMultiplier += (0.35D - this.speedMultiplier) / 35.0D;
                                  
                                                 if (this.speedMultiplier > 0.35D)
                                                     this.speedMultiplier = 0.35D;
                                             } else {
                                                 this.speedMultiplier -= (this.speedMultiplier - 0.07D) / 35.0D;
                                  
                                                 if (this.speedMultiplier < 0.07D)
                                                     this.speedMultiplier = 0.07D;
                                             }
                                  
                                             int l;
                                  
                                             for (l = 0; l < 4; ++l) {
                                                 int i1 = MathHelper.floor_double(this.posX + ((double)(l % 2) - 0.5D) * 0.8D);
                                                 j = MathHelper.floor_double(this.posZ + ((double)(l / 2) - 0.5D) * 0.8D);
                                  
                                                 for (int j1 = 0; j1 < 2; ++j1) {
                                                     int k = MathHelper.floor_double(this.posY) + j1;
                                                     BlockPos blockpos = new BlockPos(i1, k, j);
                                                     Block block = this.worldObj.getBlockState(blockpos).getBlock();
                                  
                                                     if (block == Blocks.snow_layer) {
                                                         this.worldObj.setBlockToAir(blockpos);
                                                         this.isCollidedHorizontally = false;
                                                     } else if (block == Blocks.waterlily) {
                                                         this.worldObj.destroyBlock(blockpos, true);
                                                         this.isCollidedHorizontally = false;
                                                     }
                                                 }
                                             }
                                  
                                             if (this.onGround) {
                                                 this.motionX *= 0.5D;
                                                 this.motionY *= 0.5D;
                                                 this.motionZ *= 0.5D;
                                             }
                                  
                                             this.moveEntity(this.motionX, this.motionY, this.motionZ);
                                  
                                             if (!this.isCollidedHorizontally && d9 > 0.2D) {
                                                 this.motionX *= 0.9900000095367432D;
                                                 this.motionY *= 0.949999988079071D;
                                                 this.motionZ *= 0.9900000095367432D;
                                             }
                                  
                                             this.rotationPitch = 0.0F;
                                             d4 = (double)this.rotationYaw;
                                             d10 = this.prevPosX - this.posX;
                                             d11 = this.prevPosZ - this.posZ;
                                  
                                             if (d10 * d10 + d11 * d11 > 0.001D)
                                                 d4 = (double)((float)(Math.atan2(d11, d10) * 180.0D / Math.PI));
                                  
                                             double d12 = MathHelper.wrapAngleTo180_double(d4 - (double)this.rotationYaw);
                                  
                                             if (d12 > 20.0D)
                                                 d12 = 20.0D;
                                  
                                             if (d12 < -20.0D)
                                                 d12 = -20.0D;
                                  
                                             this.rotationYaw = (float)((double)this.rotationYaw + d12);
                                             this.setRotation(this.rotationYaw, this.rotationPitch);
                                  
                                             if (!this.worldObj.isRemote) {
                                                 List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D));
                                  
                                                 if (list != null && !list.isEmpty()) {
                                                     for (int k1 = 0; k1 < list.size(); ++k1) {
                                                         Entity entity = (Entity)list.get(k1);
                                  
                                                         if (entity != this.riddenByEntity && entity.canBePushed() && entity instanceof EntityBoat)
                                                             entity.applyEntityCollision(this);
                                                     }
                                                 }
                                  
                                                 if (this.riddenByEntity != null && this.riddenByEntity.isDead)
                                                     this.riddenByEntity = null;
                                             }
                                         }
                                     }
                                  
                                     public void updateRiderPosition()
                                     {
                                         if (this.riddenByEntity != null)
                                         {
                                             double d0 = Math.cos((double)this.rotationYaw * Math.PI / 180.0D) * 0.4D;
                                             double d1 = Math.sin((double)this.rotationYaw * Math.PI / 180.0D) * 0.4D;
                                             this.riddenByEntity.setPosition(this.posX + d0, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + d1);
                                         }
                                     }
                                  
                                     /**
                                      * (abstract) Protected helper method to write subclass entity data to NBT.
                                      */
                                     protected void writeEntityToNBT(NBTTagCompound tagCompound) {}
                                  
                                     /**
                                      * (abstract) Protected helper method to read subclass entity data from NBT.
                                      */
                                     protected void readEntityFromNBT(NBTTagCompound tagCompund) {}
                                  
                                     /**
                                      * First layer of player interaction
                                      */
                                     public boolean interactFirst(EntityPlayer playerIn)
                                     {
                                         if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn)
                                         {
                                             return true;
                                         }
                                         else
                                         {
                                             if (!this.worldObj.isRemote)
                                             {
                                                 playerIn.mountEntity(this);
                                             }
                                  
                                             return true;
                                         }
                                     }
                                  
                                     protected void func_180433_a(double p_180433_1_, boolean p_180433_3_, Block p_180433_4_, BlockPos p_180433_5_)
                                     {
                                         if (p_180433_3_)
                                         {
                                             if (this.fallDistance > 3.0F)
                                             {
                                                 this.fall(this.fallDistance, 1.0F);
                                  
                                                 if (!this.worldObj.isRemote && !this.isDead)
                                                 {
                                  
                                                 }
                                  
                                                 this.fallDistance = 0.0F;
                                             }
                                         }
                                         else if (this.worldObj.getBlockState((new BlockPos(this)).down()).getBlock().getMaterial() != Material.water && p_180433_1_ < 0.0D)
                                         {
                                             this.fallDistance = (float)((double)this.fallDistance - p_180433_1_);
                                         }
                                     }
                                  
                                     /**
                                      * Sets the damage taken from the last hit.
                                      */
                                     public void setDamageTaken(float p_70266_1_)
                                     {
                                         this.dataWatcher.updateObject(19, Float.valueOf(p_70266_1_));
                                     }
                                  
                                     /**
                                      * Gets the damage taken from the last hit.
                                      */
                                     public float getDamageTaken()
                                     {
                                         return this.dataWatcher.getWatchableObjectFloat(19);
                                     }
                                  
                                     /**
                                      * Sets the time to count down from since the last time entity was hit.
                                      */
                                     public void setTimeSinceHit(int p_70265_1_)
                                     {
                                         this.dataWatcher.updateObject(17, Integer.valueOf(p_70265_1_));
                                     }
                                  
                                     /**
                                      * Gets the time since the last hit.
                                      */
                                     public int getTimeSinceHit()
                                     {
                                         return this.dataWatcher.getWatchableObjectInt(17);
                                     }
                                  
                                     /**
                                      * Sets the forward direction of the entity.
                                      */
                                     public void setForwardDirection(int p_70269_1_)
                                     {
                                         this.dataWatcher.updateObject(18, Integer.valueOf(p_70269_1_));
                                     }
                                  
                                     /**
                                      * Gets the forward direction of the entity.
                                      */
                                     public int getForwardDirection()
                                     {
                                         return this.dataWatcher.getWatchableObjectInt(18);
                                     }
                                  
                                     /**
                                      * true if no player in boat
                                      */
                                     @SideOnly(Side.CLIENT)
                                     public void setIsBoatEmpty(boolean p_70270_1_)
                                     {
                                         this.isBoatEmpty = p_70270_1_;
                                     }
                                  }
                                  

                                  La méthode en question se trouve ligne ~445

                                  Membre fantôme
                                  Je développe maintenant un jeu sur UnrealEngine4


                                  Contact :…

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

                                    Une fois ce plus c’est parce que ton bateau est extends EntityBoat. Avec la ligne super.onUpdate(); il fait ce qui se trouve dans la classe EntityBoat, et comme dans cette classe il y a le code pour se casser …

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

                                      Ah bah ça fonctionne beaucoup mieux 🙂
                                      Faut vraiment que je regarde le code avant.
                                      Mais je ne savais pas vraiment ce que c’était le super. ( J’ai fait que le premier chapitre d’Openclassroom )
                                      Je pense que c’est bientot fini 🙂 reste plus qu’a augmenter les vitesse / ou réduire et faire en sorte que le bateau en acier soit résistant a la lave ( et toi aussi quand t’es dedans )

                                      Membre fantôme
                                      Je développe maintenant un jeu sur UnrealEngine4


                                      Contact :…

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

                                        Je me permet de double-post, car c’est bientot terminée, et le topic sera mis en résolu dans pas trop longtemps

                                        Alors c’est bon, j’ai un peu galéré au début, mais j’ai ensuite regarder dans la classe du blaze pour ce qui lui permet d’être invincible a la lave,e t j’ai ensuite pris la fonction qui permet au bateau de floter, et changer water par lava

                                        Pour ceux qui veulent savoir :

                                        Ajouter ceci dans le constructeur

                                        this.isImmuneToFire = true
                                        

                                        Pour que le bateau flotte sur la lave, copiez cette méthode

                                        if (this.worldObj.isAABBInMaterial(axisalignedbb, Material.water))
                                                   {
                                                       d0 += 1.0D / (double)b0;
                                                   }
                                        

                                        qui permet au bateau de flotter sur l’eau
                                        et remplacer water par lava comme ceci

                                        if (this.worldObj.isAABBInMaterial(axisalignedbb, Material.lava))
                                                   {
                                                       d0 += 1.0D / (double)b0;
                                                   }
                                        

                                        Don voila, et donc, le dernier problème, le joueur prend feu, normal, mais je ne sais pas comment lui donner fireResistance.
                                        J’ai d’ailleurs eu une meilleur idée, au lieu de lui donner Fire resistance, pourquoi pas éteindre les flammes tous simplement ( grâce à this/entity/player.extinguish(); ( Peut-etre que sa ne sert pas à cela, mais c’est ce que je pense ))

                                        Ya aussi un  petit truc gênant, an faisant clic mollete sur mes bateaux, j’obtiens le bateau de base, et non mon bateau

                                        Membre fantôme
                                        Je développe maintenant un jeu sur UnrealEngine4


                                        Contact :…

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

                                          Deux solutions :

                                          • Dans la fonction onUpdate si this.riddenByEntity n’est pas null et est d’instance entity player, tu lui mets Fire resistance.
                                          • Avec l’event LivingHurtEvent, si l’entité monte ton bateau (event.living.ridingEntity instanceof TonBateau), et que la source des dégâts et le feu ou la lave tu cancel l’event.
                                          1 réponse Dernière réponse Répondre Citer 0
                                          • EryahE Hors-ligne
                                            Eryah
                                            dernière édition par

                                            J’ai choisis la première solution
                                            sauf que au niveau de l’instance, je bloque 😕

                                            if(this.riddenByEntity != null && event.living.ridingEntity instanceof EntityPlayer){
                                            
                                                }
                                            

                                            j’ai pas le paramètre event, et je pense pas que ça fonctionera avec

                                            Membre fantôme
                                            Je développe maintenant un jeu sur UnrealEngine4


                                            Contact :…

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

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB