Module used to create shaderpack entries that can be rendered into a table using Module:ShaderpackList.
Generic
Shaderpacks not backed by a data source may be created this way.
{{#invoke:ShaderpackListEntry|Generic
|arg1 = value1
|arg2 = value2
}}
Arguments
- name
- Required. Text.
- style
- Required. Text.
- performance_impact_level
- Required. Number.
- 0
- Potato
- 1
- Low
- 2
- Medium
- 3
- High
- 4
- Extreme
- 5
- Screenshots
- version
- Required. Text.
- last_update
- Required. Text.
- links
- Required. Text.
- drivers
- Required. Name of logos separated by spaces. Available: "nvidia", "amd", "intel", "apple", "tux", "m1".
- shader_loaders
- Required. Name of logos separated by spaces. Available: "iris", "of", "canvas", "vanilla", "focal".
- author
- Required. Text.
- min_mc_version
- Optional. Text.
- max_mc_version
- Required. Text.
Example
{{#invoke:ShaderpackListEntry|Generic
|name=Example
|style=[https://www.example.com/ Realistic]
|performance_impact_level=1
|version=0.4.2
|last_update=1990-01-01
|links=[https://www.example.com/ Website]
|drivers=nvidia amd intel apple tux m1
|shader_loaders=iris of canvas vanilla focal
|author=[https://www.example.com Joe]
|min_mc_version=1.14.4
|max_mc_version=1.20.1
}}
Modrinth
Shaderpacks that are available on Modrinth may be created this way.
{{#invoke:ShaderpackListEntry|Modrinth
|arg1 = value1
|arg2 = value2
}}
Arguments
- slug
- Required. Slug or ID of the project. Can be found in the URL (
https://modrinth.com/shader/<SLUG>
). - name
- Required. Text.
- style
- Required. Text.
- performance_impact_level
- Required. Number.
- 0
- Potato
- 1
- Low
- 2
- Medium
- 3
- High
- 4
- Extreme
- 5
- Screenshots
- version
- Optional. Text. Overrides value from API.
- last_update
- Optional. Text. Overrides value from API.
- links
- Required. Text.
- drivers
- Required. Name of logos separated by spaces. Available: "nvidia", "amd", "intel", "apple", "tux", "m1".
- shader_loaders
- Optional. Name of logos separated by spaces. Available: "iris", "of", "canvas", "vanilla", "focal". Overrides value from API.
- author
- Required. Text.
- min_mc_version
- Optional. Text. Overrides value from API.
- max_mc_version
- Optional. Text. Overrides value from API.
Example
{{#invoke:ShaderpackListEntry|Modrinth
|slug=example-pack
|name=Example
|style=[https://www.example.com/ Realistic]
|performance_impact_level=1
|links=[https://www.example.com/ Website]
|drivers=nvidia amd intel apple tux m1
|author=[https://www.example.com Joe]
}}
local entry = {}
local performance_impact_names = {'Potato', 'Low', 'Medium', 'High', 'Extreme', 'Screenshots'}
function get_performance_impact(level)
local data_sort_value = "data-sort-value=\"" .. level .. "\""
return data_sort_value .. ' | ' .. performance_impact_names[level + 1]
end
function get_mc_version(min_version, max_version)
local mc_version = max_version
if min_version ~= max_version then
mc_version = min_version .. ' - ' .. mc_version
end
return mc_version
end
function logo_template(frame, name)
return frame:expandTemplate { title = 'Logo', args = { name } }
end
function logo_template_list(frame, names)
local list = ''
for name in names.gmatch(names, "%S+") do
list = list .. ' ' .. logo_template(frame, name)
end
return list
end
function entry.Generic(frame)
local name = frame.args.name
local style = frame.args.style
local performance_impact = get_performance_impact(frame.args.performance_impact_level)
local version = frame.args.version
local last_update = frame.args.last_update
local links = frame.args.links
local drivers = logo_template_list(frame, frame.args.drivers)
local shader_loaders = logo_template_list(frame, frame.args.shader_loaders)
local author = frame.args.author
local min_mc_version = frame.args.min_mc_version or frame.args.max_mc_version
local max_mc_version = frame.args.max_mc_version
local mc_version = get_mc_version(min_mc_version, max_mc_version)
return mw.text.jsonEncode({ name, style, performance_impact, version, last_update, links, drivers, shader_loaders, author, mc_version }) .. ','
end
function entry.Modrinth(frame)
local version_data, version_errors = mw.ext.externalData.getExternalData {
source = 'modrinth',
slug = frame.args.slug
}
local name = frame.args.name
local style = frame.args.style
local performance_impact = get_performance_impact(frame.args.performance_impact_level)
local links = frame.args.links
local drivers = logo_template_list(frame, frame.args.drivers)
local author = frame.args.author
if version_errors then
return mw.text.jsonEncode({
name,
style,
performance_impact,
frame.args.version or 'N/A',
frame.args.last_update or 'N/A',
links,
drivers,
logo_template_list(frame, frame.args.shader_loaders or '') or 'N/A',
author,
get_mc_version(frame.args.min_mc_version or frame.args.max_mc_version or 'N/A', frame.args.max_mc_version or 'N/A')
}) .. ','
end
local latest_version = version_data.__json[1]
local version = frame.args.version or latest_version.version_number or 'N/A'
local last_update = frame.args.last_update or string.sub(latest_version.date_published, 1, 10) or 'N/A'
local shader_loaders = ''
if not frame.args.shader_loaders then
for i = 1,#latest_version.loaders do
local name = latest_version.loaders[i]
if name == "iris" then
shader_loaders = shader_loaders .. logo_template(frame, 'iris') .. ' '
elseif name == "optifine" then
shader_loaders = shader_loaders .. logo_template(frame, 'of') .. ' '
elseif name == "canvas" then
shader_loaders = shader_loaders .. logo_template(frame, 'canvas') .. ' '
elseif name == "vanilla" then
shader_loaders = shader_loaders .. logo_template(frame, 'vanilla') .. ' '
end
end
else
shader_loaders = logo_template_list(frame, frame.args.shader_loaders)
end
local min_mc_version = frame.args.min_mc_version or frame.args.max_mc_version or latest_version.game_versions[1] or 'N/A'
local max_mc_version = frame.args.max_mc_version or latest_version.game_versions[#latest_version.game_versions] or 'N/A'
local mc_version = get_mc_version(min_mc_version, max_mc_version)
return mw.text.jsonEncode({ name, style, performance_impact, version, last_update, links, drivers, shader_loaders, author, mc_version }) .. ','
end
return entry