Résolu Recuper la variable lorsque le joueur spawn pour la tout première fois.
-
Alors voila je suis entrain de faire un mod qui fait en sorte d’attribuer un pouvoir lorsque le joueur spaw différent de celui d’un joueur numero deux par exemple pour cela j’aimerai que ce pouvoir soit attribuer des que le joueur spawn pour la premiere fois hors l’event EntityJoinWorldEvent s’active a chaque fois que le joeur join…
-
Salut,
Tu mets tout simplement une variable dans le tag nbt du joueur.
Si il n’a pas la variable, tu fais ton truc, sinon tu fais rien.if(!event.player.getEntityData().hasKey("quelquechose")) { // le joueur n'a pas la variable, c'est donc la première fois qu'il se connecte // je fais ce que je veux player.getEntityData().setBoolean("quelquechose", true); }
Et j’utiliserai plutôt PlayerLoggedInEvent
-
Merci sa fonctionne pour les intéressés voici le code en entier.
package portuar.otherWorld.common; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class EventClass { @SubscribeEvent public void deathEvent(EntityJoinWorldEvent event) { if(event.entity instanceof EntityPlayerMP) { if(!event.entity.getEntityData().hasKey("isAdded")) { event.entity.getEntityData().setBoolean("isAdded", true); } else { System.out.println("NO FIRST TIME !"); } } } }
-
j’ai un problème avec ce code je n’avais pas test mais quand on meurt sa se réinitialise.
-
Ah ? Je l’utilisais dans le mod cube3, je n’ai pas eu ce problème
-
Normal car les tag nbt sont reset à la mort d’une entity
-
je fais comment alors ?
-
Tu es sur que c’est pas un problème client / serveur ? Car normalement le tag est sensé rester …
Essaye avec event.entity instanceof EntityPlayer plutôt que EntityPlayerMP -
Bah j’ai testé et non j’ai aussi testé avec EntityPlaterSP
-
Et avec PlayerLoggedInEvent ?
-
Non non plus
-
Je viens de tester de mon côté, et en effet il perd la valeur, c’est étrange.
Sinon plutôt que passer par le tag nbt, tu pourra créer un fichier dans le dossier de la map, si le fichier existe pas, ba c’est le première fois et donc on le créé, sinon on ne fait rien.
Tu peux utiliser DimensionManager.getCurrentSaveRootDirectory() pour avoir le dossier de la save. -
Ouai mais sa devient compliquer, après faut stocker la valeur pour chaque joueur etc non, je pensais plutôt à utilisé les propriété d’entité grâce au tuto mais le problème est que je ne veux pas utilisé FMTT Api et que je n’ais aucune connaissance des packet.
-
Pas obliger de passer par ffmt lib, tu peux faire des paquets autrement.
http://www.minecraftforge.net/forum/index.php/topic,20135.0.html -
Ouai faut que je vois je reviendrais si j’ai des problème.
Dans son “tuto” la,
@Override public void fromBytes(ByteBuf buf) { text = ByteBufUtils.readUTF8String(buf); // this class is very useful in general for writing more complex objects } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf, text); }
je peux le faire qu’avec un String hors moi je veux un long
-
re up c’est bon j’ai reussi mais j’ai trois erreur :
CommonProxy.storeEntityData(getSaveKey(player), savedData); NBTTagCompound savedData = CommonProxy.getEntityData(getSaveKey(player)); proxy.storeEntityData(((EntityPlayer) event.entity).getDisplayName(), playerData);
-
https://github.com/Gugu42/RatchetAndClankMod/blob/master/java/com/gugu42/rcmod/CommonProxy.java#L16-L39
Visiblement il a oublié de donné ces fonctions dans le tutoriel. -
Oui il a oublier je testerai demain je te tient au courant!
-
Et non sa ah crash :s
[10:49:04] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker [10:49:04] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker [10:49:04] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker [10:49:04] [main/INFO] [FML]: Forge Mod Loader version 7.2.129.1047 for Minecraft 1.7.2 loading [10:49:04] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_51, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7 [10:49:04] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [10:49:04] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [10:49:04] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker [10:49:04] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [10:49:04] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [10:49:04] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [10:49:04] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [10:49:05] [main/ERROR] [FML]: The minecraft jar file:/D:/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.0.1047/forgeSrc-1.7.2-10.12.0.1047.jar!/net/minecraft/client/ClientBrandRetriever.class appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again! [10:49:05] [main/ERROR] [FML]: FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem! [10:49:05] [main/ERROR] [FML]: Technical information: ClientBrandRetriever was at jar:file:/D:/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.0.1047/forgeSrc-1.7.2-10.12.0.1047.jar!/net/minecraft/client/ClientBrandRetriever.class, there were 0 certificates for it [10:49:05] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [10:49:05] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [10:49:05] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker [10:49:05] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [10:49:06] [main/INFO]: Setting user: Player948 [10:49:07] [Client thread/INFO]: LWJGL Version: 2.9.0 [10:49:08] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization [10:49:08] [Client thread/INFO] [FML]: MinecraftForge v10.12.0.1047 Initialized [10:49:08] [Client thread/INFO] [FML]: Replaced 141 ore recipies [10:49:08] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization [10:49:08] [Client thread/INFO] [FML]: Searching D:\ModMinecraft\Cubic beyond\eclipse\mods for mods [10:49:08] [Client thread/ERROR] [FML]: FML has detected a mod that is using a package name based on 'net.minecraft.src' : net.minecraft.src.FMLRenderAccessLibrary. This is generally a severe programming error. There should be no mod code in the minecraft namespace. MOVE YOUR MOD! If you're in eclipse, select your source code and 'refactor' it into a new package. Go on. DO IT NOW! [10:49:10] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load [10:49:10] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:OtherWorld [10:49:10] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [10:49:10] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from PREINITIALIZATION to INITIALIZATION. Loading cannot continue [10:49:10] [Client thread/ERROR] [FML]: mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{7.2.129.1047} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1047.jar) Unloaded->Constructed->Pre-initialized Forge{10.12.0.1047} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1047.jar) Unloaded->Constructed->Pre-initialized otherworld{0.0.1} [OtherWorld] (bin) Unloaded->Constructed->Errored [10:49:10] [Client thread/ERROR] [FML]: The following problems were captured during this phase [10:49:10] [Client thread/ERROR] [FML]: Caught exception from otherworld java.lang.IllegalStateException: cannot determine the type of the type parameter 'REQ': class cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper at io.netty.util.internal.TypeParameterMatcher.fail(TypeParameterMatcher.java:171) ~[TypeParameterMatcher.class:?] at io.netty.util.internal.TypeParameterMatcher.find0(TypeParameterMatcher.java:165) ~[TypeParameterMatcher.class:?] at io.netty.util.internal.TypeParameterMatcher.find(TypeParameterMatcher.java:93) ~[TypeParameterMatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.<init>(SimpleChannelInboundHandler.java:60) ~[SimpleChannelInboundHandler.class:?] at io.netty.channel.SimpleChannelInboundHandler.<init>(SimpleChannelInboundHandler.java:50) ~[SimpleChannelInboundHandler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.<init>(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.getHandlerWrapper(SimpleNetworkWrapper.java:85) ~[SimpleNetworkWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.addServerHandlerAfter(SimpleNetworkWrapper.java:73) ~[SimpleNetworkWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:63) ~[SimpleNetworkWrapper.class:?] at portuar.otherWorld.client.MainClass.preInit(MainClass.java:45) ~[MainClass.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51] at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[FMLModContainer.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) ~[guava-15.0.jar:?] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:267) ~[guava-15.0.jar:?] at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:209) ~[LoadController.class:?] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188) ~[LoadController.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) ~[guava-15.0.jar:?] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:267) ~[guava-15.0.jar:?] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) [LoadController.class:?] at cpw.mods.fml.common.Loader.loadMods(Loader.java:495) [Loader.class:?] at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:201) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:564) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:934) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51] at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?] –-- Minecraft Crash Report ---- // I just don't know what went wrong :( Time: 17/06/14 10:49 Description: Initializing game java.lang.IllegalStateException: cannot determine the type of the type parameter 'REQ': class cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper at io.netty.util.internal.TypeParameterMatcher.fail(TypeParameterMatcher.java:171) at io.netty.util.internal.TypeParameterMatcher.find0(TypeParameterMatcher.java:165) at io.netty.util.internal.TypeParameterMatcher.find(TypeParameterMatcher.java:93) at io.netty.channel.SimpleChannelInboundHandler.<init>(SimpleChannelInboundHandler.java:60) at io.netty.channel.SimpleChannelInboundHandler.<init>(SimpleChannelInboundHandler.java:50) at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.<init>(SimpleChannelHandlerWrapper.java:17) at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.getHandlerWrapper(SimpleNetworkWrapper.java:85) at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.addServerHandlerAfter(SimpleNetworkWrapper.java:73) at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:63) at portuar.otherWorld.client.MainClass.preInit(MainClass.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:209) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) at cpw.mods.fml.common.Loader.loadMods(Loader.java:495) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:201) at net.minecraft.client.Minecraft.startGame(Minecraft.java:564) at net.minecraft.client.Minecraft.run(Minecraft.java:934) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at io.netty.util.internal.TypeParameterMatcher.fail(TypeParameterMatcher.java:171) at io.netty.util.internal.TypeParameterMatcher.find0(TypeParameterMatcher.java:165) at io.netty.util.internal.TypeParameterMatcher.find(TypeParameterMatcher.java:93) at io.netty.channel.SimpleChannelInboundHandler.<init>(SimpleChannelInboundHandler.java:60) at io.netty.channel.SimpleChannelInboundHandler.<init>(SimpleChannelInboundHandler.java:50) at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.<init>(SimpleChannelHandlerWrapper.java:17) at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.getHandlerWrapper(SimpleNetworkWrapper.java:85) at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.addServerHandlerAfter(SimpleNetworkWrapper.java:73) at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:63) at portuar.otherWorld.client.MainClass.preInit(MainClass.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:209) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) at cpw.mods.fml.common.Loader.loadMods(Loader.java:495) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:201) at net.minecraft.client.Minecraft.startGame(Minecraft.java:564) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:934) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) -- System Details -- Details: Minecraft Version: 1.7.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_51, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 872052424 bytes (831 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.01-pre FML v7.2.129.1047 Minecraft Forge 10.12.0.1047 4 mods loaded, 4 mods active mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{7.2.129.1047} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1047.jar) Unloaded->Constructed->Pre-initialized Forge{10.12.0.1047} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1047.jar) Unloaded->Constructed->Pre-initialized otherworld{0.0.1} [OtherWorld] (bin) Unloaded->Constructed->Errored Launched Version: 1.6 LWJGL: 2.9.0 OpenGL: GeForce GTX 560 Ti/PCI/SSE2 GL version 4.1.0, NVIDIA Corporation Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: English (US) Profiler Position: N/A (disabled) Vec3 Pool Size: ~~ERROR~~ NullPointerException: null Anisotropic Filtering: Off (1) #@!@# Game crashed! Crash report saved to: #@!@# D:\ModMinecraft\Cubic beyond\eclipse\.\crash-reports\crash-2014-06-17_10.49.10-client.txt
Il dise que l’erreur ce trouve dans ma main class ligne 45 c’est à dire
network.registerMessage(PacketAlteration.Handler.class, PacketAlteration.class, 0, Side.SERVER);
Doc sa doit venir du packet voila le code :
package portuar.otherWorld.client.alteration; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import net.minecraft.entity.player.EntityPlayer; 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 PacketAlteration implements IMessage { long maxMoney; long Money; public PacketAlteration(long maxMoney, long money) { this.maxMoney = maxMoney; this.Money = money; } @Override public void fromBytes(ByteBuf buf) { this.maxMoney = buf.readLong(); this.Money = buf.readLong(); } @Override public void toBytes(ByteBuf buf) { buf.writeLong(maxMoney); buf.writeLong(Money); } public void handleClientSide(EntityPlayer player) { ExtendedEntityPropAlteration props = ExtendedEntityPropAlteration.get(player); props.maxMoney = this.maxMoney; props.money = this.Money; } public void handleServerSide(EntityPlayer player) { ExtendedEntityPropAlteration props = ExtendedEntityPropAlteration.get(player); props.maxMoney = this.maxMoney; props.money = this.Money; } public static class Handler implements IMessageHandler <packetalteration, imessage="">{ @Override public IMessage onMessage(PacketAlteration message, MessageContext ctx) { return null; } } } ```</packetalteration,></init></init></init></init></init></init></init></init></init>
-
@‘robin4002’:
https://github.com/Gugu42/RatchetAndClankMod/blob/master/java/com/gugu42/rcmod/CommonProxy.java#L16-L39
Visiblement il a oublié de donné ces fonctions dans le tutoriel.Ah, j’avais oublié les fonctions sur le stockage des données entité ! ( Le truc des GUIs est différents )
Je vais les ajouter