Problème d'handler
-
Bonjour/Bonsoir,
J’ai un problème avec mon handler. Quand je crée un nouveau monde, j’apparais sans crash, j’édite les données de mon ExtendedEntityProperties, le serveur et le client sont synchronisés. Mais quand je quitte le jeu et que je relance la map, ou que je quitte simplement la map et que je la relance, et bien je crash avec un NPE. J’ai beau chercher je ne trouve pas la raison de ce NPE. C’est pourquoi je vous demande vôtre aide.Voici les logs d’erreur:
[21:22:40] [main/INFO] [GradleStart]: username: Wassangota [21:22:40] [main/INFO] [GradleStart]: Extra: [] [21:22:40] [main/INFO] [GradleStart]: Running with arguments: [–userProperties, {}, --assetsDir, C:/Users/Wassil/.gradle/caches/minecraft/assets, --assetIndex, 1.8, --accessToken, {REDACTED}, --version, 1.8, --username, Wassangota, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [21:22:40] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [21:22:40] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [21:22:40] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [21:22:40] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [21:22:40] [main/INFO] [FML]: Forge Mod Loader version 8.99.114.1446 for Minecraft 1.8 loading [21:22:40] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_25, running on Windows 8.1:amd64:6.3, installed at C:\Program Files\Java\jre1.8.0_25 [21:22:40] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [21:22:40] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [21:22:40] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [21:22:40] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [21:22:40] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [21:22:40] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [21:22:40] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [21:22:40] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [21:22:40] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [21:22:40] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [21:22:41] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [21:22:44] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [21:22:44] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [21:22:44] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [21:22:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [21:22:45] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [21:22:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [21:22:45] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [21:22:46] [Client thread/INFO]: Setting user: Wassangota [21:22:53] [Client thread/INFO]: LWJGL Version: 2.9.1 [21:22:54] [Client thread/INFO] [STDOUT]: [net.minecraftforge.fml.client.SplashProgress:start:235]: –-- Minecraft Crash Report ---- // I let you down. Sorry :( Time: 02/01/16 21:22 Description: Loading screen debug info This is just a prompt for computer specs to be printed. THIS IS NOT A ERROR A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.8 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.8.0_25, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 932732784 bytes (889 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: Loaded coremods (and transformers): GL info: ' Vendor: 'Intel' Version: '4.2.0 - Build 10.18.10.3355' Renderer: 'Intel(R) HD Graphics 4400' [21:22:54] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization [21:22:54] [Client thread/INFO] [FML]: MinecraftForge v11.14.3.1446 Initialized [21:22:54] [Client thread/INFO] [FML]: Replaced 204 ore recipies [21:22:54] [Client thread/INFO] [FML]: Preloading CrashReport classes [21:22:55] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization [21:22:55] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer [21:22:55] [Client thread/INFO] [FML]: Searching C:\Users\Wassil\Desktop\ModTestProjet\eclipse\mods for mods [21:22:59] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load [21:23:00] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, tm] at CLIENT [21:23:00] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, tm] at SERVER [21:23:01] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Mod Drakaelia [21:23:01] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [21:23:01] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations [21:23:01] [Client thread/INFO] [FML]: Identifying ItemStackHolder annotations [21:23:01] [Client thread/INFO] [FML]: Found 0 ItemStackHolder annotations [21:23:01] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [21:23:01] [Client thread/INFO] [FML]: Applying holder lookups [21:23:01] [Client thread/INFO] [FML]: Holder lookups applied [21:23:01] [Client thread/INFO] [FML]: Injecting itemstacks [21:23:01] [Client thread/INFO] [FML]: Itemstack injection complete [21:23:01] [Sound Library Loader/INFO]: Starting up SoundSystem… [21:23:02] [Thread-9/INFO]: Initializing LWJGL OpenAL [21:23:02] [Thread-9/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [21:23:02] [Thread-9/INFO]: OpenAL initialized. [21:23:02] [Sound Library Loader/INFO]: Sound engine started [21:23:08] [Client thread/INFO]: Created: 512x512 textures-atlas [21:23:09] [Client thread/ERROR] [FML]: Model definition for location tm:torse_samurai2#inventory not found [21:23:09] [Client thread/ERROR] [FML]: Model definition for location tm:torse_samurai1#inventory not found [21:23:09] [Client thread/ERROR] [FML]: Model definition for location tm:epee_test#inventory not found [21:23:09] [Client thread/ERROR] [FML]: Model definition for location tm:pantalon_samurai1#inventory not found [21:23:09] [Client thread/ERROR] [FML]: Model definition for location tm:pantalon_samurai2#inventory not found [21:23:09] [Client thread/ERROR] [FML]: Model definition for location tm:itemadmin#inventory not found [21:23:09] [Client thread/ERROR] [FML]: Model definition for location tm:nigga#inventory not found [21:23:09] [Client thread/ERROR] [FML]: Model definition for location tm:casque_samurai2#inventory not found [21:23:09] [Client thread/ERROR] [FML]: Model definition for location tm:casque_samurai1#inventory not found [21:23:09] [Client thread/ERROR] [FML]: Model definition for location tm:casque_guerrier#inventory not found [21:23:11] [Client thread/INFO] [FML]: Injecting itemstacks [21:23:11] [Client thread/INFO] [FML]: Itemstack injection complete [21:23:12] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods [21:23:12] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Mod Drakaelia [21:23:12] [Client thread/INFO]: SoundSystem shutting down… [21:23:12] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com [21:23:12] [Sound Library Loader/INFO]: Starting up SoundSystem… [21:23:12] [Thread-11/INFO]: Initializing LWJGL OpenAL [21:23:12] [Thread-11/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [21:23:12] [Thread-11/INFO]: OpenAL initialized. [21:23:13] [Sound Library Loader/INFO]: Sound engine started [21:23:18] [Client thread/INFO]: Created: 512x512 textures-atlas [21:23:18] [Client thread/ERROR] [FML]: Model definition for location tm:torse_samurai2#inventory not found [21:23:18] [Client thread/ERROR] [FML]: Model definition for location tm:torse_samurai1#inventory not found [21:23:18] [Client thread/ERROR] [FML]: Model definition for location tm:epee_test#inventory not found [21:23:18] [Client thread/ERROR] [FML]: Model definition for location tm:pantalon_samurai1#inventory not found [21:23:18] [Client thread/ERROR] [FML]: Model definition for location tm:pantalon_samurai2#inventory not found [21:23:18] [Client thread/ERROR] [FML]: Model definition for location tm:itemadmin#inventory not found [21:23:18] [Client thread/ERROR] [FML]: Model definition for location tm:nigga#inventory not found [21:23:18] [Client thread/ERROR] [FML]: Model definition for location tm:casque_samurai2#inventory not found [21:23:18] [Client thread/ERROR] [FML]: Model definition for location tm:casque_samurai1#inventory not found [21:23:18] [Client thread/ERROR] [FML]: Model definition for location tm:casque_guerrier#inventory not found [21:23:23] [Server thread/INFO]: Starting integrated minecraft server version 1.8 [21:23:23] [Server thread/INFO]: Generating keypair [21:23:23] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance [21:23:23] [Server thread/INFO] [FML]: Applying holder lookups [21:23:23] [Server thread/INFO] [FML]: Holder lookups applied [21:23:23] [Server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@257362ee) [21:23:23] [Server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@257362ee) [21:23:23] [Server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@257362ee) [21:23:23] [Server thread/INFO]: Preparing start region for level 0 [21:23:24] [Server thread/INFO]: Preparing spawn area: 23% [21:23:26] [Server thread/INFO]: Changing view distance to 12, from 10 [21:23:28] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 2 [21:23:28] [Netty Server IO #1/INFO] [FML]: Client protocol version 2 [21:23:28] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 4 mods : FML@8.0.99.99,Forge@11.14.3.1446,tm@Drakaelia_0.01_4.b,mcp@9.05 [21:23:28] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established [21:23:28] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [21:23:28] [Server thread/INFO]: Wassangota[local:E:0be648f9] logged in with entity id 412 at (65.01556391145466, 79.7559626627752, 323.3373460078601) [21:23:28] [Server thread/INFO]: Wassangota joined the game [21:23:28] [Netty Local Client IO #0/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.NullPointerException at tarael.extendedentity.ExtendedEntityPropTuto.get(ExtendedEntityPropTuto.java:38) ~[ExtendedEntityPropTuto.class:?] at tarael.packet.PacketMoney$Handler.onMessage(PacketMoney.java:83) ~[PacketMoney$Handler.class:?] at tarael.packet.PacketMoney$Handler.onMessage(PacketMoney.java:1) ~[PacketMoney$Handler.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.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:382) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:249) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:50) [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(Unknown Source) [?:1.8.0_25] [21:23:28] [Netty Local Client IO #0/ERROR] [FML]: There was a critical exception handling a packet on channel tm java.lang.NullPointerException at tarael.extendedentity.ExtendedEntityPropTuto.get(ExtendedEntityPropTuto.java:38) ~[ExtendedEntityPropTuto.class:?] at tarael.packet.PacketMoney$Handler.onMessage(PacketMoney.java:83) ~[PacketMoney$Handler.class:?] at tarael.packet.PacketMoney$Handler.onMessage(PacketMoney.java:1) ~[PacketMoney$Handler.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.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:382) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:249) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:50) [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(Unknown Source) [?:1.8.0_25] [21:23:28] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_25] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1077) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] 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/:?] Caused by: java.lang.NullPointerException at net.minecraft.client.network.NetHandlerPlayClient.handleJoinGame(NetHandlerPlayClient.java:276) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.S01PacketJoinGame.processPacket(S01PacketJoinGame.java:89) ~[S01PacketJoinGame.class:?] at net.minecraft.network.play.server.S01PacketJoinGame.processPacket(S01PacketJoinGame.java:103) ~[S01PacketJoinGame.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_25] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?] … 11 more [21:23:28] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_25] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1077) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] 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/:?] Caused by: java.lang.NullPointerException at net.minecraft.client.network.NetHandlerPlayClient.handleCustomPayload(NetHandlerPlayClient.java:1860) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.S3FPacketCustomPayload.process(S3FPacketCustomPayload.java:64) ~[S3FPacketCustomPayload.class:?] at net.minecraft.network.play.server.S3FPacketCustomPayload.processPacket(S3FPacketCustomPayload.java:78) ~[S3FPacketCustomPayload.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_25] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?] … 11 more [21:23:28] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_25] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1077) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] 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/:?] Caused by: java.lang.NullPointerException at net.minecraft.client.network.NetHandlerPlayClient.handleServerDifficulty(NetHandlerPlayClient.java:1549) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.S41PacketServerDifficulty.func_179829_a(S41PacketServerDifficulty.java:28) ~[S41PacketServerDifficulty.class:?] at net.minecraft.network.play.server.S41PacketServerDifficulty.processPacket(S41PacketServerDifficulty.java:58) ~[S41PacketServerDifficulty.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_25] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?] … 11 more [21:23:28] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_25] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1077) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] 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/:?] Caused by: java.lang.NullPointerException at net.minecraft.client.network.NetHandlerPlayClient.handleSpawnPosition(NetHandlerPlayClient.java:963) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.S05PacketSpawnPosition.func_180752_a(S05PacketSpawnPosition.java:42) ~[S05PacketSpawnPosition.class:?] at net.minecraft.network.play.server.S05PacketSpawnPosition.processPacket(S05PacketSpawnPosition.java:56) ~[S05PacketSpawnPosition.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_25] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?] … 11 more [21:23:28] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_25] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1077) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] 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/:?] Caused by: java.lang.NullPointerException at net.minecraft.client.network.NetHandlerPlayClient.handlePlayerAbilities(NetHandlerPlayClient.java:1674) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.S39PacketPlayerAbilities.func_180742_a(S39PacketPlayerAbilities.java:82) ~[S39PacketPlayerAbilities.class:?] at net.minecraft.network.play.server.S39PacketPlayerAbilities.processPacket(S39PacketPlayerAbilities.java:152) ~[S39PacketPlayerAbilities.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_25] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?] … 11 more [21:23:28] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_25] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1077) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] 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/:?] Caused by: java.lang.NullPointerException at net.minecraft.client.network.NetHandlerPlayClient.handleHeldItemChange(NetHandlerPlayClient.java:600) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.S09PacketHeldItemChange.func_180746_a(S09PacketHeldItemChange.java:41) ~[S09PacketHeldItemChange.class:?] at net.minecraft.network.play.server.S09PacketHeldItemChange.processPacket(S09PacketHeldItemChange.java:55) ~[S09PacketHeldItemChange.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_25] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?] … 11 more [21:23:28] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_25] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1077) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] 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/:?] Caused by: java.lang.NullPointerException at net.minecraft.client.network.NetHandlerPlayClient.handleStatistics(NetHandlerPlayClient.java:1470) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.S37PacketStatistics.processPacket(S37PacketStatistics.java:34) ~[S37PacketStatistics.class:?] at net.minecraft.network.play.server.S37PacketStatistics.processPacket(S37PacketStatistics.java:84) ~[S37PacketStatistics.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_25] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?] … 11 more [21:23:29] [Server thread/INFO]: Wassangota 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}} [21:23:29] [Server thread/INFO]: Wassangota left the game [21:23:29] [Server thread/INFO]: Stopping singleplayer server as player logged out [21:23:30] [Server thread/INFO]: Stopping server [21:23:30] [Server thread/INFO]: Saving players [21:23:30] [Server thread/INFO]: Saving worlds [21:23:30] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld [21:23:30] [Server thread/INFO]: Saving chunks for level 'New World'/Nether [21:23:30] [Server thread/INFO]: Saving chunks for level 'New World'/The End [21:23:34] [Server thread/INFO] [FML]: Unloading dimension 0 [21:23:34] [Server thread/INFO] [FML]: Unloading dimension -1 [21:23:34] [Server thread/INFO] [FML]: Unloading dimension 1 [21:23:34] [Server thread/INFO] [FML]: Applying holder lookups [21:23:34] [Server thread/INFO] [FML]: Holder lookups applied [21:23:43] [Client thread/INFO]: Stopping!
Voici ma classe de l’ExtendedEntityProperties:
package tarael.extendedentity; import tarael.client.CommonProxy; import tarael.common.ModTarael; import tarael.packet.PacketMoney; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; import net.minecraftforge.common.IExtendedEntityProperties; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; public class ExtendedEntityPropTuto implements IExtendedEntityProperties { public final static String EXT_PROP_NAME = "ExtPropTuto"; private final EntityPlayer player; public long money; public long maxMoney; public ExtendedEntityPropTuto(EntityPlayer player) { this.player = player; this.money = 0; this.maxMoney = 999999999; } public static final void register(EntityPlayer player) { player.registerExtendedProperties(ExtendedEntityPropTuto.EXT_PROP_NAME, new ExtendedEntityPropTuto(player)); } public static final ExtendedEntityPropTuto get(EntityPlayer player) { return (ExtendedEntityPropTuto) player.getExtendedProperties(EXT_PROP_NAME); } @Override public void saveNBTData(NBTTagCompound compound) { // TODO Auto-generated method stub NBTTagCompound properties = new NBTTagCompound(); properties.setLong("Money", this.money); properties.setLong("MaxMoney", this.maxMoney); compound.setTag(EXT_PROP_NAME, properties); } @Override public void loadNBTData(NBTTagCompound compound) { // TODO Auto-generated method stub NBTTagCompound properties = (NBTTagCompound) compound.getTag(EXT_PROP_NAME); this.money = properties.getLong("Money"); this.maxMoney = properties.getLong("MaxMoney"); } @Override public void init(Entity entity, World world) { // TODO Auto-generated method stub } public final void sync() { PacketMoney packetMoney = new PacketMoney(this.money , this.maxMoney); if (!player.worldObj.isRemote) { EntityPlayerMP player1 = (EntityPlayerMP) player; ModTarael.network.sendTo(packetMoney, player1); } else { ModTarael.network.sendToServer(packetMoney); } } private static String getSaveKey(EntityPlayer player) { return player.getDisplayName() + ":" + EXT_PROP_NAME; } public static void saveProxyData(EntityPlayer player) { ExtendedEntityPropTuto playerData = ExtendedEntityPropTuto.get(player); NBTTagCompound savedData = new NBTTagCompound(); playerData.saveNBTData(savedData); CommonProxy.storeEntityData(getSaveKey(player), savedData); } public static void loadProxyData(EntityPlayer player) { ExtendedEntityPropTuto playerData = ExtendedEntityPropTuto.get(player); NBTTagCompound savedData = CommonProxy .getEntityData(getSaveKey(player)); if (savedData != null) { playerData.loadNBTData(savedData); } playerData.sync(); } public void update(long money, long maxMoney) { this.money = money; this.maxMoney = maxMoney; } public boolean pay(long amount) { boolean sufficient = amount <= this.money; if (sufficient) { this.money -= amount; this.sync(); } else { return false; } return sufficient; } public void addMoney(long amount) { this.money += amount; this.sync(); } public long getMoney() { return this.money; } public void setMoney(long newMoney) { this.money = newMoney; this.sync(); } }
Ma classe du packet ainsi que sa sous classe handler:
package tarael.packet; import java.net.ProtocolException; import tarael.extendedentity.ExtendedEntityPropTuto; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.NetHandlerPlayServer; 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 PacketMoney implements IMessage { private long maxMoney, money; public PacketMoney() { } public PacketMoney(long money, long maxMoney) { this.maxMoney = maxMoney; this.money = money; } @Override public void fromBytes(ByteBuf buf) { this.maxMoney = buf.readLong(); this.money = buf.readLong(); } @Override public void toBytes(ByteBuf buf) { buf.writeLong(maxMoney); buf.writeLong(money); } public void handleClientSide(EntityPlayer player) { ExtendedEntityPropTuto props = ExtendedEntityPropTuto .get(player); props.maxMoney = this.maxMoney; props.money = this.money; } public void handleServerSide(EntityPlayer player) { ExtendedEntityPropTuto props = ExtendedEntityPropTuto .get(player); props.maxMoney = this.maxMoney; props.money = this.money; } // TODO Auto-generated method stub /*EntityPlayer player = ctx.getServerHandler().playerEntity; ExtendedEntityPropTuto props = ExtendedEntityPropTuto .get(player); props.maxMoney = this.maxMoney; props.money = this.money;*/ public static class Handler implements IMessageHandler <packetmoney, imessage="">{ @Override public IMessage onMessage(PacketMoney message, MessageContext ctx) { if(ctx.netHandler instanceof NetHandlerPlayServer) { ExtendedEntityPropTuto dat = ExtendedEntityPropTuto.get(((NetHandlerPlayServer)ctx.netHandler).playerEntity); dat.update(message.money, message.maxMoney); } else if(ctx.netHandler instanceof NetHandlerPlayClient) { EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; ExtendedEntityPropTuto dat = ExtendedEntityPropTuto.get(player); dat.update(message.money, message.maxMoney); } return null; } } }
Et puis aussi l’eventhandler puisque je pense qu’il est aussi impliqué:
package tarael.packet; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.event.entity.EntityEvent.EntityConstructing; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; import tarael.common.ModTarael; import tarael.client.CommonProxy; import tarael.common.ModTarael; import tarael.extendedentity.ExtendedEntityPropTuto; public class MoneyEventHandler { CommonProxy proxy = ModTarael.proxy; private EntityPlayer player; @SubscribeEvent public void onEntityConstructing(EntityConstructing event) { if (event.entity instanceof EntityPlayer && ExtendedEntityPropTuto.get((EntityPlayer) event.entity) == null) ExtendedEntityPropTuto.register((EntityPlayer) event.entity); } @SubscribeEvent public void onLivingDeathEvent(LivingDeathEvent event) { if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer) { NBTTagCompound playerData = new NBTTagCompound(); ((ExtendedEntityPropTuto) (event.entity .getExtendedProperties(ExtendedEntityPropTuto.EXT_PROP_NAME))) .saveNBTData(playerData); proxy.storeEntityData( ((EntityPlayer) event.entity).getName(), playerData); ExtendedEntityPropTuto.saveProxyData((EntityPlayer) event.entity); } else { } } @SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent event) { if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer) { NBTTagCompound playerData = proxy .getEntityData(((EntityPlayer) event.entity) .getName()); if (playerData != null) { ((ExtendedEntityPropTuto) (event.entity .getExtendedProperties(ExtendedEntityPropTuto.EXT_PROP_NAME))) .loadNBTData(playerData); } ((ExtendedEntityPropTuto) (event.entity .getExtendedProperties(ExtendedEntityPropTuto.EXT_PROP_NAME))) .sync(); } } }
Donc déjà merci d’avoir lu ce sujet et désolé si vous perdez du temps pour une erreur de débutant.</packetmoney,>
-
java.lang.NullPointerException
at tarael.extendedentity.ExtendedEntityPropTuto.get(ExtendedEntityPropTuto.java:38) ~[ExtendedEntityPropTuto.class:?]Ton ExtendedEntityPropTuto est null. Vérifies que ta classe MoneyEventHandler soit bien enregistré comme classe d’event.
-
Ma classe MoneyEventHandler est enregistrée dans l’init comme ça: MinecraftForge.EVENT_BUS.register(new MoneyEventHandler());
-
Dans ce cas tu ne devrais pas avoir un npe. C’est étrange. Vérifies peut-être que Minecraft.getMinecraft().thePlayer n’est pas null à l’arrivé du paquet.
-
J’ai vu que le NPE était causé par ceci dans ma classe de l’extendedentityprop :
public static final ExtendedEntityPropTuto get(EntityPlayer player) { return (ExtendedEntityPropTuto) player.getExtendedProperties(EXT_PROP_NAME); }
et par ceci dans l’handler du packet
else if(ctx.netHandler instanceof NetHandlerPlayClient) { EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; ExtendedEntityPropTuto dat = ExtendedEntityPropTuto.get(player); dat.update(message.money, message.maxMoney); }
Ce serait à cause de la façon dont je récupère le joueur pour le client ?
Et désolé si je met du temps à répondre à vos aides, je ne suis pas très dispo pendant la semaine :s
-
Normalement ça devrait fonctionner. C’est peut-être le fait d’envoyer le paquet tout de suite à la connexion qui cause problème.
Dans le paquet ajoute :
System.out.println(Minecraft.getMinecraft().thePlayer);
S’il affiche null c’est bien que le joueur est null. -
Quand je recrée une map j’obtiens ça:
[Netty Local Client IO #0/INFO] [STDOUT]: [tarael.packet.PacketMoney$Handler:onMessage:85]: EntityPlayerSP['Wassangota'/207, l='MpServer', x=8,50, y=65,00, z=8,50] [18:46:13] [Netty Local Client IO #0/INFO] [STDOUT]: [tarael.packet.PacketMoney$Handler:onMessage:85]: EntityPlayerSP['Wassangota'/207, l='MpServer', x=8,50, y=65,00, z=8,50]
Et quand je la relance je ne l’ai plus, seulement les logs de crash. J’ai mis le println au mauvais endroit dans mon classe ?
-
En effet, met le print au début de la condition.
-
Au début dans le “else if” j’obtiens ça maintenant dans le crash
[Netty Local Client IO #0/INFO] [STDOUT]: [tarael.packet.PacketMoney$Handler:onMessage:82]: null
donc cette ligne ```java
System.out.println(Minecraft.getMinecraft().thePlayer); -
Oui donc c’est bien le joueur qui est null.
Donc envoyer un paquet dès la connexion n’est pas une bonne idée. -
Donc si j’ai bien compris pour envoyer le paquet il ne faut pas que je passe par EntityJoinWorldEvent mais par autre chose dans l’event handler ?
-
Regardes avec PlayerEvent.PlayerLogginEvent (par contre c’est un event de fml).
-
Oui ça marche maintenant je peux relancer mon monde en solo et en multi sans crash. Mais quand je meurs je perd mes données. Je sauvegarde mal les données dans LivingDeathEvent ?
-
Mets un System.out.println(“quelque chose”); dans saveNBTData et loadNBTData pour vérifier que les fonctions sont appelés.
-
Alors quand je rejoins le monde le message que j’ai mis dans le loadNBTData apparaît bien dans la console et quand je meurt celui du saveNBTData aussi. Les fonction sont donc bien appelées mais alors pourquoi alors je n’obtiens pas la valeur de mon argent ?
-
Aucune idée x)
Renvoies ton code actuel ? -
Voila le code de mon event handler :
package tarael.packet; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.event.entity.EntityEvent.EntityConstructing; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; import tarael.common.ModTarael; import tarael.client.CommonProxy; import tarael.common.ModTarael; import tarael.extendedentity.ExtendedEntityPropTuto; public class MoneyEventHandler { CommonProxy proxy = ModTarael.proxy; private EntityPlayer player; @SubscribeEvent public void onEntityConstructing(EntityConstructing event) { if (event.entity instanceof EntityPlayer && ExtendedEntityPropTuto.get((EntityPlayer) event.entity) == null) ExtendedEntityPropTuto.register((EntityPlayer) event.entity); } @SubscribeEvent public void onLivingDeathEvent(LivingDeathEvent event) { if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer) { NBTTagCompound playerData = new NBTTagCompound(); ((ExtendedEntityPropTuto) (event.entity .getExtendedProperties(ExtendedEntityPropTuto.EXT_PROP_NAME))) .saveNBTData(playerData); CommonProxy.storeEntityData( ((EntityPlayer)event.entity).getName(), playerData); ExtendedEntityPropTuto.saveProxyData((EntityPlayer)event.entity); } else { } } @SubscribeEvent public void onPlayerLogginEvent(PlayerLoggedInEvent event) { if (!event.player.worldObj.isRemote && event.player instanceof EntityPlayer) { ExtendedEntityPropTuto.get((EntityPlayer) event.player).sync(); if (!event.player.worldObj.isRemote && event.player instanceof EntityPlayer) { NBTTagCompound playerData = proxy .getEntityData(((EntityPlayer) event.player).getName()); if (playerData != null) { ((ExtendedEntityPropTuto) (event.player .getExtendedProperties(ExtendedEntityPropTuto.EXT_PROP_NAME))) .loadNBTData(playerData); } ((ExtendedEntityPropTuto) (event.player .getExtendedProperties(ExtendedEntityPropTuto.EXT_PROP_NAME))) .sync(); } } } /*@SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent event) { if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer) { NBTTagCompound playerData = proxy .getEntityData(((EntityPlayer) event.entity).getName()); if (playerData != null) { ((ExtendedEntityPropTuto) (event.entity .getExtendedProperties(ExtendedEntityPropTuto.EXT_PROP_NAME))) .loadNBTData(playerData); } ((ExtendedEntityPropTuto) (event.entity .getExtendedProperties(ExtendedEntityPropTuto.EXT_PROP_NAME))) .sync(); } }*/ }
Edit: Et l’ ExtendedEntityProp :
package tarael.extendedentity; import tarael.client.CommonProxy; import tarael.common.ModTarael; import tarael.packet.PacketMoney; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; import net.minecraftforge.common.IExtendedEntityProperties; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; public class ExtendedEntityPropTuto implements IExtendedEntityProperties { public final static String EXT_PROP_NAME = "ExtPropTuto"; private final EntityPlayer player; public long money; public long maxMoney; public ExtendedEntityPropTuto(EntityPlayer player) { this.player = player; this.money = 0; this.maxMoney = 999999999; } public static final void register(EntityPlayer player) { player.registerExtendedProperties(ExtendedEntityPropTuto.EXT_PROP_NAME, new ExtendedEntityPropTuto(player)); } public static final ExtendedEntityPropTuto get(EntityPlayer player) { return (ExtendedEntityPropTuto) player.getExtendedProperties(EXT_PROP_NAME); } @Override public void saveNBTData(NBTTagCompound compound) { // TODO Auto-generated method stub NBTTagCompound properties = new NBTTagCompound(); properties.setLong("Money", this.money); properties.setLong("MaxMoney", this.maxMoney); compound.setTag(EXT_PROP_NAME, properties); System.out.println("quelque chose saveNBTData"); } @Override public void loadNBTData(NBTTagCompound compound) { // TODO Auto-generated method stub NBTTagCompound properties = (NBTTagCompound) compound.getTag(EXT_PROP_NAME); this.money = properties.getLong("Money"); this.maxMoney = properties.getLong("MaxMoney"); System.out.println("quelque chose loadNBTData"); } @Override public void init(Entity entity, World world) { // TODO Auto-generated method stub } public final void sync() { PacketMoney packetMoney = new PacketMoney(this.money , this.maxMoney); if (!player.worldObj.isRemote) { EntityPlayerMP player1 = (EntityPlayerMP) player; ModTarael.network.sendTo(packetMoney, player1); } else { ModTarael.network.sendToServer(packetMoney); } } private static String getSaveKey(EntityPlayer player) { return player.getDisplayName() + ":" + EXT_PROP_NAME; } public static void saveProxyData(EntityPlayer player) { ExtendedEntityPropTuto playerData = ExtendedEntityPropTuto.get(player); NBTTagCompound savedData = new NBTTagCompound(); playerData.saveNBTData(savedData); CommonProxy.storeEntityData(getSaveKey(player), savedData); } public static void loadProxyData(EntityPlayer player) { ExtendedEntityPropTuto playerData = ExtendedEntityPropTuto.get(player); NBTTagCompound savedData = CommonProxy.getEntityData(getSaveKey(player)); if (savedData != null) { playerData.loadNBTData(savedData); } playerData.sync(); } public void update(long money, long maxMoney) { this.money = money; this.maxMoney = maxMoney; } public boolean pay(long amount) { boolean sufficient = amount <= this.money; if (sufficient) { this.money -= amount; this.sync(); } else { return false; } return sufficient; } public void addMoney(long amount) { this.money += amount; this.sync(); } public long getMoney() { return this.money; } public void setMoney(long newMoney) { this.money = newMoney; this.sync(); } }
-
Regarde si tu appelles les variables côté serveur ou client déjà, si c’est serveur et que ça ne marche pas, le problème vient de ton EEP, sinon c’est surement un problème de synchronisation
-
Comment ça ? Tu veux que je regarde si dans le onMessage j’envoie les données vers le serveur et le client ?
-
System.out.println() affichera la side d’où la fonction est appelé dans la console.