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.5k 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.
    • 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
                      • darkvince37D Hors-ligne
                        darkvince37
                        dernière édition par

                        En cherchant un peut j’ai trouver sa

                        https://www.minecraftforgefrance.fr/showthread.php?tid=394

                        en 1.7 sa donne sa

                        Oublie pas l’implements IEntityAdditionalSpawnData

                        @Override
                        public void writeSpawnData(ByteBuf buffer) {
                        
                        buffer.writeInt(this.fuse);
                        
                        }
                        
                        @Override
                        public void readSpawnData(ByteBuf additionalData) {
                        
                        this.fuse = additionalData.readInt();
                        
                        }
                        

                        J’ai tester sa marche

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

                          Merci, la tnt ne disparais plus !
                          Par contre c’est un bloc blanc, comment puis-je appliquer une texture ?

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

                            @‘Sebenf0rce’:

                            Merci, la tnt ne disparais plus !
                            Par contre c’est un bloc blanc, comment puis-je appliquer une texture ?

                            Bizarre j’ai la texture chez moi

                            Edit:

                            J’ai pu constaté que chez moi il crash sur le serveur pareil pour toi ?

                            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

                              Blanc ? Tu peux envoyer un screen ?

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

                                @‘robin4002’:

                                Blanc ? Tu peux envoyer un screen ?

                                C’était vraiment tout blanc sans rien dessus x)
                                Je viens de résoudre le problème. J’ai fait une erreur bête, mauvais lien ici :
                                @SidedProxy(clientSide = “com.sebenforce.ClientProxy”, serverSide = “com.sebenforce.CommonProxy”)

                                Du coup mon register ne s’appliquait pas.

                                Merci à tous ceux qui m’ont aidé.

                                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