MFF

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

    [Pas Faisable] Rendre un item pêchable

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.2
    11 Messages 4 Publieurs 2.7k 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.
    • isadorI Hors-ligne
      isador Moddeurs confirmés Modérateurs
      dernière édition par

      Je regarde ça dès que je vais sur le pc

      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

        Malheureusement forge ne permet pas ça, il n’y a rien de prévu pour 😕
        La seule solution pour l’instant est de créé une nouvelle canne à pêche.

        1 réponse Dernière réponse Répondre Citer 0
        • isadorI Hors-ligne
          isador Moddeurs confirmés Modérateurs
          dernière édition par

          ou utiliser la reflexion sur celle existante non?

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

            @‘robin4002’:

            Malheureusement forge ne permet pas ça, il n’y a rien de prévu pour 😕
            La seule solution pour l’instant est de créé une nouvelle canne à pêche.

            Tu pense que si je code un hook pour ça, forge acceptera le pull request ?

            "If you have a comprehensive explanation for everything then it decreases uncertainty and anxiety and reduces your cognitive load. And if you can use that simplifying algorithm to put yourself on the side of moral virtue then you’re constantly a good person with a minimum of effort."
            ― Jordan B. Peterson

            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

              En effet, il y a trois liste dans EntityFishHook (field_146039_d, field_146041_e et field_146041_f) donc ça doit être possible avec la réflexion.

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

                Je pensais pas que ça demanderait tant de chose…

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

                  @‘Noxon’:

                  Je pensais pas que ça demanderait tant de chose…

                  La pêche, c’est du sérieux bonhomme !

                  "If you have a comprehensive explanation for everything then it decreases uncertainty and anxiety and reduces your cognitive load. And if you can use that simplifying algorithm to put yourself on the side of moral virtue then you’re constantly a good person with a minimum of effort."
                  ― Jordan B. Peterson

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

                    Donc du coup je laisse tomber ? x)

                    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

                      try
                      {
                      List fixedSizeList = ObfuscationReflectionHelper.getPrivateValue(EntityFishHook.class, null, "field_146036_f");
                      List <weightedrandomfishable>fishList = new LinkedList<weightedrandomfishable>(fixedSizeList);
                      System.out.println(fishList.size());
                      fishList.add(new WeightedRandomFishable(new ItemStack(itemTutoriel), 1000));
                      ObfuscationReflectionHelper.setPrivateValue(EntityFishHook.class, null, fishList, "field_146036_f");
                      }
                      catch(Exception ex)
                      {
                      System.err.println("Reflexion error when adding fish");
                      ex.printStackTrace();
                      }
                      
                      Reflexion error when adding fish
                      cpw.mods.fml.relauncher.ReflectionHelper$UnableToAccessFieldException: java.lang.IllegalAccessException: Can not set static final java.util.List field net.minecraft.entity.projectile.EntityFishHook.field_146036_f to java.util.LinkedList
                      at cpw.mods.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:147)
                      at cpw.mods.fml.common.ObfuscationReflectionHelper.setPrivateValue(ObfuscationReflectionHelper.java:91)
                      at fr.minecraftforgefrance.tutoriel.common.ModTutoriel.init(ModTutoriel.java:102)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                      at java.lang.reflect.Method.invoke(Unknown Source)
                      at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)
                      at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                      at java.lang.reflect.Method.invoke(Unknown Source)
                      at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
                      at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)
                      at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
                      at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
                      at com.google.common.eventbus.EventBus.post(EventBus.java:267)
                      at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:209)
                      at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                      at java.lang.reflect.Method.invoke(Unknown Source)
                      at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
                      at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)
                      at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
                      at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
                      at com.google.common.eventbus.EventBus.post(EventBus.java:267)
                      at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
                      at cpw.mods.fml.common.Loader.initializeMods(Loader.java:677)
                      at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:268)
                      at net.minecraft.client.Minecraft.startGame(Minecraft.java:583)
                      at net.minecraft.client.Minecraft.run(Minecraft.java:890)
                      at net.minecraft.client.main.Main.main(Main.java:112)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                      at java.lang.reflect.Method.invoke(Unknown Source)
                      at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
                      at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                      Caused by: java.lang.IllegalAccessException: Can not set static final java.util.List field net.minecraft.entity.projectile.EntityFishHook.field_146036_f to java.util.LinkedList
                      at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(Unknown Source)
                      at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(Unknown Source)
                      at sun.reflect.UnsafeQualifiedStaticObjectFieldAccessorImpl.set(Unknown Source)
                      at java.lang.reflect.Field.set(Unknown Source)
                      at cpw.mods.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:143)
                      … 38 more
                      

                      Impossible avec la réflexion. Faudrait faire un coremods avec un access transformer pour le final et passe le private en static.</weightedrandomfishable></weightedrandomfishable>

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

                        Okay merci quand même. 🙂
                        Je ferais autrement !

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

                        MINECRAFT FORGE FRANCE © 2024

                        Powered by NodeBB