Module:ItemToImageMap: Difference between revisions

From BTA-Mirror
imported>SunSeeker02
No edit summary
imported>SunSeeker02
No edit summary
(No difference)

Revision as of 17:21, 2 March 2023

Documentation for this module may be created at Module:ItemToImageMap/doc

local p = {}

function p.get( f )
	local args = require( 'Module:ProcessArgs' ).merge()
	local key = args.key
	local width = args.width or "16"
	local height = args.height or width
	local link = args.link or ""
	
	local map = {
		["Quiver"] = "File:Quiver.png",
		["Quartz"] = "File:Quartz.png",
		["Nether Coal"] = "File:Nether Coal.png",
		["Cloth"] = "File:Cloth.png",
		["Pebble"] = "File:Pebble.png",
		["Olivine"] = "File:Olivine.png",
		["Bucket of Ice Cream"] = "File:Bucket of Ice Cream.png",
		["Golden Arrow"] = "File:Golden Arrow.png",
		["Steel Ingot"] = "File:Steel Ingot.png",
		["Crude Steel"] = "File:Crude Steel.png",
		["Chainlinks"] = "File:Chainlinks.png",
		["Cherries"] = "File:Cherries.png",
		["Charcoal"] = "File:Charcoal.png",
		["Hand Cannon"] = "File:Hand Cannon.png",
		["Explosive Charge"] = "File:Explosive Charge.png",
		["Iron Nugget"] = "File:Iron Nugget.png",
		["Gold Nugget"] = "File:Gold Nugget.png",
		["Golden Quiver"] = "File:Golden Quiver.png",
		["Loaded Hand Cannon"] = "File:Loaded Hand Cannon.png",
		["Empty Quiver"] = "File:Empty Quiver.png",
		["Label"] = "File:Label.png",
		["Filled Label"] = "File:Filled Label.png",
		["Steel Helmet"] = "File:Steel Helmet.png",
		["Steel Chestplate"] = "File:Steel Chestplate.png",
		["Steel Leggings"] = "File:Steel Leggings.png",
		["Steel Boots"] = "File:Steel Boots.png",
		["Steel Sword"] = "File:Steel Sword.png",
		["Steel Pickaxe"] = "File:Steel Pickaxe.png",
		["Steel Axe"] = "File:Steel Axe.png",
		["Steel Shovel"] = "File:Steel Shovel.png",
		["Steel Hoe"] = "File:Steel Hoe.png",
		["Block of Quartz"] = "File:Block of Quartz (item).png",
		["Oak Log"] = "File:Grid Oak Log.png",
		["Block of Steel"] = "File:Grid Block of Steel.png",
		["Bow"] = "File:Grid Bow.png",
		["Block of Olivine"] = "File:Grid Block of Olivine.png",
		["Tinted Glass"] = "File:Tinted Glass.png",
		["Glass"] = "File:GlassMC.png",
		["Nether Coal Ore"] = "File:Nether Coal grid.png",
		["Block of Nether Coal"] = "File:Block of Nether Coal Render 1.7.6.1.png",
		["Blast Furnace"] = "File:Grid Blast Furnace.png",
		["Iron Ingot"] = "File:Iron Ingot.png"
	}
	
	if map[key] == nil then
		return "<strong class=\"error\">Item not found: " .. args.key .."</strong>"
	else
		return "<span class=\"pixelated sprite\" style=\"width:" .. width .. "px; height:" .. height .. "px;\">[[" .. map[key] .. "|link=" .. link .. "]]</span>"
	end
end

return p