LorenzoVulcan wrote:Are there any functions for getting and modifying a durability of an item?
Jordach wrote:LorenzoVulcan wrote:Are there any functions for getting and modifying a durability of an item?
Go look at http://github.com/RealBadAngel/technic that has a tool repair box that can fix tools.
Read the source from there.
for i=1,4 do
local item_stack=ItemStack(inv:get_stack("items", i))
if item_stack:get_name() == itemname then
if gen_energy >= energy_per_second then
item_stack:add_wear(energy_per_second)
gen_meta:set_int("energy",gen_energy-energy_per_second)
print(item_stack:get_wear())
end
end
endLorenzoVulcan wrote:Now it's all solved,but:Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
for i=1,4 do
local item_stack=ItemStack(inv:get_stack("items", i))
if item_stack:get_name() == itemname then
if gen_energy >= energy_per_second then
item_stack:add_wear(energy_per_second)
gen_meta:set_int("energy",gen_energy-energy_per_second)
print(item_stack:get_wear())
end
end
end
The wear doesn't change.
Anyway thanks all for your help :)
Users browsing this forum: No registered users and 4 guests