[Extended Entity Properties] Crash lors du chargement du monde
-
Bonjour ! Bonsoir !
Je viens poster une erreur que Phénix et moi-même avons lors de la création d’un système de Mana un magnifique NPE !
Voici donc le code d’erreur suivie des différentes classes qui touchent l’Extended Entity Properties !
[20:39:28] [main/INFO] [GradleStart]: Extra: [] [20:39:28] [main/INFO] [GradleStart]: Running with arguments: [–userProperties, {}, --accessToken, {REDACTED}, --assetIndex, 1.8, --assetsDir, C:/Users/Jean-Baptiste/.gradle/caches/minecraft/assets, --version, 1.8, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker] [20:39:28] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [20:39:28] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [20:39:28] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker [20:39:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [20:39:28] [main/INFO] [FML]: Forge Mod Loader version 8.0.14.1280 for Minecraft 1.8 loading [20:39:28] [main/INFO] [FML]: Java is Java HotSpot(TM) Client VM, version 1.7.0_60, running on Windows 8.1:x86:6.3, installed at C:\Program Files (x86)\Java\jre7 [20:39:28] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [20:39:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker [20:39:28] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [20:39:28] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [20:39:28] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [20:39:28] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [20:39:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [20:39:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [20:39:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [20:39:29] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [20:39:31] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [20:39:31] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [20:39:31] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [20:39:31] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [20:39:31] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [20:39:31] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [20:39:32] [Client thread/INFO]: Setting user: Player109 [20:39:35] [Client thread/INFO]: LWJGL Version: 2.9.1 [20:39:36] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization [20:39:36] [Client thread/INFO] [FML]: MinecraftForge v11.14.0.1280 Initialized [20:39:36] [Client thread/INFO] [FML]: Replaced 204 ore recipies [20:39:36] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization [20:39:36] [Client thread/INFO] [FML]: Searching C:\Users\Jean-Baptiste\Desktop\Modding\JAVA\The Ender Scrolls - Minecraft 1.8\Forge\eclipse\mods for mods [20:39:36] [Client thread/INFO] [examplemod]: Mod examplemod is missing the required element 'name'. Substituting examplemod [20:39:40] [Client thread/INFO] [FML]: Forge Mod Loader has identified 6 mods to load [20:39:40] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, examplemod, tesm, ffmtlibs] at CLIENT [20:39:40] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, examplemod, tesm, ffmtlibs] at SERVER [20:39:40] [Client thread/INFO] [FFMTLibs]: Successful register packet : fr.zeamateis.tesm.common.network.packets.PacketMana with discriminator 1 [20:39:40] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:examplemod, FMLFileResourcePack:The Ender Scrolls; Minecraft, FMLFileResourcePack:FFMT Library [20:39:41] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [20:39:41] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations [20:39:41] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [20:39:41] [Client thread/INFO] [FML]: Applying holder lookups [20:39:41] [Client thread/INFO] [FML]: Holder lookups applied [20:39:41] [Sound Library Loader/INFO]: Starting up SoundSystem… [20:39:41] [Thread-7/INFO]: Initializing LWJGL OpenAL [20:39:41] [Thread-7/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [20:39:41] [Thread-7/INFO]: OpenAL initialized. [20:39:42] [Sound Library Loader/INFO]: Sound engine started [20:39:45] [Client thread/INFO]: Created: 512x512 textures-atlas [20:39:46] [Client thread/INFO] [STDOUT]: [com.example.examplemod.ExampleMod:init:18]: DIRT BLOCK >> tile.dirt [20:39:47] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 6 mods [20:39:47] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:examplemod, FMLFileResourcePack:The Ender Scrolls; Minecraft, FMLFileResourcePack:FFMT Library [20:39:47] [Client thread/INFO]: SoundSystem shutting down… [20:39:47] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com [20:39:47] [Sound Library Loader/INFO]: Starting up SoundSystem… [20:39:47] [Thread-9/INFO]: Initializing LWJGL OpenAL [20:39:47] [Thread-9/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [20:39:47] [Thread-9/INFO]: OpenAL initialized. [20:39:47] [Sound Library Loader/INFO]: Sound engine started [20:39:50] [Client thread/INFO]: Created: 512x512 textures-atlas [20:39:56] [Server thread/INFO]: Starting integrated minecraft server version 1.8 [20:39:56] [Server thread/INFO]: Generating keypair [20:39:56] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance [20:39:56] [Server thread/INFO] [FML]: Applying holder lookups [20:39:56] [Server thread/INFO] [FML]: Holder lookups applied [20:39:56] [Server thread/INFO] [FML]: Loading dimension 0 (Dev' Test World) (net.minecraft.server.integrated.IntegratedServer@18405ce) [20:39:56] [Server thread/INFO] [FML]: Loading dimension 1 (Dev' Test World) (net.minecraft.server.integrated.IntegratedServer@18405ce) [20:39:56] [Server thread/INFO] [FML]: Loading dimension -1 (Dev' Test World) (net.minecraft.server.integrated.IntegratedServer@18405ce) [20:39:56] [Server thread/INFO]: Preparing start region for level 0 [20:39:57] [Server thread/INFO]: Changing view distance to 8, from 10 [20:39:58] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 1 [20:39:58] [Netty Server IO #1/INFO] [FML]: Client protocol version 1 [20:39:58] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 6 mods : mcp@9.05,FML@8.0.14.1280,examplemod@1.0,Forge@11.14.0.1280,tesm@1.0,ffmtlibs@1.5.0.125 [20:39:58] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established [20:39:58] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [20:39:58] [Server thread/INFO]: Player109[local:E:3c2d2a08] logged in with entity id 1297 at (-728.907882799766, 4.0, -438.4770544187029) [20:39:58] [Server thread/INFO]: Player109 joined the game [20:39:58] [Netty Local Client IO #0/ERROR] [FML]: There was a critical exception handling a packet on channel tesmChannel java.lang.NullPointerException at fr.zeamateis.tesm.common.core.CustomPlayerProps.get(CustomPlayerProps.java:36) ~[CustomPlayerProps.class:?] at fr.zeamateis.tesm.common.network.packets.PacketMana.handleClientSide(PacketMana.java:28) ~[PacketMana.class:?] at fr.minecraftforgefrance.ffmtlibs.network.PacketHandler.channelRead0(PacketHandler.java:31) ~[PacketHandler.class:?] at fr.minecraftforgefrance.ffmtlibs.network.PacketHandler.channelRead0(PacketHandler.java:15) ~[PacketHandler.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:79) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:136) [NetworkManager.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:414) [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:342) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:219) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:47) [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.7.0_60] [20:39:58] [Server thread/INFO]: Player109 lost connection: TextComponent{text='Disconnected', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}} [20:39:58] [Server thread/INFO]: Player109 left the game [20:39:58] [Server thread/INFO]: Stopping singleplayer server as player logged out [20:39:59] [Server thread/INFO]: Stopping server [20:39:59] [Server thread/INFO]: Saving players [20:39:59] [Server thread/INFO]: Saving worlds [20:39:59] [Server thread/INFO]: Saving chunks for level 'Dev' Test World'/Overworld [20:39:59] [Server thread/INFO]: Saving chunks for level 'Dev' Test World'/Nether [20:39:59] [Server thread/INFO]: Saving chunks for level 'Dev' Test World'/The End [20:39:59] [Server thread/INFO] [FML]: Unloading dimension 0 [20:39:59] [Server thread/INFO] [FML]: Unloading dimension -1 [20:39:59] [Server thread/INFO] [FML]: Unloading dimension 1 [20:39:59] [Server thread/INFO] [FML]: Applying holder lookups [20:39:59] [Server thread/INFO] [FML]: Holder lookups applied [20:40:15] [Server thread/INFO]: Starting integrated minecraft server version 1.8 [20:40:15] [Server thread/INFO]: Generating keypair [20:40:15] [Server thread/INFO]: Converting map! [20:40:15] [Server thread/INFO]: Scanning folders… [20:40:15] [Server thread/INFO]: Total conversion count is 0 [20:40:15] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance [20:40:15] [Server thread/INFO] [FML]: Applying holder lookups [20:40:15] [Server thread/INFO] [FML]: Holder lookups applied [20:40:15] [Server thread/INFO] [FML]: Loading dimension 0 (Copy of Dev' Test World) (net.minecraft.server.integrated.IntegratedServer@11111d3) [20:40:17] [Server thread/INFO] [FML]: Loading dimension 1 (Copy of Dev' Test World) (net.minecraft.server.integrated.IntegratedServer@11111d3) [20:40:17] [Server thread/INFO] [FML]: Loading dimension -1 (Copy of Dev' Test World) (net.minecraft.server.integrated.IntegratedServer@11111d3) [20:40:17] [Server thread/INFO]: Preparing start region for level 0 [20:40:18] [Server thread/INFO]: Preparing spawn area: 51% [20:40:19] [Server thread/INFO]: Changing view distance to 8, from 10 [20:40:19] [Netty Local Client IO #1/INFO] [FML]: Server protocol version 1 [20:40:19] [Netty Server IO #3/INFO] [FML]: Client protocol version 1 [20:40:19] [Netty Server IO #3/INFO] [FML]: Client attempting to join with 6 mods : mcp@9.05,FML@8.0.14.1280,examplemod@1.0,Forge@11.14.0.1280,tesm@1.0,ffmtlibs@1.5.0.125 [20:40:19] [Netty Local Client IO #1/INFO] [FML]: [Netty Local Client IO #1] Client side modded connection established [20:40:19] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [20:40:19] [Server thread/INFO]: Player109[local:E:b06e3db6] logged in with entity id 2649 at (-720.5, 4.0, -439.5) [20:40:19] [Server thread/INFO]: Player109 joined the game [20:40:19] [Netty Local Client IO #1/ERROR] [FML]: There was a critical exception handling a packet on channel tesmChannel java.lang.NullPointerException at fr.zeamateis.tesm.common.core.CustomPlayerProps.get(CustomPlayerProps.java:36) ~[CustomPlayerProps.class:?] at fr.zeamateis.tesm.common.network.packets.PacketMana.handleClientSide(PacketMana.java:28) ~[PacketMana.class:?] at fr.minecraftforgefrance.ffmtlibs.network.PacketHandler.channelRead0(PacketHandler.java:31) ~[PacketHandler.class:?] at fr.minecraftforgefrance.ffmtlibs.network.PacketHandler.channelRead0(PacketHandler.java:15) ~[PacketHandler.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:79) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:136) [NetworkManager.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:414) [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:342) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:219) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:47) [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.7.0_60] [20:40:20] [Server thread/INFO]: Player109 lost connection: TextComponent{text='Disconnected', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}} [20:40:20] [Server thread/INFO]: Player109 left the game [20:40:20] [Server thread/INFO]: Stopping singleplayer server as player logged out [20:40:20] [Server thread/INFO]: Stopping server [20:40:20] [Server thread/INFO]: Saving players [20:40:20] [Server thread/INFO]: Saving worlds [20:40:20] [Server thread/INFO]: Saving chunks for level 'Copy of Dev' Test World'/Overworld [20:40:20] [Server thread/INFO]: Saving chunks for level 'Copy of Dev' Test World'/Nether [20:40:20] [Server thread/INFO]: Saving chunks for level 'Copy of Dev' Test World'/The End [20:40:21] [Server thread/INFO] [FML]: Unloading dimension 0 [20:40:21] [Server thread/INFO] [FML]: Unloading dimension -1 [20:40:21] [Server thread/INFO] [FML]: Unloading dimension 1 [20:40:21] [Server thread/INFO] [FML]: Applying holder lookups [20:40:21] [Server thread/INFO] [FML]: Holder lookups applied
Classe: CustomPlayerProps:
:::
package fr.zeamateis.tesm.common.core; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; 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.world.World; import net.minecraftforge.common.IExtendedEntityProperties; import fr.zeamateis.tesm.common.network.packets.PacketMana; public class CustomPlayerProps implements IExtendedEntityProperties { public static final String EXT_PROP_NAME = "TESMPlayerProperties"; private EntityPlayer player; public int maxMana; public int mana; public CustomPlayerProps(EntityPlayer player) { this.player = player; this.mana = 100; this.maxMana = 100; } @Override public void init(Entity entity, World world) { if (entity instanceof EntityPlayer && CustomPlayerProps.get((EntityPlayer)entity) == null) CustomPlayerProps.register((EntityPlayer)entity); } public static final void register(EntityPlayer player) { player.registerExtendedProperties(CustomPlayerProps.EXT_PROP_NAME, new CustomPlayerProps(player)); } public static final CustomPlayerProps get(EntityPlayer player) { return ((CustomPlayerProps)player.getExtendedProperties(EXT_PROP_NAME)); } @Override public void saveNBTData(NBTTagCompound compound) { NBTTagCompound properties = new NBTTagCompound(); properties.setLong("Mana", this.mana); properties.setLong("MaxMana", this.maxMana); compound.setTag(EXT_PROP_NAME, properties); } @Override public void loadNBTData(NBTTagCompound compound) { NBTTagCompound properties = (NBTTagCompound)compound.getTag(EXT_PROP_NAME); this.mana = properties.getInteger("Mana"); this.maxMana = properties.getInteger("MaxMana"); } //TODO public final void sync() { // ByteArrayOutputStream bos = new ByteArrayOutputStream(8); // DataOutputStream outputStream = new DataOutputStream(bos); // try // { // outputStream.writeInt(getCurrentMana()); // } // catch(Exception ex) // { // ex.printStackTrace(); // } PacketMana packetMoney = new PacketMana(this.maxMana, this.mana); TESMCore.packetManager.sendToServer(packetMoney); if (!this.player.worldObj.isRemote) { EntityPlayerMP player1 = (EntityPlayerMP)this.player; TESMCore.packetManager.sendTo(packetMoney, player1); } } private static String getSaveKey(EntityPlayer player) { return player.getDisplayName() + ":" + EXT_PROP_NAME; } public static void saveProxyData(EntityPlayer player) { CustomPlayerProps playerData = CustomPlayerProps.get(player); NBTTagCompound savedData = new NBTTagCompound(); playerData.saveNBTData(savedData); CommonProxy.storeEntityData(getSaveKey(player), savedData); } public static void loadProxyData(EntityPlayer player) { CustomPlayerProps playerData = CustomPlayerProps.get(player); NBTTagCompound savedData = CommonProxy.getEntityData(getSaveKey(player)); if (savedData != null) playerData.loadNBTData(savedData); playerData.sync(); } public boolean consumeMana(int amount) { if(amount <= this.mana) { removeMana(amount); return true; } return false; } public void replenishMana() { this.mana = this.maxMana; this.sync(); } public final void setMana(int amount) { this.mana = amount; sync(); } public final void removeMana(int amount) { this.mana -= amount; sync(); } public final void setMaxMana(int amount) { this.maxMana = (amount > 0 ? amount : 0); sync(); } }
:::
La classe PacketMana
:::
package fr.zeamateis.tesm.common.network.packets; import fr.minecraftforgefrance.ffmtlibs.network.FFMTPacket; import fr.zeamateis.tesm.common.core.CustomPlayerProps; import io.netty.buffer.ByteBuf; import java.io.IOException; import net.minecraft.entity.player.EntityPlayer; public class PacketMana extends FFMTPacket { private int mana, maxMana; public PacketMana() {} public PacketMana(int maxMana, int mana) { this.maxMana = maxMana; this.mana = mana; } @Override public void handleClientSide(EntityPlayer player) { CustomPlayerProps props = CustomPlayerProps.get(player); props.maxMana = this.maxMana; props.mana = this.mana; } @Override public void handleServerSide(EntityPlayer player) { CustomPlayerProps props = CustomPlayerProps.get(player); props.maxMana = this.maxMana; props.mana = this.mana; } @Override public void writeData(ByteBuf buffer) throws IOException { buffer.writeInt(maxMana); buffer.writeInt(mana); } @Override public void readData(ByteBuf buffer) { this.maxMana = buffer.readInt(); this.mana = buffer.readInt(); } @Override public int getDiscriminator() { return 1; } }
:::
Le pre-Init de la classe principale
:::
@EventHandler public void preInit(FMLPreInitializationEvent event) { GameRegistryBase.registerEvents(new ExtendedPlayerPropertiesEvent()); }
:::
La méthode “registerEvents”
public static void registerEvents(Object target) { FMLCommonHandler.instance().bus().register(target); MinecraftForge.EVENT_BUS.register(target); }
La classe de l’event du CustomPlayerProps
:::
package fr.zeamateis.tesm.common.event; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; 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.ItemCraftedEvent; import fr.zeamateis.tesm.common.core.CommonProxy; import fr.zeamateis.tesm.common.core.CustomPlayerProps; import fr.zeamateis.tesm.common.core.TESMCore; public class ExtendedPlayerPropertiesEvent { @SubscribeEvent public void onEntityConstructing(EntityConstructing event) { if (event.entity instanceof EntityPlayer && CustomPlayerProps.get((EntityPlayer) event.entity) == null) CustomPlayerProps.register((EntityPlayer) event.entity); } @SubscribeEvent public void onLivingDeathEvent(LivingDeathEvent event) { if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer) { NBTTagCompound playerData = new NBTTagCompound(); ((CustomPlayerProps)(event.entity.getExtendedProperties(CustomPlayerProps.EXT_PROP_NAME))).saveNBTData(playerData); TESMCore.proxy.storeEntityData(((EntityPlayer)event.entity).getName(), playerData); CustomPlayerProps.saveProxyData((EntityPlayer) event.entity); } } @SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent event) { if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer) { NBTTagCompound playerData = TESMCore.proxy.getEntityData(((EntityPlayer)event.entity).getName()); if (playerData != null) ((CustomPlayerProps) (event.entity.getExtendedProperties(CustomPlayerProps.EXT_PROP_NAME))).loadNBTData(playerData); ((CustomPlayerProps) (event.entity.getExtendedProperties(CustomPlayerProps.EXT_PROP_NAME))).sync(); } } @SubscribeEvent public void onPlayerCraft(ItemCraftedEvent event) { if(event.crafting.getItem() == Items.stick) { event.player.addChatMessage(new ChatComponentText("event est mana")); } } }
:::
Si une personne à déjà réalisé un système de Mana en 1.8 et qu’il a réussi je serais ravi de savoir d’où vient le problème !
Merci !
-
Dans sync() tu as:
PacketMana packetMoney = new PacketMana(this.maxMana, this.mana); TESMCore.packetManager.sendToServer(packetMoney);
Enveloppe le d’un
if(worldObj.isRemote){…}
pour être sûr que le packet ne soit pas envoyé du serveur vers le serveur et donc causer un NPE.
Vérifie aussi que l’instance de CustomPlayerProps ne soit pas nulle quand tu l’utilises dans handleClientSide(EntityPlayer)
J’espère que ça va t’avancer
-
Ah ! Nickel ça fonctionne !
Mais je viens de voir que le mana ne se sauvegarde pas, c’est pas normal ?
-
Tu fais un setLong, et ensuite un getInteger
Essaie de faire setInteger et getInteger
-
C’est ce que je viens de faire, toujours pareil