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

时间:2016-08-27 23:00:36

标签: minecraft-forge

抱歉,我不确定我是否在正确的论坛或者我的措辞是否合适。人们可能会称之为含糊不清的东西。我不在乎。

无论如何,我在尝试某些事情后开始出现随机错误。结果并不顺利。这是我的主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)is。)

Syntax error on token "(", ; expected.

Syntax error on token ")", ; expected.

这就是我所能说的。提前谢谢。

1 个答案:

答案 0 :(得分:0)

在第37行,你关闭了支架。在所有GameRegistry.register

之后关闭它