• Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Unsolved Créer une barre de mana

    Sans suite
    1.12.2
    3
    5
    81
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Heorty last edited by

      Bonjour,
      J’aimerais créer une barre de mana pour mon mod mais débutant sur le modding, j’ai du mal a le faire.
      J’ai tenté de créer des capabilities mais je n’arrive pas a comprendre comment je pourrais stocker le mana de chaque joueurs.
      j’ai deja une barre de mana qui n’attend que d’avoir des vraies données.
      Merci
      Heorty

      1 Reply Last reply Reply Quote 0
      • D
        Drastic last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • D
          Drastic last edited by

          Petit cadeau :
          Par contre tu devras te dévbrouiller pour adapter le code

          public class Mana extends Gui
          {
              private Minecraft mc;
                     
              public static int mana = 10;
              
              FontRenderer fontRender;
              
              final ResourceLocation full = new ResourceLocation(Reference.MODID + ":textures/gui/mana_full.png");
              final ResourceLocation mana_9 = new ResourceLocation(Reference.MODID + ":textures/gui/mana_9.png");
              final ResourceLocation mana_8 = new ResourceLocation(Reference.MODID + ":textures/gui/mana_8.png");
              final ResourceLocation mana_7 = new ResourceLocation(Reference.MODID + ":textures/gui/mana_7.png");
              final ResourceLocation mana_6 = new ResourceLocation(Reference.MODID + ":textures/gui/mana_6.png");
              final ResourceLocation mana_5 = new ResourceLocation(Reference.MODID + ":textures/gui/mana_5.png");
              final ResourceLocation mana_4 = new ResourceLocation(Reference.MODID + ":textures/gui/mana_4.png");
              final ResourceLocation mana_3 = new ResourceLocation(Reference.MODID + ":textures/gui/mana_3.png");
              final ResourceLocation mana_2 = new ResourceLocation(Reference.MODID + ":textures/gui/mana_2.png");
              final ResourceLocation mana_1 = new ResourceLocation(Reference.MODID + ":textures/gui/mana_1.png");
              final ResourceLocation empty = new ResourceLocation(Reference.MODID + ":textures/items/mana_empty.png");
          
              public Mana() 
              {
                  this.mc = Minecraft.getMinecraft();
                  this.fontRender = this.mc.fontRenderer;
              }
              
              @SideOnly(Side.CLIENT)
              @SubscribeEvent
              public void onRenderPre(RenderGameOverlayEvent.Pre event)
              {
                  if(event.getType() == RenderGameOverlayEvent.ElementType.HELMET)
                  {
                      if(mana == 10)
                      {
                          mc.getTextureManager().bindTexture(this.full);
                      }
                      else if(mana == 9)
                      {
                          mc.getTextureManager().bindTexture(this.mana_9);
                      }
                      else if(mana == 8)
                      {
                          mc.getTextureManager().bindTexture(this.mana_8);
                      }
                      else if(mana == 7)
                      {
                          mc.getTextureManager().bindTexture(this.mana_7); 
                      }
                      else if(mana == 6)
                      {
                          mc.getTextureManager().bindTexture(this.mana_6);
                      }
                      else if(mana == 5)
                      {
                          mc.getTextureManager().bindTexture(this.mana_5); 
                      }
                      else if(mana == 4)
                      {
                          mc.getTextureManager().bindTexture(this.mana_4);
                      }
                      else if(mana == 3)
                      {
                          mc.getTextureManager().bindTexture(this.mana_3);
                      }
                      else if(mana == 2)
                      {
                          mc.getTextureManager().bindTexture(this.mana_2); 
                      }
                      else if(mana == 1)
                      {
                          mc.getTextureManager().bindTexture(this.mana_1);
                      }
                      else if(mana == 0)
                      {
                          mc.getTextureManager().bindTexture(this.empty);
                      }
                      
                      drawModalRectWithCustomSizedTexture(37,5,0,0,36,12,36,12);        
          
                      event.setCanceled(true);
                  }
              }
          
          1 Reply Last reply Reply Quote 0
          • robin4002
            robin4002 Moddeurs confirmés Rédacteurs Administrateurs last edited by

            Faut mieux lire la demande d’aide, il a déjà ce qu’il faut pour l’afficher.
            Ce qui lui manque c’est la capa.

            Sur quel point tu bloques pour la capability ?
            Une fois que tu as un capa fonctionnel, il te suffit de mettre une variable, int mana par exemple pour stocker la mana dans la capa.

            1 Reply Last reply Reply Quote 0
            • H
              Heorty last edited by

              Après pas mal de recherche j’ai vu qu’il existait surement un moyen de stocker le mana dans des NBTs mais je n’arrive pas a trouver la version 1.12.2 des entitydatas
              et pour les capabilities je n’arrive pas trop a comprendre n’y l’inteteret n’y l’utilisation.
              Merci

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Design by Woryk
              Contact / Mentions Légales

              MINECRAFT FORGE FRANCE © 2018

              Powered by NodeBB