Résolu Crash Client.
-
Ligne 174
EntityPlayerMP playerMp = (EntityPlayerMP)this.player;
WasteLandMod.network.sendTo(packetAlcool, playerMp); //
Exact^^ du coup je l’envoie au server? -
“packetAlcool” correspond à quel paquet ?
-
ça dépend à quoi sert ce packet, soit tu vas devoir l’envoyer au serveur, soit changer la ligne où tu l’enregistres.
-
Euuh packetalcool faut que je renomme il sert maintenant a la soif.
package net.armacraft.Utils; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class PacketWater implements IMessage { private int alcool; public PacketWater() {} public PacketWater(int alcool) { this.alcool = alcool; } @Override public void fromBytes(ByteBuf buf) { this.alcool = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(this.alcool); } public static class ServerHandler implements IMessageHandler <packetwater, imessage="">{ @Override public IMessage onMessage(PacketWater message, MessageContext ctx) { EntityPlayerMP player = ctx.getServerHandler().playerEntity; AltisMineExtendedProp props = AltisMineExtendedProp.get(player); props.water = message.alcool; return message; } } public static class ClientHandler implements IMessageHandler <packetwater, imessage="">{ @Override @SideOnly(Side.CLIENT) public IMessage onMessage(PacketWater message, MessageContext ctx) { AltisMineExtendedProp props = AltisMineExtendedProp.get(Minecraft.getMinecraft().thePlayer); props.setAlcool(message.alcool); return message; } } } ```</packetwater,></packetwater,>
-
network.registerMessage(PacketWater.ClientHandler.class, PacketWater.class, 9, Side.CLIENT);
network.registerMessage(PacketWater.ServerHandler.class, PacketWater.class, 9, Side.SERVER);Il est bien enregistré en client et a un ClientHandler. Étrange, ça ne devrait pas crasher.
Sauf si lorsque tu envoies le paquet au client tu es déjà sur le client.Faudrait ajouter un if(!world.isRemote) pour être sûr.
-
Essaye de ne pas les mettre sur le même discriminator sinon (je sais pas si ça peut poser problème mais on sait jamais).
-
Non, ça ne cause pas de problème.
-
ah bah bravo x) moi aymeric m’a dis de tout séparer du coup j’ai pas enregistrer les packetwater en 9 …
-
De tout séparer ? Juste de changer le discriminator d’un des deux.
Fais le if(!world.isRemote) comme robin l’a conseillé. -
C’est bon j’ai fais mais j’ai toujours un crash…
[18:53:32] [main/INFO] [GradleStart]: Extra: [] [18:53:32] [main/INFO] [GradleStart]: Running with arguments: [–userProperties, {}, --assetsDir, C:/Users/Admin/.gradle/caches/minecraft/assets, --assetIndex, 1.8, --accessToken, {REDACTED}, --version, 1.8, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [18:53:32] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [18:53:32] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [18:53:32] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [18:53:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [18:53:32] [main/INFO] [FML]: Forge Mod Loader version 8.0.37.1334 for Minecraft 1.8 loading [18:53:32] [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 [18:53:32] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [18:53:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [18:53:32] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [18:53:32] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [18:53:32] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [18:53:32] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [18:53:32] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [18:53:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [18:53:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [18:53:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [18:53:32] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [18:53:33] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [18:53:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [18:53:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [18:53:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [18:53:33] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [18:53:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [18:53:33] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [18:53:33] [Client thread/INFO]: Setting user: Player109 [18:53:35] [Client thread/INFO]: LWJGL Version: 2.9.1 [18:53:35] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization [18:53:35] [Client thread/INFO] [FML]: MinecraftForge v11.14.1.1334 Initialized [18:53:35] [Client thread/INFO] [FML]: Replaced 204 ore recipies [18:53:35] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization [18:53:35] [Client thread/INFO] [FML]: Searching C:\Users\Admin\Desktop\WasteLandMod V1.0\eclipse\mods for mods [18:53:35] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load [18:53:36] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, wl] at CLIENT [18:53:36] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, wl] at SERVER [18:53:36] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:WasteLand [18:53:36] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [18:53:36] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations [18:53:36] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [18:53:36] [Client thread/INFO] [FML]: Applying holder lookups [18:53:36] [Client thread/INFO] [FML]: Holder lookups applied [18:53:36] [Sound Library Loader/INFO]: Starting up SoundSystem… [18:53:36] [Thread-7/INFO]: Initializing LWJGL OpenAL [18:53:36] [Thread-7/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [18:53:36] [Thread-7/INFO]: OpenAL initialized. [18:53:37] [Sound Library Loader/INFO]: Sound engine started [18:53:37] [Client thread/INFO]: Created: 512x512 textures-atlas [18:53:37] [Client thread/ERROR] [FML]: Model definition for location wl:Trousseaoutils#inventory not found [18:53:38] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods [18:53:38] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:WasteLand [18:53:38] [Client thread/INFO]: SoundSystem shutting down… [18:53:38] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com [18:53:38] [Sound Library Loader/INFO]: Starting up SoundSystem… [18:53:38] [Thread-9/INFO]: Initializing LWJGL OpenAL [18:53:38] [Thread-9/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [18:53:38] [Thread-9/INFO]: OpenAL initialized. [18:53:39] [Sound Library Loader/INFO]: Sound engine started [18:53:39] [Client thread/INFO]: Created: 512x512 textures-atlas [18:53:39] [Client thread/ERROR] [FML]: Model definition for location wl:Trousseaoutils#inventory not found [18:54:22] [Server thread/INFO]: Starting integrated minecraft server version 1.8 [18:54:22] [Server thread/INFO]: Generating keypair [18:54:22] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance [18:54:22] [Server thread/INFO] [FML]: Applying holder lookups [18:54:22] [Server thread/INFO] [FML]: Holder lookups applied [18:54:22] [Server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@15422b6) [18:54:22] [Server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@15422b6) [18:54:22] [Server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@15422b6) [18:54:22] [Server thread/INFO]: Preparing start region for level 0 [18:54:23] [Server thread/INFO]: Changing view distance to 8, from 10 [18:54:23] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 1 [18:54:23] [Netty Server IO #1/INFO] [FML]: Client protocol version 1 [18:54:23] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 4 mods : FML@8.0.37.1334,wl@1.0,Forge@11.14.1.1334,mcp@9.05 [18:54:23] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established [18:54:23] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [18:54:23] [Server thread/INFO]: Player109[local:E:4b4aeec0] logged in with entity id 183 at (-55.46586524641768, 67.0, 225.75097882165025) [18:54:23] [Server thread/INFO]: Player109 joined the game [18:54:24] [Client thread/INFO]: [CHAT] §aConnexion au serveur WasteLand 1.0 Effectuée. [18:54:24] [Client thread/INFO]: [CHAT] §aBonjour Player109§a Pret pour la bataille? [18:54:24] [Client thread/INFO]: [CHAT] §aSi §2Oui §aappuie sur ta touche: §cENTRÉE §a! [18:54:24] [Server thread/INFO]: Saving and pausing game… [18:54:24] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld [18:54:24] [Server thread/INFO]: Saving chunks for level 'New World'/Nether [18:54:24] [Server thread/INFO]: Saving chunks for level 'New World'/The End [18:56:37] [Netty Local Client IO #0/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.ClassCastException: net.minecraft.client.network.NetHandlerPlayClient cannot be cast to net.minecraft.network.NetHandlerPlayServer at net.minecraftforge.fml.common.network.simpleimpl.MessageContext.getServerHandler(MessageContext.java:36) ~[MessageContext.class:?] at net.armacraft.Utils.PacketWater$ClientHandler.onMessage(PacketWater.java:58) ~[PacketWater$ClientHandler.class:?] at net.armacraft.Utils.PacketWater$ClientHandler.onMessage(PacketWater.java:1) ~[PacketWater$ClientHandler.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) ~[SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:106) [SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:4.0.15.Final] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:4.0.15.Final] at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:88) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:144) [NetworkManager.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:469) [NetworkManager.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:363) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:230) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:49) [NetworkDispatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final] at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:312) [LocalChannel.class:4.0.15.Final] at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:44) [LocalChannel.class:4.0.15.Final] at io.netty.channel.local.LocalChannel$6.run(LocalChannel.java:298) [LocalChannel$6.class:4.0.15.Final] at io.netty.channel.local.LocalEventLoop.run(LocalEventLoop.java:33) [LocalEventLoop.class:4.0.15.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [SingleThreadEventExecutor$2.class:4.0.15.Final] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45] [18:56:37] [Netty Local Client IO #0/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.ClassCastException: net.minecraft.client.network.NetHandlerPlayClient cannot be cast to net.minecraft.network.NetHandlerPlayServer at net.minecraftforge.fml.common.network.simpleimpl.MessageContext.getServerHandler(MessageContext.java:36) ~[MessageContext.class:?] at net.armacraft.Utils.PacketWater$ClientHandler.onMessage(PacketWater.java:58) ~[PacketWater$ClientHandler.class:?] at net.armacraft.Utils.PacketWater$ClientHandler.onMessage(PacketWater.java:1) ~[PacketWater$ClientHandler.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) ~[SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:106) [SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:4.0.15.Final] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:4.0.15.Final] at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:88) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:144) [NetworkManager.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:469) [NetworkManager.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:363) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:230) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:49) [NetworkDispatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final] at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:312) [LocalChannel.class:4.0.15.Final] at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:44) [LocalChannel.class:4.0.15.Final] at io.netty.channel.local.LocalChannel$6.run(LocalChannel.java:298) [LocalChannel$6.class:4.0.15.Final] at io.netty.channel.local.LocalEventLoop.run(LocalEventLoop.java:33) [LocalEventLoop.class:4.0.15.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [SingleThreadEventExecutor$2.class:4.0.15.Final] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45] [18:56:37] [Netty Local Client IO #0/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.ClassCastException: net.minecraft.client.network.NetHandlerPlayClient cannot be cast to net.minecraft.network.NetHandlerPlayServer at net.minecraftforge.fml.common.network.simpleimpl.MessageContext.getServerHandler(MessageContext.java:36) ~[MessageContext.class:?] at net.armacraft.Utils.PacketWater$ClientHandler.onMessage(PacketWater.java:58) ~[PacketWater$ClientHandler.class:?] at net.armacraft.Utils.PacketWater$ClientHandler.onMessage(PacketWater.java:1) ~[PacketWater$ClientHandler.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) ~[SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:106) [SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:4.0.15.Final] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:4.0.15.Final] at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:88) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:144) [NetworkManager.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:469) [NetworkManager.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:363) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:230) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:49) [NetworkDispatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final] at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:312) [LocalChannel.class:4.0.15.Final] at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:44) [LocalChannel.class:4.0.15.Final] at io.netty.channel.local.LocalChannel$6.run(LocalChannel.java:298) [LocalChannel$6.class:4.0.15.Final] at io.netty.channel.local.LocalEventLoop.run(LocalEventLoop.java:33) [LocalEventLoop.class:4.0.15.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [SingleThreadEventExecutor$2.class:4.0.15.Final] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45] [18:56:37] [Netty Local Client IO #0/ERROR] [FML]: There was a critical exception handling a packet on channel wl: java.lang.ClassCastException: net.minecraft.client.network.NetHandlerPlayClient cannot be cast to net.minecraft.network.NetHandlerPlayServer at net.minecraftforge.fml.common.network.simpleimpl.MessageContext.getServerHandler(MessageContext.java:36) ~[MessageContext.class:?] at net.armacraft.Utils.PacketWater$ClientHandler.onMessage(PacketWater.java:58) ~[PacketWater$ClientHandler.class:?] at net.armacraft.Utils.PacketWater$ClientHandler.onMessage(PacketWater.java:1) ~[PacketWater$ClientHandler.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) ~[SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) ~[DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) ~[DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:106) ~[SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) ~[DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) ~[DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[MessageToMessageDecoder.class:4.0.15.Final] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) ~[DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) ~[DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:4.0.15.Final] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:4.0.15.Final] at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:88) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:144) [NetworkManager.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:469) [NetworkManager.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:363) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:230) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:49) [NetworkDispatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final] at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:312) [LocalChannel.class:4.0.15.Final] at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:44) [LocalChannel.class:4.0.15.Final] at io.netty.channel.local.LocalChannel$6.run(LocalChannel.java:298) [LocalChannel$6.class:4.0.15.Final] at io.netty.channel.local.LocalEventLoop.run(LocalEventLoop.java:33) [LocalEventLoop.class:4.0.15.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [SingleThreadEventExecutor$2.class:4.0.15.Final] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45] [18:56:37] [Server thread/INFO]: Player109 lost connection: TextComponent{text='Disconnected', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}} [18:56:37] [Server thread/INFO]: Player109 left the game [18:56:37] [Server thread/INFO]: Stopping singleplayer server as player logged out [18:56:37] [Server thread/INFO]: Stopping server [18:56:37] [Server thread/INFO]: Saving players [18:56:37] [Server thread/INFO]: Saving worlds [18:56:37] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld [18:56:37] [Server thread/INFO]: Saving chunks for level 'New World'/Nether [18:56:37] [Server thread/INFO]: Saving chunks for level 'New World'/The End [18:56:37] [Server thread/INFO] [FML]: Unloading dimension 0 [18:56:37] [Server thread/INFO] [FML]: Unloading dimension -1 [18:56:37] [Server thread/INFO] [FML]: Unloading dimension 1 [18:56:37] [Server thread/INFO] [FML]: Applying holder lookups [18:56:37] [Server thread/INFO] [FML]: Holder lookups applied
-
Dans ton ClientHandler, il faut que tu remplaces “getServerHandler” par “getClientHandler”, tu essayes d’avoir celui serveur à partir du client.
-
Pourquoi tu as mit getServerHandler dans le handler client ?
Ton paquet était bon ici :
@‘floriangabet’:Euuh packetalcool faut que je renomme il sert maintenant a la soif.
package net.armacraft.Utils; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class PacketWater implements IMessage { private int alcool; public PacketWater() {} public PacketWater(int alcool) { this.alcool = alcool; } @Override public void fromBytes(ByteBuf buf) { this.alcool = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(this.alcool); } public static class ServerHandler implements IMessageHandler <packetwater, imessage="">{ @Override public IMessage onMessage(PacketWater message, MessageContext ctx) { EntityPlayerMP player = ctx.getServerHandler().playerEntity; AltisMineExtendedProp props = AltisMineExtendedProp.get(player); props.water = message.alcool; return message; } } public static class ClientHandler implements IMessageHandler <packetwater, imessage="">{ @Override @SideOnly(Side.CLIENT) public IMessage onMessage(PacketWater message, MessageContext ctx) { AltisMineExtendedProp props = AltisMineExtendedProp.get(Minecraft.getMinecraft().thePlayer); props.setAlcool(message.alcool); return message; } } } ```</packetwater,></packetwater,>
-
Exact j’avais pas vus merci
Sinon je voudrais faire autre chose en gros je voudrais faire comme dans l’inventaire de base une fois mon gui ouvert je r’appuie sur la touche d’ouverture et sa ferme le gui c’est possible?
-
Oui, via la fonction keyTyped du gui, tu vérifies la touche et tu fais mc.displayGuiScreen(null);
Envoyé de mon RAINBOW LITE 4G en utilisant Tapatalk
-
Ouaip merci nickel et j’ai un soucis j’ai complétement oublier comment on faisait pour ouvrir un gui côté client donc avec l’EntityPlayerMp
j’ai fais ça:private void keyTestTyped2() { EntityPlayer player = mc.thePlayer; EntityPlayerMP playerMp = (EntityPlayerMP)player; WasteLandMod.network.sendTo(new PacketGUIEquipe(), (EntityPlayerMP) playerMp); }
mais ça crash…
-
Pour ouvrir côté client, tu as juste à faire player.openGui(…); uniquement du côté client (si le gui à un container, il ne sera pas ouvert côté serveur, si tu appelles côté serveur, il sera appelé aussi sur le client).
Envoyé de mon RAINBOW LITE 4G en utilisant Tapatalk
-
Suffit juste de faire Minecraft.getMinecraft().displayGuiScreen(le gui);
-
Nickel merci beaucoup