I had a few problems making the mod,
Who can help me with the answer?🤔
The first question is: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException
The second question is: java.lang.IllegalArgumentException
The third question is: java.io.FileNotFoundException: itnt:models/item/tnt_ball.json(My ModID is: itnt)
The file path is: zzzz.itnt.itnt.java
package zzzz.itnt;
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;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import org.apache.logging.log4j.Logger;
@Mod(modid = itnt.MODID, name = itnt.NAME, version = itnt.VERSION, acceptedMinecraftVersions = "[1.12,1.13)")
public class itnt
{
public static final String MODID = "itnt";
public static final String NAME = "Ikun tnt";
public static final String VERSION = "1.0";
private static Logger logger;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
logger = event.getModLog();
}
@EventHandler
public void init(FMLInitializationEvent event)
{
// some example code
logger.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
}
}
The file path is: zzzz.itnt.item.tntBall.java
package zzzz.itnt.item;
import net.minecraft.item.Item;
import zzzz.itnt.itnt;
public class tntBall extends Item {
public tntBall()
{
this.setUnlocalizedName(itnt.MODID+".dirtball");
this.setRegistryName("dirt_ball");
this.setMaxStackSize(16);
}
}
The file path is: zzzz.itnt.item.ItemRegistryHandler.java
package zzzz.itnt.item;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.event.RegistryEvent.Register;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.registries.IForgeRegistry;
@Mod.EventBusSubscriber
public class ItemRegistryHandler
{
public static final tntBall TNT_BALL = new tntBall();
@SubscribeEvent
public static void onRegistry(Register<Item> event)
{
IForgeRegistry<Item> registry = event.getRegistry();
registry.register(TNT_BALL);
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void onModelRegistery(ModelRegistryEvent event)
{
ModelLoader.setCustomModelResourceLocation(TNT_BALL,0,
new ModelResourceLocation(TNT_BALL.getRegistryName(),"inventory"));
}
}
And in the resources folder have:
resource\
assets\
itnt\
lang\
en_us.lang
zh_cn.lang
models\
item\
tnt_ball.json
(The tnt_ball.json code:
{
"parent": "item/generated",
"textures": {
"layer0": "dirtgy:items/dirtball"
}
}
)
textures\
items\
tnt_ball.png
mcmod.info
pack.mcmeta
(The mcmod.info code:
[
{
"modid": "Itnt",
"name": "Ikun tnt",
"description": "Ikun tnt mod",
"version": "${version}",
"mcversion": "${mcversion}",
"url": "",
"updateUrl": "",
"authorList": ["zzzz"],
"credits": "Ikun tnt, zzzz",
"logoFile": "",
"screenshots": [],
"dependencies": []
}
]
),
(The pack.mcmeta code:
{
"pack": {
"pack_format": 3,
"description": "Ikun tnt resources"
}
}
)
This is the code I wrote, who can help me to see where the problem?