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

    Résolu Erreur pour jouer un son avec un TickHandler

    1.7.x
    1.7.10
    2
    3
    1071
    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.
    • Axaurus
      Axaurus dernière édition par robin4002

      Salut
      J’ai commencer à remettre mon mod d’Halloween à jour. J’ai chercher pendant des jours, voir des semaines, pour trouver un autre TickHandler (car celui de la 1.6 ne marche plus). J’ai trouver beaucoup de fois le même code, mais je ne l’enregistrais pas avec le bon code. Quand j’ai tout résolu, j’étais content; et quand j’ai lancé Minecraft, :

      [19:29:41] [main/INFO] [GradleStart]: No arguments specified, assuming client.
      [19:29:41] [main/INFO] [GradleStart]: Extra: []
      [19:29:41] [main/INFO] [GradleStart]: Running with arguments: [–userProperties, {}, --assetsDir, C:/Users/Antonin/.gradle/caches/minecraft/assets, --assetIndex, 1.7.10, --accessToken, {REDACTED}, --version, 1.7.10, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --username, ForgeDevName]
      [19:29:41] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
      [19:29:41] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker
      [19:29:41] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker
      [19:29:41] [main/INFO] [FML]: Forge Mod Loader version 7.10.18.1180 for Minecraft 1.7.10 loading
      [19:29:41] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_11, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre8
      [19:29:41] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
      [19:29:41] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
      [19:29:41] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker
      [19:29:41] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
      [19:29:41] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
      [19:29:41] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
      [19:29:41] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
      [19:29:43] [main/ERROR] [FML]: The minecraft jar file:/C:/Users/Antonin/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.10-10.13.0.1180/forgeSrc-1.7.10-10.13.0.1180.jar!/net/minecraft/client/ClientBrandRetriever.class appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again!
      [19:29:43] [main/ERROR] [FML]: FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem!
      [19:29:43] [main/ERROR] [FML]: Technical information: ClientBrandRetriever was at jar:file:/C:/Users/Antonin/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.10-10.13.0.1180/forgeSrc-1.7.10-10.13.0.1180.jar!/net/minecraft/client/ClientBrandRetriever.class, there were 0 certificates for it
      [19:29:43] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
      [19:29:43] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
      [19:29:43] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker
      [19:29:43] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
      [19:29:44] [main/INFO]: Setting user: ForgeDevName
      [19:29:45] [Client thread/INFO]: LWJGL Version: 2.9.1
      [19:29:45] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
      [19:29:45] [Client thread/INFO] [FML]: MinecraftForge v10.13.0.1180 Initialized
      [19:29:45] [Client thread/INFO] [FML]: Replaced 182 ore recipies
      [19:29:45] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
      [19:29:45] [Client thread/INFO] [FML]: Searching C:\Users\Antonin\Desktop\un dossier de partage\Jeux\Minecraft\Codage\This_is_Halloween\1.7.10\eclipse\mods for mods
      [19:29:46] [Client thread/ERROR] [FML]: FML has detected a mod that is using a package name based on 'net.minecraft.src' : net.minecraft.src.FMLRenderAccessLibrary. This is generally a severe programming error. There should be no mod code in the minecraft namespace. MOVE YOUR MOD! If you're in eclipse, select your source code and 'refactor' it into a new package. Go on. DO IT NOW!
      [19:29:47] [Client thread/INFO] [FML]: Forge Mod Loader has identified 5 mods to load
      [19:29:47] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Example Mod, FMLFileResourcePack:This is Halloween
      [19:29:47] [Client thread/INFO] [FML]: Processing ObjectHolder annotations
      [19:29:47] [Client thread/INFO] [FML]: Found 341 ObjectHolder annotations
      [19:29:47] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0
      [19:29:47] [Client thread/INFO] [FML]: Applying holder lookups
      [19:29:47] [Client thread/INFO] [FML]: Holder lookups applied
      
      Starting up SoundSystem…
      Initializing LWJGL OpenAL
      (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org)
      OpenAL initialized.
      
      [19:29:48] [Sound Library Loader/INFO]: Sound engine started
      [19:29:50] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas
      [19:29:50] [Client thread/INFO]: Created: 256x256 textures/items-atlas
      DIRT BLOCK >> tile.dirt
      [19:29:50] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 5 mods
      [19:29:50] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Example Mod, FMLFileResourcePack:This is Halloween
      [19:29:50] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas
      [19:29:50] [Client thread/INFO]: Created: 256x256 textures/items-atlas
      
      SoundSystem shutting down…
      Author: Paul Lamb, www.paulscode.com
      
      Starting up SoundSystem...
      Initializing LWJGL OpenAL
      (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org)
      OpenAL initialized.
      
      [19:29:51] [Sound Library Loader/INFO]: Sound engine started
      [19:29:52] [Client thread/FATAL]: Unreported exception thrown!
      java.lang.NullPointerException
      at This_is_Halloween.ClientTickHandler.onTick(ClientTickHandler.java:24) ~[ClientTickHandler.class:?]
      at cpw.mods.fml.common.eventhandler.ASMEventHandler_5_ClientTickHandler_onTick_ClientTickEvent.invoke(.dynamic) ~[?:?]
      at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) ~[ASMEventHandler.class:?]
      at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) ~[EventBus.class:?]
      at cpw.mods.fml.common.FMLCommonHandler.onPostClientTick(FMLCommonHandler.java:329) ~[FMLCommonHandler.class:?]
      at net.minecraft.client.Minecraft.runTick(Minecraft.java:2154) ~[Minecraft.class:?]
      at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1038) ~[Minecraft.class:?]
      at net.minecraft.client.Minecraft.run(Minecraft.java:961) [Minecraft.class:?]
      at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
      at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
      at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
      at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
      at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
      at GradleStart.bounce(GradleStart.java:107) [start/:?]
      at GradleStart.startClient(GradleStart.java:100) [start/:?]
      at GradleStart.main(GradleStart.java:55) [start/:?]
      –-- Minecraft Crash Report ----
      // There are four lights!
      
      Time: 05/09/14 19:29
      Description: Unexpected error
      
      java.lang.NullPointerException: Unexpected error
      at This_is_Halloween.ClientTickHandler.onTick(ClientTickHandler.java:24)
      at cpw.mods.fml.common.eventhandler.ASMEventHandler_5_ClientTickHandler_onTick_ClientTickEvent.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.onPostClientTick(FMLCommonHandler.java:329)
      at net.minecraft.client.Minecraft.runTick(Minecraft.java:2154)
      at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1038)
      at net.minecraft.client.Minecraft.run(Minecraft.java:961)
      at net.minecraft.client.main.Main.main(Main.java:164)
      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)
      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 GradleStart.bounce(GradleStart.java:107)
      at GradleStart.startClient(GradleStart.java:100)
      at GradleStart.main(GradleStart.java:55)
      
      A detailed walkthrough of the error, its code path and all known details is as follows:
      ---------------------------------------------------------------------------------------
      
      -- System Details --
      Details:
      Minecraft Version: 1.7.10
      Operating System: Windows 7 (amd64) version 6.1
      Java Version: 1.8.0_11, Oracle Corporation
      Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
      Memory: 723119136 bytes (689 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
      JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
      AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
      IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
      FML: MCP v9.05 FML v7.10.18.1180 Minecraft Forge 10.13.0.1180 5 mods loaded, 5 mods active
      mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
      FML{7.10.18.1180} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
      Forge{10.13.0.1180} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
      examplemod{1.0} [Example Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
      This_is_Halloween{1.0} [This is Halloween] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
      Launched Version: 1.7.10
      LWJGL: 2.9.1
      OpenGL: Intel(R) HD Graphics 4600 GL version 4.2.0 - Build 10.18.10.3643, Intel
      GL Caps: Using GL 1.3 multitexturing.
      Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
      Anisotropic filtering is supported and maximum anisotropy is 16.
      Shaders are available because OpenGL 2.1 is supported.
      
      Is Modded: Definitely; Client brand changed to 'fml,forge'
      Type: Client (map_client.txt)
      Resource Packs: []
      Current Language: English (US)
      Profiler Position: N/A (disabled)
      Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
      Anisotropic Filtering: Off (1)
      #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Antonin\Desktop\un dossier de partage\Jeux\Minecraft\Codage\This_is_Halloween\1.7.10\eclipse\.\crash-reports\crash-2014-09-05_19.29.52-client.txt
      AL lib: (EE) alc_cleanup: 1 device not closed
      Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
      
      

      C’est mon ClientTickHandler qui bug :

      package This_is_Halloween;
      
      import java.util.Random;
      
      import net.minecraft.block.Block;
      import net.minecraft.client.Minecraft;
      import net.minecraft.client.gui.GuiIngameMenu;
      import net.minecraft.client.gui.GuiScreen;
      import net.minecraft.init.Blocks;
      import net.minecraft.util.MathHelper;
      import net.minecraft.world.biome.BiomeGenBase;
      import cpw.mods.fml.client.FMLClientHandler;
      import cpw.mods.fml.common.eventhandler.SubscribeEvent;
      import cpw.mods.fml.common.gameevent.TickEvent;
      
      public class ClientTickHandler
      {
          @SubscribeEvent
          public void onTick(TickEvent.ClientTickEvent event)
          {
              if(event.phase == TickEvent.Phase.END)
              {
                  Minecraft mc = FMLClientHandler.instance().getClient();
                  Random rand = mc.theWorld.rand;
                  BiomeGenBase biome = mc.theWorld.getBiomeGenForCoords((int)mc.thePlayer.posX, (int)mc.thePlayer.posZ);
      
                  int i = MathHelper.floor_double(mc.thePlayer.posX);
                  int k = MathHelper.floor_double(mc.thePlayer.posZ);
                  int k1 = i + rand.nextInt(10) - rand.nextInt(10);
                  int l1 = k + rand.nextInt(10) - rand.nextInt(10);
                  int i2 = mc.theWorld.getPrecipitationHeight(k1, l1);
                  Block j2 = mc.theWorld.getBlock(k1, i2 - 1, l1);
                  float f1 = rand.nextFloat();
                  float f2 = rand.nextFloat();
                  double d0 = (double)((float)k1 + f1);
                  double d1 = (double)((float)i2 + 0.1F);
                  double d2 = (double)((float)l1 + f2);
                  System.out.println("test");
      
                  if(mc.theWorld.getWorldTime() == 15000)
                  {
                      System.out.println("test");
                      if(d1 > mc.thePlayer.posY + 1.0D && mc.theWorld.getPrecipitationHeight(MathHelper.floor_double(mc.thePlayer.posX), MathHelper.floor_double(mc.thePlayer.posZ)) > MathHelper.floor_double(mc.thePlayer.posY))
                      {
                          mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "halloween:night_sound", 0.1F, 0.5F, false);
                      }
                      else
                      {
                          mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "halloween:night_sound", 0.2F, 1.0F, false);
                      }
                  }
              }
          }
      }
      

      J’ai regarder dans les logs, mais je ne vois pas pourquoi.

      Si vous pouvez m’aider, merci d’avance.

      PS : je précise qu’à la ligne 32 (Block j2 = mc.theWorld.getBlock(k1, i2 - 1, l1);), au début de la ligne, j’ai du remplacer “int” par “Block” (erreur + proposition de changer comme ça)

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

        TickEvent.PlayerTickEvent ou TickEvent.WorldTickEvent
        Sur ClientTickEvent mc.theWorld et mc.thePlayer peuvent être null, d’où le NPE.

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

          Ca marche. Merci Robin 😉

          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