物品在Minecraft mod中不起作用 - Minecraft Forge Mod Development [编辑:固定]

时间:2015-12-18 00:43:31

标签: java eclipse minecraft minecraft-forge

我已经开始制作一个mod,它没有注册为项目。当我输入/give Fidojj222 fcm:fuel_canister时,它应该给我项目,除非它说它不存在!我使用eclipse作为我的IDE我怀疑当我将它编译成jar时可能是这个警告:

JAR export finished with warnings. See details for additional information.
Can not export external class folder at 'C:\Users\J.J\.gradle\caches\minecraft\net\minecraftforge\forge\1.8-11.14.3.1450\start'.

如果这是问题所在,我该如何解决?如果不是这里是我的代码:

CarsMod.java:

package com.fidojj222.carsmod;

import com.fidojj222.carsmod.init.CarsItems;
import com.fidojj222.carsmod.proxy.CommonProxy;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version =     Reference.VERSION)
public class CarsMod {

    @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide =             Reference.SERVER_PROXY_CLASS)
    public static CommonProxy proxy;

    public void PreInit(FMLPreInitializationEvent event){
        CarsItems.init();
        CarsItems.register();
    }

    public void Init(FMLInitializationEvent event){
        proxy.registerRenders();
    }

    public void PostInit(FMLPostInitializationEvent event){

    }
}

Reference.java:

package com.fidojj222.carsmod;

public class Reference {
    public static final String MOD_ID = "fcm";
    public static final String MOD_NAME = "Fidojj222\'s Cars Mod";
    public static final String VERSION = "1.0";
    public static final String CLIENT_PROXY_CLASS = "com.fidojj222.carsmod.proxy.ClientProxy";
    public static final String SERVER_PROXY_CLASS = "com.fidojj222.carsmod.proxy.CommonProxy";
}

CarsItems.java:

package com.fidojj222.carsmod.init;

import com.fidojj222.carsmod.Reference;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class CarsItems {
    public static Item fuel_canister;

    public static void init(){
        fuel_canister = new Item().setUnlocalizedName("fuel_canister");
    }

    public static void register(){
        GameRegistry.registerItem(fuel_canister, fuel_canister.getUnlocalizedName().substring(5));
    }

    public static void registerRenders(){
        registerRender(fuel_canister);
    }

    public static void registerRender(Item item){
            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
    }
}

CommonProxy.java:

package com.fidojj222.carsmod.proxy;

public class CommonProxy {
    public void registerRenders(){

    }
}

ClientProxy.java:

package com.fidojj222.carsmod.proxy;

import com.fidojj222.carsmod.init.CarsItems;

public class ClientProxy extends CommonProxy {
    @Override
    public void registerRenders(){
        CarsItems.registerRenders();
    }
}

0 个答案:

没有答案