Non résolu Commande pour modifier l'item qui est dans la Main
-
Bonjour,
J’aimerai creer une commande /rename pour renommez a sa guise l’item en main, pouvez vous m’aider ? -
Salut, as-tu lu le tutoriel sur les commandes ?
Si tu as déjà lu ce dernier, peux-tu nous indiquer sur quelle partie tu bloques ?
-
oui mais j’ai ça :
[18:46:50] [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_181] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_181] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_181] at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_181] at net.minecraftforge.fml.common.ModContainerFactory.build(ModContainerFactory.java:73) [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.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:74) [ModCandidate.class:?] at net.minecraftforge.fml.common.discovery.ModDiscoverer.identifyMods(ModDiscoverer.java:93) [ModDiscoverer.class:?] at net.minecraftforge.fml.common.Loader.identifyMods(Loader.java:425) [Loader.class:?] at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:566) [Loader.class:?] at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:232) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:513) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181] 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_181] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: java.lang.IllegalArgumentException: The modId MapMakerCommands must be all lowercase. at net.minecraftforge.fml.common.FMLModContainer.sanityCheckModId(FMLModContainer.java:146) ~[FMLModContainer.class:?] at net.minecraftforge.fml.common.FMLModContainer.<init>(FMLModContainer.java:130) ~[FMLModContainer.class:?] ... 31 more
ma classe principale :
import net.minecraft.init.Blocks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; 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.event.FMLServerStartedEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import org.apache.logging.log4j.Logger; import com.sun.webkit.graphics.Ref; import fr.eno.mmc.commands.CommandRename; import fr.eno.mmc.events.RegisteringEvent; import fr.eno.mmc.proxy.ClientProxy; import fr.eno.mmc.proxy.CommonProxy; @Mod(modid = Reference.MOD_ID, version = Reference.VERSION, name = Reference.MOD_NAME) public class MapMakerCommandsBase { private static Logger logger; @Mod.Instance(Reference.MOD_ID) public static MapMakerCommandsBase instance; @SidedProxy(clientSide = "fr.eno.mmc.proxy.ClientProxy", serverSide = "fr.eno.mmc.proxy.CommonProxy") public static CommonProxy proxy; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { proxy.preinit(event); } @Mod.EventHandler public void init(FMLInitializationEvent event) { proxy.init(event); } @Mod.EventHandler public void postinit(FMLPostInitializationEvent event) { proxy.postinit(event); } @EventHandler public void serverStarting(FMLServerStartingEvent event) { event.registerServerCommand(new CommandRename()); } }
ma classe de commande :
package fr.eno.mmc.commands; import java.util.List; import javax.annotation.Nullable; import fr.eno.mmc.MapMakerCommandsBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; import net.minecraftforge.client.IClientCommand; public class CommandRename extends MapMakerCommandsBase implements ICommand { public int compareTo(ICommand arg0) { return 0; } public String getName() { return "rename"; } public String getUsage(ICommandSender sender) { return "commands.rename.usage"; } public void execute(MinecraftServer server, ICommandSender sender, String[] strings) throws CommandException { if(sender instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) sender; player.inventory.getCurrentItem().getDisplayName().equals(strings); } } public boolean checkPermission(MinecraftServer server, ICommandSender sender) { return true; } public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) { return null; } public List<String> getAliases() { return null; } public boolean isUsernameIndex(String[] args, int index) { return false; } }
-
Il y a une autre fonction à override, c’est
getRequiredPermissionLevel
-
oui mais j’ai quand meme ça :
[18:46:50] [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_181] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_181] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_181] at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_181] at net.minecraftforge.fml.common.ModContainerFactory.build(ModContainerFactory.java:73) [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.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:74) [ModCandidate.class:?] at net.minecraftforge.fml.common.discovery.ModDiscoverer.identifyMods(ModDiscoverer.java:93) [ModDiscoverer.class:?] at net.minecraftforge.fml.common.Loader.identifyMods(Loader.java:425) [Loader.class:?] at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:566) [Loader.class:?] at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:232) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:513) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181] 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_181] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: java.lang.IllegalArgumentException: The modId MapMakerCommands must be all lowercase. at net.minecraftforge.fml.common.FMLModContainer.sanityCheckModId(FMLModContainer.java:146) ~[FMLModContainer.class:?] at net.minecraftforge.fml.common.FMLModContainer.<init>(FMLModContainer.java:130) ~[FMLModContainer.class:?] ... 31 more
ma classe principale :
import net.minecraft.init.Blocks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; 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.event.FMLServerStartedEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import org.apache.logging.log4j.Logger; import com.sun.webkit.graphics.Ref; import fr.eno.mmc.commands.CommandRename; import fr.eno.mmc.events.RegisteringEvent; import fr.eno.mmc.proxy.ClientProxy; import fr.eno.mmc.proxy.CommonProxy; @Mod(modid = Reference.MOD_ID, version = Reference.VERSION, name = Reference.MOD_NAME) public class MapMakerCommandsBase { private static Logger logger; @Mod.Instance(Reference.MOD_ID) public static MapMakerCommandsBase instance; @SidedProxy(clientSide = "fr.eno.mmc.proxy.ClientProxy", serverSide = "fr.eno.mmc.proxy.CommonProxy") public static CommonProxy proxy; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { proxy.preinit(event); } @Mod.EventHandler public void init(FMLInitializationEvent event) { proxy.init(event); } @Mod.EventHandler public void postinit(FMLPostInitializationEvent event) { proxy.postinit(event); } @EventHandler public void serverStarting(FMLServerStartingEvent event) { event.registerServerCommand(new CommandRename()); } }
ma classe de commande :
package fr.eno.mmc.commands; import java.util.List; import javax.annotation.Nullable; import fr.eno.mmc.MapMakerCommandsBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; import net.minecraftforge.client.IClientCommand; public class CommandRename extends MapMakerCommandsBase implements ICommand { public int compareTo(ICommand arg0) { return 0; } public String getName() { return "rename"; } public String getUsage(ICommandSender sender) { return "commands.rename.usage"; } public void execute(MinecraftServer server, ICommandSender sender, String[] strings) throws CommandException { if(sender instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) sender; player.inventory.getCurrentItem().getDisplayName().equals(strings); } } public boolean checkPermission(MinecraftServer server, ICommandSender sender) { return true; } public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) { return null; } public List<String> getAliases() { return null; } public boolean isUsernameIndex(String[] args, int index) { return false; } public int getRequiredPermissionLevel() { return 2; } }
-
Lis bien le message d’erreur :
The modId MapMakerCommands must be all lowercase.
Je ne vois pas comment on peut être plus explicite. -
oui mince j’avais pas vu merci !
mais dans le chargement d’un monde j’ai ça :[19:29:22] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STARTING and forced into state SERVER_STOPPED. Errors may have been discarded.
-
Il faudrait les logs complets pour savoir quel est le problème.
-
voila les logs complets :
2018-12-19 19:28:23,124 main ERROR Unable to move file C:\Users\*\Desktop\Eno\Dev\Forge-Directory 1.12.2\run\logs\latest.log to C:\Users\*\Desktop\Eno\Dev\Forge-Directory 1.12.2\run\logs\2018-12-19-6.log: java.nio.file.FileSystemException C:\Users\*\Desktop\Eno\Dev\Forge-Directory 1.12.2\run\logs\latest.log -> C:\Users\*\Desktop\Eno\Dev\Forge-Directory 1.12.2\run\logs\2018-12-19-6.log: Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus. 2018-12-19 19:28:23,131 main ERROR Unable to delete file C:\Users\*\Desktop\Eno\Dev\Forge-Directory 1.12.2\run\logs\latest.log: java.nio.file.FileSystemException C:\Users\*\Desktop\Eno\Dev\Forge-Directory 1.12.2\run\logs\latest.log: Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus. 2018-12-19 19:28:23,154 main ERROR Unable to move file C:\Users\*\Desktop\Eno\Dev\Forge-Directory 1.12.2\run\logs\debug.log to C:\Users\*\Desktop\Eno\Dev\Forge-Directory 1.12.2\run\logs\debug-1.log: java.nio.file.FileSystemException C:\Users\*\Desktop\Eno\Dev\Forge-Directory 1.12.2\run\logs\debug.log -> C:\Users\*\Desktop\Eno\Dev\Forge-Directory 1.12.2\run\logs\debug-1.log: Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus. 2018-12-19 19:28:23,161 main ERROR Unable to delete file C:\Users\*\Desktop\Eno\Dev\Forge-Directory 1.12.2\run\logs\debug.log: java.nio.file.FileSystemException C:\Users\*\Desktop\Eno\Dev\Forge-Directory 1.12.2\run\logs\debug.log: Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus. [19:28:23] [main/INFO] [GradleStart]: Extra: [] [19:28:23] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/Rajo/.gradle/caches/minecraft/assets, --assetIndex, 1.12, --accessToken{REDACTED}, --version, 1.12.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [19:28:23] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [19:28:23] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [19:28:23] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [19:28:23] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [19:28:23] [main/INFO] [FML]: Forge Mod Loader version 14.23.5.2768 for Minecraft 1.12.2 loading [19:28:23] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_181, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre1.8.0_181 [19:28:23] [main/ERROR] [FML]: Apache Maven library folder was not in the format expected. Using default libraries directory. [19:28:23] [main/ERROR] [FML]: Full: C:\Users\Rajo\.gradle\caches\modules-2\files-2.1\org.apache.maven\maven-artifact\3.5.3\7dc72b6d6d8a6dced3d294ed54c2cc3515ade9f4\maven-artifact-3.5.3.jar [19:28:23] [main/ERROR] [FML]: Trimmed: c:/users/rajo/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/3.5.3/ [19:28:23] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [19:28:23] [main/INFO] [FML]: Detected deobfuscated environment, loading log configs for colored console logs. 2018-12-19 19:28:25,451 main WARN Disabling terminal, you're running in an unsupported environment. [19:28:25] [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 [19:28:25] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLForgePlugin (net.minecraftforge.classloading.FMLForgePlugin), we are in deobf and it's a forge core plugin [19:28:25] [main/INFO] [FML]: Searching C:\Users\Rajo\Desktop\Eno\Dev\Forge-Directory 1.12.2\run\.\mods for mods [19:28:25] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [19:28:25] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [19:28:25] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [19:28:25] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [19:28:25] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [19:28:25] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [19:28:25] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [19:28:25] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [19:28:25] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [19:28:29] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [19:28:29] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [19:28:29] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [19:28:30] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [19:28:30] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [19:28:30] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [19:28:30] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [19:28:31] [main/INFO] [minecraft/Minecraft]: Setting user: Player645 [19:28:37] [main/INFO] [minecraft/Minecraft]: LWJGL Version: 2.9.4 [19:28:38] [main/INFO] [FML]: -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_181, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 787851288 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: '3.1.0 - Build 9.17.10.4229' Renderer: 'Intel(R) HD Graphics 3000' [19:28:38] [main/INFO] [FML]: MinecraftForge v14.23.5.2768 Initialized [19:28:38] [main/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients. [19:28:39] [main/INFO] [FML]: Replaced 1036 ore ingredients [19:28:39] [main/INFO] [FML]: Searching C:\Users\Rajo\Desktop\Eno\Dev\Forge-Directory 1.12.2\run\.\mods for mods [19:28:41] [Thread-3/INFO] [FML]: Using sync timing. 200 frames of Display.update took 280912271 nanos [19:28:42] [main/INFO] [FML]: Forge Mod Loader has identified 5 mods to load [19:28:42] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, mapmakercommands] at CLIENT [19:28:42] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, mapmakercommands] at SERVER [19:28:43] [main/INFO] [minecraft/SimpleReloadableResourceManager]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Map Maker Commands + [19:28:43] [main/INFO] [FML]: Processing ObjectHolder annotations [19:28:43] [main/INFO] [FML]: Found 1168 ObjectHolder annotations [19:28:43] [main/INFO] [FML]: Identifying ItemStackHolder annotations [19:28:43] [main/INFO] [FML]: Found 0 ItemStackHolder annotations [19:28:43] [main/INFO] [FML]: Configured a dormant chunk cache size of 0 [19:28:43] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json [19:28:43] [main/INFO] [FML]: Applying holder lookups [19:28:43] [main/INFO] [FML]: Holder lookups applied [19:28:43] [main/INFO] [FML]: Applying holder lookups [19:28:43] [main/INFO] [FML]: Holder lookups applied [19:28:43] [main/INFO] [FML]: Applying holder lookups [19:28:43] [main/INFO] [FML]: Holder lookups applied [19:28:43] [main/INFO] [FML]: Applying holder lookups [19:28:43] [main/INFO] [FML]: Holder lookups applied [19:28:43] [main/INFO] [FML]: Injecting itemstacks [19:28:43] [main/INFO] [FML]: Itemstack injection complete [19:28:44] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: UP_TO_DATE Target: null [19:28:51] [Sound Library Loader/INFO] [minecraft/SoundManager]: Starting up SoundSystem... [19:28:52] [Thread-5/INFO] [minecraft/SoundManager]: Initializing LWJGL OpenAL [19:28:52] [Thread-5/INFO] [minecraft/SoundManager]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [19:28:52] [Thread-5/INFO] [minecraft/SoundManager]: OpenAL initialized. [19:28:52] [Sound Library Loader/INFO] [minecraft/SoundManager]: Sound engine started [19:29:05] [main/INFO] [FML]: Max texture size: 8192 [19:29:05] [main/INFO] [minecraft/TextureMap]: Created: 512x512 textures-atlas [19:29:10] [main/INFO] [FML]: Applying holder lookups [19:29:10] [main/INFO] [FML]: Holder lookups applied [19:29:10] [main/INFO] [FML]: Injecting itemstacks [19:29:10] [main/INFO] [FML]: Itemstack injection complete [19:29:10] [main/INFO] [FML]: Forge Mod Loader has successfully loaded 5 mods [19:29:10] [main/INFO] [mojang/NarratorWindows]: Narrator library for x64 successfully loaded [19:29:12] [Realms Notification Availability checker #1/INFO] [mojang/RealmsClient]: Could not authorize you against Realms server: Invalid session id [19:29:14] [Server thread/INFO] [minecraft/IntegratedServer]: Starting integrated minecraft server version 1.12.2 [19:29:14] [Server thread/INFO] [minecraft/IntegratedServer]: Generating keypair [19:29:14] [Server thread/INFO] [FML]: Injecting existing registry data into this server instance [19:29:15] [Server thread/INFO] [FML]: Applying holder lookups [19:29:15] [Server thread/INFO] [FML]: Holder lookups applied [19:29:15] [Server thread/INFO] [FML]: Loading dimension 0 (Yes) (net.minecraft.server.integrated.IntegratedServer@34548260) [19:29:17] [Server thread/INFO] [minecraft/AdvancementList]: Loaded 488 advancements [19:29:17] [Server thread/INFO] [FML]: Loading dimension -1 (Yes) (net.minecraft.server.integrated.IntegratedServer@34548260) [19:29:17] [Server thread/INFO] [FML]: Loading dimension 1 (Yes) (net.minecraft.server.integrated.IntegratedServer@34548260) [19:29:17] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing start region for level 0 [19:29:18] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 0% [19:29:19] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 25% [19:29:20] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 72% [19:29:20] [Server thread/ERROR] [FML]: A fatal exception occurred during the server starting event net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Map Maker Commands + (mapmakercommands) Caused by: java.lang.NullPointerException at net.minecraft.command.CommandHandler.registerCommand(CommandHandler.java:162) ~[forgeSrc-1.12.2-14.23.5.2768.jar:?] at net.minecraftforge.fml.common.event.FMLServerStartingEvent.registerServerCommand(FMLServerStartingEvent.java:59) ~[forgeSrc-1.12.2-14.23.5.2768.jar:?] at fr.eno.mmc.MapMakerCommandsBase.serverStarting(MapMakerCommandsBase.java:59) ~[bin/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181] at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:626) ~[forgeSrc-1.12.2-14.23.5.2768.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181] at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) ~[guava-21.0.jar:?] at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) ~[guava-21.0.jar:?] at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) ~[guava-21.0.jar:?] at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) ~[guava-21.0.jar:?] at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) ~[guava-21.0.jar:?] at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) ~[guava-21.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:217) ~[guava-21.0.jar:?] at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:218) ~[forgeSrc-1.12.2-14.23.5.2768.jar:?] at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:196) ~[forgeSrc-1.12.2-14.23.5.2768.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181] at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) ~[guava-21.0.jar:?] at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) ~[guava-21.0.jar:?] at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) ~[guava-21.0.jar:?] at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) ~[guava-21.0.jar:?] at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) ~[guava-21.0.jar:?] at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) ~[guava-21.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:217) ~[guava-21.0.jar:?] at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135) ~[LoadController.class:?] at net.minecraftforge.fml.common.Loader.serverStarting(Loader.java:794) [Loader.class:?] at net.minecraftforge.fml.common.FMLCommonHandler.handleServerStarting(FMLCommonHandler.java:297) [FMLCommonHandler.class:?] at net.minecraft.server.integrated.IntegratedServer.init(IntegratedServer.java:162) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:552) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_181] [19:29:21] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server [19:29:21] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players [19:29:21] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds [19:29:21] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Yes'/overworld [19:29:21] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Yes'/the_nether [19:29:21] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Yes'/the_end [19:29:21] [Server thread/INFO] [FML]: Unloading dimension 0 [19:29:21] [Server thread/INFO] [FML]: Unloading dimension -1 [19:29:21] [Server thread/INFO] [FML]: Unloading dimension 1 [19:29:22] [Server thread/INFO] [FML]: Applying holder lookups [19:29:22] [Server thread/INFO] [FML]: Holder lookups applied [19:29:22] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STARTING and forced into state SERVER_STOPPED. Errors may have been discarded. [19:29:34] [main/INFO] [minecraft/Minecraft]: Stopping! [19:29:34] [main/INFO] [minecraft/SoundManager]: SoundSystem shutting down... [19:29:35] [main/WARN] [minecraft/SoundManager]: Author: Paul Lamb, www.paulscode.com
-
Ta fonction getAliases renvoies null, ce qui cause un npe.
Il faut renvoyer une liste valide. -
merci ça marche maintenant !
Mais je n’arrive pas a trouver comment modifier le nom de l’item qui est dans la main,
j’ai essayer ça mais ça ne marche pas :public void execute(MinecraftServer server, ICommandSender sender, String[] strings) throws CommandException { if(sender instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) sender; String name = player.getActiveHand().MAIN_HAND.name(); player.inventory.getDisplayName().equals(name); } }
mais j’aimerais aussi pouvoir mettre le nom de couleur dans laquelle on veut le nom,
par exemple : /rename NomDelItem Couleur EnGras(true ou false)
Est ce que l’on peut le faire ? -
player.inventory.getDisplayName()
retourne le nom de l’inventaire et.equals
c’est une méthode qui permet de comparer deux objets.Donc là forcement oui, ton code ne va rien faire.
Il faut plutôt quelque chose comme ceci :
ItemStack stack = player.getHeldItem(EnumHand.MAIN_HAND); // obtient l'item dans la main principale stack.setStackDisplayName(displayName); // change le nom affiché
Pour récupérer les arguments tapés, c’est ta variable
strings
qui les contient.
strings[0]
-> le premier argument (NomDelItem dans l’exemple que tu as donné)
strings[1]
-> le deuxièmeargument (Couleur dans l’exemple que tu as donné)
etc…
Et il faut bien sur vérifier questrings.length
ait la bonne valeur avant d’utiliser le string à l’index voulu (sinon ça va déclencher uneArrayOutOfBoundException
-
yes merci ça marche
mais je n’arrive pas a ajouter la couleur :public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if(sender instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) sender; ItemStack stack = player.getHeldItem(EnumHand.MAIN_HAND); // obtient l'item dans la main principale TextFormatting color = TextFormatting.valueOf(args[1]); TextFormatting effect = TextFormatting.valueOf(args[2]); stack.setStackDisplayName(args[0]); // change le nom affiché } }
J’ai essayer avec le text formatting mais sans succès (ou alors je l’ai mal fait )
une idée ? -
Le couleur tu veux que l’utilisateur l’écrit avec quel format ? §1 §2 etc. ? ou RED, BLUE, etc. ?
-
plutot en red, blue, bold,obfuscated
j’aurais voulu additionner comme ça :
/rename [NomDel’Item] blue bold underline -
Pour ça va falloir faire une boucle qui pour chaque args vérifie s’il existe dans les EnumFormatting, et si oui retourner le texte de formatage qui va avec.
-
et je pourrais faire ça comment par exemple ?
-
Salut, c’est une opération assez simple :
def : style Pour i allant de 1 à (taille(args) - 1): Si args[i] dans valeurs(EnumFormatting) : def : format = récupérerEnumFormattingDepuisNom(args[i]) style.ajouterFormat(format)
Voilà, plus qu’à traduire cette logique en Java.
-
le truc c’est que je suis en train d’apprendre le java et donc je comprends pas trop ou plutot je ne sais pas comment le traduire en java
tu pourrais m’expliquer ? -
yo sinon tu utilise comme dans tout les plugins le caractere
&
dans le message ensuite tu le remplace par un§
et minecraft fait le formatage tout seul x)player.getHeldItemMainhand().setStackDisplayName(name.replace('&', '§'));
si tu comprends toujours pas comment faire passe sur le discord et je peux vocal pour plus d’explications x)