Added a conversion for legacy fireworks

This commit is contained in:
the-real-herowl 2024-12-31 03:04:36 +01:00
parent cd9cc8b492
commit 9e55cfed65
2 changed files with 14 additions and 1 deletions

@ -1,3 +1,3 @@
name = vl_fireworks
description = Adds fun fireworks to the game which players can use.
depends = vl_projectile
depends = vl_projectile, vl_legacy

@ -199,3 +199,16 @@ local firework_def = {
vl_fireworks.firework_def = table.copy(firework_def)
core.register_craftitem("vl_fireworks:rocket", firework_def)
-- legacy
for i=1, 3 do
vl_legacy.register_item_conversion("mcl_fireworks:rocket_"..i, nil, function(itemstack)
itemstack:set_name("vl_fireworks:rocket")
local meta = itemstack:get_meta()
local tbl = vl_fireworks.firework_def._vl_fireworks_std_durs_forces[i]
meta:set_float("vl_fireworks:duration", tbl[1])
meta:set_int("vl_fireworks:force", tbl[2])
tt.reload_itemstack_description(itemstack)
end)
end