Résolu Encore problème onUpdate
-
Le tag nbt est nul, mais tu ne peux pas faire comme ça car sinon il y aura un problème de synchronisation entre le client et le serveur, il te faut envoyer un paquet au serveur et c’est lui qui ajoutera les nbt puisque c’est de ce côté que vont être tirées les flèches.
-
@‘SCAREX’:
Le tag nbt est nul, mais tu ne peux pas faire comme ça car sinon il y aura un problème de synchronisation entre le client et le serveur, il te faut envoyer un paquet au serveur et c’est lui qui ajoutera les nbt puisque c’est de ce côté que vont être tirées les flèches.
D’accord alors j’ai fais ça:
Packet (enregistrer côté client):
package net.legacymod.packets; import io.netty.buffer.ByteBuf; import net.legacymod.LegacyMod; import net.legacymod.gui.ClassesGUI; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; 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 PacketKey implements IMessage { public PacketKey(){ } @Override public void fromBytes(ByteBuf buf) { } @Override public void toBytes(ByteBuf buf) { } public static class Handler implements IMessageHandler <packetkey, imessage="">{ public IMessage onMessage(PacketKey message, MessageContext ctx) { ItemStack stack = new ItemStack(LegacyMod.FlameBow); NBTTagCompound nbt = (NBTTagCompound) stack.getTagCompound().getTag("key"); stack.getTagCompound().setTag("key", nbt); return null; } } }
Proxy:
@SubscribeEvent public void onEvent2(KeyInputEvent event) { if(keyBindSortG1.isPressed()) { keyTestTyped2(); } } private void keyTestTyped2() { LegacyMod.network.sendToServer(new PacketKey()); }
FlameBow (classe de l’arc):
else if (!world.isRemote && stack.getTagCompound().hasKey("key")) { LegacyMod.network.sendToServer(new PacketArrow(f * 2.0F, 3)); System.out.println("flèche en feu"); //stack.getTagCompound().setInteger("timer2", 0); }
J’ai pas de crash, mais le truc c’est que ça me lance une flèche normale quand j’appuie sur la touche au lieux de la flèche en feu.</packetkey,>
-
Tu tes mélange complètement les pinceaux.
!world.isRemote = côté serveur.
Pourquoi tu envoies un paquet vers le serveur si tu es déjà côté serveur ?Ensuite comme le paquet va du client au serveur, le paquet doit être enregistré avec Side.SERVER et non client.
Et pour finir, tu as de-nouveau un item stack qui sort de null part, cette fois-ci dans l’handler de ton paquet :
ItemStack stack = new ItemStack(LegacyMod.FlameBow); -
@‘robin4002’:
Tu tes mélange complètement les pinceaux.
!world.isRemote = côté serveur.
Pourquoi tu envoies un paquet vers le serveur si tu es déjà côté serveur ?Ensuite comme le paquet va du client au serveur, le paquet doit être enregistré avec Side.SERVER et non client.
Et pour finir, tu as de-nouveau un item stack qui sort de null part, cette fois-ci dans l’handler de ton paquet :
ItemStack stack = new ItemStack(LegacyMod.FlameBow);Car Scarex m’a dis d’envoyer le packet côté serveur.
Crash:
[21:16:08] [main/INFO] [GradleStart]: username: floriangabet [21:16:08] [main/INFO] [GradleStart]: Extra: [] [21:16:08] [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, --username, floriangabet, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [21:16:08] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker [21:16:08] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker [21:16:08] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [21:16:08] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker [21:16:08] [main/INFO] [FML]: Forge Mod Loader version 7.10.85.1291 for Minecraft 1.7.10 loading [21:16:08] [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 [21:16:08] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [21:16:08] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [21:16:08] [main/INFO] [GradleStart]: Injecting location in coremod cpw.mods.fml.relauncher.FMLCorePlugin [21:16:08] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [21:16:08] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [21:16:08] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker [21:16:08] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [21:16:08] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [21:16:08] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [21:16:08] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [21:16:08] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [21:16:09] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [21:16:09] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [21:16:09] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker [21:16:09] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [21:16:09] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.TerminalTweaker [21:16:09] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.TerminalTweaker [21:16:09] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [21:16:09] [main/INFO]: Setting user: floriangabet [21:16:10] [Client thread/INFO]: LWJGL Version: 2.9.1 [21:16:10] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization [21:16:10] [Client thread/INFO] [FML]: MinecraftForge v10.13.2.1291 Initialized [21:16:10] [Client thread/INFO] [FML]: Replaced 183 ore recipies [21:16:10] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization [21:16:10] [Client thread/INFO] [FML]: Searching C:\Users\Admin\Documents\Modding\LegacyMod\eclipse\mods for mods [21:16:10] [Client thread/INFO] [lc]: Mod lc is missing the required element 'name'. Substituting lc [21:16:12] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load [21:16:12] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, lc] at CLIENT [21:16:12] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, lc] at SERVER [21:16:12] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:lc, [1.10] Firewolf v1.36.zip [21:16:12] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [21:16:12] [Client thread/INFO] [FML]: Found 341 ObjectHolder annotations [21:16:12] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [21:16:12] [Client thread/INFO] [FML]: Applying holder lookups [21:16:12] [Client thread/INFO] [FML]: Holder lookups applied [21:16:12] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [21:16:12] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem… [21:16:12] [Thread-6/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL [21:16:12] [Thread-6/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [21:16:12] [Thread-6/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized. [21:16:13] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [21:16:13] [Sound Library Loader/INFO]: Sound engine started [21:16:15] [Client thread/INFO]: Created: 2048x2048 textures/blocks-atlas [21:16:15] [Client thread/ERROR]: Using missing texture, unable to load minecraft:textures/items/.png java.io.FileNotFoundException: minecraft:textures/items/.png at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:126) [TextureMap.class:?] at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:91) [TextureMap.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTickableTexture(TextureManager.java:71) [TextureManager.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTextureMap(TextureManager.java:58) [TextureManager.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:583) [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/:?] [21:16:15] [Client thread/INFO]: Created: 512x256 textures/items-atlas [21:16:15] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods [21:16:15] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:lc, [1.10] Firewolf v1.36.zip [21:16:17] [Client thread/INFO]: Created: 2048x2048 textures/blocks-atlas [21:16:17] [Client thread/ERROR]: Using missing texture, unable to load minecraft:textures/items/.png java.io.FileNotFoundException: minecraft:textures/items/.png at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:126) [TextureMap.class:?] at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:91) [TextureMap.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?] at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(TextureManager.java:170) [TextureManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:643) [Minecraft.class:?] at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:303) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:586) [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/:?] [21:16:17] [Client thread/INFO]: Created: 512x256 textures/items-atlas [21:16:17] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [21:16:17] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: SoundSystem shutting down… [21:16:17] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:importantMessage:90]: Author: Paul Lamb, www.paulscode.com [21:16:17] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [21:16:17] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [21:16:17] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem… [21:16:18] [Thread-8/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL [21:16:18] [Thread-8/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [21:16:18] [Thread-8/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized. [21:16:18] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [21:16:18] [Sound Library Loader/INFO]: Sound engine started [21:16:20] [Server thread/INFO]: Starting integrated minecraft server version 1.7.10 [21:16:20] [Server thread/INFO]: Generating keypair [21:16:21] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance [21:16:21] [Server thread/INFO] [FML]: Applying holder lookups [21:16:21] [Server thread/INFO] [FML]: Holder lookups applied [21:16:21] [Server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@1030af) [21:16:21] [Server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@1030af) [21:16:21] [Server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@1030af) [21:16:21] [Server thread/INFO]: Preparing start region for level 0 [21:16:22] [Server thread/INFO]: Changing view distance to 8, from 10 [21:16:22] [Netty Client IO #0/INFO] [FML]: Server protocol version 1 [21:16:22] [Netty IO #1/INFO] [FML]: Client protocol version 1 [21:16:22] [Netty IO #1/INFO] [FML]: Client attempting to join with 4 mods : FML@7.10.85.1291,lc@1.0,Forge@10.13.2.1291,mcp@9.05 [21:16:22] [Netty IO #1/INFO] [FML]: Attempting connection with missing mods [] at CLIENT [21:16:22] [Netty Client IO #0/INFO] [FML]: Attempting connection with missing mods [] at SERVER [21:16:22] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [21:16:22] [Client thread/INFO] [FML]: [Client thread] Client side modded connection established [21:16:22] [Server thread/INFO]: floriangabet[local:E:fc05e651] logged in with entity id 349 at (-125.12197808627539, 83.5862816420882, -3.7061562067116407) [21:16:22] [Server thread/INFO]: floriangabet a rejoint la partie [21:16:25] [Server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.NullPointerException at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:35) ~[PacketKey$Handler.class:?] at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:1) ~[PacketKey$Handler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] [21:16:25] [Server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.NullPointerException at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:35) ~[PacketKey$Handler.class:?] at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:1) ~[PacketKey$Handler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] [21:16:25] [Server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.NullPointerException at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:35) ~[PacketKey$Handler.class:?] at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:1) ~[PacketKey$Handler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] [21:16:25] [Server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.NullPointerException at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:35) ~[PacketKey$Handler.class:?] at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:1) ~[PacketKey$Handler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] [21:16:25] [Server thread/ERROR] [FML]: There was a critical exception handling a packet on channel lc: java.lang.NullPointerException at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:35) ~[PacketKey$Handler.class:?] at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:1) ~[PacketKey$Handler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] [21:16:25] [Server thread/INFO]: Stopping server [21:16:25] [Server thread/INFO]: Saving players [21:16:25] [Server thread/INFO]: Saving worlds [21:16:25] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld [21:16:25] [Server thread/INFO]: Saving chunks for level 'New World'/Nether [21:16:25] [Server thread/INFO]: Saving chunks for level 'New World'/The End [21:16:25] [Server thread/INFO] [FML]: Unloading dimension 0 [21:16:25] [Server thread/INFO] [FML]: Unloading dimension -1 [21:16:25] [Server thread/INFO] [FML]: Unloading dimension 1 [21:16:25] [Server thread/INFO] [FML]: Applying holder lookups [21:16:25] [Server thread/INFO] [FML]: Holder lookups applied
-
@‘robin4002’:
Et pour finir, tu as de-nouveau un item stack qui sort de null part, cette fois-ci dans l’handler de ton paquet :
ItemStack stack = new ItemStack(LegacyMod.FlameBow);La raison du crash est là.
Ton item stack que tu sors de null part n’a pas de tag nbt.
Donc forcement npe. -
@‘robin4002’:
@‘robin4002’:
Et pour finir, tu as de-nouveau un item stack qui sort de null part, cette fois-ci dans l’handler de ton paquet :
ItemStack stack = new ItemStack(LegacyMod.FlameBow);La raison du crash est là.
Ton item stack que tu sors de null part n’a pas de tag nbt.
Donc forcement npe.Comment je lui ajoute des nbt ?
-
Déjà le stack obtiens-le depuis l’inventaire du joueur au lieu de créer une nouvelle instance sinon ça ne fonctionnera pas.
Ensuite il faut faire stack.setTagCompound(new NBTTagCompound()); avant de le get. -
@‘robin4002’:
Déjà le stack obtiens-le depuis l’inventaire du joueur au lieu de créer une nouvelle instance sinon ça ne fonctionnera pas.
Ensuite il faut faire stack.setTagCompound(new NBTTagCompound()); avant de le get.J’ai fais ça:
public static class Handler implements IMessageHandler <packetkey, imessage="">{ public IMessage onMessage(PacketKey message, MessageContext ctx) { ItemStack stack = ctx.getServerHandler().playerEntity.inventory.getItemStack(); stack.setTagCompound(new NBTTagCompound()); NBTTagCompound nbt = (NBTTagCompound) stack.getTagCompound().getTag("key"); stack.getTagCompound().setTag("key", nbt); return null; } }
Crash:
[17:10:39] [main/INFO] [GradleStart]: username: floriangabet [17:10:39] [main/INFO] [GradleStart]: Extra: [] [17:10:39] [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, --username, floriangabet, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [17:10:39] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker [17:10:39] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker [17:10:39] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [17:10:39] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker [17:10:40] [main/INFO] [FML]: Forge Mod Loader version 7.10.85.1291 for Minecraft 1.7.10 loading [17:10:40] [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 [17:10:40] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [17:10:40] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [17:10:40] [main/INFO] [GradleStart]: Injecting location in coremod cpw.mods.fml.relauncher.FMLCorePlugin [17:10:40] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [17:10:40] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [17:10:40] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker [17:10:40] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [17:10:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [17:10:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [17:10:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [17:10:40] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [17:10:40] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [17:10:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [17:10:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker [17:10:40] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [17:10:40] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.TerminalTweaker [17:10:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.TerminalTweaker [17:10:40] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [17:10:41] [main/INFO]: Setting user: floriangabet [17:10:41] [Client thread/INFO]: LWJGL Version: 2.9.1 [17:10:41] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization [17:10:41] [Client thread/INFO] [FML]: MinecraftForge v10.13.2.1291 Initialized [17:10:41] [Client thread/INFO] [FML]: Replaced 183 ore recipies [17:10:41] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization [17:10:42] [Client thread/INFO] [FML]: Searching C:\Users\Admin\Documents\Modding\LegacyMod\eclipse\mods for mods [17:10:42] [Client thread/INFO] [lc]: Mod lc is missing the required element 'name'. Substituting lc [17:10:43] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load [17:10:43] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, lc] at CLIENT [17:10:43] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, lc] at SERVER [17:10:43] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:lc, [1.10] Firewolf v1.36.zip [17:10:43] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [17:10:43] [Client thread/INFO] [FML]: Found 341 ObjectHolder annotations [17:10:43] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [17:10:43] [Client thread/INFO] [FML]: Applying holder lookups [17:10:43] [Client thread/INFO] [FML]: Holder lookups applied [17:10:43] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [17:10:43] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem… [17:10:43] [Thread-5/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL [17:10:43] [Thread-5/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [17:10:43] [Thread-5/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized. [17:10:44] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [17:10:44] [Sound Library Loader/INFO]: Sound engine started [17:10:46] [Client thread/INFO]: Created: 2048x2048 textures/blocks-atlas [17:10:46] [Client thread/ERROR]: Using missing texture, unable to load minecraft:textures/items/.png java.io.FileNotFoundException: minecraft:textures/items/.png at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:126) [TextureMap.class:?] at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:91) [TextureMap.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTickableTexture(TextureManager.java:71) [TextureManager.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTextureMap(TextureManager.java:58) [TextureManager.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:583) [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/:?] [17:10:46] [Client thread/INFO]: Created: 512x256 textures/items-atlas [17:10:46] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods [17:10:46] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:lc, [1.10] Firewolf v1.36.zip [17:10:48] [Client thread/INFO]: Created: 2048x2048 textures/blocks-atlas [17:10:48] [Client thread/ERROR]: Using missing texture, unable to load minecraft:textures/items/.png java.io.FileNotFoundException: minecraft:textures/items/.png at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:126) [TextureMap.class:?] at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:91) [TextureMap.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?] at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(TextureManager.java:170) [TextureManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:643) [Minecraft.class:?] at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:303) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:586) [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/:?] [17:10:48] [Client thread/INFO]: Created: 512x256 textures/items-atlas [17:10:48] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [17:10:48] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: SoundSystem shutting down… [17:10:49] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:importantMessage:90]: Author: Paul Lamb, www.paulscode.com [17:10:49] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [17:10:49] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [17:10:49] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem… [17:10:49] [Thread-7/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL [17:10:49] [Thread-7/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [17:10:49] [Thread-7/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized. [17:10:49] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [17:10:49] [Sound Library Loader/INFO]: Sound engine started [17:10:50] [Server thread/INFO]: Starting integrated minecraft server version 1.7.10 [17:10:50] [Server thread/INFO]: Generating keypair [17:10:50] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance [17:10:50] [Server thread/INFO] [FML]: Applying holder lookups [17:10:50] [Server thread/INFO] [FML]: Holder lookups applied [17:10:50] [Server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@32010c) [17:10:50] [Server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@32010c) [17:10:50] [Server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@32010c) [17:10:50] [Server thread/INFO]: Preparing start region for level 0 [17:10:51] [Server thread/INFO]: Changing view distance to 8, from 10 [17:10:51] [Netty Client IO #0/INFO] [FML]: Server protocol version 1 [17:10:51] [Netty IO #1/INFO] [FML]: Client protocol version 1 [17:10:52] [Netty IO #1/INFO] [FML]: Client attempting to join with 4 mods : FML@7.10.85.1291,lc@1.0,Forge@10.13.2.1291,mcp@9.05 [17:10:52] [Netty IO #1/INFO] [FML]: Attempting connection with missing mods [] at CLIENT [17:10:52] [Netty Client IO #0/INFO] [FML]: Attempting connection with missing mods [] at SERVER [17:10:52] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [17:10:52] [Server thread/INFO]: floriangabet[local:E:6a76d8a3] logged in with entity id 350 at (-125.12197808627539, 83.5862816420882, -3.7061562067116407) [17:10:52] [Server thread/INFO]: floriangabet a rejoint la partie [17:10:52] [Client thread/INFO] [FML]: [Client thread] Client side modded connection established [17:10:53] [Server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.NullPointerException at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:37) ~[PacketKey$Handler.class:?] at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:1) ~[PacketKey$Handler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] [17:10:53] [Server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.NullPointerException at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:37) ~[PacketKey$Handler.class:?] at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:1) ~[PacketKey$Handler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] [17:10:53] [Server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.NullPointerException at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:37) ~[PacketKey$Handler.class:?] at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:1) ~[PacketKey$Handler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] [17:10:53] [Server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.NullPointerException at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:37) ~[PacketKey$Handler.class:?] at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:1) ~[PacketKey$Handler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] [17:10:53] [Server thread/ERROR] [FML]: There was a critical exception handling a packet on channel lc: java.lang.NullPointerException at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:37) ~[PacketKey$Handler.class:?] at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:1) ~[PacketKey$Handler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] [17:10:53] [Server thread/INFO]: Stopping server [17:10:53] [Server thread/INFO]: Saving players [17:10:53] [Server thread/INFO]: Saving worlds [17:10:53] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld [17:10:53] [Server thread/INFO]: Saving chunks for level 'New World'/Nether [17:10:53] [Server thread/INFO]: Saving chunks for level 'New World'/The End [17:10:53] [Server thread/INFO] [FML]: Unloading dimension 0 [17:10:53] [Server thread/INFO] [FML]: Unloading dimension -1 [17:10:53] [Server thread/INFO] [FML]: Unloading dimension 1 [17:10:53] [Server thread/INFO] [FML]: Applying holder lookups [17:10:53] [Server thread/INFO] [FML]: Holder lookups applied ```</packetkey,>
-
Rajoute un null check pour ta variable stack, avant le setTagCompound
-
Si tu n’avais pas d’item en main c’est normal que cela crash (suffit de faire ce que plaigon t’a dis).
Si tu avais un item en main, le crash vient surement de la ligne d’après, ce que tu fais n’a pas de sens.Je te conseille aussi de regarder la dernière vidéo de la chaine de mff, car rester bloquer sur un simple NPE ça ne devrait pas arriver …
-
@‘robin4002’:
Si tu n’avais pas d’item en main c’est normal que cela crash (suffit de faire ce que plaigon t’a dis).
Si tu avais un item en main, le crash vient surement de la ligne d’après, ce que tu fais n’a pas de sens.Je te conseille aussi de regarder la dernière vidéo de la chaine de mff, car rester bloquer sur un simple NPE ça ne devrait pas arriver …
J’avais un item dans la main oui, j’ai r’ajouter un null check pour évité le crash sans item.
Maintenant c’est le NBTTagCompound nbt = (NBTTagCompound) stack.getTagCompound().getTag(“key”); qui pose soucis .
Je sais que se que j’ai fais n’a pas de sens mais je vois pas comment le récupéré le nbt. -
stack.getTagCompound() quel est le problème ?
Envoyé via mobile
-
@‘AymericRed’:
stack.getTagCompound() quel est le problème ?
Envoyé via mobile
J’ai essayer mais j’ai eu un crash je le refais je te glisse le crash 30 secondes
edit:
[20:39:06] [Server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception java.lang.NullPointerException at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:40) ~[PacketKey$Handler.class:?] at net.legacymod.packets.PacketKey$Handler.onMessage(PacketKey.java:1) ~[PacketKey$Handler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
ligne 40: NBTTagCompound nbt = (NBTTagCompound) stack.getTagCompound();
-
Ton ItemStack est null, envoi le code
-
@‘SCAREX’:
Ton ItemStack est null, envoi le code
Encore ?!
mais what?
tien:public static class Handler implements IMessageHandler <packetkey, imessage="">{ public IMessage onMessage(PacketKey message, MessageContext ctx) { ItemStack stack = ctx.getServerHandler().playerEntity.inventory.getItemStack(); if(stack != null){ stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound nbt = (NBTTagCompound) stack.getTagCompound(); stack.getTagCompound().setTag("key", nbt); return null; } }
edit: my bad ^^
J’ai fais ça plus de crash:
public static class Handler implements IMessageHandler <packetkey, imessage="">{ public IMessage onMessage(PacketKey message, MessageContext ctx) { ItemStack stack = ctx.getServerHandler().playerEntity.inventory.getItemStack(); if(stack != null){ stack.setTagCompound(new NBTTagCompound()); NBTTagCompound nbt = (NBTTagCompound) stack.getTagCompound(); stack.getTagCompound().setTag("key", nbt); } return null; } }
Mais bon ça me lance une flèche normale au lieux d’une flèche en feu.
[21:25:20] [Server thread/INFO] [STDOUT]: [net.legacymod.items.FlameBow:onPlayerStoppedUsing:142]: flèche normale
Normalement ça doit exécute ça:
else if (!world.isRemote && stack.getTagCompound().hasKey("key")) { LegacyMod.network.sendToServer(new PacketArrow(f * 2.0F, 3)); System.out.println("flèche en feu"); //stack.getTagCompound().setInteger("timer2", 0); } ```</packetkey,></packetkey,>
-
Envoi le code du paquet, celui du ClientProxy et celui de la flèche
-
@‘SCAREX’:
Envoi le code du paquet, celui du ClientProxy et celui de la flèche
Paquet:
package net.legacymod.packets; import io.netty.buffer.ByteBuf; import net.legacymod.LegacyMod; import net.legacymod.gui.ClassesGUI; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; 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 PacketKey implements IMessage { public PacketKey(){ } @Override public void fromBytes(ByteBuf buf) { } @Override public void toBytes(ByteBuf buf) { } public static class Handler implements IMessageHandler <packetkey, imessage="">{ public IMessage onMessage(PacketKey message, MessageContext ctx) { ItemStack stack = ctx.getServerHandler().playerEntity.inventory.getItemStack(); if(stack != null){ stack.setTagCompound(new NBTTagCompound()); NBTTagCompound nbt = (NBTTagCompound) stack.getTagCompound(); stack.getTagCompound().setTag("key", nbt); } return null; } } }
ClientProxy:
@SubscribeEvent public void onEvent2(KeyInputEvent event) { if(keyBindSortG1.isPressed()) { keyTestTyped2(); } } private void keyTestTyped2() { LegacyMod.network.sendToServer(new PacketKey()); // c'est pas sendto ? il me semble que si mais j'ai du oublier de le modifier. }
Packet Arrow:
package net.legacymod.packets; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.util.Vec3; 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 PacketArrow implements IMessage{ private float f1; private int i; public PacketArrow(){ } public PacketArrow(float f, int i) { this.f1 = f; this.i = i; } @Override public void fromBytes(ByteBuf buf) { f1 = buf.readFloat(); i = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeFloat(f1); buf.writeInt(i); } public static class Handler implements IMessageHandler <packetarrow, imessage="">{ @Override public IMessage onMessage(PacketArrow message, MessageContext ctx) { EntityArrow entityarrow = new EntityArrow(ctx.getServerHandler().playerEntity.worldObj, ctx.getServerHandler().playerEntity, message.f1 + message.i); EntityArrow entityarrow2 = new EntityArrow(ctx.getServerHandler().playerEntity.worldObj, ctx.getServerHandler().playerEntity, message.f1 + message.i); EntityArrow entityarrow3 = new EntityArrow(ctx.getServerHandler().playerEntity.worldObj, ctx.getServerHandler().playerEntity, message.f1 + message.i); EntityArrow entityarrow4 = new EntityArrow(ctx.getServerHandler().playerEntity.worldObj, ctx.getServerHandler().playerEntity, message.f1 + message.i); EntityArrow entityarrow5 = new EntityArrow(ctx.getServerHandler().playerEntity.worldObj, ctx.getServerHandler().playerEntity, message.f1 + message.i); switch(message.i) { case 1: { entityarrow.getEntityData().setBoolean("isExplosive", true); ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(entityarrow); break; } case 2: { ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(entityarrow); ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(entityarrow2); ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(entityarrow3); ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(entityarrow4); ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(entityarrow5); Vec3 look = ctx.getServerHandler().playerEntity.getLookVec(); entityarrow.setPosition( ctx.getServerHandler().playerEntity.posX + look.xCoord, ctx.getServerHandler().playerEntity.posY + 1 + look.yCoord, ctx.getServerHandler().playerEntity.posZ + look.zCoord); entityarrow2.setPosition( ctx.getServerHandler().playerEntity.posX + 1 + look.xCoord, ctx.getServerHandler().playerEntity.posY + 1 + look.yCoord, ctx.getServerHandler().playerEntity.posZ + look.zCoord); entityarrow3.setPosition( ctx.getServerHandler().playerEntity.posX + look.xCoord, ctx.getServerHandler().playerEntity.posY + 1 + look.yCoord, ctx.getServerHandler().playerEntity.posZ + 1 + look.zCoord); entityarrow4.setPosition( ctx.getServerHandler().playerEntity.posX - 1 + look.xCoord, ctx.getServerHandler().playerEntity.posY + 1 + look.yCoord, ctx.getServerHandler().playerEntity.posZ + look.zCoord); entityarrow5.setPosition( ctx.getServerHandler().playerEntity.posX + look.xCoord, ctx.getServerHandler().playerEntity.posY + 1 + look.yCoord, ctx.getServerHandler().playerEntity.posZ - 1 + look.zCoord); break; } case 3: { ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(entityarrow); entityarrow.setFire(2 * 5); break; } default: break; } return null; } } } ```</packetarrow,></packetkey,>
-
C’est bien sendToServeur puisque ça va vers le serveur. En revanche y’a un truc que je comprends pas : pourquoi envoyer un PacketKey et me donner la classe PacketArrow ?
-
@‘SCAREX’:
C’est bien sendToServeur puisque ça va vers le serveur. En revanche y’a un truc que je comprends pas : pourquoi envoyer un PacketKey et me donner la classe PacketArrow ?
Tu as le packetKey et le packetarrow ^^
-
Oui mais à quoi sert le PacketArrow alors ?
D’ailleurs je ne comprends pas ce que tu veux faire avec ce code :
if(stack != null){ stack.setTagCompound(new NBTTagCompound()); // Tu supprimes tous les tags de l'item NBTTagCompound nbt = (NBTTagCompound) stack.getTagCompound(); // Ensuite tu récupères les tags (qui sont nuls désormais) stack.getTagCompound().setTag("key", nbt); // et tu mets les tags de l'item (qui sont nuls) dans un tag "key" dans l'item }