2

I was following Powns' tutorial

https://www.youtube.com/watch?v=keDj9fvzigk

on how to make mods in Minecraft 1.8.9 Forge.

I did the exact same thing as him but when I ran it, it did not work. This has lead me to believe that it has to do with my JDK version. Except, he does not say which one he uses, what version should I use?

I have tried using the newest version and it does not work, I'm using 8u5 currently.

My code for the counter is

package me.BeastModeGamez.arrowCounter;

import net.minecraft.init.Blocks;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;

@Mod(modid = ArrowCounter.MODID, version = ArrowCounter.VERSION)
public class ArrowCounter
{
    public static final String MODID = "arrowCounter";
    public static final String VERSION = "1.0";

    @EventHandler
    public void init(FMLInitializationEvent event)
    {


    }
}

My code for the counterCommands is

package me.BeastModeGamez.arrowCounter.commands;

import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;

public class arrowCounterCommands extends CommandBase {

    @Override
    public String getCommandName() {
    return "arrowcounter";
    }

    @Override
    public String getCommandUsage(ICommandSender sender) {
        return "/" + getCommandName();
    }

    @Override
    public void processCommand(ICommandSender sender, String[] args) throws CommandException {
        sender.addChatMessage(new ChatComponentText("Test Command."));

    }

    @Override
    public int getRequiredPermissionLevel() {
        return 0;
    }

    @Override
    public boolean canCommandSenderUseCommand(final ICommandSender p_71519_1_) {
    return true;
    }

}

I hope to see the mod work, but instead it says unknown command. Something that I believe to be important are two warnings saying:

Description Resource Path Location Type The compiler compliance specified is 1.6 but a JRE 1.8 is used .org.eclipse.jdt.core.external.folders Compiler Compliance JRE Compiler Compliance Problem

and also

Description Resource Path Location Type The compiler compliance specified is 1.6 but a JRE 1.8 is used MDKExample Compiler Compliance JRE Compiler Compliance Problem

Also, in case you are wondering if the code won't work anymore, the video was made 3 weeks ago.

So, in conclusion, my question is: what is needed to fix this, and does it have to do with the JRE as it says in the warnings, or is my code incorrect, or do I need a newer JDK? And if I do have to change the JRE, how?

Edit: I have fixed both errors (and changed the jdk to an updated one) meaning it is most likely not software but instead, code, the error is now (not in problems - not shown) that every time I try to run the command it says unknown command.

BeastCoder
  • 2,391
  • 3
  • 15
  • 26

1 Answers1

3

You need Java 8

If you have more than one JDK installed you'll need to insure that Eclipse is pointed to the right one, but unless you're doing other Java development, you could just uninstall the other JDKs and install only the one you need. See this thread. Its often easier to just have the right version of the JDK than to use a newer one and target an older specification.

For reference, Minecraft 1.13 targets Java 9 and the Forge launcher is having to be rewritten to support that (see this thread).

However it looks like you have Eclipse set to target the Java 6 runtime, regardless of what JDK you have, and that's what's being complained about. See this question to resolve that.

Community
  • 1
  • 1