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

    Méthode pour positionner un vertex

    Sans suite
    1.7.10
    2
    3
    1287
    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.
    • Deleted
      Deleted dernière édition par

      Bonjour tout le monde, je suis en train de reconstituer l’animation de la mort de l’enderdragon sur mon mob sauf que les vertex ne sont pas au bon endroit pourtant j’ai utilisé la méthode addVertex et addVertexWithUV et j’ai modifier plein de fois les arguments mais en vain le vertex ne bouge pas…
      Je vous mets à disposition ma class et je vous remercie d’avance

      
      package mrplaigon.invictusserver.invictus.client.renderer.entity.mob;
      
      import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
      import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
      
      import java.util.Random;
      
      import org.lwjgl.opengl.GL11;
      
      import mrplaigon.invictusserver.invictus.client.model.entity.mob.ModelCyclopBoss;
      import mrplaigon.invictusserver.invictus.common.InvictusMod;
      import mrplaigon.invictusserver.invictus.entity.EntityBossCyclop;
      import mrplaigon.invictusserver.invictus.entity.EntityScorpion;
      import mrplaigon.invictusserver.invictus.handler.ItemHandler;
      import net.minecraft.block.Block;
      import net.minecraft.client.model.ModelBase;
      import net.minecraft.client.model.ModelBiped;
      import net.minecraft.client.renderer.RenderBlocks;
      import net.minecraft.client.renderer.RenderHelper;
      import net.minecraft.client.renderer.Tessellator;
      import net.minecraft.client.renderer.entity.RenderBiped;
      import net.minecraft.client.renderer.entity.RenderLiving;
      import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
      import net.minecraft.entity.Entity;
      import net.minecraft.entity.EntityLiving;
      import net.minecraft.entity.EntityLivingBase;
      import net.minecraft.entity.boss.BossStatus;
      import net.minecraft.entity.boss.EntityDragon;
      import net.minecraft.entity.monster.EntityGiantZombie;
      import net.minecraft.init.Items;
      import net.minecraft.item.Item;
      import net.minecraft.item.ItemBlock;
      import net.minecraft.item.ItemStack;
      import net.minecraft.util.ResourceLocation;
      import net.minecraftforge.client.IItemRenderer;
      import net.minecraftforge.client.MinecraftForgeClient;
      
      public class RenderCyclopBoss
        extends RenderLiving
      {
      public final ResourceLocation texturePhase1 = new ResourceLocation(InvictusMod.MODID, "textures/entity/cyclopBossPhase1.png"); 
      public final ResourceLocation texturePhase2 = new ResourceLocation(InvictusMod.MODID, "textures/entity/cyclopBossPhase2.png"); 
      public final ResourceLocation textureExploding = new ResourceLocation(InvictusMod.MODID, "textures/entity/cyclopBossExploding.png"); 
      
      public ModelCyclopBoss modelcyclop;
      
        public RenderCyclopBoss(ModelCyclopBoss modelcyclop, float shadow)
        {
          super(modelcyclop, shadow);
          this.modelcyclop = modelcyclop;
        }
      
        protected void preRenderCallback(EntityBossCyclop cyclop, float f)
        {
       GL11.glScalef(2, 2, 2);
        }
      
        protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2)
        {
            this.preRenderCallback((EntityBossCyclop)par1EntityLivingBase, par2);
        }
      
        @Override
        protected void renderEquippedItems(EntityLivingBase livingbase, float par2)
        {
            this.renderCyclopEquippedItems((EntityBossCyclop)livingbase, par2);
        }
      
        protected void renderCyclopEquippedItems(EntityBossCyclop cyclopBoss, float par2)
        {
            float f = 1.0F;
            GL11.glColor3f(f, f, f);
            super.renderEquippedItems(cyclopBoss, par2);
            ItemStack itemstack = cyclopBoss.getHeldItem();
            float f0;
            Tessellator tessellator = Tessellator.instance;
      
            if(itemstack != null)
            {
                GL11.glPushMatrix();
      
              /** if(this.mainModel.isChild)
                {
                    f2 = 0.5F;
                    GL11.glTranslatef(0.0F, 0.625F, 0.0F);
                    GL11.glRotatef(-20.0F, -1.0F, 0.0F, 0.0F);
                    GL11.glScalef(f2, f2, f2);
                }*/
      
                GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
      
                IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
                boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));
      
                if(itemstack.getItem().equals(ItemHandler.gourdin))
                {
                    GL11.glRotatef(120F, 0.0F, 1.0F, 0.0F);
                    GL11.glRotatef(160F, 1.0F, 0.0F, 0.0F);
                    GL11.glRotatef(-60F, 0.0F, 0.0F, 1.0F);
                    GL11.glTranslatef(0.5F, 0.01F, 0.09F);
                }
                else if(itemstack.getItem().isFull3D())
                {
                    f0 = 0.625F;
      
                    if(itemstack.getItem().shouldRotateAroundWhenRendering())
                    {
                        GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
                        GL11.glTranslatef(0.0F, -0.125F, 0.0F);
                    }
      
                    GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
                    GL11.glScalef(f0, -f0, f0);
                    GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
                    GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
                }
                else
                {
                    f0 = 0.375F;
                    GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
                    GL11.glScalef(f0, f0, f0);
                    GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
                    GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
                    GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
                }
      
                this.renderManager.itemRenderer.renderItem(cyclopBoss, itemstack, 0);
      
                if(itemstack.getItem().requiresMultipleRenderPasses())
                {
                    for(int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++)
                    {
                        this.renderManager.itemRenderer.renderItem(cyclopBoss, itemstack, x);
                    }
                }
      
                if (cyclopBoss.deathTicks > 0)
                {
                    RenderHelper.disableStandardItemLighting();
                    float f1 = ((float)cyclopBoss.deathTicks + par2) / 200.0F;
                    float f2 = 0.0F;
      
                    if (f1 > 0.8F)
                    {
                        f2 = (f1 - 0.8F) / 0.2F;
                    }
      
                    Random random = new Random(432L);
                    GL11.glDisable(GL11.GL_TEXTURE_2D);
                    GL11.glShadeModel(GL11.GL_SMOOTH);
                    GL11.glEnable(GL11.GL_BLEND);
                    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
                    GL11.glDisable(GL11.GL_ALPHA_TEST);
                    GL11.glEnable(GL11.GL_CULL_FACE);
                    GL11.glDepthMask(false);
                    GL11.glPushMatrix();
                    GL11.glTranslatef(0.0F, -1.0F, -2.0F);
      
                    for (int i = 0; (float)i < (f1 + f1 * f1) / 2.0F * 60.0F; ++i)
                    {
                        GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
                        GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
                        GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
                        GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
                        GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
                        GL11.glRotatef(random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F);
                        tessellator.startDrawing(6);
                        float f3 = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
                        float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
                        tessellator.setColorRGBA_I(19311935, (int)(255.0F * (1.0F - f2)));
                        tessellator.addVertex(0.0D, 0.0D, 0.0D);
                        tessellator.setColorRGBA_I(16311935, 0);
                        tessellator.addVertexWithUV(cyclopBoss.motionX + 50.0D, cyclopBoss.posY + 10, cyclopBoss.motionZ +10, 1, 1);
                        tessellator.addVertex(-0.866D * (double)f4, (double)f3, (double)(-0.5F * f4));
                        tessellator.addVertex(0.866D * (double)f4, (double)f3, (double)(-0.5F * f4));
                        tessellator.addVertex(0.0D, (double)f3, (double)(1.0F * f4));
                        tessellator.addVertex(-0.866D * (double)f4, (double)f3, (double)(-0.5F * f4));
                        tessellator.draw();
                    }
                    GL11.glPopMatrix();
                    GL11.glDepthMask(true);
                    GL11.glDisable(GL11.GL_CULL_FACE);
                    GL11.glDisable(GL11.GL_BLEND);
                    GL11.glShadeModel(GL11.GL_FLAT);
                    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                    GL11.glEnable(GL11.GL_TEXTURE_2D);
                    GL11.glEnable(GL11.GL_ALPHA_TEST);
                    RenderHelper.enableStandardItemLighting();
                }
      
                GL11.glPopMatrix();
            }
        }
      
        /**
         * Renders the model in RenderLiving
         */
        protected void renderModel(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4, float par5, float par6, float par7)
        {
            this.renderModel((EntityBossCyclop)par1EntityLivingBase, par2, par3, par4, par5, par6, par7);
        }
      
        /**
         * Renders the model in RenderLiving
         */
        protected void renderModel(EntityBossCyclop bossCyclop, float par2, float par3, float par4, float par5, float par6, float par7)
        {
            if (bossCyclop.deathTicks > 0)
            {
                float f6 = (float)bossCyclop.deathTicks / 200.0F;
                GL11.glDepthFunc(GL11.GL_LEQUAL);
                GL11.glEnable(GL11.GL_ALPHA_TEST);
                GL11.glAlphaFunc(GL11.GL_GREATER, f6);
                this.bindTexture(textureExploding);
                this.mainModel.render(bossCyclop, par2, par3, par4, par5, par6, par7);
                GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
                GL11.glDepthFunc(GL11.GL_EQUAL);
            }
      
            this.bindEntityTexture(bossCyclop);
            this.mainModel.render(bossCyclop, par2, par3, par4, par5, par6, par7);
        }
      
        protected ResourceLocation getEntityTexture(Entity entity)
        {
          return getMobTutorielTexture((EntityBossCyclop)entity);
        }
      
        private ResourceLocation getMobTutorielTexture(EntityBossCyclop cyclop)
        {
       if (cyclop.getHealth() < 10)
       {
       return texturePhase2;
       }
       return this.texturePhase1;
        }
      }
      

      Et puis au passage j’ai un autre question le vertex apparaît bien mais l’effet de l’enderdragon qui disparaît peu à peu avec des bouts de peau…ça ça ne marche pas j’ai cru comprendre que c’était géré dans la méthode renderModel si vous pouviez aussi m’aidez pour ça, j’ai aussi crée une texture “exploding” comme l’enderdragon l’a lui.
      Merci beaucoup vous êtes tops !

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

        Il faut bind la bonne texture déjà pour cela…

        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
        • Deleted
          Deleted dernière édition par

          @‘jglrxavpok’:

          Il faut bind la bonne texture déjà pour cela…

          ? Elle est bind  :

          
            /**
          
             * Renders the model in RenderLiving
             */
            protected void renderModel(EntityBossCyclop bossCyclop, float par2, float par3, float par4, float par5, float par6, float par7)
            {
                if (bossCyclop.deathTicks > 0)
                {
                    float f6 = (float)bossCyclop.deathTicks / 200.0F;
                    GL11.glDepthFunc(GL11.GL_LEQUAL);
                    GL11.glEnable(GL11.GL_ALPHA_TEST);
                    GL11.glAlphaFunc(GL11.GL_GREATER, f6);
                    this.bindTexture(textureExploding);
                    this.mainModel.render(bossCyclop, par2, par3, par4, par5, par6, par7);
                    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
                    GL11.glDepthFunc(GL11.GL_EQUAL);
                }
          
                this.bindEntityTexture(bossCyclop);
                this.mainModel.render(bossCyclop, par2, par3, par4, par5, par6, par7);
            }
          
          

          Dans cette méthode je bind bien la texture exploding, c’est de ça que tu me parles ?

          Et c’est la bonne texture j’ai regardé celle de l’enderdragon elle est blanche…J’ai fais pareil pour mon mob

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

          MINECRAFT FORGE FRANCE © 2018

          Powered by NodeBB