MFF

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

    Probleme de touche

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.x
    34 Messages 4 Publieurs 7.4k Vues 1 Abonné
    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.
    • Fanor79F Hors-ligne
      Fanor79
      dernière édition par

      OK, je vais y jeté un œil merci :D___humm ça limite (même si ça s’envoie toujours pas paire, une fois qu’on appuie, mais du coup ça ne marche toujours pas dans une interface___ça fonctionne mais pas dans les interfaces 😕

      1 réponse Dernière réponse Répondre Citer 0
      • robin4002R En ligne
        robin4002 Moddeurs confirmés Rédacteurs Administrateurs
        dernière édition par

        Toujours pas ? Pas possible, ClientTickEvent est appelé à chaque tick …

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

          bha …. j’ai l’impressions que le isPressed marche pas quand le gui est ouvert.

          ​public class ClientProxy extends CommonProxy{
          
              public static KeyBinding keyScreen;
              private int lastKeyState = 0;
          
              public ClientProxy()
              {
                  FMLCommonHandler.instance().bus().register(this);
                  keyScreen = new KeyBinding("Screen", Keyboard.KEY_U, "Ushare");
          
                  ClientRegistry.registerKeyBinding(keyScreen);
              }
          
              @SubscribeEvent
              public void onClientTickEvent(ClientTickEvent event)
              {
                  if(event.phase == Phase.END)
                  {
                      sendKeyUpdate();
          
                      //SendFile sfile = new SendFile("sendfile");
                      //sfile.start();
                  }
          
              }
          
              public void sendKeyUpdate()
              {
                  int currentKeyState = (keyScreen.isPressed() ? 1 : 0) << 0;
                  if(currentKeyState != this.lastKeyState)
                  {
                      lastKeyState = currentKeyState;
                      System.out.println("ok");
                  }
              }
          
          }
          
          1 réponse Dernière réponse Répondre Citer 0
          • robin4002R En ligne
            robin4002 Moddeurs confirmés Rédacteurs Administrateurs
            dernière édition par

            Sinon faut faire comme Minecraft :

            ​    public void dispatchKeypresses()
                {
                    int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() : Keyboard.getEventKey();
            
                    if (i != 0 && !Keyboard.isRepeatEvent())
                    {
                        if (!(this.currentScreen instanceof GuiControls) || ((GuiControls)this.currentScreen).time <= getSystemTime() - 20L)
                        {
                            if (Keyboard.getEventKeyState())
                            {
                                if (i == this.gameSettings.keyBindStreamStartStop.getKeyCode())
                                {
                                    if (this.getTwitchStream().func_152934_n())
                                    {
                                        this.getTwitchStream().func_152914_u();
                                    }
                                    else if (this.getTwitchStream().func_152924_m())
                                    {
                                        this.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
                                        {
                                            private static final String __OBFID = "CL_00001852";
                                            public void confirmClicked(boolean result, int id)
                                            {
                                                if (result)
                                                {
                                                    Minecraft.this.getTwitchStream().func_152930_t();
                                                }
            
                                                Minecraft.this.displayGuiScreen((GuiScreen)null);
                                            }
                                        }, I18n.format("stream.confirm_start", new Object[0]), "", 0));
                                    }
                                    else if (this.getTwitchStream().func_152928_D() && this.getTwitchStream().func_152936_l())
                                    {
                                        if (this.theWorld != null)
                                        {
                                            this.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Not ready to start streaming yet!"));
                                        }
                                    }
                                    else
                                    {
                                        GuiStreamUnavailable.func_152321_a(this.currentScreen);
                                    }
                                }
                                else if (i == this.gameSettings.keyBindStreamPauseUnpause.getKeyCode())
                                {
                                    if (this.getTwitchStream().func_152934_n())
                                    {
                                        if (this.getTwitchStream().isPaused())
                                        {
                                            this.getTwitchStream().func_152933_r();
                                        }
                                        else
                                        {
                                            this.getTwitchStream().func_152916_q();
                                        }
                                    }
                                }
                                else if (i == this.gameSettings.keyBindStreamCommercials.getKeyCode())
                                {
                                    if (this.getTwitchStream().func_152934_n())
                                    {
                                        this.getTwitchStream().func_152931_p();
                                    }
                                }
                                else if (i == this.gameSettings.keyBindStreamToggleMic.getKeyCode())
                                {
                                    this.stream.func_152910_a(true);
                                }
                                else if (i == this.gameSettings.keyBindFullscreen.getKeyCode())
                                {
                                    this.toggleFullscreen();
                                }
                                else if (i == this.gameSettings.keyBindScreenshot.getKeyCode()) // screenshot ici
                                {
                                    this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight, this.framebufferMc));
                                }
                            }
                            else if (i == this.gameSettings.keyBindStreamToggleMic.getKeyCode())
                            {
                                this.stream.func_152910_a(false);
                            }
                        }
                    }
                }
            
            1 réponse Dernière réponse Répondre Citer 0
            • Fanor79F Hors-ligne
              Fanor79
              dernière édition par

              c’est ce que j’avais essayer de faire au début

              1 réponse Dernière réponse Répondre Citer 0
              • robin4002R En ligne
                robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                dernière édition par

                Si tu utilises tickEvent + ces 3 conditions :

                       int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() : Keyboard.getEventKey();
                       if (i != 0 && !Keyboard.isRepeatEvent())
                       {
                           if (!(this.currentScreen instanceof GuiControls) || ((GuiControls)this.currentScreen).time <= getSystemTime() - 20L)
                           {
                               if (Keyboard.getEventKeyState())
                
                • celle pour ta touche bien sûr
                  ça donne quoi ?
                1 réponse Dernière réponse Répondre Citer 0
                • Fanor79F Hors-ligne
                  Fanor79
                  dernière édition par

                  ça marche mais ça spam toujours 😕

                  1 réponse Dernière réponse Répondre Citer 0
                  • robin4002R En ligne
                    robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                    dernière édition par

                    Et avec un if(Keyboard.next()) en plus ?

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

                      ça ne marche plus apres je ne sais pas si ou il se trouve dans l’imbrication a de l’importance …

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

                        C’est bon affaire résulu, je bidouiller dans l’algo, j’ai trouver une solution merci pour votre aide !

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

                          Poste la solution au cas où quelqu’un en ait besoin 😉

                          Sent from my GT-I9000 using Tapatalk 2

                          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
                          • Fanor79F Hors-ligne
                            Fanor79
                            dernière édition par

                            ​    @SubscribeEvent
                                public void onClientTickEvent(ClientTickEvent event)
                                {
                                    if(event.phase == Phase.END)
                                    {
                                        int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() : Keyboard.getEventKey();
                            
                                        if(i != 0 && !Keyboard.isRepeatEvent())
                                        {
                                            if(!(mc.currentScreen instanceof GuiControls) || ((GuiControls)mc.currentScreen).time <= Minecraft.getSystemTime() - 20L)
                                            {
                                                if(Keyboard.getEventKeyState())
                                                {
                                                    if(i == keyScreen.getKeyCode())
                                                    {
                                                        if(!press)
                                                        {
                                                           //Action
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    this.press = false;
                                                }
                                            }
                                        }
                                    }
                                }
                            

                            press un boolean init a false au début 😄

                            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