Résolu Faire un compteur de tick (Bar de soif)
-
Alors déjà dans le “onMessage” de ton packet, tu ne fais rien, donc le packet devient inutile, il faut que tu affectes la valeur de soif du packet à ta capability.
Ensuite, pourrait-on avoir le plus important, le rapport de crash ? -
J’ai mis ceci :
@Override public IMessage onMessage(Message message, MessageContext ctx) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; IThirst thirst = player.getCapability(ThirstProvider.THIRST_CAP, null); thirst.set(thirstVal); return null; }
Et voici pour le crash report :
2017-06-04 14:30:18,876 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream 2017-06-04 14:30:18,882 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream [14:30:19] [main/INFO] [GradleStart]: Extra: [] [14:30:19] [main/INFO] [GradleStart]: Running with arguments: [–userProperties, {}, --assetsDir, C:/Users/user/.gradle/caches/minecraft/assets, --assetIndex, 1.8, --accessToken{REDACTED}, --version, 1.8.9, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [14:30:19] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [14:30:19] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [14:30:19] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [14:30:19] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [14:30:19] [main/INFO] [FML]: Forge Mod Loader version 11.15.1.1747 for Minecraft 1.8.9 loading [14:30:19] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_121, running on Windows 8.1:amd64:6.3, installed at C:\Program Files\Java\jre1.8.0_121 [14:30:19] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [14:30:19] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [14:30:19] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [14:30:19] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [14:30:19] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [14:30:19] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [14:30:19] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [14:30:19] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [14:30:19] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [14:30:19] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [14:30:19] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [14:30:21] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [14:30:21] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [14:30:21] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [14:30:23] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [14:30:23] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [14:30:23] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [14:30:23] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} 2017-06-04 14:30:24,317 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream 2017-06-04 14:30:24,391 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream 2017-06-04 14:30:24,394 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream [14:30:24] [Client thread/INFO]: Setting user: Player943 [14:30:31] [Client thread/INFO]: LWJGL Version: 2.9.4 [14:30:33] [Client thread/WARN] [FML]: ============================================================= [14:30:33] [Client thread/WARN] [FML]: MOD HAS DIRECT REFERENCE System.exit() THIS IS NOT ALLOWED REROUTING TO FML! [14:30:33] [Client thread/WARN] [FML]: Offendor: com/sun/jna/Native.main([Ljava/lang/String;)V [14:30:33] [Client thread/WARN] [FML]: Use FMLCommonHandler.exitJava instead [14:30:33] [Client thread/WARN] [FML]: ============================================================= [14:30:34] [Client thread/INFO] [STDOUT]: [net.minecraftforge.fml.client.SplashProgress:start:246]: –-- Minecraft Crash Report ---- // Quite honestly, I wouldn't worry myself about that. Time: 04/06/17 14:30 Description: Loading screen debug info This is just a prompt for computer specs to be printed. THIS IS NOT A ERROR A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.8.9 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.8.0_121, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 787543920 bytes (751 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: Loaded coremods (and transformers): GL info: ' Vendor: 'Intel' Version: '4.0.0 - Build 10.18.10.3621' Renderer: 'Intel(R) HD Graphics 4000' [14:30:34] [Client thread/INFO] [FML]: MinecraftForge v11.15.1.1747 Initialized [14:30:34] [Client thread/INFO] [FML]: Replaced 204 ore recipies [14:30:35] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer [14:30:35] [Client thread/INFO] [FML]: Searching C:\Users\user\Desktop\forge-1.8.9-11.15.1.1747-mdk\run\mods for mods [14:30:38] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load [14:30:38] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, survivant] at CLIENT [14:30:38] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, survivant] at SERVER [14:30:40] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Mod Survivant [14:30:40] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [14:30:40] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations [14:30:40] [Client thread/INFO] [FML]: Identifying ItemStackHolder annotations [14:30:40] [Client thread/INFO] [FML]: Found 0 ItemStackHolder annotations [14:30:40] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [14:30:40] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json [14:30:40] [Client thread/INFO] [FML]: Applying holder lookups [14:30:40] [Client thread/INFO] [FML]: Holder lookups applied [14:30:40] [Client thread/INFO] [FML]: Injecting itemstacks [14:30:40] [Client thread/INFO] [FML]: Itemstack injection complete [14:30:41] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Found status: OUTDATED Target: 11.15.1.1902 [14:30:41] [Sound Library Loader/INFO]: Starting up SoundSystem… [14:30:41] [Thread-9/INFO]: Initializing LWJGL OpenAL [14:30:41] [Thread-9/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [14:30:42] [Thread-9/INFO]: OpenAL initialized. [14:30:42] [Sound Library Loader/INFO]: Sound engine started [14:30:56] [Client thread/INFO] [FML]: Max texture size: 8192 [14:30:56] [Client thread/INFO]: Created: 16x16 textures-atlas [14:30:57] [Client thread/ERROR] [FML]: Model definition for location survivant:blockBanana#inventory not found [14:30:57] [Client thread/ERROR] [FML]: Model definition for location survivant:blockCoconut#inventory not found [14:30:58] [Client thread/INFO] [FML]: Injecting itemstacks [14:30:58] [Client thread/INFO] [FML]: Itemstack injection complete [14:30:59] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods [14:30:59] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Mod Survivant [14:30:59] [Client thread/INFO]: SoundSystem shutting down… [14:30:59] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com [14:30:59] [Sound Library Loader/INFO]: Starting up SoundSystem… [14:30:59] [Thread-11/INFO]: Initializing LWJGL OpenAL [14:30:59] [Thread-11/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [14:30:59] [Thread-11/INFO]: OpenAL initialized. [14:30:59] [Sound Library Loader/INFO]: Sound engine started [14:31:09] [Client thread/INFO] [FML]: Max texture size: 8192 [14:31:11] [Client thread/INFO]: Created: 512x512 textures-atlas [14:31:11] [Client thread/ERROR] [FML]: Model definition for location survivant:blockBanana#inventory not found [14:31:11] [Client thread/ERROR] [FML]: Model definition for location survivant:blockCoconut#inventory not found [14:31:19] [Server thread/INFO]: Starting integrated minecraft server version 1.8.9 [14:31:19] [Server thread/INFO]: Generating keypair [14:31:19] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance [14:31:19] [Server thread/INFO] [FML]: Found a missing id from the world survivant:blockCampfire [14:31:19] [Server thread/INFO] [FML]: Found a missing id from the world survivant:block_potable_water [14:31:19] [Server thread/INFO] [FML]: Found a missing id from the world survivant:blockManioc [14:31:19] [Server thread/INFO] [FML]: Found a missing id from the world survivant:block2 [14:31:19] [Server thread/INFO] [FML]: Found a missing id from the world survivant:blockSurvivalBed [14:31:19] [Server thread/INFO] [FML]: Found a missing id from the world survivant:blockSaltWater [14:31:19] [Server thread/INFO] [FML]: Applying holder lookups [14:31:19] [Server thread/INFO] [FML]: Holder lookups applied [14:31:19] [Server thread/INFO] [FML]: Loading dimension 0 (Mod survivant) (net.minecraft.server.integrated.IntegratedServer@41db268d) [14:31:19] [Server thread/INFO] [FML]: Loading dimension 1 (Mod survivant) (net.minecraft.server.integrated.IntegratedServer@41db268d) [14:31:19] [Server thread/INFO] [FML]: Loading dimension -1 (Mod survivant) (net.minecraft.server.integrated.IntegratedServer@41db268d) [14:31:19] [Server thread/INFO]: Preparing start region for level 0 [14:31:21] [Server thread/INFO]: Preparing spawn area: 42% [14:31:21] [Server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.fml.common.gameevent.TickEvent$ServerTickEvent@29adea34: java.lang.NullPointerException at com.survivant.mod.SurvivantThirstBar.playerTick(SurvivantThirstBar.java:64) ~[SurvivantThirstBar.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_12_SurvivantThirstBar_playerTick_ServerTickEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:49) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140) [EventBus.class:?] at net.minecraftforge.fml.common.FMLCommonHandler.onPreServerTick(FMLCommonHandler.java:266) [FMLCommonHandler.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:670) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:159) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:548) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_121] [14:31:21] [Server thread/ERROR] [FML]: Index: 1 Listeners: [14:31:21] [Server thread/ERROR] [FML]: 0: NORMAL [14:31:21] [Server thread/ERROR] [FML]: 1: ASM: com.survivant.mod.SurvivantThirstBar@2149532d playerTick(Lnet/minecraftforge/fml/common/gameevent/TickEvent$ServerTickEvent;)V [14:31:21] [Server thread/ERROR]: Encountered an unexpected exception java.lang.NullPointerException at com.survivant.mod.SurvivantThirstBar.playerTick(SurvivantThirstBar.java:64) ~[SurvivantThirstBar.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_12_SurvivantThirstBar_playerTick_ServerTickEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:49) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140) ~[EventBus.class:?] at net.minecraftforge.fml.common.FMLCommonHandler.onPreServerTick(FMLCommonHandler.java:266) ~[FMLCommonHandler.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:670) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:159) ~[IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:548) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_121] [14:31:21] [Server thread/ERROR]: This crash report has been saved to: C:\Users\user\Desktop\forge-1.8.9-11.15.1.1747-mdk\run\.\crash-reports\crash-2017-06-04_14.31.21-server.txt [14:31:21] [Server thread/INFO]: Stopping server [14:31:21] [Server thread/INFO]: Saving players [14:31:21] [Server thread/INFO]: Saving worlds [14:31:21] [Server thread/INFO]: Saving chunks for level 'Mod survivant'/Overworld [14:31:21] [Server thread/INFO]: Saving chunks for level 'Mod survivant'/Nether [14:31:21] [Server thread/INFO]: Saving chunks for level 'Mod survivant'/The End [14:31:21] [Server thread/INFO] [FML]: Unloading dimension 0 [14:31:21] [Server thread/INFO] [FML]: Unloading dimension -1 [14:31:21] [Server thread/INFO] [FML]: Unloading dimension 1 [14:31:21] [Server thread/INFO] [FML]: Applying holder lookups [14:31:21] [Server thread/INFO] [FML]: Holder lookups applied [14:31:21] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded. [14:31:22] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:612]: –-- Minecraft Crash Report ---- // You're mean. Time: 04/06/17 14:31 Description: Exception in server tick loop java.lang.NullPointerException: Exception in server tick loop at com.survivant.mod.SurvivantThirstBar.playerTick(SurvivantThirstBar.java:64) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_12_SurvivantThirstBar_playerTick_ServerTickEvent.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:49) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140) at net.minecraftforge.fml.common.FMLCommonHandler.onPreServerTick(FMLCommonHandler.java:266) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:670) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:159) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:548) at java.lang.Thread.run(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.8.9 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.8.0_121, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 821776008 bytes (783 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP 9.19 Powered by Forge 11.15.1.1747 4 mods loaded, 4 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCHIJAAAA mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8.9-11.15.1.1747.jar) UCHIJAAAA Forge{11.15.1.1747} [Minecraft Forge] (forgeSrc-1.8.9-11.15.1.1747.jar) UCHIJAAAA survivant{1.0.0} [Mod Survivant] (bin) Loaded coremods (and transformers): GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. Profiler Position: N/A (disabled) Player Count: 0 / 8; [] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' [14:31:22] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:612]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2017-06-04_14.31.21-server.txt AL lib: (EE) alc_cleanup: 1 device not closed Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
Merci par avance.
-
@SubscribeEvent public void playerTick(TickEvent.ServerTickEvent event) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; … }
Tu ne peut pas récupérer le joueur de cette façon car cela est faisable seulement côté client or ServerTickEvent se fait côté serveur.
Remplace ServerTickEvent par PlayerTickEvent et check si event.side est égal à side.server :@SubscribeEvent public void playerTick(TickEvent.PlayerTickEvent event) { if(event.side == Side.SERVER){ IThirst thirst = event.player.getCapability(ThirstProvider.THIRST_CAP, null); //fais tout ce que tu doit faire ici } }
-
C’est presque bon, mes deux problèmes sont réglés, le seul petit souci est que lorsque je me reconnecte et que ma bar de soif était à 66 par exemple, pendant un instant on dirait qu’elle est pleine (or ce n’est pas le cas), mais lorsque la valeur de la bar de soif diminue de 1, visuellement elle prend la valeur 65.
Peut-être que cela ce règle dans la fonction onPlayerLogIn mais je n’ai aucune idée de comment faire ceci.
Merci d’avance. -
Oui cela peut se fixer avec l’utilisation de l’event PlayerLoggedInEvent, il suffira alors d’envoyer le packet comme tu le fais quand tu diminues la soif via l’event PlayerTickEvent.
-
Lorsque je me suis connecté, la bar de soif était bien visuellement à 65, mais lorsque j’ai quitté le monde puis que je suis revenu, le monde ne c’est pas chargé (je suis revenu au menu principale). Dans la fonction playerLogsIn j’ai mis ceci :
@SubscribeEvent public void onPlayerLogsIn(PlayerLoggedInEvent event) { EntityPlayer player = event.player; IThirst thirst = player.getCapability(ThirstProvider.THIRST_CAP, null); ModSurvivant.network.sendTo(new Message(thirst.getThirst()), (EntityPlayerMP)player); }
Voici ce qu’il y a dans la console :
[14:54:55] [Client thread/FATAL]: Error executing task java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_121] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_121] at net.minecraft.util.Util.runTask(Util.java:23) [Util.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1070) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:380) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:116) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.NullPointerException at net.minecraft.client.network.NetHandlerPlayClient.handleSetSlot(NetHandlerPlayClient.java:1154) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.S2FPacketSetSlot.processPacket(S2FPacketSetSlot.java:33) ~[S2FPacketSetSlot.class:?] at net.minecraft.network.play.server.S2FPacketSetSlot.processPacket(S2FPacketSetSlot.java:11) ~[S2FPacketSetSlot.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_121] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_121] at net.minecraft.util.Util.runTask(Util.java:22) ~[Util.class:?] … 15 more
Merci par avance.
-
Change
@Override public IMessage onMessage(Message message, MessageContext ctx) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; IThirst thirst = player.getCapability(ThirstProvider.THIRST_CAP, null); thirst.set(thirstVal); return null; }
Par
@Override public IMessage onMessage(Message message, MessageContext ctx) { Minecraft.getMinecraft().addScheduledTask(new Runnable() { @Override public void run() { EntityPlayer player = Minecraft.getMinecraft().thePlayer; IThirst thirst = player.getCapability(ThirstProvider.THIRST_CAP, null); thirst.set(message.thirstVal); } }); return null; }
-
Ca marche !!! Merci à tous pour votre aide.
Aussi, pour éclairer ceux qui chercherait à faire une chose semblable, je met en pièce jointe les classes relative à ce système de soif.Encore merci.