RedstoneMaster256 Posted June 18, 2018 Share Posted June 18, 2018 (edited) I am not sure why, but my commands in the mod I am writing seem to not be registering properly. I have tried all sorts of things, including looking at prior functioning code and tutorials, but none of it is working. When I do /help, it is not listed there, nor is it listed when I press / then tab. Here is one of the commands, which generates and builds a maze by id. package dcn.mazegen.commands; import java.util.ArrayList; import java.util.List; import dcn.mazegen.Maze; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; public class CmdBuild extends CommandBase{ @Override public String getName() { return "buildmaze"; } @Override public String getUsage(ICommandSender sender) { return "buildmaze <id>"; } @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if(args.length == 0) { sender.sendMessage(new TextComponentString("Too few args")); return; } boolean found = false; for(Maze m : Maze.mazeList) { if(m.id.equals(args[0])) { found = true; sender.sendMessage(new TextComponentString("Generating maze....")); m.generate(); sender.sendMessage(new TextComponentString("Generated, building maze....")); m.build(); sender.sendMessage(new TextComponentString("Maze built.")); break; } } if(!found) sender.sendMessage(new TextComponentString("Could not find maze with id \"" + args[0] + "\".")); } } Here is the main class, with the @Mod annotation. package dcn.mazegen; import dcn.mazegen.commands.CmdBuild; import dcn.mazegen.commands.CmdMaze; 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.event.FMLServerStartingEvent; @Mod(modid = MazeGenerator.MODID, name = MazeGenerator.NAME, version = MazeGenerator.VERSION) public class MazeGenerator { public static final String MODID = "MazeGenerator"; public static final String NAME = "Maze Generator"; public static final String VERSION = "0.0"; @Instance public static MazeGenerator instance; @EventHandler public void onServerLoad(FMLServerStartingEvent e) { e.registerServerCommand(new CmdMaze()); e.registerServerCommand(new CmdBuild()); } } I am using Forge version 1.12.2 - 14.23.4.2705 and Java version 1.8.0_171. Edited June 18, 2018 by RedstoneMaster256 Adding code change Quote Link to comment Share on other sites More sharing options...
Terrails Posted June 18, 2018 Share Posted June 18, 2018 methods annotated with @EventHandler cannot be static Quote Link to comment Share on other sites More sharing options...
RedstoneMaster256 Posted June 18, 2018 Author Share Posted June 18, 2018 Thank you, I missed that. I feel kinda dumb now.... Do I have to mark this as closed or anything? Quote Link to comment Share on other sites More sharing options...
Terrails Posted June 18, 2018 Share Posted June 18, 2018 You could add [SOLVED] to the title but no need Quote Link to comment Share on other sites More sharing options...
RedstoneMaster256 Posted June 18, 2018 Author Share Posted June 18, 2018 (edited) Actually, in testing, it still isn't working. I changed the event handler to not be static. Edit: Figured it out I read through the logs and saw this line java.lang.IllegalArgumentException: The modId MazeGenerator must be all lowercase. Now I feel even dumber Edited June 18, 2018 by RedstoneMaster256 Solved it Quote Link to comment Share on other sites More sharing options...
Draco18s Posted June 18, 2018 Share Posted June 18, 2018 2 hours ago, RedstoneMaster256 said: Actually, in testing, it still isn't working. I changed the event handler to not be static. Edit: Figured it out I read through the logs and saw this line java.lang.IllegalArgumentException: The modId MazeGenerator must be all lowercase. Now I feel even dumber Do you need help with that error, or not? Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given. Link to comment Share on other sites More sharing options...
RedstoneMaster256 Posted June 18, 2018 Author Share Posted June 18, 2018 I figured it out. I had not realized mod ids had to be lower case, so the entire mod wasn't active. Since the mod so far only adds commands, I hadn't noticed. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.