为什么我使用 eclipse 在我的 Minecraft 1.7.10 mod 中出现随机错误?

Why am I getting random errors in my Minecraft 1.7.10 mod using eclipse?

抱歉,我不确定我是否在正确的论坛或我的措辞是否正确。人们可能会称其为模糊之类的。我才不管呢

无论如何,我在尝试一些事情后开始出现随机错误。结果不太好。这是我的主要 mod 文件的代码 + 错误。

package com.harry.MoStuff;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;

@Mod(modid = "ms", name = "Mo' Stuff", version = "a-1.0")
public class MoStuff {

public static Item itemRuby;
public static Item itemChain;
public static Item itemRubyEssence;
public static Item itemRubyShard;
public static Item itemRedBull;
public static Block blockRubyOre;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    //Item/block init and registering
    //Config handling
    itemRuby = new ItemRuby().setUnlocalizedName("ruby").setTextureName("ms:ruby");
    itemChain = new ItemChain().setUnlocalizedName("chain");
    blockRubyOre = new BlockRubyOre(Material.rock).setBlockName("ruby_ore").setBlockTextureName("ms:ruby_ore");
    itemRubyShard = new ItemRubyShard().setUnlocalizedName("ruby_shard");
    itemRubyEssence = new ItemRubyEssence().setUnlocalizedName("ruby_essence");
    itemRedBull = new ItemFood(8, 1.0F, true).setUnlocalizedName("red_bull").setTextureName("ms:red_bull");

    }
    GameRegistry.registerItem(itemRuby, itemRuby.getUnlocalizedName().substring(5));
    GameRegistry.registerItem(itemChain, itemChain.getUnlocalizedName().substring(5));
    GameRegistry.registerItem(itemRubyShard, itemRubyShard.getUnlocalizedName().substring(5));
    GameRegistry.registerItem(itemRubyEssence, itemRubyEssence.getUnlocalizedName().substring(5));
    GameRegistry.registerBlock(blockRubyOre, blockRubyOre.getUnlocalizedName().substring(5));
    GameRegistry.registerItem(itemRedBull, itemRedBull.getUnlocalizedName().substring(5));

    @EventHandler
    public void init(FMLInitializationEvent event) {
        //Proxy, tile entity, entity, GUI, packet reg.
        GameRegistry.addRecipe(new ItemStack(itemRuby), new Object[]{"RRR","RRR","RRR", 'R', itemRubyShard});
        GameRegistry.addRecipe(new ItemStack(itemChain), new Object[] {"III","I I","III", 'I', Items.iron_ingot});
        GameRegistry.addRecipe(new ItemStack(itemRubyEssence, 5), new Object[]{"   "," R ","   ", 'R', itemRuby});
    }

@EventHandler
public void postInit(FMLPostInitializationEvent event) {

}
}

错误是:

此行有多个标记(38,其中 GameRegistry.registerItem(itemRuby) 等等):

Syntax error on token ".", > expected.

Syntax error on token "(", < expected.

Syntax error on token ".", { expected.

Syntax error on token ")", delete this token.

此行有多个标记(46,其中 public void init(params) 是。)

Syntax error on token "(", ; expected.

Syntax error on token ")", ; expected.

此行有多个标记(54,其中 public void postInit(params) 是。)

Syntax error on token "(", ; expected.

Syntax error on token ")", ; expected.

我只能说这些了。提前致谢。

在第 37 行,您关闭了大括号。在你 GameRegistry.register

之后关闭它