Création d'un mod client-side qui notifie son utilisateur quand son inventaire est full
-
Re : ya java, et java dans forge, savoir comment coder en java est bien, savoir l’appliquer avec forge et minecraft est autre chose.
après certaines modif, eclipse détecte aucune erreurs de syntaxes ou autres, donc je démarre le jeu, aucun soucis, mais ma class pour check si l’inventaire est full n’envois pas d’output (le message dans le chat par def), j’ai update le github avec la dernière version du code.
@EventHandler public void chkInv(TickEvent.ClientTickEvent event) { if(Minecraft.getMinecraft().player != null) { invChk invchk = new invChk(); } } }et ma class invChk :
package Gess.mod.scripts; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextComponentString; public class invChk { public void invChecker() { checkFreeSlot : { for(int i=0; i > 36; i++) { if(Minecraft.getMinecraft().player.inventory.getStackInSlot(i).equals(ItemStack.EMPTY)) { Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Your inventory is full")); break checkFreeSlot; } } } } }aussi, invoquer les bases de java à 5h du math est pas facile.
les logs :
2019-08-29 10:26:07,635 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream 2019-08-29 10:26:07,640 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream [10:26:08] [main/INFO] [GradleStart]: Extra: [] [10:26:08] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/samdra.r/.gradle/caches/minecraft/assets, --assetIndex, 1.12, --accessToken{REDACTED}, --version, 1.12.1, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [10:26:08] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [10:26:08] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [10:26:08] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [10:26:08] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [10:26:08] [main/INFO] [FML]: Forge Mod Loader version 14.22.1.2478 for Minecraft 1.12.1 loading [10:26:08] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_212, running on Windows 8.1:amd64:6.3, installed at C:\Program Files\Java\jre1.8.0_212 [10:26:08] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [10:26:08] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLCorePlugin (net.minecraftforge.fml.relauncher.FMLCorePlugin), we are in deobf and it's a forge core plugin [10:26:08] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLForgePlugin (net.minecraftforge.classloading.FMLForgePlugin), we are in deobf and it's a forge core plugin [10:26:08] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [10:26:08] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [10:26:08] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [10:26:08] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [10:26:08] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [10:26:08] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [10:26:08] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [10:26:08] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [10:26:08] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper 2019-08-29 10:26:09,146 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream 2019-08-29 10:26:09,860 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream 2019-08-29 10:26:09,869 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream [10:26:12] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [10:26:12] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [10:26:12] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [10:26:13] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [10:26:13] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [10:26:13] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [10:26:13] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [10:26:15] [main/INFO]: Setting user: Player867 [10:26:23] [main/WARN]: Skipping bad option: lastServer: [10:26:23] [main/INFO]: LWJGL Version: 2.9.4 [10:26:25] [main/INFO] [FML]: -- System Details -- Details: Minecraft Version: 1.12.1 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.8.0_212, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 730763808 bytes (696 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: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 431.60' Renderer: 'GeForce GT 1030/PCIe/SSE2' [10:26:25] [main/INFO] [FML]: MinecraftForge v14.22.1.2478 Initialized [10:26:25] [main/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients. [10:26:26] [main/INFO] [FML]: Replaced 1036 ore ingredients [10:26:26] [main/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer [10:26:26] [main/INFO] [FML]: Searching D:\Modding\Minecraft\fullinventorychecker\run\mods for mods [10:26:26] [main/WARN] [FML]: **************************************** [10:26:26] [main/WARN] [FML]: * The modid F is not the same as it's lowercase version. Lowercasing is enforced in 1.11 [10:26:26] [main/WARN] [FML]: * at net.minecraftforge.fml.common.FMLModContainer.sanityCheckModId(FMLModContainer.java:154) [10:26:26] [main/WARN] [FML]: * at net.minecraftforge.fml.common.FMLModContainer.<init>(FMLModContainer.java:135) [10:26:26] [main/WARN] [FML]: * at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [10:26:26] [main/WARN] [FML]: * at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [10:26:26] [main/WARN] [FML]: * at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [10:26:26] [main/WARN] [FML]: * at java.lang.reflect.Constructor.newInstance(Unknown Source)... [10:26:26] [main/WARN] [FML]: **************************************** [10:26:26] [main/ERROR] [FML]: Unable to construct net.minecraftforge.fml.common.Mod container java.lang.reflect.InvocationTargetException: null at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_212] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_212] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_212] at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_212] at net.minecraftforge.fml.common.ModContainerFactory.build(ModContainerFactory.java:90) [ModContainerFactory.class:?] at net.minecraftforge.fml.common.discovery.DirectoryDiscoverer.exploreFileSystem(DirectoryDiscoverer.java:135) [DirectoryDiscoverer.class:?] at net.minecraftforge.fml.common.discovery.DirectoryDiscoverer.exploreFileSystem(DirectoryDiscoverer.java:104) [DirectoryDiscoverer.class:?] at net.minecraftforge.fml.common.discovery.DirectoryDiscoverer.exploreFileSystem(DirectoryDiscoverer.java:104) [DirectoryDiscoverer.class:?] at net.minecraftforge.fml.common.discovery.DirectoryDiscoverer.discover(DirectoryDiscoverer.java:62) [DirectoryDiscoverer.class:?] at net.minecraftforge.fml.common.discovery.ContainerType.findMods(ContainerType.java:47) [ContainerType.class:?] at net.minecraftforge.fml.common.discovery.ModCandidate.explore(ModCandidate.java:78) [ModCandidate.class:?] at net.minecraftforge.fml.common.discovery.ModDiscoverer.identifyMods(ModDiscoverer.java:138) [ModDiscoverer.class:?] at net.minecraftforge.fml.common.Loader.identifyMods(Loader.java:403) [Loader.class:?] at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:543) [Loader.class:?] at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:227) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:508) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_212] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_212] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_212] 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_212] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_212] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_212] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_212] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: java.lang.IllegalArgumentException: The modid F is not the same as it's lowercase version. Lowercasing will be enforced in 1.11 at net.minecraftforge.fml.common.FMLModContainer.sanityCheckModId(FMLModContainer.java:155) ~[FMLModContainer.class:?] at net.minecraftforge.fml.common.FMLModContainer.<init>(FMLModContainer.java:135) ~[FMLModContainer.class:?] ... 30 more [10:26:28] [main/INFO] [FML]: Forge Mod Loader has identified 4 mods to load [10:26:28] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge] at CLIENT [10:26:28] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge] at SERVER [10:26:29] [Thread-3/INFO] [FML]: Using alternative sync timing : 200 frames of Display.update took 3432140805 nanos [10:26:30] [main/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge [10:26:30] [main/INFO] [FML]: Processing ObjectHolder annotations [10:26:30] [main/INFO] [FML]: Found 1168 ObjectHolder annotations [10:26:30] [main/INFO] [FML]: Identifying ItemStackHolder annotations [10:26:30] [main/INFO] [FML]: Found 0 ItemStackHolder annotations [10:26:30] [main/INFO] [FML]: Configured a dormant chunk cache size of 0 [10:26:30] [Forge Version Check/INFO] [ForgeVersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json [10:26:30] [main/INFO] [FML]: Applying holder lookups [10:26:30] [main/INFO] [FML]: Holder lookups applied [10:26:30] [main/INFO] [FML]: Applying holder lookups [10:26:30] [main/INFO] [FML]: Holder lookups applied [10:26:30] [main/INFO] [FML]: Applying holder lookups [10:26:30] [main/INFO] [FML]: Holder lookups applied [10:26:30] [main/INFO] [FML]: Applying holder lookups [10:26:30] [main/INFO] [FML]: Holder lookups applied [10:26:30] [main/INFO] [FML]: Injecting itemstacks [10:26:30] [main/INFO] [FML]: Itemstack injection complete [10:26:31] [Forge Version Check/INFO] [ForgeVersionCheck]: [forge] Found status: UP_TO_DATE Target: null [10:26:36] [Sound Library Loader/INFO]: Starting up SoundSystem... [10:26:36] [Thread-5/INFO]: Initializing LWJGL OpenAL [10:26:36] [Thread-5/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) AL lib: (EE) DoReset: Failed to initialize audio client: 0x88890017 Exception in thread "Thread-5" [10:26:36] [Thread-5/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: org.lwjgl.openal.OpenALException: Invalid Device [10:26:37] [Thread-5/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: at org.lwjgl.openal.Util.checkALCError(Util.java:55) [10:26:37] [Thread-5/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: at org.lwjgl.openal.ALC10.alcCreateContext(ALC10.java:251) [10:26:37] [Thread-5/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: at org.lwjgl.openal.AL.init(AL.java:173) [10:26:37] [Thread-5/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: at org.lwjgl.openal.AL.create(AL.java:143) [10:26:37] [Thread-5/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: at org.lwjgl.openal.AL.create(AL.java:102) [10:26:37] [Thread-5/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: at org.lwjgl.openal.AL.create(AL.java:206) [10:26:37] [Thread-5/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: at paulscode.sound.libraries.LibraryLWJGLOpenAL.init(LibraryLWJGLOpenAL.java:164) [10:26:37] [Thread-5/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: at paulscode.sound.SoundSystem.CommandNewLibrary(SoundSystem.java:1576) [10:26:37] [Thread-5/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: at paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2572) [10:26:37] [Thread-5/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: at paulscode.sound.CommandThread.run(CommandThread.java:121) [10:26:45] [main/INFO] [FML]: Max texture size: 16384 [10:26:46] [main/INFO]: Created: 512x512 textures-atlas [10:26:48] [main/INFO] [FML]: Applying holder lookups [10:26:48] [main/INFO] [FML]: Holder lookups applied [10:26:48] [main/INFO] [FML]: Injecting itemstacks [10:26:48] [main/INFO] [FML]: Itemstack injection complete [10:26:49] [main/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods [10:26:49] [main/WARN]: Skipping bad option: lastServer: [10:26:49] [main/INFO]: Narrator library for x64 successfully loaded [10:26:52] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id [10:27:16] [Sound Library Loader/WARN]: ERROR MESSAGE: [10:27:16] [Sound Library Loader/INFO]: SoundSystem did not load after 30 seconds. [10:27:16] [Sound Library Loader/INFO]: Starting up SoundSystem... [10:27:17] [Thread-8/INFO]: Switching to No Sound [10:27:17] [Thread-8/INFO]: (Silent Mode) [10:27:17] [Sound Library Loader/INFO]: Sound engine started [10:29:28] [Server thread/INFO]: Starting integrated minecraft server version 1.12.1 [10:29:28] [Server thread/INFO]: Generating keypair [10:29:28] [Server thread/INFO] [FML]: Injecting existing registry data into this server instance [10:29:28] [Server thread/INFO] [FML]: Applying holder lookups [10:29:28] [Server thread/INFO] [FML]: Holder lookups applied [10:29:29] [Server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@1f48151b) [10:29:30] [Server thread/INFO]: Loaded 488 advancements [10:29:30] [Server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@1f48151b) [10:29:30] [Server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@1f48151b) [10:29:30] [Server thread/INFO]: Preparing start region for level 0 [10:29:31] [Server thread/INFO]: Preparing spawn area: 31% [10:29:36] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 2 [10:29:36] [Netty Server IO #1/INFO] [FML]: Client protocol version 2 [10:29:36] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 4 mods : minecraft@1.12.1,FML@8.0.99.99,forge@14.22.1.2478,mcp@9.19 [10:29:36] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established [10:29:36] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [10:29:36] [Server thread/INFO]: Player867[local:E:e6561e55] logged in with entity id 53 at (-839.5, 4.0, -742.5) [10:29:36] [Server thread/INFO]: Player867 joined the game [10:29:39] [Server thread/INFO]: Saving and pausing game... [10:29:39] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:29:39] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:29:39] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:29:40] [pool-2-thread-1/WARN]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@5b3d8f3d[id=218a3571-b707-3992-b46a-db90429dc7f7,name=Player867,properties={},legacy=false] com.mojang.authlib.exceptions.AuthenticationException: The client has sent too many requests within a certain amount of time at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:79) ~[YggdrasilAuthenticationService.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:180) [YggdrasilMinecraftSessionService.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:60) [YggdrasilMinecraftSessionService$1.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:57) [YggdrasilMinecraftSessionService$1.class:?] at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3716) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2424) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2298) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2211) [guava-21.0.jar:?] at com.google.common.cache.LocalCache.get(LocalCache.java:4154) [guava-21.0.jar:?] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4158) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5147) [guava-21.0.jar:?] at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5153) [guava-21.0.jar:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:170) [YggdrasilMinecraftSessionService.class:?] at net.minecraft.client.Minecraft.getProfileProperties(Minecraft.java:3170) [Minecraft.class:?] at net.minecraft.client.resources.SkinManager$3.run(SkinManager.java:138) [SkinManager$3.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_212] at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_212] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_212] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_212] at java.lang.Thread.run(Unknown Source) [?:1.8.0_212] [10:29:43] [Server thread/INFO]: Saving and pausing game... [10:29:43] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:29:43] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:29:43] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:30:21] [Server thread/INFO]: Saving and pausing game... [10:30:21] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:30:21] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:30:21] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:30:32] [Server thread/INFO]: Saving and pausing game... [10:30:32] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:30:32] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:30:32] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:30:44] [main/INFO]: Loaded 2 advancements [10:31:12] [main/INFO]: [CHAT] The number you have entered (3000) is too big, it must be at most 64 [10:31:22] [main/INFO]: [CHAT] minecraft:coal, minecraft:coal_block, minecraft:coal_ore, minecraft:cobblestone, minecraft:cobblestone_wall, minecraft:command_block, minecraft:command_block_minecart, minecraft:comparator, minecraft:compass, minecraft:concrete, minecraft:concrete_powder, minecraft:cooked_beef, minecraft:cooked_chicken, minecraft:cooked_fish, minecraft:cooked_mutton, minecraft:cooked_porkchop, minecraft:cooked_rabbit, minecraft:cookie [10:31:28] [Server thread/INFO]: [Player867: Given [Command Block] * 1 to Player867] [10:31:28] [main/INFO]: [CHAT] Given [Command Block] * 1 to Player867 [10:31:31] [Server thread/INFO]: Saving and pausing game... [10:31:31] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:31:31] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:31:31] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:31:48] [main/INFO]: [CHAT] Command set: give @P minecraft:dirt 64 [10:32:09] [Server thread/INFO]: Saving and pausing game... [10:32:09] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:32:09] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:32:09] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:32:28] [main/INFO]: [CHAT] Command set: give @a minecraft:dirt 64 [10:32:30] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:32:30] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:32:31] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:32:31] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:32:33] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:32:33] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:32:40] [main/INFO]: Loaded 8 advancements [10:33:03] [Server thread/INFO]: Saving and pausing game... [10:33:03] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:33:03] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:33:03] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:33:07] [main/INFO]: [CHAT] Command set: give @a minecraft:dirt 64 [10:33:08] [Server thread/INFO]: Saving and pausing game... [10:33:08] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:33:08] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:33:08] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:33:16] [main/INFO]: Loaded 9 advancements [10:33:17] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:17] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:17] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:17] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:17] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:17] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:17] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:17] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:17] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:17] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:17] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:17] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: Loaded 10 advancements [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:18] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:18] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:19] [Server thread/INFO]: [@: Given [Dirt] * 64 to Player867] [10:33:19] [main/INFO]: [CHAT] [@: Given [Dirt] * 64 to Player867] [10:33:24] [main/WARN]: Unable to play empty soundEvent: minecraft:entity.small_slime.squish [10:33:25] [main/WARN]: Unable to play empty soundEvent: minecraft:entity.small_slime.jump [10:35:10] [Server thread/INFO]: Saving and pausing game... [10:35:10] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:35:10] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:35:10] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:36:56] [Server thread/INFO]: Saving and pausing game... [10:36:56] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:36:56] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:36:56] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:36:56] [Server thread/INFO]: Stopping server [10:36:56] [Server thread/INFO]: Saving players [10:36:56] [Server thread/INFO]: Player867 lost connection: Disconnected [10:36:56] [Server thread/INFO]: Player867 left the game [10:36:56] [Server thread/INFO]: Stopping singleplayer server as player logged out [10:36:56] [Server thread/INFO]: Saving worlds [10:36:56] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [10:36:56] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [10:36:56] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [10:36:56] [Server thread/INFO] [FML]: Unloading dimension 0 [10:36:56] [Server thread/INFO] [FML]: Unloading dimension -1 [10:36:56] [Server thread/INFO] [FML]: Unloading dimension 1 [10:36:57] [Server thread/INFO] [FML]: Applying holder lookups [10:36:57] [Server thread/INFO] [FML]: Holder lookups applied [10:37:15] [main/INFO]: Stopping! [10:37:15] [main/INFO]: SoundSystem shutting down... [10:37:15] [main/WARN]: Author: Paul Lamb, www.paulscode.com Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future releaseEDIT : fixed en partie, le modid aime pas les maj, le mod apparaissait pas, maintenant oui, mais la class ne donne toujours aucun output
also me:
[f]: The mod f appears to have an invalid event annotation EventHandler. This annotation can only apply to methods with recognized event arguments - it will not be called -
Tous les events sauf ceux d’initialisations doivent être annotés avec
@SubscribeEventet pas@EventHandler.
Ensuite, il serait bien de respecter les conventions de nommage de Java. -
@Superloup10 ma class ne donne aucun output avec @@SubscribeEvent aussi, donc …
C’est même ce que j’ai test après avoir utilisé @EventHandlerj’ai créer un nouveau monde au cas où, car je sait que dans d’autres mods que j’ai fais, ça m’a réglé pas mal de soucis de render ou d’évents
-
Envois ton code actuel
-
Main :
package Gess.mod; import Gess.mod.proxy.iProxy; import Gess.mod.scripts.invChk; import net.minecraft.client.Minecraft; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import util.Reference; @Mod(modid=Reference.MODID, name=Reference.MODNAME, version=Reference.VERSION) public class Main { public static Main instance; public static final String CLIENT = "gess.mod.proxy.ClientProxy"; public static final String SERVER = "gess.mod.proxy.CommonProxy"; @SidedProxy(clientSide = Reference.CLIENT, serverSide = Reference.COMMON) public static iProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event){} @EventHandler public void init(FMLInitializationEvent event){} @EventHandler public void postInit(FMLPostInitializationEvent event){} @SubscribeEvent public void chkInv(TickEvent.ClientTickEvent event) { if(Minecraft.getMinecraft().player != null) { invChk invchk = new invChk(); } } }invChk:
package Gess.mod.scripts; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextComponentString; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class invChk { @SubscribeEvent public void invChecker() { checkFreeSlot : { for(int i=0; i > 36; i++) { if(Minecraft.getMinecraft().player.inventory.getStackInSlot(i).equals(ItemStack.EMPTY)) { Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Your inventory is full")); break checkFreeSlot; } } } } }les forums officiel de forge m’ont conseillé d’utiliser TickEvent.PlayerTickEvent à la place mais ducoup faut que je trouve de mon côté comment le faire marcher.
donc si je peux faire marcher le mod avec l’event actuel, ça m’éviterais de perdre trop de temps.EDIT: j’ai éssayé avec un constructor à la place d’une class séparé, toujours la même chose
-
Ton event ClientTickEvent n’est jamais appelé car il n’est pas enregistré.
https://www.minecraftforgefrance.fr/topic/3948/les-événements#enregistrer-la-classe-contenant-les-événements -
tout est dans la même class maintenant :
package Gess.mod; import Gess.mod.proxy.iProxy; import net.minecraft.client.Minecraft; import net.minecraft.util.text.TextComponentString; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import util.Reference; @Mod(modid=Reference.MODID, name=Reference.MODNAME, version=Reference.VERSION) public class Main { public static Main instance; public static final String CLIENT = "gess.mod.proxy.ClientProxy"; public static final String SERVER = "gess.mod.proxy.CommonProxy"; @SidedProxy(clientSide = Reference.CLIENT, serverSide = Reference.COMMON) public static iProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event){} @EventHandler public void init(FMLInitializationEvent event){} @EventHandler public void postInit(FMLPostInitializationEvent event){} public Main() { for(int i=0; i < 37; i++) { if(!Minecraft.getMinecraft().player.inventory.getStackInSlot(i).isEmpty()) { Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Your inventory is full")); return; } } return; } @SubscribeEvent public static void chkInv(TickEvent.ClientTickEvent event) { if(Minecraft.getMinecraft().player != null) { Minecraft.getMinecraft().player.sendMessage(new TextComponentString("you're ingame")); Main main = new Main(); } } }j’éssaie de voir comment fix le problème de ticks maintenant
FIXED les messages s’envoient je dois juste mettre du delay entre les message pour éviter un spam intensif :
package Gess.mod; import Gess.mod.proxy.iProxy; import net.minecraft.client.Minecraft; import net.minecraft.util.text.TextComponentString; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import util.Reference; @EventBusSubscriber @Mod(modid=Reference.MODID, name=Reference.MODNAME, version=Reference.VERSION) public class Main { public static Main instance; public static final String CLIENT = "gess.mod.proxy.ClientProxy"; public static final String SERVER = "gess.mod.proxy.CommonProxy"; @SidedProxy(clientSide = Reference.CLIENT, serverSide = Reference.COMMON) public static iProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event){} @EventHandler public void init(FMLInitializationEvent event){} @EventHandler public void postInit(FMLPostInitializationEvent event){} public Main() { } @SubscribeEvent public static void chkInv(TickEvent.ClientTickEvent event) throws InterruptedException { if(Minecraft.getMinecraft().player != null) { int s = 0; for(int i=0; i < 37; i++) { if(!Minecraft.getMinecraft().player.inventory.getStackInSlot(i).isEmpty()) { s++; if(s > 35) { Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Your inventory is full")); return; } } } return; } } }le Seul truc que j’ai réussis à faire ces trois dernière heures c’est réussir à casser mon code, heuresement que j’ai la backup sur github^^ j’ai éssayer d’ajouter du délai entre chaque message et à chaque fois, plus aucun message apparaît.
j’ai notamment éssayé de call la méthod pour mon TickHandler(TickEvent.ClientTickEvent event) mais dès que j’éssaie de call la méthode via une instance, plus rien.
-
J’AI RIEN DIT! on peut utiliser getTotalWorldTime dans des method static apparement, ducoup ça marche! ya 10 secondes de délai entre chaques message, mais ducoup, quand la method est call avec full inv, il y a 2 messages qui apparaissent, je me demandais pourquoi.
package Gess.mod; import Gess.mod.proxy.iProxy; import net.minecraft.client.Minecraft; import net.minecraft.util.text.TextComponentString; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import util.Reference; @EventBusSubscriber @Mod(modid=Reference.MODID, name=Reference.MODNAME, version=Reference.VERSION) public class Main { public static Main instance; public static final String CLIENT = "gess.mod.proxy.ClientProxy"; public static final String SERVER = "gess.mod.proxy.CommonProxy"; @SidedProxy(clientSide = Reference.CLIENT, serverSide = Reference.COMMON) public static iProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event){} @EventHandler public void init(FMLInitializationEvent event){} @EventHandler public void postInit(FMLPostInitializationEvent event){} public Main() { } @SubscribeEvent public static void chkInv(TickEvent.ClientTickEvent event) throws InterruptedException { if(Minecraft.getMinecraft().player != null) { int s = 0; for(int i=0; i < 37; i++) { if(!Minecraft.getMinecraft().player.inventory.getStackInSlot(i).isEmpty()) { s++; if(s > 35) { if(Minecraft.getMinecraft().world.getTotalWorldTime() % 300 == 3L ) { Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Your inventory is full")); } } } } return; } } //@SideOnly(Side.CLIENT) //public void TickhHandler(TickEvent.ClientTickEvent event) throws InterruptedException { //wait(200); } //}j’ai update mon repo avec le code et une liste de choses que je doit encore faire avant de build et potentiellement release le mod
-
car tu teste en solo et que en solo tu es à la fois client et serveur
-
@isador34 nope, c’est aussi le cas sur server et puis le solo utilise aussi server.jar pour fonctionner
-
TickEvent.ClientTickEventn’est qu’appelé sur le client donc il n’y a pas de problème de double appel client + serveur.Le problème vient du fait que l’event est appelé deux fois par phase, au début du tick et à la fin.
Ajouter unif (event.phase == TickEvent.Phase.END)devrait régler le problème. -
@robin4002 Effectivement, j’avais oublié cette notion de phase
-
@robin4002 a dit dans Création d'un mod client-side qui notifie son utilisateur quand son inventaire est full :
if (event.phase == TickEvent.Phase.END)
C’est fais, àa marche, mais ducoup je me demandais aussi pourquoi le jeu met autant de temps avant de redémarrer un autre check même si je l’ai pas déclanché une nouvelle fois depuis les 300 ticks expiré, c’est sensé être un clienttickEvent nan?
ce serais pas un problème d’ordes par hasard? si oui je crois savoir qu’il faut que je run mon délai pour attendre après avoir envoyé le message je supose?Ma class actuellement
@SubscribeEvent public static void chkInv(TickEvent.ClientTickEvent event) throws InterruptedException { if(Minecraft.getMinecraft().player != null) { int s = 0; for(int i=0; i < 37; i++) { if(!Minecraft.getMinecraft().player.inventory.getStackInSlot(i).isEmpty() && Minecraft.getMinecraft() .player.inventory.getStackInSlot(i).getCount() == Minecraft.getMinecraft().player.inventory.getStackInSlot(i).getMaxStackSize()) { s++; if(s > 35) { if(Minecraft.getMinecraft().world.getTotalWorldTime() % 240 == 3L && event.phase == TickEvent.Phase.END) { Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Your inventory is full")); return; } } } } return; -
L’event est toujours appelé à chaque tick. 300 tick c’est 12 secondes, tu es sûr que le message ne s’affiche pas toutes les 12 secondes ? (au passage tes
returnne servent absolument à rien). -
@robin4002
je l’ai modifié, le message s’envois toutes les 12 secondes quand j’ai un inventaire plein, mais il faut attendre 12s quand je vais ingame pour que le premiers message apparaît, pareil quand je recupère un item au sol pour remplir l’inventaire, 12s après avoir recup l’item, le message est envoyé -
Vu comment ton code est fait c’est normal.
Il faudrait utiliser un boolean et mettre ceci sur false dès que le message est affiché et si elle est sur false lancer le compteur puis remettre sur true à la fin du compteur.
-
ya une fonction pour detecter un message client side?
si c’est pas le cas au pire j’ai juste à utiliser une variable right? -
Pourquoi tu veux une fonction pour ça ?
Tu as justement besoin d’une variable en effet. -
@robin4002 a dit dans Création d'un mod client-side qui notifie son utilisateur quand son inventaire est full :
Vu comment ton code est fait c’est normal.
Il faudrait utiliser un boolean et mettre ceci sur false dès que le message est affiché et si elle est sur false lancer le compteur puis remettre sur true à la fin du compteur.
donc je créer une bolean timer = true; au début de ma method chkInv, après mon message je met timer = !timer;:
mais je suis sensé lancer le check comment si je ne peux pas lancer le compteur en dehors de la boucle if?
je suis sensé run if(Minecraft.getMinecraft().world.getTotalWorldTime() % 240 == 3L ) comme première commande? comme genreEDIT: le message n’est plus déclenché donc j’ai ya un truc qui va pas, j’me relis 2s pour voir.
RE: je vois pas ce qui empêche le message de s’envoyer.
—> bon bas ma method n’a plus l’air de fonctionner dutout, pas d’errors, impossible de savoir d’où ça vient. même avec un manual undoEDIT2: les backups, c’est la vie. ducoup ma class de backup marche, juste perdu la boolean.
quand j’ai supprimé la bolean et que j’ai remis la fonction worldgetTotalWorldTime() manuellement à sa place, le problème étais toujours là, donc aucune idée de pourquoi j’ai eu le problème d’avant.@SubscribeEvent public static void chkInv(TickEvent.ClientTickEvent event) throws InterruptedException { boolean timer = false; if(Minecraft.getMinecraft().player != null ) { if(Minecraft.getMinecraft().world.getTotalWorldTime() % 200 == 3L && timer = false) int s = 0; for(int i=0; i < 37; i++) { if(!Minecraft.getMinecraft().player.inventory.getStackInSlot(i).isEmpty() && Minecraft.getMinecraft() .player.inventory.getStackInSlot(i).getCount() == Minecraft.getMinecraft().player.inventory.getStackInSlot(i).getMaxStackSize()) { s++; if(s > 35) { if(event.phase == TickEvent.Phase.END && timer == false) { Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Your inventory is full")); timer = !timer; return; } } return; } } } { return; } } -
j’étais en train de créer mon fichier de config puis j’ai tenté de démarrer le jeu mais ça a crash et la ligne “if(cfg.haschanged()) {” en serait la cause
mon fichier configpublic static void readConfig() { Configuration cfg = CommonProxy.config; try { cfg.load(); initGeneralConfig(cfg); } finally { if (cfg.hasChanged()) { cfg.save(); } } }le crash report :
net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Full Inventory Checker (fullinvchecker) Caused by: java.lang.NullPointerException at Gess.mod.config.Config.readConfig(Config.java:21) at Gess.mod.Main.preInit(Main.java:41) 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.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:611) 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.Subscriber.invokeSubscriberMethod(Subscriber.java:91) at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) at com.google.common.eventbus.EventBus.post(EventBus.java:217) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:253) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:231) 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.Subscriber.invokeSubscriberMethod(Subscriber.java:91) at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) at com.google.common.eventbus.EventBus.post(EventBus.java:217) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:148) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:604) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:266) at net.minecraft.client.Minecraft.init(Minecraft.java:508) at net.minecraft.client.Minecraft.run(Minecraft.java:416) at net.minecraft.client.main.Main.main(Main.java:118) 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:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) 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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:25)si jamais tu veux voir ma method preInit :
line 41 = Config.readConfig();@EventHandler public void preInit(FMLPreInitializationEvent event){ File directory = event.getModConfigurationDirectory(); config = new Configuration(new File(directory.getPath(), "FullInventoryChecker.cfg")); Config.readConfig(); }j’ai aussi éssayer de faire jouer un son du côté client avec Minecraft.getMinecraft().getSoundHandler().playSound(); mais ya une erreur dans mon code, quelque soit le code, j’ai éssayé de voir dans des exemples ou d’autres mods open source, mais ya rien qui marche
pour finir, je me demandais si dans
if(!Minecraft.getMinecraft().player.inventory.getStackInSlot(i).isEmpty() && Minecraft.getMinecraft() .player.inventory.getStackInSlot(i).getCount() == Minecraft.getMinecraft().player.inventory.getStackInSlot(i).getMaxStackSize())je pouvais ajouter l’ID d’un item comme exception car sur certain serveurs comme hypixel skyblock ou wynncraft, ya une limite custom de stacks par items .
je vais passer par un else et ajouter les ID manuellement, et si j’arrive à faire fonctionner ce fichier de config, alors j’ajouterais un filtre d’exception. je n’arrive pas à trouver comment comparer le stack trouvé avec getStackInSlot avec un item genre mineccraft:head (je supose je dois utiliser getItem() mais ya aucun moyen de savoir comment elle marche)
