Add possibility of setting a specific item amount in kitpvp.api.get_item_obj() & Added Elytrian kit
parent
1b78a1a0e5
commit
e48720103c
12
api.lua
12
api.lua
|
@ -33,10 +33,11 @@ function kitpvp.api.add_enchantments(itemstring, enchantments)
|
|||
return itemObj
|
||||
end
|
||||
|
||||
function kitpvp.api.get_item_obj(itemstring, enchantments)
|
||||
function kitpvp.api.get_item_obj(itemstring, count, enchantments)
|
||||
local obj = {}
|
||||
|
||||
obj.itemstring = itemstring
|
||||
obj.count = count
|
||||
obj.enchantments = enchantments
|
||||
|
||||
return obj
|
||||
|
@ -123,6 +124,11 @@ function kitpvp.api.give_kit(player, kitname)
|
|||
local item = itemobj.itemstring
|
||||
local itemstack = ItemStack(item)
|
||||
local enchantments = itemobj.enchantments
|
||||
|
||||
local count = itemobj.count
|
||||
|
||||
if count == 0 then count = 1 end
|
||||
|
||||
local final_item_obj
|
||||
|
||||
if enchantments ~= nil then
|
||||
|
@ -131,6 +137,8 @@ function kitpvp.api.give_kit(player, kitname)
|
|||
final_item_obj = itemstack
|
||||
end
|
||||
|
||||
kitpvp.api.give_to_player(player, final_item_obj)
|
||||
for i=1,count do
|
||||
kitpvp.api.give_to_player(player, final_item_obj)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
16
kits.lua
16
kits.lua
|
@ -59,3 +59,19 @@ kitpvp.api.register_kit({
|
|||
armor = "gold",
|
||||
armor_enchantments = {{fire_protection = 5}, {fire_protection = 5}, {fire_protection = 5}, {fire_protection = 5}}
|
||||
})
|
||||
|
||||
kitpvp.api.register_kit({
|
||||
name = "elytrian",
|
||||
items = {
|
||||
item("mcl_tools:sword_iron", 1, {sharpness = 1}),
|
||||
item("mcl_armor:elytra", 1),
|
||||
item("mcl_fireworks:rocket_3", 50),
|
||||
item("mcl_core:apple_gold", 1),
|
||||
item("mcl_farming:bread", 20),
|
||||
item("mcl_bows:bow", 1),
|
||||
item("mcl_bows:arrow", 20)
|
||||
},
|
||||
default_items = true,
|
||||
armor = "leather",
|
||||
armor_enchantments = {{protection = 1}, {protection = 1}, {protection = 1}, {protection = 1}}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue