Hello. First of, I wanna say that I am a really bad noob in Forge development. I was developing Bukkit stuff previously. But I know basics of Java. So, this is mah code:
MainClass:
package com.timsworkshop.food;
import com.timsworkshop.food.init.ButcherKnifeClass;
import com.timsworkshop.food.init.Items;
import com.timsworkshop.food.proxy.CommonProxy;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
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;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.LanguageRegistry;
@Mod(modid = Info.MOD_ID, name = Info.MOD_NAME, version = Info.VERSION)
public class MainClass {
public static ToolMaterial bknife = EnumHelper.addToolMaterial("bknife", 0, 750, 3.0F, 2.0F, 10);
@SidedProxy(clientSide = Info.CLIENT_PROXY_CLASS, serverSide = Info.SERVER_PROXY_CLASS)
public static CommonProxy proxy;
@EventHandler
public void preInit(FMLPreInitializationEvent e){
Items.items();
Items.register();
Items.butcher_knife.setCreativeTab(CreativeTabs.tabCombat);
LanguageRegistry.addName(Items.butcher_knife, "Butcher Knife");
}
@EventHandler
public void init(FMLInitializationEvent e){
proxy.registerRenders();
}
@EventHandler
public void postInit(FMLPostInitializationEvent e){
}
}
Items.java:
package com.timsworkshop.food.init;
import com.timsworkshop.food.Info;
import com.timsworkshop.food.MainClass;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class Items {
//Items&ToolMaterials
public static Item butcher_knife;
public static void items(){
butcher_knife = new Item().setUnlocalizedName("butcher_knife");
}
public static void register(){
GameRegistry.registerItem(butcher_knife = new ButcherKnifeClass("butcher_knife", MainClass.bknife), butcher_knife.getUnlocalizedName().substring(5));
}
public static void registerRenders(){
registerRender(butcher_knife);
}
public static void registerRender(Item item){
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Info.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
}
And, ButcherKnifeClass:
package com.timsworkshop.food.init;
import net.minecraft.item.ItemSword;
public class ButcherKnifeClass extends ItemSword {
public ButcherKnifeClass(String butcher_knife, ToolMaterial material) {
super(material);
this.setUnlocalizedName("butcher_knife");
}
}
Everything working just fine. But...
Textures...
Here is the path for texture json file:
And, for actual texture:
Here, what i wrote in json file:
{
"parent": "builtin/generated",
"textures": {
"layer0": "cf:butcher_knife/butcher_knife"
},
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}
Everything should work just fine. No mistakes. As I thought
This is what happened when I start Minecraft:
[18:54:41] [Client thread/ERROR] [TEXTURE ERRORS]: The following texture errors were found.
[18:54:41] [Client thread/ERROR] [TEXTURE ERRORS]: ==================================================
[18:54:41] [Client thread/ERROR] [TEXTURE ERRORS]: DOMAIN cf
[18:54:41] [Client thread/ERROR] [TEXTURE ERRORS]: --------------------------------------------------
[18:54:41] [Client thread/ERROR] [TEXTURE ERRORS]: domain cf is missing 1 texture
[18:54:41] [Client thread/ERROR] [TEXTURE ERRORS]: domain cf has 1 location:
[18:54:41] [Client thread/ERROR] [TEXTURE ERRORS]: mod cf resources at T:\eclipse\Forge\bin
[18:54:41] [Client thread/ERROR] [TEXTURE ERRORS]: -------------------------
[18:54:41] [Client thread/ERROR] [TEXTURE ERRORS]: The missing resources for domain cf are:
[18:54:41] [Client thread/ERROR] [TEXTURE ERRORS]: textures/butcher_knife/butcher_knife.png
[18:54:41] [Client thread/ERROR] [TEXTURE ERRORS]: -------------------------
[18:54:41] [Client thread/ERROR] [TEXTURE ERRORS]: No other errors exist for domain cf
[18:54:41] [Client thread/ERROR] [TEXTURE ERRORS]: ==================================================
[18:54:41] [Client thread/ERROR] [TEXTURE ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
I am not sure what does it mean.
Pls halp ;o
Thanks, have a nice day!