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

    Résolu ObfuscationReflectionHelper problème !

    1.7.x
    1.7.x
    2
    7
    1849
    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.
    • Multi
      Multi dernière édition par robin4002

      Salut 🙂

      J’ai un problème assez bizarre, j’utilise cette fonction pour pouvoir assigner une valeur à une variable private ;

      ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.EntityRenderer.class, FMLClientHandler.instance().getClient().entityRenderer, 6.5D, "cameraZoom");
      

      Mais voilà le problème : Quand je lance minecraft avec eclipse, tout marche. Mais quand je test le mod sans eclipse, le jeu crash et me dit que “cameraZoom” est inexistante. WTF :@

      Mon code d’erreur :

      –-- Minecraft Crash Report ----
      // Daisy, daisy...
      
      Time: 23/06/14 19:34
      Description: Unexpected error
      
      cpw.mods.fml.relauncher.ReflectionHelper$UnableToAccessFieldException: cpw.mods.fml.relauncher.ReflectionHelper$UnableToFindFieldException: java.lang.NoSuchFieldException: cameraZoom
      at cpw.mods.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:121)
      at cpw.mods.fml.common.ObfuscationReflectionHelper.setPrivateValue(ObfuscationReflectionHelper.java:60)
      at com.multi7200.tam.ClientProxy.onEvent(ClientProxy.java:51)
      at cpw.mods.fml.common.eventhandler.ASMEventHandler_4_ClientProxy_onEvent_KeyInputEvent.invoke(.dynamic)
      at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51)
      at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122)
      at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:539)
      at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1822)
      at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:916)
      at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:835)
      at net.minecraft.client.main.Main.main(SourceFile:103)
      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: cpw.mods.fml.relauncher.ReflectionHelper$UnableToFindFieldException: java.lang.NoSuchFieldException: cameraZoom
      at cpw.mods.fml.relauncher.ReflectionHelper.findField(ReflectionHelper.java:94)
      at cpw.mods.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:117)
      ... 16 more
      Caused by: java.lang.NoSuchFieldException: cameraZoom
      at java.lang.Class.getDeclaredField(Unknown Source)
      at cpw.mods.fml.relauncher.ReflectionHelper.findField(ReflectionHelper.java:85)
      ... 17 more
      
      A detailed walkthrough of the error, its code path and all known details is as follows:
      ---------------------------------------------------------------------------------------
      
      -- Head --
      Stacktrace:
      at cpw.mods.fml.relauncher.ReflectionHelper.getPrivateValue(ReflectionHelper.java:121)
      at cpw.mods.fml.common.ObfuscationReflectionHelper.getPrivateValue(ObfuscationReflectionHelper.java:60)
      at com.multi7200.tam.ClientProxy.onEvent(ClientProxy.java:51)
      at cpw.mods.fml.common.eventhandler.ASMEventHandler_4_ClientProxy_onEvent_KeyInputEvent.invoke(.dynamic)
      at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51)
      at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122)
      at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:539)
      
      -- Affected level --
      Details:
      Level name: MpServer
      All players: 1 total; [EntityClientPlayerMP['Multi7200'/353, l='MpServer', x=-46,37, y=84,62, z=254,93]]
      Chunk stats: MultiplayerChunkCache: 85, 85
      Level seed: 0
      Level generator: ID 00 - default, ver 1\. Features enabled: false
      Level generator options:
      Level spawn location: World: (-52,64,248), Chunk: (at 12,4,8 in -4,15; contains blocks -64,0,240 to -49,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
      Level time: 393 game time, 393 day time
      Level dimension: 0
      Level storage version: 0x00000 - Unknown?
      Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
      Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
      

      Ma classe ClientPorxy.java :

      package com.multi7200.tam;
      
      import net.minecraft.client.settings.KeyBinding;
      
      import org.lwjgl.input.Keyboard;
      
      import com.multi7200.tam.entity.EntityDisk;
      import com.multi7200.tam.entity.EntityNitron;
      import com.multi7200.tam.model.ModelDisk;
      import com.multi7200.tam.render.RenderDisk;
      import com.multi7200.tam.render.RenderNitron;
      
      import cpw.mods.fml.client.FMLClientHandler;
      import cpw.mods.fml.client.registry.ClientRegistry;
      import cpw.mods.fml.client.registry.RenderingRegistry;
      import cpw.mods.fml.common.FMLCommonHandler;
      import cpw.mods.fml.common.ObfuscationReflectionHelper;
      import cpw.mods.fml.common.eventhandler.SubscribeEvent;
      import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
      import cpw.mods.fml.relauncher.Side;
      import cpw.mods.fml.relauncher.SideOnly;
      
      public class ClientProxy extends CommonProxy
      {
      private static KeyBinding keyBindZoom;
      private boolean state;
      
      @Override
      public void registerRender()
      {
      RenderingRegistry.registerEntityRenderingHandler(EntityDisk.class, new RenderDisk(new ModelDisk()));
      RenderingRegistry.registerEntityRenderingHandler(EntityNitron.class, new RenderNitron());
      
      FMLCommonHandler.instance().bus().register(this);
      keyBindZoom = new KeyBinding("tamod.keyzoom", Keyboard.KEY_A, "key.categories.gameplay");
      ClientRegistry.registerKeyBinding(keyBindZoom);
      }
      
      @SubscribeEvent
      public void onEvent(KeyInputEvent event)
      {
      if(keyBindZoom.isPressed())
      {
      if(state == false) {
      ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.EntityRenderer.class, FMLClientHandler.instance().getClient().entityRenderer, 6.5D, "cameraZoom");
      
      state = true;
      } else if (state == true) {
      ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.EntityRenderer.class, FMLClientHandler.instance().getClient().entityRenderer, 1.0D, "cameraZoom");
      
      state = false;
      }
      }
      }
      }
      

      Merci de m’éclairer, je ne comprend vraiment rien 😕

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

        Salut,
        une fois compilé, ton mod et minecraft sont obfusqués, les variables n’ont pas le même nom. Utilise ça :

        ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.Entity?Renderer.class, FMLClientHandler.instance().getClient().entityRenderer, 6.5D, "cameraZoom", "field_78503_V");
        

        La liste des correspondances se trouve dans le fichier :
        C:\Users<nom de=“” la=“” session=“”>.gradle\caches\minecraft\net\minecraftforge\forge<version de=“” forge=“”>\unpacked\conf\fields.csv</version></nom>

        1 réponse Dernière réponse Répondre Citer 0
        • Multi
          Multi dernière édition par

          Merci beaucoup !

          Une autre petite question ? Comment modifier les fichiers de minecraft comme GuiMainMenu.java ou ce genre de chose ?
          En 1.7, je ne comprends plus rien, plein de truc enlevés 😢

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

            http://www.minecraftforgefrance.fr/showthread.php?tid=555&pid=6034#pid6034

            1 réponse Dernière réponse Répondre Citer 0
            • Multi
              Multi dernière édition par

              Merci, mais pour les autres fichier en général ? le GuiInGame, etc ? c’est plus possible avec forge 😞 ?

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

                Pour GuiInGame tu as l’event RenderGameOverlayEvent

                1 réponse Dernière réponse Répondre Citer 0
                • Multi
                  Multi dernière édition par

                  Ok merci beaucoup 🙂 Résolu.

                  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