MFF

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

    Création tnt

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    47 Messages 8 Publieurs 8.6k 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.
    • S Hors-ligne
      Sebenf0rce
      dernière édition par

      @‘AymericRed’:

      Tu as un npe à la ligne 80, c’est bien celle là : float f1 = this.explosionSize * (0.7F + this.worldObj.rand.nextFloat() * 0.6F); ?
      Si oui, fais un print de this.worldObj puis this.worldObj.rand.

      J’ai donc ajouté cette ligne à la ligne 80 : System.out.println("Wordobj : " + this.worldObj + " worldObj.rand : " + this.worldObj.rand);
      Cependant aucun texte ne s’affiche dans la console.

      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

        Supprimes également les lignes :
        private static final String __OBFID = “CL_xxxxxxx”;
        Sinon tu vas avoir des problèmes lors de la compilation.

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

          D’accord j’ai bien supprimé cette ligne dans la classe entité et dans la classe explosion.
          Sinon sais tu d’où peut provenir le crash ?

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

            Salut,
            Vraiment pas sur, j’ai regardé en coup de vent mais je crois qu’il y a une erreur dans la classe de l’entity :

            
            this(p_i1730_1_);
            
            

            Devrait etre :

            
            super(p_i1730_1_);
            
            
            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

              Ça ne changera rien.
              Faut trouver quelle variable est null et pourquoi.

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

                @‘robin4002’:

                Supprimes également les lignes :
                  private static final String __OBFID = “CL_xxxxxxx”;
                Sinon tu vas avoir des problèmes lors de la compilation.

                Oups j’en ai plein x)

                Voila ma signature

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

                  Dans ta classe ExplosionCustom, essaie de modifier ton constructeur :

                  
                  public ExplosionCustom(World p_i1948_1_, Entity p_i1948_2_, double p_i1948_3_, double p_i1948_5_, double p_i1948_7_, float p_i1948_9_)
                  {
                      super(p_i1948_1_, p_i1948_2_, p_i1948_3_, p_i1948_5_, p_i1948_7_, p_i1948_9_);
                      this.worldObj = p_i1948_1_;
                      this.exploder = p_i1948_2_;
                      this.explosionX = p_i1948_3_;
                      this.explosionY = p_i1948_5_;
                      this.explosionZ = p_i1948_7_;
                      this.explosionSize = p_i1948_9_;
                  }
                  
                  
                  1 réponse Dernière réponse Répondre Citer 1
                  • S Hors-ligne
                    Sebenf0rce
                    dernière édition par

                    C’est bon ça marche merci beaucoup !!

                    J’ai plus que le soucis de la tnt qui disparait quand elle est désactivé.
                    J’ai fait ceci pour register mon Entité : EntityRegistry.registerModEntity(EntityTNTCustom.class, “EntityTNTCustom”, 30, Main.MODID, 80, 3, true);
                    Est-bon ?

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

                      Le problème ne vient pas de la déclaration mais plutot du block :
                      Par exemple, la méthode

                      
                      public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
                        {
                            if (p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_, p_149695_4_))
                            {
                                this.onBlockDestroyedByPlayer(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, 1);
                                p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_);
                            }
                        }
                      
                      

                      va détecter un changement des blocs à coté de ta TNTCustome. Et si ce block active ta TNT (genre red torch etc…), alors un block d’air est placé à la place de ton block, il faut donc modifier cette ligne

                      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

                        Ah, il faut aussi enregistrer le rendu de l’entity comme celle de n’importe quelle entité.
                        Pour le rendu tu peux reprendre le même code que le rendu de la tnt vanilla (RenderTNTPrimed)

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

                          Ma classe EntityTNTCustom correspond exactement au même code que la classe RenderTNTPrimed pourtant 😮

                          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

                            Non, ta classe EntityTNTCustom correspond à EntityTNTPrimed.
                            Maintenant il faut en plus faire un rendu.

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

                              Ah oui autant pour moi.
                              J’ai donc créé ma classe mais aucun changement. Ai-je oublié quelque chose ?
                              Voici mon code :

                              
                              package com.sebenforce;
                              
                              import net.minecraft.client.renderer.RenderBlocks;
                              import net.minecraft.client.renderer.entity.Render;
                              import net.minecraft.client.renderer.texture.TextureMap;
                              import net.minecraft.entity.Entity;
                              import net.minecraft.init.Blocks;
                              import net.minecraft.util.ResourceLocation;
                              
                              import org.lwjgl.opengl.GL11;
                              
                              import cpw.mods.fml.relauncher.Side;
                              import cpw.mods.fml.relauncher.SideOnly;
                              
                              @SideOnly(Side.CLIENT)
                              public class RenderTNTPrimed extends Render
                              {
                              private RenderBlocks blockRenderer = new RenderBlocks();
                              
                              public RenderTNTPrimed()
                              {
                              this.shadowSize = 0.5F;
                              }
                              
                              /**
                              * 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,="" d1,<br="">* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
                              */
                              public void doRender(EntityTNTCustom p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
                              {
                              GL11.glPushMatrix();
                              GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
                              float f2;
                              
                              if ((float)p_76986_1_.fuse - p_76986_9_ + 1.0F < 10.0F)
                              {
                              f2 = 1.0F - ((float)p_76986_1_.fuse - p_76986_9_ + 1.0F) / 10.0F;
                              
                              if (f2 < 0.0F)
                              {
                              f2 = 0.0F;
                              }
                              
                              if (f2 > 1.0F)
                              {
                              f2 = 1.0F;
                              }
                              
                              f2 *= f2;
                              f2 *= f2;
                              float f3 = 1.0F + f2 * 0.3F;
                              GL11.glScalef(f3, f3, f3);
                              }
                              
                              f2 = (1.0F - ((float)p_76986_1_.fuse - p_76986_9_ + 1.0F) / 100.0F) * 0.8F;
                              this.bindEntityTexture(p_76986_1_);
                              this.blockRenderer.renderBlockAsItem(Main.tntZenodium, 0, p_76986_1_.getBrightness(p_76986_9_));
                              
                              if (p_76986_1_.fuse / 5 % 2 == 0)
                              {
                              GL11.glDisable(GL11.GL_TEXTURE_2D);
                              GL11.glDisable(GL11.GL_LIGHTING);
                              GL11.glEnable(GL11.GL_BLEND);
                              GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA);
                              GL11.glColor4f(1.0F, 1.0F, 1.0F, f2);
                              this.blockRenderer.renderBlockAsItem(Main.tntZenodium, 0, 1.0F);
                              GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                              GL11.glDisable(GL11.GL_BLEND);
                              GL11.glEnable(GL11.GL_LIGHTING);
                              GL11.glEnable(GL11.GL_TEXTURE_2D);
                              }
                              
                              GL11.glPopMatrix();
                              }
                              
                              /**
                              * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
                              */
                              protected ResourceLocation getEntityTexture(EntityTNTCustom p_110775_1_)
                              {
                              return TextureMap.locationBlocksTexture;
                              }
                              
                              /**
                              * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
                              */
                              protected ResourceLocation getEntityTexture(Entity p_110775_1_)
                              {
                              return this.getEntityTexture((EntityTNTCustom)p_110775_1_);
                              }
                              
                              /**
                              * 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,="" d1,<br="">* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
                              */
                              public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
                              {
                              this.doRender((EntityTNTCustom)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
                              }
                              }
                              ```</t></t>
                              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

                                As-tu enregistré cette classe ?
                                RenderingRegistry.registerEntityRenderingHandler(EntityTNTCustom.class, new RenderTNTPrimed());
                                dans la classe client proxy

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

                                  Oui ici :

                                  package com.sebenforce;
                                  
                                  import cpw.mods.fml.client.registry.RenderingRegistry;
                                  
                                  public class ClientProxy extends CommonProxy
                                  {
                                  @Override
                                  public void registerRender()
                                  {
                                  RenderingRegistry.registerEntityRenderingHandler(EntityTNTCustom.class, new RenderTNTPrimed());
                                  }
                                  }
                                  
                                  
                                  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

                                    Et toujours pas de rendu ?

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

                                      Faut que tu fasses attention aux imports, à prendre le bon RenderTNTPrimed.

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

                                        Sa viendrai pas de la texture ? car je c’est que si on mais pas de texture au mob l’entity est invisible c’est pas pareil pour la TNT ?

                                         protected ResourceLocation getEntityTexture(EntityTntObsi p_110775_1_)
                                            {
                                                return TextureMap.locationBlocksTexture;
                                            }
                                        
                                        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

                                          La texture c’est bon, TextureMap.locationBlocksTexture c’est le fichier de texture des blocs.
                                          C’est ce qu’il faut utiliser pour avoir la texture d’un bloc dans une entité.
                                          Le problème ne vient pas de là.

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

                                            @‘robin4002’:

                                            Et toujours pas de rendu ?

                                            Si j’ai crée la classe RenderTntPrimed :

                                            
                                            package com.sebenforce;
                                            
                                            import net.minecraft.client.renderer.RenderBlocks;
                                            import net.minecraft.client.renderer.entity.Render;
                                            import net.minecraft.client.renderer.texture.TextureMap;
                                            import net.minecraft.entity.Entity;
                                            import net.minecraft.init.Blocks;
                                            import net.minecraft.util.ResourceLocation;
                                            
                                            import org.lwjgl.opengl.GL11;
                                            
                                            import cpw.mods.fml.relauncher.Side;
                                            import cpw.mods.fml.relauncher.SideOnly;
                                            
                                            @SideOnly(Side.CLIENT)
                                            public class RenderTNTPrimed extends Render
                                            {
                                            private RenderBlocks blockRenderer = new RenderBlocks();
                                            
                                            public RenderTNTPrimed()
                                            {
                                            this.shadowSize = 0.5F;
                                            }
                                            
                                            /**
                                            * 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,="" d1,<br="">* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
                                            */
                                            public void doRender(EntityTNTCustom p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
                                            {
                                            GL11.glPushMatrix();
                                            GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
                                            float f2;
                                            
                                            if ((float)p_76986_1_.fuse - p_76986_9_ + 1.0F < 10.0F)
                                            {
                                            f2 = 1.0F - ((float)p_76986_1_.fuse - p_76986_9_ + 1.0F) / 10.0F;
                                            
                                            if (f2 < 0.0F)
                                            {
                                            f2 = 0.0F;
                                            }
                                            
                                            if (f2 > 1.0F)
                                            {
                                            f2 = 1.0F;
                                            }
                                            
                                            f2 *= f2;
                                            f2 *= f2;
                                            float f3 = 1.0F + f2 * 0.3F;
                                            GL11.glScalef(f3, f3, f3);
                                            }
                                            
                                            f2 = (1.0F - ((float)p_76986_1_.fuse - p_76986_9_ + 1.0F) / 100.0F) * 0.8F;
                                            this.bindEntityTexture(p_76986_1_);
                                            this.blockRenderer.renderBlockAsItem(Main.tntZenodium, 0, p_76986_1_.getBrightness(p_76986_9_));
                                            
                                            if (p_76986_1_.fuse / 5 % 2 == 0)
                                            {
                                            GL11.glDisable(GL11.GL_TEXTURE_2D);
                                            GL11.glDisable(GL11.GL_LIGHTING);
                                            GL11.glEnable(GL11.GL_BLEND);
                                            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA);
                                            GL11.glColor4f(1.0F, 1.0F, 1.0F, f2);
                                            this.blockRenderer.renderBlockAsItem(Main.tntZenodium, 0, 1.0F);
                                            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                                            GL11.glDisable(GL11.GL_BLEND);
                                            GL11.glEnable(GL11.GL_LIGHTING);
                                            GL11.glEnable(GL11.GL_TEXTURE_2D);
                                            }
                                            
                                            GL11.glPopMatrix();
                                            }
                                            
                                            /**
                                            * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
                                            */
                                            protected ResourceLocation getEntityTexture(EntityTNTCustom p_110775_1_)
                                            {
                                            return TextureMap.locationBlocksTexture;
                                            }
                                            
                                            /**
                                            * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
                                            */
                                            protected ResourceLocation getEntityTexture(Entity p_110775_1_)
                                            {
                                            return this.getEntityTexture((EntityTNTCustom)p_110775_1_);
                                            }
                                            
                                            /**
                                            * 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,="" d1,<br="">* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
                                            */
                                            public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
                                            {
                                            this.doRender((EntityTNTCustom)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
                                            }
                                            } [java]
                                            
                                            @'Plaigon':
                                            
                                            > Faut que tu fasses attention aux imports, à prendre le bon RenderTNTPrimed.
                                            
                                            En faisant ctrl clique gauche sur le nom ça me redirige bien vers ma classe.
                                            
                                            @'darkvince37':
                                            
                                            > Sa viendrai pas de la texture ? car je c'est que si on mais pas de texture au mob l'entity est invisible c'est pas pareil pour la TNT ?
                                            > 
                                            > [java] protected ResourceLocation getEntityTexture(EntityTntObsi p_110775_1_)
                                            >     {
                                            >         return TextureMap.locationBlocksTexture;
                                            >     }
                                            > ```
                                            
                                            ça y est dans mon rendu du coup.</t></t>
                                            1 réponse Dernière réponse Répondre Citer 0
                                            • 1
                                            • 2
                                            • 3
                                            • 3 / 3
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB