Comment faire pour que les joueurs entende autour de moi le son que j'active
-
WWaa c’est trop l’bordel jlaisse tomber , merci quand meme juste vous pouvez m’aider pour le if(player.openContainer instanceof ContainerPlayer) marche pas
-
Tu veux vérifier si un Gui est ouvert?
Si oui:
if(Minecraft.getMinecraft().currentScreen != null) { Action } -
Non je veux jouer un son avec une touche j’ai déjà le code de cela mais je veux que on puisse le jouer en ayant l’inventaire ouvert ^^
-
Ah d’accord je n’ai pas vraiment jamais touché à ça, désolé.
-
UP
UP -
où est le problème ?
-
page 4
-
Renvoi toutes tes classes : paquet, handler, la classe où tu envoies ton paquet
-
Packet:
package com.AltisMine.mod; import java.util.Scanner; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.ContainerPlayer; import net.minecraft.world.World; import io.netty.buffer.ByteBuf; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; public class PacketSamu implements IMessage{ private boolean samu; public PacketSamu(){ } public PacketSamu(boolean samu, int x, int y, int z){ this.samu = samu; } @Override public void fromBytes(ByteBuf buf) { this.samu = buf.readBoolean(); } @Override public void toBytes(ByteBuf buf) { buf.writeBoolean(this.samu); } 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; } } }[font=Ubuntu, sans-serifenvoies du paquet:]
[font=Ubuntu, sans-serif@SubscribeEvent] [font=Ubuntu, sans-serifpublic void onEvent4(KeyInputEvent event)] [font=Ubuntu, sans-serif{] [font=Ubuntu, sans-serifif(keyBindSamu.isPressed())] [font=Ubuntu, sans-serif{] [font=Ubuntu, sans-serifkeyTestTyped3();] [font=Ubuntu, sans-serif}] [font=Ubuntu, sans-serif}] [font=Ubuntu, sans-serifprivate void keyTestTyped3()] [font=Ubuntu, sans-serif{] [font=Ubuntu, sans-serifEntityPlayer player = Minecraft.getMinecraft().thePlayer;] [font=Ubuntu, sans-serif if(player.inventory.hasItem(AltisMineMod.GyroSamu)){] [font=Ubuntu, sans-serif if(player.openContainer.getInventory() != null){] [font=Ubuntu, sans-serif if(player.openContainer instanceof ContainerPlayer){] [font=Ubuntu, sans-serif ] [font=Ubuntu, sans-serif if(true){] [font=Ubuntu, sans-serif ] [font=Ubuntu, sans-serif AltisMineMod.samu.sendToServer(new PacketSamu());] [font=Ubuntu, sans-serif }] [font=Ubuntu, sans-serif }] [font=Ubuntu, sans-serif }] [font=Ubuntu, sans-serif ] [font=Ubuntu, sans-serif ] [font=Ubuntu, sans-serif ] [font=Ubuntu, sans-serif ] [font=Ubuntu, sans-serif ] [font=Ubuntu, sans-serif }] [font=Ubuntu, sans-serif}] [font=Ubuntu, sans-serif} ] ```</packetsamu,> -
Bon, normalement ton code marche, sauf que ton code est toujours en bordel : tu mets un booléen dans ton paquet sans l’utiliser et tu utilises le constructeur sans le booléen, le if (true) dans ton ClientProxy est inutile.
-
Mieux comme ça?
Proxy:
@SubscribeEvent public void onEvent4(KeyInputEvent event) { if(keyBindSamu.isPressed()) { keyTestTyped3(); } } private void keyTestTyped3() { AltisMineMod.samu.sendToServer(new PacketSamu()); } }Paquet:
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; } } }Ps: Marche toujours pas</packetsamu,>
-
Renvoi toutes tes classes, y’a encore des problèmes
-
Alors
Main:
public static SimpleNetworkWrapper samu; public static SimpleNetworkWrapper police; public static SimpleNetworkWrapper pompier; samu = NetworkRegistry.INSTANCE.newSimpleChannel("amm:"); samu.registerMessage(PacketSamu.Handler.class, PacketSamu.class, 0, Side.SERVER); police = NetworkRegistry.INSTANCE.newSimpleChannel("amm"); police.registerMessage(PacketPolice.Handler2.class, PacketPolice.class, 1, Side.SERVER); pompier = NetworkRegistry.INSTANCE.newSimpleChannel("am"); pompier.registerMessage(PacketPompier.Handler.class, PacketPompier.class, 2, Side.SERVER);Proxy:
@SubscribeEvent public void onEvent4(KeyInputEvent event) { if(keyBindSamu.isPressed()) { keyTestTyped3(); } } private void keyTestTyped3() { AltisMineMod.samu.sendToServer(new PacketSamu()); } }Packet:
package com.AltisMine.mod; import java.util.Scanner; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.ContainerPlayer; import net.minecraft.world.World; import io.netty.buffer.ByteBuf; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; public class PacketSamu implements IMessage{ private boolean samu; public PacketSamu(){ } public PacketSamu(boolean samu, int x, int y, int z){ this.samu = samu; } @Override public void fromBytes(ByteBuf buf) { this.samu = buf.readBoolean(); } @Override public void toBytes(ByteBuf buf) { buf.writeBoolean(this.samu); } 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; } } } ```</packetsamu,> -
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 releaseD’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,>
-
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.
-
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é ?
-
Il vient de t’expliquer comment faire…