Jump to content

RedstoneMaster256

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by RedstoneMaster256

  1. 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.
  2. 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
  3. Thank you, I missed that. I feel kinda dumb now.... Do I have to mark this as closed or anything?
  4. 1.8.0_74 is a rather old version of Java. Perhaps try updating to a more recent 64-bit version of Java 8?
  5. 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.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.