Comment faire pour que les joueurs entende autour de moi le son que j'active



  • 1. Comme l'a dit robin, tu enregistres un seul channel pour plusieurs paquets, pas un channel par paquet
    2. Si ton paquet doit utiliser un booléen, crées un constructeur avec un booléen et utilises le.Sinon enlève les constructeurs inutiles ainsi que le CONTENU des fonctions fromBytes et toBytes
    3. Quel est la condition que tu veux vérifier pour ton son ?



    Quand je utilise que un channel:

         samu = NetworkRegistry.INSTANCE.newSimpleChannel("amm:");
        samu.registerMessage(PacketSamu.Handler.class, PacketSamu.class, 0, Side.SERVER);
        police.registerMessage(PacketPolice.Handler2.class, PacketPolice.class, 1, Side.SERVER);
        pompier.registerMessage(PacketPompier.Handler.class, PacketPompier.class, 2, Side.SERVER);
    

    J'ai un crash.

    J'ai viré le boolean:

    public class PacketSamu implements IMessage{
    public PacketSamu(){
    
    }
    
    @Override
    public void fromBytes(ByteBuf buf) {
    
    }
    
    @Override
    public void toBytes(ByteBuf buf) {
    
    }
    
    public static class Handler implements IMessageHandler <packetsamu, imessage="">{
       @Override
       public IMessage onMessage(PacketSamu message, MessageContext ctx) {
           EntityPlayerMP player = ctx.getServerHandler().playerEntity;
           if(player.inventory.hasItem(AltisMineMod.GyroSamu)){
    
    if(player.openContainer instanceof ContainerPlayer)
                 player.worldObj.playSoundAtEntity(player, "amm:BarrettShoot", 1.0F, 1.0F);
    
           }
    return null;
    
                }
    
               }
    
    }
    
    

    Je voulais juste que lorsque on a l'inventaire ouvert on puisse jouer le son avec un boutton d'ou le:  if(player.openContainer instanceof ContainerPlayer)

    CRASHREPORT:

    
    [20:53:09] [main/INFO] [GradleStart]: Extra: []
    [20:53:09] [main/INFO] [GradleStart]: Running with arguments: [–userProperties, {}, --assetsDir, C:/Users/Admin/.gradle/caches/minecraft/assets, --assetIndex, 1.7.10, --accessToken, {REDACTED}, --version, 1.7.10, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
    [20:53:09] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
    [20:53:09] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker
    [20:53:09] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
    [20:53:09] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker
    [20:53:09] [main/INFO] [FML]: Forge Mod Loader version 7.10.85.1291 for Minecraft 1.7.10 loading
    [20:53:09] [main/INFO] [FML]: Java is Java HotSpot(TM) Client VM, version 1.8.0_45, running on Windows 7:x86:6.1, installed at C:\Program Files (x86)\Java\jdk1.8.0_45\jre
    [20:53:09] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
    [20:53:09] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
    [20:53:09] [main/INFO] [GradleStart]: Injecting location in coremod cpw.mods.fml.relauncher.FMLCorePlugin
    [20:53:09] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
    [20:53:09] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
    [20:53:09] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker
    [20:53:09] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
    [20:53:09] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
    [20:53:09] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
    [20:53:09] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
    [20:53:09] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
    [20:53:10] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
    [20:53:10] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
    [20:53:10] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker
    [20:53:10] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
    [20:53:10] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.TerminalTweaker
    [20:53:10] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.TerminalTweaker
    [20:53:10] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
    [20:53:10] [main/INFO]: Setting user: Player151
    [20:53:10] [Client thread/INFO]: LWJGL Version: 2.9.1
    [20:53:11] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
    [20:53:11] [Client thread/INFO] [FML]: MinecraftForge v10.13.2.1291 Initialized
    [20:53:11] [Client thread/INFO] [FML]: Replaced 183 ore recipies
    [20:53:11] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
    [20:53:11] [Client thread/INFO] [FML]: Searching C:\Users\Admin\Desktop\Modding\AltisMineMod\eclipse\mods for mods
    [20:53:12] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load
    [20:53:12] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, amm] at CLIENT
    [20:53:12] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, amm] at SERVER
    [20:53:12] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:§aAltisMineMod
    [20:53:12] [Client thread/INFO] [FML]: Processing ObjectHolder annotations
    [20:53:12] [Client thread/INFO] [FML]: Found 341 ObjectHolder annotations
    [20:53:12] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0
    [20:53:12] [Client thread/INFO] [FML]: Applying holder lookups
    [20:53:12] [Client thread/INFO] [FML]: Holder lookups applied
    [20:53:12] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from PREINITIALIZATION to INITIALIZATION. Loading cannot continue
    [20:53:12] [Client thread/ERROR] [FML]: 
    mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
    FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized
    Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized
    amm{1.0} [§aAltisMineMod] (bin) Unloaded->Constructed->Errored
    [20:53:12] [Client thread/ERROR] [FML]: The following problems were captured during this phase
    [20:53:12] [Client thread/ERROR] [FML]: Caught exception from amm
    java.lang.NullPointerException
    at com.AltisMine.mod.AltisMineMod.preInit(AltisMineMod.java:416) ~[bin/:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_45]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45]
    at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_45]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45]
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
    at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?]
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_45]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45]
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]
    at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) [Loader.class:?]
    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) [FMLClientHandler.class:?]
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:931) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_45]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
    at GradleStart.main(Unknown Source) [start/:?]
    [20:53:12] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: –-- Minecraft Crash Report ----
    // Would you like a cupcake?
    
    Time: 03/09/15 20:53
    Description: Initializing game
    
    java.lang.NullPointerException: Initializing game
    at com.AltisMine.mod.AltisMineMod.preInit(AltisMineMod.java:416)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
    at com.google.common.eventbus.EventBus.post(EventBus.java:275)
    at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
    at com.google.common.eventbus.EventBus.post(EventBus.java:275)
    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
    at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513)
    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)
    at net.minecraft.client.Minecraft.run(Minecraft.java:931)
    at net.minecraft.client.main.Main.main(Main.java:164)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
    at GradleStart.main(Unknown Source)
    
    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------
    
    -- Head --
    Stacktrace:
    at com.AltisMine.mod.AltisMineMod.preInit(AltisMineMod.java:416)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
    at com.google.common.eventbus.EventBus.post(EventBus.java:275)
    at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
    at com.google.common.eventbus.EventBus.post(EventBus.java:275)
    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
    at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513)
    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)
    
    -- Initialization --
    Details:
    Stacktrace:
    at net.minecraft.client.Minecraft.run(Minecraft.java:931)
    at net.minecraft.client.main.Main.main(Main.java:164)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
    at GradleStart.main(Unknown Source)
    
    -- System Details --
    Details:
    Minecraft Version: 1.7.10
    Operating System: Windows 7 (x86) version 6.1
    Java Version: 1.8.0_45, Oracle Corporation
    Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
    Memory: 684333512 bytes (652 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 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.85.1291 Minecraft Forge 10.13.2.1291 4 mods loaded, 4 mods active
    mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
    FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized
    Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized
    amm{1.0} [§aAltisMineMod] (bin) Unloaded->Constructed->Errored
    Launched Version: 1.7.10
    LWJGL: 2.9.1
    OpenGL: GeForce GTX 960/PCIe/SSE2 GL version 4.5.0 NVIDIA 355.82, NVIDIA Corporation
    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)
    [20:53:12] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Admin\Desktop\Modding\AltisMineMod\eclipse\.\crash-reports\crash-2015-09-03_20.53.12-client.txt
    Java HotSpot(TM) Client VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
    
    

    D'après se que je vois un problème ici:  at com.AltisMine.mod.AltisMineMod.preInit(AltisMineMod.java:416)

    soit la ligne:   police.registerMessage(PacketPolice.Handler2.class, PacketPolice.class, 1, Side.SERVER);</packetsamu,>


  • Administrateurs

    network = NetworkRegistry.INSTANCE.newSimpleChannel("amm:");
       network.registerMessage(PacketSamu.Handler.class, PacketSamu.class, 0, Side.SERVER);
       network.registerMessage(PacketPolice.Handler2.class, PacketPolice.class, 1, Side.SERVER);
       network.registerMessage(PacketPompier.Handler.class, PacketPompier.class, 2, Side.SERVER);
    ->
    Tu renomme ta ligne public static SimpleNetworkWrapper samu; en public static SimpleNetworkWrapper network; et tu me vires les autres.

    Pour le problème original : en fait tu veux que le son ne puisse être joué que dans le gui ou partout et actuellement ça ne fonctionne pas dans le gui ?



  • Je veux que le son puisse être joué partout, et non ça fonctionne pas dans un gui.


  • Administrateurs

    Ahhh Dans ce cas ça veut dire que l'event pour les touches n'est pas appelé lorsqu'un gui est ouvert (sûrement car les gui ont leurs propres actions pour les touches).
    Sauf si tu t'amuses à modifier le jeu en profondeur (très compliqué, il faut connaître le bytecode et utiliser la bibliothèque asm avec un core mod) tu ne pourra pas faire ce que tu veux.
    Quoi que, peut-être qu'avec ClientTickEvent ça pourrait fonctionner.



  • Et sinon que dans un gui c'est moins compliqué ?


  • Correcteurs

    Il vient de t'expliquer comment faire…



  • J'ai une erreur: if(player.openContainer instanceof ClientTickEvent)

    Jp'ense que c'est normal ^^ cela doit pas être cela


  • Administrateurs

    va se pendre



  • pas mal


  • Administrateurs

    En gros tu dois utiliser :

        @SubscribeEvent
        public void onEvent4(ClientTickEvent event)
        {
            if(keyBindSamu.isPressed())
            {
                keyTestTyped3();
            }
        }
    

    à la place de :

       @SubscribeEvent
        public void onEvent4(KeyInputEvent event)
        {
            if(keyBindSamu.isPressed())
            {
                keyTestTyped3();
            }
        }
    


  • Toujours pas … du coup je peux pas "Sauf si tu t'amuses à modifier le jeu en profondeur (très compliqué, il faut connaître le bytecode et utiliser la bibliothèque asm avec un core mod)"



  • Il faut que tu enregistres l'event ClientTickEvent juste côté Client (ça paraît logique), genre dans ton Client Proxy
    Ou essaie en rajoutant l'annotation SideOnly(SIDE.CLIENT)



  • Non mais cela marche le son marche mais il marche pas dans gui ^^


  • Correcteurs

    @'floriangabet':

    J'ai une erreur:  if(player.openContainer instanceof ClientTickEvent)

    Jp'ense que c'est normal ^^ cela doit pas être cela

    Sérieux? je vais faire comme robin…

    Sinon, tu n'as jamais remarqué que dans minecraft on ne peux pas bouger pendant qu'on est dans un gui? C'est ça ton problème et le seul moyen serait de faire comme ils disent, de toutes façons tu fais une sirène si je ne me trompe donc pourquoi c'est si important de pouvoir allumer la sirène dans un gui?

    Pour t'aider.



  • Car je suis sur un serveur rp avec des mods et donc des voitures ( Flan's Mod) et dans une voiture lorsque on appui sur un touche elle marche pas mais on peu ouvrir l'inventaire …
    Fin bref c'est pas grave au pire .



  • Ce n'est pas normal que tu n'arrives pas a boucler ton problème avec 75 réponses pour une question de ce genre.
    Notre but n'est pas de te fournir du code mais des éléments de réponse à ton problème. Dès qu'on te fournit autre chose que du code tout fait ou pré-fait, tu ne comprends pas.
    Désolé d'être un peu sec, mais le seul conseil que je peux te donner pour trouver solution a ton problème, c'est d'apprendre le Java et de commencer par des mods simples.


Log in to reply