下面列出了怎么用net.minecraft.util.InvalidIdentifierException的API类实例代码及写法,或者点击链接到github查看源代码。
private Item getItem(String id) throws CmdSyntaxError
{
try
{
return Registry.ITEM.get(new Identifier(id));
}catch(InvalidIdentifierException e)
{
throw new CmdSyntaxError("Invalid item: " + id);
}
}
private Identifier getItemIDFromField()
{
try
{
return new Identifier(itemNameField.getText().toLowerCase());
}catch(InvalidIdentifierException e)
{
return null;
}
}