MFF

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

    Modifier boutons

    Planifier Épinglé Verrouillé Déplacé Résolu Anciennes versions
    1.6.4
    24 Messages 6 Publieurs 8.9k 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.
    • PatatoufetP Hors-ligne
      Patatoufet
      dernière édition par

      Petite question, c’est le même principe pour la modification de l’inventaire ?

      J’ai voulu essayer mais malheureusement dans le constructeur de ma class GuiCustomInventory il me demande EntityPlayer par1EntityPlayer.

      
      public GuiCustomInventory(EntityPlayer par1EntityPlayer)
      {
      super(par1EntityPlayer.inventoryContainer);
      this.allowUserInput = true;
      par1EntityPlayer.addStat(AchievementList.openInventory, 1);
      }
      

      du coups dans mon TickHandlerInventory il me le réclame:

      @Override
      public void tickEnd(EnumSet <ticktype>type, Object… tickData){
      if(type.equals(EnumSet.of(TickType.CLIENT))){
      Minecraft mc = Minecraft.getMinecraft();
      GuiScreen currentScreen = mc.currentScreen;
      List players = mc.theWorld.playerEntities;
      GuiCustomInventory customInventory = new GuiCustomInventory(..); //ici
      
      if(currentScreen instanceof GuiInventory && !currentScreen.equals(customInventory))
      mc.displayGuiScreen(customInventory);
      }
      }
      

      J’ai essayer de plusieurs façon différente d’aller le rechercher mais malheureusement à chaque fois il me retourne null…

      Merci d’avance :P</ticktype>

      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

        Il te faut le joueur en paramètre, je partirais plutôt sur un tickhandler de type player.

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

          C’est pas con, j’ai pas spécialement pensé à regarder la documentation (Dans les commentaires du code c’est marqué que pour serveur le type PLAYER…).

          Maintenant il veut bien compiler mais par contre il rentre pas dans le if

          if(type.equals(EnumSet.of(TickType.PLAYER))) { }
          
          @Override
          public void tickEnd(EnumSet <ticktype>type, Object… tickData){
          if(type.equals(EnumSet.of(TickType.PLAYER))){
          Minecraft mc = Minecraft.getMinecraft();
          GuiScreen currentScreen = mc.currentScreen;
          GuiCustomInventory customInventory = new GuiCustomInventory((EntityPlayer) tickData[0]);
          System.out.println("TESTTTTTTTTTTTTT");
          if(currentScreen instanceof GuiInventory && !currentScreen.equals(customInventory))
          mc.displayGuiScreen(customInventory);
          }
          else
          System.out.println("FAILLLLLLLLLLLLLLLLLLLLLLL");
          }
          

          Petite info sur la documentation :

          PLAYER
          public static final TickType PLAYER
          client and server side. Fired whenever the players update loop runs. arg 0 : the player arg 1 : the world the player is in
          ```</ticktype>
          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

            Oui, car mc.currentScreen retourne GuiForgeInGame
            Cette fonction donne le Screen ouvert, le menu de minecraft qui tourne. Elle ne renvoie pas les gui de bloc, entity, etc …
            Il faudrait plutot utiliser GuiOpenEvent pour ça, mais tu n’as pas player en argument. Donc je pense pas que ce soit faisable.

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

            MINECRAFT FORGE FRANCE © 2024

            Powered by NodeBB