Titleize displayed egg names
This commit is contained in:
parent
407eff6196
commit
7139c627d2
@ -1,4 +1,8 @@
|
|||||||
|
|
||||||
|
1.1
|
||||||
|
- Egg names are titleized & underscores are replaced with space.
|
||||||
|
|
||||||
|
|
||||||
1.0
|
1.0
|
||||||
- Made independent of any other mods or games.
|
- Made independent of any other mods or games.
|
||||||
- Renamed to "asm_spawneggs" (Another Spawneggs Mod).
|
- Renamed to "asm_spawneggs" (Another Spawneggs Mod).
|
||||||
|
15
api.lua
15
api.lua
@ -53,6 +53,19 @@ end
|
|||||||
asm.addEggRecipe = asm.registerEggRecipe
|
asm.addEggRecipe = asm.registerEggRecipe
|
||||||
|
|
||||||
|
|
||||||
|
local function formatTitle(s)
|
||||||
|
s = s:gsub("_", " ")
|
||||||
|
|
||||||
|
local t = {}
|
||||||
|
|
||||||
|
for m in (s .. " "):gmatch("(.-) ") do
|
||||||
|
local v = m:gsub("^%l", string.upper)
|
||||||
|
table.insert(t, v)
|
||||||
|
end
|
||||||
|
|
||||||
|
return table.concat(t, " ") .. " Spawn Egg"
|
||||||
|
end
|
||||||
|
|
||||||
--- Registers new egg in game.
|
--- Registers new egg in game.
|
||||||
--
|
--
|
||||||
-- Alias: *asm.addEgg*
|
-- Alias: *asm.addEgg*
|
||||||
@ -66,7 +79,7 @@ asm.registerEgg = function(def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
core.register_craftitem(":spawneggs:" .. def.name:lower(), {
|
core.register_craftitem(":spawneggs:" .. def.name:lower(), {
|
||||||
description = def.name:gsub("^%l", string.upper) .. " Spawn Egg",
|
description = formatTitle(def.name),
|
||||||
inventory_image = img,
|
inventory_image = img,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, target)
|
on_place = function(itemstack, placer, target)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user